From 6ee739905842f6e72a88697e527554ac03184dab Mon Sep 17 00:00:00 2001 From: oglog Date: Fri, 9 Aug 2019 17:33:40 +0200 Subject: [PATCH 01/19] Large TradeCache overhaul - Marketplaces are now united; Dai and xDai appear on the same page - Trade page now loads from cache if the trade is already loaded - web3 wallet network now only affects user when user wants to initiate some action - better management and knowledge of factory types --- docs/404.html | 2 +- docs/index.html | 2 +- docs/static/js/main-3387ac99f2d2877d5b65.js | 7 - docs/static/js/main-8b815b70735337f0c99f.js | 7 + src/AgentHistory/State.elm | 62 ++- src/AgentHistory/Types.elm | 20 +- src/AgentHistory/View.elm | 403 +++------------ src/{Helpers => }/ChainCmd.elm | 27 +- src/CommonTypes.elm | 48 +- src/Config.elm | 24 +- src/Contracts/Types.elm | 42 +- src/Contracts/Wrappers.elm | 56 +-- src/Create/State.elm | 107 ++-- src/Create/Types.elm | 30 +- src/Create/View.elm | 112 +++-- src/Helpers/Element.elm | 2 +- src/Helpers/Eth.elm | 120 +---- src/Helpers/Tuple.elm | 17 +- src/Marketplace/State.elm | 404 ++++++--------- src/Marketplace/Types.elm | 81 ++- src/Marketplace/View.elm | 483 +++++------------- src/QuickCreate/State.elm | 176 +++---- src/QuickCreate/Types.elm | 27 +- src/QuickCreate/View.elm | 35 +- src/Routing.elm | 92 ++-- src/State.elm | 459 ++++++++--------- src/Trade/ChatHistory/State.elm | 18 +- src/Trade/ChatHistory/Types.elm | 9 +- src/Trade/ChatHistory/View.elm | 7 +- src/Trade/State.elm | 195 +++++--- src/Trade/Types.elm | 20 +- src/Trade/View.elm | 519 ++++++++++---------- src/TradeCache/State.elm | 71 ++- src/TradeCache/Types.elm | 35 +- src/TradeTable/State.elm | 40 ++ src/TradeTable/Types.elm | 59 +++ src/TradeTable/View.elm | 357 ++++++++++++++ src/Types.elm | 32 +- src/View.elm | 88 +--- src/Wallet.elm | 98 ++++ 40 files changed, 2151 insertions(+), 2242 deletions(-) delete mode 100644 docs/static/js/main-3387ac99f2d2877d5b65.js create mode 100644 docs/static/js/main-8b815b70735337f0c99f.js rename src/{Helpers => }/ChainCmd.elm (63%) create mode 100644 src/TradeTable/State.elm create mode 100644 src/TradeTable/Types.elm create mode 100644 src/TradeTable/View.elm create mode 100644 src/Wallet.elm diff --git a/docs/404.html b/docs/404.html index 72ebefb..28cf5bd 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 72ebefb..28cf5bd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-3387ac99f2d2877d5b65.js b/docs/static/js/main-3387ac99f2d2877d5b65.js deleted file mode 100644 index f6adae3..0000000 --- a/docs/static/js/main-3387ac99f2d2877d5b65.js +++ /dev/null @@ -1,7 +0,0 @@ -!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/DAIHard/",t(t.s=43)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t,n,a,i){function o(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(l.isArrayBuffer(e)||l.isArrayBufferView(e))if(void 0!==i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(i=Date.now(),s(e)):(a.push(e),1===a.length&&u.setAttribute("a",o=!o))}}l.nextTick=l.setImmediate}(),l.isNodejs=void 0!==t&&t.versions&&t.versions.node,l.globalScope=function(){return l.isNodejs?a:"undefined"==typeof self?window:self}(),l.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},l.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},l.isArrayBufferView=function(e){return e&&l.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},l.ByteBuffer=u,l.ByteStringBuffer=u;l.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},l.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},l.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},l.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},l.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},l.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},l.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(l.encodeUtf8(e))},l.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},l.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},l.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},l.ByteStringBuffer.prototype.putInt=function(e,t){o(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},l.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},l.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},l.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},l.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},l.ByteStringBuffer.prototype.copy=function(){var e=l.createBuffer(this.data);return e.read=this.read,e},l.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},l.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},l.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},l.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},l.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},l.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},l.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},l.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},l.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},l.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},l.DataBuffer.prototype.putInt=function(e,t){o(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},l.DataBuffer.prototype.putSignedInt=function(e,t){return o(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},l.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},l.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},l.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},l.DataBuffer.prototype.copy=function(){return new l.DataBuffer(this)},l.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},l.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},l.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},l.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},l.xorBytes=function(e,t,r){for(var n="",a="",i="",o=0,u=0;r>0;--r,++o)a=e.charCodeAt(o)^t.charCodeAt(o),u>=10&&(n+=i,i="",u=0),i+=String.fromCharCode(a),++u;return n+=i},l.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";l.encode64=function(e,t){for(var r,n,a,i="",o="",u=0;u>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,a,i="",o=0;o>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==a&&(i+=String.fromCharCode((3&n)<<6|a)));return i},l.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},l.decodeUtf8=function(e){return decodeURIComponent(escape(e))},l.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:f.encode,decode:f.decode}},l.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},l.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var a,i,o,u,s=0,c=r;s>4,64!==o&&(n[c++]=(15&i)<<4|o>>2,64!==u&&(n[c++]=(3&o)<<6|u));return t?c-r:n.subarray(0,c)},l.binary.base58.encode=function(e,t){return l.binary.baseN.encode(e,p,t)},l.binary.base58.decode=function(e,t){return l.binary.baseN.decode(e,p,t)},l.text={utf8:{},utf16:{}},l.text.utf8.encode=function(e,t,r){e=l.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i0?(a=r[n].substring(0,o),i=r[n].substring(o+1)):(a=r[n],i=null),a in t||(t[a]=[]),a in Object.prototype||null===i||t[a].push(unescape(i))}return t};return void 0===e?(null===E&&(E="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=E):t=r(e),t},l.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var a=t.split("/");return a.length>0&&""===a[0]&&a.shift(),{pathString:t,queryString:r,path:a,query:""===r?{}:l.getQueryVariables(r)}},l.makeRequest=function(e){var t=l.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},l.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},l.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,a=t.length;n0&&i.push(r),o=n.lastIndex;var u=t[0][1];switch(u){case"s":case"o":a");break;case"%":i.push("%");break;default:i.push("<%"+u+"?>")}}return i.push(e.substring(o)),i.join("")},l.formatNumber=function(e,t,r,n){var a=e,i=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,u=void 0===n?".":n,s=a<0?"-":"",c=parseInt(a=Math.abs(+a||0).toFixed(i),10)+"",f=c.length>3?c.length%3:0;return s+(f?c.substr(0,f)+u:"")+c.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+u)+(i?o+Math.abs(a-c).toFixed(i).slice(2):"")},l.formatSize=function(e){return e=e>=1073741824?l.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?l.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?l.formatNumber(e/1024,0)+" KiB":l.formatNumber(e,0)+" bytes"},l.bytesFromIP=function(e){return-1!==e.indexOf(".")?l.bytesFromIPv4(e):-1!==e.indexOf(":")?l.bytesFromIPv6(e):null},l.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=l.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(i)}if(r.length>0){var s=r[n];s.end-s.start>0&&(t.splice(s.start,s.end-s.start+1,""),0===s.start&&t.unshift(""),7===s.end&&t.push(""))}return t.join(":")},l.estimateCores=function(e,t){function r(e,o,u){if(0===o){var s=Math.floor(e.reduce(function(e,t){return e+t},0)/e.length);return l.cores=Math.max(1,s),URL.revokeObjectURL(i),t(null,l.cores)}n(u,function(t,n){e.push(a(u,n)),r(e,o-1,u)})}function n(e,t){for(var r=[],n=[],a=0;au.st&&a.sta.st&&u.st0)return l.cores=navigator.hardwareConcurrency,t(null,l.cores);if("undefined"==typeof Worker)return l.cores=1,t(null,l.cores);if("undefined"==typeof Blob)return l.cores=2,t(null,l.cores);var i=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}function a(e,t,r,i){var s;n(e,t,2);var c=e.getByte();t--;var f=192&c,l=31&c;s=e.length();var d=u(e,t);if(t-=s-e.length(),void 0!==d&&d>t){if(i.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=e.length(),h.remaining=t,h.requested=d,h}d=t}var p,g,v=32==(32&c);if(v)if(p=[],void 0===d)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}s=e.length(),p.push(a(e,t,r+1,i)),t-=s-e.length()}else for(;d>0;)s=e.length(),p.push(a(e,d,r+1,i)),t-=s-e.length(),d-=s-e.length();if(void 0===p&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&(g=e.bytes(d)),void 0===p&&i.decodeBitStrings&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&d>1){var y=e.read,m=t,b=0;if(l===o.Type.BITSTRING&&(n(e,t,1),b=e.getByte(),t--),0===b)try{s=e.length();var C={verbose:i.verbose,strict:!0,decodeBitStrings:!0},S=a(e,t,r+1,C),E=s-e.length();t-=E,l==o.Type.BITSTRING&&E++;var T=S.tagClass;E!==d||T!==o.Class.UNIVERSAL&&T!==o.Class.CONTEXT_SPECIFIC||(p=[S])}catch(e){}void 0===p&&(e.read=y,t=m)}if(void 0===p){if(void 0===d){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=t}if(l===o.Type.BMPSTRING)for(p="";d>0;d-=2)n(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(d)}var w=void 0===g?null:{bitStringContents:g};return o.create(f,l,v,p,w)}var i=r(0);r(1),r(6);var o=e.exports=i.asn1=i.asn1||{};o.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},o.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},o.create=function(e,t,r,n,a){if(i.util.isArray(n)){for(var u=[],s=0;s1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?n.putBytes(e.value.substr(1)):n.putBytes(e.value);if(t.putByte(r),n.length()<=127)t.putByte(127&n.length());else{var s=n.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);t.putByte(128|c.length);for(var u=c.length-1;u>=0;--u)t.putByte(c.charCodeAt(u))}return t.putBuffer(n),t},o.oidToDer=function(e){var t=e.split("."),r=i.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var n,a,o,u,s=2;s>>=7,n||(u|=128),a.push(u),n=!1}while(o>0);for(var c=a.length-1;c>=0;--c)r.putByte(a[c])}return r},o.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)r=e.getByte(),n<<=7,128&r?n+=127&r:(t+="."+(n+r),n=0);return t},o.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),u=0;if(e.length>11){var s=e.charAt(10),c=10;"+"!==s&&"-"!==s&&(u=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,0),c&&("+"===(s=e.charAt(c))||"-"===s)){var f=parseInt(e.substr(c+1,2),10),l=parseInt(e.substr(c+4,2),10),d=60*f+l;d*=6e4,"+"===s?t.setTime(+t-d):t.setTime(+t+d)}return t},o.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),u=parseInt(e.substr(12,2),10),s=0,c=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var l=e.length-5,d=e.charAt(l);if("+"===d||"-"===d){c=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10),c*=6e4,"+"===d&&(c*=-1),f=!0}return"."===e.charAt(14)&&(s=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,s),t.setTime(+t+c)):(t.setFullYear(r,n,a),t.setHours(i,o,u,s)),t},o.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},o.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},o.validate=function(e,t,r,n){var a=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(a=!0,t.value&&i.util.isArray(t.value))for(var u=0,s=0;a&&s0&&(n+="\n");for(var a="",u=0;u1?n+="0x"+i.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?n+=" (1 unused bit shown)":d>1&&(n+=" ("+d+" unused bits shown)")}}else e.type===o.Type.OCTETSTRING?(s.test(e.value)||(n+="("+e.value+") "),n+="0x"+i.util.bytesToHex(e.value)):e.type===o.Type.UTF8?n+=i.util.decodeUtf8(e.value):e.type===o.Type.PRINTABLESTRING||e.type===o.Type.IA5String?n+=e.value:s.test(e.value)?n+="0x"+i.util.bytesToHex(e.value):0===e.value.length?n+="[null]":n+=e.value}return n}},function(e,t,r){var n=r(0);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){function n(e,t){var r=function(){return new s.aes.Algorithm(e,t)};s.cipher.registerAlgorithm(e,r)}function a(){p=!0,l=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;c=new Array(256),f=new Array(256),d=new Array(4),h=new Array(4);for(var t=0;t<4;++t)d[t]=new Array(256),h[t]=new Array(256);for(var r,n,a,i,o,u,s,g=0,v=0,t=0;t<256;++t){i=v^v<<1^v<<2^v<<3^v<<4,i=i>>8^255&i^99,c[g]=i,f[i]=g,o=e[i],r=e[g],n=e[r],a=e[n],u=o<<24^i<<16^i<<8^i^o,s=(r^n^a)<<24^(g^a)<<16^(g^n^a)<<8^g^r^a;for(var y=0;y<4;++y)d[y][g]=u,h[y][i]=s,u=u<<24|u>>>8,s=s<<24|s>>>8;0===g?g=v=1:(g=r^e[e[e[r^a]]],v^=e[e[v]])}}function i(e,t){for(var r,n=e.slice(0),a=1,i=n.length,o=i+6+1,u=g*o,s=i;s>>16&255]<<24^c[r>>>8&255]<<16^c[255&r]<<8^c[r>>>24]^l[a]<<24,a++):i>6&&s%i==4&&(r=c[r>>>24]<<24^c[r>>>16&255]<<16^c[r>>>8&255]<<8^c[255&r]),n[s]=n[s-i]^r;if(t){var f,d=h[0],p=h[1],v=h[2],y=h[3],m=n.slice(0);u=n.length;for(var s=0,b=u-g;s>>24]]^p[c[f>>>16&255]]^v[c[f>>>8&255]]^y[c[255&f]];n=m}return n}function o(e,t,r,n){var a,i,o,u,s,l=e.length/4-1;n?(a=h[0],i=h[1],o=h[2],u=h[3],s=f):(a=d[0],i=d[1],o=d[2],u=d[3],s=c);var p,g,v,y,m,b,C;p=t[0]^e[0],g=t[n?3:1]^e[1],v=t[2]^e[2],y=t[n?1:3]^e[3];for(var S=3,E=1;E>>24]^i[g>>>16&255]^o[v>>>8&255]^u[255&y]^e[++S],b=a[g>>>24]^i[v>>>16&255]^o[y>>>8&255]^u[255&p]^e[++S],C=a[v>>>24]^i[y>>>16&255]^o[p>>>8&255]^u[255&g]^e[++S],y=a[y>>>24]^i[p>>>16&255]^o[g>>>8&255]^u[255&v]^e[++S],p=m,g=b,v=C;r[0]=s[p>>>24]<<24^s[g>>>16&255]<<16^s[v>>>8&255]<<8^s[255&y]^e[++S],r[n?3:1]=s[g>>>24]<<24^s[v>>>16&255]<<16^s[y>>>8&255]<<8^s[255&p]^e[++S],r[2]=s[v>>>24]<<24^s[y>>>16&255]<<16^s[p>>>8&255]<<8^s[255&g]^e[++S],r[n?1:3]=s[y>>>24]<<24^s[p>>>16&255]<<16^s[g>>>8&255]<<8^s[255&v]^e[++S]}function u(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="AES-"+r;t=e.decrypt?s.cipher.createDecipher(n,e.key):s.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof s.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var s=r(0);r(15),r(23),r(1),e.exports=s.aes=s.aes||{},s.aes.startEncrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!1,mode:n});return a.start(t),a},s.aes.createEncryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!1,mode:t})},s.aes.startDecrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!0,mode:n});return a.start(t),a},s.aes.createDecryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!0,mode:t})},s.aes.Algorithm=function(e,t){p||a();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return o(r._w,e,t,!1)},decrypt:function(e,t){return o(r._w,e,t,!0)}}}),r._init=!1},s.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(s.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=s.util.createBuffer();for(var n=0;n>>=2;for(var n=0;n65&&-1!==o){var u=t[o];","===u?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+u+t.substr(o+1),i=a-o-1,o=-1,++a}else" "!==t[a]&&"\t"!==t[a]&&","!==t[a]||(o=a);return t}function a(e){return e.replace(/^\s+/,"")}var i=r(0);r(1);var o=e.exports=i.pem=i.pem||{};o.encode=function(e,t){t=t||{};var r,a="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=n(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=n(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=n(r)),e.headers)for(var o=0;ot.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),a=n.util.createBuffer(),c=o.length();for(var s=0;s=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,s=e.h4,f=0;f<16;++f)n=r.getInt32(),t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<20;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<32;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<40;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<60;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i&o|u&(i^o),n=(a<<5|a>>>27)+c+s+2400959708+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<80;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+3395469782+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,e.h4=e.h4+s|0,l-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=o,o.create=function(){s||n();var e=null,t=i.util.createBuffer(),r=new Array(80),o={algorithm:"sha1",blockLength:64,digestLength:20,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};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},o};var u=null,s=!1},function(e,t,r){"use strict";(function(e){function n(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),i.alloc(+e)}function v(e,t){if(i.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(n)return j(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return $(this,t,r);case"base64":return B(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,a){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:C(e,t,r,n,a);if("number"==typeof t)return t&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):C(e,[t],r,n,a);throw new TypeError("val must be string, number or Buffer")}function C(e,t,r,n,a){function i(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,u=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,u/=2,s/=2,r/=2}var c;if(a){var f=-1;for(c=r;cu&&(r=u-s),c=r;c>=0;c--){for(var l=!0,d=0;da&&(n=a):n=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(a+u<=r){var s,c,f,l;switch(u){case 1:i<128&&(o=i);break;case 2:s=e[a+1],128==(192&s)&&(l=(31&i)<<6|63&s)>127&&(o=l);break;case 3:s=e[a+1],c=e[a+2],128==(192&s)&&128==(192&c)&&(l=(15&i)<<12|(63&s)<<6|63&c)>2047&&(l<55296||l>57343)&&(o=l);break;case 4:s=e[a+1],c=e[a+2],f=e[a+3],128==(192&s)&&128==(192&c)&&128==(192&f)&&(l=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&f)>65535&&l<1114112&&(o=l)}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),a+=u}return N(n)}function N(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var a="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,a,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function D(e,t,r,n){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-r,2);a>>8*(n?a:1-a)}function U(e,t,r,n){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-r,4);a>>8*(n?a:3-a)&255}function O(e,t,r,n,a,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,a){return a||O(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,a){return a||O(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(e,t,r,n,52,8),r+8}function V(e){if(e=K(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function K(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function j(e,t){t=t||1/0;for(var r,n=e.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(e){for(var t=[],r=0;r>8,a=r%256,i.push(a),i.push(n);return i}function z(e){return J.toByteArray(V(e))}function Y(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function W(e){return e!==e}/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return 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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r,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,ka(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return T(e,"Dict")+B(e,".fromList")+" "+S(e,Aa(t));if("Array_elm_builtin"===r)return T(e,"Array")+B(e,".fromList")+" "+S(e,Ta(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=ka(e),t=ka(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Aa(e),t=Aa(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 Ma(n)?n:li(f(gi,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(!Ma(n))return li(f(pi,o,n.a));i=M(L(o,n.a),i)}return di(xa(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&&vt(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 vt(r,0,n,t):((h?mt(l,d):l===d)||vt(r,2,n,d),void yt(p,g,r,n+1));case 0:return void(e.a!==t.a&&vt(r,3,n,t.a));case 1:return void bt(e,t,r,n,St);case 2:return void bt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void vt(r,0,n,t);var v=Ct(e.d,t.d);v&&vt(r,4,n,v);var y=t.i(e.g,t.g);return void(y&&vt(r,5,n,y))}}}function mt(e,t){for(var r=0;ru?vt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&&vt(r,8,n,{w:a,x:o,y:k})}function Tt(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 yt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}Tt(e,t,r+Pn,n,a,i)}function wt(e,t,r,n,a){var i=e[r];if(!i){var o=vt(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 yt(n,i.z,u,a),void vt(t,9,a,{w:u,A:i})}wt(e,t,r+Pn,n,a)}function It(e,t,r,n){At(e,t,r,0,0,t.b,n)}function At(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)It(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&At(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&&At(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 At(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 Bt(e,t,r,n){return 0===r.length?e:(It(e,t,r,n),kt(e,r))}function kt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(Uh,o,function(e){return ci(Oh(e)?u+", "+e.a:u)},t)}}return t}function Kt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Be(f(Fh,e,L(r,Gh({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Be(f(Fh,e,L(r,qh({received:n.loaded,size:n.lengthComputable?ci(n.total):fi}))))})}function Ht(e,t){function r(){n=1===n?0:(aa(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&aa(r),n=2)}}function jt(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(qt()))};return na({setup:function(e){return a.a=e,sa.addEventListener("popstate",a),sa.navigator.userAgent.indexOf("Trident")<0||sa.addEventListener("hashchange",a),r(function(t,r){if(!r.ctrlKey&&!r.metaKey&&!r.shiftKey&&r.button<1&&!t.target&&!t.hasAttribute("download")){r.preventDefault();var a=t.href,i=qt(),o=Eg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?fg(o):cg(a)))}})},init:function(t){return l(e.init,t,qt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function qt(){return Eg(Sn.location.href).a||N(1)}function Gt(e,t){return Ie(function(r){aa(function(){var n=document.getElementById(e);r(n?Te(t(n)):we(lg(e)))})})}function zt(e){return Ie(function(t){aa(function(){t(Te(e()))})})}function Yt(){return{scene:Wt(),viewport:{x:sa.pageXOffset,y:sa.pageYOffset,width:ua.documentElement.clientWidth,height:ua.documentElement.clientHeight}}}function Wt(){var e=ua.body,t=ua.documentElement;return{width:Math.max(e.scrollWidth,e.offsetWidth,t.scrollWidth,t.offsetWidth,t.clientWidth),height:Math.max(e.scrollHeight,e.offsetHeight,t.scrollHeight,t.offsetHeight,t.clientHeight)}}function Jt(e){return Gt(e,function(e){var t=e.getBoundingClientRect(),r=sa.pageXOffset,n=sa.pageYOffset;return{scene:Wt(),viewport:{x:r,y:n,width:ua.documentElement.clientWidth,height:ua.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Qt(e){return f(hg,dg,Ie(function(t){try{sa.location=e}catch(e){Sn.location.reload(!1)}}))}function Xt(e){try{return ci(decodeURIComponent(e))}catch(e){return fi}}function Zt(){return f(yo,Pa(Vs),f(yo,Es,Fs))}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?Ca:r?wa:ba})),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===ba?0:n===Ca?-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})),Mn=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Fn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Vn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Kn=a(function(e,t,r,n){return e.setUint16(t,r,n),t+2}),Hn=a(function(e,t,r,n){return e.setUint32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),qn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),Gn=n(function(e,t,r){for(var n=0,a=r.byteLength,i=a-4;n<=i;n+=4)e.setUint32(t+n,r.getUint32(n));for(;n>>6&31)<<8|63&a),2):a<55296||56319>>12&15)<<8|a>>>6&63),e.setUint8(t+2,128|63&a),3):(a=1024*(a-55296)+r.charCodeAt(++n)-56320+65536,e.setUint32(t,4034953344|(a>>>18&7)<<24|(a>>>12&63)<<16|(a>>>6&63)<<8|63&a),4)}return t}),Yn=r(function(e,t){try{return ci(f(e,t,0).b)}catch(e){return fi}}),Wn=(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))})),Jn=(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))})),Qn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?ci(l):fi}a.push(d(gd,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?ci(o):fi}return r(d(gd,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(jh)}),i.addEventListener("timeout",function(){a(zh)}),i.addEventListener("load",function(){a(Mt(r.expect.b,i))}),Oh(r.tracker)&&Kt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(Kh(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=_t(i);return Ht(r,function(e){var r=a(e),n=gt(o,r);i=Bt(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=Sn.title,o=Sn.body,u=_t(o);return Ht(r,function(e){er=n;var r=a(e),s=Tn("body")(mr)(r.body),c=gt(u,s);o=Bt(o,u,c,t),u=s,er=0,i!==r.title&&(Sn.title=i=r.title)})})})),aa=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),ia=(r(function(e,t){return f(hg,dg,Ie(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(hg,dg,Ie(function(){history.pushState({},"",t),e()}))})),oa=(r(function(e,t){return f(hg,dg,Ie(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),ua="undefined"!=typeof document?document:oa,sa="undefined"!=typeof window?window:oa,ca=(n(function(e,t,r){return ke(Ie(function(n){function a(e){Be(r(e))}return e.addEventListener(t,a,tr&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=le(e,t);return Ma(r)?ci(r.a):fi}),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=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),da=function(e){return{$:"GTag",a:e}},ha=function(e){return{$:"GotoRoute",a:e}},pa={$:"RequestBrowserNotificationPermission"},ga=function(e){return{$:"UserNotice",a:e}},va={$:"Web3Connect"},ya=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ma=r(function(e,t){return t(e)}),ba={$:"EQ"},Ca={$:"LT"},Sa=cr,Ea=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(Sa,o,r,n)}var a=t.a;return l(Sa,e,r,a)});return l(Sa,o,l(Sa,e,t,i),a)}),Ta=function(e){return l(Ea,Na,mr,e)},wa={$:"GT"},Ia=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(Ia,e,t,o)),c=i;e=u,t=s,r=c}}),Aa=function(e){return l(Ia,n(function(e,t,r){return f(Na,L(e,t),r)}),mr,e)},Ba=function(e){return l(Ia,n(function(e,t,r){return f(Na,e,r)}),mr,e)},ka=function(e){var t=e.a;return Ba(t)},Na=br,Ra=Tr,$a=n(function(e,t,r){for(;;){if(!r.b)return t;var n=r.a,a=r.b,i=e,o=f(e,n,t),u=a;e=i,t=o,r=u}}),xa=function(e){return l($a,Na,mr,e)},_a=a(function(e,t,r,n){if(n.b){var a=n.a,i=n.b;if(i.b){var o=i.a,u=i.b;if(u.b){var s=u.a,c=u.b;if(c.b){var h=c.a,p=c.b;return f(e,a,f(e,o,f(e,s,f(e,h,r>500?l($a,e,t,xa(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),Pa=r(function(e,t){return l(La,r(function(t,r){return f(Na,e(t),r)}),mr,t)}),Da=r(function(e,t){return e(t)}),Ua=n(function(e,t,r){return e(t(r))}),Oa=function(e){return e},Ma=function(e){return"Ok"===e.$},Fa=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Va=$r,Ka=r(function(e,t){return Lr(t)/Lr(e)}),Ha=K,ja=Va(f(Ka,2,32)),qa=rr,Ga=d(Fa,0,ja,qa,qa),za=function(e){return{$:"Leaf",a:e}},Ya=function(e){return{$:"SubTree",a:e}},Wa=ar,Ja=r(function(e,t){for(;;){var r=f(Wa,32,e),n=r.a,a=r.b,i=f(Na,Ya(n),t);if(!a.b)return xa(i);var o=a,u=i;e=o,t=u}}),Qa=hr,Xa=function(e){return e.a},Za=r(function(e,t){for(;;){var r=Va(t/32);if(1===r)return f(Wa,32,e).a;var n=f(Ja,e,mr),a=r;e=n,t=a}}),ei=xr,ti=r(function(e,t){return _(e,t)>0?e:t}),ri=Ir,ni=wr,ai=m,ii=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=ei(f(Ka,32,r-1)),a=e?xa(t.nodeList):t.nodeList,i=f(Za,a,t.nodeListSize);return d(Fa,ai(t.tail)+r,f(ti,5,n*ja),i,t.tail)}return d(Fa,ai(t.tail),ja,qa,t.tail)}),oi=nr,ui=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ii,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=za(l(oi,32,t,e)),o=e,u=t-32,s=r,c=f(Na,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),si=r(function(e,t){if(e<=0)return Ga;var r=e%32,n=l(oi,r,e-r,t);return h(ui,t,e-r-32,e,mr,n)}),ci=function(e){return{$:"Just",a:e}},fi={$:"Nothing"},li=function(e){return{$:"Err",a:e}},di=function(e){return{$:"Ok",a:e}},hi=r(function(e,t){return{$:"Failure",a:e,b:t}}),pi=r(function(e,t){return{$:"Field",a:e,b:t}}),gi=r(function(e,t){return{$:"Index",a:e,b:t}}),vi=function(e){return{$:"OneOf",a:e}},yi=yr,mi=j,bi=function(e){var t=mi(e);return 97<=t&&t<=122},Ci=function(e){var t=mi(e);return t<=90&&65<=t},Si=function(e){return bi(e)||Ci(e)},Ei=function(e){var t=mi(e);return t<=57&&48<=t},Ti=function(e){return bi(e)||Ci(e)||Ei(e)},wi=function(e){return l($a,r(function(e,t){return t+1}),0,e)},Ii=Cr,Ai=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(Na,t,r);e=n,t=a,r=i}}),Bi=r(function(e,t){return l(Ai,e,t,mr)}),ki=r(function(e,t){return l(Ii,e,f(Bi,0,wi(t)-1),t)}),Ni=Kr,Ri=Z,$i=r(function(e,t){return f(Fr,e,V(t))}),xi=z,_i=r(function(e,t){return F(f(Mr,e,t))}),Li=function(e){return f($i,"\n ",f(_i,"\n",e))},Pi=on,Di=r(function(e,t){return"\n\n("+Ri(e+1)+") "+Li(Ui(t))}),Ui=function(e){return f(Oi,e,mr)},Oi=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=xi(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Si(n)&&f(Ni,Ti,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(Na,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ri(s)+"]",o=n,u=f(Na,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($i,"",xa(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ri(wi(l))+" ways:";return f($i,"\n\n",f(Na,h,f(ki,Di,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($i,"",xa(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f($i,"",xa(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(Pi,4,g))+"\n\n")+p}}),Mi=en,Fi=tn,Vi=ae,Ki=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Hi=An,ji={$:"Empty"},qi=function(e){return{$:"Styled",a:e}},Gi=function(e){return{$:"Text",a:e}},zi=function(e){return{$:"Unstyled",a:e}},Yi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return qi({html:r(function(t,r){return f(Hi,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return zi(f(Ua,Hi(e),a));case"Text":var i=t.a;return Gi(i);default:return ji}}),Wi=Yi,Ji=r(function(e,t){return d(ya,t.noticeType,f(Pa,Pa(Wi(e)),t.mainParagraphs),t.align,t.label)}),Qi=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return ga(f(Ji,e,r));case"Web3Connect":return va;case"GotoRoute":var n=t.a;return ha(n);case"GTag":var a=t.a;return da(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(la,i,o,u);default:return pa}}),Xi=r(function(e,t){return f(Pa,Qi(e),t)}),Zi=function(e){return{$:"Native",a:e}},eo={$:"XDai"},to={$:"EthDai"},ro={$:"KovanDai"},no=function(e){return{$:"Token",a:e}},ao=function(e){e:for(;;)switch(e.$){case"Mainnet":return ci(no(to));case"Kovan":return ci(no(ro));case"Private":if(100===e.a)return ci(Zi(eo));break e;default:break e}return fi},io={$:"ETCMain"},oo={$:"ETCTest"},uo={$:"Expanse"},so={$:"Kovan"},co={$:"Mainnet"},fo=function(e){return{$:"Private",a:e}},lo={$:"Rinkeby"},ho={$:"Ropsten"},po={$:"RskMain"},go={$:"RskTest"},vo=function(e){switch(e){case 1:return co;case 2:return uo;case 3:return ho;case 4:return lo;case 30:return po;case 31:return go;case 42:return so;case 41:return io;case 62:return oo;default:return fo(e)}},yo=n(function(e,t,r){return t(e(r))}),mo=f(yo,vo,ao),bo=n(function(e,t,r){return{factoryType:e,httpProvider:t,wsProvider:r}}),Co=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return l(bo,e,"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://mainnet.infura.io/ws")}e.a;return l(bo,e,"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://kovan.infura.io/ws")}switch(e.a.$){case"Eth":e.a;return l(bo,e,"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://mainnet.infura.io/ws");case"Kovan":e.a;return l(bo,e,"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9","wss://kovan.infura.io/ws");default:e.a;return l(bo,e,"https://dai.poa.network","")}},So=r(function(e,t){return t.b?l(La,Na,t,e):e}),Eo=r(function(e,t){return U(t,{userNotices:f(So,t.userNotices,F([e]))})}),To=r(function(e,t){return l($a,Eo,t,e)}),wo={$:"Open"},Io=Me,Ao=Io(mr),Bo=a(function(e,t,r,n){return L({agentAddress:t,agentRole:r,userInfo:n,viewPhase:wo,web3Context:e},Ao)}),ko=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),No={$:"None"},Ro=No,$o=function(e){return d(ko,e,Ao,Ro,mr)},xo=function(e){return{$:"AbiDecoder",a:e}},_o=r(function(e,t){return{$:"Tape",a:e,b:t}}),Lo=Y,Po=Vr,Do=r(function(e,t){return e<1?t:l(Po,e,Lo(t),t)}),Uo=Do(64),Oo=n(function(e,t,r){return L(f(_o,e,Uo(t)),r)}),Mo=r(function(e,t){return e<1?"":l(Po,0,e,t)}),Fo=Mo(64),Vo=r(function(e,t){if("Ok"===t.$){var r=t.a;return di(e(r))}var n=t.a;return li(n)}),Ko=function(e){return-e},Ho=r(function(e,t){return e<1?"":l(Po,-e,Lo(t),t)}),jo=function(){var e=function(e){if(!f(Ni,Qa(D("0")),f(Mo,63,e)))return li("Boolean decode error. "+e+" is not 1 or 0.");switch(f(Ho,1,e)){case"0":return di(!1);case"1":return di(!0);default:return li("Boolean decode error. "+e+" is not 1 or 0.")}};return xo(function(t){var r=t.a,n=t.b;return f(Vo,f(Oo,r,n),e(Fo(n)))})}(),qo=jr,Go=function(e){return f(qo,"0x",e)||f(qo,"0X",e)?f(Do,2,e):e},zo=function(e){return e.b},Yo=r(function(e,t){var r=e.a;return f(Vo,zo,r(function(e){return f(_o,e,e)}(Go(t))))}),Wo=Zr,Jo=ie,Qo=Jr,Xo=function(e){return f(Wo,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Vi(n)}var a=r.a;return Jo(a)},Qo)},Zo=f(yo,Yo,Xo),eu=function(e){return{$:"Magnitude",a:e}},tu=function(e){return{$:"Pos",a:e}},ru=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),nu=function(e){return{$:"MagnitudeNotNormalised",a:e}},au=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 ci(n)}return fi}},iu=function(e){var t=au(e);return"Nothing"!==t.$&&t.a<0},ou=function(e){return{$:"Neg",a:e}},uu={$:"Zer"},su=function(e){return!e.b},cu=r(function(e,t){var r=t.a;if(su(r))return uu;switch(e.$){case"Zero":return uu;case"Positive":return tu(t);default:return ou(t)}}),fu=r(function(e,t){return f(ru,e,nu(t))}),lu=function(e){return f(La,r(function(t,r){return e(t)&&su(r)?mr:f(Na,t,r)}),mr)}(Qa(0)),du=Ar,hu=-1+f(du,10,7),pu=hu+1,gu=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),vu=function(e){return e<0?f(gu,Ra(-1),vu(e+pu)):L(e/pu|0,e%pu)},yu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=vu(r+e),i=a.a,o=a.b;return f(Na,o,f(yu,i,n))}{if(!(_(e,pu)>0))return F([e]);var u=F([e]);e=0,t=u}}}),mu=function(e){var t=e.a;return eu(lu(f(yu,0,t)))},bu=Pa(Ko),Cu={$:"Negative"},Su={$:"Positive"},Eu={$:"Zero"},Tu=function(e){switch(e.$){case"Positive":return Cu;case"Negative":return Su;default:return Eu}},wu=function(e){for(;;){var t=e.a,r=e.b,n=mu(r),a=n.a;if(!iu(a))return f(cu,t,eu(a));e=f(fu,Tu(t),bu(a))}},Iu=gr,Au=function(e){switch(f(Iu,e,0).$){case"LT":return Cu;case"GT":return Su;default:return Eu}},Bu=function(e){return e<0?-e:e},ku=function(e){return wu(f(ru,Au(e),nu(F([Bu(e)]))))},Nu=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(du,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},Ru=function(e){switch(e.$){case"Zer":return uu;case"Neg":var t=e.a;return tu(t);default:return e}},$u=function(e){return{$:"MagnitudePair",a:e}},xu=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(Na,L(a,u),f(xu,i,s))}var c=r.a,a=c.a,i=c.b;return f(Na,L(a,0),f(xu,i,mr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(Na,L(0,u),f(xu,mr,s))}return mr}),_u=r(function(e,t){var r=e.a,n=t.a;return $u(f(xu,r,n))}),Lu=function(e){switch(e.$){case"Zer":return f(fu,Eu,mr);case"Neg":var t=e.a.a;return f(fu,Su,bu(t));default:var t=e.a.a;return f(fu,Su,t)}},Pu=r(function(e,t){var r=Lu(t),n=r.b,a=Lu(e),i=a.b,o=f(_u,i,n),u=o.a,s=f(Pa,function(e){return e.a+e.b},u);return wu(f(ru,Su,nu(s)))}),Du=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 wa}return a.b.b?Ca:f(Iu,e,t)}}),Uu=function(e){switch(e.$){case"LT":return wa;case"EQ":return ba;default:return Ca}},Ou=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(Du,0,0,n,a)}return wa;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Uu(d(Du,0,0,n,a))}return Ca;default:switch(r.b.$){case"Pos":r.a;return Ca;case"Zer":r.a,r.b;return ba;default:r.a;return wa}}}),Mu=r(function(e,t){return $(f(Ou,e,t),wa)}),Fu=H,Vu=r(function(e,t){return!f(Mu,e,t)}),Ku=function(e){switch(e.$){case"Zer":return eu(mr);case"Pos":default:var t=e.a;return t}},Hu=r(function(e,t){var r=e.a;return mu(nu(f(Pa,ri(t),r)))}),ju=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(Hu,eu(n),a),u=f(ju,eu(i),eu(n)),s=u.a,c=f(Pu,f(cu,Su,o),f(cu,Su,eu(f(Na,0,s))));return Ku(c)}var a=r.a;return f(Hu,eu(n),a)}return eu(mr)}),qu=function(e){switch(e.$){case"Zer":return Eu;case"Pos":return Su;default:return Cu}},Gu=r(function(e,t){return $(e,Eu)||$(t,Eu)?Eu:$(e,t)?Su:Cu}),zu=r(function(e,t){return f(cu,f(Gu,qu(e),qu(t)),f(ju,Ku(e),Ku(t)))}),Yu=function(e){switch(e.$){case"Zer":return uu;case"Pos":var t=e.a;return ou(t);default:var t=e.a;return tu(t)}},Wu=r(function(e,t){return f(Pu,e,Yu(t))}),Ju=ku(0),Qu=a(function(e,t,r,n){if(e){var a=ku(e),i=f(zu,f(zu,a,n),t),o=f(Vu,i,r)?L(f(zu,a,t),f(Wu,r,i)):L(Ju,r),u=o.a,s=o.b,c=d(Qu,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Pu,u,l),h)}return L(Ju,r)}),Xu=Va(f(Ka,2,hu)),Zu=n(function(e,t,r){return d(Qu,f(du,2,Xu),e,t,r)}),es=ku(1),ts=r(function(e,t){return e}),rs=n(function(e,t,r){return l($a,ts(e),t,f(Bi,1,r))}),ns=function(e){return l(rs,zu(ku(pu)),es,e)},as=n(function(e,t,r){if(e){var n=l(Zu,ns(e),t,r),a=n.a,i=n.b,o=l(as,e-1,i,r),u=o.a,s=o.b;return L(f(Pu,a,u),s)}return l(Zu,ns(e),t,r)}),is=function(e){switch(e.$){case"Zer":return mr;case"Pos":default:var t=e.a.a;return t}},os=r(function(e,t){if($(t,Ju))return fi;var r=wi(is(e))-wi(is(t))+1,n=l(as,f(ti,0,r),Ru(e),Ru(t)),a=n.a,i=n.b;return ci(L(f(cu,f(Gu,qu(e),qu(t)),Ku(a)),f(cu,qu(e),Ku(i))))}),us=f(zu,ku(2),ku(2147483648)),ss=Pr,cs=function(e){return f(ss,e,"")},fs=Dn,ls=n(function(e,t,r){return e<=0?r:l(ls,e>>1,O(t,t),1&e?O(r,t):r)}),ds=r(function(e,t){return l(ls,e,t,"")}),hs=n(function(e,t,r){return O(f(ds,e-Lo(r),cs(t)),r)}),ps=re,gs=Br,vs=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}},ys=r(function(e,t){for(;;){if(t<16)return f(Na,vs(t),e);var r=f(Na,vs(f(gs,16,t)),e),n=t/16|0;e=r,t=n}}),ms=function(e){return ps(e<0?f(Na,D("-"),f(ys,mr,-e)):f(ys,mr,e))},bs=function(e){var t=f(os,e,us);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=ms(Nu(a));return $(n,ku(0))?i:O(bs(n),l(hs,8,D("0"),i))},Cs=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return $(t,eu(mr))?"0":bs(tu(t));default:var t=e.a;return"-"+Cs(f(zu,ku(-1),e))}},Ss=function(e){return l(hs,64,D("0"),e)},Es=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=Ss(ms(a)),c=function(e){return O(e,n)}(Ss(ms(u)));return P(a+32+(Lo(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($a,t,P(32*wi(e),"",""),e))},Ts=Ur,ws=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))))}),Is=n(function(e,t,n){return l(Ts,r(function(t,r){return l(ws,e,mi(t),r)}),t,n)}),As=function(e){return xa(l(Is,Na,mr,e))},Bs=function(e){return f($i,"",f(Pa,f(yo,ms,f(hs,2,D("0"))),As(e)))},ks=function(e){return 64-f(gs,64,e)},Ns=function(e){return O(e,f(ds,ks(Lo(e)),"0"))},Rs=function(e){return L(ci(Lo(e)/2|0),Ns(e))},$s=function(e){return L(fi,Ss(e))},xs=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("!")}},_s=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"}},Ls=Or,Ps=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(ss,D("1"),r),!0);case"1":return L(f(ss,D("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(ss,D("0"),r),!1);case"1":return L(f(ss,D("1"),r),!0);default:break e}return L(r,!0)});return l(Ls,t,L("",!1),e).a},Ds=function(e){return l(Ls,Na,mr,e)},Us=n(function(e,t,r){for(;;){if(""===t)return xa(r);var n=e,a=f(Do,e,t),i=f(Na,l(Po,0,e,t),r);e=n,t=a,r=i}}),Os=r(function(e,t){return e&&""!==t?l(Us,e,t,mr):F([t])}),Ms=function(e){var t=function(){var t=Ds(Cs(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(yo,Ps,f(hs,256,D("1"))))}var r=t;return L(r,f(hs,256,D("0")))}(),r=t.a,n=t.b;return ps(f(Pa,xs,f(Os,4,n(f($i,"",f(Pa,_s,r))))))},Fs=function(e){return{$:"Hex",a:e}},Vs=function(e){switch(e.$){case"AddressE":var t=e.a.a;return $s(t);case"UintE":var r=e.a;return $s(Cs(r));case"IntE":var n=e.a;return $s(Ms(n));case"BoolE":return $s(e.a?"1":"0");case"DBytesE":var a=e.a.a;return Rs(a);case"BytesE":var a=e.a.a;return $s(Go(a));case"StringE":var i=e.a;return Rs(Bs(i));case"ListE":var o=e.a;return function(e){var t=e.a;return Rs(t)}(Zt()(o));default:var i=e.a;return $s(Go(i))}};try{var Ks=Zt();Zt=function(){return Ks}}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 Hs=Dr,js=function(e){return 1===Lo(e)?f(Hs,"0",e):e},qs=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(Na,n,r);e=i,t=o,r=u}}}),Gs=r(function(e,t){return xa(l(qs,e,t,mr))}),zs=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(Na,i,f(Na,u,f(Na,h,f(Na,m,f(Gs,t-4,b))))):f(Na,i,f(Na,u,f(Na,h,f(Na,m,l(zs,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return F([i])}),Ys=r(function(e,t){return l(zs,0,e,t)}),Ws=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),Js=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 Dt(e.a)}},Qs={$:"LE"},Xs=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(On,t,r,n);case"I16":var a=e.a,n=e.b;return d(Mn,t,r,n,$(a,Qs));case"I32":var a=e.a,n=e.b;return d(Fn,t,r,n,$(a,Qs));case"U8":var n=e.a;return l(Vn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Kn,t,r,n,$(a,Qs));case"U32":var a=e.a,n=e.b;return d(Hn,t,r,n,$(a,Qs));case"F32":var a=e.a,n=e.b;return d(jn,t,r,n,$(a,Qs));case"F64":var a=e.a,n=e.b;return d(qn,t,r,n,$(a,Qs));case"Seq":var i=e.b;return l(Zs,i,t,r);case"Utf8":var o=e.b;return l(zn,t,r,o);default:var i=e.a;return l(Gn,t,r,i)}}),Zs=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Xs,n,t,r);e=i,t=o,r=u}}),ec=Ut,tc=r(function(e,t){return{$:"Seq",a:e,b:t}}),rc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+Js(r),i=n;e=a,t=i}}),nc=function(e){return f(tc,f(rc,0,e),e)},ac=function(e){return{$:"U8",a:e}},ic=ac,oc=r(function(e,t){return _(e,t)<0?e:t}),uc=pr,sc=function(e){return{$:"Bytes",a:e}},cc=sc,fc=function(e){return ec(nc(f(Pa,cc,xa(e))))},lc=Dt,dc=r(function(e,t){var r=e.a;return f(Yn,r,t)}),hc=function(e){return{$:"Decoder",a:e}},pc=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}}),gc=r(function(e,t){return hc(f(pc,e,t))}),vc=hc(Wn),yc=r(function(e,t){if("Just"===t.$){return t.a}return e}),mc=function(e){return{$:"Done",a:e}},bc=function(e){return{$:"Loop",a:e}},Cc=r(function(e,t){var n=t.a;return hc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),Sc=function(e){return hc(r(function(t,r){return L(r,e)}))},Ec=r(function(e,t){var r=t.a,n=t.b;return r<=0?Sc(mc(xa(n))):f(Cc,function(e){return bc(L(r-1,f(Na,e,n)))},e)}),Tc=function(e){return f(yc,mr,f(dc,f(gc,L(lc(e),mr),Ec(vc)),e))},wc=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))}),Ic=r(function(e,t){return l(wc,fs,e,t)}),Ac=f(Bi,0,4),Bc=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}}),kc=Pt,Nc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),Rc=function(e){return f(Nc,f(yo,kc,fs(4294967295)),e)},$c=r(function(e,t){return 5*t+e}),xc=4294967295>>>32-ja,_c=ir,Lc=n(function(e,t,r){for(;;){var n=xc&t>>>e,a=f(_c,n,r);if("SubTree"!==a.$){var i=a.a;return f(_c,xc&t,i)}var o=a.a,u=e-ja,s=t,c=o;e=u,t=s,r=c}}),Pc=function(e){return e>>>5<<5},Dc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?fi:ci(_(e,Pc(r))>-1?f(_c,xc&e,i):l(Lc,n,e,a))}),Uc=r(function(e,t){var r=f(Dc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),Oc=n(function(e,t,r){var n=f($c,e,t);return f(Uc,n,r)}),Mc=or,Fc=a(function(e,t,r,n){var a=xc&t>>>e,i=f(_c,a,n);if("SubTree"===i.$){var o=i.a,u=d(Fc,e-ja,t,r,o);return l(Mc,a,Ya(u),n)}var s=i.a,c=l(Mc,xc&t,r,s);return l(Mc,a,za(c),n)}),Vc=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,Pc(n))>-1?d(Fa,n,a,i,l(Mc,xc&e,t,o)):d(Fa,n,a,d(Fc,a,e,t,i),o)}),Kc=n(function(e,t,r){return l(Vc,e,t,r)}),Hc=a(function(e,t,r,n){var a=f($c,e,t);return l(Kc,a,r,n)}),jc=Un,qc=r(function(e,t){return l(wc,jc,e,t)}),Gc=function(e){var t=l(La,r(function(t,n){var a={d0:l(Oc,0,t,e.state),d1:l(Oc,1,t,e.state),d2:l(Oc,2,t,e.state),d3:l(Oc,3,t,e.state),d4:l(Oc,4,t,e.state)},i=r(function(e,r){return d(Hc,e,t,f(qc,f(Bc,e,a),f(Ic,Rc(f(Bc,f(gs,5,e+1),a)),f(Bc,f(gs,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Ac);return U(e,{state:t})},zc=L(0,0),Yc=function(e){return{current:zc,lfsrstate:1,state:e,x:1,y:0}},Wc=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},Jc=L(1,0),Qc=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),Xc=r(function(e,t){if(e){var n=f(Qc,1,t);return l(wc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),Zc=r(function(e,t){var r=f(gs,32,e/32|0),n=f(Qc,r,t),a=f(gs,32,e);return f(Xc,a,n)}),ef=n(function(e,t,r){var n=f(Dc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(Vc,e,t(a),r)}),tf=n(function(e,t,r){return l(ef,e,qc(t),r)}),rf=a(function(e,t,r,n){var a=f($c,e,t);return l(tf,a,r,n)}),nf=function(e){return l($a,r(function(e,t){var r=(1<>r}),df=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(oc,n,r),i=f(Pa,function(e){return f(lf,e,g)},f(Bi,0,a)),o=ff(e),u=O(t,i),s=n-a;e=o,t=u,n=s}});return f(Ys,i.outputLen,l(v,g,mr,i.outputLen))},vf=function(e){return{$:"KS",a:e}},yf=function(e){var t=e.a;return vf({config:t,inputLength:0,partial:mr,state:f(si,25,ts(zc))})},mf=function(e){return hc(Jn(e))},bf=ec(nc(mr)),Cf=r(function(e,t){var n=t.a;return hc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),Sf=r(function(e,t){return f(Cf,function(e){return mf(t)},mf(e))}),Ef=r(function(e,t){return f(yc,bf,f(dc,f(Sf,e,lc(t)-e),t))}),Tf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=lc(e)?f(Na,e,n.partial):n.partial;if(!(_(l($a,r(function(e,t){return t+lc(e)}),0,i),a)>-1))return vf(U(n,{inputLength:lc(e)+n.inputLength,partial:i}));var o=fc(i),u=f(yc,bf,f(dc,mf(a),o)),s=Tc(u),c=f(pf,s,n.state),d=ff(c),h=f(Ef,a,o),p=bf,g=vf(U(n,{inputLength:lc(e)+n.inputLength,partial:F([h]),state:d}));e=p,t=g}}),wf=r(function(e,t){return gf(f(Tf,ec(nc(f(Pa,ic,t))),yf(e)))}),If=wf(Ws),Af=function(e){return Fs(f($i,"",f(Pa,f(yo,ms,js),f(Ys,4,If(f(Pa,mi,Ds(e)))))))},Bf=function(e){return f(qo,"0x",e)||f(qo,"0X",e)?e:"0x"+e},kf=function(e){var t=e.a;return Bf(t)},Nf=r(function(e,t){var r=Es(f(Pa,Vs,t)),n=function(e){return O(e,r)}(Go(kf(Af(e))));return Fs(n)}),Rf=function(e){return{data:ci(f(Nf,"poke()",mr)),decoder:Zo(jo),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},$f=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),xf=r(function(e,t){return f($f,e,t)}),_f=r(function(e,t){return{$:"AgentHistory",a:e,b:t}}),Lf=function(e){return{$:"Trade",a:e}},Pf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},Df=r(function(e,t){switch(e.$){case"ViewUserRoleChanged":var r=e.a;return d(ko,t,Ao,Ro,F([ha(f(_f,t.agentAddress,r))]));case"ViewPhaseChanged":var n=e.a;return d(ko,U(t,{viewPhase:n}),Ao,Ro,mr);case"Poke":var a=e.a,i=Pf(Rf(a)),o={onBroadcast:fi,onMined:fi,onSign:fi},u=f(xf,o,i);return d(ko,t,Ao,u,mr);case"TradeClicked":var s=e.a;return d(ko,t,Ao,Ro,F([ha(Lf(s))]));default:return $o(t)}}),Uf=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),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 ci(e(r))}return fi}),qf=r(function(e,t){return f(yc,Ju,f(jf,Xa,f(os,e,t)))}),Gf=r(function(e,t){return Kf(f(qf,Hf(e),ku(t)))}),zf=function(e){return f(Gf,e,12)},Yf=function(e){return f(Gf,e,3)},Wf=Kf(ku(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 ci(t)}return fi},Zf=Gr,el=function(e){var t=Xf(f(Zf,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Lo(e)-1-r;return L(O(f(Mo,r,e),f(Do,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,Qa(0),t);return eu(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=wi(r)>0;return e>0&&t>0&&a?f(Na,f(Ys,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 fi;var a=n.a;return f(jf,Na(a),r)});return f(La,t,ci(mr))}(Oa),sl=function(e){return f(jf,f(Ua,rl,eu),ul(f(Pa,f(yo,xa,f(yo,ps,nl)),f(ol,7,xa(e)))))},cl=X,fl=function(e){var t=Ds(cl(e));if(!t.b)return fi;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(jf,cu(Cu),sl(r))}return fi;case"+":if(t.b.b){var r=t.b;return f(jf,cu(Su),sl(r))}return fi;default:var r=t;return f(jf,cu(Su),sl(r))}},ll=function(e){var t=function(e){return!f(gs,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(yc,0,Xf(r)))}},dl=function(e){return f(zu,e,e)},hl=ku(2),pl=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return es;case"Neg":return uu;default:if($(r,es))return f(zu,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(zu,t,e),a=dl(t),i=f(qf,f(Wu,r,es),hl);e=n,t=a,r=i;continue e}}),gl=r(function(e,t){return l(pl,es,e,t)}),vl=function(e){if(""===e)return fi;var t=el(e),r=t.a,n=t.b,a=fl(r),i=18-n;if(i<0)return fi;if("Nothing"===a.$)return fi;var o=a.a,u=f(zu,o,f(gl,ku(10),ku(i)));return ci(u)},yl=function(e){return f(jf,Kf,vl(e))},ml=qr,bl=function(e){for(;;){if(f(ml,".",e))return l(Po,0,-1,e);{if(!f(ml,"0",e))return""===e?"0":e;e=l(Po,0,-1,e)}}},Cl=f(Ua,f(hs,7,D("0")),Ri),Sl=function(e){return f($i,"",e)},El=function(e){var t=e.a,r=xa(t);if(r.b){var n=r.a,a=r.b;return Sl(f(Na,Ri(n),f(Pa,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(Po,0,-e,t)}),Il=function(e){var t=l(hs,18,D("0"),Tl(e)),r=f(wl,18,t)+"."+f(Ho,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(Mo,a+1+e,r):f(Mo,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,fi,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 li("You must specify a trade amount.");var r=yl(t);if("Nothing"===r.$)return li("I don't understand this number.");var n=r.a;return Rl(n)<1?li("Trade amount must be a least 1 "+Qf(e)+"."):di(n)}),xl=function(e){if(""===e)return li("You must specify a fiat price.");var t=fl(e);if("Nothing"===t.$){var r=Nl(e);return li("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 di(n)},_l=r(function(e,t){if("Just"===t.$){var r=t.a;return di(r)}return li(e)}),Ll=function(e){return""===e},Pl=function(e){return Ll(e)?fi:ci(e)},Dl=function(e){return f(_l,"You must specify a fiat type.",Pl(e))},Ul=function(e){return""===e?li("Must specify a payment method."):di(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,fi,fi,fi,fi,fi,fi,fi),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 di(P(i,o,u))}var s=a.c.a;return li(s)}var c=a.b.a;return li(c)}var f=a.a.a;return li(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 li(o)}var u=t.a;if("Err"===r.$){var o=r.a;return li(o)}var s=r.a;if("Err"===n.$){var o=n.a;return li(o)}var c=n.a;if("Err"===a.$){var o=a.a;return li(o)}var f=a.a;if("Err"===i.$){var o=i.a;return li(o)}var l=i.a;return di(h(e,u,s,c,f,l))}),ql=r(function(e,t){if("Ok"===t.$){var r=t.a;return di(r)}var n=t.a;return li(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:ci(e)})},f($l,e,t.daiAmount)),f(ql,function(e){return U(Ml,{fiatAmount:ci(e)})},xl(t.fiatAmount)),f(ql,function(e){return U(Ml,{fiatType:ci(e)})},Dl(t.fiatType)),f(ql,function(e){return U(Ml,{paymentMethod:ci(e)})},Ul(t.paymentMethod)),Fl(d(Vl,function(e){return Gl(e)>0?di(e):li(U(Ml,{autorecallInterval:ci("Must specify a non-zero time for this window")}))},function(e){return Gl(e)>0?di(e):li(U(Ml,{autoabortInterval:ci("Must specify a non-zero time for this window")}))},function(e){return Gl(e)>0?di(e):li(U(Ml,{autoreleaseInterval:ci("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 fi;var n=t.a;if("Nothing"===r.$)return fi;var a=r.a;return ci(f(e,n,a))}),Wl=function(e){if("Ok"===e.$){var t=e.a;return ci(t)}return fi},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:fi,createParameters:fi,depositAmount:fi,errors:Ml,inputs:Vf,showFiatTypeDropdown:!1,txChainStatus:fi,userInfo:t,web3Context:e}),Ao,Ro,mr)}),ed=a(function(e,t,r,n){return da(d(Uf,e,t,r,n))}),td=function(e){return{$:"Address",a:e}},rd=f(yo,Go,f(yo,cl,td)),nd=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return rd("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return rd("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return rd("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return rd("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return rd("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},ad=function(e){return rd("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},id=function(e){return{$:"AddressE",a:e}},od=id,ud=function(e){return{$:"UintE",a:e}},sd=ud,cd=n(function(e,t,r){return{data:ci(f(Nf,"approve(address,uint256)",F([od(t),sd(r)]))),decoder:Zo(jo),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),fd=function(e){return f(Gf,e,200)},ld=r(function(e,t){return Kf(f(Pu,Hf(e),Hf(t)))}),dd=function(e){var t=f(Gf,e.tradeAmount,200);return f(ld,e.pokeReward,f(ld,fd(e.tradeAmount),f(ld,t,function(){return"Buyer"===e.initiatorRole.$?Yf(e.tradeAmount):e.tradeAmount}())))},hd=Fi(ma),pd=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),gd=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),vd=Zn,yd=Xn,md=function(e){return f(yd,{caseInsensitive:!1,multiline:!1},e)},bd=Qn,Cd=vd(f(yc,bd,md("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Sd=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}}),Ed=r(function(e,t){return!f(Sd,f(Ua,Fu,e),t)}),Td=Ed(Oa),wd=G,Id=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ad=n(function(e,t,r){if("Err"===t.$){var n=t.a;return li(n)}var a=t.a;if("Err"===r.$){var n=r.a;return li(n)}var i=r.a;return di(f(e,a,i))}),Bd=f(La,Ad(Na),di(mr)),kd=function(e){if(e.b){var t=(e.a,e.b);return ci(t)}return fi},Nd=n(function(e,t,r){e:for(;;){if(!t.b)return di(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(du,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(du,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(du,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(du,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(du,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(du,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(du,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(du,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(du,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(du,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(du,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(du,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(du,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(du,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(du,16,e);e=i,t=o,r=u;continue e;default:var s=n;return li(cs(s)+" is not a valid hexadecimal character.")}}}),Rd=function(e){if(Ll(e))return li("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(qo,"-",e)){var t=f(yc,mr,kd(Ds(e)));return f(Vo,Ko,l(Nd,wi(t)-1,t,0))}return l(Nd,Lo(e)-1,Ds(e),0)}();return f(ql,function(t){return f($i," ",F(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},$d=function(e){var t=Ds(e);return function(e){return L(t,e)}(f(Id,mr,Bd(f(Pa,Rd,f(_i,"",f($i,"",f(Pa,f(yo,ms,js),f(Ys,20,If(f(Pa,f(yo,wd,mi),t))))))))))},xd=function(e){var t=r(function(e,t){return!(t>=8&&bi(e)||t<8&&Ci(e))}),n=$d(Go(e)),a=n.a,i=n.b,o=l(Ii,t,a,i);return!!Cd(e)&&Td(o)},_d=vd(f(yc,bd,md("^((0[Xx]){1})?[0-9a-f]{40}$"))),Ld=vd(f(yc,bd,md("^((0[Xx]){1})?[0-9A-F]{40}$"))),Pd=function(e){return'"'+e+'"'},Dd=function(e){var t=Go(e),r=f(Mo,24,t),n=f(Ho,40,e);return 64===Lo(t)&&f(Ni,Qa(D("0")),r)?Ld(n)||_d(n)?di(td(n)):xd(n)?di(td(n)):li("Given address "+Pd(e)+" failed the EIP-55 checksum test."):40!==Lo(t)?li("Given address "+Pd(e)+" is not the correct length."):Cd(t)?Ld(t)||_d(t)?di(td(t)):xd(t)?di(td(t)):li("Given address "+Pd(e)+" failed the EIP-55 checksum test."):li("Given address "+Pd(e)+" contains invalid hex characters.")},Ud=xo(function(e){var t=e.a,r=e.b;return f(Vo,f(Oo,t,r),Dd(Fo(r)))}),Od=r(function(e,t){var r=t.a;return xo(function(t){var n=t.a,a=t.b;return r(f(_o,n,f(Do,64*e,a)))})}),Md=Qr,Fd=r(function(e,t){return f(Md,"data",Zo(f(Od,e,t)))}),Vd=Xr,Kd=r(function(e,t){return f(Md,"topics",f(Vd,e,Zo(t)))}),Hd=function(e){return f(jf,f(yo,xa,f($a,r(function(e,t){return f(Pu,ku(e),f(zu,t,us))}),Ju)),ul(f(Pa,f(yo,xa,f(yo,ps,f(yo,Rd,Wl))),f(ol,8,xa(e)))))},jd=function(e){var t=Ds(cl(e));e:for(;;){if(!t.b)return fi;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,zu(ku(-1)),Hd(a))}var i=t.b;i.b;return fi}var a=t.b;return f(jf,zu(ku(-1)),Hd(a))}return fi;case"+":if(t.b.b){var a=t.b;return Hd(a)}return fi;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Hd(a)}t.b;return fi}break e;default:break e}}var a=t;return Hd(a)},qd=xo(function(e){var t=e.a,r=e.b;return f(Vo,f(Oo,t,r),f(_l,"Error Decoding Uint into BigInt",jd(Bf(Fo(r)))))}),Gd=f(hd,f(Kd,1,Ud),f(hd,f(Fd,1,Ud),f(hd,f(Fd,0,qd),Vi(pd)))),zd=me,Yd=f(yo,kf,zd),Wd=an,Jd=r(function(e,t){return me(l($a,Ee(e),Ce(),t))}),Qd=function(e){return me(l($a,r(function(e,t){var r=e.a,n=e.b;return l(un,r,n,t)}),Se(),e))},Xd=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(Wd,e,Qd(F([L("data",zd(t.data)),L("topics",f(Jd,Yd,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Zd=function(e){var t=e.a;return Bf(t)},eh=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(Na,t,r):r}),mr,t)}),th=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return li(r)}),rh=r(function(e,t){return f(Vo,function(e){return e.id},f(th,function(e){return f(ql,Ui,f(Xd,Gd,e).returnData)},f(_l,"No log found from that factoryAddress in that txReceipt",Xf(f(eh,function(t){return $(f(yo,Zd,cl)(t.address),f(yo,Zd,cl)(nd(e)))},t.logs)))))}),nh=n(function(e,t,r){return{data:ci(f(Nf,"allowance(address,address)",F([od(t),od(r)]))),decoder:Zo(qd),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),ah=function(e){switch(e.$){case"BlockNum":var t=e.a;return zd(Bf(ms(t)));case"EarliestBlock":return zd("earliest");case"LatestBlock":return zd("latest");default:return zd("pending")}},ih=f(yo,Zd,zd),oh=f(yo,Cs,f(yo,Bf,zd)),uh=f(yo,ms,f(yo,Bf,zd)),sh=sn,ch=function(e){return Qd(f(Pa,function(e){var t=e.a,r=e.b;return L(t,f(yc,sh,r))},f(eh,function(e){e.a;return!$(e.b,fi)},e)))},fh=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return ch(F([L("to",f(jf,ih,t)),L("from",f(jf,ih,r)),L("gas",f(jf,uh,n)),L("gasPrice",f(jf,oh,a)),L("value",f(jf,oh,i)),L("data",f(jf,Yd,o))]))},lh=function(e){return{$:"BadBody",a:e}},dh=function(e){return{$:"BadStatus",a:e}},hh=function(e){return{$:"BadUrl",a:e}},ph={$:"NetworkError"},gh={$:"Timeout"},vh=nn,yh=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return li(hh(r));case"Timeout_":return li(gh);case"NetworkError_":return li(ph);case"BadStatus_":var n=t.a,a=t.b;return li(dh(n.statusCode));default:var n=t.a,a=t.b,i=f(vh,f(Md,"result",e),a);if("Ok"===i.$){var o=i.a;return di(o)}var u=i.a;return li(lh(Ui(u)))}}),mh=me,bh=n(function(e,t,r){return Qd(F([L("id",mh(e)),L("jsonrpc",zd("2.0")),L("method",zd(t)),L("params",f(Jd,Oa,r))]))}),Ch={$:"RBEmpty_elm_builtin"},Sh=Ch,Eh=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return fi;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Iu,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return ci(n);default:var u=e,s=i;e=u,t=s;continue e}}}),Th={$:"Black"},wh=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Ih={$:"Red"},Ah=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(wh,Ih,t,r,h(wh,Th,c,f,l,d),h(wh,Th,i,o,u,s))}return h(wh,e,i,o,h(wh,Ih,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(wh,Ih,c,f,h(wh,Th,g,v,y,m),h(wh,Th,t,r,d,a))}return h(wh,e,t,r,n,a)}),Bh=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(wh,Ih,e,t,Ch,Ch);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Iu,e,a).$){case"LT":return h(Ah,n,a,i,l(Bh,e,t,o),u);case"EQ":return h(wh,n,a,t,o,u);default:return h(Ah,n,a,i,o,l(Bh,e,t,u))}}),kh=n(function(e,t,r){var n=l(Bh,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(wh,Th,a,i,o,u)}return n}),Nh=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},Rh=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(wh,Ih,p,g,h(wh,Th,r,n,h(wh,Ih,i,o,u,s),v),h(wh,Th,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(wh,Th,r,n,h(wh,Ih,i,o,u,s),h(wh,Ih,f,l,d,m))}return e},$h=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(wh,Ih,i,o,h(wh,Th,s,c,f,l),h(wh,Th,r,n,d,h(wh,Ih,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(wh,Th,r,n,h(wh,Ih,i,o,C,d),h(wh,Ih,g,v,y,m))}return e},xh=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(wh,r,u,s,c,h(wh,Ih,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 $h(t)}break e}o.a,o.d;return $h(t)}break e}return t}),_h=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(wh,t,r,n,_h(a),u)}var s=Rh(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Ah,c,f,l,_h(d),p)}return Ch}return h(wh,t,r,n,_h(a),u)}return Ch},Lh=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Ch;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(wh,r,n,a,f(Lh,e,i),o)}var s=Rh(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Ah,c,l,d,f(Lh,e,p),v)}return Ch}return h(wh,r,n,a,f(Lh,e,i),o)}return f(Ph,e,g(xh,e,t,r,n,a,i,o))}),Ph=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=Nh(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Ah,r,s,c,i,_h(o))}return Ch}return h(Ah,r,n,a,i,f(Lh,e,o))}return Ch}),Dh=r(function(e,t){var r=f(Lh,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(wh,Th,n,a,i,o)}return r}),Uh=n(function(e,t,r){var n=t(f(Eh,e,r));if("Just"===n.$){var a=n.a;return l(kh,e,a,r)}return f(Dh,e,r)}),Oh=function(e){return"Just"===e.$},Mh=vn,Fh=yn,Vh=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),Kh=function(e){return{$:"BadUrl_",a:e}},Hh=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),jh={$:"NetworkError_"},qh=function(e){return{$:"Receiving",a:e}},Gh=function(e){return{$:"Sending",a:e}},zh={$:"Timeout_"},Yh=function(e){return f(ra,"application/json",f(Pi,0,e))},Wh=n(function(e,t,r){return Yh(l(bh,e,t,r))}),Jh=f(ta,"",Oa),Qh=we,Xh=Te,Zh=function(e){if("Ok"===e.$){var t=e.a;return Xh(t)}var r=e.a;return Qh(r)},ep=function(e){return l(ea,vr,Zh,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:fi,url:e.url})},tp=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return ep({body:l(Wh,1,r,n),headers:mr,method:"POST",resolver:Jh(yh(a)),timeout:fi,url:t})},rp=n(function(e,t,r){return tp({decoder:t.decoder,method:"eth_call",params:F([fh(t),ah(r)]),url:e})}),np={$:"LatestBlock"},ap=r(function(e,t){return l(rp,e,t,np)}),ip=function(e){return{$:"Perform",a:e}},op=cn,up=Xh(vr),sp=r(function(e,t){return f(op,function(t){return Xh(e(t))},t)}),cp=n(function(e,t,r){return f(op,function(t){return f(op,function(r){return Xh(f(e,t,r))},r)},t)}),fp=function(e){return l(La,cp(Na),Xh(mr),e)},lp=r(function(e,t){var r=t.a;return ke(f(op,Mh(e),r))}),dp=n(function(e,t,r){return f(sp,function(e){return vr},fp(f(Pa,lp(e),t)))}),hp=n(function(e,t,r){return Xh(vr)}),pp=r(function(e,t){var r=t.a;return ip(f(sp,e,r))});gn.Task=De(up,dp,hp,pp);var gp=Oe("Task"),vp=fn,yp=r(function(e,t){return gp(ip(f(vp,f(Ua,f(Ua,Xh,e),li),f(op,f(Ua,f(Ua,Xh,e),di),t))))}),mp=i(function(e,t,r,n,a){return f(yp,a,f(ap,e.httpProvider,l(nh,ad(t),r,n)))}),bp=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return rd("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return rd("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return rd("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return rd("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return rd("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Cp=function(e){return{$:"BoolE",a:e}},Sp=Cp,Ep=function(e){return{$:"StringE",a:e}},Tp=Ep,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:ci(f(Nf,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([od(t),od(r),Sp(n),sd(a),sd(i),sd(o),sd(u),sd(s),sd(c),sd(l),sd(d),Tp(h),Tp(p)]))),decoder:Zo(Ud),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}}}}}}}}}}}}}},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:ci(f(Nf,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([od(t),od(r),Sp(n),sd(a),sd(i),sd(o),sd(u),sd(s),sd(c),sd(l),sd(d),Tp(h),Tp(p)]))),decoder:Zo(Ud),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}}}}}}}}}}}}}},Ap=r(function(e,t){return{paymentMethods:t,price:e}}),Bp=function(e){return zd(Tl(e))},kp=function(e){return f(Jd,Oa,F([zd(e.fiatType),Bp(e.amount)]))},Np=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},Rp=function(e){return Qd(F([L("type",zd(Np(e.type_))),L("info",zd(e.info))]))},$p=function(e){var t=kp(e.price),r=f(Jd,Rp,e.paymentMethods);return f(Pi,0,Qd(F([L("paymentmethods",r),L("price",t)])))},xp=r(function(e,t){return U(t,{value:ci(e)})}),_p=function(e){return ku(Gl(e))},Lp=function(e){return f(qf,_p(e),ku(1e3))},Pp=r(function(e,t){var r=function(){return"Token"===e.$?wp:Ip}();return function(){return"Native"===e.$?xp(Hf(dd(t))):Oa}()(r(nd(e))(t.initiatorAddress)(bp(e))($(t.initiatorRole,Of))(Hf(t.tradeAmount))(Hf(Yf(t.tradeAmount)))(Hf(zf(t.tradeAmount)))(Hf(t.pokeReward))(Lp(t.autorecallInterval))(Lp(t.autoabortInterval))(Lp(t.autoreleaseInterval))(Hf(fd(t.tradeAmount)))($p(f(Ap,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Dp=function(e){return{$:"CreateMined",a:e}},Up={$:"CreateNeedsSig"},Op=function(e){return{$:"CreateSigned",a:e}},Mp=r(function(e,t){var r=Pf(f(Pp,e,t)),n={onBroadcast:fi,onMined:ci(L(Dp,fi)),onSign:ci(Op)};return L(ci(Up),f(xf,n,r))}),Fp=function(e){return{$:"AllowanceFetched",a:e}},Vp=r(function(e,t){return{$:"ApproveMining",a:e,b:t}}),Kp={$:"ApproveNeedsSig"},Hp=r(function(e,t){return{$:"ApproveSigned",a:e,b:t}}),jp=function(e){return{$:"Confirm",a:e}},qp=function(e){return{$:"CreateMining",a:e}},Gp={$:"NoOp"},zp=function(e){return{appCmds:mr,chainCmd:Ro,cmd:Ao,model:e}},Yp=function(e){return nl(Tl(e))},Wp={$:"BottomRight"},Jp={$:"ShouldBeImpossible"},Qp=function(e){return Gi(e)},Xp=r(function(e,t){f(kl,e,t);return{align:Wp,label:"unexpectedError",mainParagraphs:F([F([Qp(e)])]),noticeType:Jp}}),Zp={$:"Error"},eg=r(function(e,t){f(kl,e+" fetch error",t);return{align:Wp,label:"web3FetchError",mainParagraphs:F([F([Qp('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:Zp}}),tg=r(function(e,t){return{align:Wp,label:"web3MiningError",mainParagraphs:F([F([Qp('Error mining "'+e+'" transaction: '+t)])]),noticeType:Zp}}),rg={$:"Caution"},ng=r(function(e,t){return{align:Wp,label:"web3SigError",mainParagraphs:F([F([Qp('Error signing "'+e+'" transaction: '+t)])]),noticeType:rg}}),ag=r(function(e,t){if("Just"===t.$){return e(t.a)}return fi}),ig=r(function(e,t){return 1-e(1-t)}),og=function(e){return f(du,e,5)},ug=ig(og),sg={easing:ug,offset:12,speed:200},cg=function(e){return{$:"External",a:e}},fg=function(e){return{$:"Internal",a:e}},lg=function(e){return{$:"NotFound",a:e}},dg=function(e){for(;;){e=e.a}},hg=r(function(e,t){return gp(ip(f(sp,e,t)))}),pg={$:"Http"},gg={$:"Https"},vg=Hr,yg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),mg=i(function(e,t,r,n,a){if(Ll(a)||f(vg,"@",a))return fi;var i=f(Zf,":",a);if(i.b){if(i.b.b)return fi;var o=i.a,u=nl(f(Do,o+1,a));if("Nothing"===u.$)return fi;var s=u;return ci(p(yg,e,f(Mo,o,a),s,t,r,n))}return ci(p(yg,e,a,fi,t,r,n))}),bg=a(function(e,t,r,n){if(Ll(n))return fi;var a=f(Zf,"/",n);if(a.b){var i=a.a;return h(mg,e,f(Do,i,n),t,r,f(Mo,i,n))}return h(mg,e,"/",t,r,n)}),Cg=n(function(e,t,r){if(Ll(r))return fi;var n=f(Zf,"?",r);if(n.b){var a=n.a;return d(bg,e,ci(f(Do,a+1,r)),t,f(Mo,a,r))}return d(bg,e,fi,t,r)}),Sg=r(function(e,t){if(Ll(t))return fi;var r=f(Zf,"#",t);if(r.b){var n=r.a;return l(Cg,e,ci(f(Do,n+1,t)),f(Mo,n,t))}return l(Cg,e,fi,t)}),Eg=function(e){return f(qo,"http://",e)?f(Sg,pg,f(Do,7,e)):f(qo,"https://",e)?f(Sg,gg,f(Do,8,e)):fi},Tg=Jt,wg=zt(Yt),Ig=ca,Ag=r(function(e,t){return L(e,t)}),Bg=_r,kg=a(function(e,t,r,n){var a=_(r,n)>0?ni:Ra,i=Bu(r-n),o=f(ti,1,Bg(i)/e|0),u=o,s=f(Pa,function(e){return t(e/u)},f(Bi,0,o));return e<=0||$(r,n)?mr:f(Pa,function(e){return f(a,r,e*i)},s)}),Ng=r(function(e,t){var n=r(function(t,r){return fp(f(Pa,Ig(0),d(kg,e.speed,e.easing,t,r-e.offset)))});return f(op,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(cp,Ag,wg,Tg(t)))}),Rg=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(t.userInfo,t.web3Context.factoryType));if("Just"===r.a.$&&"Token"===r.b.$){var n=r.a.a,a=r.b.a,i=h(mp,t.web3Context,a,n.address,nd(t.web3Context.factoryType),Fp);return d(Xl,t,i,Ro,mr)}return zp(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Xl,U(t,{inputs:U(u,{userRole:o})}),Ao,Ro,F([function(){return"Buyer"===o.$?d(ed,"create offer type changed","input","sell dai",0):d(ed,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return zp(f(Ql,U(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return zp(f(Ql,U(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return zp(f(Ql,U(u,{fiatType:c}),t));case"FiatTypeLostFocus":return zp(U(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var p=e.a,u=t.inputs;return zp(f(Ql,U(u,{paymentMethod:p}),t));case"AutorecallIntervalChanged":var g=e.a,u=t.inputs;return zp(f(Ql,U(u,{autorecallInterval:g}),t));case"AutoabortIntervalChanged":var g=e.a,u=t.inputs;return zp(f(Ql,U(u,{autoabortInterval:g}),t));case"AutoreleaseIntervalChanged":var g=e.a,u=t.inputs;return zp(f(Ql,U(u,{autoreleaseInterval:g}),t));case"ShowCurrencyDropdown":var v=e.a,u=t.inputs;return d(Xl,(v?Ql(U(u,{fiatType:""})):Oa)(U(t,{showFiatTypeDropdown:v})),Ao,Ro,v?F([d(ed,"currency-selector-clicked","input","",0)]):mr);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 zp(U(t,{depositAmount:ci(Hf(dd(b))),txChainStatus:ci(jp(b))}))}var C=y.a;return d(Xl,U(t,{errors:C}),f(yp,ts(Gp),function(){return f(Ng,U(sg,{offset:60}),"inputError")}()),Ro,mr);case"AbortCreate":return d(Xl,U(t,{txChainStatus:fi}),Ao,Ro,F([d(ed,"abort","abort","create",0)]));case"ConfirmCreate":var b=e.a,S=e.b,E=function(){var e=t.web3Context.factoryType;if("Native"===e.$)return f(Mp,t.web3Context.factoryType,b);var r=e.a,n=function(){var e=Pf(l(cd,ad(r),nd(t.web3Context.factoryType),S)),n={onBroadcast:fi,onMined:fi,onSign:ci(Hp(b))};return f(xf,n,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Ou,i,S),Ca)?L(ci(Kp),n):f(Mp,t.web3Context.factoryType,b)}return L(ci(Kp),n)}(),T=E.a,w=E.b;return d(Xl,U(t,{txChainStatus:T}),Ao,w,mr);case"ApproveSigned":var b=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return zp(U(t,{txChainStatus:ci(f(Vp,b,A))}))}var B=I.a;return d(Xl,U(t,{txChainStatus:fi}),Ao,Ro,F([ga(f(ng,"appove",B))]));case"AllowanceFetched":var k=e.a;if("Ok"===k.$){var N=k.a,R=U(t,{allowance:ci(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(Ou,N,P),Ca))return zp(R);var D=f(Mp,R.web3Context.factoryType,b),T=D.a,w=D.b;return d(Xl,U(R,{txChainStatus:T}),Ao,w,mr)}return zp(R)}var O=k.a;return d(Xl,t,Ao,Ro,F([ga(f(eg,"allowance",O))]));case"CreateSigned":var I=e.a;if("Ok"===I.$){var A=I.a;return zp(U(t,{txChainStatus:ci(qp(A))}))}var B=I.a;return d(Xl,U(t,{txChainStatus:fi}),Ao,Ro,F([ga(f(ng,"create",B))]));case"CreateMined":if("Err"===e.a.$){var B=e.a.a;return d(Xl,t,Ao,Ro,F([ga(f(tg,"create",B))]))}var M=e.a.a,V=f(ag,Yp,Wl(f(rh,t.web3Context.factoryType,M)));if("Just"===V.$){var K=V.a;return d(Xl,t,Ao,Ro,F([ha(Lf(K))]))}return d(Xl,t,Ao,Ro,F([ga(f(Xp,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',M))]));case"Web3Connect":return d(Xl,t,Ao,Ro,F([va]));case"NoOp":return zp(t);default:var H=e.a;return d(Xl,t,Ao,Ro,F([H]))}}),$g=function(e){return ch(F([L("to",f(jf,ih,e.to)),L("from",f(jf,ih,e.from)),L("gas",f(jf,uh,e.gas)),L("gasPrice",f(jf,oh,e.gasPrice)),L("value",f(jf,oh,e.value)),L("data",f(jf,Yd,e.data)),L("nonce",f(jf,uh,e.nonce))]))},xg=function(e){return{$:"TxSentry",a:e}},_g=r(function(e,t){return Qd(F([L("ref",mh(e)),L("txParams",t)]))}),Lg=function(e){return{$:"Signing",a:e}},Pg=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Lg(e)}}),Dg=mn,Ug=n(function(e,t,r){var n=e.a,a=$g(r),i=l(kh,n.ref,f(Pg,r,t),n.txs);return L(xg(U(n,{ref:n.ref+1,txs:i})),f(Dg,n.tagger,n.outPort(f(_g,n.ref,a))))}),Og=Ug,Mg=r(function(e,t){if("None"===t.$)return L(e,Ao);var r=t.a,n=t.b;return l(Og,e,r,n)}),Fg=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Vg=r(function(e,t){if("None"===t.$)return No;var r=t.a,n=t.b,a=l(Fg,f(jf,Ua(e),r.onSign),f(jf,Ua(e),r.onBroadcast),f(jf,function(t){var r=t.a,n=t.b;return L(f(yo,r,e),f(jf,function(t){return{confirmations:t.confirmations,toMsg:f(yo,t.toMsg,e)}},n))},r.onMined));return f($f,a,n)}),Kg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return co}e.a;return so}switch(e.a.$){case"Eth":e.a;return co;case"Kovan":e.a;return so;default:e.a;return fo(100)}},Hg=r(function(e,t){return f(Iu,Gl(e),Gl(t))}),jg=r(function(e,t){return $(t.state.phase,wo)&&$(f(Hg,t.derived.phaseEndTime,e),wa)}),qg=function(e){if(""===e)return di(fi);var t=yl(e);if("Nothing"===t.$)return li("I can't interpret this number");var r=t.a;return di(ci(r))},Gg=function(e){if(""===e)return di(fi);var t=fl(e);if("Nothing"===t.$)return li("I don't understand this number.");var r=t.a;return di(ci(r))},zg=a(function(e,t,r,n){return{maxDai:t,maxFiat:n,minDai:e,minFiat:r}}),Yg=d(zg,fi,fi,fi,fi),Wg=i(function(e,t,r,n,a){if("Err"===t.$){var i=t.a;return li(i)}var o=t.a;if("Err"===r.$){var i=r.a;return li(i)}var u=r.a;if("Err"===n.$){var i=n.a;return li(i)}var s=n.a;if("Err"===a.$){var i=a.a;return li(i)}var c=a.a;return di(d(e,o,u,s,c))}),Jg=function(e){return h(Wg,a(function(t,r,n,a){return{dai:{max:r,min:t},fiat:f(jf,function(e){return{max:a,min:n,type_:e}},Pl(e.fiatType)),paymentMethodTerms:e.paymentMethodTerms}}),f(ql,function(e){return U(Yg,{minDai:ci(e)})},qg(e.minDai)),f(ql,function(e){return U(Yg,{maxDai:ci(e)})},qg(e.maxDai)),f(ql,function(e){return U(Yg,{minFiat:ci(e)})},Gg(e.minFiat)),f(ql,function(e){return U(Yg,{maxFiat:ci(e)})},Gg(e.maxFiat)))},Qg=r(function(e,t){var r=function(t){return f(Ed,function(e){return f(vg,cl(e),cl(t))},e)};return f(Sd,function(e){return r(e.info)},t)}),Xg=r(function(e,t){return U(t,{paymentMethod:e})}),Zg=r(function(e,t){return U(t,{paymentMethodTerms:e})}),ev=r(function(e,t){return f(Ou,Hf(e),Hf(t))}),tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(So,e.inputs.paymentMethodTerms,F([t]));return rv(U(e,{inputs:f(Zg,r,f(Xg,"",e.inputs))}))},rv=function(e){var t=tv(e),n=Jg(t.inputs);if("Err"===n.$){return U(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(Qg,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiat;if("Nothing"===t.$)return!0;var r=t.a;return $(e.terms.price.fiatType,r.type_)&&function(){var t=r.min;if("Nothing"===t.$)return!0;var n=t.a;return!$(f(Ou,e.terms.price.amount,n),Ca)}()&&function(){var t=r.max;if("Nothing"===t.$)return!0;var n=t.a;return!$(f(Ou,e.terms.price.amount,n),wa)}()},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(ev,e.parameters.tradeAmount,r),Ca)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!$(f(ev,e.parameters.tradeAmount,r),wa)}()},s=r(function(e,r){return f(jg,e,r)&&!$(r.parameters.initiatorRole,t.browsingRole)&&f(i,e,r)&&u(r)&&o(r)});return U(t,{filterFunc:s})},nv={fiatType:"",maxDai:"",maxFiat:"",minDai:"",minFiat:"",paymentMethod:"",paymentMethodTerms:mr},av=r(function(e,t){return f(Iu,e.creationInfo.blocknum,t.creationInfo.blocknum)}),iv=n(function(e,t,r){return L(rv({browsingRole:t,errors:Yg,filterFunc:jg,inputs:nv,showCurrencyDropdown:!1,sortFunc:av,userInfo:r,web3Context:e}),Ao)}),ov=r(function(e,t){return f(Ou,e.amount,t.amount)}),uv=r(function(e,t){var r=f(eh,uc(e),t.inputs.paymentMethodTerms);return rv(U(t,{inputs:f(Zg,r,t.inputs)}))}),sv=function(e){return U(e,{filterFunc:jg,inputs:nv,sortFunc:av})},cv={$:"Ascending"},fv=n(function(e,t,r){return{appCmds:r,cmd:t,model:e}}),lv=function(e){return l(fv,e,Ao,mr)},dv=r(function(e,t){return U(t,{fiatType:e})}),hv=r(function(e,t){return U(t,{maxDai:e})}),pv=r(function(e,t){return U(t,{maxFiat:e})}),gv=r(function(e,t){return U(t,{minDai:e})}),vv=r(function(e,t){return U(t,{minFiat:e})}),yv=n(function(e,t,r){return f(e,r,t)}),mv=r(function(e,t){switch(e.$){case"MinDaiChanged":var n=e.a;return l(fv,U(t,{inputs:f(gv,n,t.inputs)}),Ao,mr);case"MaxDaiChanged":var n=e.a;return l(fv,U(t,{inputs:f(hv,n,t.inputs)}),Ao,mr);case"MinFiatChanged":var n=e.a;return l(fv,U(t,{inputs:f(vv,n,t.inputs)}),Ao,mr);case"MaxFiatChanged":var n=e.a;return l(fv,U(t,{inputs:f(pv,n,t.inputs)}),Ao,mr);case"FiatTypeInputChanged":var n=e.a;return l(fv,U(t,{inputs:f(dv,n,t.inputs)}),Ao,mr);case"ShowCurrencyDropdown":var a=e.a;t.inputs;return l(fv,U(t,{inputs:(a?dv(""):Oa)(t.inputs),showCurrencyDropdown:a}),Ao,mr);case"FiatTypeLostFocus":return l(fv,U(t,{showCurrencyDropdown:!1}),Ao,mr);case"PaymentMethodInputChanged":var n=e.a;return l(fv,U(t,{inputs:f(Xg,n,t.inputs)}),Ao,mr);case"AddSearchTerm":return l(fv,tv(t),Ao,mr);case"RemoveTerm":var i=e.a;return l(fv,f(uv,i,t),Ao,mr);case"ApplyInputs":return l(fv,rv(t),Ao,mr);case"ResetSearch":return l(fv,sv(t),Ao,mr);case"TradeClicked":var o=e.a;return l(fv,t,Ao,F([ha(Lf(o))]));case"SortBy":var u=e.a,s=e.b,c=($(s,cv)?yv:Oa)(r(function(e,t){switch(u.$){case"Expiring":return f(Hg,e.derived.phaseEndTime,t.derived.phaseEndTime);case"TradeAmount":return f(ev,e.parameters.tradeAmount,t.parameters.tradeAmount);case"Fiat":return f(ov,e.terms.price,t.terms.price);case"Margin":return f(yc,ba,l(Yl,r(function(e,t){return f(Iu,e,t)}),e.derived.margin,t.derived.margin));case"PaymentMethods":return f(av,e,t);case"AutoabortWindow":return f(Hg,e.parameters.autoabortInterval,t.parameters.autoabortInterval);default:return f(Hg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)}}));return l(fv,U(t,{sortFunc:c}),Ao,mr);case"NoOp":return lv(t);default:var d=e.a;return l(fv,t,Ao,F([d]))}}),bv=a(function(e,t,r,n){return e(Qd(F([L("title",zd(t)),L("body",function(){if("Nothing"===r.$)return sh;var e=r.a;return zd(e)}()),L("image",function(){if("Nothing"===n.$)return sh;var e=n.a;return zd(e)}())])))}),Cv=n(function(e,t,r){var n=e.factoryType;if("Token"===n.$){var a=n.a;return h(mp,e,a,t.address,nd(e.factoryType),r)}return Ao}),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:fi,userInfo:t,web3Context:e},n=function(){if("Just"===t.$){var e=t.a;return l(Cv,r.web3Context,e,Sv)}return Ao}();return d(wv,r,n,Ro,mr)}),Av=function(e){return{$:"ApproveSigned",a:e}},Bv=r(function(e,t){var r=Pf(l(cd,ad(e),nd(no(e)),Hf(t))),n={onBroadcast:fi,onMined:fi,onSign:ci(Av)};return f(xf,n,r)}),kv=function(e){return{$:"OpenMined",a:e}},Nv=function(e){return{$:"OpenSigned",a:e}},Rv=r(function(e,t){var r=Pf(f(Pp,e,t)),n={onBroadcast:fi,onMined:ci(L(kv,fi)),onSign:ci(Nv)};return f(xf,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 Kf(f(zu,Hf(e),ku(t)))}),Mv=function(e){var t=function(){return"Buyer"===e.initiatorRole.$?3:1}();return f(Gf,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(Jf,e,{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,initiatorRole:t.initiatorRole,paymentMethods:F([f(Hl,Kl,r)]),price:t.fiatValue,tradeAmount:Mv(t)})}),Vv=function(e){return{appCmds:mr,chainCmd:Ro,cmd:Ao,model:e}},Kv=function(e){return Kf(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(mp,t.web3Context,a,n.address,nd(t.web3Context.factoryType),Sv);return d(wv,t,i,Ro,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(ev,r,o.daiAmountIn),Ca)?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))}),Ao,c,mr)}return d(wv,t,Ao,Ro,F([ga(f(Xp,"Approve Clicked msg received, but factoryType is not a token factory!",o))]));case"ApproveSigned":var p=e.a,g=L(p,t.state);if("Ok"===g.a.$){if("Menu"===g.b.$&&"ApproveNeedsSig"===g.b.a.$){var v=g.a.a,o=g.b.a.a;return Vv(U(t,{state:f(Dv,o,$v(v))}))}return d(wv,t,Ao,Ro,F([ga(f(Xp,"Approve signed, but factoryType is not a token factory!",p))]))}var y=g.a.a;return d(wv,t,Ao,Ro,F([ga(f(ng,"ERC20 approve",y))]));case"AllowanceFetched":var m=e.a,b=L(m,t.state);if("Ok"===b.a.$){if("Spec"===b.b.$&&"ApproveMining"===b.b.b.$){var C=b.a.a,S=b.b,o=S.a;return Vv($(f(Ou,C,Hf(o.daiAmountIn)),Ca)?U(t,{tokenAllowance:ci(Kv(C))}):U(t,{state:f(Dv,o,Pv),tokenAllowance:ci(Kv(C))}))}return Vv(t)}var E=b.a.a;return d(wv,t,Ao,Ro,F([ga(f(eg,"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)}),Ao,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,Ao,Ro,F([ga(f(Xp,"Open signed, but factoryType is not a token factory!",p))]))}var y=I.a.a;return d(wv,t,Ao,Ro,F([ga(f(ng,"Open trade",y))]));case"OpenMined":var B=e.a;if("Ok"===B.$){var k=B.a,N=f(ag,Yp,Wl(f(rh,t.web3Context.factoryType,k)));if("Just"===N.$){var R=N.a;return d(wv,t,Ao,Ro,F([ha(Lf(R))]))}return d(wv,t,Ao,Ro,F([ga(f(Xp,'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,Ao,Ro,F([ga(f(tg,"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,Ao,Ro,F([va]))}}),jv=function(e){return"Buyer"===e.$?"buyer":"seller"},qv=function(e){return e.a+"="+e.b},Gv=function(e){return e.b?"?"+f($i,"&",f(Pa,qv,e)):""},zv=r(function(e,t){return"/"+(f($i,"/",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",Ri(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",Zd(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(Na,u,r),s,a,i,o(l))])}return mr}return mr})}),ny=f(ry,"ADDRESS",f(yo,Dd,Wl)),ay={$:"Buyer"},iy=f(ry,"BUYERORSELLER",function(e){switch(e){case"buyer":return ci(ay);case"seller":return ci(Of);default:return fi}}),oy=f(ry,"NUMBER",nl),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(Pa,uy(u),r(h(ty,n,a,i,o,e)))})}),cy=function(e){return l(La,So,mr,e)},fy=r(function(e,t){return cy(f(Pa,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(Na,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,Lf,f(dy,ly("trade"),oy)),f(sy,Xv,f(dy,ly("marketplace"),iy)),f(sy,_f,f(dy,ly("history"),f(dy,ny,iy))),f(sy,function(e){return f(_f,e,Of)},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 ci(t.value)}return ci(t.value)}return fi}},vy=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(Na,t,vy(r))}return mr}return mr},yy=function(e){var t=f(_i,"/",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 ci(F([e]));var r=t.a;return ci(f(Na,e,r))}),Cy=r(function(e,t){var r=f(_i,"=",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(Uh,u,by(c),t)}return t}),Sy=function(e){if("Nothing"===e.$)return Sh;var t=e.a;return l(La,Cy,Sh,f(_i,"&",t))},Ey=r(function(e,t){var r=e.a;return gy(r(h(ty,mr,yy(t.path),Sy(t.query),t.fragment,Oa)))}),Ty=function(e){return f(yc,Wv,f(Ey,py,e))},wy=ia,Iy=r(function(e,t){return f(wy,e,Yv(t))}),Ay=qe("connectToWeb3",function(e){return sh}),By=function(e){return Qd(F([L("event",zd(e.event)),L("category",zd(e.category)),L("label",zd(e.label)),L("value",mh(e.value))]))},ky=r(function(e,t){return Qd(F([L("address",zd(Zd(e))),L("signSeedMsg",zd(t))]))}),Ny=qe("gTagOut",Oa),Ry=qe("genPrivkey",Oa),$y=qe("notifyPort",Oa),xy=qe("requestNotifyPermissionPort",function(e){return sh}),_y=r(function(e,t){return U(t,{userInfo:e})}),Ly=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(mp,t.web3Context,a,n.address,nd(t.web3Context.factoryType),Fp)}return Ao}())}),Py=r(function(e,t){return U(t,{userInfo:e})}),Dy=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 Ao}())}),Uy=function(e){return{$:"AllowanceFetched",a:e}},Oy=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(mp,t.web3Context,i,n.address,a.creationInfo.address,Uy)}return Ao}())}),My=function(e){return{$:"AgentHistoryModel",a:e}},Fy=function(e){return{$:"CreateModel",a:e}},Vy=function(e){return{$:"CreateMsg",a:e}},Ky=function(e){return{$:"MarketplaceModel",a:e}},Hy=function(e){return{$:"QuickCreateModel",a:e}},jy=function(e){return{$:"QuickCreateMsg",a:e}},qy=function(e){return{$:"TradeModel",a:e}},Gy=function(e){return{$:"TradeMsg",a:e}},zy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Ao);case"CreateModel":var r=t.a,n=f(Ly,e,r),a=n.a,i=n.b;return L(Fy(a),f(Dg,Vy,i));case"QuickCreateModel":var o=t.a,u=f(Dy,e,o),s=u.a,c=u.b;return L(Hy(s),f(Dg,jy,c));case"TradeModel":var l=t.a,d=f(Oy,e,l),h=d.a,p=d.b;return L(qy(h),f(Dg,Gy,p));case"MarketplaceModel":var g=t.a;return L(Ky(f(Py,e,g)),Ao);default:var v=t.a;return L(My(f(_y,e,v)),Ao)}}),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){return U(t,{web3Context:e})}),Qy=r(function(e,t){return U(t,{web3Context:e})}),Xy=r(function(e,t){switch(t.$){case"BetaLandingPage":return P(t,Ao,fi);case"CreateModel":var r=t.a;return P(Fy(f(Wy,e,r)),Ao,fi);case"QuickCreateModel":var n=t.a;return P(Hy(f(Qy,e,n)),Ao,fi);case"TradeModel":t.a;return P(t,Ao,ci(Xv(ay)));case"MarketplaceModel":var a=t.a;return P(Ky(f(Jy,e,a)),Ao,fi);default:var i=t.a;return P(My(f(Yy,e,i)),Ao,fi)}}),Zy=o(function(e,t,r,n,a,i){return{creationInfo:t,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),em=function(e){return{$:"PartiallyLoadedTrade",a:e}},tm=function(e){return em(p(Zy,e,fi,fi,fi,fi,fi))},rm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),nm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},am=nm(f(rm,fi,fi)),im=function(e){return{$:"CurrentBlockFetched",a:e}},om=Xo(f(yo,Go,Rd)),um=function(e){return tp({decoder:om,method:"eth_blockNumber",params:mr,url:e})},sm=function(e){return f(yp,im,um(e.httpProvider))},cm=r(function(e,t){return{address_:e,blocknum:t}}),fm=function(e){return xo(function(t){return di(L(t,e))})},lm=r(function(e,t){return L(t.a,e(t.b))}),dm=n(function(e,t,r){var n=t.a,a=r.a;return xo(function(t){return f(th,function(t){var r=t.a,n=t.b;return f(Vo,lm(e(n)),a(r))},n(t))})}),hm=r(function(e,t){return l(dm,r(function(e,t){return e(t)}),t,e)}),pm=Zo(f(hm,qd,f(hm,Ud,fm(cm)))),gm=r(function(e,t){return{data:ci(f(Nf,"createdTrades(uint256)",F([sd(t)]))),decoder:pm,from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),vm=n(function(e,t,r){return f(yp,r,f(ap,e.httpProvider,f(gm,nd(e.factoryType),t)))}),ym=function(e){return{$:"CreationInfoFetched",a:e}},mm=r(function(e,t){return l(vm,e,ku(t),ym)}),bm=function(e){return{$:"EventSentryMsg",a:e}},Cm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Sm=function(e){return{$:"BlockNumber",a:e}},Em=function(e){return{$:"EventSentry",a:e}},Tm=function(e){return{$:"Set_elm_builtin",a:e}},wm=Tm(Sh),Im=r(function(e,t){return L(Em({blockNumber:fi,errors:mr,nodePath:t,pending:wm,ref:1,requests:Sh,tagger:e,watching:wm}),f(yp,f(yo,Sm,e),um(t)))}),Am=n(function(e,t,r){var n=f(mm,e,r),a=f(Im,bm,e.httpProvider),i=a.a,o=a.b;return d(Cm,{allowance:fi,blocknumOnInit:fi,chatHistoryModel:fi,eventSentry:i,eventsWaitingForChatHistory:mr,expandedPhase:wo,secureCommInfo:am,showChatHistory:!1,showStatsModal:!1,trade:tm(r),txChainStatus:fi,userInfo:t,web3Context:e},Io(F([n,o,sm(e)])),Ro,F([pa]))}),Bm=function(e){return{data:ci(f(Nf,"abort()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},km=function(e){return{data:ci(f(Nf,"burn()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Nm=function(e){return{data:ci(f(Nf,"claim()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Rm=r(function(e,t){return{data:ci(f(Nf,"initiatorStatement(string)",F([Tp(t)]))),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),$m=function(e){return{data:ci(f(Nf,"recall()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},xm=function(e){return{data:ci(f(Nf,"release()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},_m=r(function(e,t){return{data:ci(f(Nf,"responderStatement(string)",F([Tp(t)]))),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),Lm=r(function(e,t){return{amount:t,fiatType:e}}),Pm=f(Wo,function(e){var t=fl(e);if("Just"===t.$){var r=t.a;return Vi(r)}return Jo("Can't convert that to a BigInt")},Qo),Dm=l(Fi,Lm,f(Vd,0,Qo),f(Vd,1,Pm)),Um={$:"Bank"},Om={$:"Cash"},Mm=function(e){switch(e){case"cash":return ci(Om);case"bank":return ci(Um);case"custom":return ci(Kl);default:return fi}},Fm=f(Wo,function(e){var t=Mm(e);if("Just"===t.$){var r=t.a;return Vi(r)}return Jo("")},Qo),Vm=l(Fi,Hl,f(Md,"type",Fm),f(Md,"info",Qo)),Km=ue,Hm=function(e){var t=l(Fi,Ap,f(Md,"price",Dm),f(Md,"paymentmethods",Km(Vm)));return f(vh,t,e)},jm=r(function(e,t){return{commPubkey:t,responder:e}}),qm=r(function(e,t){var n=r(function(t,r){return l(Po,t,t+2*r,e)}),a=f(yo,Rd,Vo(ri(2)));return f(th,function(t){return f(Vo,function(e){return f(n,t+64,e)},Rd(l(Po,t,t+64,e)))},a(t))}),Gm=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))}),zm=n(function(e,t,r){var n=l($a,Gm(e),P(0,0,t),r);if(n.b)return li("invalid UTF-8 sequence");var a=n.c;return di(a)}),Ym=q,Wm=function(e){return cs(Ym(e))},Jm=function(e){return l(zm,r(function(e,t){return O(t,Wm(e))}),"",e)},Qm=xo(function(e){var t=e.a,r=e.b;return f(Vo,f(Oo,t,r),f(th,Jm,f(th,f(yo,Pa(Rd),Bd),f(Vo,eh(f(yo,Ll,Fu)),f(Vo,Os(2),f(qm,t,Fo(r)))))))}),Xm=f(hd,f(Fd,1,Qm),f(hd,f(Fd,0,Ud),Vi(jm))),Zm=r(function(e,t){return{commPubkey:t,terms:e}}),eb=f(hd,f(Fd,1,Qm),f(hd,f(Fd,0,Qm),Vi(Zm))),tb=function(e){return{statement:e}},rb=f(hd,f(Fd,0,Qm),Vi(tb)),nb=function(e){return{statement:e}},ab=f(hd,f(Fd,0,Qm),Vi(nb)),ib={$:"AbortedEvent"},ob={$:"BurnedEvent"},ub={$:"ClaimedEvent"},sb=function(e){return{$:"CommittedEvent",a:e}},cb=function(e){return{$:"InitiatedEvent",a:e}},fb=function(e){return{$:"InitiatorStatementLogEvent",a:e}},lb={$:"PokeEvent"},db={$:"RecalledEvent"},hb={$:"ReleasedEvent"},pb=function(e){return{$:"ResponderStatementLogEvent",a:e}},gb=vd(f(yc,bd,md("^((0[Xx]){1})?[0-9a-fA-F]+$"))),vb=function(e){return gb(e)?di(Fs(Go(e))):li("Something in here is not very hexy: "+Pd(e))},yb=Xo(vb),mb=f(Md,"topics",f(Vd,0,yb)),bb=function(e){return Fs(f($i,"",f(Pa,f(yo,ms,js),If(f(Pa,mi,Ds(e))))))},Cb=f(Wo,function(e){return $(e,bb("Initiated(string,string)"))?f(Mi,cb,eb):$(e,bb("Committed(address,string)"))?f(Mi,sb,Xm):$(e,bb("Recalled()"))?Vi(db):$(e,bb("Claimed()"))?Vi(ub):$(e,bb("Aborted()"))?Vi(ib):$(e,bb("Released()"))?Vi(hb):$(e,bb("Burned()"))?Vi(ob):$(e,bb("InitiatorStatementLog(string)"))?f(Mi,fb,rb):$(e,bb("ResponderStatementLog(string)"))?f(Mi,pb,ab):$(e,bb("Poke()"))?Vi(lb):Jo("Unrecognized topic hash")},mb),Sb={$:"Initiator"},Eb={$:"Responder"},Tb=r(function(e,t){return $(t,e.parameters.initiatorAddress)?ci(Sb):f(ag,function(e){return $(t,e)?ci(Eb):fi},e.state.responder)}),wb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},Ib=function(e){return $(e.buyerDeposit,Yf(e.tradeAmount))&&$(e.abortPunishment,zf(e.tradeAmount))},Ab={$:"Invalid"},Bb=u(function(e,t,r,n,a,i,o){return{creationInfo:t,derived:o,id:e,parameters:r,phaseStartInfo:i,state:n,terms:a}}),kb=function(e){return{$:"LoadedTrade",a:e}},Nb=r(function(e,t){return Ff(Gl(t)+Gl(e))}),Rb=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},$b=r(function(e,t){return(t-e)/e}),xb=r(function(e,t){var r=Rb(t),n=Rl(e);return"USD"===t.fiatType?ci(f($b,n,r)):fi}),_b=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(xb,e.tradeAmount,r.price),phaseEndTime:f(Nb,t.phaseStartTime,n)}}),Lb=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 kb(g(Bb,e.id,n,a,o,u,s,l(_b,a,o,u)))}return em(e)},Pb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Lb(U(r,{creationInfo:ci(e)}));case"LoadedTrade":f(kl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Ab}}),Db=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Lb(U(r,{parameters:ci(e)}));case"LoadedTrade":t.a,f(kl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Ab}}),Ub=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Lb(U(r,{phaseStartInfo:ci(e)}));case"LoadedTrade":t.a,f(kl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Ab}}),Ob=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Lb(U(r,{state:ci(e)}));case"LoadedTrade":var n=t.a;return kb(U(n,{state:e}));default:return Ab}}),Mb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Lb(U(r,{terms:ci(e)}));case"LoadedTrade":t.a,f(kl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Ab}}),Fb=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}}),Vb=Zo(f(hm,qd,f(hm,qd,f(hm,qd,f(hm,qd,f(hm,qd,f(hm,qd,f(hm,qd,f(hm,jo,f(hm,Ud,fm(Fb))))))))))),Kb=function(e){return{data:ci(f(Nf,"getParameters()",mr)),decoder:Vb,from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Hb=function(e){return f(jf,function(e){return Ff(1e3*e)},nl(Tl(e)))},jb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return li(a)}var i=t.a;if("Err"===r.$){var a=r.a;return li(a)}var o=r.a;if("Err"===n.$){var a=n.a;return li(a)}var u=n.a;return di(l(e,i,o,u))}),qb=function(e){var t=f(_l,"error converting BigInt to Time.Posix",Hb(e.autoabortInterval)),r=f(_l,"error converting BigInt to Time.Posix",Hb(e.autoreleaseInterval)),a=f(_l,"error converting BigInt to Time.Posix",Hb(e.autorecallInterval));return d(jb,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.initiatedByCustodian?Of:ay,pokeReward:Kv(e.pokeReward),tradeAmount:Kv(e.tradeAmount)}}),a,t,r)},Gb=n(function(e,t,r){return f(yp,r,f(sp,qb,f(ap,e.httpProvider,Kb(t))))}),zb=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}}}}}}}}}}},Yb=Zo(f(hm,qd,f(hm,qd,f(hm,qd,f(hm,qd,f(hm,qd,f(hm,qd,f(hm,qd,f(hm,qd,f(hm,qd,f(hm,qd,fm(zb)))))))))))),Wb=function(e){return{data:ci(f(Nf,"getPhaseStartInfo()",mr)),decoder:Yb,from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Jb=i(function(e,t,r,n,a){if("Nothing"===t.$)return fi;var i=t.a;if("Nothing"===r.$)return fi;var o=r.a;if("Nothing"===n.$)return fi;var u=n.a;if("Nothing"===a.$)return fi;var s=a.a;return ci(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}}),Hb(e.v6),Hb(e.v7),Hb(e.v8),Hb(e.v9))},Xb=n(function(e,t,r){return f(yp,r,f(sp,Qb,f(ap,e.httpProvider,Wb(t))))}),Zb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),eC=Zo(f(hm,qd,f(hm,Ud,f(hm,qd,f(hm,qd,f(hm,qd,fm(Zb))))))),tC=function(e){return{data:ci(f(Nf,"getState()",mr)),decoder:eC,from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},rC={$:"Aborted"},nC={$:"Burned"},aC={$:"NotClosed"},iC={$:"Recalled"},oC={$:"Released"},uC=function(e){switch(f(yc,99,nl(Tl(e)))){case 0:return ci(aC);case 1:return ci(iC);case 2:return ci(rC);case 3:return ci(oC);case 4:return ci(nC);default:return fi}},sC={$:"Closed"},cC={$:"Committed"},fC={$:"Judgment"},lC=function(e){switch(f(yc,99,nl(Tl(e)))){case 1:return ci(wo);case 2:return ci(cC);case 3:return ci(fC);case 4:return ci(sC);default:return fi}},dC=function(e){return $(e,rd("0x0000000000000000000000000000000000000000"))?fi:ci(e)},hC=a(function(e,t,r,n){if("Nothing"===t.$)return fi;var a=t.a;if("Nothing"===r.$)return fi;var i=r.a;if("Nothing"===n.$)return fi;var o=n.a;return ci(l(e,a,i,o))}),pC=function(e){var t=Hb(e.phaseStartTimestamp),r=lC(e.phase),a=uC(e.closedReason);return d(hC,n(function(t,r,n){return{balance:Kv(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:dC(e.responder)}}),r,t,a)},gC=n(function(e,t,r){return f(yp,r,f(sp,pC,f(ap,e.httpProvider,tC(t))))}),vC=i(function(e,t,r,n,a){return Io(F([l(Gb,e,t,r),l(gC,e,t,n),l(Xb,e,t,a)]))}),yC=function(e){var t=Yp(e);if("Just"===t.$){return t.a}f(kl,"Warning! BigInt to Int conversion failed!",Tl(e));return 0},mC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),bC=n(function(e,t,r){for(;;){var n=f(Wa,32,e),a=n.a,i=n.b;if(_(ai(a),32)<0)return f(ii,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(Na,za(a),t),s=r+1;e=o,t=u,r=s}}),CC=function(e){return e.b?l(bC,e,mr,0):Ga},SC=rn,EC=function(e){var t=h(SC,mC,f(Md,"encapsulation",Qo),f(Md,"iv",Qo),f(Md,"tag",Qo),f(Md,"encrypted",Qo)),r=Km(t),n=f(Wd,r,e);if("Err"===n.$){var a=n.a;return li(Ui(a))}var i=n.a;return function(e){var t=L(f(Dc,0,e),f(Dc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return di(L(r,n))}return li("Decoded list has less than 2 items.")}(CC(i))},TC=function(e){var t=function(e){var t=Lo(e);return t>1114111?li("string is too long"):di(f(ss,Ym(t),e))};return f(Vo,$i(""),Bd(f(Pa,t,e)))},wC=function(e){var t=e.a,r=e.b;return TC(F([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},IC=r(function(e,t){return Qd(F([L("message",zd(e)),L("pubkeyHexStrings",f(Jd,zd,F([t.initiatorPubkey,t.responderPubkey])))]))}),AC=function(e){return{$:"LoadedCommInfo",a:e}},BC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),kC=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 AC(f(BC,r,n))}return nm(e)},NC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return kC(U(r,{initiatorPubkey:ci(e)}))}var n=t.a;return AC(U(n,{initiatorPubkey:e}))}),RC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return kC(U(r,{responderPubkey:ci(e)}))}var n=t.a;return AC(U(n,{responderPubkey:e}))}),$C=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 Of}if("Buyer"===r.b.$){r.a,r.b;return Of}r.a,r.b;return ay}),xC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=mi(r),i=f(al,a,n),o=ps(f(Ys,a,n)),u=O(t,F([o])),s=i,c=u;e=s,t=c}}),_C=function(e){var t=CC(f(xC,Ds(e),mr));return l(Yl,Ag,h(Jb,mC,f(Dc,0,t),f(Dc,1,t),f(Dc,2,t),f(Dc,3,t)),h(Jb,mC,f(Dc,4,t),f(Dc,5,t),f(Dc,6,t),f(Dc,7,t)))},LC=r(function(e,t){if("Statement"===t.$){t.a;return l(la,"New Message from Trade",fi,fi)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(la,n,fi,fi)}),PC={$:"Aborted"},DC={$:"Burned"},UC={$:"Claimed"},OC=function(e){return{$:"Committed",a:e}},MC=function(e){return{$:"Encrypted",a:e}},FC={$:"FailedDecode"},VC={$:"Initiated"},KC={$:"Recalled"},HC={$:"Released"},jC=function(e){return{$:"StateChange",a:e}},qC=function(e){return{$:"Statement",a:e}},GC=lr,zC=fr,YC=r(function(e,t){var r=ai(e),n=32-ai(t.tail)-r,a=l(GC,32,t.tail,e);return n<0?{nodeList:f(Na,za(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(zC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(Na,za(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:qa}}),WC=ur,JC=y,QC=a(function(e,t,r,n){var a=xc&t>>>e;if(_(a,ai(n))>-1){if(5===e)return f(WC,za(r),n);var i=Ya(d(QC,e-ja,t,r,qa));return f(WC,i,n)}var o=f(_c,a,n);if("SubTree"===o.$){var u=o.a,i=Ya(d(QC,e-ja,t,r,u));return l(Mc,a,i,n)}var i=Ya(d(QC,e-ja,t,r,JC(o)));return l(Mc,a,i,n)}),XC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ai(i),u=ai(e),s=r+(u-o);if($(u,32)){if(_(s>>>ja,1<0){var c=n+ja,f=d(QC,c,r,e,JC(Ya(a)));return d(Fa,s,c,f,qa)}return d(Fa,s,n,d(QC,n,r,e,a),qa)}return d(Fa,s,n,a,e)}),ZC=r(function(e,t){var r=(t.a,t.c,t.d),n=ai(e),a=32-ai(r)-n,i=l(GC,32,r,e),o=f(XC,i,t);if(a<0){var u=l(zC,a,n,e);return f(XC,u,o)}return o}),eS=sr,tS=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(eS,i,t,r)}return f(Na,e,t)});return{nodeList:l(eS,i,mr,n),nodeListSize:t/32|0,tail:a}},rS=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(eS,o,t,r)}var n=e.a;return f(ZC,n,t)});return f(ZC,i,l(eS,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(eS,o,t,r)}var n=e.a;return f(YC,n,t)});return f(ii,!0,f(YC,i,l(eS,o,tS(e),a)))}),nS=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(Na,r,t)}),aS=f(La,nS,mr),iS=n(function(e,t,r){var n=$C(r.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return ci(jC(VC));case"CommittedEvent":var r=t.a;return ci(jC(OC(r.responder)));case"RecalledEvent":return ci(jC(KC));case"ClaimedEvent":return ci(jC(UC));case"AbortedEvent":return ci(jC(PC));case"ReleasedEvent":return ci(jC(HC));case"BurnedEvent":return ci(jC(DC));case"InitiatorStatementLogEvent":var r=t.a;return ci(qC({blocknum:e,message:function(){var e=_C(r.statement);if("Just"===e.$){var t=e.a;return MC(t)}return FC}(),who:n(Sb)}));case"ResponderStatementLogEvent":var r=t.a;return ci(qC({blocknum:e,message:function(){var e=_C(r.statement);if("Just"===e.$){var t=e.a;return MC(t)}return FC}(),who:n(Eb)}));default:return fi}}(),i=f(jf,function(t){return{blocknum:e,eventInfo:t,time:fi}},a),o=f(rS,r.history,CC(aS(F([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(jf,LC($(r.userRole,r.initiatorRole)),a),e):L(fi,r.lastNotificationBlocknum),s=u.a;return P(U(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),aS(F([s])))}),oS=zr,uS=function(e){var t=l(Fi,Ag,f(Md,"id",oS),f(Md,"message",Qo));return f(ql,Ui,f(Wd,t,e))},sS=function(e){return{$:"Decrypted",a:e}},cS=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),fS=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(iS,n,a,t),o=i.a,u=i.b,s=i.c;return d(cS,o,u,fi,s);case"MessageInputChanged":var c=e.a;return d(cS,U(t,{messageInput:c}),!1,fi,mr);case"MessageSubmit":return d(cS,U(t,{messageInput:""}),!1,ci(t.messageInput),mr);default:var h=e.a,p=uS(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Dc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var S=C.a,E=U(S,{message:sS(y)}),T=U(b,{eventInfo:qC(E)}),w=l(Vc,v,T,t.history);return d(cS,U(t,{history:w}),!1,fi,mr)}return d(cS,t,!1,fi,F([ga(f(Xp,"got a decryption result, but for an event that is not a message!",b))]))}return d(cS,t,!1,fi,F([ga(f(Xp,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(cS,t,!1,fi,F([ga(f(Xp,"Error decoding decryption result",I))]))}}),lS=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),dS=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),hS=function(e){return{onBroadcast:fi,onMined:ci(L(lS(e),fi)),onSign:ci(dS(e))}},pS=qe("encryptToPubkeys",Oa),gS=n(function(e,t,r){return{data:ci(f(Nf,"commit(address,string)",F([od(t),Tp(r)]))),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),vS=n(function(e,t,r){return{data:ci(f(Nf,"commit(address,string)",F([od(t),Tp(r)]))),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),yS=function(e){return{$:"CommitMined",a:e}},mS={$:"CommitNeedsSig"},bS=function(e){return{$:"CommitSigned",a:e}},CS=a(function(e,t,r,n){var a=function(){return"Token"===e.factoryType.$?vS:gS}(),i=Pf(function(){return"Token"===e.factoryType.$?Oa:xp(Hf(wb(t.parameters)))}()(l(a,t.creationInfo.address,r,n)));return L(ci(mS),f(xf,{onBroadcast:fi,onMined:ci(L(yS,fi)),onSign:ci(bS)},i))}),SS=r(function(e,t){return Qd(F([L("id",mh(e)),L("encapsulation",zd(t.encapsulatedKey)),L("iv",zd(t.iv)),L("tag",zd(t.tag)),L("encrypted",zd(t.message))]))}),ES=qe("decryptMessage",Oa),TS=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(Na,L(r,e),n))});return l(Ea,n,L(t-1,mr),e).b},wS=r(function(e,t){return Io(f(Pa,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 ES(f(SS,r,s))}return Ao}return Ao},TS(e.history)))}),IS=function(e){if("Just"===e.$){return e.a}return fi},AS=function(e){var t=IS(l(Yl,Tb,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return ci(r)}return fi}(),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(wS,n,a)}return Ao},BS=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 ay}if("Seller"===r.b.$){r.a,r.b;return ay}r.a,r.b;return Of},f(Tb,e,t))}),kS=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return P(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(iS,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=P(d,n||h,f(So,a,p));e=g,t=v}}),e,P(t,!1,mr))}),NS=u(function(e,t,r,n,a,i,o){return{history:a,initiatorRole:n,lastNotificationBlocknum:i,messageInput:o,userInfo:t,userRole:r,web3Context:e}}),RS=o(function(e,t,r,n,a,i){return f(kS,a,g(NS,e,t,r,n,Ga,i,""))}),$S=function(e){return{$:"ChatHistoryMsg",a:e}},xS=i(function(e,t,r,n,a){var i=P(t,r,n);if("LoadedTrade"===i.a.$&&"Just"===i.b.$&&"Just"===i.c.$){var o=i.a.a,u=i.b.a,s=i.c.a,c=f(BS,o,u.address);if("Just"===c.$){var l=c.a;return function(e){var t=e.a,r=e.b,n=e.c;return P(ci(t),r,f(Pa,Qi($S),n))}(p(RS,e,u,l,o.parameters.initiatorRole,a,s))}return P(fi,!1,mr)}return P(fi,!1,mr)}),_S={$:"Abort"},LS=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),PS=function(e){return{$:"ActionNeedsSig",a:e}},DS=function(e){return{$:"ApproveMining",a:e}},US={$:"ApproveNeedsSig"},OS=function(e){return{$:"ApproveSigned",a:e}},MS={$:"Burn"},FS={$:"Claim"},VS=function(e){return{$:"CommitMining",a:e}},KS=function(e){return{$:"ConfirmingAction",a:e}},HS=n(function(e,t,r){return{$:"ConfirmingCommit",a:e,b:t,c:r}}),jS=function(e){return{$:"EventLogFetched",a:e}},qS=function(e){return{$:"ParametersFetched",a:e}},GS=function(e){return{$:"PhaseInfoFetched",a:e}},zS={$:"Poke"},YS={$:"Recall"},WS={$:"Release"},JS=function(e){return{$:"StartContractAction",a:e}},QS=function(e){return{$:"StateFetched",a:e}},XS=function(e){switch(e.$){case"Poke":return"poke";case"Recall":return"recall";case"Claim":return"claim";case"Abort":return"abort";case"Release":return"release";default:return"burn"}},ZS=function(e){return d(Cm,e,Ao,Ro,mr)},eE={align:Wp,label:"cantFindTradeWillRetry",mainParagraphs:F([F([Qp("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:Zp},tE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(eg,e,r)}if("Nothing"===t.a.$){t.a;return f(Xp,"Couldn't decode the fetched \""+e+'" result.',fi)}return f(Xp,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),rE={align:Wp,label:"tradeParametersNotDefault",mainParagraphs:F([F([Qp("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:Zp},nE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),aE=n(function(e,t,r){return l(Uh,e,jf(function(e){return U(e,{logCount:wi(t)+e.logCount})}),r)}),iE=r(function(e,t){var r=t.a;return Tm(f(Dh,e,r))}),oE=n(function(e,t,r){var n=e.a,a=f(Eh,t,n.requests);if("Nothing"===a.$)return L(Em(n),Ao);var i=a.a,o=L(i.watchOnce,Xf(r));if("Nothing"===o.b.$){o.b;return L(Em(U(n,{requests:l(aE,t,r,n.requests)})),Ao)}if(o.a){var u=o.b.a;return L(Em(U(n,{requests:l(aE,t,r,n.requests),watching:f(iE,t,n.watching)})),f(hg,i.tagger,Xh(u)))}return L(Em(U(n,{requests:l(aE,t,r,n.requests)})),Io(f(Pa,function(e){return f(hg,i.tagger,Xh(e))},r)))}),uE=_e,sE=r(function(e,t){return f(yp,f(yo,Sm,t),f(op,function(t){return um(e)},uE(2e3)))}),cE=se,fE=fe,lE=Wr,dE=n(function(e,t,r){var n=function(e){return fE(F([e,cE(r)]))};return f(Wo,function(a){var i=f(Wd,e,a);if("Ok"===i.$){var o=i.a,u=f(Wd,n(t),o);if("Ok"===u.$){var s=u.a;return Vi(s)}var c=u.a;return Jo(Ui(c))}return Vi(r)},lE)}),hE=a(function(e,t,r,n){return f(hd,l(dE,f(Md,e,lE),t,r),n)}),pE=n(function(e,t,r){return f(hd,f(Md,e,t),r)}),gE=Xo(Dd),vE=vd(f(yc,bd,md("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),yE=function(e){return{$:"BlockHash",a:e}},mE=function(e){return vE(e)?di(yE(Go(e))):li("Given blockHash "+Pd(e)+" is not valid.")},bE=Xo(mE),CE=function(e){return{$:"TxHash",a:e}},SE=function(e){return vE(e)?di(CE(Go(e))):li("Given txHash "+Pd(e)+" is not valid.")},EE=Xo(SE),TE=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}}),wE=Yr,IE=l(pE,"blockNumber",om,l(pE,"blockHash",bE,l(pE,"transactionHash",EE,l(pE,"transactionIndex",om,l(pE,"logIndex",om,d(hE,"removed",wE,!1,l(pE,"topics",Km(yb),l(pE,"data",Qo,l(pE,"address",gE,Vi(TE)))))))))),AE=function(e){return f(Jd,function(e){if("Just"===e.$){var t=e.a;return zd(kf(t))}return sh},e)},BE=function(e){return Qd(F([L("fromBlock",ah(e.fromBlock)),L("toBlock",ah(e.toBlock)),L("address",ih(e.address)),L("topics",AE(e.topics))]))},kE=r(function(e,t){return tp({decoder:Km(IE),method:"eth_getLogs",params:F([BE(t)]),url:e})}),NE=function(e){return{$:"BlockNum",a:e}},RE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(op,function(r){return f(sp,yi(r),f(kE,e,U(t,{fromBlock:NE(n),toBlock:NE(a)})))},f(kE,e,t)):f(kE,e,t)}),$E=n(function(e,t,r){var n=r.a,a=r.b;return f(kE,e,U(t,{fromBlock:NE(n),toBlock:NE(a)}))}),xE=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(xE,e,t,i)),c=o;e=u,t=s,r=c}}),_E=r(function(e,t){return l(xE,kh,t,e)}),LE=r(function(e,t){var r=e.a,n=t.a;return Tm(f(_E,r,n))}),PE=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 Io(f(Pa,function(t){return f(yp,f(yo,nE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},aS(f(Pa,function(e){return f(Eh,e,r.requests)},ka(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(Em(U(r,{blockNumber:ci(a)})),Io(F([f(sE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,$E)]))):L(t,f(sE,r.nodePath,r.tagger))}return L(Em(U(r,{blockNumber:ci(a),pending:wm,watching:f(LE,r.watching,r.pending)})),Io(F([f(sE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,RE),l(i,L(a,a),r.watching,$E)])))}var s=e.a.a;return L(Em(U(r,{errors:f(Na,s,r.errors)})),f(sE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(oE,t,c,d)}var s=e.b.a;return L(Em(U(r,{errors:f(Na,s,r.errors)})),Ao)}),DE=r(function(e,t){var r=t.a;return Tm(l(kh,e,vr,r))}),UE=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(kh,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return P(Em(U(o,{watching:f(DE,a.ref,o.watching)})),f(yp,f(yo,nE(a.ref),a.tagger),e),a.ref)}(l(RE,a.nodePath,n,L(s,s)))}return P(Em(U(o,{pending:f(DE,a.ref,o.pending)})),Ao,a.ref)}),OE=UE(!1),ME=function(e){return F([e])},FE=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(mm,t.web3Context,r.id):Ao}return Ao}()),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(mp,t.web3Context,a,r.address,n.creationInfo.address,Uy)}return Ao}(),a=function(){return"Nothing"===t.chatHistoryModel.$?h(xS,t.web3Context,t.trade,t.userInfo,t.blocknumOnInit,t.eventsWaitingForChatHistory):P(t.chatHistoryModel,!1,mr)}(),i=a.a,o=a.b,u=a.c,s=U(t,{chatHistoryModel:i}),c=o?AS(t):Ao,p=t.trade;if("LoadedTrade"===p.$){var g=p.a;return d(Cm,s,Io(F([l(gC,t.web3Context,g.creationInfo.address,QS),c,r,n])),Ro,u)}return ZS(s);case"CurrentBlockFetched":var v=e.a;if("Ok"===v.$){var y=v.a;return ZS(U(t,{blocknumOnInit:ci(y)}))}var m=v.a;return d(Cm,t,Ao,Ro,F([ga(f(eg,"blocknum",m))]));case"AllowanceFetched":var v=e.a;if("Ok"===v.$){var b=v.a,s=U(t,{allowance:ci(b)}),C=P(s.txChainStatus,s.trade,s.userInfo);if("Just"===C.a.$&&"ApproveMining"===C.a.a.$&&"LoadedTrade"===C.b.$&&"Just"===C.c.$){var S=C.b.a,E=C.c.a;if($(f(Ou,b,Hf(wb(S.parameters))),Ca))return ZS(s);var T=d(CS,t.web3Context,S,E.address,E.commPubkey),w=T.a,I=T.b;return d(Cm,U(s,{txChainStatus:w}),Ao,I,mr)}return ZS(s)}var m=v.a;return d(Cm,t,Ao,Ro,F([ga(f(eg,"allowance",m))]));case"CreationInfoFetched":var v=e.a;if("Ok"===v.$){var A=v.a,B={address:A.address_,blocknum:yC(A.blocknum)},k=l(OE,jS,t.eventSentry,{address:B.address,fromBlock:NE(B.blocknum),toBlock:np,topics:mr}),N=k.a,R=k.b,s=U(t,{eventSentry:N,trade:f(Pb,B,t.trade)}),x=Io(F([R,h(vC,s.web3Context,B.address,qS,QS,GS)]));return d(Cm,s,x,Ro,mr)}if("BadBody"===v.a.$){v.a.a;return d(Cm,t,Ao,Ro,F([ga(eE)]))}var m=v.a;return d(Cm,t,Ao,Ro,F([ga(f(eg,"trade state",m))]));case"StateFetched":var v=e.a;if("Ok"===v.$&&"Just"===v.a.$){var _=v.a.a,D=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!$(e.a.state.phase,_.phase);default:return!1}}(),s=U(t,{expandedPhase:D?_.phase:t.expandedPhase,trade:f(Ob,_,t.trade)});return d(Cm,s,AS(s),Ro,mr)}return d(Cm,t,Ao,Ro,F([ga(f(tE,"trade state",v))]));case"ParametersFetched":var v=e.a;if("Ok"===v.$){if("Ok"===v.a.$){var M=v.a.a;if(Ib(M)){var s=U(t,{trade:f(Db,M,t.trade)});return d(Cm,s,AS(s),Ro,mr)}return d(Cm,t,Ao,Ro,F([ga(rE)]))}var V=v.a.a;return d(Cm,t,Ao,Ro,F([ga(f(Xp,"Error decoding fetched trade parameters",V))]))}var K=v.a;return d(Cm,t,Ao,Ro,F([ga(f(eg,"trade parameters",K))]));case"PhaseInfoFetched":var v=e.a;if("Ok"===v.$&&"Just"===v.a.$){var H=v.a.a,s=U(t,{trade:f(Ub,H,t.trade)});return d(Cm,s,AS(s),Ro,mr)}return d(Cm,t,Ao,Ro,F([ga(f(tE,"trade state",v))]));case"EventLogFetched":var j=e.a,q=f(Xd,Cb,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(Cm,t,Ao,Ro,F([ga(f(Xp,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(NC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(RC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=Hm(e.terms);if("Ok"===r.$){var n=r.a;return L(f(Mb,n,t.trade),fi)}var a=r.a;return L(t.trade,ci(f(Xp,"Couldn't decode payment methods!",a)))}return L(t.trade,fi)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return P(ci(t),r,f(Pa,Qi($S),n))}(l(iS,q.blockNumber,Y,r))}return h(xS,t.web3Context,Q,t.userInfo,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),i=Z.a,o=Z.b,u=Z.c,ee=function(){return"Nothing"===i.$?f(So,t.eventsWaitingForChatHistory,F([L(q.blockNumber,Y)])):mr}(),s=U(t,{chatHistoryModel:i,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),x=o?AS(s):Ao;return d(Cm,s,x,Ro,f(So,f(Pa,ga,aS(F([X]))),u));case"ExpandPhase":var te=e.a;return ZS(U(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return ZS(U(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return ZS(U(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=e.a,ie=t.trade;if("LoadedTrade"===ie.$){var S=ie.a;return d(Cm,t,Ao,Ro,F([ha(f(_f,S.parameters.initiatorAddress,ae))]))}return d(Cm,t,Ao,Ro,F([ga(f(Xp,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var S=e.a,E=e.b,oe=e.c;return ZS(U(t,{txChainStatus:ci(l(HS,S,E,oe))}));case"AbortAction":return ZS(U(t,{txChainStatus:fi}));case"ConfirmCommit":var S=e.a,E=e.b,oe=e.c,ue=function(){var e=t.web3Context.factoryType;if("Native"===e.$)return d(CS,t.web3Context,S,E.address,E.commPubkey);var r=e.a,n=function(){var e=Pf(l(cd,ad(r),S.creationInfo.address,oe)),t={onBroadcast:fi,onMined:fi,onSign:ci(OS)};return f(xf,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Ou,i,Hf(wb(S.parameters))),Ca)?L(ci(US),n):d(CS,t.web3Context,S,E.address,E.commPubkey)}return L(ci(US),n)}(),w=ue.a,I=ue.b;return d(Cm,U(t,{txChainStatus:w}),Ao,I,mr);case"ContractActionClicked":var se=e.a;if($(se,zS)||$(se,YS)){var ce=JS(se),fe=t;e=ce,t=fe;continue e}return ZS(U(t,{txChainStatus:ci(KS(se))}));case"StartContractAction":var le=e.a,de=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return P(t.txChainStatus,Ro,F([ga(f(Xp,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(le.$){case"Recall":var a=Pf($m(n.creationInfo.address));return P(ci(PS(YS)),f(xf,hS(YS),a),mr);case"Claim":var a=Pf(Nm(n.creationInfo.address));return P(ci(PS(FS)),f(xf,hS(FS),a),mr);case"Abort":var a=Pf(Bm(n.creationInfo.address));return P(ci(PS(_S)),f(xf,hS(_S),a),mr);case"Release":var a=Pf(xm(n.creationInfo.address));return P(ci(PS(WS)),f(xf,hS(WS),a),mr);case"Burn":var a=Pf(km(n.creationInfo.address));return P(ci(PS(MS)),f(xf,hS(MS),a),mr);default:var a=Pf(Rf(n.creationInfo.address));return P(ci(PS(zS)),f(xf,hS(zS),a),mr)}}(),w=de.a,I=de.b,u=de.c;return d(Cm,U(t,{txChainStatus:w}),Ao,I,u);case"ApproveSigned":var he=e.a;if("Ok"===he.$){var pe=he.a;return ZS(U(t,{txChainStatus:ci(DS(pe))}))}var V=he.a;return d(Cm,U(t,{txChainStatus:fi}),Ao,Ro,F([ga(f(ng,"approve",V))]));case"CommitSigned":var he=e.a;if("Ok"===he.$){var pe=he.a;return ZS(U(t,{txChainStatus:ci(VS(pe))}))}var V=he.a;return d(Cm,U(t,{txChainStatus:fi}),Ao,Ro,F([ga(f(ng,"commit",V))]));case"CommitMined":return ZS(U(t,{txChainStatus:fi}));case"ActionSigned":var se=e.a,he=e.b;if("Ok"===he.$){var pe=he.a;return ZS(U(t,{txChainStatus:ci(f(LS,se,pe))}))}var V=he.a;return d(Cm,U(t,{txChainStatus:fi}),Ao,Ro,F([ga(f(ng,XS(se),V))]));case"ActionMined":var se=e.a;return ZS(U(t,{txChainStatus:fi}));case"EventSentryMsg":var ge=e.a,ve=f(PE,ge,t.eventSentry),ye=ve.a,x=ve.b;return d(Cm,U(t,{eventSentry:ye}),x,Ro,mr);case"ChatHistoryMsg":var me=e.a,be=t.chatHistoryModel;if("Just"===be.$){var Ce=be.a,Se=f(fS,me,Ce),Ee=U(t,{chatHistoryModel:ci(Se.model)}),c=Se.shouldCallDecrypt?AS(t):Ao,Te=function(){var e=Se.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(pS(f(IC,r,a)),fi)}return L(Ao,ci(f(Xp,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Ao,fi)}(),we=Te.a,Ie=Te.b;return d(Cm,Ee,Io(F([c,we])),Ro,O(f(Xi,$S,Se.appCmds),f(yc,mr,f(jf,ME,f(jf,ga,Ie)))))}return d(Cm,t,Ao,Ro,F([ga(f(Xp,"Got a chat history message, but there is no chat history model!",me))]));case"EncryptionFinished":var Ae=e.a,Be=f(th,wC,EC(Ae)),ke=P(t.userInfo,t.trade,Be);if("Ok"===ke.c.$){if("Just"===ke.a.$&&"LoadedTrade"===ke.b.$){var E=ke.a.a,g=ke.b.a,Ne=ke.c.a,Re=f(Tb,g,E.address);if("Nothing"===Re.$)return d(Cm,t,Ao,Ro,F([ga(f(Xp,"Trying to encrypt, but the user is not involved in this trade.",fi))]));var $e=Re.a,xe=function(){return Pf("Initiator"===$e.$?f(Rm,g.creationInfo.address,Ne):f(_m,g.creationInfo.address,Ne))}();return d(Cm,t,Ao,f(xf,{onBroadcast:fi,onMined:fi,onSign:fi},xe),mr)}var _e=ke.a,Le=ke.b;return d(Cm,t,Ao,Ro,F([ga(f(Xp,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var Pe=ke.c.a;return d(Cm,t,Ao,Ro,F([ga(f(Xp,"Error translating JS encryption result into Elm.",Pe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return ZS(t)}var V=e.a.a;return d(Cm,t,Ao,Ro,F([ga(f(tg,"message",V))]));default:return d(Cm,t,Ao,Ro,F([va]))}}),VE=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Ethereum Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ethereum Eth";case"Kovan":e.a;return"Kovan Eth";default:e.a;return"xDai"}},KE=function(e){return{$:"EventSentryMsg",a:e}},HE=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),jE=function(e){var t=f(Im,KE,e.httpProvider),r=t.a,n=t.b;return P({dataFetchStatus:l(HE,fi,0,0),eventSentry:r,trades:Ga,web3Context:e},n,F([d(ed,"tradeCache init","processing",VE(e.factoryType),0)]))},qE=function(e){return{data:ci(f(Nf,"numTrades()",mr)),decoder:Zo(qd),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},GE=r(function(e,t){return f(yp,t,f(ap,e.httpProvider,qE(nd(e.factoryType))))}),zE=function(e){return{$:"InitialNumTradesFetched",a:e}},YE=function(e){return f(GE,e.web3Context,zE)},WE=function(e){var t=jE(e),r=t.a,n=t.b,a=t.c;return P(r,Io(F([n,YE(r)])),a)},JE=r(function(e,t){return{address:e,blocknum:t}}),QE=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(UE,!0,e,t,r))}),XE=n(function(e,t,r){var n=function(e){return r(f(Xd,eb,e).returnData)},a={address:t.address,fromBlock:NE(t.blocknum),toBlock:NE(t.blocknum),topics:F([ci(bb("Initiated(string,string)"))])};return l(QE,n,e,a)}),ZE=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(Na,a,r)}return r}),eT=r(function(e,t){return l(La,ZE(e),mr,t)}),tT=function(e){return f(eT,function(e){if("LoadedTrade"===e.$){var t=e.a;return ci(t)}return fi},Ta(e.trades))},rT=function(e){return f($a,r(function(t,r){return e(t)?r+1:r}),0)},nT=function(e){return f(rT,Qa(Ab),Ta(e.trades))},aT=function(e){return U(e,{dataFetchStatus:U(e.dataFetchStatus,{invalid:nT(e),loaded:wi(tT(e))})})},iT=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),oT=r(function(e,t){var r=f(Dc,e,t.trades);if("Just"===r.$){var n=(r.a,l(Vc,e,Ab,t.trades));return l(iT,aT(U(t,{trades:n})),Ao,mr)}return l(iT,t,Ao,F([ga(f(Xp,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),uT=n(function(e,t,r){var n=f(Dc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Pb,t,a),o=l(Vc,e,i,r.trades);return L(aT(U(r,{trades:o})),mr)}return L(r,F([f(Xp,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),sT=n(function(e,t,r){var n=f(Dc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Db,t,a),o=l(Vc,e,i,r.trades);return l(iT,aT(U(r,{trades:o})),Ao,mr)}return l(iT,r,Ao,F([ga(f(Xp,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),cT=n(function(e,t,r){var n=f(Dc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Ub,t,a),o=l(Vc,e,i,r.trades);return l(iT,aT(U(r,{trades:o})),Ao,mr)}return l(iT,r,Ao,F([ga(f(Xp,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),fT=n(function(e,t,r){var n=f(Dc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Ob,t,a),o=l(Vc,e,i,r.trades);return l(iT,aT(U(r,{trades:o})),Ao,mr)}return l(iT,r,Ao,F([ga(f(Xp,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),lT=n(function(e,t,r){var n=f(Dc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Mb,t,a),o=l(Vc,e,i,r.trades);return l(iT,aT(U(r,{trades:o})),Ao,mr)}return l(iT,r,Ao,F([ga(f(Xp,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),dT=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),hT=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),pT=function(e){return{$:"NumTradesFetchedAgain",a:e}},gT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),vT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),yT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),mT=function(e){return l(iT,e,Ao,mr)},bT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=yC(n),i=CC(f(Pa,tm,f(Bi,0,a-1))),o=Io(f(Pa,function(e){return l(vm,t.web3Context,ku(e),dT(e))},f(Bi,0,a-1)));return l(iT,U(t,{dataFetchStatus:l(HE,ci(a),0,0),trades:i}),o,mr)}var u=r.a;return l(iT,t,Ao,F([ga(f(eg,"Factory numTrades",u))]));case"CheckForNewTrades":return l(iT,t,f(GE,t.web3Context,pT),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=yC(n);if(_(c,d)<0){var p=t.dataFetchStatus,o=Io(f(Pa,function(e){return l(vm,t.web3Context,ku(e),dT(e))},f(Bi,c,d-1))),g=CC(f(Pa,tm,f(Bi,c,d-1)));return l(iT,U(t,{dataFetchStatus:U(p,{total:ci(d)}),trades:f(rS,t.trades,g)}),o,mr)}return mT(t)}s.b;return l(iT,t,Ao,F([ga(f(Xp,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=s.a.a;return l(iT,t,Ao,F([ga(f(eg,"Factory numTrades",u))]));case"CreationInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$){var y=r.a,m=f(JE,y.address_,yC(y.blocknum)),b=l(XE,t.eventSentry,m,hT(v)),C=b.a,S=b.b,E=Io(F([h(vC,t.web3Context,m.address,gT(v),yT(v),vT(v)),S])),T=l(uT,v,m,t),w=T.a,I=T.b;return l(iT,aT(U(w,{eventSentry:C})),E,f(Pa,ga,I))}var u=r.a;return l(iT,t,Ao,F([ga(f(eg,"creationInfo",u))]));case"ParametersFetched":var v=e.a,r=e.b;if("Err"===r.$){var A=r.a;return l(iT,t,Ao,F([ga(f(eg,"parameters",A))]))}if("Ok"===r.a.$){var B=r.a.a;return l(sT,v,B,t)}var k=r.a.a;return l(iT,t,Ao,F([ga(f(Xp,"Can't decode fetched trade parameters",k))]));case"StateFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var N=r.a.a;return l(fT,v,N,t)}return l(iT,t,Ao,F([ga(f(tE,"state",r))]));case"PhaseStartInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var R=r.a.a;return l(cT,v,R,t)}return l(iT,t,Ao,F([ga(f(tE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var v=e.a,r=e.b;if("Ok"===r.$){var $=r.a,x=Hm($.terms);if("Ok"===x.$){var P=x.a;return l(lT,v,P,t)}var D=x.a;return f(oT,v,t)}var D=r.a;return l(iT,t,Ao,F([ga(f(Xp,"Error decoding initiated event",D))]));default:var O=e.a,M=f(PE,O,t.eventSentry),V=M.a,E=M.b;return l(iT,U(t,{eventSentry:V}),E,mr)}}),CT=function(e){return{$:"AgentHistoryMsg",a:e}},ST=function(e){return{$:"AppCmd",a:e}},ET={$:"BetaLandingPage"},TT={$:"ConnectToWeb3"},wT=function(e){return{$:"MarketplaceMsg",a:e}},IT=function(e){return{$:"TradeCacheMsg",a:e}},AT=r(function(e,t){return f(Nn,e,zd(t))}),BT=function(e){return f(AT,"href",rt(e))},kT=Rn("rel"),NT=AT("target"),RT=function(e){return{$:"Height",a:e}},$T=RT,xT={$:"Content"},_T=xT,LT=function(e){return{$:"Width",a:e}},PT=LT,DT=function(e){return{$:"Attr",a:e}},UT=function(e){return{$:"NodeName",a:e}},OT=function(e){return{$:"Unkeyed",a:e}},MT={$:"AsEl"},FT=MT,VT=r(function(e,t){return{$:"Field",a:e,b:t}}),KT=f(VT,0,0),HT={$:"NoNearbyChildren"},jT={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"},qT=jT.any+" "+jT.column,GT=jT.any+" "+jT.grid,zT=jT.any+" "+jT.page,YT=jT.any+" "+jT.paragraph,WT=jT.any+" "+jT.row,JT=jT.any+" "+jT.single,QT=function(e){switch(e.$){case"AsRow":return WT;case"AsColumn":return qT;case"AsEl":return JT;case"AsGrid":return GT;case"AsParagraph":return YT;default:return zT}},XT=function(e){return{$:"Keyed",a:e}},ZT={$:"NoStyleSheet"},ew=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))}}),tw=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return O(f(Pa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return O(t,f(Pa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return O(f(Pa,function(t){return L(e,t)},n),O(t,f(Pa,function(t){return L(e,t)},a)))}}),rw={$:"AsParagraph"},nw=rw,aw=Tn("div"),iw=Tn("p"),ow=Tn("s"),uw=Tn("u"),sw=AT("className"),cw=function(e){return In(Ze(e))},fw=function(e){return Tn(Ze(e))},lw=function(e){return{$:"Flag",a:e}},dw=function(e){return{$:"Second",a:e}},hw=function(e){return e>31?dw(1< .ctr > ."+jT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",pI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Pw(jT.any)+Pw(jT.row)+" > "+Pw(jT.any)+" { flex-basis: auto !important; } "+Pw(jT.any)+Pw(jT.row)+" > "+Pw(jT.any)+Pw(jT.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"+hI,gI=function(e){return{$:"Intermediate",a:e}},vI=r(function(e,t){return gI({closing:t,others:mr,props:mr,selector:e})}),yI=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(Na,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(Na,gI({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(Na,f(yI,f(vI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return U(t,{others:f(Na,f(yI,f(vI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return U(t,{others:f(Na,f(yI,f(vI,O(n.selector,p),""),g),t.others)});default:var v=e.a;return U(t,{others:f(Na,f(yI,f(vI,n.selector,""),v),t.others)})}});return gI(l(La,a,n,t))}),mI=O(pI,function(e){var t=function(e){return Sl(f(Pa,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(Pa,a,t.others)))};return Sl(f(Pa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(Na,f(yI,f(vI,r,""),n),t)}),mr,e)))}(O(fI,dI))),bI=l(fw,"style",mr,F([Uw(mI)])),CI=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+'"'}},SI=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}},EI=function(e){if("FontWith"===e.$){var t=e.a;return f(Sd,SI,t.variants)}return!1},TI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),wI=r(function(e,t){return e+" {"+f($i,"",f(Pa,function(e){return e.a+": "+e.b+";"},t))+"}"}),II=n(function(e,t,r){var n=r.a,a=r.b;return F([f(wI,"."+e+"."+t+", ."+e+" ."+t,n),f(wI,"."+e+"."+t+"> ."+jT.text+", ."+e+" ."+t+" > ."+jT.text,a)])}),AI=n(function(e,t,r){var n=t.a,a=t.b,i=$(e,r)?e:r+" ."+e;return f($i," ",O(l(II,i,jT.sizeByCapital,a),l(II,i,jT.fullSize,n)))}),BI=r(function(e,t){var r=$(e,t)?e:t+" ."+e;return f($i," ",F([f(wI,"."+r+"."+jT.sizeByCapital+", ."+r+" ."+jT.sizeByCapital,F([L("line-height","1")])),f(wI,"."+r+"."+jT.sizeByCapital+"> ."+jT.text+", ."+r+" ."+jT.sizeByCapital+" > ."+jT.text,F([L("vertical-align","0"),L("line-height","1")]))]))}),kI=function(e){if(e.b){var t=e.a,r=e.b;return ci(l($a,ti,t,r))}return fi},NI=function(e){if(e.b){var t=e.a,r=e.b;return ci(l($a,oc,t,r))}return fi},RI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),$I=function(e){var t=F([e.capital,e.baseline,e.descender,e.lowercase]),r=f(yc,e.descender,NI(t)),n=f(yc,e.baseline,NI(f(eh,function(e){return!$(e,r)},t))),a=f(yc,e.capital,kI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(RI,i,a-n,o),full:l(RI,u,a-r,s)}},xI=function(e){return L(F([L("display","block")]),F([L("display","inline-block"),L("line-height",xw(e.height)),L("vertical-align",xw(e.vertical)+"em"),L("font-size",xw(e.size)+"em")]))},_I=function(e){return l($a,r(function(e,t){if("Nothing"===t.$){if("FontWith"===e.$){var r=e.a,n=r.adjustment;if("Nothing"===n.$)return t;var a=n.a;return ci(L(xI(function(e){return e.full}($I(a))),xI(function(e){return e.capital}($I(a)))))}return t}return t}),fi,e)},LI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return ci("@import url('"+t+"');")}return fi},r=function(e){var r=(e.a,e.b);return f($i,"\n",f(eT,t,r))},n=f(Pa,Xa,e),a=function(e){var t=e.a,r=e.b,a=_I(r);if("Nothing"===a.$)return f($i,"",f(Pa,BI(t),n));var i=a.a;return f($i,"",f(Pa,f(AI,t,i),n))};return O(f($i,"\n",f(Pa,r,e)),f($i,"\n",f(Pa,a,e)))},PI=function(e){switch(e.$){case"VariantActive":var t=e.a;return'"'+t+'"';case"VariantOff":var t=e.a;return'"'+t+'" 0';default:var t=e.a,r=e.b;return'"'+t+'" '+Ri(r)}},DI=function(e){if("FontWith"===e.$){var t=e.a;return ci(f($i,", ",f(Pa,PI,t.variants)))}return fi},UI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return ci(L(t,r))}return fi},OI=function(e){switch(e.$){case"Untransformed":return fi;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return ci("translate3d("+xw(r)+"px, "+xw(n)+"px, "+xw(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("+xw(o)+"px, "+xw(u)+"px, "+xw(s)+"px)",b="scale3d("+xw(f)+", "+xw(l)+", "+xw(d)+")",C="rotate3d("+xw(p)+", "+xw(g)+", "+xw(v)+", "+xw(y)+"rad)";return ci(m+" "+b+" "+C)}},MI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l($a,TI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l($a,TI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l($a,TI(!1),"",n)+"\n}"}case"Focus":var a=l($a,TI(!1),"",n);return f($i,"\n",F([r+"-fs:focus {"+a+"\n}","."+jT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+jT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+jT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l($a,TI(!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(Rw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ti,0,f(oc,1,1-c));return l(a,t,"."+u,F([f(Rw,"opacity",xw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ri(h),F([f(Rw,"font-size",Ri(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f($i,", ",f(eT,DI,p)),v=F([f(Rw,"font-family",f($i,", ",f(Pa,CI,p))),f(Rw,"font-feature-settings",g),f(Rw,"font-variant",f(Sd,EI,p)?"small-caps":"normal")]);return f($i," ",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(Rw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,F([f(Rw,s,_w(b))]));case"SpacingStyle":var C=e.a,S=e.b,E=e.c,T=Ri(E)+"px",w=Ri(S)+"px",I="."+jT.row,A="."+(jT.wrapped+I),B="."+jT.alignRight,k="."+jT.paragraph,N="."+jT.page,R="."+jT.alignLeft,$=xw(E/2)+"px",x=xw(S/2)+"px",_="."+jT.column,y="."+C,P="."+jT.any;return Sl(F([l(a,t,y+(I+" > ")+P+" + "+P,F([f(Rw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,F([f(Rw,"margin",$+" "+x)])),l(a,t,y+(_+" > ")+P+" + "+P,F([f(Rw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,F([f(Rw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,F([f(Rw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,F([f(Rw,"margin-left",w)])),l(a,t,O(y,k),F([f(Rw,"line-height","calc(1em + "+Ri(E)+"px)")])),l(a,t,"textarea"+y,F([f(Rw,"line-height","calc(1em + "+Ri(E)+"px)")])),l(a,t,y+(k+" > ")+R,F([f(Rw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,F([f(Rw,"margin-left",w)])),l(a,t,y+(k+"::after"),F([f(Rw,"content","''"),f(Rw,"display","block"),f(Rw,"height","0"),f(Rw,"width","0"),f(Rw,"margin-top",Ri(-1*(E/2|0))+"px")])),l(a,t,y+(k+"::before"),F([f(Rw,"content","''"),f(Rw,"display","block"),f(Rw,"height","0"),f(Rw,"width","0"),f(Rw,"margin-bottom",Ri(-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(Rw,"padding",Ri(D)+"px "+Ri(B)+"px "+Ri(U)+"px "+Ri(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(Rw,"border-width",Ri(D)+"px "+Ri(B)+"px "+Ri(U)+"px "+Ri(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 Ri(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, "+Ri(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ri(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ri(o)+"px, "+Ri(i)+"px)";case"Fill":var u=r.a,s=L(e,t);if("Nothing"===s.a.$){if("Nothing"===s.b.$){s.a,s.b;return Ri(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ri(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ri(o)+"px, "+Ri(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ri(o)+"px, "+Ri(i)+"px)";case"Min":var c=r.a,f=r.b,l=ci(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=ci(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,fi,fi,e)},H=(K(M.spacing.a),K(M.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f($i," ",f(Pa,K,M.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f($i,H,f(Pa,K,M.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f($i,H,f(Pa,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($i," ",f(Pa,K,M.columns))),y=".grid-rows-"+f($i,"-",f(Pa,Iw,M.rows))+"-cols-"+f($i,"-",f(Pa,Iw,M.columns))+"-space-x-"+Iw(M.spacing.a)+"-space-y-"+Iw(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($i," ",F(["-ms-grid-row: "+Ri(Z.row)+";","-ms-grid-row-span: "+Ri(Z.height)+";","-ms-grid-column: "+Ri(Z.col)+";","-ms-grid-column-span: "+Ri(Z.width)+";"])),te=f($i," ",F(["grid-row: "+Ri(Z.row)+" / "+Ri(Z.row+Z.height)+";","grid-column: "+Ri(Z.col)+" / "+Ri(Z.col+Z.width)+";"])),y=".grid-pos-"+Ri(Z.row)+"-"+Ri(Z.col)+"-"+Ri(Z.width)+"-"+Ri(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return O(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f($i," ",f(Pa,function(e){return f(i,e,ci(y))},re));default:var ne=e.a,m=OI(ne),y=Bw(ne),ae=L(y,m);if("Just"===ae.a.$&&"Just"===ae.b.$){var C=ae.a.a,ie=ae.b.a;return l(a,t,"."+C,F([f(Rw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:O(t.rules,f(i,e,fi)),topLevel:function(){var r=UI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(Na,n,t.topLevel)}()}}),u=l($a,o,{rules:"",topLevel:mr},t),s=u.topLevel,c=u.rules;return O(LI(s),c)}),FI=r(function(e,t){return l(fw,"style",mr,F([Uw(f(MI,e,t))]))}),VI=a(function(e,t,r,n){return e?f(Na,L("static-stylesheet",bI),f(Na,L("dynamic-stylesheet",f(FI,t,l($a,Nw,L(wm,F([Dw(t.focus)])),r).b)),n)):f(Na,L("dynamic-stylesheet",f(FI,t,l($a,Nw,L(wm,F([Dw(t.focus)])),r).b)),n)}),KI=a(function(e,t,r,n){return e?f(Na,bI,f(Na,f(FI,t,l($a,Nw,L(wm,F([Dw(t.focus)])),r).b),n)):f(Na,f(FI,t,l($a,Nw,L(wm,F([Dw(t.focus)])),r).b),n)}),HI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(cw,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(VI,!1,e,t,r);default:var e=i.a,t=i.b;return d(VI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return aw;case"p":return iw;default:return fw(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(KI,!1,e,t,n);default:var e=i.a,t=i.b;return d(KI,!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(fw,e,n,F([f(u,r,F([sw(jT.any+" "+jT.single)]))]))}}();switch(o.$){case"AsRow":return f(Cw,Ew,e)&&!f(Cw,Sw,e)?s:f(Cw,gw,e)?f(uw,F([sw(f($i," ",F([jT.any,jT.single,jT.container,jT.contentCenterY,jT.alignContainerRight])))]),F([s])):f(Cw,vw,e)?f(ow,F([sw(f($i," ",F([jT.any,jT.single,jT.container,jT.contentCenterY,jT.alignContainerCenterX])))]),F([s])):s;case"AsColumn":return f(Cw,bw,e)&&!f(Cw,mw,e)?s:f(Cw,yw,e)?f(ow,F([sw(f($i," ",F([jT.any,jT.single,jT.container,jT.alignContainerCenterY])))]),F([s])):f(Cw,pw,e)?f(uw,F([sw(f($i," ",F([jT.any,jT.single,jT.container,jT.alignContainerBottom])))]),F([s])):s;default:return s}}),jI=Uw,qI=function(e){return f(aw,F([sw(f($i," ",F([jT.any,jT.text,jT.widthContent,jT.heightContent])))]),F([jI(e)]))},GI=function(e){return l(fw,"div",F([sw(f($i," ",F([jT.any,jT.text,jT.widthFill,jT.heightFill])))]),F([Uw(e)]))},zI=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,nw),L(f(Na,L(n,u(e)),i),o);case"Styled":var s=a.a;return $(e,nw),L(f(Na,L(n,f(s.html,ZT,e)),i),su(o)?s.styles:O(s.styles,o));case"Text":var c=a.a;return L(f(Na,L(n,$(e,FT)?GI(c):qI(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,nw),L(f(Na,i(e),n),a);case"Styled":var o=t.a;return $(e,nw),L(f(Na,f(o.html,ZT,e),n),su(a)?o.styles:O(o.styles,a));case"Text":var u=t.a;return L(f(Na,$(e,FT)?GI(u):qI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(mr,mr),o),s=u.a,c=u.b,p=su(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return qi({html:d(HI,n.has,n.node,n.attributes,XT(l(tw,"nearby-element-pls",s,n.children))),styles:g})}return zi(h(HI,n.has,n.node,n.attributes,XT(l(tw,"nearby-element-pls",s,n.children)),ZT))}var v=t.a,y=l(La,i,L(mr,mr),v),m=y.a,c=y.b,p=su(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return qi({html:d(HI,n.has,n.node,n.attributes,OT(f(ew,m,n.children))),styles:g})}return zi(h(HI,n.has,n.node,n.attributes,OT(f(ew,m,n.children)),ZT))}),YI=r(function(e,t){return f(Rn,et(e),nt(t))}),WI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(VT,a|r,n)}var i=e.a;return f(VT,r,i|n)}),JI=hw(7),QI=hw(36),XI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(VT,r|a,n|i)}),ZI=hw(6),eA=hw(38),tA=hw(30),rA=hw(29),nA=r(function(e,t){return{$:"Embedded",a:e,b:t}}),aA=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),iA=function(e){return{$:"Transform",a:e}},oA=function(e){return{$:"ChildrenBehind",a:e}},uA=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),sA=function(e){return{$:"ChildrenInFront",a:e}},cA=r(function(e,t){return f(aw,F([sw(function(){switch(e.$){case"Above":return f($i," ",F([jT.nearby,jT.single,jT.above]));case"Below":return f($i," ",F([jT.nearby,jT.single,jT.below]));case"OnRight":return f($i," ",F([jT.nearby,jT.single,jT.onRight]));case"OnLeft":return f($i," ",F([jT.nearby,jT.single,jT.onLeft]));case"InFront":return f($i," ",F([jT.nearby,jT.single,jT.inFront]));default:return f($i," ",F([jT.nearby,jT.single,jT.behind]))}}())]),F([function(){switch(t.$){case"Empty":return Uw("");case"Text":var e=t.a;return qI(e);case"Unstyled":return(0,t.a)(FT);default:return f(t.a.html,ZT,FT)}}()]))}),fA=n(function(e,t,r){var n=f(cA,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?oA(F([n])):sA(F([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?oA(f(Na,n,a)):f(uA,a,F([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(uA,F([n]),i):sA(f(Na,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(uA,f(Na,n,a),i):f(uA,a,f(Na,n,i))}}),lA=r(function(e,t){switch(t.$){case"Generic":return UT(e);case"NodeName":var r=t.a;return f(nA,r,e);default:var n=t.a,a=t.b;return f(nA,n,a)}}),dA=function(e){switch(e.$){case"Left":return jT.alignedHorizontally+" "+jT.alignLeft;case"Right":return jT.alignedHorizontally+" "+jT.alignRight;default:return jT.alignedHorizontally+" "+jT.alignCenterX}},hA=function(e){switch(e.$){case"Top":return jT.alignedVertically+" "+jT.alignTop;case"Bottom":return jT.alignedVertically+" "+jT.alignBottom;default:return jT.alignedVertically+" "+jT.alignCenterY}},pA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),gA=function(e){return{$:"Moved",a:e}},vA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return gA(P(r,0,0));case"MoveY":var n=t.a;return gA(P(0,n,0));case"MoveZ":var a=t.a;return gA(P(0,0,a));case"MoveXYZ":var i=t.a;return gA(i);case"Rotate":var i=t.a,o=t.b;return d(pA,P(0,0,0),P(1,1,1),i,o);default:var i=t.a;return d(pA,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 gA(P(s,n,a));case"MoveY":var c=t.a;return gA(P(r,c,a));case"MoveZ":var f=t.a;return gA(P(r,n,f));case"MoveXYZ":var i=t.a;return gA(i);case"Rotate":var i=t.a,o=t.b;return d(pA,u,P(1,1,1),i,o);default:var l=t.a;return d(pA,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(pA,P(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(pA,P(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(pA,P(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(pA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(pA,u,h,v,y);default:var m=t.a;return d(pA,u,m,p,o)}}}),yA=function(e){switch(e.$){case"Px":var t=e.a,r=Ri(t),n="height-px-"+r;return P(KT,n,F([l(aA,n,"height",r+"px")]));case"Content":return P(f(WI,QI,KT),jT.heightContent,mr);case"Fill":var a=e.a;return 1===a?P(f(WI,bw,KT),jT.heightFill,mr):P(f(WI,bw,KT),jT.heightFillPortion+" height-fill-"+Ri(a),F([l(aA,jT.any+"."+jT.row+" > "+Pw("height-fill-"+Ri(a)),"flex-grow",Ri(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ri(i),s=l(aA,u,"min-height",Ri(i)+"px"),c=yA(o),d=c.a,h=c.b,p=c.c;return P(f(WI,mw,d),u+" "+h,f(Na,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ri(g),s=l(aA,u,"max-height",Ri(g)+"px"),v=yA(o),d=v.a,h=v.b,p=v.c;return P(f(WI,mw,d),u+" "+h,f(Na,s,p))}},mA=function(e){switch(e.$){case"Px":var t=e.a;return P(KT,jT.widthExact+" width-px-"+Ri(t),F([l(aA,"width-px-"+Ri(t),"width",Ri(t)+"px")]));case"Content":return P(f(WI,eA,KT),jT.widthContent,mr);case"Fill":var r=e.a;return 1===r?P(f(WI,Ew,KT),jT.widthFill,mr):P(f(WI,Ew,KT),jT.widthFillPortion+" width-fill-"+Ri(r),F([l(aA,jT.any+"."+jT.row+" > "+Pw("width-fill-"+Ri(r)),"flex-grow",Ri(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ri(n),o=l(aA,i,"min-width",Ri(n)+"px"),u=mA(a),s=u.a,c=u.b,d=u.c;return P(f(WI,Sw,s),i+" "+c,f(Na,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ri(h),o=l(aA,i,"max-width",Ri(h)+"px"),p=mA(a),s=p.a,c=p.b,d=p.c;return P(f(WI,Sw,s),i+" "+c,f(Na,o,d))}},bA=hw(27),CA=r(function(e,t){if($(e,bA)){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}}),SA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=Bw(n);if("Nothing"===s.$)return{attributes:f(Na,sw(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(Na,sw(e+" "+c),i),children:o,has:r,node:t,styles:f(Na,iA(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(Cw,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(WI,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(Na,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(Cw,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(CA,E,I)){var p=kw(I)+" "+e,g=t,v=f(WI,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=kw(I)+" "+e,g=t,v=f(WI,E,r),y=n,m=f(Na,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(WI,E,r),y=f(vA,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(Cw,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}switch(B.$){case"Px":var k=B.a,p=jT.widthExact+" width-px-"+Ri(k)+" "+e,g=t,v=f(WI,ZI,r),y=n,m=f(Na,l(aA,"width-px-"+Ri(k),"width",Ri(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+" "+jT.widthContent,g=t,v=f(WI,eA,f(WI,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;case"Fill":var N=B.a;if(1===N){var p=e+" "+jT.widthFill,g=t,v=f(WI,Ew,f(WI,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}var p=e+" "+jT.widthFillPortion+" width-fill-"+Ri(N),g=t,v=f(WI,Ew,f(WI,ZI,r)),y=n,m=f(Na,l(aA,jT.any+"."+jT.row+" > "+Pw("width-fill-"+Ri(N)),"flex-grow",Ri(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=mA(B),$=R.a,x=R.b,_=R.c,p=e+" "+x,g=t,v=f(XI,$,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(Cw,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(L.$){case"Px":var k=L.a,P=Ri(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(WI,JI,r),y=n,m=f(Na,l(aA,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=jT.heightContent+" "+e,g=t,v=f(WI,QI,f(WI,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=L.a;if(1===N){var p=jT.heightFill+" "+e,g=t,v=f(WI,bw,f(WI,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+" "+jT.heightFillPortion+" height-fill-"+Ri(N),g=t,v=f(WI,bw,f(WI,JI,r)),y=n,m=f(Na,l(aA,jT.any+"."+jT.column+" > "+Pw("height-fill-"+Ri(N)),"flex-grow",Ri(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=yA(L),$=U.a,x=U.b,_=U.c,p=e+" "+x,g=t,v=f(XI,$,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(lA,"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(lA,"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(lA,"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(lA,"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(lA,"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(lA,"h"+Ri(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(lA,"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 UT("p");case"NodeName":var e=t.a;return UT(e);default:var r=t.a,n=t.b;return f(nA,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(Na,f(YI,"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(Na,f(YI,"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(Na,f(YI,"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(Na,f(YI,"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(fA,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(Cw,tA,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=dA(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(WI,vw,e);case"Right":return f(WI,gw,e);default:return e}}(f(WI,tA,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(Cw,rA,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=hA(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(WI,yw,e);case"Bottom":return f(WI,pw,e);default:return e}}(f(WI,rA,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}}}),EA={$:"Untransformed"},TA=EA,wA=a(function(e,t,r,n){return l(zI,e,n,v(SA,QT(e),t,KT,TA,mr,mr,HT,xa(r)))}),IA=function(e){return DT(sw(e))},AA=r(function(e,t){var r=t.url,n=t.label;return d(wA,FT,UT("a"),f(Na,DT(BT(r)),f(Na,DT(kT("noopener noreferrer")),f(Na,DT(NT("_blank")),f(Na,PT(_T),f(Na,$T(_T),f(Na,IA(jT.contentCenterX+" "+jT.contentCenterY),e)))))),OT(F([n])))}),BA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),kA=n(function(e,t,r){return d(BA,e,t,r,1)}),NA=hw(14),RA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),$A=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),xA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return Aw(t)+"-"+Aw(r)+"-"+Aw(n)+"-"+Aw(a)},_A=function(e){return f($A,NA,l(RA,"fc-"+xA(e),"color",e))},LA={align:Wp,label:"cantConnectNoWeb3",mainParagraphs:F([F([Qp("You need a web3 provider (such as "),f(AA,F([_A(l(kA,0,0,1))]),{label:Qp("Metamask"),url:"https://metamask.io/"}),Qp(") to Connect.")]),F([Qp("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:rg},PA={align:Wp,label:"invalidUrl",mainParagraphs:F([F([Qp("I don't understand that URL...")]),F([Qp("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:Zp},DA={align:Wp,label:"wrongWeb3Network",mainParagraphs:F([F([Qp("Your wallet is set to an incorrect network.")]),F([Qp("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:Zp},UA=Xo(f(yo,Bf,f(yo,jd,_l("Error decoding hex to BigInt")))),OA=function(){return Xo(function(e){switch(e){case"0x0":return di(!1);case"0x1":return di(!0);default:return li("Error decoding "+e+"as bool.")}})}(),MA=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}}}}}}}}}}}},FA=function(e){return fE(F([f(Mi,ci,e),Vi(fi)]))},VA=f(hd,FA(f(Md,"status",OA)),f(hd,FA(f(Md,"root",Qo)),l(pE,"logsBloom",Qo,l(pE,"logs",Km(IE),f(hd,FA(f(Md,"contractAddress",gE)),l(pE,"cumulativeGasUsed",UA,l(pE,"gasUsed",UA,l(pE,"blockNumber",om,l(pE,"blockHash",bE,l(pE,"transactionIndex",om,l(pE,"transactionHash",EE,Vi(MA)))))))))))),KA=function(e){var t=e.a;return Bf(t)},HA=f(yo,KA,zd),jA=r(function(e,t){return tp({decoder:VA,method:"eth_getTransactionReceipt",params:F([HA(t)]),url:e})}),qA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),GA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),zA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),YA=r(function(e,t){return f(jf,function(e){return e.toMsg},f(ag,function(e){return e.b},f(ag,function(e){return e.onMinedTagger},f(Eh,t,e))))}),WA=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}}}}}}}}}}}},JA=function(e){return fE(F([cE(fi),f(Mi,ci,e)]))},QA=l(pE,"input",Qo,l(pE,"gas",om,l(pE,"gasPrice",UA,l(pE,"value",UA,l(pE,"to",JA(gE),l(pE,"from",gE,l(pE,"transactionIndex",om,l(pE,"blockNumber",JA(om),l(pE,"blockHash",function(e){return f(Wo,function(t){return"0x"===t||"0x0"===t?Vi(fi):f(Ni,function(e){return $(e,D("0"))},Go(t))?Vi(fi):f(Mi,ci,e)},Qo)}(bE),l(pE,"nonce",om,l(pE,"hash",EE,Vi(WA)))))))))))),XA=r(function(e,t){return tp({decoder:QA,method:"eth_getTransactionByHash",params:F([HA(t)]),url:e})}),ZA=r(function(e,t){return{attempts:e,sleep:t}}),eB=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(vp,function(e){return a>0?f(op,function(e){return f(eB,f(ZA,a,n),t)},uE(1e3*n)):Qh(e)},t)}),tB=r(function(e,t){return f(op,function(r){return f(eB,{attempts:30,sleep:1},f(XA,e,t))},uE(250))}),rB=r(function(e,t){return f(eB,{attempts:60,sleep:5},f(jA,e,t))}),nB=function(e){return{$:"Mined",a:e}},aB=function(e){return jf(function(t){return U(t,{status:nB(e)})})},iB=function(e){return{$:"Sent",a:e}},oB=function(e){return jf(function(t){return U(t,{status:iB(e)})})},uB=function(e){return{$:"Signed",a:e}},sB=function(e){return jf(function(t){return U(t,{status:uB(e)})})},cB=function(e){return"Nothing"!==e.$},fB=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(xg(r),Ao);case"TxSigned":var n=e.a,a=e.b,i=f(Eh,n,r.txs);if("Just"===i.$){var o=i.a,u=function(){var e=o.onSignedTagger;if("Just"===e.$){var t=e.a;return f(hg,t,Xh(a))}return Ao}(),s=function(e){var t=P(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Ao;if("Just"===t.b.$){var r=t.b.a;return f(hg,r,Xh(li(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(hg,a,Xh(li(e)))}t.a,t.b,t.c;return Ao};if("Ok"===a.$){var c=a.a,d=cB(o.onBroadcastTagger)||cB(o.onMinedTagger)?f(Dg,r.tagger,f(yp,zA(n),f(tB,r.nodePath,c))):Ao;return L(xg(U(r,{txs:l(Uh,n,sB(c),r.txs)})),Io(F([u,d])))}var h=a.a;return L(xg(r),Io(F([u,s(h)])))}return L(xg(r),Ao);case"TxSent":var n=e.a,p=e.b,g=f(Eh,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Dg,r.tagger,f(yp,GA(n),f(rB,r.nodePath,v.hash))):Ao}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(hg,t,Xh(di(v)))}return Ao}();return L(xg(U(r,{txs:l(Uh,n,oB(v),r.txs)})),Io(F([d,y])))}var h=p.a,s=function(){var e=L(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(hg,t,Xh(li("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(hg,n,Xh(li("Error with TxSent stuff")))}e.a,e.b;return Ao}();return L(xg(r),s)}return L(xg(r),Ao);case"TxMined":var n=e.a,m=e.b,b=f(Eh,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(hg,a,Xh(di(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 Io(F([f(Dg,r.tagger,f(yp,f(qA,n,s),um(r.nodePath))),f(hg,a,Xh(di(C))),f(hg,u.toMsg,Xh(s))]))}return Ao}();return L(xg(U(r,{txs:l(Uh,n,aB(C),r.txs)})),S)}var h=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(hg,r,Xh(li("TxReceipt decoding failure")))}return Ao}();return L(xg(r),E)}return L(xg(r),Ao);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(YA,r.txs,n);if("Just"===A.$){var B=A.a;return L(xg(r),f(hg,B,f(vp,function(e){return Xh(U(I,{doneWatching:!0,reOrg:!0}))},f(op,function(e){return Xh(U(I,{doneWatching:!0}))},f(jA,r.nodePath,T.txHash)))))}return L(xg(r),Ao)}if($(w,T.lastCheckedBlock))return L(xg(r),f(Dg,r.tagger,f(yp,f(qA,n,T),f(op,function(e){return um(r.nodePath)},uE(2e3)))));var k=f(YA,r.txs,n);if("Just"===k.$){var B=k.a;return L(xg(r),Io(F([f(Dg,r.tagger,f(yp,f(qA,n,I),f(op,function(e){return um(r.nodePath)},uE(2e3)))),f(hg,B,Xh(I))])))}return L(xg(r),Ao)}var n=e.a,h=e.c.a;return L(xg(r),Ao);default:var h=e.a;return L(xg(r),Ao)}}),lB=Qt,dB=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ri(r)}),hB=n(function(e,t,r){return"Nothing"===t.$?r:O(r,O(e,t.a))}),pB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(hB,"#",e.fragment,l(hB,"?",e.query,O(f(dB,e.port_,O(t,e.host)),e.path)))},gB=r(function(e,t){if(e<0)return t;var r=kd(f(al,e,t)),n=f(Ys,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(So,n,a)}),vB=r(function(e,t){Yv(t);switch(t.$){case"Home":return L(U(e,{submodel:ET}),Ao);case"Create":var r=f(Zl,e.web3Context,e.userInfo),n=f(Mg,e.txSentry,f(Vg,Vy,r.chainCmd)),a=n.a,i=n.b;return f(mB,f(Xi,Vy,r.appCmds),L(U(e,{submodel:Fy(r.model),txSentry:a}),Io(F([f(Dg,Vy,r.cmd),i]))));case"QuickCreate":var r=f(Iv,e.web3Context,e.userInfo),o=f(Mg,e.txSentry,f(Vg,jy,r.chainCmd)),a=o.a,i=o.b;return f(mB,f(Xi,jy,r.appCmds),L(U(e,{submodel:Hy(r.model),txSentry:a}),Io(F([f(Dg,jy,r.cmd),i]))));case"Trade":var u=t.a,r=l(Am,e.web3Context,e.userInfo,u),s=f(Mg,e.txSentry,f(Vg,Gy,r.chainCmd)),a=s.a,i=s.b;return f(mB,f(Xi,Gy,r.appCmds),L(U(e,{submodel:qy(r.model),txSentry:a}),Io(F([f(Dg,Gy,r.cmd),i]))));case"Marketplace":var c=t.a,h=l(iv,e.web3Context,c,e.userInfo),p=h.a,g=h.b;return L(U(e,{submodel:Ky(p)}),Io(F([f(Dg,wT,g)])));case"AgentHistory":var v=t.a,y=t.b,m=d(Bo,e.web3Context,v,y,e.userInfo),b=m.a,C=m.b;return L(U(e,{submodel:My(b)}),Io(F([f(Dg,CT,C)])));default:return L(f(Eo,PA,e),Ao)}}),yB=r(function(e,t){var r=t.a,n=t.b,a=f(bB,ST(e),r),i=a.a,o=a.b;return L(i,Io(F([n,o])))}),mB=r(function(e,t){var r=t.a,n=t.b;return l($a,yB,L(r,n),e)}),bB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(bB,TT,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)));case"UserNotice":var i=r.a;return L(f(Eo,i,t),Ny(By(d(Uf,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(bv,$y,o,u,s));default:return L(t,xy(vr))}case"DismissNotice":var c=e.a;return L(U(t,{userNotices:f(gB,c,t.userNotices)}),Ao);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(wy,t.key,pB(e))}var r=h.a;return lB(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(CB,g,t);case"GotoRoute":var v=e.a;return L(t,Io(F([Ny(By(d(Uf,"GotoRoute","navigation",Yv(v),0))),f(Iy,t.key,v)])));case"Tick":var y=e.a;return L(U(t,{time:y}),Ao);case"NetworkUpdate":var m=e.a,b=f(Vo,vo,f(Wd,oS,m)),C=f(ag,ao,Wl(b)),S=L(b,C);if("Ok"===S.a.$){if("Just"===S.b.$){var E=S.a.a,T=S.b.a;if($(E,Kg(t.web3Context.factoryType)))return L(t,Ao);var w=Co(T),I=f(Xy,w,t.submodel),A=I.a,B=I.b,k=I.c,N=WE(w),R=N.a,x=N.b,_=N.c;return f(mB,f(Xi,IT,_),L(U(t,{submodel:A,tradeCache:R,web3Context:w}),Io(F([f(Dg,IT,x),function(){if("Just"===k.$){var e=k.a;return f(Iy,t.key,e)}return B}()]))))}S.b;return L(f(Eo,DA,t),Ao)}var P=S.a.a;return L(l(Da,Eo,f(Xp,"Can't decode networkID from Javascript",P),t),Ao);case"ConnectToWeb3":return"NoWeb3"===t.initialWeb3State.$?L(f(Eo,LA,t),Ao):L(t,Ay(vr));case"WalletStatus":var D=e.a,O=function(){var e=D.account;if("Nothing"===e.$)return Ao;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:D.account}),O);case"UserPubkeySet":var M=e.a,V=f(Wd,Qo,M);if("Ok"===V.$){var K=V.a,H=t.userAddress;if("Just"===H.$){var j=H.a,q=ci({address:j,commPubkey:K}),G=f(zy,q,t.submodel),A=G.a,p=G.b;return L(U(t,{submodel:A,userInfo:q}),p)}return L(f(Eo,f(Xp,"User pubkey set, but I can no longer find the user address!",fi),t),Ao)}var z=V.a;return L(l(Da,Eo,f(Xp,"error decoding commPubkey from JS",z),t),Ao);case"CreateMsg":var Y=e.a,W=t.submodel;if("CreateModel"===W.$){var J=W.a,Q=f(Rg,Y,J),X=f(Mg,t.txSentry,f(Vg,Vy,Q.chainCmd)),Z=X.a,ee=X.b;return f(mB,f(Xi,Vy,Q.appCmds),L(U(t,{submodel:Fy(Q.model),txSentry:Z}),Io(F([f(Dg,Vy,Q.cmd),ee]))))}return L(t,Ao);case"QuickCreateMsg":var te=e.a,re=t.submodel;if("QuickCreateModel"===re.$){var ne=re.a,Q=f(Hv,te,ne),ae=f(Mg,t.txSentry,f(Vg,jy,Q.chainCmd)),Z=ae.a,ee=ae.b;return f(mB,f(Xi,jy,Q.appCmds),L(U(t,{submodel:Hy(Q.model),txSentry:Z}),Io(F([f(Dg,jy,Q.cmd),ee]))))}return L(t,Ao);case"TradeMsg":var ie=e.a,oe=t.submodel;if("TradeModel"===oe.$){var ue=oe.a,Q=f(FE,ie,ue),se=f(Mg,t.txSentry,f(Vg,Gy,Q.chainCmd)),Z=se.a,ee=se.b;return f(mB,f(Xi,Gy,Q.appCmds),L(U(t,{submodel:qy(Q.model),txSentry:Z}),Io(F([f(Dg,Gy,Q.cmd),ee]))))}return L(t,Ao);case"MarketplaceMsg":var ce=e.a,fe=t.submodel;if("MarketplaceModel"===fe.$){var le=fe.a,Q=f(mv,ce,le);return f(mB,f(Xi,wT,Q.appCmds),L(U(t,{submodel:Ky(Q.model)}),f(Dg,wT,Q.cmd)))}return L(t,Ao);case"AgentHistoryMsg":var de=e.a,he=t.submodel;if("AgentHistoryModel"===he.$){var pe=he.a,Q=f(Df,de,pe),ge=f(Mg,t.txSentry,f(Vg,CT,Q.chainCmd)),Z=ge.a,ee=ge.b;return f(mB,f(Xi,CT,Q.appCmds),L(U(t,{submodel:My(Q.model),txSentry:Z}),Io(F([f(Dg,CT,Q.cmd),ee]))))}return L(t,Ao);case"TxSentryMsg":var ve=e.a,ye=f(fB,ve,t.txSentry),A=ye.a,me=ye.b;return L(U(t,{txSentry:A}),me);case"TradeCacheMsg":var be=e.a,Q=f(bT,be,t.tradeCache);return L(U(t,{tradeCache:Q.tradeCache}),f(Dg,IT,Q.cmd));case"NoOp":return L(t,Ao);default:var z=e.a;f(kl,"test",z);return L(t,Ao)}}),CB=r(function(e,t){return f(vB,t,Ty(e))}),SB=ze("txIn",lE),EB=qe("txOut",Oa),TB={$:"AllGood"},wB={$:"NoWeb3"},IB=function(e){return{$:"TxSentryMsg",a:e}},AB={$:"WrongNetwork"},BB={align:Wp,label:"noWeb3Provider",mainParagraphs:F([F([Qp("No web3 provider detected. Is "),f(AA,F([_A(l(kA,0,0,1))]),{label:Qp("Metamask"),url:"https://metamask.io/"}),Qp(" or some other web3 provider installed and unlocked?")])]),noticeType:rg},kB={$:"TopLeft"},NB={align:kB,label:"screenToSmall",mainParagraphs:F([F([Qp("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:rg},RB=n(function(e,t,r){var n=e.a,a=e.b;return xg({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Sh})}),$B=n(function(e,t,r){var n=e.width<1024?ci(NB):fi,a=function(){if(e.networkId){var t=mo(e.networkId);if("Nothing"===t.$)return L(Zi(eo),AB);return L(t.a,TB)}return L(Zi(eo),wB)}(),i=a.a,o=a.b,u=Co(i),s=WE(u),c=s.a,d=s.b,h=s.c,p=l(RB,L(EB,SB),IB,u.httpProvider),g=function(){switch(o.$){case"NoWeb3":return ci(BB);case"WrongNetwork":return ci(DA);default:return fi}}(),v=aS(F([n,g])),y=f(mB,f(Xi,IT,h),f(CB,t,{initialWeb3State:o,key:r,screenWidth:e.width,submodel:ET,time:Ff(0),tradeCache:c,txSentry:p,userAddress:fi,userInfo:fi,userNotices:mr,web3Context:u})),m=y.a,b=y.b;return L(f(To,v,m),Io(F([f(Dg,IT,d),b])))}),xB=ze("networkSentryPort",lE),_B=Me,LB=_B(mr),PB=function(e){return LB},DB=function(e){return{$:"Refresh",a:e}},UB=r(function(e,t){return{$:"Every",a:e,b:t}}),OB=r(function(e,t){return{processes:t,taggers:e}}),MB=Xh(f(OB,Sh,Sh)),FB=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(xE,s,L(Aa(i),u),o),f=c.a,h=c.b;return l($a,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),VB=Re,KB=r(function(e,t){var r=e.a,n=e.b,a=f(Eh,r,t);if("Nothing"===a.$)return l(kh,r,F([n]),t);var i=a.a;return l(kh,r,f(Na,n,i),t)}),HB=ke,jB=r(function(e,t){return{$:"Zone",a:e,b:t}}),qB=fa,GB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=HB(f(qB,n,f(Fh,e,n)));return f(op,function(t){return l(GB,e,a,l(kh,n,t,r))},i)}return Xh(r)}),zB=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(op,function(e){return i},VB(t)))}),u=l($a,KB,Sh,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return P(f(Na,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(kh,e,r,i),o)}),d=p(FB,s,c,o,u,i,P(mr,Sh,Xh(vr))),h=d.a,g=d.b,v=d.c;return f(op,function(e){return Xh(f(OB,u,e))},f(op,function(t){return l(GB,e,h,g)},v))}),YB=function(e){return Ie(function(t){t(Te(e(Date.now())))})}(Ff),WB=n(function(e,t,r){var n=f(Eh,t,r.taggers);if("Nothing"===n.$)return Xh(r);var a=n.a,i=function(t){return fp(f(Pa,function(r){return f(Mh,e,r(t))},a))};return f(op,function(e){return Xh(r)},f(op,i,YB))}),JB=r(function(e,t){var r=t.a,n=t.b;return f(UB,r,f(Ua,e,n))});gn.Time=De(MB,zB,WB,0,JB);var QB=Oe("Time"),XB=r(function(e,t){return QB(f(UB,e,t))}),ZB=function(e){return f(XB,2e3,DB)},ek=function(e){return LB},tk=function(e){return{$:"Refresh",a:e}},rk=function(e){return f(XB,2e3,tk)},nk=function(e){return{$:"DecryptionFinished",a:e}},ak=ze("decryptionFinished",lE),ik=ze("encryptionFinished",lE),ok=function(e){return{$:"EncryptionFinished",a:e}},uk=function(e){return{$:"Refresh",a:e}},sk=function(e){return _B(F([f(XB,3e3,uk),ik(ok),ak(function(e){return $S(nk(e))})]))},ck=mn,fk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return LB;case"CreateModel":t.a;return f(ck,Vy,ZB());case"QuickCreateModel":t.a;return f(ck,jy,rk());case"TradeModel":t.a;return f(ck,Gy,sk());case"MarketplaceModel":t.a;return f(ck,wT,ek());default:t.a;return f(ck,CT,PB())}},lk=ze("userPubkeyResult",lE),dk=ze("walletSentryPort",lE),hk={$:"CheckForNewTrades"},pk=function(e){return f(XB,5e3,function(e){return hk})},gk=function(e){return{$:"NetworkUpdate",a:e}},vk=function(e){return{$:"Tick",a:e}},yk=function(e){return{$:"UserPubkeySet",a:e}},mk=function(e){return{$:"WalletStatus",a:e}},bk=function(e){return f(Xp,"Error decoding JS walletSentry: "+e,fi)},Ck=function(e){return{$:"ErrorDecoding",a:e}},Sk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Ek=l(Fi,r(function(e,t){return{ref:e,txHash:t}}),f(Md,"ref",oS),f(Md,"txHash",FA(EE))),Tk=function(e){var t=f(Wd,Ek,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Sk,r.ref,di(a))}return f(Sk,r.ref,li("Problem signing/broadcasting Tx. Ref #"+Ri(r.ref)))}t.a;return Ck("Error decoding tx data")},wk=function(e){var t=e.a;return f(ck,t.tagger,t.inPort(Tk))},Ik=f(Mi,vo,oS),Ak=Xo(f(yo,nl,f(yo,_l("Failure decoding stringy int"),Vo(vo)))),Bk=fE(F([Ak,Ik])),kk=r(function(e,t){return{account:e,networkId:t}}),Nk=l(Fi,kk,f(Md,"account",FA(gE)),f(Md,"networkId",Bk)),Rk=n(function(e,t,r){var n=f(Wd,Nk,r);if("Err"===n.$){var a=n.a;return e(Ui(a))}return t(n.a)}),$k=function(e){var t=f(yo,bk,f(yo,ga,ST));return _B(O(F([f(XB,1e3,vk),dk(f(Rk,t,mk)),wk(e.txSentry),lk(yk),f(ck,IT,pk(e.tradeCache)),xB(gk)]),F([fk(e)])))},xk=function(e){return{$:"LinkClicked",a:e}},_k=function(e){return{$:"UrlChanged",a:e}},Lk=n(function(e,t,r){return d(BA,e/255,t/255,r/255,1)}),Pk=l(Lk,10,33,108),Dk={$:"Generic"},Uk=Dk,Ok=r(function(e,t){return d(wA,FT,Uk,f(Na,PT(_T),f(Na,$T(_T),e)),OT(F([t])))}),Mk=function(e){return{$:"Fill",a:e}},Fk=Mk(1),Vk=ji,Kk=function(e){return{$:"Px",a:e}},Hk=Kk,jk=hw(8),qk=function(e){return f($A,jk,l(RA,"bg-"+xA(e),"background-color",e))},Gk=f(Ok,F([PT(Fk),$T(Hk(150)),qk(Pk)]),Vk),zk=function(e){return{$:"GotoRoute",a:e}},Yk={$:"Active"},Wk={$:"Important"},Jk={$:"Normal"},Qk=l(kA,1,1,1),Xk=hw(2),Zk=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),eN=r(function(e,t){return $(e,t)?f($A,Xk,h(Zk,"p-"+Ri(e),e,e,e,e)):f($A,Xk,h(Zk,"p-"+Ri(e)+"-"+Ri(t),t,e,t,e))}),tN=hw(21),rN=r(function(e,t){return{$:"Class",a:e,b:t}}),nN=f(rN,tN,jT.cursorPointer),aN=hw(17),iN=function(e){return f($A,aN,l(aA,"br-"+Ri(e),"border-radius",Ri(e)+"px"))},oN=function(e){return{$:"Normal",a:e}},uN=Bn,sN=r(function(e,t){return f(uN,e,oN(t))}),cN=function(e){return f(sN,"click",Vi(e))},fN=f(Ua,DT,cN),lN=hw(13),dN=f(rN,lN,jT.textSemiBold),hN=hw(4),pN=function(e){return{$:"FontSize",a:e}},gN=function(e){return f($A,hN,pN(e))},vN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return mr;case"Active":return F([iN(4),qk(l(kA,0,0,1))]);default:return F([iN(4),qk(l(kA,.9,0,0))])}}();return f(Ok,O(F([f(eN,23,12),gN(22),dN,_A(Qk),nN,fN(t)]),n),Qp(e))}),yN=l(Lk,244,0,103),mN=function(e){return{$:"AlignX",a:e}},bN={$:"CenterX"},CN=mN(bN),SN=hw(3),EN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),TN=r(function(e,t){return"spacing-"+Ri(e)+"-"+Ri(t)}),wN=function(e){return f($A,SN,l(EN,f(TN,e,e),e,e))},IN=function(e){return{$:"Describe",a:e}},AN={$:"Paragraph"},BN=r(function(e,t){return d(wA,nw,Uk,f(Na,IN(AN),f(Na,PT(Fk),f(Na,wN(5),e))),OT(t))}),kN=f(rN,lN,jT.bold),NN=f(Ok,F([gN(29),_A(Qk),kN,CN,nN,fN(zk(Qv))]),f(BN,mr,F([Qp("DAI"),f(Ok,F([_A(yN)]),Qp("Hard"))]))),RN=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"}},$N=IA(jT.italic),xN=function(e){return f(Ok,F([gN(18),_A(l(kA,.8,.8,1)),dN,$N,CN]),Qp(RN(e)))},_N={$:"Right"},LN=mN(_N),PN={$:"AsColumn"},DN=PN,UN=r(function(e,t){return d(wA,DN,Uk,f(Na,IA(jT.contentTop+" "+jT.contentLeft),f(Na,$T(_T),f(Na,PT(_T),e))),OT(t))}),ON={$:"AsRow"},MN=ON,FN=r(function(e,t){return d(wA,MN,Uk,f(Na,IA(jT.contentLeft+" "+jT.contentCenterY),f(Na,PT(_T),f(Na,$T(_T),e))),OT(t))}),VN=function(e){return f(FN,F([PT(Fk),wN(30),f(eN,30,17)]),F([l(vN,"Create a New Offer",zk(Jv),function(){return"CreateModel"===e.submodel.$?Yk:Jk}()),l(vN,"Sell Offers",zk(Xv(ay)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,ay)?Yk:Jk}return Jk}()),l(vN,"Buy Offers",zk(Xv(Of)),function(){var t=e.submodel;if("MarketplaceModel"===t.$){return $(t.a.browsingRole,Of)?Yk:Jk}return Jk}()),function(){var t=e.userInfo;if("Just"===t.$){var r=t.a;return l(vN,"My Trades",zk(f(_f,r.address,Of)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return $(t.a.agentAddress,r.address)?Yk:Jk}return Jk}())}return l(vN,"Connect to Wallet",TT,Wk)}(),f(UN,F([LN,wN(0),f(eN,8,0)]),F([NN,xN(e)]))]))},KN=function(e){return function(t){return $(t.parameters.initiatorAddress,e.agentAddress)||$(t.state.responder,ci(e.agentAddress))}},HN=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},jN=function(e){return r(function(e,t){var r=f(Iu,HN(e.state.phase),HN(t.state.phase));return $(r,ba)?r:f(Hg,e.derived.phaseEndTime,t.derived.phaseEndTime)})},qN=Er,GN=r(function(e,t){return f(yo,eh(e),qN(t))}),zN=function(e){return{$:"AlignY",a:e}},YN={$:"CenterY"},WN=zN(YN),JN=hw(20),QN=f(rN,JN,jT.clip),XN=Mk,ZN=function(e){return f($A,Xk,h(Zk,"p-"+Ri(e),e,e,e,e))},eR=function(e){var t=e.a,r=e.b;return f(Ok,F([PT(XN(t)),$T(Hk(60)),QN,qk(Qk)]),f(Ok,F([ZN(12),WN,PT(Fk)]),r))},tR=f(rN,lN,jT.textMedium),rR=function(e){return f(Ok,F([tR,gN(17)]),Qp(e))},nR=function(e){return{$:"Poke",a:e}},aR=hw(33),iR={$:"Hover"},oR=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),uR=xn,sR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),cR={$:"NoAttribute"},fR=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),lR=r(function(e,t){switch(t.$){case"NoAttribute":return cR;case"Describe":var r=t.a;return IN(r);case"AlignX":var n=t.a;return mN(n);case"AlignY":var a=t.a;return zN(a);case"Width":var n=t.a;return LT(n);case"Height":var n=t.a;return RT(n);case"Class":var n=t.a,a=t.b;return f(rN,n,a);case"StyleClass":var i=t.a,o=t.b;return f($A,i,o);case"Nearby":var u=t.a,s=t.b;return f(sR,u,f(Yi,e,s));case"Attr":var c=t.a;return DT(f(uR,e,c));default:var l=t.a,d=t.b;return f(fR,l,d)}}),dR=function(e){return f(lR,dg,e)},hR=r(function(e,t){var r=t.a,n=t.b,a=dR(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(Na,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(vA,n,o));default:return L(r,n)}}),pR=function(e){var t=l($a,hR,L(mr,EA),e),r=t.a,n=t.b;return f(Na,iA(n),r)},gR=function(e){return f($A,aR,f(oR,iR,pR(e)))},vR=a(function(e,t,r,n){return d(BA,e/255,t/255,r/255,n)}),yR=me,mR=r(function(e,t){return f(Nn,e,yR(t))}),bR=mR("disabled"),CR=function(e){return f(Rn,"tabIndex",Ri(e))},SR=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},ER=function(e){return f(Sd,SR,e)?cR:IA("focusable")},TR=function(e){return{$:"MayPreventDefault",a:e}},wR=r(function(e,t){return f(uN,e,TR(t))}),IR=r(function(e,t){var r=function(r){return $(r,e)?Vi(t):Jo("Not the enter key")},n=f(Wo,r,f(Md,"key",Qo));return DT(f(wR,"keyup",f(Mi,function(e){return L(e,!0)},n)))}),AR=function(e){return f(IR,"Enter",e)},BR={$:"Button"},kR=r(function(e,t){var r=t.onPress,n=t.label;return d(wA,FT,Uk,f(Na,PT(_T),f(Na,$T(_T),f(Na,IA(jT.contentCenterX+" "+jT.contentCenterY+" "+jT.seButton+" "+jT.noTextSelection),f(Na,nN,f(Na,ER(e),f(Na,IN(BR),f(Na,DT(CR(0)),function(){if("Nothing"===r.$)return f(Na,DT(bR(!0)),e);var t=r.a;return f(Na,fN(t),f(Na,AR(t),e))}()))))))),OT(F([n])))}),NR=function(e){return f(kR,F([qk(d(vR,16,7,234,.2)),ZN(5),iN(4),PT(Fk),gR(F([qk(d(vR,16,7,234,.4))]))]),{label:f(Ok,F([CN,_A(l(Lk,16,7,234)),tR,gN(14)]),Qp("Poke")),onPress:ci(nR(e))})},RR=function(e){return{$:"TimeLeft",a:e}},$R=function(e){return{$:"TimeUp",a:e}},xR=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)}}),_R=r(function(e,t){return Ff(Gl(e)-Gl(t))}),LR=r(function(e,t){var r=f(xR,t.state.phase,t),n=f(_R,e,t.state.phaseStartTime),a=f(_R,r,n);return Gl(a)>0?RR(L(a,r)):$R(r)}),PR=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},DR=l(kA,0,0,0),UR=l(Lk,233,237,242),OR={$:"Behind"},MR=function(e){return f(sR,OR,e)},FR=r(function(e,t){var r=Bg(200*e),n=200-r,a=f(Ok,F([PT(XN(n))]),Vk),i=F([$T(Hk(3)),iN(20)]),o=f(Ok,O(i,F([PT(XN(r)),qk(t)])),Vk),u=f(Ok,O(i,F([PT(Fk),qk(UR)])),Vk);return f(FN,F([PT(Fk),MR(u)]),F([o,a]))}),VR=l(Lk,51,183,2),KR=function(e){return Gl(e)<0},HR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),jR=function(e){var t=Lp(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(HR,yC(t),yC(r),yC(n),yC(a))}(f(yc,L(ku(0),ku(0)),f(os,n,ku(60))))}(f(yc,L(ku(0),ku(0)),f(os,r,ku(3600))))}(f(yc,L(ku(0),ku(0)),f(os,t,ku(86400))))},qR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!KR(a)){var u=r(function(e,t){return O(l(hs,2,D("0"),Ri(e)),t)}),s=Gl(a)>0?i:o,c=jR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(FN,O(F([wN(5)]),e),F([f(Ok,O(F([_A(h)]),t),Qp(f(u,c.days,"d"))),f(Ok,O(F([_A(d)]),t),Qp(f(u,c.hours,"h"))),f(Ok,O(F([_A(s)]),t),Qp(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}}),GR=l(kA,1,1,0),zR=r(function(e,t){return Gl(e)/Gl(t)}),YR=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(zR,o,u),c=(f(Ok,F([CN]),d(qR,mr,mr,L(a,i),o)),s<.1?yN:s<.2?GR:VR);return f(UN,O(F([wN(5)]),e),F([d(qR,F([CN]),t,L(a,i),o),f(FR,1-s,c)]))}),WR=a(function(e,t,r,n){var a=f(LR,e,t);if("TimeLeft"===a.$){var i=a.a,o=r&&f(zR,i.a,i.b)<.05?yN:DR;return d(YR,F([PT(Fk)]),F([gN(16)]),L(o,UR),i)}return f(UN,F([wN(4),PT(Fk)]),O(F([f(Ok,F([CN,gN(14)]),Qp(PR(t.state.phase)))]),n?F([f(Ok,F([CN]),NR(t.creationInfo.address))]):mr))}),JR=function(e){return{$:"JustImage",a:e}},QR=JR,XR=function(e){return l($a,r(function(e,t){var r=e.a,n=e.b;return l(kh,r,n,t)}),Sh,e)}(f(Pa,function(e){var t=e.a;return L(t,L(e.b,QR({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","₫")]))),ZR=function(e){return f(yc,"",f(jf,Xa,f(Eh,e,XR)))},e$=function(e){return Lo(e)<=3?e:e$(f(wl,3,e))+","+f(Ho,3,e)},t$=function(e){return e$(Tl(e))},r$=function(e){return O(ZR(e.fiatType),t$(e.amount))},n$=AT("alt"),a$=function(e){return f(AT,"src",nt(e))},i$=r(function(e,t){var r=t.src,n=t.description,a=f(eh,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(wA,FT,Uk,f(Na,IA(jT.imageContainer),e),OT(F([d(wA,FT,UT("img"),O(F([DT(a$(r)),DT(n$(n))]),a),OT(mr))])))}),o$=r(function(e,t){if("None"===t.$)return Vk;var r=t.a;return f(i$,e,r)}),u$=BA,s$=function(e){var t=function(){var t=f(Eh,e.fiatType,XR);if("Nothing"===t.$)return Vk;var r=t.a,n=(r.a,r.b);return f(o$,F([$T(Hk(26))]),n)}();return f(FN,F([wN(4)]),F([t,f(Ok,F([_A(d(u$,0,0,0,.5)),tR,PT(Hk(50))]),Qp(e.fiatType)),Qp(r$(e))]))},c$=function(e){return s$(e)},f$=function(e){return f(Ok,F([PT(Fk),$T(Fk),QN]),f(BN,F([gN(12)]),F([Qp(e.info)])))},l$=function(e){return f(yc,Vk,f(jf,f$,Xf(e)))},d$=JR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),h$=function(e){return f(o$,f(Na,$T(Hk(26)),e),d$)},p$=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(Mo,3,t);case 1:return f(Mo,4,f(yc,t,f(jf,xw,f(jf,function(e){return e/100},f(jf,Ha,f(jf,Bg,f(jf,ri(100),Nl(t))))))));default:var n=r.a;return f(yc,f(Mo,n,t),f(jf,Ri,f(jf,Bg,Nl(t))))}},g$=function(e){var t=p$(e);return f(FN,F([wN(4)]),F([h$(mr),f(Ok,F([gN(16)]),Qp(t))]))},v$=function(e){return g$(e)},y$=function(e){return{$:"TradeClicked",a:e}},m$=function(e){return f(kR,F([qk(d(vR,16,7,234,.2)),ZN(11),iN(4),PT(Fk),gR(F([qk(d(vR,16,7,234,.4))]))]),{label:f(Ok,F([CN,_A(l(Lk,16,7,234)),tR]),Qp("View Offer")),onPress:ci(y$(e))})},b$=i(function(e,t,r,n,a){return f(FN,F([PT(Fk),wN(1)]),F([function(){switch(n.$){case"Open":return eR(L(2,d(WR,e,a,!1,t)));case"Committed":return eR(L(2,d(WR,e,a,$(r,ay),t)));case"Judgment":return eR(L(2,d(WR,e,a,$(r,Of),t)));default:return Vk}}(),eR(L(1,v$(a.parameters.tradeAmount))),eR(L(2,c$(a.terms.price))),eR(L(6,l$(a.terms.paymentMethods))),eR(L(2,m$(a.id)))]))}),C$=hw(28),S$=function(e){return f($A,C$,l(RA,"bc-"+xA(e),"border-color",e))},E$=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),T$=function(e){return f($A,bA,h(E$,"b-"+Ri(e),e,e,e,e))},w$=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(UN,F([PT(Fk),$T(Fk),f(eN,30,10),wN(5)]),F([f(FN,F([PT(Fk)]),F([$(r.viewPhase,sC)?Vk:eR(L(2,rR(n))),eR(L(1,rR(a))),eR(L(2,rR("For Fiat"))),eR(L(6,rR("Payment Methods"))),eR(L(2,Vk))])),f(UN,F([PT(Fk),T$(1),iN(8),S$(UR),wN(1),qk(UR),QN]),f(Pa,d(b$,e,!$(r.userInfo,fi),r.agentRole,r.viewPhase),t))]))}),I$=n(function(e,t,r){return $(f(BS,e,r),ci(t))}),A$=l(Lk,150,150,150),B$=function(e){return f(eh,function(e){return Ib(e.parameters)},tT(e))},k$=n(function(e,t,r){var n=l(GN,KN(r),jN(),B$(t)),a=f(eh,function(e){return l(I$,e,r.agentRole,r.agentAddress)&&$(e.state.phase,r.viewPhase)},n),i=function(e){return f(Ok,F([gN(24),dN,_A(A$),CN,ZN(20)]),Qp(e))},o=L(t.dataFetchStatus.total,a);if("Nothing"===o.a.$){o.a;return i("Querying Factory contract...")}if(o.a.a){if(o.b.b){var u=o.a.a;return l(w$,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.")}),N$=r(function(e,t){return f(Ok,F([iN(4),qk(d(u$,0,0,1,.1)),_A(l(Lk,16,7,234)),gN(e),dN,f(eN,15,13)]),Qp(Zd(t)))}),R$=a(function(e,t,r,n){return"pad-"+Ri(e)+"-"+Ri(t)+"-"+Ri(r)+"-"+Ri(n)}),$$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return $(t,r)&&$(t,n)&&$(t,a)?f($A,Xk,h(Zk,"p-"+Ri(t),t,t,t,t)):f($A,Xk,h(Zk,d(R$,t,r,n,a),t,r,n,a))},x$=function(e){return function(){var t=e.userInfo;return"Nothing"!==t.$&&$(t.a.address,e.agentAddress)}()?f(Ok,F([f(eN,30,10),gN(24),dN]),Qp("Your Trades")):f(FN,F([wN(10),$$({bottom:30,left:30,right:30,top:10})]),F([f(Ok,F([gN(24),dN]),Qp("Trade History for User")),f(N$,18,e.agentAddress)]))},_$=function(e){return{$:"ViewPhaseChanged",a:e}},L$=l(kA,0,0,1),P$=function(e){var t=F([gN(20),kN,nN]),r=function(e){return e?O(t,F([_A(L$)])):t};return f(FN,F([wN(30)]),F([f(Ok,O(F([fN(_$(wo))]),r($(e,wo))),Qp("Open")),f(Ok,O(F([fN(_$(cC))]),r($(e,cC))),Qp("Payment Due")),f(Ok,O(F([fN(_$(fC))]),r($(e,fC))),Qp("Release Due")),f(Ok,O(F([fN(_$(sC))]),r($(e,sC))),Qp("Closed"))]))},D$=function(e){return f(Ok,F([f(eN,30,10)]),P$(e.viewPhase))},U$=function(e){return{$:"ViewUserRoleChanged",a:e}},O$=d(vR,1,31,52,.13),M$=function(e){var t=F([gN(24),dN,nN]),r=function(){return"Buyer"===e.$?L(t,O(t,F([_A(O$)]))):L(O(t,F([_A(O$)])),t)}(),n=r.a,a=r.b;return f(FN,F([wN(20)]),F([f(Ok,O(F([fN(U$(Of))]),a),Qp("As the Seller")),f(Ok,O(F([fN(U$(ay))]),n),Qp("As the Buyer"))]))},F$=function(e){return f(Ok,F([f(eN,30,10)]),M$(e.agentRole))},V$=n(function(e,t,r){return f(UN,F([iN(5),qk(Qk),PT(Fk),$T(Fk),f(eN,0,20)]),F([x$(r),F$(r),D$(r),l(k$,e,t,r)]))}),K$=function(e){return{$:"ShowCurrencyDropdown",a:e}},H$={$:"AbortCreate"},j$=function(e){return{$:"AppCmd",a:e}},q$=r(function(e,t){return{$:"ConfirmCreate",a:e,b:t}}),G$=function(e){return f(Pa,function(e){return F([f(Ok,F([_A(yN)]),Qp("Caution! ")),Qp(e)])},aS(F([$(f(Hg,e.autoreleaseInterval,Ff(12e5)),Ca)?ci(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."}()):fi,$(f(Hg,e.autoabortInterval,Ff(36e5)),Ca)?ci(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.'}()):fi])))},z$=function(e){return f(Ok,F([$$({bottom:5,left:5,right:5,top:0}),fN(e),iN(30),qk(d(u$,1,1,1,.4)),T$(1),S$(d(u$,0,0,0,.3)),nN,gN(14)]),f(Ok,F([_A(d(u$,0,0,0,.7))]),Qp("x")))},Y$=kn,W$=Y$,J$=DT,Q$=r(function(e,t){return f(Ok,F([MR(f(Ok,F([qk(e),J$(f(W$,"position","fixed")),J$(f(W$,"z-index","1000")),J$(f(W$,"top","0")),J$(f(W$,"left","0")),J$(f(W$,"width","100%")),J$(f(W$,"height","100%"))]),Vk)),PT(Fk),$T(Fk)]),t)}),X$={$:"Top"},Z$=zN(X$),ex={$:"InFront"},tx=function(e){return f(sR,ex,e)},rx=r(function(e,t){return{$:"Max",a:e,b:t}}),nx=r(function(e,t){return f(rx,e,t)}),ax=n(function(e,t,r){return l(Da,Q$,d(u$,0,0,.3,.6),f(Ok,O(F([CN,WN,PT(f(nx,500,_T)),qk(Qk),iN(8),tx(f(Ok,F([LN,Z$]),z$(r)))]),e),t))}),ix=r(function(e,t){if("Nothing"===t.$)return Vk;var r=t.a;return f(Ok,O(F([iN(5),S$(l(kA,.9,0,0)),T$(1),qk(l(kA,1,.4,.4)),ZN(5),CN,WN,PT(f(nx,200,_T)),gN(14)]),e),f(BN,mr,F([Qp(r)])))}),ox={$:"Above"},ux=function(e){return f(sR,ox,e)},sx=hw(26),cx=function(e){return{$:"MoveY",a:e}},fx=function(e){return f(fR,sx,cx(-e))},lx=r(function(e,t){return f(Ok,F([iN(4),f(eN,25,17),gN(18),dN,qk(UR),ux(f(ix,F([fx(5)]),t))]),Qp(e))}),dx=d(vR,1,31,52,.64),hx=hw(32),px={$:"Active"},gx=function(e){return f($A,hx,f(oR,px,pR(e)))},vx=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Ok,F([iN(4),nN,fN(n),f(eN,25,17),_A(t),gN(18),dN,qk(a),gx(F([qk(o)])),gR(F([qk(i)]))]),Qp(r))}),yx=r(function(e,t){return d(vx,P(d(u$,1,0,0,1),d(u$,1,0,0,.8),d(u$,1,0,0,.6)),Qk,e,t)}),mx=hw(12),bx=f(rN,mx,jT.textCenter),Cx=function(e){return Q$(d(u$,0,0,.3,.6))(f(UN,F([wN(10),CN,WN,qk(d(u$,0,0,0,.5)),iN(8),ZN(20)]),f(Pa,function(e){return f(BN,F([CN,WN,gN(20),dN,_A(Qk),bx]),F([e]))},e)))},Sx=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+KA(t)}e.a;return"https://kovan.etherscan.io/tx/"+KA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+KA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+KA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+KA(t)}}),Ex={$:"Bottom"},Tx=zN(Ex),wx=IA(jT.underline),Ix=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(Qp(p$(Kv(n))),f(yx,"Yes, I definitely want to open this trade.",f(q$,r,n)))}return L(Qp("??"),f(lx,"(loading exact fees...)",fi))}(),i=a.a,o=a.b;return l(ax,mr,f(UN,F([wN(20),ZN(20),CN,$T(Fk),bx]),F([f(Ok,F([gN(26),dN,CN,WN]),Qp("Just to Confirm...")),f(UN,F([wN(20),CN,WN]),f(Pa,BN(F([CN,gN(18),tR,_A(dx)])),O(G$(r),O(F([F([Qp("You will deposit "),i,Qp(" "+n+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===t.web3Context.factoryType.$?F([F([Qp("This ususally requires two Metamask signatures. Your "+n+" will not be deposited until the final transaction has been mined.")])]):mr}())))),f(Ok,F([Tx,CN]),o)])),H$);case"ApproveNeedsSig":return f(Ok,F([fN(j$(d(ed,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),Cx(F([Qp("Waiting for user signature for the approve call."),Qp("(check Metamask!)"),Qp("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var r=e.a,u=e.b;return f(Ok,F([fN(j$(d(ed,"txChainModal clicked","misclick","ApproveMining",0)))]),Cx(F([Qp("Mining the initial approve transaction..."),f(AA,F([wx,_A(L$)]),{label:Qp("See the transaction on Etherscan"),url:f(Sx,t.web3Context.factoryType,u)}),Qp("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Ok,F([fN(j$(d(ed,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),Cx(F([Qp("Waiting for user signature for the create call."),Qp("(check Metamask!)")])));default:var u=e.a;return f(Ok,F([fN(j$(d(ed,"txChainModal clicked","misclick","CreateMining",0)))]),Cx(F([Qp("Mining the final create call..."),f(AA,F([wx,_A(L$)]),{label:Qp("See the transaction on Etherscan"),url:f(Sx,t.web3Context.factoryType,u)}),Qp("You will be redirected when it's mined.")])))}}),Ax=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Vk;var r=t.a;return f(Ix,r,e)},Bx=function(e){return{$:"TradeAmountChanged",a:e}},kx=AT("id"),Nx=J$(kx("inputError")),Rx=l(Lk,109,127,138),$x=function(e){return f(FN,F([wN(4)]),F([h$(mr),f(Ok,F([gN(24),tR,_A(Rx)]),Qp(Qf(e)))]))},xx={$:"Left"},_x=mN(xx),Lx=function(e){return{$:"HiddenLabel",a:e}},Px=Lx,Dx=AT("type"),Ux=function(e){return L(e,!0)},Ox=function(e){return{$:"MayStopPropagation",a:e}},Mx=r(function(e,t){return f(uN,e,Ox(t))}),Fx=r(function(e,t){return l(La,Md,t,e)}),Vx=f(Fx,F(["target","value"]),Qo),Kx=function(e){return f(Mx,"input",f(Mi,Ux,f(Mi,e,Vx)))},Hx=hw(0),jx=r(function(e,t){return{$:"Transparency",a:e,b:t}}),qx=function(e){var t=function(e){return 1-e}(f(oc,1,f(ti,0,e)));return f($A,Hx,f(jx,"transparency-"+Aw(t),t))},Gx=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),zx=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(wA,DN,UT("label"),e,OT(F([r])))}var n=t.a,a=t.b,i=t.c,o=d(wA,FT,Uk,a,OT(F([i])));switch(n.$){case"Above":return d(wA,DN,UT("label"),e,OT(F([o,r])));case"Below":return d(wA,DN,UT("label"),e,OT(F([r,o])));case"OnRight":return d(wA,MN,UT("label"),e,OT(F([r,o])));default:return d(wA,MN,UT("label"),e,OT(F([o,r])))}}),Yx=YI,Wx=f(Ua,DT,Yx("autocomplete")),Jx=l(kA,136/255,138/255,133/255),Qx=l(kA,186/255,189/255,182/255),Xx=f(eN,12,12),Zx=l(kA,1,1,1),e_=F([Xx,iN(3),S$(Qx),qk(Zx),T$(1),wN(3),PT(Fk)]),t_=function(e){return{$:"Label",a:e}},r_=function(e){if("HiddenLabel"===e.$){var t=e.a;return IN(t_(t))}return cR},n_=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},a_=function(e){return"HiddenLabel"===e.$},i_=mR("spellcheck"),o_=f(Ua,DT,i_),u_=J,s_=hw(47),c_=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(wi(u_(e))),o=(i-1)*t+f(yc,0,f(jf,a,r))+f(yc,0,f(jf,a,n));return f($A,s_,l(aA,"textarea-height-"+Ri(i),"height",function(e){return"calc("+Ri(e)+"em + "+Ri(o)+"px) !important"}(i)))}),f_=AT("value"),l_=f(Ua,DT,f_),d_={$:"LivePolite"},h_=IN(d_),p_=function(e){return l(La,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(Na,e,r),n);case"Attr":e.a;return L(f(Na,e,r),n);case"StyleClass":e.b;return L(f(Na,e,r),n);case"Width":e.a;return f(ww,"width",n)?L(r,n):L(f(Na,e,r),f(DE,"width",n));case"Height":e.a;return f(ww,"height",n)?L(r,n):L(f(Na,e,r),f(DE,"height",n));case"Describe":e.a;return f(ww,"described",n)?L(r,n):L(f(Na,e,r),f(DE,"described",n));case"Nearby":e.a,e.b;return L(f(Na,e,r),n);case"AlignX":return f(ww,"align-x",n)?L(r,n):L(f(Na,e,r),f(DE,"align-x",n));case"AlignY":return f(ww,"align-y",n)?L(r,n):L(f(Na,e,r),f(DE,"align-y",n));default:return f(ww,"transform",n)?L(r,n):L(f(Na,e,r),f(DE,"transform",n))}}),L(mr,wm),e).a},g_=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(Na,e,r):r}),mr,p_(e))}),v_=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}},y_=f(Ua,zi,ts),m_=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=F([DT(Kx(n.onChange))]),o=O(e_,t),u=f(g_,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(eh,n_,o),c=f(g_,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(g_,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(g_,o,function(e){return"Nearby"===e.$})),p=f(eh,f(Ua,Fu,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return P("input",O(F([l_(n.text),DT(Dx(a)),o_(e.spellchecked),IA(jT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return cR;var r=t.a;return Wx(r)}()]),p),mr)}var i=l(La,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(Na,e,t.adjustedAttributes),heightContent:ci(v_(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(Na,e,t.adjustedAttributes),maybeBorder:ci(d(Gx,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:ci(d(Gx,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(Na,e,t.adjustedAttributes),maybeSpacing:ci(g)}):t;default:break e}default:break e}return U(t,{adjustedAttributes:f(Na,e,t.adjustedAttributes)})}),{adjustedAttributes:mr,heightContent:fi,maybeBorder:fi,maybePadding:fi,maybeSpacing:fi},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(yc,5,c);return P("textarea",O(F([o_(e.spellchecked),IA(jT.inputMultiline),f(yc,cR,f(jf,Wx,e.autofill)),function(){if("Nothing"===u.$)return cR;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return $$({bottom:f(ti,0,n-(v/2|0)),left:a,right:r,top:f(ti,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?cR:s.a?d(c_,n.text,v,u,g):cR}()]),h),F([y_(jI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(wA,FT,Uk,f(Na,PT(Fk),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([tx(f(Ok,f(Na,Xx,O(s,O(F([_A(Jx),IA(jT.noTextSelection+" "+jT.passPointerEvents),S$(d(u$,0,0,0,0)),qk(d(u$,0,0,0,0)),$T(Fk),PT(Fk),qx(""===n.text?1:0)]),r))),a))])}()]))),OT(F([d(wA,FT,UT(v),cy(F([F([ER(t),r_(n.label)]),y,i])),OT(m))])));return l(zx,f(Na,f(rN,tN,jT.cursorText),f(Na,a_(n.label)?cR:wN(5),f(Na,h_,u))),n.label,b)}),b_=m_({autofill:fi,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),C_=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(b_,F([PT(Fk),$T(Hk(40)),T$(0)]),{label:Px(r),onChange:i,placeholder:n,text:a});return f(FN,O(F([wN(5)]),e),aS(F([f(jf,Ok(F([_x])),o),ci(s),f(jf,Ok(F([LN])),u)])))}),S_={$:"Below"},E_=function(e){return f(sR,S_,e)},T_=function(e){return f(fR,sx,cx(e))},w_=n(function(e,t,r){return p(C_,F([PT(Hk(150)),tR,gN(24),E_(f(ix,F([Nx,T_(5)]),r))]),L(fi,ci(f(Ok,F([fN(j$(d(ed,"click","misclick","dai symbol in dai input",0)))]),$x(e)))),"dai input",fi,t,Bx)}),I_=r(function(e,t){return f($A,bA,h(E$,"b-"+Ri(e)+"-"+Ri(t),t,e,t,e))}),A_=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return $(r,t)&&$(n,a)?$(r,a)?T$(r):f(I_,n,r):f($A,bA,h(E$,"b-"+Ri(r)+"-"+Ri(a)+"-"+Ri(t)+"-"+Ri(n),r,a,t,n))},B_=Ok(F([S$(UR),A_({bottom:2,left:0,right:0,top:0})])),k_=r(function(e,t){return f(UN,F([wN(10)]),F([f(Ok,F([gN(17),dN]),Qp(e)),t]))}),N_=function(e){return B_(f(k_,function(){return"Buyer"===e.inputs.userRole.$?"You're buying":"You're selling"}(),l(w_,e.web3Context.factoryType,e.inputs.daiAmount,e.errors.daiAmount)))},R_=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 "+p$(f(Gf,r,100))+" "+Qf(e.web3Context.factoryType)+"."}return"There is a 1% fee."}();return f(FN,F([CN,f(eN,20,10),qk(l(Lk,10,33,108)),iN(8),wN(5),fN(j$(d(ed,"click","misclick","fee notify element",0)))]),F([f(Ok,F([gN(18),_A(l(Lk,0,226,255)),dN]),Qp(t)),f(Ok,F([gN(17),_A(Qk),tR]),Qp("We only collect this fee when trades resolve successfully."))]))},$_=function(e){return{$:"FiatAmountChanged",a:e}},x_=function(e){return{$:"FiatTypeChanged",a:e}},__=r(function(e,t){return l(xE,n(function(t,r,n){return f(e,t,r)?l(kh,t,r,n):n}),Sh,t)}),L_=function(e){return f(__,r(function(t,r){return f(vg,e,t)}),XR)},P_=JR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),D_=function(e){return f(o$,F([$T(Hk(26))]),f(yc,P_,f(jf,zo,f(Eh,e,XR))))},U_=function(e){return J$(f(Mx,"click",Vi(L(e,!0))))},O_=y_,M_=function(e){return{$:"AppendProperty",a:e}},F_=r(function(e,t){return M_(e+":"+t)}),V_=r(function(e,t){return f(F_,e,t.value)}),K_=V_("cursor"),H_={$:"Compatible"},j_={cursor:H_,value:"default"},q_=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),G_=function(e){return{$:"PseudoClassSelector",a:e}},z_=function(e){return q_(G_(e))}("hover"),Y_=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),W_=Y_,J_=W_,Q_=J_("span"),X_=r(function(e,t){return f(Nn,tt(e),nt(t))}),Z_=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),eL=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),tL=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),rL=r(function(e,t){return t<>>32-e}),nL=function(e){var t=e.hash?e.seed^f(tL,461845907,f(rL,15,f(tL,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(tL,2246822507,r^r>>>16),a=f(tL,3266489909,n^n>>>13);return(a^a>>>16)>>>0},aL=r(function(e,t){return f(tL,5,f(rL,13,e^f(tL,461845907,f(rL,15,f(tL,3432918353,t)))))+3864292196}),iL=r(function(e,t){var r=t.hash|(255&mi(e))<";default:return""}},hP=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+"]"}},pP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f($i,"",f(Na,t,f(Pa,hP,r)));case"UniversalSelectorSequence":var r=e.a;return su(r)?"*":f($i,"",f(Pa,hP,r));default:var t=e.a,r=e.b;return f($i,"",f(Na,t,f(Pa,hP,r)))}},gP=function(e){var t=e.a,r=e.b;return f($i," ",F([dP(t),pP(r)]))},vP=function(e){var t=e.a,r=e.b,n=e.c,a=f(Na,pP(t),f(Pa,gP,r)),i=f($i,"",F([f(yc,"",f(jf,lP,n))]));return f(Hs,f($i," ",f(eh,f(Ua,Fu,Ll),a)),i)},yP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f($i,", ",f(Pa,vP,f(Na,r,n)));return f($i,"",F([i," {\n",e,fP(a),"\n",e,"}"]))}),mP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(yP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f($i,",\n",f(Pa,aP,r))+" {\n"+f($i,"\n\n",f(Pa,f(Ua,sP,yP(" ")),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"}},bP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f($i,"\n\n",f(eh,f(Ua,Fu,Ll),F([tP(t),f($i,"\n",f(Pa,oP,r)),f($i,"\n",f(Pa,uP,n)),f($i,"\n\n",f(Pa,mP,a))])))},CP=function(e){return bP(eP(QL(e)))},SP=function(e){return f($i,"\n\n",f(Pa,CP,e))},EP=function(e){return{$:"Snippet",a:e}},TP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),wP=function(e){return{$:"StyleBlockDeclaration",a:e}},IP=r(function(e,t){var r=l(wL,t,mr,fi);return EP(F([wP(l(TP,r,mr,e))]))}),AP=function(e){return su(e)?"unstyled":f(ss,D("_"),ms(f(oL,15739,SP(ME(uL(ME(f(IP,e,DL(mr)))))))))},BP=function(e){var t=AP(e),r=f(X_,"className",zd(t));return l(Z_,r,e,t)},kP=a(function(e,t,r,n){return f(e,f(Na,BP(t),r),n)}),NP=function(e){return{$:"Unstyled",a:e}},RP=function(e){return NP(Uw(e))},$P=RP,xP=r(function(e,t){return f(wn,e,Ze(t))}),_P=function(e){return En(Ze(e))},LP=r(function(e,t){var r=e.b,n=e.c;return su(r)?t:l(kh,n,r,t)}),PP=function(e){return e.a},DP=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(Na,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l($a,LP,i,s),p=l($a,UP,L(mr,h),c),g=p.a,v=p.b,o=l(fw,u,f(Pa,PP,s),xa(g));return L(f(Na,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l($a,LP,i,s),m=l($a,UP,L(mr,h),c),g=m.a,v=m.b,o=d(_P,y,u,f(Pa,PP,s),xa(g));return L(f(Na,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l($a,LP,i,s),b=l($a,DP,L(mr,h),c),g=b.a,v=b.b,o=l(cw,u,f(Pa,PP,s),xa(g));return L(f(Na,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l($a,LP,i,s),C=l($a,DP,L(mr,h),c),g=C.a,v=C.b,o=d(xP,y,u,f(Pa,PP,s),xa(g));return L(f(Na,L(r,o),a),v)}}),UP=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(Na,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l($a,LP,n,o),c=l($a,UP,L(mr,s),u),h=c.a,p=c.b,a=l(fw,i,f(Pa,PP,o),xa(h));return L(f(Na,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l($a,LP,n,o),v=l($a,UP,L(mr,s),u),h=v.a,p=v.b,a=d(_P,g,i,f(Pa,PP,o),xa(h));return L(f(Na,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l($a,LP,n,o),y=l($a,DP,L(mr,s),u),h=y.a,p=y.b,a=l(cw,i,f(Pa,PP,o),xa(h));return L(f(Na,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l($a,LP,n,o),m=l($a,DP,L(mr,s),u),h=m.a,p=m.b,a=d(xP,g,i,f(Pa,PP,o),xa(h));return L(f(Na,a,r),p)}}),OP=r(function(e,t){return h(wh,Th,e,t,Ch,Ch)}),MP=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=ci(L(a,n)),u=i;e=o,t=u}}}),FP=function(e){var t=f(MP,fi,e);if("Nothing"===t.$)return Sh;var r=t.a,n=r.a,a=r.b;return f(OP,n,a)},VP=function(e){return{$:"ClassSelector",a:e}},KP=function(e){var t=e.a,r=e.b;return f(IP,r,DL(F([VP(t)])))},HP=function(e){return SP(ME(uL(f(Pa,KP,Aa(e)))))},jP=function(e){return l(fw,"style",mr,ME(Uw(HP(e))))},qP=n(function(e,t,r){var n=f(Pa,PP,t),a=FP(t),i=l($a,UP,L(mr,a),r),o=i.a,u=i.b,s=jP(u);return l(fw,e,n,f(Na,s,xa(o)))}),GP=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}}),zP=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(GP,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),YP=r(function(e,t){return L(f(zP,"_",t),jP(e))}),WP=n(function(e,t,r){var n=f(Pa,PP,t),a=FP(t),i=l($a,DP,L(mr,a),r),o=i.a,u=i.b,s=f(YP,u,o);return l(cw,e,n,f(Na,s,xa(o)))}),JP=a(function(e,t,r,n){var a=f(Pa,PP,r),i=FP(r),o=l($a,DP,L(mr,i),n),u=o.a,s=o.b,c=f(YP,s,u);return d(xP,e,t,a,f(Na,c,xa(u)))}),QP=a(function(e,t,r,n){var a=f(Pa,PP,r),i=FP(r),o=l($a,UP,L(mr,i),n),u=o.a,s=o.b,c=jP(s);return d(_P,e,t,a,f(Na,c,xa(u)))}),XP=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(qP,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(QP,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(WP,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(JP,a,t,r,n)}},ZP=XP,eD=function(e){return O_(ZP(d(kP,Q_,F([z_(F([K_(j_)]))]),mr,F([$P(e)]))))},tD=Q,rD=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),nD=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),aD=function(e){return l(La,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 ci(h(rD,n,a,i,o,u))}return fi}(),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 ci(l(nD,a,t,i))}return fi}())}),L(fi,fi),e)},iD=r(function(e,t){var r=aD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(wA,MN,Uk,f(Na,IA(jT.contentLeft+" "+jT.contentCenterY+" "+jT.wrapped),f(Na,PT(_T),f(Na,$T(_T),e))),OT(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?ci($$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):fi}return fi}();if("Just"===c.$){var h=c.a;return d(wA,MN,Uk,f(Na,IA(jT.contentLeft+" "+jT.contentCenterY+" "+jT.wrapped),f(Na,PT(_T),f(Na,$T(_T),O(e,F([h]))))),OT(t))}var p=-s/2,g=-u/2;return d(wA,FT,Uk,e,OT(F([d(wA,MN,Uk,f(Na,IA(jT.contentLeft+" "+jT.contentCenterY+" "+jT.wrapped),f(Na,DT(f(W$,"margin",xw(p)+"px "+xw(g)+"px")),f(Na,DT(f(W$,"width","calc(100% + "+Ri(u)+"px)")),f(Na,DT(f(W$,"height","calc(100% + "+Ri(s)+"px)")),f(Na,f($A,SN,l(EN,o,u,s)),mr))))),OT(t))])))}),oD=i(function(e,t,r,n,a){var i=f(b_,F([PT(Hk(80)),$T(Hk(40)),gN(24),tR,S$(UR),U_(r)]),{label:Px("currency type"),onChange:f(yo,tD,n),placeholder:fi,text:t}),o=f(Eh,t,XR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return Vk;r.b;return f(iD,F([PT(Hk(350)),S$(DR),T$(1),qk(Qk),ZN(10),CN]),f(Pa,function(e){var t=e.a,r=e.b,a=r.b;return f(FN,F([PT(Hk(80)),wN(9),f(eN,0,5),U_(n(t)),gR(F([qk(l(kA,.8,.8,1))]))]),F([f(o$,F([$T(Hk(26))]),a),f(Ok,F([gN(16),dN]),eD(t))]))},Aa(L_(t))))}return Vk}();return f(FN,F([wN(4),E_(u)]),F([f(Ok,F([fN(a)]),D_(t)),i]))}),uD=i(function(e,t,r,n,a){var i=j$(d(ed,"click","misclick","currency flag",0)),o=f(Ok,F([fN(j$(d(ed,"click","misclick","currency symbol",0)))]),Qp(ZR(e))),u=f(Ok,F([E_(f(ix,F([Nx,T_(5)]),a))]),h(oD,r,e,K$(!0),x_,i));return p(C_,F([PT(Hk(250)),tR,gN(24),E_(f(ix,F([Nx,T_(5)]),n))]),L(ci(o),ci(u)),"fiat input",fi,t,$_)}),sD=function(e){return B_(f(k_,"For fiat",h(uD,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},cD=function(e){return{$:"ChangeRole",a:e}},fD=r(function(e,t){var r=F([gN(24),tR,nN]),n=function(){return"Buyer"===t.$?L(r,O(r,F([_A(O$)]))):L(O(r,F([_A(O$)])),r)}(),a=n.a,i=n.b;return f(FN,F([wN(20)]),F([f(Ok,O(F([fN(cD(Of))]),i),Qp("Sell "+Qf(e))),f(Ok,O(F([fN(cD(ay))]),a),Qp("Buy "+Qf(e)))]))}),lD=function(e){return f(k_,"Trade Type",f(fD,e.web3Context.factoryType,e.inputs.userRole))},dD=hw(19),hD=function(e){return Sl(F([e.inset?"box-inset":"box-",xw(e.offset.a)+"px",xw(e.offset.b)+"px",xw(e.blur)+"px",xw(e.size)+"px",xA(e.color)]))},pD=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f($A,dD,l(aA,hD(t),"box-shadow",Lw(t)))},gD=pD({blur:20,color:d(vR,0,0,0,.04),offset:L(0,3),size:0}),vD=f(rN,SN,jT.spaceEvenly),yD=function(e){return f(UN,F([PT(Fk),wN(20),qk(Qk),iN(5),ZN(20),gD]),F([f(FN,F([PT(Fk),vD]),F([lD(e),N_(e),sD(e)])),R_(e)]))},mD=function(e){return{$:"CreateClicked",a:e}},bD={$:"Web3Connect"},CD=function(e){return f(Ok,F([CN]),function(){if("Just"===e.$){var t=e.a;return f(yx,"Open Trade",mD(t))}return f(yx,"Connect to Wallet",bD)}())},SD=function(e){return{$:"AutoabortIntervalChanged",a:e}},ED=function(e){return{$:"ChangePaymentMethodText",a:e}},TD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),wD=TD,ID=function(e){return f(wD,F([_A(d(u$,0,0,0,.2))]),function(){return Qp("Seller"===e.$?"Some examples:\n\nI can accept transfers to a Schwab bank account (routing 121202211)\nI can meet in person to accept cash in London, weekdays after 6, with a day of notice.\nHide the cash in Hume Park, Bulawayo, and tell me the location over chat.":"Some examples:\n\nI can deliver cash anywhere within an hour drive of Phoneix, AZ, with 2 days of notice.\nTransferWise\nInterac e-Transfer\n")}())},AD={$:"TextArea"},BD=r(function(e,t){return l(m_,{autofill:fi,spellchecked:t.spellcheck,type_:AD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),kD=n(function(e,t,r){var n=f(Ok,F([gN(22),dN]),Qp("Payment Method")),a=f(BD,F([PT(Fk),$T(Hk(150)),qk(d(vR,155,203,255,.2)),T$(0)]),{label:Px("payment method"),onChange:ED,placeholder:""===r?ci(ID(t)):fi,spellcheck:!0,text:r});return f(UN,F([wN(20),$$({bottom:15,left:45,right:45,top:0}),PT(Fk),ux(f(ix,F([Nx,T_(30),ZN(10),gN(20),PT(Hk(400))]),e))]),F([n,a]))}),ND=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."},RD=a(function(e,t,r,n){var a=l(hs,e,D("0"),Ri(n));return f(Ok,F([gN(22),_A(t)]),Qp(O(a,r)))}),$D=function(e){return Gl(e)<0?Ff(0):e},xD=JR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),_D=JR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),LD=n(function(e,t,n){var a=r(function(e,r){return f(UN,F([wN(4)]),F([f(Ok,F([ZN(4),nN,fN(n(f(Nb,t,e)))]),f(o$,F([$T(Hk(10))]),_D)),r,f(Ok,F([ZN(4),nN,fN(n(function(e){return Gl(e)?e:Ff(3e5)}($D(f(_R,t,e)))))]),f(o$,F([$T(Hk(10))]),xD))]))}),i=jR(t);return f(FN,F([vD,wN(10)]),F([f(a,Ff(864e5),d(RD,3,e," days",i.days)),f(a,Ff(36e5),d(RD,2,e," hours",i.hours)),f(a,Ff(3e5),d(RD,2,e," min",i.min))]))}),PD=o(function(e,t,r,n,a,i){var o=f(Ok,F([qk(d(vR,155,203,255,.2)),iN(5),ZN(15),ux(f(ix,F([Nx]),a))]),l(LD,DR,n,i)),u=f(FN,F([wN(30)]),F([f(o$,F([$T(Hk(40)),fN(j$(d(ed,"click","misclick","symbol for "+t,0)))]),e),f(Ok,F([gN(22),dN]),Qp(t))])),s=f(BN,F([gN(17),tR,_A(dx)]),F([Qp(r)]));return f(UN,F([PT(Fk),iN(10),qk(l(Lk,237,237,237)),wN(2)]),f(Pa,Ok(F([qk(Qk),f(eN,45,18),PT(Fk)])),F([u,f(FN,F([PT(Fk),wN(25),qk(Qk)]),F([o,s]))])))}),DD=JR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),UD=f(rN,JN,jT.clipX),OD=f(rN,JN,jT.clipY),MD=i(function(e,t,r,n,a){return f(UN,F([wN(15),iN(8),UD,OD,qk(Qk)]),F([p(PD,DD,"Payment Window",ND(a),r,n,SD),l(kD,t,a,e)]))}),FD=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},VD=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."},KD=JR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),HD=n(function(e,t,r){return f(Ok,F([iN(8),UD,OD,qk(Qk)]),p(PD,KD,"Burn/Release Window",VD(r),e,t,FD))}),jD=function(e){return{$:"AutorecallIntervalChanged",a:e}},qD=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."},GD=JR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),zD=n(function(e,t,r){return f(Ok,F([iN(8),qk(Qk),UD,OD]),p(PD,GD,"Open Window",qD(r),e,t,jD))}),YD=function(e){return f(UN,F([PT(Fk),wN(20)]),F([l(zD,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(MD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(HD,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},WD=function(e){return f(UN,F([PT(f(nx,1e3,Fk)),CN,wN(20),$$({bottom:30,left:40,right:40,top:0}),fN(K$(!1)),tx(Ax(e))]),F([yD(e),YD(e),CD(e.userInfo)]))},JD=cs(Ym(8226)),QD=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(Na,e,f(Na,t,r))}),o=l(La,i,mr,a);return f(Na,n,o)}return mr}),XD=r(function(e,t){return l($a,Na,t,e)}),ZD=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(XD,r,e),a=t-1,i=r;e=n,t=a,r=i}}),eU=r(function(e,t){var r=wi(t);return!r||$(r,e)?t:_(r,e)<0?xa(f(XD,f(Ys,e%r,t),l(ZD,mr,e/r|0,t))):f(Ys,e,t)}),tU=a(function(e,t,r,n){for(;;){if(!r.b)return xa(n);var a=r.a,i=r.b,o=e(a);if(f(ww,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(DE,o,t),c=i,l=f(Na,a,n);e=u,t=s,r=c,n=l}}}),rU=function(e){return d(tU,Oa,wm,e,mr)},nU=r(function(e,t){return f(Ok,F([PT(Fk),tx(f(FN,F([wN(3),PT(XN(100)),PT(t),QN]),f(QD,f(Ok,F([_A(d(u$,0,0,0,.1)),gN(14)]),Qp(JD)),f(Pa,f(Ua,Ok(F([_A(d(u$,0,0,0,.2))])),Qp),f(eU,100,(e?xa:Oa)(rU(f(Pa,f(yo,zo,Xa),Aa(XR)))))))))]),Qp(" "))}),aU=r(function(e,t){var r=t.url,n=t.label;return d(wA,FT,UT("a"),f(Na,DT(BT(r)),f(Na,DT(kT("noopener noreferrer")),f(Na,PT(_T),f(Na,$T(_T),f(Na,IA(jT.contentCenterX+" "+jT.contentCenterY),e))))),OT(F([n])))}),iU=function(){var e=f(Ua,Ok(F([_A(l(kA,.8,.2,.2))])),Qp),t=f(Ua,Ok(F([kN])),Qp);return f(UN,F([PT(Fk),$T(Fk),qk(Qk),iN(6),wN(50),pD({blur:20,color:d(vR,0,0,0,.1),offset:L(0,3),size:0}),iN(10),ZN(20)]),F([f(nU,!1,Fk),f(UN,F([CN,PT(f(nx,700,Fk)),wN(20)]),F([f(BN,F([gN(70),kN,CN,bx]),F([Qp("DAI"),e("Hard")])),f(FN,F([gN(30),dN,CN,bx,$N]),F([Qp("The "),e("Global"),Qp(", "),e("Unkillable"),Qp(" Crypto Gateway")]))])),f(FN,F([qk(A$),wN(2),CN,Z$,PT(Fk)]),F([f(Ok,F([f(eN,40,10),qk(Qk),PT(Fk),$T(Fk)]),f(UN,F([wN(60),LN]),F([f(Ok,F([gN(40),dN,CN]),Qp("Want to learn more?")),f(aU,F([iN(4),nN,f(eN,25,17),qk(L$),_A(Qk),kN,gN(24),CN]),{label:f(BN,F([bx]),F([Qp("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"})]))),f(Ok,F([f(eN,40,10),qk(Qk),PT(Fk),$T(Fk)]),f(UN,F([_x,wN(60)]),F([f(Ok,F([gN(40),dN,CN]),Qp("Ready to try it out?")),f(UN,F([wN(10),PT(Hk(400)),CN]),F([f(BN,F([gN(24),PT(Fk)]),F([Qp("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f(BN,F([gN(24),PT(Fk)]),F([Qp("Then follow the links at the top of this page to browse "),t("Sell Offers"),Qp(", browse "),t("Buy Offers"),Qp(", or "),t("Create Your Own Offer"),Qp(".")]))]))])))])),f(Ok,F([Tx,PT(Fk)]),f(nU,!0,Fk))]))}(),oU=function(e){return{$:"ShowCurrencyDropdown",a:e}},uU=n(function(e,t,r){return f(yo,eh(t(e)),qN(r))}),sU={$:"AutoabortWindow"},cU={$:"AutoreleaseWindow"},fU={$:"Expiring"},lU={$:"Fiat"},dU={$:"Margin"},hU={$:"TradeAmount"},pU=function(e){var t=e.a,r=e.b;return f(Ok,F([PT(XN(t)),$T(Hk(60)),QN,qk(Qk)]),f(Ok,F([ZN(12),WN,PT(Fk)]),r))},gU={$:"Descending"},vU=r(function(e,t){return{$:"SortBy",a:e,b:t}}),yU=function(e){return f(Ok,F([tR,gN(17)]),Qp(e))},mU=n(function(e,t,r){return f(FN,F([wN(8)]),F([yU(e),f(UN,F([wN(2)]),F([f(Ok,F([ZN(4),nN,fN(f(vU,t,cv))]),f(o$,F([PT(Hk(8)),CN,WN]),_D)),f(Ok,F([ZN(4),nN,fN(f(vU,t,gU))]),f(o$,F([PT(Hk(8)),CN,WN]),xD))]))]))}),bU=r(function(e,t){var r=function(){return"Buyer"===e.$?yN:VR}(),n=_(Gl(t.parameters.autoabortInterval),216e5)<0?r:DR;return d(qR,mr,mr,L(n,UR),t.parameters.autoabortInterval)}),CU=r(function(e,t){var r=function(){return"Buyer"===e.$?VR:yN}(),n=_(Gl(t.parameters.autoabortInterval),216e5)<0?r:DR;return d(qR,mr,mr,L(n,UR),t.parameters.autoreleaseInterval)}),SU=r(function(e,t){var r=f(LR,e,t);if("TimeLeft"===r.$){var n=r.a,a=f(zR,n.a,n.b)<.05?yN:DR;return d(YR,F([PT(Fk)]),F([gN(16)]),L(a,UR),n)}var i=r.a;return d(YR,F([PT(Fk)]),F([gN(16)]),L(yN,UR),L(Ff(0),i))}),EU=function(e){return s$(e.terms.price)},TU=function(e){var t=Bu(100*e),r=t-ei(t),n=Ri(ei(t)),a=f(ti,0,3-Lo(n));return n+(function(){if(a){return f(Mo,a+1,f(Do,1,xw(r)))}return""}()+"%")},wU=r(function(e,t){return JR({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"}()})}),IU=n(function(e,t,r){return f(o$,f(Na,$T(Hk(34)),e),f(wU,t,r))}),AU=r(function(e,t){var r=TU(t);if("0%"===r)return f(Ok,F([gN(16)]),Qp("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?VR:yN;return f(FN,F([wN(4)]),F([l(IU,mr,a,ci(i)),f(Ok,F([_A(o),gN(16)]),Qp(n))]))}),BU=r(function(e,t){return f(yc,Vk,f(jf,AU(t),e.derived.margin))}),kU=function(e){return f(yc,Vk,f(jf,f$,Xf(e)))},NU=function(e){return g$(e.parameters.tradeAmount)},RU=function(e){return{$:"TradeClicked",a:e}},$U=function(e){return f(kR,F([qk(d(vR,16,7,234,.2)),ZN(11),iN(4),PT(Fk),gR(F([qk(d(vR,16,7,234,.4))]))]),{label:f(Ok,F([CN,_A(l(Lk,16,7,234)),tR]),Qp("View Offer")),onPress:ci(RU(e))})},xU=n(function(e,t,r){return f(FN,F([PT(Fk),wN(1),qk(UR)]),F([f(UN,F([PT(Fk),wN(1),PT(XN(7))]),F([f(FN,F([PT(XN(6)),wN(1)]),f(Pa,pU,F([L(2,f(SU,e,r)),L(1,NU(r)),L(2,EU(r)),L(1,f(BU,r,!$(t,ay))),L(2,f(bU,t,r)),L(2,f(CU,t,r))]))),pU(L(1,kU(r.terms.paymentMethods)))])),f(Ok,F([PT(XN(1)),$T(Fk),QN,qk(Qk)]),f(Ok,F([CN,WN]),$U(r.id)))]))}),_U=n(function(e,t,r){var n=function(){return"Buyer"===r.browsingRole.$?"Selling":"Buying"}();return f(UN,F([PT(Fk),$T(Fk),ZN(30),wN(5)]),F([f(FN,F([PT(Fk)]),F([f(FN,F([PT(XN(7))]),F([pU(L(2,l(mU,"Expires",fU,fi))),pU(L(1,l(mU,n,hU,fi))),pU(L(2,l(mU,"For Fiat",lU,fi))),pU(L(1,l(mU,"Margin",dU,fi))),pU(L(2,l(mU,"Payment Window",sU,fi))),pU(L(2,l(mU,"Auto-Release",cU,fi)))])),f(Ok,F([PT(XN(1))]),Vk)])),f(UN,F([PT(Fk),T$(2),iN(8),S$(A$),wN(1),qk(A$),QN]),f(Pa,f(xU,e,r.browsingRole),t))]))}),LU=n(function(e,t,r){var n=d(uU,e,r.filterFunc,r.sortFunc,B$(t)),a=function(e){return f(Ok,F([gN(24),dN,_A(A$),CN,ZN(20)]),Qp(e))},i=L(t.dataFetchStatus.total,n);if("Nothing"===i.a.$){i.a;return a("Querying Factory contract...")}if(i.a.a){if(i.b.b){var o=i.a.a;return l(_U,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.")}),PU={$:"ApplyInputs"},DU=f(kR,F([qk(L$),ZN(10),iN(5)]),{label:f(Ok,F([_A(Qk),CN,WN]),Qp("Apply")),onPress:ci(PU)}),UU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f($A,aN,l(aA,"br-"+Ri(t)+"-"+Ri(r)+Ri(n)+"-"+Ri(a),"border-radius",Ri(t)+"px "+Ri(r)+"px "+Ri(a)+"px "+Ri(n)+"px"))},OU=function(e){return f(sN,"focus",Vi(e))},MU=f(Ua,DT,OU),FU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return mr;var e=o.a;return F([MU(e(!0)),U_(e(!0))])}();return f(FN,O(e,F([$T(Hk(40)),pD({blur:20,color:d(vR,233,237,242,.05),offset:L(0,3),size:0})])),F([f(Ok,F([qk(UR),$T(Hk(40)),UU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Ok,F([WN,f(eN,10,0)]),r)),f(b_,O(s,O(t,F([PT(Hk(100)),$T(Hk(40)),S$(UR),UU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),A_({bottom:1,left:0,right:1,top:1})]))),{label:Px(n),onChange:u,placeholder:i,text:a})]))}),VU=function(e){return{$:"MaxDaiChanged",a:e}},KU=function(e){return{$:"MinDaiChanged",a:e}},HU=r(function(e,t){return f(UN,F([PT(Fk),wN(8)]),F([f(Ok,F([gN(17),tR]),Qp(e)),t]))}),jU=hw(25),qU=function(e){return{$:"MoveX",a:e}},GU=function(e){return f(fR,jU,qU(-e))},zU={$:"OnLeft"},YU=function(e){return f(sR,zU,e)},WU=a(function(e,t,r,n){var a=h$(F([WN])),i=f(FN,F([wN(8),WN,PT(Hk(60))]),F([a,f(Ok,F([gN(16),WN]),Qp("max"))])),o=f(FN,F([wN(8),WN,PT(Hk(60))]),F([a,f(Ok,F([gN(16),WN]),Qp("min"))]));return f(HU,Qf(e)+" Range",f(UN,F([wN(5),PT(Hk(200))]),F([v(FU,F([YU(f(ix,F([GU(5),PT(Hk(200))]),n.minDai))]),F([MU(oU(!1))]),o,"min "+Qf(e),t,fi,fi,KU),v(FU,F([YU(f(ix,F([GU(5),PT(Hk(200))]),n.maxDai))]),F([MU(oU(!1))]),i,"max "+Qf(e),r,fi,fi,VU)])))}),JU=function(e){var t=f(Eh,e,XR);if("Nothing"===t.$)return Qp("*");var r=t.a,n=r.b;return f(o$,F([$T(Hk(26))]),n)},QU=function(e){return{$:"AppCmd",a:e}},XU=function(e){return{$:"FiatTypeInputChanged",a:e}},ZU=function(e){return{$:"MaxFiatChanged",a:e}},eO=function(e){return{$:"MinFiatChanged",a:e}},tO=i(function(e,t,r,n,a){var i=QU(d(ed,"click","misclick","currency flag",0)),o=JU(t),u=f(FN,F([wN(8),WN,PT(Hk(60))]),F([o,f(Ok,F([gN(16),WN]),Qp("max"))])),s=f(FN,F([wN(8),WN,PT(Hk(60))]),F([o,f(Ok,F([gN(16),WN]),Qp("min"))]));return f(HU,"Fiat Type",f(FN,F([wN(5),PT(_T)]),F([f(Ok,F([Z$,PT(Hk(120))]),h(oD,e,t,oU(!0),XU,i)),f(UN,F([wN(5),Z$,PT(Hk(200))]),F([v(FU,F([ux(f(ix,F([fx(5),PT(f(nx,200,_T))]),a.minFiat))]),F([MU(oU(!1))]),s,"min",r,fi,fi,eO),v(FU,F([E_(f(ix,F([T_(5),PT(f(nx,200,_T))]),a.maxFiat))]),F([MU(oU(!1))]),u,"max",n,fi,fi,ZU)]))])))}),rO={$:"AddSearchTerm"},nO=function(e){return{$:"PaymentMethodInputChanged",a:e}},aO=f(Md,"keyCode",oS),iO=function(e){return f(sN,"keyup",f(Wo,function(t){return 13===t?Vi(e):Jo(Ri(t))},aO))},oO=function(e){return f(HU,"Search Payment Methods",f(b_,F([Z$,PT(Hk(250)),$T(Hk(40)),S$(UR),pD({blur:20,color:d(vR,233,237,242,.05),offset:L(0,3),size:0}),J$(iO(rO))]),{label:Px("payment methods search"),onChange:nO,placeholder:fi,text:e}))},uO={$:"ResetSearch"},sO=f(kR,F([qk(L$),ZN(10),iN(5)]),{label:f(Ok,F([_A(Qk),CN,WN]),Qp("Reset")),onPress:ci(uO)}),cO=function(e){return{$:"RemoveTerm",a:e}},fO=function(e){return f(Ok,F([ZN(3),Z$,nN,fN(cO(e)),gN(10),_A(yN)]),Qp("x"))},lO=function(e){if(e.b){var t=e;return f(FN,F([PT(Fk),ZN(10),wN(10)]),f(Pa,function(e){return f(FN,F([qk(d(vR,16,7,234,.2)),iN(5),ZN(4),wN(3)]),F([Qp(e),fO(e)]))},t))}return Vk},dO=a(function(e,t,r,n){return f(UN,F([wN(10),PT(_T),CN]),F([f(FN,F([PT(_T),wN(10)]),F([f(Ok,F([PT(_T),Z$]),d(WU,e,t.minDai,t.maxDai,r)),f(Ok,F([PT(_T),Z$]),h(tO,n,t.fiatType,t.minFiat,t.maxFiat,r)),f(UN,F([PT(_T),Z$,wN(5)]),F([oO(t.paymentMethod),lO(t.paymentMethodTerms)])),f(HU," ",f(UN,F([wN(5),PT(_T)]),F([DU,sO])))]))]))}),hO=n(function(e,t,r){return f(UN,F([iN(5),qk(Qk),PT(Fk),$T(Fk),fN(oU(!1))]),F([f(FN,F([PT(Fk),wN(10),ZN(30)]),F([d(dO,r.web3Context.factoryType,r.inputs,r.errors,r.showCurrencyDropdown)])),l(LU,e,t,r)]))}),pO=f(yo,ku,Lm("USD")),gO=a(function(e,t,r,n){return{daiAmountIn:t,fiatValue:r,initiatorRole:e,intervals:n}}),vO=function(e){return Kv(f(zu,f(gl,ku(10),ku(18)),ku(e)))},yO=F([d(gO,Of,vO(5),pO(4),P(Ff(1728e5),Ff(1728e5),Ff(2592e5))),d(gO,ay,vO(2),pO(7),P(Ff(1728e5),Ff(1728e5),Ff(2592e5)))]),mO=function(e){return f(Gf,Mv(e),3)},bO=GR,CO=r(function(e,t){return p$(t)+" "+Qf(e)}),SO=r(function(e,t){return f(Ok,F([_A(bO),gN(20)]),Qp(f(CO,e,t)))}),EO=VR,TO=function(e){return"$"+Tl(e.amount)+" USD"},wO=function(e){return f(Ok,F([_A(EO),gN(20)]),Qp(TO(e)))},IO=function(e){return $(e,Ff(6048e5))?Qp("1 week"):b("QuickCreate.View",{start:{line:132,column:9},end:{line:132,column:19}})("lol bet u forgot about dis. summarizeIntervalElement is a hack! A dirty hack!!")},AO=r(function(e,t){var r=function(){return"Buyer"===t.initiatorRole.$?f(SO,e,f(ld,Mv(t),mO(t))):wO(t.fiatValue)}(),n=function(){return"Buyer"===t.initiatorRole.$?f(UN,F([wN(5)]),F([f(SO,e,t.daiAmountIn),wO(t.fiatValue)])):f(SO,e,t.daiAmountIn)}(),a=IO(function(e){var t=e.a,r=e.b,n=e.c;return f(Nb,n,f(Nb,r,t))}(t.intervals)),i=Qp("---\x3e");return f(UN,F([wN(8)]),F([f(FN,F([wN(4)]),F([n,i,r])),a]))}),BO=r(function(e,t){return d(vx,P(d(u$,0,0,1,1),d(u$,0,0,1,.8),d(u$,0,0,1,.6)),Qk,e,t)}),kO=function(e){return{$:"StartClicked",a:e}},NO=function(e){return f(BO,"Start",kO(e))},RO=n(function(e,t,r){return f(FN,F([wN(40)]),F([f(AO,e,r),t?NO(r):Vk]))}),$O=r(function(e,t){return{$:"OpenClicked",a:e,b:t}}),xO=r(function(e,t){if("Just"!==e.$)return f(lx,"Can't find userInfo...",ci("You shouldn't be seeing this. Maybe your web3 provider changed something just now?"));var r=e.a;if("Spec"!==t.$)return Vk;var n=t.a,a=t.b;switch(a.$){case"ApproveMining":a.a;return f(lx,"Mining Prepare tx...",fi);case"ReadyToOpen":return f(yx,"Open Trade",f($O,r,n));case"OpenNeedsSig":default:return Vk}}),_O=function(e){return{$:"TextInputChanged",a:e}},LO=function(e){return f(wD,mr,f(UN,F([wN(5)]),f(Pa,f(Ua,BN(mr),ME),function(){return F("Buyer"===e.$?[Qp("Some ideas:"),f(Ok,F([$N]),Qp("I can meet in NYC central park for a cash handoff after 6 pm.")),f(Ok,F([$N]),Qp("I'll send you $7 in Steam credit.")),f(Ok,F([$N]),Qp("TransferWise")),f(Ok,F([$N]),Qp("Cash drop in Hume Park, Bulawayo"))]:[Qp("Some ideas:"),f(Ok,F([$N]),Qp("I accept money orders or cashier checks into my Schwab bank account.")),f(Ok,F([$N]),Qp("Meet me at the Bangkok airport (BKK) on Saturday. I'm coming in on flight I453.")),f(Ok,F([$N]),Qp("Buy Dig Dog on Steam and gift it to me (syriven).")),f(Ok,F([$N]),Qp("Ship me a potato."))])}())))},PO=r(function(e,t){return f(BD,F([PT(Fk),$T(Hk(200))]),{label:Px("payment details"),onChange:_O,placeholder:""===t?ci(LO(e)):fi,spellcheck:!0,text:t})}),DO=r(function(e,t){return f(UN,F([wN(10)]),f(Pa,BN(mr),F([function(){return F("Seller"===e.$?[Qp("How must the "),wO(t),Qp(" be paid?")]:[Qp("How can you deliver the "),wO(t),Qp("?")])}(),F([Qp("You will be able to chat with the "),Qp(function(){return"Seller"===e.$?"buyer":"seller"}()),Qp(" to coordinate further once the trade is in progress.")])])))}),UO=function(e){return{$:"ApproveClicked",a:e}},OO=function(e){return{$:"ChangeState",a:e}},MO={$:"Web3Connect"},FO=n(function(e,t,r){return f(yc,Vk,function(){e:for(;;)if("Menu"===r.$)switch(r.a.$){case"StartPrompt":var n=r.a.a;return ci(l(ax,mr,f(UN,F([wN(15),CN,ZN(20)]),F([Qp("Text about approving"),function(){if("Just"===t.$){t.a;return f(BO,"Prepare "+p$(n.daiAmountIn)+" "+Qf(e)+" for deposit",UO(n))}return f(yx,"Connect to Wallet",MO)}()])),OO(Ev(Tv))));case"ApproveNeedsSig":var n=r.a.a;return ci(l(ax,mr,f(UN,F([wN(15),ZN(20),CN]),F([Qp("Waiting for sig text")])),OO(Ev(Tv))));default:break e}else switch(r.b.$){case"OpenNeedsSig":var n=r.a;r.b;return ci(l(ax,mr,f(UN,F([wN(15),ZN(20),CN]),F([Qp("Text about opening")])),OO(f(Dv,n,Pv))));case"OpenMining":var n=r.a;r.b;return ci(l(ax,mr,f(UN,F([wN(15),ZN(20),CN]),F([Qp("Opening trade. Note that if you close this modal or navigate away, the transaction could still complete."),Qp("You will be redirected when the trade is finished opening.")])),OO(Ev(Tv))));default:break e}return fi}())}),VO=function(e){return L(function(){var t=e.state;if("Menu"===t.$){t.a;return f(UN,F([wN(10),CN]),f(Pa,f(RO,e.web3Context.factoryType,!0),yO))}var r=t.a;t.b;return f(UN,F([wN(20),CN]),F([l(RO,e.web3Context.factoryType,!1,r),f(UN,F([wN(10),CN]),F([f(DO,r.initiatorRole,r.fiatValue),f(PO,r.initiatorRole,e.textInput),f(xO,e.userInfo,e.state)]))]))}(),F([l(FO,e.web3Context.factoryType,e.userInfo,e.state)]))},KO=function(e){return{$:"MessageInputChanged",a:e}},HO={$:"MessageSubmit"},jO=function(e){return f(UN,F([PT(Fk),wN(10)]),F([f(BD,F([PT(Fk),$T(Hk(100))]),{label:Px("messageInput"),onChange:KO,placeholder:fi,spellcheck:!1,text:e.messageInput}),f(kR,F([CN,gN(24)]),{label:Qp("Submit"),onPress:ci(HO)})]))},qO=f(rN,JN,jT.scrollbarsY),GO=r(function(e,t){return f(Ok,F([$T(Fk),PT(Fk)]),f(Ok,O(F([J$(f(W$,"position","absolute")),J$(f(W$,"top","0")),J$(f(W$,"right","0")),J$(f(W$,"bottom","0")),J$(f(W$,"left","0")),qO]),e),t))}),zO=l(Lk,200,205,210),YO=n(function(e,t,r){var n=F([LN,qk(L$),_A(Qk),UU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=F([_x,qk(zO),_A(DR),UU({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(Ok,O(F([ZN(7)]),u),f(BN,mr,F([Qp(O(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return ci(P(l(kA,0,0,1),Qk,"Initiator opened the trade"));case"Recalled":return ci(P(l(kA,0,0,1),Qk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Mo,8,Zd(t))+"..";return ci(P(l(kA,1,0,1),Qk,r+" committed to the trade"));case"Aborted":return ci(P(l(kA,1,0,0),Qk,"Buyer aborted the trade"));case"Claimed":return ci(P(l(kA,0,1,0),Qk,"Buyer marked the fiat transfer complete"));case"Released":return ci(P(l(kA,0,0,1),Qk,"Seller released the "+Qf(e)+" and closed the contract"));default:return ci(P(l(kA,0,0,1),Qk,"Seller burned the "+Qf(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Vk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Ok,F([iN(3),T$(1),S$(l(kA,1,0,1)),CN,qk(h)]),f(BN,F([_A(p)]),F([Qp(g)])))}),WO=n(function(e,t,r){if(r.b){var n=r;return f(GO,F([PT(Fk),$T(Fk),iN(5),T$(1),S$(DR),ZN(10)]),f(UN,F([PT(Fk),$T(Fk),wN(10)]),f(Pa,f(YO,e,t),n)))}return f(Ok,F([PT(Fk),$T(Fk),iN(5),T$(1),S$(DR),CN,_A(l(kA,.5,.5,.5)),$N]),Qp("no messages found."))}),JO=Sr,QO=function(e){return f(UN,F([PT(Fk),$T(Fk),wN(10),T$(1),iN(5),ZN(20)]),F([l(WO,e.web3Context.factoryType,e.userRole,f(JO,function(e){return e.blocknum},Ta(e.history))),jO(e)]))},XO=function(e){return f(Ok,F([qk(Qk),iN(8),gD,PT(Fk),$T(Fk)]),QO(e))},ZO={$:"ToggleChat"},eM=function(e){if(e.showChatHistory){var t=f(yc,Vk,f(jf,XO,e.chatHistoryModel));return f(Ok,F([$T(Fk),PT(Hk(500)),ZN(20),LN]),l(ax,F([$T(Fk),PT(Fk)]),f(Wi,$S,t),ZO))}return Vk},tM=function(e){return"Buyer"===e.initiatorRole.$?Of:ay},rM=function(e){return r$(e)+" "+e.fiatType},nM={$:"AbortAction"},aM=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),iM=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Vk;switch(t.a.$){case"ConfirmingCommit":var r=t.a,n=r.a,a=r.b,i=r.c,o=rM(n.terms.price),u=p$(Kv(i)),s=p$(n.parameters.tradeAmount)+" "+Qf(e.web3Context.factoryType),c=function(){return"Buyer"===tM(n.parameters).$?L(f(Ok,F([tR,_A(DR)]),Qp("buyer")),F([Qp("pay the seller "),f(Ok,F([_A(L$)]),Qp(o)),Qp(" in exchange for the "),f(Ok,F([_A(L$)]),Qp(s)),Qp(" held in this contract.")])):L(f(Ok,F([tR,_A(DR)]),Qp("seller")),F([Qp("accept "),f(Ok,F([_A(L$)]),Qp(o)),Qp(" from the buyer in exchange for the "),f(Ok,F([_A(L$)]),Qp(s)),Qp(" held in this contract.")]))}(),d=c.a,h=c.b;return l(ax,mr,f(UN,F([wN(20),ZN(20),CN,$T(Fk),bx]),F([f(Ok,F([gN(26),dN,CN,WN]),Qp("Just to Confirm...")),f(UN,F([wN(20),CN,WN]),f(Pa,BN(F([CN,gN(18),tR,_A(dx)])),O(F([O(F([Qp("You will deposit "),f(Ok,F([_A(L$)]),Qp(u+" "+Qf(e.web3Context.factoryType))),Qp(", thereby becoming the "),d,Qp(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===e.web3Context.factoryType.$?F([F([Qp("(This ususally requires two Metamask signatures. Your "+Qf(e.web3Context.factoryType)+" will not be deposited until the second transaction has been mined.)")])]):mr}()))),f(Ok,F([Tx,CN]),f(yx,"Yes, I definitely want to commit to this trade.",l(aM,n,a,i)))])),nM);case"ApproveNeedsSig":t.a;return Cx(F([Qp("Waiting for user signature for the approve call."),Qp("(check Metamask!)"),Qp("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=t.a.a;return Cx(F([Qp("Mining the initial approve transaction..."),f(AA,F([wx,_A(L$)]),{label:Qp("See the transaction on Etherscan"),url:f(Sx,e.web3Context.factoryType,p)}),Qp("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":t.a;return Cx(F([Qp("Waiting for user signature for the final commit call."),Qp("(check Metamask!)"),Qp("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=t.a.a;return Cx(F([Qp("Mining the final commit transaction..."),f(AA,F([wx,_A(L$)]),{label:Qp("See the transaction"),url:f(Sx,e.web3Context.factoryType,p)})]));case"ConfirmingAction":var g=t.a.a;return l(ax,mr,f(UN,F([wN(20),ZN(20),CN,$T(Fk),bx]),F([f(Ok,F([gN(26),dN,CN,WN]),Qp("Just to Confirm...")),f(UN,F([wN(20),CN,WN]),f(Pa,BN(F([CN,gN(18),tR,_A(dx)])),function(){switch(g.$){case"Poke":case"Recall":return mr;case"Claim":return F([F([Qp('By clicking "Confirm Payment", you are claiming that you\'ve paid the Seller in a way they can verify. Only do this if you are sure the Seller will agree that they have the money--otherwise they may burn the '+Qf(e.web3Context.factoryType)+" rather than release it to you.")])]);case"Abort":return F([F([Qp("Aborting will incur a small penalty on both parties, and refund the rest of the "+Qf(e.web3Context.factoryType)+".")])]);case"Release":return F([F([Qp("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return F([F([Qp("This will destroy the "+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(Ok,F([Tx,CN]),function(e){return f(yx,e,JS(g))}(function(){switch(g.$){case"Poke":return"Poke";case"Recall":return"Recall";case"Claim":return"I understand. Confirm Payment";case"Abort":return"I understand. Abort the trade.";case"Release":return"I understand. Release the "+Qf(e.web3Context.factoryType)+".";default:return"I understand. Burn the "+Qf(e.web3Context.factoryType)+"."}}()))])),nM);case"ActionNeedsSig":var g=t.a.a;return Cx(F([Qp("Waiting for user signature for the "+XS(g)+" call."),Qp("(check Metamask!)")]));default:var v=t.a,g=v.a,p=v.b;return Vk}},oM=FN(F([PT(Fk),qk(Qk),iN(5),ZN(20),vD,gD])),uM=function(e){return f(FN,F([wN(8)]),F([f(o$,mr,d$),f(Ok,F([gN(24),tR]),Qp(p$(e)))]))},sM=r(function(e,t){var r=f(ag,Tb(e),f(jf,function(e){return e.address},t));return f(k_,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"}(),uM(e.parameters.tradeAmount))}),cM=function(e){return f(FN,F([wN(5)]),F([D_(e.fiatType),f(Ok,F([gN(24),tR]),Qp(rM(e)))]))},fM=function(e){return f(k_,"For Fiat",cM(e.terms.price))},lM=function(e){return"Buyer"===e.$?"Buyer":"Seller"},dM=l(Lk,250,165,22),hM=l(Lk,255,0,0),pM=l(Lk,0,255,0),gM=JR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),vM=JR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),yM=JR({description:"released",src:"/DAIHard/static/img/released.svg"}),mM={$:"ToggleStatsModal"},bM=function(e){return f(JO,Oa,e)},CM=n(function(e,t,n){var a=f(eh,function(e){return $(f(BS,e,n),ci(t))},f(eT,function(e){if("LoadedTrade"===e.$){var t=e.a;return ci(t)}return fi},Ta(e.trades))),i=wi(a),o=l($a,r(function(e,t){switch(e.state.closedReason.$){case"Released":return U(t,{amountReleased:f(ld,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return U(t,{amountBurned:f(ld,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(bM(f(eT,function(e){return function(e){return e?ci(e):fi}(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}}),SM=function(e){return{$:"ViewUserHistory",a:e}},EM=f(jB,0,mr),TM=f(rN,lN,jT.textNormalWeight),wM=r(function(e,t){return ei(e/t)}),IM=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}}),AM=r(function(e,t){var r=e.a,n=e.b;return l(IM,r,f(wM,Gl(t),6e4),n)}),BM=r(function(e,t){return f(gs,24,f(wM,f(AM,e,t),60))}),kM=r(function(e,t){return f(gs,1e3,Gl(t))}),NM=r(function(e,t){return f(gs,60,f(AM,e,t))}),RM={$:"Apr"},$M={$:"Aug"},xM={$:"Dec"},_M={$:"Feb"},LM={$:"Jan"},PM={$:"Jul"},DM={$:"Jun"},UM={$:"Mar"},OM={$:"May"},MM={$:"Nov"},FM={$:"Oct"},VM={$:"Sep"},KM=function(e){var t=f(wM,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)}},HM=r(function(e,t){switch(KM(f(AM,e,t)).month){case 1:return LM;case 2:return _M;case 3:return UM;case 4:return RM;case 5:return OM;case 6:return DM;case 7:return PM;case 8:return $M;case 9:return VM;case 10:return FM;case 11:return MM;default:return xM}}),jM=r(function(e,t){return f(gs,60,f(wM,Gl(t),1e3))}),qM={$:"Fri"},GM={$:"Mon"},zM={$:"Sat"},YM={$:"Sun"},WM={$:"Thu"},JM={$:"Tue"},QM={$:"Wed"},XM=r(function(e,t){switch(f(gs,7,f(wM,f(AM,e,t),1440))){case 0:return WM;case 1:return qM;case 2:return zM;case 3:return YM;case 4:return GM;case 5:return JM;default:return QM}}),ZM=n(function(e,t,r){return e.toAmPm(f(BM,t,r))}),eF=r(function(e,t){return KM(f(AM,e,t)).day}),tF=eF,rF=F([YM,GM,JM,QM,WM,qM,zM]),nF=r(function(e,t){return function(e){return e.a}(f(yc,L(0,YM),Xf(f(eh,function(r){return $(r.b,f(XM,e,t))},f(ki,r(function(e,t){return L(e,t)}),rF)))))}),aF=function(e){return l($a,Ra,0,e)},iF=r(function(e,t){return KM(f(AM,e,t)).year}),oF=function(e){return!f(gs,4,e)&&(!!f(gs,100,e)||!f(gs,400,e))},uF=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return oF(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}}),sF=F([LM,_M,UM,RM,OM,DM,PM,$M,VM,FM,MM,xM]),cF=r(function(e,t){return f(yc,L(0,LM),Xf(f(eh,function(r){r.a;return $(r.b,f(HM,e,t))},f(ki,r(function(e,t){return L(e,t)}),sF))))}),fF=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(cF,e,t))}),lF=r(function(e,t){var r=f(Ys,f(fF,e,t)-1,sF);return aF(f(Pa,uF(f(iF,e,t)),r))+f(tF,e,t)}),dF=r(function(e,t){return f(fF,e,t)/4|0}),hF=r(function(e,t){var r=Ri(t),n=e-Lo(r);return O(f($i,"",f(Pa,function(e){return"0"},f(Bi,1,n))),r)}),pF=function(e){return e?e<=12?e:e-12:12},gF=Bg(315576e5),vF=r(function(e,t){return Ff(gF*f(iF,e,t))}),yF=r(function(e,t){var r=f(vF,e,t),n=f(nF,e,r);return 1+((f(lF,e,t)+n)/7|0)}),mF=r(function(e,t){return Ri(f(iF,e,t))}),bF=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ri(f(fF,t,r));case"MonthSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(fF,t,r));case"MonthFixed":return f(hF,2,f(fF,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(HM,t,r));case"MonthNameFull":return e.toMonthName(f(HM,t,r));case"QuarterNumber":return Ri(1+f(dF,t,r));case"QuarterSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(1+f(dF,t,r));case"DayOfMonthNumber":return Ri(f(tF,t,r));case"DayOfMonthSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(tF,t,r));case"DayOfMonthFixed":return f(hF,2,f(tF,t,r));case"DayOfYearNumber":return Ri(f(lF,t,r));case"DayOfYearSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(lF,t,r));case"DayOfYearFixed":return f(hF,3,f(lF,t,r));case"DayOfWeekNumber":return Ri(f(nF,t,r));case"DayOfWeekSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(nF,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(XM,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(XM,t,r));case"WeekOfYearNumber":return Ri(f(yF,t,r));case"WeekOfYearSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(yF,t,r));case"WeekOfYearFixed":return f(hF,2,f(yF,t,r));case"YearNumberLastTwo":return f(Ho,2,f(mF,t,r));case"YearNumber":return f(mF,t,r);case"AmPmUppercase":return tD(l(ZM,e,t,r));case"AmPmLowercase":return cl(l(ZM,e,t,r));case"HourMilitaryNumber":return Ri(f(BM,t,r));case"HourMilitaryFixed":return f(hF,2,f(BM,t,r));case"HourNumber":return Ri(pF(f(BM,t,r)));case"HourFixed":return f(hF,2,pF(f(BM,t,r)));case"HourMilitaryFromOneNumber":return Ri(1+f(BM,t,r));case"HourMilitaryFromOneFixed":return f(hF,2,1+f(BM,t,r));case"MinuteNumber":return Ri(f(NM,t,r));case"MinuteFixed":return f(hF,2,f(NM,t,r));case"SecondNumber":return Ri(f(jM,t,r));case"SecondFixed":return f(hF,2,f(jM,t,r));case"MillisecondNumber":return Ri(f(kM,t,r));case"MillisecondFixed":return f(hF,3,f(kM,t,r));default:return n.a}}),CF=a(function(e,t,r,n){return f($i,"",f(Pa,l(bF,e,r,n),t))}),SF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),EF=function(e){return e>11?"pm":"am"},TF=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"}},wF=function(e){switch(f(gs,100,e)){case 11:case 12:case 13:return"th";default:switch(f(gs,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},IF=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"}},AF=p(SF,TF,f(yo,TF,Mo(3)),IF,f(yo,IF,Mo(3)),EF,wF),BF=CF(AF),kF={$:"MonthNameFull"},NF=kF,RF=function(e){return{$:"Text",a:e}},$F=RF,xF={$:"YearNumber"},_F=xF,LF=n(function(e,t,n){var a=r(function(e,t){return f(UN,F([gN(18),wN(6)]),F([f(Ok,F([kN]),Qp(e)),f(Ok,F([TM]),Qp(t))]))}),i=BF(F([NF,$F(", "),_F])),o=f(UN,F([wN(23),PT(Fk)]),O(f(Pa,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,EM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ri(n.numReleases)+" trades / "+p$(n.amountReleased)+" "+Qf(e)+" Released"),L("Abort Outcomes",Ri(n.numAborts)+" trades"),L("Burn Outcomes",Ri(n.numBurns)+" trades / "+p$(n.amountBurned)+" "+Qf(e)+" Burned")])),F([f(Ok,F([CN]),f(BO,"View User History",SM(n.asRole)))])));return f(UN,F([iN(8),UD,OD,qk(UR),wN(1),pD({blur:20,color:d(u$,0,0,0,.08),offset:L(0,0),size:0})]),F([f(Ok,F([PT(Fk),qk(Qk),ZN(17)]),f(N$,18,t)),f(Ok,F([PT(Fk),qk(Qk),ZN(17)]),o)]))}),PF=a(function(e,t,r,n){var a=l(CM,r,t.parameters.initiatorRole,t.parameters.initiatorAddress),i=lM(t.parameters.initiatorRole)+" Stats";return f(Ok,n?F([E_(f(Ok,F([T_(30),LN]),l(LF,e,t.parameters.initiatorAddress,a)))]):mr,f(k_,i,f(FN,F([PT(Fk),wN(20),nN,fN(mM)]),f(Pa,FN(F([wN(5)])),F([F([f(o$,F([$T(Hk(28))]),yM),f(Ok,F([gN(24),tR,_A(pM)]),Qp(l(hs,2,D("0"),Ri(a.numReleases))))]),F([f(o$,F([$T(Hk(28))]),gM),f(Ok,F([gN(24),tR,_A(dM)]),Qp(l(hs,2,D("0"),Ri(a.numAborts))))]),F([f(o$,F([$T(Hk(28))]),vM),f(Ok,F([gN(24),tR,_A(hM)]),Qp(l(hs,2,D("0"),Ri(a.numBurns))))])])))))}),DF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+Zd(t)}e.a;return"https://kovan.etherscan.io/address/"+Zd(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+Zd(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+Zd(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+Zd(t)}}),UF=n(function(e,t,r){return f(AA,e,{label:Qp(Zd(r)),url:f(DF,t,r)})}),OF=r(function(e,t){return f(k_,"Trade Status",f(UN,F([gN(24),tR,wN(8)]),F([Qp(function(){switch(e.state.phase.$){case"Open":return"Buyer"===e.parameters.initiatorRole.$?"Open Buy Offer":"Open Sell Offer";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}}()),l(UF,F([gN(12),_A(L$),wx]),t,e.creationInfo.address)])))}),MF=o(function(e,t,r,n,a,i){return oM(F([f(OF,t,n),f(sM,t,r),fM(t),d(PF,n,t,a,i)]))}),FF=l(Lk,9,32,107),VF=JR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),KF=f(Ok,F([iN(4),nN,fN(ZO),ZN(5),qk(l(Lk,22,0,255))]),f(o$,F([PT(Hk(42))]),VF)),HF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},jF=function(e){return f(UN,F([iN(12),qk(UR),ZN(15),wN(15)]),F([f(Ok,F([gN(24),dN,$N]),Qp("Fiat Payment Method")),f(BN,F([gN(18),$T(_T),qk(Qk),pD({blur:5,color:d(u$,0,0,0,.2),offset:L(-3,3),size:0}),iN(3),ZN(5)]),F([f(yc,f(Ok,F([_A(O$),$N]),Qp("No payment methods found.")),f(jf,Qp,f(jf,function(e){return e.info},Xf(e))))]))]))},qF={$:"Active"},GF=function(e){return{$:"ExpandPhase",a:e}},zF=F([qk(FF),_A(Qk)]),YF=r(function(e,t){return{$:"Min",a:e,b:t}}),WF=r(function(e,t){return f(YF,e,t)}),JF=function(e){return F(e?[iN(12),Z$,$T(f(WF,380,_T))]:[iN(12),CN])},QF=F([qk(Qk)]),XF=JR({description:"flame",src:"/DAIHard/static/img/flame.png"}),ZF=r(function(e,t){return Kf(f(Wu,Hf(e),Hf(t)))}),eV=r(function(e,t){return d(vx,P(d(u$,1,.6,.2,1),d(u$,1,.6,.2,.8),d(u$,1,.6,.2,.6)),Qk,e,t)}),tV=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),rV=function(e){return{$:"ContractActionClicked",a:e}},nV={$:"Web3Connect"},aV=n(function(e,t,r){if("Just"===r.$){var n=r.a;return"TimeUp"===f(LR,e,t).$?Vk:f(FN,F([wN(8)]),function(){var e=P(t.state.phase,f(Tb,t,n.address),f(BS,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(Wi,JS,f(BO,"Remove and Refund this Trade",YS))])}break e}var r=(e.a,e.b,Hf(wb(t.parameters)));return F([f(yx,"Deposit and Commit to Trade",l(tV,t,n,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return F([f(Wi,rV,f(eV,"Abort Trade",_S)),f(Wi,rV,f(yx,"Confirm Payment",FS)),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(Wi,rV,f(yx,"Burn it All!",MS)),f(Wi,rV,f(BO,"Release Everything",WS)),KF])}e.a,e.c.a;return F([KF])}break e;default:break e}return mr}())}return f(yx,"Connect to Wallet",nV)}),iV={$:"Finished"},oV={$:"NotStarted"},uV=r(function(e,t){var r=L(HN(t),HN(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?oV:$(n,a)?qF:iV}),sV=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(Na,r,e),a=t-1,i=r;e=n,t=a,r=i}}),cV=r(function(e,t){return l(sV,mr,e,t)}),fV=i(function(e,t,r,n,a){var i=p$(f(ld,n.parameters.tradeAmount,n.parameters.buyerDeposit))+" "+Qf(e),o=p$(n.parameters.tradeAmount)+" "+Qf(e),u=f(FN,mr,f(cV,3,f(o$,F([$T(Hk(18))]),XF))),s=f(Ua,Ok(F([_A(l(kA,1,0,0))])),Qp),c=$(t,n.state.phase),d=f(ag,BS(n),f(jf,function(e){return e.address},a)),h=c?Qk:DR,p=BN(F([_A(h),gN(18),dN])),g=rM(n.terms.price),v=c?l(Lk,0,226,255):l(Lk,16,7,234),y=f(Ua,Ok(F([_A(v)])),Qp),m=p$(n.parameters.buyerDeposit)+" "+Qf(e),b=n.parameters.abortPunishment,C=p$(b)+" "+Qf(e),S=p$(f(ZF,n.parameters.buyerDeposit,b))+" "+Qf(e),E=p$(f(ZF,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(Pa,p,F([F([Qp("Your "),s("burnable deposit"),Qp(" of "),y(m),Qp(" is now held in this contract, and your offer to buy "),y(o),Qp(" for "),y(g),Qp(" is now listed in the marketplace.")]),F([Qp("If another user likes your offer, they can become the Seller by depositing the full "),y(o),Qp(" into this contract.")]),F([Qp("If no one commits within the Open Window, your offer will expire, refunding the "),y(m),Qp(" to you.")])])):f(Pa,p,F([F([Qp("Your offer to sell the "),y(o),Qp(" held in this contract for "),y(g),Qp(" is now listed in the marketplace.")]),F([Qp("If another user likes your offer, they can become the Buyer by depositing a "),s("burnable deposit"),Qp(" of 1/3 of the trade amount "),y("("+m+")"),Qp(" into this contract.")]),F([Qp("If no one commits within the Open Window, your offer will expire, refunding the "),y(o),Qp(" to you.")])]))}());case"Committed":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Time to Pay Up",f(Pa,p,F([F([Qp("You must now pay the Seller "),y(g),Qp(" via the Fiat Payment Method, "),f(Ok,F([dN]),Qp("and then click ")),s("Confirm Payment"),Qp(" before the payment window runs out. Use the chat to coordinate.")]),F([Qp("If you abort the trade, or do not confirm payment before this time is up, "),y(C),Qp(" (1/4 of the "),s("burnable deposit"),Qp(") will be "),s("burned"),Qp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Qp(" to the Seller, "),y(S),Qp(" to you).")]),F([Qp("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),y(g),Qp(" has been unmistakably transferred.")])])))}r.a,r.b.a;return L("Time to Get Paid",f(Pa,p,F([F([Qp("Work and communicate with the Buyer to receive "),y(g),Qp(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),F([Qp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Qp(" (1/4 of the "),s("burnable deposit"),Qp(") will be "),s("burned"),Qp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Qp(" to you, "),y(S),Qp(" to the Buyer).")])])));case"Judgment":if("Buyer"===r.b.a.$){r.a,r.b.a;return L("Judgement",f(Pa,p,F([F([Qp("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),y(i),Qp(" will be released to you.")]),F([Qp("If they cannot confirm they've received payment from you, they will probably instead "),s("burn the contract's balance of "),y(i),s("."),Qp(" In this case the "),y(i),Qp(" will be lost to both parties.")]),F([Qp("These are the only options the Seller has. So, fingers crossed!")])])))}r.a,r.b.a;return L("Judgement",f(Pa,p,F([F([Qp("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),F([Qp("So, have you recieved the "),y(g),Qp("? If so, you can click "),y("Release Everything"),Qp(".")]),F([Qp("If not, the Buyer is probably trying to scam you, and you should probably "),s("burn it all"),Qp(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),F([Qp("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:r.a;return L("Contract closed.",F([p(F([Qp("Check the chat log for the full history.")]))]))}else switch(r.a.$){case"Open":r.a,r.b;return L("Get it while it's hot",function(){return"Seller"===n.parameters.initiatorRole.$?f(Pa,p,F([F([Qp("The Seller has deposited "),y(o),Qp(" into this contract, and offers to sell it for "),y(g),Qp(". To become the Buyer, you must deposit 1/3 of the trade amount "),y("("+m+")"),Qp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Qp(".")]),F([Qp("If the trade is successful, the combined "+Qf(e)+" balance "),y("("+i+")"),Qp(" will be released to you. If anything goes wrong, there are "),s("burnable punishments "),u,Qp(" for both parties (see Payment Window for more on this).")]),F([Qp("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),y(g),Qp(" within the payment window.")])])):f(Pa,p,F([F([Qp("The Buyer is offering to buy "),y(o),Qp(" for "),y(g),Qp(", and has deposited "),y(m),Qp(" into this contract as a "),s("burnable deposit"),Qp(". To become the Seller, deposit "),y(o),Qp(" into this contract by clicking "),s("Deposit and Commit to Trade"),Qp(".")]),F([Qp("When you receive the "),y(g),Qp(" from the Buyer, the combined "+Qf(e)+" balance "),y("("+i+")"),Qp(" will be released to the Buyer. If anything goes wrong, there are "),s("burnable punishments "),u,Qp(" for both parties (see Payment Window for more on this).")]),F([Qp("Don't commit unless you can receive "),y(g),Qp(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":r.a,r.b;return L("Making the Payment",f(Pa,p,F([F([Qp("During this phase, the Buyer is expected to transfer "),y(g),Qp(" to the Seller, as described in Fiat Payment Method, "),f(Ok,F([dN]),Qp("and ")),s("Confirm the Payment "),Qp(" before the payment window runs out. This would move the trade to the final phase.")]),F([Qp("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),y(C),Qp(" (1/4 of the "),s("burnable deposit"),Qp(" amount) will be "),s("burned"),Qp(" from both parties, while the remainder of each party's deposit is refunded ("),y(E),Qp(" to the Seller, "),y(S),Qp(" to the Buyer).")])])));case"Judgment":r.a,r.b;return L("Judgement",f(Pa,p,F([F([Qp("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),F([Qp("If the Seller can verify he has received the "),y(g),Qp(", he will probably release the total balance of "),y(o),Qp(" to the Buyer. If he cannot verify payment, he will probably instead "),s("burn it all"),Qp(".")]),F([Qp("If the Seller has not made a decision before the Burn/Release Window expires, the "),y(o),Qp(" will be automaticall released.")])])));default:r.a,r.b;return L("Contract closed.",mr)}}(),w=T.a,I=T.b;return f(UN,F([PT(Fk),$T(Fk),ZN(20),wN(30)]),F([f(FN,F([PT(Fk)]),F([f(Ok,F([gN(24),dN,_A(v),_x]),Qp(w))])),f(UN,F([PT(Fk),WN,wN(13)]),I),f(Ok,F([LN]),function(){switch(f(uV,n,t).$){case"Active":return l(aV,r,n,a);case"NotStarted":return f(Ok,F([gN(20),dN,$N,_A(A$)]),Qp("Phase not yet started."));default:return f(Ok,F([gN(20),dN,$N]),Qp("Phase no longer active."))}}())]))}),lV=JR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),dV=JR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),hV={$:"None"},pV=hV,gV=JR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),vV=function(e){switch(e.$){case"Open":return gV;case"Committed":return lV;case"Judgment":return dV;default:return pV}},yV=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),mV=a(function(e,t,r,n){return d(yV,e,t,r,n)}),bV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},CV=function(e){return function(e){return d(mV,e.red,e.green,e.blue,e.alpha)}(bV(e))},SV=function(e){return{$:"Circle",a:e}},EV=SV,TV=d(yV,0,0,0,1),wV={$:"Flat"},IV={$:"Sharp"},AV=function(e){return{$:"Uniform",a:e}},BV=AV,kV={cap:wV,dashPattern:mr,dashPhase:0,fill:BV(TV),join:IV,thickness:2},NV=n(function(e,t,r){return U(kV,{dashPattern:e,fill:r,thickness:t})}),RV=NV(mr),$V={$:"Transparent"},xV=$V,_V=f(RV,0,xV),LV=r(function(e,t){return{$:"Shape",a:e,b:t}}),PV=function(e){return{basic:e,handlers:mr,name:fi,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},DV=function(e){return f(Ua,PV,LV(e))},UV=function(e){return DV(L(e,_V))},OV=function(e){return L(-e.a,-e.b)},MV=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)})}),FV=r(function(e,t){return f(MV,OV(e(t)),t)}),VV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(Na,r,a),f(Na,n,i))});return l(La,t,L(mr,mr),e)},KV=r(function(e,t){return{$:"Path",a:e,b:t}}),HV=Nr,jV=Rr,qV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=jV(n),i=HV(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(Ua,f(Ua,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},GV=function(e){return Pa(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)})},zV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(GV,e,F([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),YV=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)])},WV=function(e){var t=JV(e.basic),r=VV(f(Pa,qV(e),t)),n=r.a,a=r.b;return{toBottom:-f(yc,0,NI(a)),toLeft:-f(yc,0,NI(n)),toRight:f(yc,0,kI(n)),toTop:f(yc,0,kI(a))}},JV=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(zV,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(zV,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(zV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(GV,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(GV,$(C,wV)?0:r,g);case"Text":case"Image":case"Html":var S=e.a;return f(zV,0,S);case"Group":var E=e.a;return f(GV,0,cy(f(Pa,f(yo,WV,YV),E)));default:var T=e.b;return f(GV,0,YV(WV(T)))}},QV=function(e){var t=WV(e);return t.toTop+t.toBottom},XV=function(e){var t=WV(e);return L(-t.toLeft,t.toTop)},ZV=function(e){var t=WV(e);return t.toLeft+t.toRight},eK=En("http://www.w3.org/2000/svg"),tK=eK("svg"),rK=Rn("height"),nK=Rn("version"),aK=Rn("width"),iK=eK("circle"),oK=eK("ellipse"),uK=eK("foreignObject"),sK=eK("g"),cK=eK("image"),fK=eK("polygon"),lK=eK("polyline"),dK=eK("rect"),hK=Uw,pK=eK("text"),gK=Rn("id"),vK=Rn("points"),yK=Rn("r"),mK=Rn("rx"),bK=Rn("ry"),CK=function(e){return l($n,"http://www.w3.org/1999/xlink","xlink:href",rt(e))},SK=function(e){return{$:"Group",a:e}},EK=Rn("dominant-baseline"),TK=Rn("fill"),wK=Rn("fill-opacity"),IK=Rn("font-family"),AK=Rn("font-size"),BK=Rn("font-style"),kK=Rn("font-variant"),NK=Rn("font-weight"),RK=Rn("opacity"),$K=Rn("stroke"),xK=Rn("stroke-dasharray"),_K=Rn("stroke-dashoffset"),LK=Rn("stroke-linecap"),PK=Rn("stroke-linejoin"),DK=Rn("stroke-opacity"),UK=Rn("stroke-width"),OK=Rn("text-anchor"),MK=Rn("text-decoration"),FK=Rn("transform"),VK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},KK=function(e){return f($i," ",f(Pa,function(e){var t=e.a,r=e.b;return f($i,",",F([Ri(t),Ri(r)]))},e))},HK=n(function(e,t,r){return d(yV,e,t,r,1)}),jK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Bg(1e4*e)/100};return Sl(F(["rgba(",xw(i(t)),"%,",xw(i(r)),"%,",xw(i(n)),"%,",xw(function(e){return Bg(1e3*e)/1e3}(a)),")"]))},qK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},GK=function(e){var t=qK(e),r=t.red,n=t.green,a=t.blue;return jK(l(HK,r,n,a))},zK=function(e){if("Uniform"===e.$){var t=e.a;return GK(t)}return"none"},YK=function(e){var t=qK(e),r=t.alpha;return xw(r)},WK=function(e){if("Uniform"===e.$){var t=e.a;return YK(t)}return"0"},JK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},QK=kr,XK=function(e){var t=xw(e.scale.b),r=xw(e.scale.a),n=xw(-e.rotation/2/QK*360),a=xw(-e.shift.b),i=xw(e.shift.a);return Sl(F(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},ZK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return F([$K(zK(r.fill)),DK(WK(r.fill)),UK(xw(r.thickness)),LK(VK(r.cap)),PK(JK(r.join)),TK("none"),RK(xw(e.opacity)),FK(XK(e)),_K(Ri(r.dashPhase)),xK(KK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return F([TK(zK(a)),wK(WK(a)),$K(zK(r.fill)),DK(WK(r.fill)),UK(xw(r.thickness)),LK(VK(r.cap)),PK(JK(r.join)),RK(xw(e.opacity)),FK(XK(e)),_K(Ri(r.dashPhase)),xK(KK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return F([TK(zK(AV(o.color))),IK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),AK(Ri(o.size)),NK(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"}}()),BK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),kK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),MK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),OK("middle"),EK("middle"),FK(XK(e))]);default:return F([FK(XK(e))])}},eH=Rn("x"),tH=Rn("y"),rH=r(function(e,t){return F([aK(xw(e)),rK(xw(t)),eH(xw(-e/2)),tH(xw(-t/2))])}),nH=function(e){return f($i," ",f(Pa,function(e){var t=e.a,r=e.b;return f($i,",",F([xw(t),xw(-r)]))},e))},aH=sN,iH=r(function(e,t){return f(e,t.a,t.b)}),oH=function(e){return f(Pa,iH(aH),e)},uH=function(e){e:for(;;){var t=f(yc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(lK,O(F([gK(t),vK(nH(i))]),O(ZK(e),oH(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(fK,O(F([gK(t),vK(nH(i))]),O(ZK(e),oH(e.handlers))),mr);case"Circle":var c=s.a;return f(iK,O(F([gK(t),yK(xw(c))]),O(ZK(e),oH(e.handlers))),mr);case"Ellipse":var d=s.a,h=s.b;return f(oK,O(F([gK(t),mK(xw(d)),bK(xw(h))]),O(ZK(e),oH(e.handlers))),mr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(dK,O(F([gK(t),mK(xw(c)),bK(xw(c))]),O(f(rH,p,g),O(ZK(e),oH(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(pK,O(F([gK(t)]),O(ZK(e),oH(e.handlers))),F([hK(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(cK,O(F([gK(t),CK(C)]),O(f(rH,p,g),O(ZK(e),oH(e.handlers)))),mr);case"Html":var S=n.a,p=S.a,g=S.b,E=n.b;return f(uK,O(F([gK(t)]),O(f(rH,p,g),O(ZK(e),oH(e.handlers)))),F([E]));case"Group":var T=n.a;return f(sK,f(Na,gK(t),O(ZK(e),oH(e.handlers))),l($a,r(function(e,t){return f(Na,uH(e),t)}),mr,T));default:var w=n.a,I=n.b,v=U(e,{basic:SK(F([w,I]))});e=v;continue e}}},sH=r(function(e,t){var r=e.a,n=e.b,a=xw(r),i=xw(n);return f(aw,mr,F([f(tK,F([aK(a),rK(i),nK("1.1")]),F([uH(t)]))]))}),cH=function(e){return f(sH,L(ZV(e),QV(e)),f(FV,XV,e))},fH=r(function(e,t){var r=vV(e),n=function(){switch(t.$){case"NotStarted":return l(Lk,10,33,108);case"Active":return l(Lk,0,100,170);default:return l(Lk,1,129,104)}}(),a=O_(cH(f(UV,BV(CV(n)),EV(50))));return f(Ok,F([CN,tx(f(o$,F([CN,WN,$T(Hk(60))]),r))]),a)}),lH=function(e){var t=F([$N,dN,gN(20)]);switch(e.$){case"Active":return f(Ok,O(t,F([_A(yN)])),Qp("Active"));case"NotStarted":return f(Ok,O(t,F([_A(A$)])),Qp("Not Started"));default:return f(Ok,t,Qp("Finished"))}},dH=n(function(e,t,r){var n=f(uV,t,e),a=function(){return"Active"===n.$?l(Lk,0,226,255):DR}(),i=f(Ok,F([_A(a),gN(20),dN,CN]),Qp(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 Vk;switch(n.$){case"NotStarted":return d(qR,F([CN]),F([gN(22),tR]),L(DR,UR),f(xR,e,t));case"Active":var a=f(LR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(YR,F([CN]),F([gN(22),tR]),L(Qk,UR),i)}return f(UN,F([CN,wN(10)]),F([f(Ok,F([CN]),Qp(PR(e))),f(BO,"Poke",JS(zS))]));default:return f(Ok,F([$T(Hk(1))]),Vk)}}();return f(UN,F([ZN(20),wN(10),$T(Fk)]),F([f(Ok,F([Z$,CN]),i),f(Ok,F([$T(Fk),CN]),f(Ok,F([WN]),f(fH,e,n))),f(UN,F([wN(10),Tx,CN]),F([f(Ok,F([CN]),lH(n)),o]))]))}),hH=u(function(e,t,r,n,a,i,o){var u=f(uV,n,r),s=f(Ok,F([ZN(10),PT(Fk),$T(Fk)]),h(fV,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(dH,r,n,o),p=(function(){switch(u.$){case"NotStarted":return c;case"Active":return f(_R,f(Nb,n.state.phaseStartTime,c),o);default:Ff(0)}}(),f(Ok,F([$T(Fk),PT(Hk(1)),qk(function(){return"Active"===u.$?l(kA,0,0,1):UR}())]),Vk)),g=i?f(FN,O(JF(e),O($(u,qF)?zF:QF,F([PT(Fk)]))),F([d,p,s])):f(FN,O(JF(e),O($(u,qF)?zF:QF,F([nN,fN(GF(r))]))),F([d]));return!e&&$(u,qF)?f(UN,F([PT(Fk),wN(20),$$({bottom:20,left:0,right:0,top:0})]),F([g,jF(n.terms.paymentMethods)])):g}),pH=o(function(e,t,r,n,a,i){return"Closed"===r.state.phase.$?f(FN,F([CN,iN(12),ZN(30),wN(10),qk(FF),gN(24),dN,_A(Qk)]),F([Qp("Trade "+HF(r.state.closedReason)),KF])):e?f(UN,F([PT(Fk),wN(10)]),F([f(FN,F([PT(Fk),$T(_T),wN(20)]),F([g(hH,e,t,wo,r,a,$(n,wo),i),g(hH,e,t,cC,r,a,$(n,cC),i),g(hH,e,t,fC,r,a,$(n,fC),i)])),jF(r.terms.paymentMethods)])):f(UN,F([PT(Fk),$T(_T),wN(20)]),F([g(hH,e,t,wo,r,a,$(n,wo),i),g(hH,e,t,cC,r,a,$(n,cC),i),g(hH,e,t,fC,r,a,$(n,fC),i)]))}),gH=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(UN,F([PT(Fk),$T(Fk),wN(40)]),F([p(MF,t,i,n.userInfo,n.web3Context.factoryType,r,n.showStatsModal),f(Ok,F([PT(Fk),f(eN,40,0),wN(40)]),p(pH,a,n.web3Context.factoryType,i,n.expandedPhase,n.userInfo,t))]));case"PartiallyLoadedTrade":e.a;return f(Ok,F([CN,WN,gN(30)]),Qp("Loading trade info..."));default:return f(Ok,F([CN,WN,gN(30)]),Qp("Invalid trade"))}}(),F([eM(n),iM(n)]))}),vH=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),yH=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(iU,mr);case"CreateModel":var n=r.a;return L(f(Wi,Vy,WD(n)),mr);case"QuickCreateModel":var a=r.a;return l(vH,Wi(jy),Pa(Wi(jy)),VO(a));case"TradeModel":var i=r.a;return l(vH,Wi(Gy),Pa(Wi(Gy)),d(gH,e,t.time,t.tradeCache,i));case"MarketplaceModel":var o=r.a;return L(f(Wi,wT,l(hO,t.time,t.tradeCache,o)),mr);default:var u=r.a;return L(f(Wi,CT,l(V$,t.time,t.tradeCache,u)),mr)}}(),n=r.a,a=r.b;return L(f(Ok,F([PT(Fk),$T(Fk),iN(10)]),n),a)}),mH=function(e){return{$:"DismissNotice",a:e}},bH=function(e){return f(fR,jU,qU(e))},CH=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(kA,1,1,1):l(kA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Lk,100,200,255);case"Caution":return l(Lk,255,188,0);case"Error":return l(Lk,255,70,70);default:return l(Lk,200,200,200)}}(),o=f(Ok,F([LN,Z$,fx(5),bH(5)]),z$(mH(t)));return f(Ok,F([qk(i),iN(10),ZN(8),PT(Fk),T$(1),S$(d(u$,0,0,0,.15)),gD]),f(UN,F([wN(4),PT(Fk)]),f(ki,r(function(e,t){return f(BN,F([PT(Fk),_A(a)]),e?t:f(Na,o,t))}),n.mainParagraphs)))},SH=function(e){return $(e,mr)?mr:F([f(UN,F([GU(20),fx(20),wN(10),LN,Tx,PT(Hk(300)),gN(15)]),f(Pa,CH,f(eh,function(e){return $(e.b.align,Wp)},f(ki,r(function(e,t){return L(e,t)}),e)))),f(UN,F([bH(20),T_(100),wN(10),_x,Z$,PT(Hk(300)),gN(15)]),f(Pa,CH,f(eh,function(e){return $(e.b.align,kB)},f(ki,r(function(e,t){return L(e,t)}),e))))])},EH=r(function(e,t){var r=f(yH,e,t),n=r.a,a=r.b;return L(f(UN,F([MR(Gk),tx(VN(t)),PT(Fk),$T(Fk),ZN(30)]),F([f(Ok,F([$T(Hk(50))]),Vk),n])),O(a,SH(t.userNotices)))}),TH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),wH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),IH={$:"AllowHover"},AH={$:"Layout"},BH={backgroundColor:fi,borderColor:fi,shadow:ci({blur:3,color:d(BA,155/255,203/255,1,1),offset:L(0,0),size:3})},kH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?U(t,{hover:ci(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?U(t,{focus:ci(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?U(t,{mode:ci(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?BH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?IH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?AH:t.a}()}}(l(La,t,{focus:fi,hover:fi,mode:fi},e))},NH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(FT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),FT);case"Text":var a=t.a;return qI(a);default:return qI("")}}),RH=n(function(e,t,r){var n=kH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?TH(n):wH(n)}();return f(NH,a,d(wA,FT,Uk,t,OT(F([r]))))}),$H=hw(5),xH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),_H={$:"SansSerif"},LH=function(e){return{$:"Typeface",a:e}},PH=W,DH=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($i,"-",PH(cl(t)));case"ImportFont":var t=e.a;e.b;return f($i,"-",PH(cl(t)));default:var t=e.a.name;return f($i,"-",PH(cl(t)))}}())}),UH=function(){var e=F([LH("Open Sans"),LH("Helvetica"),LH("Verdana"),_H]);return F([f($A,jk,l(RA,"bg-color-"+xA(d(BA,1,1,1,0)),"background-color",d(BA,1,1,1,0))),f($A,NA,l(RA,"font-color-"+xA(d(BA,0,0,0,1)),"color",d(BA,0,0,0,1))),f($A,hN,pN(20)),f($A,$H,f(xH,l($a,DH,"font-",e),e))])}(),OH=n(function(e,t,r){var n=e.options;return l(RH,n,f(Na,IA(f($i," ",F([jT.root,jT.any,jT.single]))),O(UH,t)),r)}),MH=OH({options:mr}),FH=function(e){return f($A,$H,f(xH,l($a,DH,"ff-",e),e))},VH=_H,KH=LH,HH=function(e){return{body:F([function(){var t=f(EH,e.screenWidth,e),r=t.a,n=t.b,a=O(F([PT(Fk),$T(Fk),FH(F([KH("Soleil"),VH]))]),f(Pa,tx,n));return f(MH,a,r)}()]),title:"DAIHard"}},jH=jt,qH=jH({init:$B,onUrlChange:_k,onUrlRequest:xk,subscriptions:$k,update:bB,view:HH});!function(t){e.Elm?We("Elm",e.Elm,t):e.Elm=t}({App:{init:qH(f(Wo,function(e){return f(Wo,function(t){return f(Wo,function(r){return Vi({height:r,networkId:t,width:e})},f(Md,"height",oS))},f(Md,"networkId",oS))},f(Md,"width",oS)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/docs/static/js/main-8b815b70735337f0c99f.js b/docs/static/js/main-8b815b70735337f0c99f.js new file mode 100644 index 0000000..dbd2d9c --- /dev/null +++ b/docs/static/js/main-8b815b70735337f0c99f.js @@ -0,0 +1,7 @@ +!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/DAIHard/",t(t.s=43)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t,n,a,i){function o(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(l.isArrayBuffer(e)||l.isArrayBufferView(e))if(void 0!==i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(i=Date.now(),s(e)):(a.push(e),1===a.length&&u.setAttribute("a",o=!o))}}l.nextTick=l.setImmediate}(),l.isNodejs=void 0!==t&&t.versions&&t.versions.node,l.globalScope=function(){return l.isNodejs?a:"undefined"==typeof self?window:self}(),l.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},l.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},l.isArrayBufferView=function(e){return e&&l.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},l.ByteBuffer=u,l.ByteStringBuffer=u;l.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},l.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},l.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},l.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},l.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},l.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},l.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(l.encodeUtf8(e))},l.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},l.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},l.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},l.ByteStringBuffer.prototype.putInt=function(e,t){o(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},l.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},l.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},l.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},l.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},l.ByteStringBuffer.prototype.copy=function(){var e=l.createBuffer(this.data);return e.read=this.read,e},l.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},l.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},l.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},l.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},l.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},l.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},l.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},l.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},l.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},l.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},l.DataBuffer.prototype.putInt=function(e,t){o(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},l.DataBuffer.prototype.putSignedInt=function(e,t){return o(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},l.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},l.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},l.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},l.DataBuffer.prototype.copy=function(){return new l.DataBuffer(this)},l.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},l.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},l.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},l.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},l.xorBytes=function(e,t,r){for(var n="",a="",i="",o=0,u=0;r>0;--r,++o)a=e.charCodeAt(o)^t.charCodeAt(o),u>=10&&(n+=i,i="",u=0),i+=String.fromCharCode(a),++u;return n+=i},l.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";l.encode64=function(e,t){for(var r,n,a,i="",o="",u=0;u>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,a,i="",o=0;o>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==a&&(i+=String.fromCharCode((3&n)<<6|a)));return i},l.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},l.decodeUtf8=function(e){return decodeURIComponent(escape(e))},l.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:f.encode,decode:f.decode}},l.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},l.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var a,i,o,u,s=0,c=r;s>4,64!==o&&(n[c++]=(15&i)<<4|o>>2,64!==u&&(n[c++]=(3&o)<<6|u));return t?c-r:n.subarray(0,c)},l.binary.base58.encode=function(e,t){return l.binary.baseN.encode(e,p,t)},l.binary.base58.decode=function(e,t){return l.binary.baseN.decode(e,p,t)},l.text={utf8:{},utf16:{}},l.text.utf8.encode=function(e,t,r){e=l.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i0?(a=r[n].substring(0,o),i=r[n].substring(o+1)):(a=r[n],i=null),a in t||(t[a]=[]),a in Object.prototype||null===i||t[a].push(unescape(i))}return t};return void 0===e?(null===S&&(S="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=S):t=r(e),t},l.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var a=t.split("/");return a.length>0&&""===a[0]&&a.shift(),{pathString:t,queryString:r,path:a,query:""===r?{}:l.getQueryVariables(r)}},l.makeRequest=function(e){var t=l.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},l.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},l.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,a=t.length;n0&&i.push(r),o=n.lastIndex;var u=t[0][1];switch(u){case"s":case"o":a");break;case"%":i.push("%");break;default:i.push("<%"+u+"?>")}}return i.push(e.substring(o)),i.join("")},l.formatNumber=function(e,t,r,n){var a=e,i=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,u=void 0===n?".":n,s=a<0?"-":"",c=parseInt(a=Math.abs(+a||0).toFixed(i),10)+"",f=c.length>3?c.length%3:0;return s+(f?c.substr(0,f)+u:"")+c.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+u)+(i?o+Math.abs(a-c).toFixed(i).slice(2):"")},l.formatSize=function(e){return e=e>=1073741824?l.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?l.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?l.formatNumber(e/1024,0)+" KiB":l.formatNumber(e,0)+" bytes"},l.bytesFromIP=function(e){return-1!==e.indexOf(".")?l.bytesFromIPv4(e):-1!==e.indexOf(":")?l.bytesFromIPv6(e):null},l.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=l.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(i)}if(r.length>0){var s=r[n];s.end-s.start>0&&(t.splice(s.start,s.end-s.start+1,""),0===s.start&&t.unshift(""),7===s.end&&t.push(""))}return t.join(":")},l.estimateCores=function(e,t){function r(e,o,u){if(0===o){var s=Math.floor(e.reduce(function(e,t){return e+t},0)/e.length);return l.cores=Math.max(1,s),URL.revokeObjectURL(i),t(null,l.cores)}n(u,function(t,n){e.push(a(u,n)),r(e,o-1,u)})}function n(e,t){for(var r=[],n=[],a=0;au.st&&a.sta.st&&u.st0)return l.cores=navigator.hardwareConcurrency,t(null,l.cores);if("undefined"==typeof Worker)return l.cores=1,t(null,l.cores);if("undefined"==typeof Blob)return l.cores=2,t(null,l.cores);var i=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}function a(e,t,r,i){var s;n(e,t,2);var c=e.getByte();t--;var f=192&c,l=31&c;s=e.length();var d=u(e,t);if(t-=s-e.length(),void 0!==d&&d>t){if(i.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=e.length(),h.remaining=t,h.requested=d,h}d=t}var p,g,v=32==(32&c);if(v)if(p=[],void 0===d)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}s=e.length(),p.push(a(e,t,r+1,i)),t-=s-e.length()}else for(;d>0;)s=e.length(),p.push(a(e,d,r+1,i)),t-=s-e.length(),d-=s-e.length();if(void 0===p&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&(g=e.bytes(d)),void 0===p&&i.decodeBitStrings&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&d>1){var y=e.read,m=t,b=0;if(l===o.Type.BITSTRING&&(n(e,t,1),b=e.getByte(),t--),0===b)try{s=e.length();var C={verbose:i.verbose,strict:!0,decodeBitStrings:!0},E=a(e,t,r+1,C),S=s-e.length();t-=S,l==o.Type.BITSTRING&&S++;var T=E.tagClass;S!==d||T!==o.Class.UNIVERSAL&&T!==o.Class.CONTEXT_SPECIFIC||(p=[E])}catch(e){}void 0===p&&(e.read=y,t=m)}if(void 0===p){if(void 0===d){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=t}if(l===o.Type.BMPSTRING)for(p="";d>0;d-=2)n(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(d)}var w=void 0===g?null:{bitStringContents:g};return o.create(f,l,v,p,w)}var i=r(0);r(1),r(6);var o=e.exports=i.asn1=i.asn1||{};o.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},o.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},o.create=function(e,t,r,n,a){if(i.util.isArray(n)){for(var u=[],s=0;s1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?n.putBytes(e.value.substr(1)):n.putBytes(e.value);if(t.putByte(r),n.length()<=127)t.putByte(127&n.length());else{var s=n.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);t.putByte(128|c.length);for(var u=c.length-1;u>=0;--u)t.putByte(c.charCodeAt(u))}return t.putBuffer(n),t},o.oidToDer=function(e){var t=e.split("."),r=i.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var n,a,o,u,s=2;s>>=7,n||(u|=128),a.push(u),n=!1}while(o>0);for(var c=a.length-1;c>=0;--c)r.putByte(a[c])}return r},o.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)r=e.getByte(),n<<=7,128&r?n+=127&r:(t+="."+(n+r),n=0);return t},o.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),u=0;if(e.length>11){var s=e.charAt(10),c=10;"+"!==s&&"-"!==s&&(u=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,0),c&&("+"===(s=e.charAt(c))||"-"===s)){var f=parseInt(e.substr(c+1,2),10),l=parseInt(e.substr(c+4,2),10),d=60*f+l;d*=6e4,"+"===s?t.setTime(+t-d):t.setTime(+t+d)}return t},o.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),u=parseInt(e.substr(12,2),10),s=0,c=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var l=e.length-5,d=e.charAt(l);if("+"===d||"-"===d){c=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10),c*=6e4,"+"===d&&(c*=-1),f=!0}return"."===e.charAt(14)&&(s=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,s),t.setTime(+t+c)):(t.setFullYear(r,n,a),t.setHours(i,o,u,s)),t},o.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},o.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},o.validate=function(e,t,r,n){var a=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(a=!0,t.value&&i.util.isArray(t.value))for(var u=0,s=0;a&&s0&&(n+="\n");for(var a="",u=0;u1?n+="0x"+i.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?n+=" (1 unused bit shown)":d>1&&(n+=" ("+d+" unused bits shown)")}}else e.type===o.Type.OCTETSTRING?(s.test(e.value)||(n+="("+e.value+") "),n+="0x"+i.util.bytesToHex(e.value)):e.type===o.Type.UTF8?n+=i.util.decodeUtf8(e.value):e.type===o.Type.PRINTABLESTRING||e.type===o.Type.IA5String?n+=e.value:s.test(e.value)?n+="0x"+i.util.bytesToHex(e.value):0===e.value.length?n+="[null]":n+=e.value}return n}},function(e,t,r){var n=r(0);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){function n(e,t){var r=function(){return new s.aes.Algorithm(e,t)};s.cipher.registerAlgorithm(e,r)}function a(){p=!0,l=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;c=new Array(256),f=new Array(256),d=new Array(4),h=new Array(4);for(var t=0;t<4;++t)d[t]=new Array(256),h[t]=new Array(256);for(var r,n,a,i,o,u,s,g=0,v=0,t=0;t<256;++t){i=v^v<<1^v<<2^v<<3^v<<4,i=i>>8^255&i^99,c[g]=i,f[i]=g,o=e[i],r=e[g],n=e[r],a=e[n],u=o<<24^i<<16^i<<8^i^o,s=(r^n^a)<<24^(g^a)<<16^(g^n^a)<<8^g^r^a;for(var y=0;y<4;++y)d[y][g]=u,h[y][i]=s,u=u<<24|u>>>8,s=s<<24|s>>>8;0===g?g=v=1:(g=r^e[e[e[r^a]]],v^=e[e[v]])}}function i(e,t){for(var r,n=e.slice(0),a=1,i=n.length,o=i+6+1,u=g*o,s=i;s>>16&255]<<24^c[r>>>8&255]<<16^c[255&r]<<8^c[r>>>24]^l[a]<<24,a++):i>6&&s%i==4&&(r=c[r>>>24]<<24^c[r>>>16&255]<<16^c[r>>>8&255]<<8^c[255&r]),n[s]=n[s-i]^r;if(t){var f,d=h[0],p=h[1],v=h[2],y=h[3],m=n.slice(0);u=n.length;for(var s=0,b=u-g;s>>24]]^p[c[f>>>16&255]]^v[c[f>>>8&255]]^y[c[255&f]];n=m}return n}function o(e,t,r,n){var a,i,o,u,s,l=e.length/4-1;n?(a=h[0],i=h[1],o=h[2],u=h[3],s=f):(a=d[0],i=d[1],o=d[2],u=d[3],s=c);var p,g,v,y,m,b,C;p=t[0]^e[0],g=t[n?3:1]^e[1],v=t[2]^e[2],y=t[n?1:3]^e[3];for(var E=3,S=1;S>>24]^i[g>>>16&255]^o[v>>>8&255]^u[255&y]^e[++E],b=a[g>>>24]^i[v>>>16&255]^o[y>>>8&255]^u[255&p]^e[++E],C=a[v>>>24]^i[y>>>16&255]^o[p>>>8&255]^u[255&g]^e[++E],y=a[y>>>24]^i[p>>>16&255]^o[g>>>8&255]^u[255&v]^e[++E],p=m,g=b,v=C;r[0]=s[p>>>24]<<24^s[g>>>16&255]<<16^s[v>>>8&255]<<8^s[255&y]^e[++E],r[n?3:1]=s[g>>>24]<<24^s[v>>>16&255]<<16^s[y>>>8&255]<<8^s[255&p]^e[++E],r[2]=s[v>>>24]<<24^s[y>>>16&255]<<16^s[p>>>8&255]<<8^s[255&g]^e[++E],r[n?1:3]=s[y>>>24]<<24^s[p>>>16&255]<<16^s[g>>>8&255]<<8^s[255&v]^e[++E]}function u(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="AES-"+r;t=e.decrypt?s.cipher.createDecipher(n,e.key):s.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof s.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var s=r(0);r(15),r(23),r(1),e.exports=s.aes=s.aes||{},s.aes.startEncrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!1,mode:n});return a.start(t),a},s.aes.createEncryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!1,mode:t})},s.aes.startDecrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!0,mode:n});return a.start(t),a},s.aes.createDecryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!0,mode:t})},s.aes.Algorithm=function(e,t){p||a();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return o(r._w,e,t,!1)},decrypt:function(e,t){return o(r._w,e,t,!0)}}}),r._init=!1},s.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(s.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=s.util.createBuffer();for(var n=0;n>>=2;for(var n=0;n65&&-1!==o){var u=t[o];","===u?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+u+t.substr(o+1),i=a-o-1,o=-1,++a}else" "!==t[a]&&"\t"!==t[a]&&","!==t[a]||(o=a);return t}function a(e){return e.replace(/^\s+/,"")}var i=r(0);r(1);var o=e.exports=i.pem=i.pem||{};o.encode=function(e,t){t=t||{};var r,a="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=n(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=n(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=n(r)),e.headers)for(var o=0;ot.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),a=n.util.createBuffer(),c=o.length();for(var s=0;s=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,s=e.h4,f=0;f<16;++f)n=r.getInt32(),t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<20;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<32;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<40;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<60;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i&o|u&(i^o),n=(a<<5|a>>>27)+c+s+2400959708+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<80;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+3395469782+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,e.h4=e.h4+s|0,l-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=o,o.create=function(){s||n();var e=null,t=i.util.createBuffer(),r=new Array(80),o={algorithm:"sha1",blockLength:64,digestLength:20,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};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},o};var u=null,s=!1},function(e,t,r){"use strict";(function(e){function n(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),i.alloc(+e)}function v(e,t){if(i.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(n)return j(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return _(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return $(this,t,r);case"base64":return B(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,a){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:C(e,t,r,n,a);if("number"==typeof t)return t&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):C(e,[t],r,n,a);throw new TypeError("val must be string, number or Buffer")}function C(e,t,r,n,a){function i(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,u=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,u/=2,s/=2,r/=2}var c;if(a){var f=-1;for(c=r;cu&&(r=u-s),c=r;c>=0;c--){for(var l=!0,d=0;da&&(n=a):n=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(a+u<=r){var s,c,f,l;switch(u){case 1:i<128&&(o=i);break;case 2:s=e[a+1],128==(192&s)&&(l=(31&i)<<6|63&s)>127&&(o=l);break;case 3:s=e[a+1],c=e[a+2],128==(192&s)&&128==(192&c)&&(l=(15&i)<<12|(63&s)<<6|63&c)>2047&&(l<55296||l>57343)&&(o=l);break;case 4:s=e[a+1],c=e[a+2],f=e[a+3],128==(192&s)&&128==(192&c)&&128==(192&f)&&(l=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&f)>65535&&l<1114112&&(o=l)}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),a+=u}return N(n)}function N(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var a="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,a,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function D(e,t,r,n){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-r,2);a>>8*(n?a:1-a)}function U(e,t,r,n){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-r,4);a>>8*(n?a:3-a)&255}function O(e,t,r,n,a,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,a){return a||O(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,a){return a||O(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(e,t,r,n,52,8),r+8}function V(e){if(e=K(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function K(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function j(e,t){t=t||1/0;for(var r,n=e.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(e){for(var t=[],r=0;r>8,a=r%256,i.push(a),i.push(n);return i}function z(e){return J.toByteArray(V(e))}function Y(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function W(e){return e!==e}/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r,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,"'"+S(t,!0)+"'");if("string"==typeof t)return I(e,'"'+S(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(E(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return T(e,"Set")+B(e,".fromList")+" "+E(e,ka(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return T(e,"Dict")+B(e,".fromList")+" "+E(e,Aa(t));if("Array_elm_builtin"===r)return T(e,"Array")+B(e,".fromList")+" "+E(e,Ta(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=E(e,t.a),t=t.b);t.b;t=t.b)n+=","+E(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=E(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)+" = "+E(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return k(e,"")}function S(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=_(e,t,0,n);a&&(r=n.pop());a=_(r.a,r.b,0,n));return a}function _(e,t,r,n){if(r>100)return n.push(x(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=ka(e),t=ka(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Aa(e),t=Aa(t));for(var a in e)if(!_(e[a],t[a],r+1,n))return!1;return!0}function L(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 Ma(n)?n:li(f(gi,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(!Ma(n))return li(f(pi,o,n.a));i=M(x(o,n.a),i)}return di(_a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=gn[e].r,o=Le(0);return gn[e].b=o,gn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=be(i(t.a)),s=0;s0&&vt(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 vt(r,0,n,t):((h?mt(l,d):l===d)||vt(r,2,n,d),void yt(p,g,r,n+1));case 0:return void(e.a!==t.a&&vt(r,3,n,t.a));case 1:return void bt(e,t,r,n,Et);case 2:return void bt(e,t,r,n,St);case 3:if(e.h!==t.h)return void vt(r,0,n,t);var v=Ct(e.d,t.d);v&&vt(r,4,n,v);var y=t.i(e.g,t.g);return void(y&&vt(r,5,n,y))}}}function mt(e,t){for(var r=0;ru?vt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&&vt(r,8,n,{w:a,x:o,y:k})}function Tt(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 yt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}Tt(e,t,r+Pn,n,a,i)}function wt(e,t,r,n,a){var i=e[r];if(!i){var o=vt(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 yt(n,i.z,u,a),void vt(t,9,a,{w:u,A:i})}wt(e,t,r+Pn,n,a)}function It(e,t,r,n){At(e,t,r,0,0,t.b,n)}function At(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)It(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&At(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&&At(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 At(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 Bt(e,t,r,n){return 0===r.length?e:(It(e,t,r,n),kt(e,r))}function kt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(Qh,o,function(e){return ci(Xh(e)?u+", "+e.a:u)},t)}}return t}function Kt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Be(f(ep,e,x(r,op({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Be(f(ep,e,x(r,ip({received:n.loaded,size:n.lengthComputable?ci(n.total):fi}))))})}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=Dg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?wg(o):Tg(a)))}})},init:function(t){return l(e.init,t,qt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function qt(){return Dg(En.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(Ig(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(Bg,Ag,Ie(function(t){try{sa.location=e}catch(e){En.location.reload(!1)}}))}function Xt(e){try{return ci(decodeURIComponent(e))}catch(e){return fi}}function Zt(){return f(Ao,Pa(Os),f(Ao,bs,Us))}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 L(e,t)>=0}),r(function(e,t){var r=L(e,t);return r<0?Ca:r?wa:ba})),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)}),Er=(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 L(e(t),e(r))}))})),Sr=r(function(e,t){return F(V(t).sort(function(t,r){var n=f(e,t,r);return n===ba?0:n===Ca?-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),_r=Math.floor,Lr=Math.round,xr=(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})),Mn=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Fn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Vn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Kn=a(function(e,t,r,n){return e.setUint16(t,r,n),t+2}),Hn=a(function(e,t,r,n){return e.setUint32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),qn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),Gn=n(function(e,t,r){for(var n=0,a=r.byteLength,i=a-4;n<=i;n+=4)e.setUint32(t+n,r.getUint32(n));for(;n>>6&31)<<8|63&a),2):a<55296||56319>>12&15)<<8|a>>>6&63),e.setUint8(t+2,128|63&a),3):(a=1024*(a-55296)+r.charCodeAt(++n)-56320+65536,e.setUint32(t,4034953344|(a>>>18&7)<<24|(a>>>12&63)<<16|(a>>>6&63)<<8|63&a),4)}return t}),Yn=r(function(e,t){try{return ci(f(e,t,0).b)}catch(e){return fi}}),Wn=(r(function(e,t){return x(t+1,e.getInt8(t))}),n(function(e,t,r){return x(r+2,t.getInt16(r,e))}),n(function(e,t,r){return x(r+4,t.getInt32(r,e))}),r(function(e,t){return x(t+1,e.getUint8(t))})),Jn=(n(function(e,t,r){return x(r+2,t.getUint16(r,e))}),n(function(e,t,r){return x(r+4,t.getUint32(r,e))}),n(function(e,t,r){return x(r+4,t.getFloat32(r,e))}),n(function(e,t,r){return x(r+8,t.getFloat64(r,e))}),n(function(e,t,r){return x(r+e,new DataView(t.buffer,t.byteOffset+r,e))})),Qn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?ci(l):fi}a.push(d(Gd,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?ci(o):fi}return r(d(Gd,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(ap)}),i.addEventListener("timeout",function(){a(up)}),i.addEventListener("load",function(){a(Mt(r.expect.b,i))}),Xh(r.tracker)&&Kt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(rp(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 xe(t,n,e.init,e.update,e.subscriptions,function(t,r){var a=e.view,i=n&&n.node?n.node:N(0),o=Lt(i);return Ht(r,function(e){var r=a(e),n=gt(o,r);i=Bt(i,o,n,t),o=r})})}),a(function(e,t,r,n){return xe(t,n,e.init,e.update,e.subscriptions,function(t,r){var n=e.setup&&e.setup(t),a=e.view,i=En.title,o=En.body,u=Lt(o);return Ht(r,function(e){er=n;var r=a(e),s=Tn("body")(mr)(r.body),c=gt(u,s);o=Bt(o,u,c,t),u=s,er=0,i!==r.title&&(En.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(Bg,Ag,Ie(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Bg,Ag,Ie(function(){history.pushState({},"",t),e()}))})),oa=(r(function(e,t){return f(Bg,Ag,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 Ma(r)?ci(r.a):fi}),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=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),da=function(e){return{$:"GTag",a:e}},ha=function(e){return{$:"GotoRoute",a:e}},pa={$:"RequestBrowserNotificationPermission"},ga=function(e){return{$:"UserNotice",a:e}},va={$:"Web3Connect"},ya=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ma=r(function(e,t){return t(e)}),ba={$:"EQ"},Ca={$:"LT"},Ea=cr,Sa=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(Ea,o,r,n)}var a=t.a;return l(Ea,e,r,a)});return l(Ea,o,l(Ea,e,t,i),a)}),Ta=function(e){return l(Sa,Na,mr,e)},wa={$:"GT"},Ia=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(Ia,e,t,o)),c=i;e=u,t=s,r=c}}),Aa=function(e){return l(Ia,n(function(e,t,r){return f(Na,x(e,t),r)}),mr,e)},Ba=function(e){return l(Ia,n(function(e,t,r){return f(Na,e,r)}),mr,e)},ka=function(e){var t=e.a;return Ba(t)},Na=br,Ra=Tr,$a=n(function(e,t,r){for(;;){if(!r.b)return t;var n=r.a,a=r.b,i=e,o=f(e,n,t),u=a;e=i,t=o,r=u}}),_a=function(e){return l($a,Na,mr,e)},La=a(function(e,t,r,n){if(n.b){var a=n.a,i=n.b;if(i.b){var o=i.a,u=i.b;if(u.b){var s=u.a,c=u.b;if(c.b){var h=c.a,p=c.b;return f(e,a,f(e,o,f(e,s,f(e,h,r>500?l($a,e,t,_a(p)):d(La,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(La,e,t,0,r)}),Pa=r(function(e,t){return l(xa,r(function(t,r){return f(Na,e(t),r)}),mr,t)}),Da=r(function(e,t){return e(t)}),Ua=n(function(e,t,r){return e(t(r))}),Oa=function(e){return e},Ma=function(e){return"Ok"===e.$},Fa=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Va=$r,Ka=r(function(e,t){return xr(t)/xr(e)}),Ha=K,ja=Va(f(Ka,2,32)),qa=rr,Ga=d(Fa,0,ja,qa,qa),za=function(e){return{$:"Leaf",a:e}},Ya=function(e){return{$:"SubTree",a:e}},Wa=ar,Ja=r(function(e,t){for(;;){var r=f(Wa,32,e),n=r.a,a=r.b,i=f(Na,Ya(n),t);if(!a.b)return _a(i);var o=a,u=i;e=o,t=u}}),Qa=hr,Xa=function(e){return e.a},Za=r(function(e,t){for(;;){var r=Va(t/32);if(1===r)return f(Wa,32,e).a;var n=f(Ja,e,mr),a=r;e=n,t=a}}),ei=_r,ti=r(function(e,t){return L(e,t)>0?e:t}),ri=Ir,ni=wr,ai=m,ii=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=ei(f(Ka,32,r-1)),a=e?_a(t.nodeList):t.nodeList,i=f(Za,a,t.nodeListSize);return d(Fa,ai(t.tail)+r,f(ti,5,n*ja),i,t.tail)}return d(Fa,ai(t.tail),ja,qa,t.tail)}),oi=nr,ui=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ii,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=za(l(oi,32,t,e)),o=e,u=t-32,s=r,c=f(Na,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),si=r(function(e,t){if(e<=0)return Ga;var r=e%32,n=l(oi,r,e-r,t);return h(ui,t,e-r-32,e,mr,n)}),ci=function(e){return{$:"Just",a:e}},fi={$:"Nothing"},li=function(e){return{$:"Err",a:e}},di=function(e){return{$:"Ok",a:e}},hi=r(function(e,t){return{$:"Failure",a:e,b:t}}),pi=r(function(e,t){return{$:"Field",a:e,b:t}}),gi=r(function(e,t){return{$:"Index",a:e,b:t}}),vi=function(e){return{$:"OneOf",a:e}},yi=yr,mi=j,bi=function(e){var t=mi(e);return 97<=t&&t<=122},Ci=function(e){var t=mi(e);return t<=90&&65<=t},Ei=function(e){return bi(e)||Ci(e)},Si=function(e){var t=mi(e);return t<=57&&48<=t},Ti=function(e){return bi(e)||Ci(e)||Si(e)},wi=function(e){return l($a,r(function(e,t){return t+1}),0,e)},Ii=Cr,Ai=n(function(e,t,r){for(;;){if(!(L(e,t)<1))return r;var n=e,a=t-1,i=f(Na,t,r);e=n,t=a,r=i}}),Bi=r(function(e,t){return l(Ai,e,t,mr)}),ki=r(function(e,t){return l(Ii,e,f(Bi,0,wi(t)-1),t)}),Ni=Kr,Ri=Z,$i=r(function(e,t){return f(Fr,e,V(t))}),_i=z,Li=r(function(e,t){return F(f(Mr,e,t))}),xi=function(e){return f($i,"\n ",f(Li,"\n",e))},Pi=on,Di=r(function(e,t){return"\n\n("+Ri(e+1)+") "+xi(Ui(t))}),Ui=function(e){return f(Oi,e,mr)},Oi=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=_i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ei(n)&&f(Ni,Ti,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(Na,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ri(s)+"]",o=n,u=f(Na,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($i,"",_a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ri(wi(l))+" ways:";return f($i,"\n\n",f(Na,h,f(ki,Di,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($i,"",_a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f($i,"",_a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(xi(f(Pi,4,g))+"\n\n")+p}}),Mi=en,Fi=tn,Vi=ae,Ki=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Hi=An,ji={$:"Empty"},qi=function(e){return{$:"Styled",a:e}},Gi=function(e){return{$:"Text",a:e}},zi=function(e){return{$:"Unstyled",a:e}},Yi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return qi({html:r(function(t,r){return f(Hi,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return zi(f(Ua,Hi(e),a));case"Text":var i=t.a;return Gi(i);default:return ji}}),Wi=Yi,Ji=r(function(e,t){return d(ya,t.noticeType,f(Pa,Pa(Wi(e)),t.mainParagraphs),t.align,t.label)}),Qi=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return ga(f(Ji,e,r));case"Web3Connect":return va;case"GotoRoute":var n=t.a;return ha(n);case"GTag":var a=t.a;return da(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(la,i,o,u);default:return pa}}),Xi=r(function(e,t){return f(Pa,Qi(e),t)}),Zi={$:"EthDai"},eo=function(e){return{$:"Native",a:e}},to=function(e){return{$:"Token",a:e}},ro={$:"XDai"},no=F([to(Zi),eo(ro)]),ao=function(e){var t=e.a;e.b,e.c;return t},io=function(e){var t=(e.a,e.b);e.c;return t},oo=function(e){e.a,e.b;return e.c},uo=r(function(e,t){return t.b?l(xa,Na,t,e):e}),so=r(function(e,t){return U(t,{userNotices:f(uo,t.userNotices,F([e]))})}),co=r(function(e,t){return l($a,so,t,e)}),fo=function(e){return{orderBy:e}},lo=fo,ho={$:"Ascending"},po={$:"Phase"},go=Me,vo=go(mr),yo=r(function(e,t){return x({agentAddress:t,tradeTable:lo(x(po,ho)),wallet:e},vo)}),mo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),bo={$:"None"},Co=bo,Eo=function(e){return d(mo,e,vo,Co,mr)},So=function(e){return{$:"TradeTableMsg",a:e}},To=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),wo=r(function(e,t){return f(To,e,t)}),Io=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Ao=n(function(e,t,r){return t(e(r))}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return ci(e(r))}return fi}),ko=r(function(e,t){if("None"===t.$)return bo;var r=t.a,n=t.b,a=l(Io,f(Bo,Ua(e),r.onSign),f(Bo,Ua(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return x(f(Ao,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(Ao,t.toMsg,e)}},n))},r.onMined));return f(To,a,n)}),No=function(e){return{$:"AbiDecoder",a:e}},Ro=r(function(e,t){return{$:"Tape",a:e,b:t}}),$o=Y,_o=Vr,Lo=r(function(e,t){return e<1?t:l(_o,e,$o(t),t)}),xo=Lo(64),Po=n(function(e,t,r){return x(f(Ro,e,xo(t)),r)}),Do=r(function(e,t){return e<1?"":l(_o,0,e,t)}),Uo=Do(64),Oo=r(function(e,t){if("Ok"===t.$){var r=t.a;return di(e(r))}var n=t.a;return li(n)}),Mo=function(e){return-e},Fo=r(function(e,t){return e<1?"":l(_o,-e,$o(t),t)}),Vo=function(){var e=function(e){if(!f(Ni,Qa(D("0")),f(Do,63,e)))return li("Boolean decode error. "+e+" is not 1 or 0.");switch(f(Fo,1,e)){case"0":return di(!1);case"1":return di(!0);default:return li("Boolean decode error. "+e+" is not 1 or 0.")}};return No(function(t){var r=t.a,n=t.b;return f(Oo,f(Po,r,n),e(Uo(n)))})}(),Ko=jr,Ho=function(e){return f(Ko,"0x",e)||f(Ko,"0X",e)?f(Lo,2,e):e},jo=function(e){return e.b},qo=r(function(e,t){var r=e.a;return f(Oo,jo,r(function(e){return f(Ro,e,e)}(Ho(t))))}),Go=Zr,zo=ie,Yo=Jr,Wo=function(e){return f(Go,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Vi(n)}var a=r.a;return zo(a)},Yo)},Jo=f(Ao,qo,Wo),Qo=function(e){return{$:"Magnitude",a:e}},Xo=function(e){return{$:"Pos",a:e}},Zo=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),eu=function(e){return{$:"MagnitudeNotNormalised",a:e}},tu=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 ci(n)}return fi}},ru=function(e){var t=tu(e);return"Nothing"!==t.$&&t.a<0},nu=function(e){return{$:"Neg",a:e}},au={$:"Zer"},iu=function(e){return!e.b},ou=r(function(e,t){var r=t.a;if(iu(r))return au;switch(e.$){case"Zero":return au;case"Positive":return Xo(t);default:return nu(t)}}),uu=r(function(e,t){return f(Zo,e,eu(t))}),su=function(e){return f(xa,r(function(t,r){return e(t)&&iu(r)?mr:f(Na,t,r)}),mr)}(Qa(0)),cu=Ar,fu=-1+f(cu,10,7),lu=fu+1,du=r(function(e,t){var r=t.a,n=t.b;return x(e(r),n)}),hu=function(e){return e<0?f(du,Ra(-1),hu(e+lu)):x(e/lu|0,e%lu)},pu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=hu(r+e),i=a.a,o=a.b;return f(Na,o,f(pu,i,n))}{if(!(L(e,lu)>0))return F([e]);var u=F([e]);e=0,t=u}}}),gu=function(e){var t=e.a;return Qo(su(f(pu,0,t)))},vu=Pa(Mo),yu={$:"Negative"},mu={$:"Positive"},bu={$:"Zero"},Cu=function(e){switch(e.$){case"Positive":return yu;case"Negative":return mu;default:return bu}},Eu=function(e){for(;;){var t=e.a,r=e.b,n=gu(r),a=n.a;if(!ru(a))return f(ou,t,Qo(a));e=f(uu,Cu(t),vu(a))}},Su=gr,Tu=function(e){switch(f(Su,e,0).$){case"LT":return yu;case"GT":return mu;default:return bu}},wu=function(e){return e<0?-e:e},Iu=function(e){return Eu(f(Zo,Tu(e),eu(F([wu(e)]))))},Au=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(cu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},Bu=function(e){switch(e.$){case"Zer":return au;case"Neg":var t=e.a;return Xo(t);default:return e}},ku=function(e){return{$:"MagnitudePair",a:e}},Nu=r(function(e,t){var r=x(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(Na,x(a,u),f(Nu,i,s))}var c=r.a,a=c.a,i=c.b;return f(Na,x(a,0),f(Nu,i,mr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(Na,x(0,u),f(Nu,mr,s))}return mr}),Ru=r(function(e,t){var r=e.a,n=t.a;return ku(f(Nu,r,n))}),$u=function(e){switch(e.$){case"Zer":return f(uu,bu,mr);case"Neg":var t=e.a.a;return f(uu,mu,vu(t));default:var t=e.a.a;return f(uu,mu,t)}},_u=r(function(e,t){var r=$u(t),n=r.b,a=$u(e),i=a.b,o=f(Ru,i,n),u=o.a,s=f(Pa,function(e){return e.a+e.b},u);return Eu(f(Zo,mu,eu(s)))}),Lu=a(function(e,t,r,n){e:for(;;){var a=x(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 wa}return a.b.b?Ca:f(Su,e,t)}}),xu=function(e){switch(e.$){case"LT":return wa;case"EQ":return ba;default:return Ca}},Pu=r(function(e,t){var r=x(e,t);switch(r.a.$){case"Pos":if("Pos"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return d(Lu,0,0,n,a)}return wa;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return xu(d(Lu,0,0,n,a))}return Ca;default:switch(r.b.$){case"Pos":r.a;return Ca;case"Zer":r.a,r.b;return ba;default:r.a;return wa}}}),Du=r(function(e,t){return $(f(Pu,e,t),wa)}),Uu=H,Ou=r(function(e,t){return!f(Du,e,t)}),Mu=function(e){switch(e.$){case"Zer":return Qo(mr);case"Pos":default:var t=e.a;return t}},Fu=r(function(e,t){var r=e.a;return gu(eu(f(Pa,ri(t),r)))}),Vu=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(Fu,Qo(n),a),u=f(Vu,Qo(i),Qo(n)),s=u.a,c=f(_u,f(ou,mu,o),f(ou,mu,Qo(f(Na,0,s))));return Mu(c)}var a=r.a;return f(Fu,Qo(n),a)}return Qo(mr)}),Ku=function(e){switch(e.$){case"Zer":return bu;case"Pos":return mu;default:return yu}},Hu=r(function(e,t){return $(e,bu)||$(t,bu)?bu:$(e,t)?mu:yu}),ju=r(function(e,t){return f(ou,f(Hu,Ku(e),Ku(t)),f(Vu,Mu(e),Mu(t)))}),qu=function(e){switch(e.$){case"Zer":return au;case"Pos":var t=e.a;return nu(t);default:var t=e.a;return Xo(t)}},Gu=r(function(e,t){return f(_u,e,qu(t))}),zu=Iu(0),Yu=a(function(e,t,r,n){if(e){var a=Iu(e),i=f(ju,f(ju,a,n),t),o=f(Ou,i,r)?x(f(ju,a,t),f(Gu,r,i)):x(zu,r),u=o.a,s=o.b,c=d(Yu,e/2|0,t,s,n),l=c.a,h=c.b;return x(f(_u,u,l),h)}return x(zu,r)}),Wu=Va(f(Ka,2,fu)),Ju=n(function(e,t,r){return d(Yu,f(cu,2,Wu),e,t,r)}),Qu=Iu(1),Xu=r(function(e,t){return e}),Zu=n(function(e,t,r){return l($a,Xu(e),t,f(Bi,1,r))}),es=function(e){return l(Zu,ju(Iu(lu)),Qu,e)},ts=n(function(e,t,r){if(e){var n=l(Ju,es(e),t,r),a=n.a,i=n.b,o=l(ts,e-1,i,r),u=o.a,s=o.b;return x(f(_u,a,u),s)}return l(Ju,es(e),t,r)}),rs=function(e){switch(e.$){case"Zer":return mr;case"Pos":default:var t=e.a.a;return t}},ns=r(function(e,t){if($(t,zu))return fi;var r=wi(rs(e))-wi(rs(t))+1,n=l(ts,f(ti,0,r),Bu(e),Bu(t)),a=n.a,i=n.b;return ci(x(f(ou,f(Hu,Ku(e),Ku(t)),Mu(a)),f(ou,Ku(e),Mu(i))))}),as=f(ju,Iu(2),Iu(2147483648)),is=Pr,os=function(e){return f(is,e,"")},us=Dn,ss=n(function(e,t,r){return e<=0?r:l(ss,e>>1,O(t,t),1&e?O(r,t):r)}),cs=r(function(e,t){return l(ss,e,t,"")}),fs=n(function(e,t,r){return O(f(cs,e-$o(r),os(t)),r)}),ls=re,ds=Br,hs=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}},ps=r(function(e,t){for(;;){if(t<16)return f(Na,hs(t),e);var r=f(Na,hs(f(ds,16,t)),e),n=t/16|0;e=r,t=n}}),gs=function(e){return ls(e<0?f(Na,D("-"),f(ps,mr,-e)):f(ps,mr,e))},vs=function(e){var t=f(ns,e,as);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=gs(Au(a));return $(n,Iu(0))?i:O(vs(n),l(fs,8,D("0"),i))},ys=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return $(t,Qo(mr))?"0":vs(Xo(t));default:var t=e.a;return"-"+ys(f(ju,Iu(-1),e))}},ms=function(e){return l(fs,64,D("0"),e)},bs=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=ms(gs(a)),c=function(e){return O(e,n)}(ms(gs(u)));return P(a+32+($o(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($a,t,P(32*wi(e),"",""),e))},Cs=Ur,Es=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(Cs,r(function(t,r){return l(Es,e,mi(t),r)}),t,n)}),Ts=function(e){return _a(l(Ss,Na,mr,e))},ws=function(e){return f($i,"",f(Pa,f(Ao,gs,f(fs,2,D("0"))),Ts(e)))},Is=function(e){return 64-f(ds,64,e)},As=function(e){return O(e,f(cs,Is($o(e)),"0"))},Bs=function(e){return x(ci($o(e)/2|0),As(e))},ks=function(e){return x(fi,ms(e))},Ns=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("!")}},Rs=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"}},$s=Or,_s=function(e){var t=r(function(e,t){var r=t.a,n=t.b,a=x(e,n);e:for(;;)if(a.b)switch(a.a.valueOf()){case"0":return x(f(is,D("1"),r),!0);case"1":return x(f(is,D("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return x(f(is,D("0"),r),!1);case"1":return x(f(is,D("1"),r),!0);default:break e}return x(r,!0)});return l($s,t,x("",!1),e).a},Ls=function(e){return l($s,Na,mr,e)},xs=n(function(e,t,r){for(;;){if(""===t)return _a(r);var n=e,a=f(Lo,e,t),i=f(Na,l(_o,0,e,t),r);e=n,t=a,r=i}}),Ps=r(function(e,t){return e&&""!==t?l(xs,e,t,mr):F([t])}),Ds=function(e){var t=function(){var t=Ls(ys(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return x(r,f(Ao,_s,f(fs,256,D("1"))))}var r=t;return x(r,f(fs,256,D("0")))}(),r=t.a,n=t.b;return ls(f(Pa,Ns,f(Ps,4,n(f($i,"",f(Pa,Rs,r))))))},Us=function(e){return{$:"Hex",a:e}},Os=function(e){switch(e.$){case"AddressE":var t=e.a.a;return ks(t);case"UintE":var r=e.a;return ks(ys(r));case"IntE":var n=e.a;return ks(Ds(n));case"BoolE":return ks(e.a?"1":"0");case"DBytesE":var a=e.a.a;return Bs(a);case"BytesE":var a=e.a.a;return ks(Ho(a));case"StringE":var i=e.a;return Bs(ws(i));case"ListE":var o=e.a;return function(e){var t=e.a;return Bs(t)}(Zt()(o));default:var i=e.a;return ks(Ho(i))}};try{var Ms=Zt();Zt=function(){return Ms}}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 Fs=Dr,Vs=function(e){return 1===$o(e)?f(Fs,"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(Na,n,r);e=i,t=o,r=u}}}),Hs=r(function(e,t){return _a(l(Ks,e,t,mr))}),js=n(function(e,t,r){if(t<=0)return mr;var n=x(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(Na,i,f(Na,u,f(Na,h,f(Na,m,f(Hs,t-4,b))))):f(Na,i,f(Na,u,f(Na,h,f(Na,m,l(js,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return F([i])}),qs=r(function(e,t){return l(js,0,e,t)}),Gs=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),zs=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 Dt(e.a)}},Ys={$:"LE"},Ws=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(On,t,r,n);case"I16":var a=e.a,n=e.b;return d(Mn,t,r,n,$(a,Ys));case"I32":var a=e.a,n=e.b;return d(Fn,t,r,n,$(a,Ys));case"U8":var n=e.a;return l(Vn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Kn,t,r,n,$(a,Ys));case"U32":var a=e.a,n=e.b;return d(Hn,t,r,n,$(a,Ys));case"F32":var a=e.a,n=e.b;return d(jn,t,r,n,$(a,Ys));case"F64":var a=e.a,n=e.b;return d(qn,t,r,n,$(a,Ys));case"Seq":var i=e.b;return l(Js,i,t,r);case"Utf8":var o=e.b;return l(zn,t,r,o);default:var i=e.a;return l(Gn,t,r,i)}}),Js=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Ws,n,t,r);e=i,t=o,r=u}}),Qs=Ut,Xs=r(function(e,t){return{$:"Seq",a:e,b:t}}),Zs=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+zs(r),i=n;e=a,t=i}}),ec=function(e){return f(Xs,f(Zs,0,e),e)},tc=function(e){return{$:"U8",a:e}},rc=tc,nc=r(function(e,t){return L(e,t)<0?e:t}),ac=pr,ic=function(e){return{$:"Bytes",a:e}},oc=ic,uc=function(e){return Qs(ec(f(Pa,oc,_a(e))))},sc=Dt,cc=r(function(e,t){var r=e.a;return f(Yn,r,t)}),fc=function(e){return{$:"Decoder",a:e}},lc=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 x(u,s.a)}var c=s.a,l=c,d=t,h=r,p=u;e=l,t=d,r=h,n=p}}),dc=r(function(e,t){return fc(f(lc,e,t))}),hc=fc(Wn),pc=r(function(e,t){if("Just"===t.$){return t.a}return e}),gc=function(e){return{$:"Done",a:e}},vc=function(e){return{$:"Loop",a:e}},yc=r(function(e,t){var n=t.a;return fc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return x(i,e(o))}))}),mc=function(e){return fc(r(function(t,r){return x(r,e)}))},bc=r(function(e,t){var r=t.a,n=t.b;return r<=0?mc(gc(_a(n))):f(yc,function(e){return vc(x(r-1,f(Na,e,n)))},e)}),Cc=function(e){return f(pc,mr,f(cc,f(dc,x(sc(e),mr),bc(hc)),e))},Ec=n(function(e,t,r){var n=t.a,a=t.b,i=r.a,o=r.b;return x(f(e,n,i),f(e,a,o))}),Sc=r(function(e,t){return l(Ec,us,e,t)}),Tc=f(Bi,0,4),wc=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}}),Ic=Pt,Ac=r(function(e,t){var r=t.a,n=t.b;return x(e(r),e(n))}),Bc=function(e){return f(Ac,f(Ao,Ic,us(4294967295)),e)},kc=r(function(e,t){return 5*t+e}),Nc=4294967295>>>32-ja,Rc=ir,$c=n(function(e,t,r){for(;;){var n=Nc&t>>>e,a=f(Rc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Rc,Nc&t,i)}var o=a.a,u=e-ja,s=t,c=o;e=u,t=s,r=c}}),_c=function(e){return e>>>5<<5},Lc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||L(e,r)>-1?fi:ci(L(e,_c(r))>-1?f(Rc,Nc&e,i):l($c,n,e,a))}),xc=r(function(e,t){var r=f(Lc,e,t);if("Just"===r.$){return r.a}return x(0,0)}),Pc=n(function(e,t,r){var n=f(kc,e,t);return f(xc,n,r)}),Dc=or,Uc=a(function(e,t,r,n){var a=Nc&t>>>e,i=f(Rc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Uc,e-ja,t,r,o);return l(Dc,a,Ya(u),n)}var s=i.a,c=l(Dc,Nc&t,r,s);return l(Dc,a,za(c),n)}),Oc=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=r.d;return e<0||L(e,n)>-1?r:L(e,_c(n))>-1?d(Fa,n,a,i,l(Dc,Nc&e,t,o)):d(Fa,n,a,d(Uc,a,e,t,i),o)}),Mc=n(function(e,t,r){return l(Oc,e,t,r)}),Fc=a(function(e,t,r,n){var a=f(kc,e,t);return l(Mc,a,r,n)}),Vc=Un,Kc=r(function(e,t){return l(Ec,Vc,e,t)}),Hc=function(e){var t=l(xa,r(function(t,n){var a={d0:l(Pc,0,t,e.state),d1:l(Pc,1,t,e.state),d2:l(Pc,2,t,e.state),d3:l(Pc,3,t,e.state),d4:l(Pc,4,t,e.state)},i=r(function(e,r){return d(Fc,e,t,f(Kc,f(wc,e,a),f(Sc,Bc(f(wc,f(ds,5,e+1),a)),f(wc,f(ds,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Tc);return U(e,{state:t})},jc=x(0,0),qc=function(e){return{current:jc,lfsrstate:1,state:e,x:1,y:0}},Gc=function(e){var t=1&e;return 128&e?x(t,e<<1^113):x(t,e<<1)},zc=x(1,0),Yc=r(function(e,t){var r=t.a,n=t.b;return e?x(n,r):x(r,n)}),Wc=r(function(e,t){if(e){var n=f(Yc,1,t);return l(Ec,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),Jc=r(function(e,t){var r=f(ds,32,e/32|0),n=f(Yc,r,t),a=f(ds,32,e);return f(Wc,a,n)}),Qc=n(function(e,t,r){var n=f(Lc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(Oc,e,t(a),r)}),Xc=n(function(e,t,r){return l(Qc,e,Kc(t),r)}),Zc=a(function(e,t,r,n){var a=f(kc,e,t);return l(Xc,a,r,n)}),ef=function(e){return l($a,r(function(e,t){var r=(1<>r}),cf=n(function(e,t,r){return t?x(0,r<0))return t;var a=f(nc,n,r),i=f(Pa,function(e){return f(sf,e,g)},f(Bi,0,a)),o=uf(e),u=O(t,i),s=n-a;e=o,t=u,n=s}});return f(qs,i.outputLen,l(v,g,mr,i.outputLen))},hf=function(e){return{$:"KS",a:e}},pf=function(e){var t=e.a;return hf({config:t,inputLength:0,partial:mr,state:f(si,25,Xu(jc))})},gf=function(e){return fc(Jn(e))},vf=Qs(ec(mr)),yf=r(function(e,t){var n=t.a;return fc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),mf=r(function(e,t){return f(yf,function(e){return gf(t)},gf(e))}),bf=r(function(e,t){return f(pc,vf,f(cc,f(mf,e,sc(t)-e),t))}),Cf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=sc(e)?f(Na,e,n.partial):n.partial;if(!(L(l($a,r(function(e,t){return t+sc(e)}),0,i),a)>-1))return hf(U(n,{inputLength:sc(e)+n.inputLength,partial:i}));var o=uc(i),u=f(pc,vf,f(cc,gf(a),o)),s=Cc(u),c=f(lf,s,n.state),d=uf(c),h=f(bf,a,o),p=vf,g=hf(U(n,{inputLength:sc(e)+n.inputLength,partial:F([h]),state:d}));e=p,t=g}}),Ef=r(function(e,t){return df(f(Cf,Qs(ec(f(Pa,rc,t))),pf(e)))}),Sf=Ef(Gs),Tf=function(e){return Us(f($i,"",f(Pa,f(Ao,gs,Vs),f(qs,4,Sf(f(Pa,mi,Ls(e)))))))},wf=function(e){return f(Ko,"0x",e)||f(Ko,"0X",e)?e:"0x"+e},If=function(e){var t=e.a;return wf(t)},Af=r(function(e,t){var r=bs(f(Pa,Os,t)),n=function(e){return O(e,r)}(Ho(If(Tf(e))));return Us(n)}),Bf=function(e){return{data:ci(f(Af,"poke()",mr)),decoder:Jo(Vo),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},kf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Nf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Rf={$:"Descending"},$f=function(e){return"Ascending"===e.$?Rf:ho},_f=function(e){return d(Nf,e,vo,Co,mr)},Lf=r(function(e,t){return x(t.a,e(t.b))}),xf=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Nf,t,vo,Co,F([ha(f(kf,r,n))]));case"ChangeSort":var a=e.a,i=$(t.orderBy.a,a)?f(Lf,$f,t.orderBy):x(a,ho);return _f(U(t,{orderBy:i}));default:return _f(t)}}),Pf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},Df=mn,Uf=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=Pf(Bf(r)),a={onBroadcast:fi,onMined:fi,onSign:fi},i=f(wo,a,n);return d(mo,t,vo,i,mr);case"TradeClicked":var o=e.a,u=e.b;return d(mo,t,vo,Co,F([ha(f(kf,o,u))]));case"TradeTableMsg":var s=e.a,c=f(xf,s,t.tradeTable);return d(mo,U(t,{tradeTable:c.model}),f(Df,So,c.cmd),f(ko,So,c.chainCmd),f(Pa,Qi(So),c.appCmds));default:return Eo(t)}}),Of={$:"BottomRight"},Mf={$:"ShouldBeImpossible"},Ff=dr,Vf=function(e){return Gi(e)},Kf=r(function(e,t){f(Ff,e,t);return{align:Of,label:"unexpectedError",mainParagraphs:F([F([Vf(e)])]),noticeType:Mf}}),Hf=function(e){var t=e.a;return wf(t)},jf=me,qf=f(Ao,Hf,jf),Gf=f(Ao,ys,f(Ao,wf,jf)),zf=f(Ao,If,jf),Yf=f(Ao,gs,f(Ao,wf,jf)),Wf=r(function(e,t){return l(xa,r(function(t,r){return e(t)?f(Na,t,r):r}),mr,t)}),Jf=sn,Qf=function(e){return me(l($a,r(function(e,t){var r=e.a,n=e.b;return l(un,r,n,t)}),Ee(),e))},Xf=function(e){return Qf(f(Pa,function(e){var t=e.a,r=e.b;return x(t,f(pc,Jf,r))},f(Wf,function(e){e.a;return!$(e.b,fi)},e)))},Zf=function(e){return Xf(F([x("to",f(Bo,qf,e.to)),x("from",f(Bo,qf,e.from)),x("gas",f(Bo,Yf,e.gas)),x("gasPrice",f(Bo,Gf,e.gasPrice)),x("value",f(Bo,Gf,e.value)),x("data",f(Bo,zf,e.data)),x("nonce",f(Bo,Yf,e.nonce))]))},el=function(e){return{$:"TxSentry",a:e}},tl=me,rl=r(function(e,t){return Qf(F([x("ref",tl(e)),x("txParams",t)]))}),nl=function(e){return{$:"Signing",a:e}},al=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:nl(e)}}),il={$:"Black"},ol=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),ul={$:"RBEmpty_elm_builtin"},sl={$:"Red"},cl=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(ol,sl,t,r,h(ol,il,c,f,l,d),h(ol,il,i,o,u,s))}return h(ol,e,i,o,h(ol,sl,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(ol,sl,c,f,h(ol,il,g,v,y,m),h(ol,il,t,r,d,a))}return h(ol,e,t,r,n,a)}),fl=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(ol,sl,e,t,ul,ul);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(cl,n,a,i,l(fl,e,t,o),u);case"EQ":return h(ol,n,a,t,o,u);default:return h(cl,n,a,i,o,l(fl,e,t,u))}}),ll=n(function(e,t,r){var n=l(fl,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(ol,il,a,i,o,u)}return n}),dl=n(function(e,t,r){var n=e.a,a=Zf(r),i=l(ll,n.ref,f(al,r,t),n.txs);return x(el(U(n,{ref:n.ref+1,txs:i})),f(Df,n.tagger,n.outPort(f(rl,n.ref,a))))}),hl=dl,pl=r(function(e,t){var r=x(e,t);if("None"===r.b.$){r.b;return P(e,vo,mr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return P(ci(t),r,mr)}(l(hl,n,i,o))}return P(fi,vo,F([f(Kf,"submodel sent chainCmd, but there is no txSentry to use!",fi)]))}),gl=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),vl=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),yl={$:"Seller"},ml=function(e){return{$:"Posix",a:e}},bl=ml,Cl={autoabortInterval:bl(0),autorecallInterval:bl(0),autoreleaseInterval:bl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:yl},El=function(e){return{$:"TokenValue",a:e}},Sl=function(e){return e.a},Tl=r(function(e,t){return f(pc,zu,f(Bo,Xa,f(ns,e,t)))}),wl=r(function(e,t){return El(f(Tl,Sl(e),Iu(t)))}),Il=function(e){return f(wl,e,12)},Al=function(e){return f(wl,e,3)},Bl=El(Iu(0)),kl=r(function(e,t){var r=Bl;return{abortPunishment:Il(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Al(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Nl=function(e){if(e.b){var t=e.a;e.b;return ci(t)}return fi},Rl=Gr,$l=function(e){var t=Nl(f(Rl,".",e));if("Nothing"===t.$)return x(e,0);var r=t.a,n=$o(e)-1-r;return x(O(f(Do,r,e),f(Lo,r+1,e)),n)},_l=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}}),Ll=function(e){var t=e.a,r=f(_l,Qa(0),t);return Qo(r.b?t:mr)},xl=ee,Pl=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}}}),Dl=n(function(e,t,r){var n=f(Pl,t,r),a=wi(r)>0;return e>0&&t>0&&a?f(Na,f(qs,e,r),l(Dl,e,t,n)):mr}),Ul=r(function(e,t){return l(Dl,e,e,t)}),Ol=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return fi;var a=n.a;return f(Bo,Na(a),r)});return f(xa,t,ci(mr))}(Oa),Ml=function(e){return f(Bo,f(Ua,Ll,Qo),Ol(f(Pa,f(Ao,_a,f(Ao,ls,xl)),f(Ul,7,_a(e)))))},Fl=X,Vl=function(e){var t=Ls(Fl(e));if(!t.b)return fi;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,ou(yu),Ml(r))}return fi;case"+":if(t.b.b){var r=t.b;return f(Bo,ou(mu),Ml(r))}return fi;default:var r=t;return f(Bo,ou(mu),Ml(r))}},Kl=function(e){var t=function(e){return!f(ds,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(pc,0,Nl(r)))}},Hl=function(e){return f(ju,e,e)},jl=Iu(2),ql=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Qu;case"Neg":return au;default:if($(r,Qu))return f(ju,e,t);if(Kl(r)){var n=e,a=Hl(t),i=f(Tl,r,jl);e=n,t=a,r=i;continue e}var n=f(ju,t,e),a=Hl(t),i=f(Tl,f(Gu,r,Qu),jl);e=n,t=a,r=i;continue e}}),Gl=r(function(e,t){return l(ql,Qu,e,t)}),zl=function(e){if(""===e)return fi;var t=$l(e),r=t.a,n=t.b,a=Vl(r),i=18-n;if(i<0)return fi;if("Nothing"===a.$)return fi;var o=a.a,u=f(ju,o,f(Gl,Iu(10),Iu(i)));return ci(u)},Yl=function(e){return f(Bo,El,zl(e))},Wl=qr,Jl=function(e){for(;;){if(f(Wl,".",e))return l(_o,0,-1,e);{if(!f(Wl,"0",e))return""===e?"0":e;e=l(_o,0,-1,e)}}},Ql=f(Ua,f(fs,7,D("0")),Ri),Xl=function(e){return f($i,"",e)},Zl=function(e){var t=e.a,r=_a(t);if(r.b){var n=r.a,a=r.b;return Xl(f(Na,Ri(n),f(Pa,Ql,a)))}return"0"},ed=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Zl(t);default:var t=e.a;return"-"+Zl(t)}},td=r(function(e,t){return e<1?t:l(_o,0,-e,t)}),rd=function(e){var t=l(fs,18,D("0"),ed(e)),r=f(td,18,t)+"."+f(Fo,18,t);return function(e){return""===e?"0":e}(Jl(r))},nd=r(function(e,t){var r=rd(t),n=Nl(f(Rl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Do,a+1+e,r):f(Do,a,r)}),ad=r(function(e,t){if("Nothing"===e.$)return rd(Sl(t));var r=e.a;return f(nd,r,Sl(t))}),id=te,od=function(e){var t=id(f(ad,fi,e));if("Just"===t.$){return t.a}f(Ff,"Error converting tokenValue to float: string -> float failed",e);return 0},ud=function(e){if(""===e)return li("You must specify a trade amount.");var t=Yl(e);if("Nothing"===t.$)return li("I don't understand this number.");var r=t.a;return od(r)<1?li("Trade amount can't be less than 1."):di(r)},sd=function(e){if(""===e)return li("You must specify a fiat price.");var t=Vl(e);if("Nothing"===t.$){var r=id(e);return li("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 di(n)},cd=r(function(e,t){if("Just"===t.$){var r=t.a;return di(r)}return li(e)}),fd=function(e){return""===e},ld=function(e){return fd(e)?fi:ci(e)},dd=function(e){return f(cd,"You must specify a fiat type.",ld(e))},hd=function(e){return""===e?li("Must specify a payment method."):di(e)},pd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),gd=g(pd,fi,fi,fi,fi,fi,fi,fi),vd=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 di(P(i,o,u))}var s=a.c.a;return li(s)}var c=a.b.a;return li(c)}var f=a.a.a;return li(f)},yd=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return P(e(a),t(i),r(o))}),md={$:"Custom"},bd=r(function(e,t){return{info:t,type_:e}}),Cd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return li(o)}var u=t.a;if("Err"===r.$){var o=r.a;return li(o)}var s=r.a;if("Err"===n.$){var o=n.a;return li(o)}var c=n.a;if("Err"===a.$){var o=a.a;return li(o)}var f=a.a;if("Err"===i.$){var o=i.a;return li(o)}var l=i.a;return di(h(e,u,s,c,f,l))}),Ed=r(function(e,t){if("Ok"===t.$){var r=t.a;return di(r)}var n=t.a;return li(e(n))}),Sd=function(e){return e.a},Td=function(e){return p(Cd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:F([f(bd,md,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Ed,function(e){return U(gd,{daiAmount:ci(e)})},ud(e.daiAmount)),f(Ed,function(e){return U(gd,{fiatAmount:ci(e)})},sd(e.fiatAmount)),f(Ed,function(e){return U(gd,{fiatType:ci(e)})},dd(e.fiatType)),f(Ed,function(e){return U(gd,{paymentMethod:ci(e)})},hd(e.paymentMethod)),vd(d(yd,function(e){return Sd(e)>0?di(e):li(U(gd,{autorecallInterval:ci("Must specify a non-zero time for this window")}))},function(e){return Sd(e)>0?di(e):li(U(gd,{autoabortInterval:ci("Must specify a non-zero time for this window")}))},function(e){return Sd(e)>0?di(e):li(U(gd,{autoreleaseInterval:ci("Must specify a non-zero time for this window")}))},P(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},wd=function(e){if("Active"===e.$){var t=e.a;return ci(t)}return fi},Id=n(function(e,t,r){if("Nothing"===t.$)return fi;var n=t.a;if("Nothing"===r.$)return fi;var a=r.a;return ci(f(e,n,a))}),Ad=function(e){if("Ok"===e.$){var t=e.a;return ci(t)}return fi},Bd=function(e){var t=Td(e.inputs),r=function(){return $(e.errors,gd)?gd:"Ok"===t.$?gd:t.a}();return U(e,{createParameters:l(Id,kl,wd(e.wallet),Ad(t)),errors:r})},kd=r(function(e,t){return Bd(U(t,{inputs:e}))}),Nd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Rd=function(e){return d(Nd,f(kd,Cl,{allowance:fi,createParameters:fi,depositAmount:fi,errors:gd,inputs:Cl,showFiatTypeDropdown:!1,txChainStatus:fi,wallet:e}),vo,Co,mr)},$d=a(function(e,t,r,n){return da(d(gl,e,t,r,n))}),_d=function(e){return{$:"Address",a:e}},Ld=f(Ao,Ho,f(Ao,Fl,_d)),xd=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Ld("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return Ld("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return Ld("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return Ld("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return Ld("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},Pd=function(e){return Ld("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},Dd=function(e){return{$:"AddressE",a:e}},Ud=Dd,Od=function(e){return{$:"UintE",a:e}},Md=Od,Fd=n(function(e,t,r){return{data:ci(f(Af,"approve(address,uint256)",F([Ud(t),Md(r)]))),decoder:Jo(Vo),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),Vd=function(e){return f(wl,e,200)},Kd=r(function(e,t){return El(f(_u,Sl(e),Sl(t)))}),Hd=function(e){var t=f(wl,e.tradeAmount,200);return f(Kd,e.pokeReward,f(Kd,Vd(e.tradeAmount),f(Kd,t,function(){return"Buyer"===e.initiatorRole.$?Al(e.tradeAmount):e.tradeAmount}())))},jd=Fi(ma),qd=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),Gd=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),zd=Zn,Yd=Xn,Wd=function(e){return f(Yd,{caseInsensitive:!1,multiline:!1},e)},Jd=Qn,Qd=zd(f(pc,Jd,Wd("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Xd=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}}),Zd=r(function(e,t){return!f(Xd,f(Ua,Uu,e),t)}),eh=Zd(Oa),th=G,rh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),nh=n(function(e,t,r){if("Err"===t.$){var n=t.a;return li(n)}var a=t.a;if("Err"===r.$){var n=r.a;return li(n)}var i=r.a;return di(f(e,a,i))}),ah=f(xa,nh(Na),di(mr)),ih=function(e){if(e.b){var t=(e.a,e.b);return ci(t)}return fi},oh=n(function(e,t,r){e:for(;;){if(!t.b)return di(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(cu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(cu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(cu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(cu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(cu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(cu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(cu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(cu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(cu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(cu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(cu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(cu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(cu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(cu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(cu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return li(os(s)+" is not a valid hexadecimal character.")}}}),uh=function(e){if(fd(e))return li("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(Ko,"-",e)){var t=f(pc,mr,ih(Ls(e)));return f(Oo,Mo,l(oh,wi(t)-1,t,0))}return l(oh,$o(e)-1,Ls(e),0)}();return f(Ed,function(t){return f($i," ",F(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},sh=function(e){var t=Ls(e);return function(e){return x(t,e)}(f(rh,mr,ah(f(Pa,uh,f(Li,"",f($i,"",f(Pa,f(Ao,gs,Vs),f(qs,20,Sf(f(Pa,f(Ao,th,mi),t))))))))))},ch=function(e){var t=r(function(e,t){return!(t>=8&&bi(e)||t<8&&Ci(e))}),n=sh(Ho(e)),a=n.a,i=n.b,o=l(Ii,t,a,i);return!!Qd(e)&&eh(o)},fh=zd(f(pc,Jd,Wd("^((0[Xx]){1})?[0-9a-f]{40}$"))),lh=zd(f(pc,Jd,Wd("^((0[Xx]){1})?[0-9A-F]{40}$"))),dh=function(e){return'"'+e+'"'},hh=function(e){var t=Ho(e),r=f(Do,24,t),n=f(Fo,40,e);return 64===$o(t)&&f(Ni,Qa(D("0")),r)?lh(n)||fh(n)?di(_d(n)):ch(n)?di(_d(n)):li("Given address "+dh(e)+" failed the EIP-55 checksum test."):40!==$o(t)?li("Given address "+dh(e)+" is not the correct length."):Qd(t)?lh(t)||fh(t)?di(_d(t)):ch(t)?di(_d(t)):li("Given address "+dh(e)+" failed the EIP-55 checksum test."):li("Given address "+dh(e)+" contains invalid hex characters.")},ph=No(function(e){var t=e.a,r=e.b;return f(Oo,f(Po,t,r),hh(Uo(r)))}),gh=r(function(e,t){var r=t.a;return No(function(t){var n=t.a,a=t.b;return r(f(Ro,n,f(Lo,64*e,a)))})}),vh=Qr,yh=r(function(e,t){return f(vh,"data",Jo(f(gh,e,t)))}),mh=Xr,bh=r(function(e,t){return f(vh,"topics",f(mh,e,Jo(t)))}),Ch=function(e){return f(Bo,f(Ao,_a,f($a,r(function(e,t){return f(_u,Iu(e),f(ju,t,as))}),zu)),Ol(f(Pa,f(Ao,_a,f(Ao,ls,f(Ao,uh,Ad))),f(Ul,8,_a(e)))))},Eh=function(e){var t=Ls(Fl(e));e:for(;;){if(!t.b)return fi;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(Bo,ju(Iu(-1)),Ch(a))}var i=t.b;i.b;return fi}var a=t.b;return f(Bo,ju(Iu(-1)),Ch(a))}return fi;case"+":if(t.b.b){var a=t.b;return Ch(a)}return fi;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Ch(a)}t.b;return fi}break e;default:break e}}var a=t;return Ch(a)},Sh=No(function(e){var t=e.a,r=e.b;return f(Oo,f(Po,t,r),f(cd,"Error Decoding Uint into BigInt",Eh(wf(Uo(r)))))}),Th=f(jd,f(bh,1,ph),f(jd,f(yh,1,ph),f(jd,f(yh,0,Sh),Vi(qd)))),wh=an,Ih=r(function(e,t){return me(l($a,Se(e),Ce(),t))}),Ah=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(wh,e,Qf(F([x("data",jf(t.data)),x("topics",f(Ih,zf,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Bh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return li(r)}),kh=r(function(e,t){return f(Oo,function(e){return e.id},f(Bh,function(e){return f(Ed,Ui,f(Ah,Th,e).returnData)},f(cd,"No log found from that factoryAddress in that txReceipt",Nl(f(Wf,function(t){return $(f(Ao,Hf,Fl)(t.address),f(Ao,Hf,Fl)(xd(e)))},t.logs)))))}),Nh=n(function(e,t,r){return{data:ci(f(Af,"allowance(address,address)",F([Ud(t),Ud(r)]))),decoder:Jo(Sh),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),Rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},$h=function(e){switch(e.$){case"BlockNum":var t=e.a;return jf(wf(gs(t)));case"EarliestBlock":return jf("earliest");case"LatestBlock":return jf("latest");default:return jf("pending")}},_h=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return Xf(F([x("to",f(Bo,qf,t)),x("from",f(Bo,qf,r)),x("gas",f(Bo,Yf,n)),x("gasPrice",f(Bo,Gf,a)),x("value",f(Bo,Gf,i)),x("data",f(Bo,zf,o))]))},Lh=function(e){return{$:"BadBody",a:e}},xh=function(e){return{$:"BadStatus",a:e}},Ph=function(e){return{$:"BadUrl",a:e}},Dh={$:"NetworkError"},Uh={$:"Timeout"},Oh=nn,Mh=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return li(Ph(r));case"Timeout_":return li(Uh);case"NetworkError_":return li(Dh);case"BadStatus_":var n=t.a,a=t.b;return li(xh(n.statusCode));default:var n=t.a,a=t.b,i=f(Oh,f(vh,"result",e),a);if("Ok"===i.$){var o=i.a;return di(o)}var u=i.a;return li(Lh(Ui(u)))}}),Fh=n(function(e,t,r){return Qf(F([x("id",tl(e)),x("jsonrpc",jf("2.0")),x("method",jf(t)),x("params",f(Ih,Oa,r))]))}),Vh=ul,Kh=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return fi;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 ci(n);default:var u=e,s=i;e=u,t=s;continue e}}}),Hh=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},jh=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(ol,sl,p,g,h(ol,il,r,n,h(ol,sl,i,o,u,s),v),h(ol,il,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(ol,il,r,n,h(ol,sl,i,o,u,s),h(ol,sl,f,l,d,m))}return e},qh=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(ol,sl,i,o,h(ol,il,s,c,f,l),h(ol,il,r,n,d,h(ol,sl,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(ol,il,r,n,h(ol,sl,i,o,C,d),h(ol,sl,g,v,y,m))}return e},Gh=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(ol,r,u,s,c,h(ol,sl,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 qh(t)}break e}o.a,o.d;return qh(t)}break e}return t}),zh=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(ol,t,r,n,zh(a),u)}var s=jh(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(cl,c,f,l,zh(d),p)}return ul}return h(ol,t,r,n,zh(a),u)}return ul},Yh=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return ul;var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if(L(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(ol,r,n,a,f(Yh,e,i),o)}var s=jh(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(cl,c,l,d,f(Yh,e,p),v)}return ul}return h(ol,r,n,a,f(Yh,e,i),o)}return f(Wh,e,g(Gh,e,t,r,n,a,i,o))}),Wh=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=Hh(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(cl,r,s,c,i,zh(o))}return ul}return h(cl,r,n,a,i,f(Yh,e,o))}return ul}),Jh=r(function(e,t){var r=f(Yh,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(ol,il,n,a,i,o)}return r}),Qh=n(function(e,t,r){var n=t(f(Kh,e,r));if("Just"===n.$){var a=n.a;return l(ll,e,a,r)}return f(Jh,e,r)}),Xh=function(e){return"Just"===e.$},Zh=vn,ep=yn,tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),rp=function(e){return{$:"BadUrl_",a:e}},np=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),ap={$:"NetworkError_"},ip=function(e){return{$:"Receiving",a:e}},op=function(e){return{$:"Sending",a:e}},up={$:"Timeout_"},sp=function(e){return f(ra,"application/json",f(Pi,0,e))},cp=n(function(e,t,r){return sp(l(Fh,e,t,r))}),fp=f(ta,"",Oa),lp=we,dp=Te,hp=function(e){if("Ok"===e.$){var t=e.a;return dp(t)}var r=e.a;return lp(r)},pp=function(e){return l(ea,vr,hp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:fi,url:e.url})},gp=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return pp({body:l(cp,1,r,n),headers:mr,method:"POST",resolver:fp(Mh(a)),timeout:fi,url:t})},vp=n(function(e,t,r){return gp({decoder:t.decoder,method:"eth_call",params:F([_h(t),$h(r)]),url:e})}),yp={$:"LatestBlock"},mp=r(function(e,t){return l(vp,e,t,yp)}),bp=function(e){return{$:"Perform",a:e}},Cp=cn,Ep=dp(vr),Sp=r(function(e,t){return f(Cp,function(t){return dp(e(t))},t)}),Tp=n(function(e,t,r){return f(Cp,function(t){return f(Cp,function(r){return dp(f(e,t,r))},r)},t)}),wp=function(e){return l(xa,Tp(Na),dp(mr),e)},Ip=r(function(e,t){var r=t.a;return ke(f(Cp,Zh(e),r))}),Ap=n(function(e,t,r){return f(Sp,function(e){return vr},wp(f(Pa,Ip(e),t)))}),Bp=n(function(e,t,r){return dp(vr)}),kp=r(function(e,t){var r=t.a;return bp(f(Sp,e,r))});gn.Task=De(Ep,Ap,Bp,kp);var Np=Oe("Task"),Rp=fn,$p=r(function(e,t){return Np(bp(f(Rp,f(Ua,f(Ua,dp,e),li),f(Cp,f(Ua,f(Ua,dp,e),di),t))))}),_p=a(function(e,t,r,n){return f($p,n,f(mp,Rh(to(e)),l(Nh,Pd(e),t,r)))}),Lp=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Ld("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return Ld("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return Ld("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return Ld("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return Ld("0x092110996699c3E06e998d89F0f4586026e44F0F")}},xp=function(e){return{$:"BoolE",a:e}},Pp=xp,Dp=function(e){return{$:"StringE",a:e}},Up=Dp,Op=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:ci(f(Af,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([Ud(t),Ud(r),Pp(n),Md(a),Md(i),Md(o),Md(u),Md(s),Md(c),Md(l),Md(d),Up(h),Up(p)]))),decoder:Jo(ph),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}}}}}}}}}}}}}},Mp=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:ci(f(Af,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([Ud(t),Ud(r),Pp(n),Md(a),Md(i),Md(o),Md(u),Md(s),Md(c),Md(l),Md(d),Up(h),Up(p)]))),decoder:Jo(ph),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}}}}}}}}}}}}}},Fp=r(function(e,t){return{paymentMethods:t,price:e}}),Vp=function(e){return jf(ed(e))},Kp=function(e){return f(Ih,Oa,F([jf(e.fiatType),Vp(e.amount)]))},Hp=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},jp=function(e){return Qf(F([x("type",jf(Hp(e.type_))),x("info",jf(e.info))]))},qp=function(e){var t=Kp(e.price),r=f(Ih,jp,e.paymentMethods);return f(Pi,0,Qf(F([x("paymentmethods",r),x("price",t)])))},Gp=r(function(e,t){return U(t,{value:ci(e)})}),zp=function(e){return Iu(Sd(e))},Yp=function(e){return f(Tl,zp(e),Iu(1e3))},Wp=r(function(e,t){var r=function(){return"Token"===e.$?Op:Mp}();return function(){return"Native"===e.$?Gp(Sl(Hd(t))):Oa}()(r(xd(e))(t.initiatorAddress)(Lp(e))($(t.initiatorRole,yl))(Sl(t.tradeAmount))(Sl(Al(t.tradeAmount)))(Sl(Il(t.tradeAmount)))(Sl(t.pokeReward))(Yp(t.autorecallInterval))(Yp(t.autoabortInterval))(Yp(t.autoreleaseInterval))(Sl(Vd(t.tradeAmount)))(qp(f(Fp,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Jp=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),Qp=function(e){return{$:"CreateNeedsSig",a:e}},Xp=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Zp=r(function(e,t){var r=Pf(f(Wp,e,t)),n={onBroadcast:fi,onMined:ci(x(Jp(e),fi)),onSign:ci(Xp(e))};return x(ci(Qp(e)),f(wo,n,r))}),eg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),rg=function(e){return{$:"ApproveNeedsSig",a:e}},ng=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),ig=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),og={$:"NoOp"},ug=function(e){return{appCmds:mr,chainCmd:Co,cmd:vo,model:e}},sg=function(e){return xl(ed(e))},cg={$:"Error"},fg=r(function(e,t){f(Ff,e+" fetch error",t);return{align:Of,label:"web3FetchError",mainParagraphs:F([F([Vf('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:cg}}),lg=r(function(e,t){return{align:Of,label:"web3MiningError",mainParagraphs:F([F([Vf('Error mining "'+e+'" transaction: '+t)])]),noticeType:cg}}),dg={$:"Caution"},hg=r(function(e,t){return{align:Of,label:"web3SigError",mainParagraphs:F([F([Vf('Error signing "'+e+'" transaction: '+t)])]),noticeType:dg}}),pg={$:"KovanDai"},gg=function(e){e:for(;;)switch(e.$){case"Mainnet":return ci(to(Zi));case"Kovan":return ci(to(pg));case"Private":if(100===e.a)return ci(eo(ro));break e;default:break e}return fi},vg=function(e){switch(e.$){case"NoneDetected":return fi;case"OnlyNetwork":var t=e.a;return ci(t);default:var r=e.a;return ci(r.network)}},yg=r(function(e,t){if("Just"===t.$){return e(t.a)}return fi}),mg=function(e){return f(yg,gg,vg(e))},bg=r(function(e,t){return 1-e(1-t)}),Cg=function(e){return f(cu,e,5)},Eg=bg(Cg),Sg={easing:Eg,offset:12,speed:200},Tg=function(e){return{$:"External",a:e}},wg=function(e){return{$:"Internal",a:e}},Ig=function(e){return{$:"NotFound",a:e}},Ag=function(e){for(;;){e=e.a}},Bg=r(function(e,t){return Np(bp(f(Sp,e,t)))}),kg={$:"Http"},Ng={$:"Https"},Rg=Hr,$g=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),_g=i(function(e,t,r,n,a){if(fd(a)||f(Rg,"@",a))return fi;var i=f(Rl,":",a);if(i.b){if(i.b.b)return fi;var o=i.a,u=xl(f(Lo,o+1,a));if("Nothing"===u.$)return fi;var s=u;return ci(p($g,e,f(Do,o,a),s,t,r,n))}return ci(p($g,e,a,fi,t,r,n))}),Lg=a(function(e,t,r,n){if(fd(n))return fi;var a=f(Rl,"/",n);if(a.b){var i=a.a;return h(_g,e,f(Lo,i,n),t,r,f(Do,i,n))}return h(_g,e,"/",t,r,n)}),xg=n(function(e,t,r){if(fd(r))return fi;var n=f(Rl,"?",r);if(n.b){var a=n.a;return d(Lg,e,ci(f(Lo,a+1,r)),t,f(Do,a,r))}return d(Lg,e,fi,t,r)}),Pg=r(function(e,t){if(fd(t))return fi;var r=f(Rl,"#",t);if(r.b){var n=r.a;return l(xg,e,ci(f(Lo,n+1,t)),f(Do,n,t))}return l(xg,e,fi,t)}),Dg=function(e){return f(Ko,"http://",e)?f(Pg,kg,f(Lo,7,e)):f(Ko,"https://",e)?f(Pg,Ng,f(Lo,8,e)):fi},Ug=Jt,Og=zt(Yt),Mg=ca,Fg=r(function(e,t){return x(e,t)}),Vg=Lr,Kg=a(function(e,t,r,n){var a=L(r,n)>0?ni:Ra,i=wu(r-n),o=f(ti,1,Vg(i)/e|0),u=o,s=f(Pa,function(e){return t(e/u)},f(Bi,0,o));return e<=0||$(r,n)?mr:f(Pa,function(e){return f(a,r,e*i)},s)}),Hg=r(function(e,t){var n=r(function(t,r){return wp(f(Pa,Mg(0),d(Kg,e.speed,e.easing,t,r-e.offset)))});return f(Cp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(Tp,Fg,Og,Ug(t)))}),jg=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,x(wd(t.wallet),mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(_p,a,n.address,xd(to(a)),eg(a));return d(Nd,t,i,Co,mr)}return ug(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Nd,U(t,{inputs:U(u,{userRole:o})}),vo,Co,F([function(){return"Buyer"===o.$?d($d,"create offer type changed","input","sell dai",0):d($d,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return ug(f(kd,U(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return ug(f(kd,U(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return ug(f(kd,U(u,{fiatType:c}),t));case"FiatTypeLostFocus":return ug(U(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return ug(f(kd,U(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return ug(f(kd,U(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return ug(f(kd,U(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return ug(f(kd,U(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Nd,(g?kd(U(u,{fiatType:""})):Oa)(U(t,{showFiatTypeDropdown:g})),vo,Co,g?F([d($d,"currency-selector-clicked","input","",0)]):mr);case"CreateClicked":var v=e.a,n=e.b,y=Td(t.inputs);if("Ok"===y.$){var m=y.a,b=f(kl,n,m);return ug(U(t,{depositAmount:ci(Sl(Hd(b))),txChainStatus:ci(f(ag,v,b))}))}var C=y.a;return d(Nd,U(t,{errors:C}),f($p,Xu(og),function(){return f(Hg,U(Sg,{offset:60}),"inputError")}()),Co,mr);case"AbortCreate":return d(Nd,U(t,{txChainStatus:fi}),vo,Co,F([d($d,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Zp,v,b);var e=v.a,r=function(){var t=Pf(l(Fd,Pd(e),xd(v),E)),r={onBroadcast:fi,onMined:fi,onSign:ci(f(ng,e,b))};return f(wo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return $(f(Pu,a,E),Ca)?x(ci(rg(e)),r):f(Zp,v,b)}return x(ci(rg(e)),r)}(),T=S.a,w=S.b;return d(Nd,U(t,{txChainStatus:T}),vo,w,mr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return ug(U(t,{txChainStatus:ci(l(tg,a,b,A))}))}var B=I.a;return d(Nd,U(t,{txChainStatus:fi}),vo,Co,F([ga(f(hg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,R=U(t,{allowance:ci(N)}),_=x(R.txChainStatus,R.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var L=_.a.a,b=L.b,P=_.b.a;if($(f(Pu,N,P),Ca))return ug(R);var D=f(Zp,to(a),b),T=D.a,w=D.b;return d(Nd,U(R,{txChainStatus:T}),vo,w,mr)}return ug(R)}var O=k.a;return d(Nd,t,vo,Co,F([ga(f(fg,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return ug(U(t,{txChainStatus:ci(f(ig,v,A))}))}var B=I.a;return d(Nd,U(t,{txChainStatus:fi}),vo,Co,F([ga(f(hg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Nd,t,vo,Co,F([ga(f(lg,"create",B))]))}var M=e.a,V=e.b.a,K=f(yg,sg,Ad(f(kh,M,V)));if("Just"===K.$){var H=K.a;return d(Nd,t,vo,Co,F([ha(f(kf,M,H))]))}return d(Nd,t,vo,Co,F([ga(f(Kf,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Nd,t,vo,Co,F([va]));case"NoOp":return ug(t);default:var j=e.a;return d(Nd,t,vo,Co,F([j]))}}),qg={$:"Open"},Gg=r(function(e,t){return f(Su,Sd(e),Sd(t))}),zg=r(function(e,t){return $(t.state.phase,qg)&&$(f(Gg,t.derived.phaseEndTime,e),wa)}),Yg={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:mr},Wg=r(function(e,t){return{maxDai:t,minDai:e}}),Jg=f(Wg,fi,fi),Qg={$:"Expires"},Xg=function(e){return x({errors:Jg,filterFunc:zg,inputs:Yg,showCurrencyDropdown:!1,tradeTable:lo(x(Qg,ho)),wallet:e},vo)},Zg=r(function(e,t){return U(t,{paymentMethod:e})}),ev=r(function(e,t){return U(t,{paymentMethodTerms:e})}),tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(uo,e.inputs.paymentMethodTerms,F([t]));return U(e,{inputs:f(ev,r,f(Zg,"",e.inputs))})},rv=r(function(e,t){var r=f(Wf,ac(e),t.inputs.paymentMethodTerms);return U(t,{inputs:f(ev,r,t.inputs)})}),nv=function(e){return U(e,{filterFunc:zg,inputs:Yg})},av=function(e){return{$:"TradeTableMsg",a:e}},iv=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),ov=function(e){return d(iv,e,vo,Co,mr)},uv=r(function(e,t){return U(t,{fiatType:e})}),sv=r(function(e,t){return U(t,{maxDai:e})}),cv=r(function(e,t){return U(t,{minDai:e})}),fv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return ov(U(t,{inputs:f(cv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return ov(U(t,{inputs:f(sv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return ov(U(t,{inputs:f(uv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return ov(U(t,{inputs:(n?uv(""):Oa)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return ov(U(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return ov(U(t,{inputs:f(Zg,r,t.inputs)}));case"AddSearchTerm":return ov(tv(t));case"RemoveTerm":var a=e.a;return ov(f(rv,a,t));case"ResetSearch":return ov(nv(t));case"TradeTableMsg":var i=e.a,o=f(xf,i,t.tradeTable);return d(iv,U(t,{tradeTable:o.model}),f(Df,av,o.cmd),f(ko,av,o.chainCmd),f(Pa,Qi(av),o.appCmds));case"NoOp":return ov(t);default:var u=e.a;return d(iv,t,vo,Co,F([u]))}}),lv=a(function(e,t,r,n){return e(Qf(F([x("title",jf(t)),x("body",function(){if("Nothing"===r.$)return Jf;var e=r.a;return jf(e)}()),x("image",function(){if("Nothing"===n.$)return Jf;var e=n.a;return jf(e)}())])))}),dv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},hv=function(e){return e.a+"="+e.b},pv=function(e){return e.b?"?"+f($i,"&",f(Pa,hv,e)):""},gv=r(function(e,t){return"/"+(f($i,"/",e)+pv(t))}),vv=function(e){switch(e.$){case"Home":return f(gv,F(["DAIHard"]),mr);case"Create":return f(gv,F(["DAIHard","create"]),mr);case"Trade":var t=e.a,r=e.b;return f(gv,F(["DAIHard","trade",dv(t),Ri(r)]),mr);case"Marketplace":return f(gv,F(["DAIHard","marketplace"]),mr);case"AgentHistory":var n=e.a;return f(gv,F(["DAIHard","history",Hf(n)]),mr);default:return f(gv,mr,mr)}},yv={$:"NotFound"},mv=function(e){return{$:"AgentHistory",a:e}},bv={$:"Create"},Cv={$:"Home"},Ev={$:"Marketplace"},Sv=function(e){return{$:"Parser",a:e}},Tv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),wv=r(function(e,t){return Sv(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(Tv,f(Na,u,r),s,a,i,o(l))])}return mr}return mr})}),Iv=f(wv,"ADDRESS",f(Ao,hh,Ad)),Av={$:"Eth"},Bv={$:"Kovan"},kv=f(wv,"FACTORY",function(e){switch(e){case"eth":return ci(eo(Av));case"keth":return ci(eo(Bv));case"dai":return ci(to(Zi));case"kdai":return ci(to(pg));case"xdai":return ci(eo(ro));default:return fi}}),Nv=f(wv,"NUMBER",xl),Rv=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Tv,r,n,a,i,e(o))}),$v=r(function(e,t){var r=t.a;return Sv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(Pa,Rv(u),r(h(Tv,n,a,i,o,e)))})}),_v=function(e){return l(xa,uo,mr,e)},Lv=r(function(e,t){return _v(f(Pa,e,t))}),xv=function(e){return Sv(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(Tv,f(Na,u,r),s,a,i,o)]):mr}return mr})},Pv=r(function(e,t){var r=e.a,n=t.a;return Sv(function(e){return f(Lv,n,r(e))})}),Dv=Sv(function(e){return F([e])}),Uv=f(Pv,xv("DAIHard"),function(e){return Sv(function(t){return f(Lv,function(e){return(0,e.a)(t)},e)})}(F([f($v,Cv,Dv),f($v,bv,xv("create")),f($v,kf,f(Pv,xv("trade"),f(Pv,kv,Nv))),f($v,Ev,xv("marketplace")),f($v,mv,f(Pv,xv("history"),Iv)),f($v,function(e){return mv(e)},f(Pv,xv("history"),Iv))]))),Ov=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 ci(t.value)}return ci(t.value)}return fi}},Mv=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(Na,t,Mv(r))}return mr}return mr},Fv=function(e){var t=f(Li,"/",e);if(t.b&&""===t.a){var r=t.b;return Mv(r)}var r=t;return Mv(r)},Vv=Xt,Kv=r(function(e,t){if("Nothing"===t.$)return ci(F([e]));var r=t.a;return ci(f(Na,e,r))}),Hv=r(function(e,t){var r=f(Li,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=Vv(n);if("Nothing"===o.$)return t;var u=o.a,s=Vv(i);if("Nothing"===s.$)return t;var c=s.a;return l(Qh,u,Kv(c),t)}return t}),jv=function(e){if("Nothing"===e.$)return Vh;var t=e.a;return l(xa,Hv,Vh,f(Li,"&",t))},qv=r(function(e,t){var r=e.a;return Ov(r(h(Tv,mr,Fv(t.path),jv(t.query),t.fragment,Oa)))}),Gv=function(e){return f(pc,yv,f(qv,Uv,e))},zv=ia,Yv=r(function(e,t){return f(zv,e,vv(t))}),Wv=qe("connectToWeb3",function(e){return Jf}),Jv=function(e){return Qf(F([x("event",jf(e.event)),x("category",jf(e.category)),x("label",jf(e.label)),x("value",tl(e.value))]))},Qv=r(function(e,t){return Qf(F([x("address",jf(Hf(e))),x("signSeedMsg",jf(t))]))}),Xv=qe("gTagOut",Oa),Zv=qe("genPrivkey",Oa),ey=r(function(e,t){for(;;){if(!t.b)return fi;var r=t.a,n=t.b;if(e(r))return ci(r);var a=e,i=n;e=a,t=i}}),ty=n(function(e,t,r){return f(yg,Lc(t),f(Bo,function(e){return e.trades},f(ey,function(t){return $(t.factory,e)},r)))}),ry=qe("notifyPort",Oa),ny=qe("requestNotifyPermissionPort",function(e){return Jf}),ay=r(function(e,t){return U(t,{wallet:e})}),iy=r(function(e,t){return x(f(kd,t.inputs,U(t,{wallet:e})),function(){var t=x(wd(e),mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(_p,n,r.address,xd(to(n)),eg(n))}return vo}())}),oy=r(function(e,t){return U(t,{wallet:e})}),uy=function(e){return{$:"AllowanceFetched",a:e}},sy=r(function(e,t){return x(U(t,{wallet:e}),function(){var r=P(wd(e),mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return $(mg(e),ci(i.factory))?d(_p,a,n.address,i.creationInfo.address,uy):vo}return vo}())}),cy=function(e){return{$:"AgentHistoryModel",a:e}},fy=function(e){return{$:"CreateModel",a:e}},ly=function(e){return{$:"CreateMsg",a:e}},dy=function(e){return{$:"MarketplaceModel",a:e}},hy=function(e){return{$:"TradeModel",a:e}},py=function(e){return{$:"TradeMsg",a:e}},gy=r(function(e,t){switch(t.$){case"BetaLandingPage":return x(t,vo);case"CreateModel":var r=t.a,n=f(iy,e,r),a=n.a,i=n.b;return x(fy(a),f(Df,ly,i));case"TradeModel":var o=t.a,u=f(sy,e,o),s=u.a,c=u.b;return x(hy(s),f(Df,py,c));case"MarketplaceModel":var l=t.a;return x(dy(f(oy,e,l)),vo);default:var d=t.a;return x(cy(f(ay,e,d)),vo)}}),vy=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),yy=function(e){return{$:"PartiallyLoadedTrade",a:e}},my=r(function(e,t){return yy(g(vy,e,t,fi,fi,fi,fi,fi))}),by=function(e){return{$:"CurrentBlockFetched",a:e}},Cy=Wo(f(Ao,Ho,uh)),Ey=function(e){return gp({decoder:Cy,method:"eth_blockNumber",params:mr,url:e})},Sy=function(e){return f($p,by,Ey(e))},Ty=r(function(e,t){return{address_:e,blocknum:t}}),wy=function(e){return No(function(t){return di(x(t,e))})},Iy=n(function(e,t,r){var n=t.a,a=r.a;return No(function(t){return f(Bh,function(t){var r=t.a,n=t.b;return f(Oo,Lf(e(n)),a(r))},n(t))})}),Ay=r(function(e,t){return l(Iy,r(function(e,t){return e(t)}),t,e)}),By=Jo(f(Ay,Sh,f(Ay,ph,wy(Ty)))),ky=r(function(e,t){return{data:ci(f(Af,"createdTrades(uint256)",F([Md(t)]))),decoder:By,from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),Ny=n(function(e,t,r){return f($p,r,f(mp,Rh(e),f(ky,xd(e),t)))}),Ry=function(e){return{$:"CreationInfoFetched",a:e}},$y=r(function(e,t){return l(Ny,e,Iu(t),Ry)}),_y=function(e){return{$:"EventSentryMsg",a:e}},Ly=function(e){return{$:"BlockNumber",a:e}},xy=function(e){return{$:"EventSentry",a:e}},Py=function(e){return{$:"Set_elm_builtin",a:e}},Dy=Py(Vh),Uy=r(function(e,t){return x(xy({blockNumber:fi,errors:mr,nodePath:t,pending:Dy,ref:1,requests:Vh,tagger:e,watching:Dy}),f($p,f(Ao,Ly,e),Ey(t)))}),Oy=function(e){return f(Uy,_y,Rh(e))},My=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),Fy=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},Vy=Fy(f(My,fi,fi)),Ky=n(function(e,t,r){return{allowance:fi,blocknumOnInit:fi,chatHistoryModel:fi,eventSentry:t,eventsWaitingForChatHistory:mr,expandedPhase:qg,secureCommInfo:Vy,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:fi,wallet:r}}),Hy=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),jy=n(function(e,t,r){var n=f($y,t,r),a=Oy(t),i=a.a,o=a.b;return d(Hy,l(Ky,f(my,t,r),i,e),go(F([n,o,Sy(Rh(t))])),Co,F([pa]))}),qy=function(e){return{$:"LoadedTrade",a:e}},Gy=r(function(e,t){var r=Oy(t.factory),n=r.a,a=r.b;return d(Hy,l(Ky,qy(t),n,e),go(F([a,Sy(Rh(t.factory))])),Co,F([pa]))}),zy=function(e){return{data:ci(f(Af,"abort()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Yy=function(e){return{data:ci(f(Af,"burn()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Wy=function(e){return{data:ci(f(Af,"claim()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Jy=r(function(e,t){return{data:ci(f(Af,"initiatorStatement(string)",F([Up(t)]))),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),Qy=function(e){return{data:ci(f(Af,"recall()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Xy=function(e){return{data:ci(f(Af,"release()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Zy=r(function(e,t){return{data:ci(f(Af,"responderStatement(string)",F([Up(t)]))),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),em=r(function(e,t){return{amount:t,fiatType:e}}),tm=f(Go,function(e){var t=Vl(e);if("Just"===t.$){var r=t.a;return Vi(r)}return zo("Can't convert that to a BigInt")},Yo),rm=l(Fi,em,f(mh,0,Yo),f(mh,1,tm)),nm={$:"Bank"},am={$:"Cash"},im=function(e){switch(e){case"cash":return ci(am);case"bank":return ci(nm);case"custom":return ci(md);default:return fi}},om=f(Go,function(e){var t=im(e);if("Just"===t.$){var r=t.a;return Vi(r)}return zo("")},Yo),um=l(Fi,bd,f(vh,"type",om),f(vh,"info",Yo)),sm=ue,cm=function(e){var t=l(Fi,Fp,f(vh,"price",rm),f(vh,"paymentmethods",sm(um)));return f(Oh,t,e)},fm=r(function(e,t){return{commPubkey:t,responder:e}}),lm=r(function(e,t){var n=r(function(t,r){return l(_o,t,t+2*r,e)}),a=f(Ao,uh,Oo(ri(2)));return f(Bh,function(t){return f(Oo,function(e){return f(n,t+64,e)},uh(l(_o,t,t+64,e)))},a(t))}),dm=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($a,dm(e),P(0,0,t),r);if(n.b)return li("invalid UTF-8 sequence");var a=n.c;return di(a)}),pm=q,gm=function(e){return os(pm(e))},vm=function(e){return l(hm,r(function(e,t){return O(t,gm(e))}),"",e)},ym=No(function(e){var t=e.a,r=e.b;return f(Oo,f(Po,t,r),f(Bh,vm,f(Bh,f(Ao,Pa(uh),ah),f(Oo,Wf(f(Ao,fd,Uu)),f(Oo,Ps(2),f(lm,t,Uo(r)))))))}),mm=f(jd,f(yh,1,ym),f(jd,f(yh,0,ph),Vi(fm))),bm=r(function(e,t){return{commPubkey:t,terms:e}}),Cm=f(jd,f(yh,1,ym),f(jd,f(yh,0,ym),Vi(bm))),Em=function(e){return{statement:e}},Sm=f(jd,f(yh,0,ym),Vi(Em)),Tm=function(e){return{statement:e}},wm=f(jd,f(yh,0,ym),Vi(Tm)),Im={$:"AbortedEvent"},Am={$:"BurnedEvent"},Bm={$:"ClaimedEvent"},km=function(e){return{$:"CommittedEvent",a:e}},Nm=function(e){return{$:"InitiatedEvent",a:e}},Rm=function(e){return{$:"InitiatorStatementLogEvent",a:e}},$m={$:"PokeEvent"},_m={$:"RecalledEvent"},Lm={$:"ReleasedEvent"},xm=function(e){return{$:"ResponderStatementLogEvent",a:e}},Pm=zd(f(pc,Jd,Wd("^((0[Xx]){1})?[0-9a-fA-F]+$"))),Dm=function(e){return Pm(e)?di(Us(Ho(e))):li("Something in here is not very hexy: "+dh(e))},Um=Wo(Dm),Om=f(vh,"topics",f(mh,0,Um)),Mm=function(e){return Us(f($i,"",f(Pa,f(Ao,gs,Vs),Sf(f(Pa,mi,Ls(e))))))},Fm=f(Go,function(e){return $(e,Mm("Initiated(string,string)"))?f(Mi,Nm,Cm):$(e,Mm("Committed(address,string)"))?f(Mi,km,mm):$(e,Mm("Recalled()"))?Vi(_m):$(e,Mm("Claimed()"))?Vi(Bm):$(e,Mm("Aborted()"))?Vi(Im):$(e,Mm("Released()"))?Vi(Lm):$(e,Mm("Burned()"))?Vi(Am):$(e,Mm("InitiatorStatementLog(string)"))?f(Mi,Rm,Sm):$(e,Mm("ResponderStatementLog(string)"))?f(Mi,xm,wm):$(e,Mm("Poke()"))?Vi($m):zo("Unrecognized topic hash")},Om),Vm={$:"Initiator"},Km={$:"Responder"},Hm=r(function(e,t){return $(t,e.parameters.initiatorAddress)?ci(Vm):f(yg,function(e){return $(t,e)?ci(Km):fi},e.state.responder)}),jm=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},qm=function(e){switch(e.$){case"Invalid":return fi;case"PartiallyLoadedTrade":var t=e.a;return ci(t.factory);default:var r=e.a;return ci(r.factory)}},Gm=function(e){return $(e.buyerDeposit,Al(e.tradeAmount))&&$(e.abortPunishment,Il(e.tradeAmount))},zm={$:"Invalid"},Ym=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Wm=r(function(e,t){return bl(Sd(t)+Sd(e))}),Jm=function(e){var t=id(ed(e.amount));if("Just"===t.$){return t.a}f(Ff,"Error converting FiatValue to float--string -> float failed!",e);return 0},Qm=r(function(e,t){return(t-e)/e}),Xm=r(function(e,t){var r=Jm(t),n=od(e);return"USD"===t.fiatType?ci(f(Qm,n,r)):fi}),Zm=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 bl(0)}}();return{margin:f(Xm,e.tradeAmount,r.price),phaseEndTime:f(Wm,t.phaseStartTime,n)}}),eb=function(e){var t=P(x(e.creationInfo,e.parameters),x(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 qy(v(Ym,e.factory,e.id,n,a,o,u,s,l(Zm,a,o,u)))}return yy(e)},tb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return eb(U(r,{creationInfo:ci(e)}));case"LoadedTrade":f(Ff,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return zm}}),rb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return eb(U(r,{parameters:ci(e)}));case"LoadedTrade":t.a,f(Ff,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return zm}}),nb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return eb(U(r,{phaseStartInfo:ci(e)}));case"LoadedTrade":t.a,f(Ff,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return zm}}),ab=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return eb(U(r,{state:ci(e)}));case"LoadedTrade":var n=t.a;return qy(U(n,{state:e}));default:return zm}}),ib=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return eb(U(r,{terms:ci(e)}));case"LoadedTrade":t.a,f(Ff,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return zm}}),ob=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}}),ub=Jo(f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Vo,f(Ay,ph,wy(ob))))))))))),sb=function(e){return{data:ci(f(Af,"getParameters()",mr)),decoder:ub,from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},cb={$:"Buyer"},fb=function(e){return f(Bo,function(e){return bl(1e3*e)},xl(ed(e)))},lb=function(e){return El(e)},db=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return li(a)}var i=t.a;if("Err"===r.$){var a=r.a;return li(a)}var o=r.a;if("Err"===n.$){var a=n.a;return li(a)}var u=n.a;return di(l(e,i,o,u))}),hb=function(e){var t=f(cd,"error converting BigInt to Time.Posix",fb(e.autoabortInterval)),r=f(cd,"error converting BigInt to Time.Posix",fb(e.autoreleaseInterval)),a=f(cd,"error converting BigInt to Time.Posix",fb(e.autorecallInterval));return d(db,n(function(t,r,n){return{abortPunishment:lb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:lb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?yl:cb,pokeReward:lb(e.pokeReward),tradeAmount:lb(e.tradeAmount)}}),a,t,r)},pb=n(function(e,t,r){return f($p,r,f(Sp,hb,f(mp,Rh(e),sb(t))))}),gb=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}}}}}}}}}}},vb=Jo(f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,wy(gb)))))))))))),yb=function(e){return{data:ci(f(Af,"getPhaseStartInfo()",mr)),decoder:vb,from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},mb=i(function(e,t,r,n,a){if("Nothing"===t.$)return fi;var i=t.a;if("Nothing"===r.$)return fi;var o=r.a;if("Nothing"===n.$)return fi;var u=n.a;if("Nothing"===a.$)return fi;var s=a.a;return ci(d(e,i,o,u,s))}),bb=function(e){return h(mb,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}}),fb(e.v6),fb(e.v7),fb(e.v8),fb(e.v9))},Cb=n(function(e,t,r){return f($p,r,f(Sp,bb,f(mp,Rh(e),yb(t))))}),Eb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Sb=Jo(f(Ay,Sh,f(Ay,ph,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,wy(Eb))))))),Tb=function(e){return{data:ci(f(Af,"getState()",mr)),decoder:Sb,from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},wb={$:"Aborted"},Ib={$:"Burned"},Ab={$:"NotClosed"},Bb={$:"Recalled"},kb={$:"Released"},Nb=function(e){switch(f(pc,99,xl(ed(e)))){case 0:return ci(Ab);case 1:return ci(Bb);case 2:return ci(wb);case 3:return ci(kb);case 4:return ci(Ib);default:return fi}},Rb={$:"Closed"},$b={$:"Committed"},_b={$:"Judgment"},Lb=function(e){switch(f(pc,99,xl(ed(e)))){case 1:return ci(qg);case 2:return ci($b);case 3:return ci(_b);case 4:return ci(Rb);default:return fi}},xb=function(e){return $(e,Ld("0x0000000000000000000000000000000000000000"))?fi:ci(e)},Pb=a(function(e,t,r,n){if("Nothing"===t.$)return fi;var a=t.a;if("Nothing"===r.$)return fi;var i=r.a;if("Nothing"===n.$)return fi;var o=n.a;return ci(l(e,a,i,o))}),Db=function(e){var t=fb(e.phaseStartTimestamp),r=Lb(e.phase),a=Nb(e.closedReason);return d(Pb,n(function(t,r,n){return{balance:lb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:xb(e.responder)}}),r,t,a)},Ub=n(function(e,t,r){return f($p,r,f(Sp,Db,f(mp,Rh(e),Tb(t))))}),Ob=i(function(e,t,r,n,a){return go(F([l(pb,e,t,r),l(Ub,e,t,n),l(Cb,e,t,a)]))}),Mb=function(e){var t=sg(e);if("Just"===t.$){return t.a}f(Ff,"Warning! BigInt to Int conversion failed!",ed(e));return 0},Fb=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),Vb=n(function(e,t,r){for(;;){var n=f(Wa,32,e),a=n.a,i=n.b;if(L(ai(a),32)<0)return f(ii,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(Na,za(a),t),s=r+1;e=o,t=u,r=s}}),Kb=function(e){return e.b?l(Vb,e,mr,0):Ga},Hb=rn,jb=function(e){var t=h(Hb,Fb,f(vh,"encapsulation",Yo),f(vh,"iv",Yo),f(vh,"tag",Yo),f(vh,"encrypted",Yo)),r=sm(t),n=f(wh,r,e);if("Err"===n.$){var a=n.a;return li(Ui(a))}var i=n.a;return function(e){var t=x(f(Lc,0,e),f(Lc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return di(x(r,n))}return li("Decoded list has less than 2 items.")}(Kb(i))},qb=function(e){var t=function(e){var t=$o(e);return t>1114111?li("string is too long"):di(f(is,pm(t),e))};return f(Oo,$i(""),ah(f(Pa,t,e)))},Gb=function(e){var t=e.a,r=e.b;return qb(F([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},zb=r(function(e,t){return Qf(F([x("message",jf(e)),x("pubkeyHexStrings",f(Ih,jf,F([t.initiatorPubkey,t.responderPubkey])))]))}),Yb=function(e){return{$:"LoadedCommInfo",a:e}},Wb=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),Jb=function(e){var t=x(e.initiatorPubkey,e.responderPubkey);if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return Yb(f(Wb,r,n))}return Fy(e)},Qb=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return Jb(U(r,{initiatorPubkey:ci(e)}))}var n=t.a;return Yb(U(n,{initiatorPubkey:e}))}),Xb=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return Jb(U(r,{responderPubkey:ci(e)}))}var n=t.a;return Yb(U(n,{responderPubkey:e}))}),Zb=r(function(e,t){var r=x(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return cb}r.a,r.b;return yl}if("Buyer"===r.b.$){r.a,r.b;return yl}r.a,r.b;return cb}),eC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=mi(r),i=f(Pl,a,n),o=ls(f(qs,a,n)),u=O(t,F([o])),s=i,c=u;e=s,t=c}}),tC=function(e){var t=Kb(f(eC,Ls(e),mr));return l(Id,Fg,h(mb,Fb,f(Lc,0,t),f(Lc,1,t),f(Lc,2,t),f(Lc,3,t)),h(mb,Fb,f(Lc,4,t),f(Lc,5,t),f(Lc,6,t),f(Lc,7,t)))},rC=r(function(e,t){if("Statement"===t.$){t.a;return l(la,"New Message from Trade",fi,fi)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(la,n,fi,fi)}),nC={$:"Aborted"},aC={$:"Burned"},iC={$:"Claimed"},oC=function(e){return{$:"Committed",a:e}},uC=function(e){return{$:"Encrypted",a:e}},sC={$:"FailedDecode"},cC={$:"Initiated"},fC={$:"Recalled"},lC={$:"Released"},dC=function(e){return{$:"StateChange",a:e}},hC=function(e){return{$:"Statement",a:e}},pC=lr,gC=fr,vC=r(function(e,t){var r=ai(e),n=32-ai(t.tail)-r,a=l(pC,32,t.tail,e);return n<0?{nodeList:f(Na,za(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(gC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(Na,za(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:qa}}),yC=ur,mC=y,bC=a(function(e,t,r,n){var a=Nc&t>>>e;if(L(a,ai(n))>-1){if(5===e)return f(yC,za(r),n);var i=Ya(d(bC,e-ja,t,r,qa));return f(yC,i,n)}var o=f(Rc,a,n);if("SubTree"===o.$){var u=o.a,i=Ya(d(bC,e-ja,t,r,u));return l(Dc,a,i,n)}var i=Ya(d(bC,e-ja,t,r,mC(o)));return l(Dc,a,i,n)}),CC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ai(i),u=ai(e),s=r+(u-o);if($(u,32)){if(L(s>>>ja,1<0){var c=n+ja,f=d(bC,c,r,e,mC(Ya(a)));return d(Fa,s,c,f,qa)}return d(Fa,s,n,d(bC,n,r,e,a),qa)}return d(Fa,s,n,a,e)}),EC=r(function(e,t){var r=(t.a,t.c,t.d),n=ai(e),a=32-ai(r)-n,i=l(pC,32,r,e),o=f(CC,i,t);if(a<0){var u=l(gC,a,n,e);return f(CC,u,o)}return o}),SC=sr,TC=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(SC,i,t,r)}return f(Na,e,t)});return{nodeList:l(SC,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(L(n,128)<1){var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(SC,o,t,r)}var n=e.a;return f(EC,n,t)});return f(EC,i,l(SC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(SC,o,t,r)}var n=e.a;return f(vC,n,t)});return f(ii,!0,f(vC,i,l(SC,o,TC(e),a)))}),IC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(Na,r,t)}),AC=f(xa,IC,mr),BC=n(function(e,t,r){var n=Zb(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return ci(dC(cC));case"CommittedEvent":var r=t.a;return ci(dC(oC(r.responder)));case"RecalledEvent":return ci(dC(fC));case"ClaimedEvent":return ci(dC(iC));case"AbortedEvent":return ci(dC(nC));case"ReleasedEvent":return ci(dC(lC));case"BurnedEvent":return ci(dC(aC));case"InitiatorStatementLogEvent":var r=t.a;return ci(hC({blocknum:e,message:function(){var e=tC(r.statement);if("Just"===e.$){var t=e.a;return uC(t)}return sC}(),who:n(Vm)}));case"ResponderStatementLogEvent":var r=t.a;return ci(hC({blocknum:e,message:function(){var e=tC(r.statement);if("Just"===e.$){var t=e.a;return uC(t)}return sC}(),who:n(Km)}));default:return fi}}(),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:fi}},a),o=f(wC,r.history,Kb(AC(F([i])))),u=L(e,r.lastNotificationBlocknum)>0?x(f(Bo,rC($(r.userRole,r.trade.parameters.initiatorRole)),a),e):x(fi,r.lastNotificationBlocknum),s=u.a;return P(U(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),AC(F([s])))}),kC=zr,NC=function(e){var t=l(Fi,Fg,f(vh,"id",kC),f(vh,"message",Yo));return f(Ed,Ui,f(wh,t,e))},RC=function(e){return{$:"Decrypted",a:e}},$C=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),_C=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(BC,n,a,t),o=i.a,u=i.b,s=i.c;return d($C,o,u,fi,s);case"MessageInputChanged":var c=e.a;return d($C,U(t,{messageInput:c}),!1,fi,mr);case"MessageSubmit":return d($C,U(t,{messageInput:""}),!1,ci(t.messageInput),mr);default:var h=e.a,p=NC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Lc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=U(E,{message:RC(y)}),T=U(b,{eventInfo:hC(S)}),w=l(Oc,v,T,t.history);return d($C,U(t,{history:w}),!1,fi,mr)}return d($C,t,!1,fi,F([ga(f(Kf,"got a decryption result, but for an event that is not a message!",b))]))}return d($C,t,!1,fi,F([ga(f(Kf,"got a decryption result, but for an id out of bounds!",x(v,t.history)))]))}var I=p.a;return d($C,t,!1,fi,F([ga(f(Kf,"Error decoding decryption result",I))]))}}),LC=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),xC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),PC=function(e){return{onBroadcast:fi,onMined:ci(x(LC(e),fi)),onSign:ci(xC(e))}},DC=qe("encryptToPubkeys",Oa),UC=n(function(e,t,r){return{data:ci(f(Af,"commit(address,string)",F([Ud(t),Up(r)]))),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),OC=n(function(e,t,r){return{data:ci(f(Af,"commit(address,string)",F([Ud(t),Up(r)]))),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),MC=function(e){return{$:"CommitMined",a:e}},FC={$:"CommitNeedsSig"},VC=function(e){return{$:"CommitSigned",a:e}},KC=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?OC:UC}(),a=Pf(function(){return"Token"===e.factory.$?Oa:Gp(Sl(jm(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return x(ci(FC),f(wo,{onBroadcast:fi,onMined:ci(x(MC,fi)),onSign:ci(VC)},a))}),HC=r(function(e,t){return Qf(F([x("id",tl(e)),x("encapsulation",jf(t.encapsulatedKey)),x("iv",jf(t.iv)),x("tag",jf(t.tag)),x("encrypted",jf(t.message))]))}),jC=qe("decryptMessage",Oa),qC=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return x(r-1,f(Na,x(r,e),n))});return l(Sa,n,x(t-1,mr),e).b},GC=r(function(e,t){return go(f(Pa,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 jC(f(HC,r,s))}return vo}return vo},qC(e.history)))}),zC=function(e){if("Just"===e.$){return e.a}return fi},YC=function(e){var t=zC(l(Id,Hm,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return ci(r)}return fi}(),f(Bo,function(e){return e.address},wd(e.wallet)))),r=x(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(GC,n,a)}return vo},WC=r(function(e,t){return f(Bo,function(t){var r=x(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return yl}r.a,r.b;return cb}if("Seller"===r.b.$){r.a,r.b;return cb}r.a,r.b;return yl},f(Hm,e,t))}),JC=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return P(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(BC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=P(d,n||h,f(uo,a,p));e=g,t=v}}),e,P(t,!1,mr))}),QC=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),XC=i(function(e,t,r,n,a){return f(JC,n,p(QC,e,r,t,Ga,a,""))}),ZC=function(e){return{$:"ChatHistoryMsg",a:e}},eE=a(function(e,t,r,n){var a=P(t,wd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(WC,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return P(ci(t),r,f(Pa,Qi(ZC),n))}(h(XC,e,c,i,n,u))}return P(fi,!1,mr)}return P(fi,!1,mr)}),tE={$:"Abort"},rE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),nE=function(e){return{$:"ActionNeedsSig",a:e}},aE=function(e){return{$:"ApproveMining",a:e}},iE={$:"ApproveNeedsSig"},oE=function(e){return{$:"ApproveSigned",a:e}},uE={$:"Burn"},sE={$:"Claim"},cE=function(e){return{$:"CommitMining",a:e}},fE=function(e){return{$:"ConfirmingAction",a:e}},lE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),dE=function(e){return{$:"EventLogFetched",a:e}},hE=function(e){return{$:"ParametersFetched",a:e}},pE=function(e){return{$:"PhaseInfoFetched",a:e}},gE={$:"Poke"},vE={$:"Recall"},yE={$:"Release"},mE=function(e){return{$:"StartContractAction",a:e}},bE=function(e){return{$:"StateFetched",a:e}},CE=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"}},EE=function(e){return d(Hy,e,vo,Co,mr)},SE={align:Of,label:"cantFindTradeWillRetry",mainParagraphs:F([F([Vf("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:cg},TE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(fg,e,r)}if("Nothing"===t.a.$){t.a;return f(Kf,"Couldn't decode the fetched \""+e+'" result.',fi)}return f(Kf,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),wE={align:Of,label:"tradeParametersNotDefault",mainParagraphs:F([F([Vf("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:cg},IE=to(Zi),AE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),BE=n(function(e,t,r){return l(Qh,e,Bo(function(e){return U(e,{logCount:wi(t)+e.logCount})}),r)}),kE=r(function(e,t){var r=t.a;return Py(f(Jh,e,r))}),NE=n(function(e,t,r){var n=e.a,a=f(Kh,t,n.requests);if("Nothing"===a.$)return x(xy(n),vo);var i=a.a,o=x(i.watchOnce,Nl(r));if("Nothing"===o.b.$){o.b;return x(xy(U(n,{requests:l(BE,t,r,n.requests)})),vo)}if(o.a){var u=o.b.a;return x(xy(U(n,{requests:l(BE,t,r,n.requests),watching:f(kE,t,n.watching)})),f(Bg,i.tagger,dp(u)))}return x(xy(U(n,{requests:l(BE,t,r,n.requests)})),go(f(Pa,function(e){return f(Bg,i.tagger,dp(e))},r)))}),RE=Le,$E=r(function(e,t){return f($p,f(Ao,Ly,t),f(Cp,function(t){return Ey(e)},RE(2e3)))}),_E=se,LE=fe,xE=Wr,PE=n(function(e,t,r){var n=function(e){return LE(F([e,_E(r)]))};return f(Go,function(a){var i=f(wh,e,a);if("Ok"===i.$){var o=i.a,u=f(wh,n(t),o);if("Ok"===u.$){var s=u.a;return Vi(s)}var c=u.a;return zo(Ui(c))}return Vi(r)},xE)}),DE=a(function(e,t,r,n){return f(jd,l(PE,f(vh,e,xE),t,r),n)}),UE=n(function(e,t,r){return f(jd,f(vh,e,t),r)}),OE=Wo(hh),ME=zd(f(pc,Jd,Wd("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),FE=function(e){return{$:"BlockHash",a:e}},VE=function(e){return ME(e)?di(FE(Ho(e))):li("Given blockHash "+dh(e)+" is not valid.")},KE=Wo(VE),HE=function(e){return{$:"TxHash",a:e}},jE=function(e){return ME(e)?di(HE(Ho(e))):li("Given txHash "+dh(e)+" is not valid.")},qE=Wo(jE),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}}),zE=Yr,YE=l(UE,"blockNumber",Cy,l(UE,"blockHash",KE,l(UE,"transactionHash",qE,l(UE,"transactionIndex",Cy,l(UE,"logIndex",Cy,d(DE,"removed",zE,!1,l(UE,"topics",sm(Um),l(UE,"data",Yo,l(UE,"address",OE,Vi(GE)))))))))),WE=function(e){return f(Ih,function(e){if("Just"===e.$){var t=e.a;return jf(If(t))}return Jf},e)},JE=function(e){return Qf(F([x("fromBlock",$h(e.fromBlock)),x("toBlock",$h(e.toBlock)),x("address",qf(e.address)),x("topics",WE(e.topics))]))},QE=r(function(e,t){return gp({decoder:sm(YE),method:"eth_getLogs",params:F([JE(t)]),url:e})}),XE=function(e){return{$:"BlockNum",a:e}},ZE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Cp,function(r){return f(Sp,yi(r),f(QE,e,U(t,{fromBlock:XE(n),toBlock:XE(a)})))},f(QE,e,t)):f(QE,e,t)}),eS=n(function(e,t,r){var n=r.a,a=r.b;return f(QE,e,U(t,{fromBlock:XE(n),toBlock:XE(a)}))}),tS=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(tS,e,t,i)),c=o;e=u,t=s,r=c}}),rS=r(function(e,t){return l(tS,ll,t,e)}),nS=r(function(e,t){var r=e.a,n=t.a;return Py(f(rS,r,n))}),aS=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 go(f(Pa,function(t){return f($p,f(Ao,AE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},AC(f(Pa,function(e){return f(Kh,e,r.requests)},ka(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?x(xy(U(r,{blockNumber:ci(a)})),go(F([f($E,r.nodePath,r.tagger),l(i,x(u+1,a),r.watching,eS)]))):x(t,f($E,r.nodePath,r.tagger))}return x(xy(U(r,{blockNumber:ci(a),pending:Dy,watching:f(nS,r.watching,r.pending)})),go(F([f($E,r.nodePath,r.tagger),l(i,x(a,a),r.pending,ZE),l(i,x(a,a),r.watching,eS)])))}var s=e.a.a;return x(xy(U(r,{errors:f(Na,s,r.errors)})),f($E,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(NE,t,c,d)}var s=e.b.a;return x(xy(U(r,{errors:f(Na,s,r.errors)})),vo)}),iS=r(function(e,t){var r=t.a;return Py(l(ll,e,vr,r))}),oS=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(ll,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return P(xy(U(o,{watching:f(iS,a.ref,o.watching)})),f($p,f(Ao,AE(a.ref),a.tagger),e),a.ref)}(l(ZE,a.nodePath,n,x(s,s)))}return P(xy(U(o,{pending:f(iS,a.ref,o.pending)})),vo,a.ref)}),uS=oS(!1),sS=function(e){return F([e])},cS=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($y,r.factory,r.id):vo}}(),function(){var e=P(wd(t.wallet),mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return $(mg(t.wallet),ci(a.factory))?d(_p,n,r.address,a.creationInfo.address,uy):vo}return vo}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(eE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):P(t.chatHistoryModel,!1,mr)}(),a=n.a,i=n.b,o=n.c,u=U(t,{chatHistoryModel:a}),s=i?YC(t):vo,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(Hy,u,go(F([l(Ub,p.factory,p.creationInfo.address,bE),s,r])),Co,o)}return EE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return EE(U(t,{blocknumOnInit:ci(v)}))}var y=g.a;return d(Hy,t,vo,Co,F([ga(f(fg,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=U(t,{allowance:ci(m)}),b=P(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if($(f(Pu,m,Sl(jm(C.parameters))),Ca))return EE(u);var S=l(KC,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(Hy,U(u,{txChainStatus:T}),vo,w,mr)}return EE(u)}var y=g.a;return d(Hy,t,vo,Co,F([ga(f(fg,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:Mb(I.blocknum)},B=l(uS,dE,t.eventSentry,{address:A.address,fromBlock:XE(A.blocknum),toBlock:yp,topics:mr}),k=B.a,N=B.b,u=U(t,{eventSentry:k,trade:f(tb,A,t.trade)}),R=f(pc,IE,qm(u.trade)),_=go(F([N,h(Ob,R,A.address,hE,bE,pE)]));return d(Hy,u,_,Co,mr)}if("BadBody"===g.a.$){g.a.a;return d(Hy,t,vo,Co,F([ga(SE)]))}var y=g.a;return d(Hy,t,vo,Co,F([ga(f(fg,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var L=g.a.a,D=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!$(e.a.state.phase,L.phase);default:return!1}}(),u=U(t,{expandedPhase:D?L.phase:t.expandedPhase,trade:f(ab,L,t.trade)});return d(Hy,u,YC(u),Co,mr)}return d(Hy,t,vo,Co,F([ga(f(TE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var M=g.a.a;if(Gm(M)){var u=U(t,{trade:f(rb,M,t.trade)});return d(Hy,u,YC(u),Co,mr)}return d(Hy,t,vo,Co,F([ga(wE)]))}var V=g.a.a;return d(Hy,t,vo,Co,F([ga(f(Kf,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(Hy,t,vo,Co,F([ga(f(fg,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=U(t,{trade:f(nb,H,t.trade)});return d(Hy,u,YC(u),Co,mr)}return d(Hy,t,vo,Co,F([ga(f(TE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Ah,Fm,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(Hy,t,vo,Co,F([ga(f(Kf,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(Qb,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(Xb,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=cm(e.terms);if("Ok"===r.$){var n=r.a;return x(f(ib,n,t.trade),fi)}var a=r.a;return x(t.trade,ci(f(Kf,"Couldn't decode payment methods!",a)))}return x(t.trade,fi)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return P(ci(t),r,f(Pa,Qi(ZC),n))}(l(BC,q.blockNumber,Y,r))}return d(eE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(uo,t.eventsWaitingForChatHistory,F([x(q.blockNumber,Y)])):mr}(),u=U(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?YC(u):vo;return d(Hy,u,_,Co,f(uo,f(Pa,ga,AC(F([X]))),o));case"ExpandPhase":var te=e.a;return EE(U(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return EE(U(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return EE(U(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(Hy,t,vo,Co,F([ha(mv(C.parameters.initiatorAddress))]))}return d(Hy,t,vo,Co,F([ga(f(Kf,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return EE(U(t,{txChainStatus:ci(f(lE,E,ie))}));case"AbortAction":return EE(U(t,{txChainStatus:fi}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(KC,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=Pf(l(Fd,Pd(r),C.creationInfo.address,ie)),t={onBroadcast:fi,onMined:fi,onSign:ci(oE)};return f(wo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Pu,i,Sl(jm(C.parameters))),Ca)?x(ci(iE),n):l(KC,C,E.address,E.commPubkey)}return x(ci(iE),n)}(),T=oe.a,w=oe.b;return d(Hy,U(t,{txChainStatus:T}),vo,w,mr);case"ContractActionClicked":var ue=e.a;if($(ue,gE)||$(ue,vE)){var se=mE(ue),ce=t;e=se,t=ce;continue e}return EE(U(t,{txChainStatus:ci(fE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return P(t.txChainStatus,Co,F([ga(f(Kf,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=Pf(Qy(n.creationInfo.address));return P(ci(nE(vE)),f(wo,PC(vE),a),mr);case"Claim":var a=Pf(Wy(n.creationInfo.address));return P(ci(nE(sE)),f(wo,PC(sE),a),mr);case"Abort":var a=Pf(zy(n.creationInfo.address));return P(ci(nE(tE)),f(wo,PC(tE),a),mr);case"Release":var a=Pf(Xy(n.creationInfo.address));return P(ci(nE(yE)),f(wo,PC(yE),a),mr);case"Burn":var a=Pf(Yy(n.creationInfo.address));return P(ci(nE(uE)),f(wo,PC(uE),a),mr);default:var a=Pf(Bf(n.creationInfo.address));return P(ci(nE(gE)),f(wo,PC(gE),a),mr)}}(),T=le.a,w=le.b,o=le.c;return d(Hy,U(t,{txChainStatus:T}),vo,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return EE(U(t,{txChainStatus:ci(aE(he))}))}var V=de.a;return d(Hy,U(t,{txChainStatus:fi}),vo,Co,F([ga(f(hg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return EE(U(t,{txChainStatus:ci(cE(he))}))}var V=de.a;return d(Hy,U(t,{txChainStatus:fi}),vo,Co,F([ga(f(hg,"commit",V))]));case"CommitMined":return EE(U(t,{txChainStatus:fi}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return EE(U(t,{txChainStatus:ci(f(rE,ue,he))}))}var V=de.a;return d(Hy,U(t,{txChainStatus:fi}),vo,Co,F([ga(f(hg,CE(ue),V))]));case"ActionMined":var ue=e.a;return EE(U(t,{txChainStatus:fi}));case"EventSentryMsg":var pe=e.a,ge=f(aS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(Hy,U(t,{eventSentry:ve}),_,Co,mr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(_C,ye,be),Ee=U(t,{chatHistoryModel:ci(Ce.model)}),s=Ce.shouldCallDecrypt?YC(t):vo,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return x(DC(f(zb,r,a)),fi)}return x(vo,ci(f(Kf,"Trying to encrypt, but commInfo is not loaded",n)))}return x(vo,fi)}(),Te=Se.a,we=Se.b;return d(Hy,Ee,go(F([s,Te])),Co,O(f(Xi,ZC,Ce.appCmds),f(pc,mr,f(Bo,sS,f(Bo,ga,we)))))}return d(Hy,t,vo,Co,F([ga(f(Kf,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Bh,Gb,jb(Ie)),Be=P(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Hm,p,E.address);if("Nothing"===Ne.$)return d(Hy,t,vo,Co,F([ga(f(Kf,"Trying to encrypt, but the user is not involved in this trade.",fi))]));var Re=Ne.a,$e=function(){return Pf("Initiator"===Re.$?f(Jy,p.creationInfo.address,ke):f(Zy,p.creationInfo.address,ke))}();return d(Hy,t,vo,f(wo,{onBroadcast:fi,onMined:fi,onSign:fi},$e),mr)}var _e=Be.a,Le=Be.b;return d(Hy,t,vo,Co,F([ga(f(Kf,"Encryption successful, but the user or trade is no longer valid.",x(_e,Le)))]))}var xe=Be.c.a;return d(Hy,t,vo,Co,F([ga(f(Kf,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return EE(t)}var V=e.a.a;return d(Hy,t,vo,Co,F([ga(f(lg,"message",V))]));default:return d(Hy,t,vo,Co,F([va]))}}),fS=r(function(e,t){return{address:e,blocknum:t}}),lS=n(function(e,t,r){return function(e){return x(e.a,e.b)}(d(oS,!0,e,t,r))}),dS=n(function(e,t,r){var n=function(e){return r(f(Ah,Cm,e).returnData)},a={address:t.address,fromBlock:XE(t.blocknum),toBlock:XE(t.blocknum),topics:F([ci(Mm("Initiated(string,string)"))])};return l(lS,n,e,a)}),hS=function(e){return{data:ci(f(Af,"numTrades()",mr)),decoder:Jo(Sh),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},pS=r(function(e,t){return f($p,t,f(mp,Rh(e),hS(xd(e))))}),gS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(Na,a,r)}return r}),vS=r(function(e,t){return l(xa,gS(e),mr,t)}),yS=function(e){return f(vS,function(e){if("LoadedTrade"===e.$){var t=e.a;return ci(t)}return fi},Ta(e.trades))},mS=function(e){return f($a,r(function(t,r){return e(t)?r+1:r}),0)},bS=function(e){return f(mS,Qa(zm),Ta(e.trades))},CS=function(e){return U(e,{dataFetchState:U(e.dataFetchState,{invalid:bS(e),loaded:wi(yS(e))})})},ES=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),SS=r(function(e,t){var r=f(Lc,e,t.trades);if("Just"===r.$){var n=(r.a,l(Oc,e,zm,t.trades));return l(ES,CS(U(t,{trades:n})),vo,mr)}return l(ES,t,vo,F([ga(f(Kf,"markTradeInvalid ran into an out-of-range error",x(e,t.trades)))]))}),TS=n(function(e,t,r){var n=f(Lc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tb,t,a),o=l(Oc,e,i,r.trades);return x(CS(U(r,{trades:o})),mr)}return x(r,F([f(Kf,"updateTradeAddress ran into an out-of-range error",x(e,r.trades))]))}),wS=n(function(e,t,r){var n=f(Lc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(rb,t,a),o=l(Oc,e,i,r.trades);return l(ES,CS(U(r,{trades:o})),vo,mr)}return l(ES,r,vo,F([ga(f(Kf,"updateTradeParameters ran into an out-of-range error",x(e,r.trades)))]))}),IS=n(function(e,t,r){var n=f(Lc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(nb,t,a),o=l(Oc,e,i,r.trades);return l(ES,CS(U(r,{trades:o})),vo,mr)}return l(ES,r,vo,F([ga(f(Kf,"updateTradePhaseTimeInfo ran into an out-of-range error",x(e,r.trades)))]))}),AS=n(function(e,t,r){var n=f(Lc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(ab,t,a),o=l(Oc,e,i,r.trades);return l(ES,CS(U(r,{trades:o})),vo,mr)}return l(ES,r,vo,F([ga(f(Kf,"updateTradeState ran into an out-of-range error",x(e,r.trades)))]))}),BS=n(function(e,t,r){var n=f(Lc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(ib,t,a),o=l(Oc,e,i,r.trades);return l(ES,CS(U(r,{trades:o})),vo,mr)}return l(ES,r,vo,F([ga(f(Kf,"updateTTPaymentMethods ran into an out-of-range error",x(e,r.trades)))]))}),kS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),NS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),RS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),$S=function(e){return{$:"NumTradesFetchedAgain",a:e}},_S=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),LS=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),xS=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),PS=function(e){return l(ES,e,vo,mr)},DS=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=Mb(n),i=Kb(f(Pa,my(t.factory),f(Bi,0,a-1))),o=go(f(Pa,function(e){return l(Ny,t.factory,Iu(e),kS(e))},f(Bi,0,a-1)));return l(ES,U(t,{dataFetchState:l(NS,ci(a),0,0),trades:i}),o,mr)}var u=r.a;return l(ES,t,vo,F([ga(f(fg,"Factory numTrades",u))]));case"CheckForNewTrades":return l(ES,t,f(pS,t.factory,$S),mr);case"NumTradesFetchedAgain":var r=e.a,s=x(r,t.dataFetchState.total);if("Ok"===s.a.$){if("Just"===s.b.$){var n=s.a.a,c=s.b.a,d=Mb(n);if(L(c,d)<0){var p=t.dataFetchState,o=go(f(Pa,function(e){return l(Ny,t.factory,Iu(e),kS(e))},f(Bi,c,d-1))),g=Kb(f(Pa,my(t.factory),f(Bi,c,d-1)));return l(ES,U(t,{dataFetchState:U(p,{total:ci(d)}),trades:f(wC,t.trades,g)}),o,mr)}return PS(t)}s.b;return l(ES,t,vo,F([ga(f(Kf,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=s.a.a;return l(ES,t,vo,F([ga(f(fg,"Factory numTrades",u))]));case"CreationInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$){var y=r.a,m=f(fS,y.address_,Mb(y.blocknum)),b=l(dS,t.eventSentry,m,RS(v)),C=b.a,E=b.b,S=go(F([h(Ob,t.factory,m.address,_S(v),xS(v),LS(v)),E])),T=l(TS,v,m,t),w=T.a,I=T.b;return l(ES,CS(U(w,{eventSentry:C})),S,f(Pa,ga,I))}var u=r.a;return l(ES,t,vo,F([ga(f(fg,"creationInfo",u))]));case"ParametersFetched":var v=e.a,r=e.b;if("Err"===r.$){var A=r.a;return l(ES,t,vo,F([ga(f(fg,"parameters",A))]))}if("Ok"===r.a.$){var B=r.a.a;return l(wS,v,B,t)}var k=r.a.a;return l(ES,t,vo,F([ga(f(Kf,"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(AS,v,N,t)}return l(ES,t,vo,F([ga(f(TE,"state",r))]));case"PhaseStartInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var R=r.a.a;return l(IS,v,R,t)}return l(ES,t,vo,F([ga(f(TE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var v=e.a,r=e.b;if("Ok"===r.$){var $=r.a,_=cm($.terms);if("Ok"===_.$){var P=_.a;return l(BS,v,P,t)}var D=_.a;return f(SS,v,t)}var D=r.a;return l(ES,t,vo,F([ga(f(Kf,"Error decoding initiated event",D))]));default:var O=e.a,M=f(aS,O,t.eventSentry),V=M.a,S=M.b;return l(ES,U(t,{eventSentry:V}),S,mr)}}),US=function(e){return{$:"AgentHistoryMsg",a:e}},OS=function(e){return{$:"AppCmd",a:e}},MS={$:"BetaLandingPage"},FS={$:"ConnectToWeb3"},VS=function(e){return{$:"MarketplaceMsg",a:e}},KS=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),HS=r(function(e,t){return f(Nn,e,jf(t))}),jS=function(e){return f(HS,"href",rt(e))},qS=Rn("rel"),GS=HS("target"),zS=function(e){return{$:"Height",a:e}},YS=zS,WS={$:"Content"},JS=WS,QS=function(e){return{$:"Width",a:e}},XS=QS,ZS=function(e){return{$:"Attr",a:e}},eT=function(e){return{$:"NodeName",a:e}},tT=function(e){return{$:"Unkeyed",a:e}},rT={$:"AsEl"},nT=rT,aT=r(function(e,t){return{$:"Field",a:e,b:t}}),iT=f(aT,0,0),oT={$:"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"},sT=uT.any+" "+uT.column,cT=uT.any+" "+uT.grid,fT=uT.any+" "+uT.page,lT=uT.any+" "+uT.paragraph,dT=uT.any+" "+uT.row,hT=uT.any+" "+uT.single,pT=function(e){switch(e.$){case"AsRow":return dT;case"AsColumn":return sT;case"AsEl":return hT;case"AsGrid":return cT;case"AsParagraph":return lT;default:return fT}},gT=function(e){return{$:"Keyed",a:e}},vT={$:"NoStyleSheet"},yT=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))}}),mT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return O(f(Pa,function(t){return x(e,t)},n),t);case"ChildrenInFront":var a=r.a;return O(t,f(Pa,function(t){return x(e,t)},a));default:var n=r.a,a=r.b;return O(f(Pa,function(t){return x(e,t)},n),O(t,f(Pa,function(t){return x(e,t)},a)))}}),bT={$:"AsParagraph"},CT=bT,ET=Tn("div"),ST=Tn("p"),TT=Tn("s"),wT=Tn("u"),IT=HS("className"),AT=function(e){return In(Ze(e))},BT=function(e){return Tn(Ze(e))},kT=function(e){return{$:"Flag",a:e}},NT=function(e){return{$:"Second",a:e}},RT=function(e){return e>31?NT(1< .ctr > ."+uT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",$w="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+XT(uT.any)+XT(uT.row)+" > "+XT(uT.any)+" { flex-basis: auto !important; } "+XT(uT.any)+XT(uT.row)+" > "+XT(uT.any)+XT(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"+Rw,_w=function(e){return{$:"Intermediate",a:e}},Lw=r(function(e,t){return _w({closing:t,others:mr,props:mr,selector:e})}),xw=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(Na,x(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return U(t,{others:f(Na,_w({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(Na,f(xw,f(Lw,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return U(t,{others:f(Na,f(xw,f(Lw,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return U(t,{others:f(Na,f(xw,f(Lw,O(n.selector,p),""),g),t.others)});default:var v=e.a;return U(t,{others:f(Na,f(xw,f(Lw,n.selector,""),v),t.others)})}});return _w(l(xa,a,n,t))}),Pw=O($w,function(e){var t=function(e){return Xl(f(Pa,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),Xl(f(Pa,a,t.others)))};return Xl(f(Pa,a,l(xa,r(function(e,t){var r=e.a,n=e.b;return f(Na,f(xw,f(Lw,r,""),n),t)}),mr,e)))}(O(Bw,Nw))),Dw=l(BT,"style",mr,F([ew(Pw)])),Uw=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+'"'}},Ow=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}},Mw=function(e){if("FontWith"===e.$){var t=e.a;return f(Xd,Ow,t.variants)}return!1},Fw=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),Vw=r(function(e,t){return e+" {"+f($i,"",f(Pa,function(e){return e.a+": "+e.b+";"},t))+"}"}),Kw=n(function(e,t,r){var n=r.a,a=r.b;return F([f(Vw,"."+e+"."+t+", ."+e+" ."+t,n),f(Vw,"."+e+"."+t+"> ."+uT.text+", ."+e+" ."+t+" > ."+uT.text,a)])}),Hw=n(function(e,t,r){var n=t.a,a=t.b,i=$(e,r)?e:r+" ."+e;return f($i," ",O(l(Kw,i,uT.sizeByCapital,a),l(Kw,i,uT.fullSize,n)))}),jw=r(function(e,t){var r=$(e,t)?e:t+" ."+e;return f($i," ",F([f(Vw,"."+r+"."+uT.sizeByCapital+", ."+r+" ."+uT.sizeByCapital,F([x("line-height","1")])),f(Vw,"."+r+"."+uT.sizeByCapital+"> ."+uT.text+", ."+r+" ."+uT.sizeByCapital+" > ."+uT.text,F([x("vertical-align","0"),x("line-height","1")]))]))}),qw=function(e){if(e.b){var t=e.a,r=e.b;return ci(l($a,ti,t,r))}return fi},Gw=function(e){if(e.b){var t=e.a,r=e.b;return ci(l($a,nc,t,r))}return fi},zw=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),Yw=function(e){var t=F([e.capital,e.baseline,e.descender,e.lowercase]),r=f(pc,e.descender,Gw(t)),n=f(pc,e.baseline,Gw(f(Wf,function(e){return!$(e,r)},t))),a=f(pc,e.capital,qw(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(zw,i,a-n,o),full:l(zw,u,a-r,s)}},Ww=function(e){return x(F([x("display","block")]),F([x("display","inline-block"),x("line-height",WT(e.height)),x("vertical-align",WT(e.vertical)+"em"),x("font-size",WT(e.size)+"em")]))},Jw=function(e){return l($a,r(function(e,t){if("Nothing"===t.$){if("FontWith"===e.$){var r=e.a,n=r.adjustment;if("Nothing"===n.$)return t;var a=n.a;return ci(x(Ww(function(e){return e.full}(Yw(a))),Ww(function(e){return e.capital}(Yw(a)))))}return t}return t}),fi,e)},Qw=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return ci("@import url('"+t+"');")}return fi},r=function(e){var r=(e.a,e.b);return f($i,"\n",f(vS,t,r))},n=f(Pa,Xa,e),a=function(e){var t=e.a,r=e.b,a=Jw(r);if("Nothing"===a.$)return f($i,"",f(Pa,jw(t),n));var i=a.a;return f($i,"",f(Pa,f(Hw,t,i),n))};return O(f($i,"\n",f(Pa,r,e)),f($i,"\n",f(Pa,a,e)))},Xw=function(e){switch(e.$){case"VariantActive":var t=e.a;return'"'+t+'"';case"VariantOff":var t=e.a;return'"'+t+'" 0';default:var t=e.a,r=e.b;return'"'+t+'" '+Ri(r)}},Zw=function(e){if("FontWith"===e.$){var t=e.a;return ci(f($i,", ",f(Pa,Xw,t.variants)))}return fi},eI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return ci(x(t,r))}return fi},tI=function(e){switch(e.$){case"Untransformed":return fi;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return ci("translate3d("+WT(r)+"px, "+WT(n)+"px, "+WT(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("+WT(o)+"px, "+WT(u)+"px, "+WT(s)+"px)",b="scale3d("+WT(f)+", "+WT(l)+", "+WT(d)+")",C="rotate3d("+WT(p)+", "+WT(g)+", "+WT(v)+", "+WT(y)+"rad)";return ci(m+" "+b+" "+C)}},rI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l($a,Fw(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l($a,Fw(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l($a,Fw(!1),"",n)+"\n}"}case"Focus":var a=l($a,Fw(!1),"",n);return f($i,"\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($a,Fw(!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(zT,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ti,0,f(nc,1,1-c));return l(a,t,"."+u,F([f(zT,"opacity",WT(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ri(h),F([f(zT,"font-size",Ri(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f($i,", ",f(vS,Zw,p)),v=F([f(zT,"font-family",f($i,", ",f(Pa,Uw,p))),f(zT,"font-feature-settings",g),f(zT,"font-variant",f(Xd,Mw,p)?"small-caps":"normal")]);return f($i," ",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(zT,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,F([f(zT,s,JT(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ri(S)+"px",w=Ri(E)+"px",I="."+uT.row,A="."+(uT.wrapped+I),B="."+uT.alignRight,k="."+uT.paragraph,N="."+uT.page,R="."+uT.alignLeft,$=WT(S/2)+"px",_=WT(E/2)+"px",L="."+uT.column,y="."+C,P="."+uT.any;return Xl(F([l(a,t,y+(I+" > ")+P+" + "+P,F([f(zT,"margin-left",w)])),l(a,t,y+(A+" > ")+P,F([f(zT,"margin",$+" "+_)])),l(a,t,y+(L+" > ")+P+" + "+P,F([f(zT,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,F([f(zT,"margin-top",T)])),l(a,t,y+(N+" > ")+R,F([f(zT,"margin-right",w)])),l(a,t,y+(N+" > ")+B,F([f(zT,"margin-left",w)])),l(a,t,O(y,k),F([f(zT,"line-height","calc(1em + "+Ri(S)+"px)")])),l(a,t,"textarea"+y,F([f(zT,"line-height","calc(1em + "+Ri(S)+"px)")])),l(a,t,y+(k+" > ")+R,F([f(zT,"margin-right",w)])),l(a,t,y+(k+" > ")+B,F([f(zT,"margin-left",w)])),l(a,t,y+(k+"::after"),F([f(zT,"content","''"),f(zT,"display","block"),f(zT,"height","0"),f(zT,"width","0"),f(zT,"margin-top",Ri(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),F([f(zT,"content","''"),f(zT,"display","block"),f(zT,"height","0"),f(zT,"width","0"),f(zT,"margin-bottom",Ri(-1*(S/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(zT,"padding",Ri(D)+"px "+Ri(B)+"px "+Ri(U)+"px "+Ri(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(zT,"border-width",Ri(D)+"px "+Ri(B)+"px "+Ri(U)+"px "+Ri(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 Ri(n)+"px";case"Content":var a=x(e,t);if("Nothing"===a.a.$){if("Nothing"===a.b.$){a.a,a.b;return"max-content"}var i=(a.a,a.b.a);return"minmax(max-content, "+Ri(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ri(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ri(o)+"px, "+Ri(i)+"px)";case"Fill":var u=r.a,s=x(e,t);if("Nothing"===s.a.$){if("Nothing"===s.b.$){s.a,s.b;return Ri(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ri(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ri(o)+"px, "+Ri(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ri(o)+"px, "+Ri(i)+"px)";case"Min":var c=r.a,f=r.b,l=ci(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=ci(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,fi,fi,e)},H=(K(M.spacing.a),K(M.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f($i," ",f(Pa,K,M.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f($i,H,f(Pa,K,M.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f($i,H,f(Pa,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($i," ",f(Pa,K,M.columns))),y=".grid-rows-"+f($i,"-",f(Pa,KT,M.rows))+"-cols-"+f($i,"-",f(Pa,KT,M.columns))+"-space-x-"+KT(M.spacing.a)+"-space-y-"+KT(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($i," ",F(["-ms-grid-row: "+Ri(Z.row)+";","-ms-grid-row-span: "+Ri(Z.height)+";","-ms-grid-column: "+Ri(Z.col)+";","-ms-grid-column-span: "+Ri(Z.width)+";"])),te=f($i," ",F(["grid-row: "+Ri(Z.row)+" / "+Ri(Z.row+Z.height)+";","grid-column: "+Ri(Z.col)+" / "+Ri(Z.col+Z.width)+";"])),y=".grid-pos-"+Ri(Z.row)+"-"+Ri(Z.col)+"-"+Ri(Z.width)+"-"+Ri(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return O(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f($i," ",f(Pa,function(e){return f(i,e,ci(y))},re));default:var ne=e.a,m=tI(ne),y=jT(ne),ae=x(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(zT,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:O(t.rules,f(i,e,fi)),topLevel:function(){var r=eI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(Na,n,t.topLevel)}()}}),u=l($a,o,{rules:"",topLevel:mr},t),s=u.topLevel,c=u.rules;return O(Qw(s),c)}),nI=r(function(e,t){return l(BT,"style",mr,F([ew(f(rI,e,t))]))}),aI=a(function(e,t,r,n){return e?f(Na,x("static-stylesheet",Dw),f(Na,x("dynamic-stylesheet",f(nI,t,l($a,GT,x(Dy,F([ZT(t.focus)])),r).b)),n)):f(Na,x("dynamic-stylesheet",f(nI,t,l($a,GT,x(Dy,F([ZT(t.focus)])),r).b)),n)}),iI=a(function(e,t,r,n){return e?f(Na,Dw,f(Na,f(nI,t,l($a,GT,x(Dy,F([ZT(t.focus)])),r).b),n)):f(Na,f(nI,t,l($a,GT,x(Dy,F([ZT(t.focus)])),r).b),n)}),oI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(AT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(aI,!1,e,t,r);default:var e=i.a,t=i.b;return d(aI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return ET;case"p":return ST;default:return BT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(iI,!1,e,t,n);default:var e=i.a,t=i.b;return d(iI,!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(BT,e,n,F([f(u,r,F([IT(uT.any+" "+uT.single)]))]))}}();switch(o.$){case"AsRow":return f(UT,MT,e)&&!f(UT,OT,e)?s:f(UT,_T,e)?f(wT,F([IT(f($i," ",F([uT.any,uT.single,uT.container,uT.contentCenterY,uT.alignContainerRight])))]),F([s])):f(UT,LT,e)?f(TT,F([IT(f($i," ",F([uT.any,uT.single,uT.container,uT.contentCenterY,uT.alignContainerCenterX])))]),F([s])):s;case"AsColumn":return f(UT,DT,e)&&!f(UT,PT,e)?s:f(UT,xT,e)?f(TT,F([IT(f($i," ",F([uT.any,uT.single,uT.container,uT.alignContainerCenterY])))]),F([s])):f(UT,$T,e)?f(wT,F([IT(f($i," ",F([uT.any,uT.single,uT.container,uT.alignContainerBottom])))]),F([s])):s;default:return s}}),uI=ew,sI=function(e){return f(ET,F([IT(f($i," ",F([uT.any,uT.text,uT.widthContent,uT.heightContent])))]),F([uI(e)]))},cI=function(e){return l(BT,"div",F([IT(f($i," ",F([uT.any,uT.text,uT.widthFill,uT.heightFill])))]),F([ew(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,CT),x(f(Na,x(n,u(e)),i),o);case"Styled":var s=a.a;return $(e,CT),x(f(Na,x(n,f(s.html,vT,e)),i),iu(o)?s.styles:O(s.styles,o));case"Text":var c=a.a;return x(f(Na,x(n,$(e,nT)?cI(c):sI(c)),i),o);default:return x(i,o)}}),i=r(function(t,r){var n=r.a,a=r.b;switch(t.$){case"Unstyled":var i=t.a;return $(e,CT),x(f(Na,i(e),n),a);case"Styled":var o=t.a;return $(e,CT),x(f(Na,f(o.html,vT,e),n),iu(a)?o.styles:O(o.styles,a));case"Text":var u=t.a;return x(f(Na,$(e,nT)?cI(u):sI(u),n),a);default:return x(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(xa,a,x(mr,mr),o),s=u.a,c=u.b,p=iu(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return qi({html:d(oI,n.has,n.node,n.attributes,gT(l(mT,"nearby-element-pls",s,n.children))),styles:g})}return zi(h(oI,n.has,n.node,n.attributes,gT(l(mT,"nearby-element-pls",s,n.children)),vT))}var v=t.a,y=l(xa,i,x(mr,mr),v),m=y.a,c=y.b,p=iu(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return qi({html:d(oI,n.has,n.node,n.attributes,tT(f(yT,m,n.children))),styles:g})}return zi(h(oI,n.has,n.node,n.attributes,tT(f(yT,m,n.children)),vT))}),lI=r(function(e,t){return f(Rn,et(e),nt(t))}),dI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(aT,a|r,n)}var i=e.a;return f(aT,r,i|n)}),hI=RT(7),pI=RT(36),gI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(aT,r|a,n|i)}),vI=RT(6),yI=RT(38),mI=RT(30),bI=RT(29),CI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),EI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),SI=function(e){return{$:"Transform",a:e}},TI=function(e){return{$:"ChildrenBehind",a:e}},wI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),II=function(e){return{$:"ChildrenInFront",a:e}},AI=r(function(e,t){return f(ET,F([IT(function(){switch(e.$){case"Above":return f($i," ",F([uT.nearby,uT.single,uT.above]));case"Below":return f($i," ",F([uT.nearby,uT.single,uT.below]));case"OnRight":return f($i," ",F([uT.nearby,uT.single,uT.onRight]));case"OnLeft":return f($i," ",F([uT.nearby,uT.single,uT.onLeft]));case"InFront":return f($i," ",F([uT.nearby,uT.single,uT.inFront]));default:return f($i," ",F([uT.nearby,uT.single,uT.behind]))}}())]),F([function(){switch(t.$){case"Empty":return ew("");case"Text":var e=t.a;return sI(e);case"Unstyled":return(0,t.a)(nT);default:return f(t.a.html,vT,nT)}}()]))}),BI=n(function(e,t,r){var n=f(AI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?TI(F([n])):II(F([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?TI(f(Na,n,a)):f(wI,a,F([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(wI,F([n]),i):II(f(Na,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(wI,f(Na,n,a),i):f(wI,a,f(Na,n,i))}}),kI=r(function(e,t){switch(t.$){case"Generic":return eT(e);case"NodeName":var r=t.a;return f(CI,r,e);default:var n=t.a,a=t.b;return f(CI,n,a)}}),NI=function(e){switch(e.$){case"Left":return uT.alignedHorizontally+" "+uT.alignLeft;case"Right":return uT.alignedHorizontally+" "+uT.alignRight;default:return uT.alignedHorizontally+" "+uT.alignCenterX}},RI=function(e){switch(e.$){case"Top":return uT.alignedVertically+" "+uT.alignTop;case"Bottom":return uT.alignedVertically+" "+uT.alignBottom;default:return uT.alignedVertically+" "+uT.alignCenterY}},$I=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),_I=function(e){return{$:"Moved",a:e}},LI=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return _I(P(r,0,0));case"MoveY":var n=t.a;return _I(P(0,n,0));case"MoveZ":var a=t.a;return _I(P(0,0,a));case"MoveXYZ":var i=t.a;return _I(i);case"Rotate":var i=t.a,o=t.b;return d($I,P(0,0,0),P(1,1,1),i,o);default:var i=t.a;return d($I,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 _I(P(s,n,a));case"MoveY":var c=t.a;return _I(P(r,c,a));case"MoveZ":var f=t.a;return _I(P(r,n,f));case"MoveXYZ":var i=t.a;return _I(i);case"Rotate":var i=t.a,o=t.b;return d($I,u,P(1,1,1),i,o);default:var l=t.a;return d($I,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($I,P(s,n,a),h,p,o);case"MoveY":var c=t.a;return d($I,P(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d($I,P(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d($I,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d($I,u,h,v,y);default:var m=t.a;return d($I,u,m,p,o)}}}),xI=function(e){switch(e.$){case"Px":var t=e.a,r=Ri(t),n="height-px-"+r;return P(iT,n,F([l(EI,n,"height",r+"px")]));case"Content":return P(f(dI,pI,iT),uT.heightContent,mr);case"Fill":var a=e.a;return 1===a?P(f(dI,DT,iT),uT.heightFill,mr):P(f(dI,DT,iT),uT.heightFillPortion+" height-fill-"+Ri(a),F([l(EI,uT.any+"."+uT.row+" > "+XT("height-fill-"+Ri(a)),"flex-grow",Ri(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ri(i),s=l(EI,u,"min-height",Ri(i)+"px"),c=xI(o),d=c.a,h=c.b,p=c.c;return P(f(dI,PT,d),u+" "+h,f(Na,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ri(g),s=l(EI,u,"max-height",Ri(g)+"px"),v=xI(o),d=v.a,h=v.b,p=v.c;return P(f(dI,PT,d),u+" "+h,f(Na,s,p))}},PI=function(e){switch(e.$){case"Px":var t=e.a;return P(iT,uT.widthExact+" width-px-"+Ri(t),F([l(EI,"width-px-"+Ri(t),"width",Ri(t)+"px")]));case"Content":return P(f(dI,yI,iT),uT.widthContent,mr);case"Fill":var r=e.a;return 1===r?P(f(dI,MT,iT),uT.widthFill,mr):P(f(dI,MT,iT),uT.widthFillPortion+" width-fill-"+Ri(r),F([l(EI,uT.any+"."+uT.row+" > "+XT("width-fill-"+Ri(r)),"flex-grow",Ri(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ri(n),o=l(EI,i,"min-width",Ri(n)+"px"),u=PI(a),s=u.a,c=u.b,d=u.c;return P(f(dI,OT,s),i+" "+c,f(Na,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ri(h),o=l(EI,i,"max-width",Ri(h)+"px"),p=PI(a),s=p.a,c=p.b,d=p.c;return P(f(dI,OT,s),i+" "+c,f(Na,o,d))}},DI=RT(27),UI=r(function(e,t){if($(e,DI)){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}}),OI=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=jT(n);if("Nothing"===s.$)return{attributes:f(Na,IT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(Na,IT(e+" "+c),i),children:o,has:r,node:t,styles:f(Na,SI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(UT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(dI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(Na,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(UT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(UI,S,I)){var p=qT(I)+" "+e,g=t,v=f(dI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=qT(I)+" "+e,g=t,v=f(dI,S,r),y=n,m=f(Na,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(dI,S,r),y=f(LI,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(UT,vI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=uT.widthExact+" width-px-"+Ri(k)+" "+e,g=t,v=f(dI,vI,r),y=n,m=f(Na,l(EI,"width-px-"+Ri(k),"width",Ri(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+uT.widthContent,g=t,v=f(dI,yI,f(dI,vI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+uT.widthFill,g=t,v=f(dI,MT,f(dI,vI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+uT.widthFillPortion+" width-fill-"+Ri(N),g=t,v=f(dI,MT,f(dI,vI,r)),y=n,m=f(Na,l(EI,uT.any+"."+uT.row+" > "+XT("width-fill-"+Ri(N)),"flex-grow",Ri(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=PI(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(gI,$,r),y=n,m=O(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(UT,hI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ri(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(dI,hI,r),y=n,m=f(Na,l(EI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=uT.heightContent+" "+e,g=t,v=f(dI,pI,f(dI,hI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=uT.heightFill+" "+e,g=t,v=f(dI,DT,f(dI,hI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+uT.heightFillPortion+" height-fill-"+Ri(N),g=t,v=f(dI,DT,f(dI,hI,r)),y=n,m=f(Na,l(EI,uT.any+"."+uT.column+" > "+XT("height-fill-"+Ri(N)),"flex-grow",Ri(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var U=xI(x),$=U.a,_=U.b,L=U.c,p=e+" "+_,g=t,v=f(gI,$,r),y=n,m=O(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(kI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(kI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(kI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(kI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(kI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(kI,"h"+Ri(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(kI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return eT("p");case"NodeName":var e=t.a;return eT(e);default:var r=t.a,n=t.b;return f(CI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(Na,f(lI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(Na,f(lI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(Na,f(lI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(Na,f(lI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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=L,b=i,C=l(BI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(UT,mI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=NI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(dI,LT,e);case"Right":return f(dI,_T,e);default:return e}}(f(dI,mI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(UT,bI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=RI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(dI,xT,e);case"Bottom":return f(dI,$T,e);default:return e}}(f(dI,bI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),MI={$:"Untransformed"},FI=MI,VI=a(function(e,t,r,n){return l(fI,e,n,v(OI,pT(e),t,iT,FI,mr,mr,oT,_a(r)))}),KI=function(e){return ZS(IT(e))},HI=r(function(e,t){var r=t.url,n=t.label;return d(VI,nT,eT("a"),f(Na,ZS(jS(r)),f(Na,ZS(qS("noopener noreferrer")),f(Na,ZS(GS("_blank")),f(Na,XS(JS),f(Na,YS(JS),f(Na,KI(uT.contentCenterX+" "+uT.contentCenterY),e)))))),tT(F([n])))}),jI=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),qI=n(function(e,t,r){return d(jI,e,t,r,1)}),GI=RT(14),zI=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),YI=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),WI=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return HT(t)+"-"+HT(r)+"-"+HT(n)+"-"+HT(a)},JI=function(e){return f(YI,GI,l(zI,"fc-"+WI(e),"color",e))},QI={align:Of,label:"cantConnectNoWeb3",mainParagraphs:F([F([Vf("You need a web3 provider (such as "),f(HI,F([JI(l(qI,0,0,1))]),{label:Vf("Metamask"),url:"https://metamask.io/"}),Vf(") to Connect.")]),F([Vf("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:dg},XI={align:Of,label:"invalidUrl",mainParagraphs:F([F([Vf("I don't understand that URL...")]),F([Vf("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:cg},ZI=function(e){return{$:"Active",a:e}},eA=Wo(f(Ao,wf,f(Ao,Eh,cd("Error decoding hex to BigInt")))),tA=function(){return Wo(function(e){switch(e){case"0x0":return di(!1);case"0x1":return di(!0);default:return li("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}}}}}}}}}}}},nA=function(e){return LE(F([f(Mi,ci,e),Vi(fi)]))},aA=f(jd,nA(f(vh,"status",tA)),f(jd,nA(f(vh,"root",Yo)),l(UE,"logsBloom",Yo,l(UE,"logs",sm(YE),f(jd,nA(f(vh,"contractAddress",OE)),l(UE,"cumulativeGasUsed",eA,l(UE,"gasUsed",eA,l(UE,"blockNumber",Cy,l(UE,"blockHash",KE,l(UE,"transactionIndex",Cy,l(UE,"transactionHash",qE,Vi(rA)))))))))))),iA=function(e){var t=e.a;return wf(t)},oA=f(Ao,iA,jf),uA=r(function(e,t){return gp({decoder:aA,method:"eth_getTransactionReceipt",params:F([oA(t)]),url:e})}),sA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),cA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),fA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),lA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(yg,function(e){return e.b},f(yg,function(e){return e.onMinedTagger},f(Kh,t,e))))}),dA=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 LE(F([_E(fi),f(Mi,ci,e)]))},pA=l(UE,"input",Yo,l(UE,"gas",Cy,l(UE,"gasPrice",eA,l(UE,"value",eA,l(UE,"to",hA(OE),l(UE,"from",OE,l(UE,"transactionIndex",Cy,l(UE,"blockNumber",hA(Cy),l(UE,"blockHash",function(e){return f(Go,function(t){return"0x"===t||"0x0"===t?Vi(fi):f(Ni,function(e){return $(e,D("0"))},Ho(t))?Vi(fi):f(Mi,ci,e)},Yo)}(KE),l(UE,"nonce",Cy,l(UE,"hash",qE,Vi(dA)))))))))))),gA=r(function(e,t){return gp({decoder:pA,method:"eth_getTransactionByHash",params:F([oA(t)]),url:e})}),vA=r(function(e,t){return{attempts:e,sleep:t}}),yA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Rp,function(e){return a>0?f(Cp,function(e){return f(yA,f(vA,a,n),t)},RE(1e3*n)):lp(e)},t)}),mA=r(function(e,t){return f(Cp,function(r){return f(yA,{attempts:30,sleep:1},f(gA,e,t))},RE(250))}),bA=r(function(e,t){return f(yA,{attempts:60,sleep:5},f(uA,e,t))}),CA=function(e){return{$:"Mined",a:e}},EA=function(e){return Bo(function(t){return U(t,{status:CA(e)})})},SA=function(e){return{$:"Sent",a:e}},TA=function(e){return Bo(function(t){return U(t,{status:SA(e)})})},wA=function(e){return{$:"Signed",a:e}},IA=function(e){return Bo(function(t){return U(t,{status:wA(e)})})},AA=function(e){return"Nothing"!==e.$},BA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return x(el(r),vo);case"TxSigned":var n=e.a,a=e.b,i=f(Kh,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(Bg,t,dp(a))}return vo}(),s=function(e){var t=P(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return vo;if("Just"===t.b.$){var r=t.b.a;return f(Bg,r,dp(li(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Bg,a,dp(li(e)))}t.a,t.b,t.c;return vo};if("Ok"===a.$){var c=a.a,d=AA(o.onBroadcastTagger)||AA(o.onMinedTagger)?f(Df,r.tagger,f($p,fA(n),f(mA,r.nodePath,c))):vo;return x(el(U(r,{txs:l(Qh,n,IA(c),r.txs)})),go(F([u,d])))}var h=a.a;return x(el(r),go(F([u,s(h)])))}return x(el(r),vo);case"TxSent":var n=e.a,p=e.b,g=f(Kh,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Df,r.tagger,f($p,cA(n),f(bA,r.nodePath,v.hash))):vo}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Bg,t,dp(di(v)))}return vo}();return x(el(U(r,{txs:l(Qh,n,TA(v),r.txs)})),go(F([d,y])))}var h=p.a,s=function(){var e=x(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(Bg,t,dp(li("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Bg,n,dp(li("Error with TxSent stuff")))}e.a,e.b;return vo}();return x(el(r),s)}return x(el(r),vo);case"TxMined":var n=e.a,m=e.b,b=f(Kh,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Bg,a,dp(di(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 go(F([f(Df,r.tagger,f($p,f(sA,n,s),Ey(r.nodePath))),f(Bg,a,dp(di(C))),f(Bg,u.toMsg,dp(s))]))}return vo}();return x(el(U(r,{txs:l(Qh,n,EA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Bg,r,dp(li("TxReceipt decoding failure")))}return vo}();return x(el(r),S)}return x(el(r),vo);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(lA,r.txs,n);if("Just"===A.$){var B=A.a;return x(el(r),f(Bg,B,f(Rp,function(e){return dp(U(I,{doneWatching:!0,reOrg:!0}))},f(Cp,function(e){return dp(U(I,{doneWatching:!0}))},f(uA,r.nodePath,T.txHash)))))}return x(el(r),vo)}if($(w,T.lastCheckedBlock))return x(el(r),f(Df,r.tagger,f($p,f(sA,n,T),f(Cp,function(e){return Ey(r.nodePath)},RE(2e3)))));var k=f(lA,r.txs,n);if("Just"===k.$){var B=k.a;return x(el(r),go(F([f(Df,r.tagger,f($p,f(sA,n,I),f(Cp,function(e){return Ey(r.nodePath)},RE(2e3)))),f(Bg,B,dp(I))])))}return x(el(r),vo)}var n=e.a,h=e.c.a;return x(el(r),vo);default:var h=e.a;return x(el(r),vo)}}),kA=Qt,NA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ri(r)}),RA=n(function(e,t,r){return"Nothing"===t.$?r:O(r,O(e,t.a))}),$A=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(RA,"#",e.fragment,l(RA,"?",e.query,O(f(NA,e.port_,O(t,e.host)),e.path)))},_A=r(function(e,t){return e<0?fi:Nl(f(Pl,e,t))}),LA=r(function(e,t){if(e<0)return t;var r=ih(f(Pl,e,t)),n=f(qs,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(uo,n,a)}),xA=n(function(e,t,r){if(e<0)return r;var n=f(Pl,e,r),a=f(qs,e,r);if(n.b){var i=n.a,o=n.b;return O(a,f(Na,t(i),o))}return r}),PA=r(function(e,t){return f(xA,e,Xu(t))}),DA=r(function(e,t){vv(t);switch(t.$){case"Home":return x(U(e,{submodel:MS}),vo);case"Create":var r=Rd(e.wallet),n=f(pl,e.txSentry,f(ko,ly,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(OA,O(f(Xi,ly,r.appCmds),f(Pa,ga,o)),x(U(e,{submodel:fy(r.model),txSentry:a}),go(F([f(Df,ly,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(ty,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(Gy,e.wallet,r)}return l(jy,e.wallet,u,s)}(),c=f(pl,e.txSentry,f(ko,py,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(OA,O(f(Xi,py,r.appCmds),f(Pa,ga,o)),x(U(e,{submodel:hy(r.model),txSentry:a}),go(F([f(Df,py,r.cmd),i]))));case"Marketplace":var d=Xg(e.wallet),h=d.a,p=d.b;return x(U(e,{submodel:dy(h)}),go(F([f(Df,VS,p)])));case"AgentHistory":var g=t.a,v=f(yo,e.wallet,g),y=v.a,m=v.b;return x(U(e,{submodel:cy(y)}),go(F([f(Df,US,m)])));default:return x(f(so,XI,e),vo)}}),UA=r(function(e,t){var r=t.a,n=t.b,a=f(MA,OS(e),r),i=a.a,o=a.b;return x(i,go(F([n,o])))}),OA=r(function(e,t){var r=t.a,n=t.b;return l($a,UA,x(r,n),e)}),MA=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(MA,FS,t);case"GotoRoute":var n=r.a;return x(t,f(Yv,t.key,n));case"GTag":var a=r.a;return x(t,Xv(Jv(a)));case"UserNotice":var i=r.a;return x(f(so,i,t),Xv(Jv(d(gl,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return x(t,d(lv,ry,o,u,s));default:return x(t,ny(vr))}case"DismissNotice":var c=e.a;return x(U(t,{userNotices:f(LA,c,t.userNotices)}),vo);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(zv,t.key,$A(e))}var r=h.a;return kA(r)}();return x(t,p);case"UrlChanged":var g=e.a;return f(FA,g,t);case"GotoRoute":var v=e.a;return x(t,go(F([Xv(Jv(d(gl,"GotoRoute","navigation",vv(v),0))),f(Yv,t.key,v)])));case"Tick":var y=e.a;return x(U(t,{time:y}),vo);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?x(f(so,QI,t),vo):x(t,Wv(vr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return vo;var t=e.a;return Zv(f(Qv,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 x(U(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(wh,Yo,C);if("Ok"===E.$){var S=E.a,T=x(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=ZI(l(vl,I,w,S)),B=f(gy,A,t.submodel),k=B.a,p=B.b;return x(U(t,{submodel:k,wallet:A}),p)}return x(f(so,f(Kf,"Unexpected wallet state encounted when setting commPubkey!",fi),t),vo)}T.a;return x(f(so,f(Kf,"User pubkey set, but I can no longer find the user address!",fi),t),vo)}var N=E.a;return x(l(Da,so,f(Kf,"error decoding commPubkey from JS",N),t),vo);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,L=f(jg,R,_),P=f(pl,t.txSentry,f(ko,ly,L.chainCmd)),D=P.a,M=P.b,V=P.c;return f(OA,O(f(Xi,ly,L.appCmds),f(Pa,ga,V)),x(U(t,{submodel:fy(L.model),txSentry:D}),go(F([f(Df,ly,L.cmd),M]))))}return x(t,vo);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,L=f(cS,K,j),q=f(pl,t.txSentry,f(ko,py,L.chainCmd)),D=q.a,M=q.b,V=q.c;return f(OA,O(f(Xi,py,L.appCmds),f(Pa,ga,V)),x(U(t,{submodel:hy(L.model),txSentry:D}),go(F([f(Df,py,L.cmd),M]))))}return x(t,vo);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,L=f(fv,G,Y);return f(OA,f(Xi,VS,L.appCmds),x(U(t,{submodel:dy(L.model)}),f(Df,VS,L.cmd)))}return x(t,vo);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,L=f(Uf,W,Q),X=f(pl,t.txSentry,f(ko,US,L.chainCmd)),D=X.a,M=X.b,V=X.c;return f(OA,O(f(Xi,US,L.appCmds),f(Pa,ga,V)),x(U(t,{submodel:cy(L.model),txSentry:D}),go(F([f(Df,US,L.cmd),M]))))}return x(t,vo);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(du,ci,f(BA,Z,r))}return x(fi,vo)}(),D=ee.a,te=ee.b;return x(U(t,{txSentry:D}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(_A,re,t.tradeCaches);if("Nothing"===ae.$)return f(UA,ga(f(Kf,"Encountered an out-of-range error when trying to route a TradeCacheMsg",fi)),x(t,vo));var ie=ae.a,L=f(DS,ne,ie);return x(U(t,{tradeCaches:l(PA,re,L.tradeCache,t.tradeCaches)}),f(Df,KS(re),L.cmd));case"NoOp":return x(t,vo);default:var N=e.a;f(Ff,"test",N);return x(t,vo)}}),FA=r(function(e,t){return f(DA,t,Gv(e))}),VA=ze("txIn",xE),KA=qe("txOut",Oa),HA=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},jA=function(e){return{$:"EventSentryMsg",a:e}},qA=function(e){var t=f(Uy,jA,Rh(e)),r=t.a,n=t.b;return P({dataFetchState:l(NS,fi,0,0),eventSentry:r,factory:e,trades:Ga},n,F([d($d,"tradeCache init","processing",HA(e),0)]))},GA=function(e){return{$:"InitialNumTradesFetched",a:e}},zA=function(e){return f(pS,e.factory,GA)},YA=function(e){var t=qA(e),r=t.a,n=t.b,a=t.c;return P(r,go(F([n,zA(r)])),a)},WA=function(e){return{$:"TxSentryMsg",a:e}},JA={align:Of,label:"noWeb3Provider",mainParagraphs:F([F([Vf("No web3 provider detected. Is "),f(HI,F([JI(l(qI,0,0,1))]),{label:Vf("Metamask"),url:"https://metamask.io/"}),Vf(" or some other web3 provider installed and unlocked?")])]),noticeType:dg},QA={$:"TopLeft"},XA={align:QA,label:"screenToSmall",mainParagraphs:F([F([Vf("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:dg},ZA={align:Of,label:"wrongWeb3Network",mainParagraphs:F([F([Vf("Your wallet is set to an incorrect network.")]),F([Vf("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:cg},eB={$:"NoneDetected"},tB=function(e){return{$:"OnlyNetwork",a:e}},rB=function(e){return f(Bo,Rh,mg(e))},nB={$:"ETCMain"},aB={$:"ETCTest"},iB={$:"Expanse"},oB={$:"Kovan"},uB={$:"Mainnet"},sB=function(e){return{$:"Private",a:e}},cB={$:"Rinkeby"},fB={$:"Ropsten"},lB={$:"RskMain"},dB={$:"RskTest"},hB=function(e){switch(e){case 1:return uB;case 2:return iB;case 3:return fB;case 4:return cB;case 30:return lB;case 31:return dB;case 42:return oB;case 41:return nB;case 62:return aB;default:return sB(e)}},pB=n(function(e,t,r){var n=e.a,a=e.b;return el({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Vh})}),gB=n(function(e,t,n){var a=e.networkId?tB(hB(e.networkId)):eB,i=f(Bo,function(e){return l(pB,x(KA,VA),WA,e)},rB(a)),o=e.width<1024?ci(XA):fi,u=f(Pa,YA,no),s=function(){return $(a,eB)?ci(JA):"Nothing"===mg(a).$?ci(ZA):fi}(),c=AC(F([o,s])),d=P(f(Pa,ao,u),f(Pa,io,u),f(Pa,oo,u)),h=d.a,p=d.b,g=d.c,v=_v(f(ki,r(function(e,t){return f(Xi,KS(e),t)}),g)),y=go(f(ki,r(function(e,t){return f(Df,KS(e),t)}),p)),m=f(OA,v,f(FA,t,{key:n,screenWidth:e.width,submodel:MS,time:bl(0),tradeCaches:h,txSentry:i,userAddress:fi,userNotices:mr,wallet:a})),b=m.a,C=m.b;return x(f(co,c,b),go(F([y,C])))}),vB=Me,yB=vB(mr),mB=function(e){return yB},bB=function(e){return{$:"Refresh",a:e}},CB=r(function(e,t){return{$:"Every",a:e,b:t}}),EB=r(function(e,t){return{processes:t,taggers:e}}),SB=dp(f(EB,Vh,Vh)),TB=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(L(c,r)<0){var p=r,g=n,v=x(h,l(e,c,f,u));r=p,n=g,i=v;continue e}return L(c,r)>0?x(o,l(a,r,n,u)):x(h,d(t,c,f,n,u))}return x(o,l(a,r,n,u))}}),c=l(tS,s,x(Aa(i),u),o),f=c.a,h=c.b;return l($a,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),wB=Re,IB=r(function(e,t){var r=e.a,n=e.b,a=f(Kh,r,t);if("Nothing"===a.$)return l(ll,r,F([n]),t);var i=a.a;return l(ll,r,f(Na,n,i),t)}),AB=ke,BB=r(function(e,t){return{$:"Zone",a:e,b:t}}),kB=fa,NB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=AB(f(kB,n,f(ep,e,n)));return f(Cp,function(t){return l(NB,e,a,l(ll,n,t,r))},i)}return dp(r)}),RB=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(Cp,function(e){return i},wB(t)))}),u=l($a,IB,Vh,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return P(f(Na,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(ll,e,r,i),o)}),d=p(TB,s,c,o,u,i,P(mr,Vh,dp(vr))),h=d.a,g=d.b,v=d.c;return f(Cp,function(e){return dp(f(EB,u,e))},f(Cp,function(t){return l(NB,e,h,g)},v))}),$B=function(e){return Ie(function(t){t(Te(e(Date.now())))})}(bl),_B=n(function(e,t,r){var n=f(Kh,t,r.taggers);if("Nothing"===n.$)return dp(r);var a=n.a,i=function(t){return wp(f(Pa,function(r){return f(Zh,e,r(t))},a))};return f(Cp,function(e){return dp(r)},f(Cp,i,$B))}),LB=r(function(e,t){var r=t.a,n=t.b;return f(CB,r,f(Ua,e,n))});gn.Time=De(SB,RB,_B,0,LB);var xB=Oe("Time"),PB=r(function(e,t){return xB(f(CB,e,t))}),DB=function(e){return f(PB,2e3,bB)},UB=function(e){return yB},OB=function(e){return{$:"DecryptionFinished",a:e}},MB=ze("decryptionFinished",xE),FB=ze("encryptionFinished",xE),VB=function(e){return{$:"EncryptionFinished",a:e}},KB=function(e){return{$:"Refresh",a:e}},HB=function(e){return vB(F([f(PB,3e3,KB),FB(VB),MB(function(e){return ZC(OB(e))})]))},jB=mn,qB=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return yB;case"CreateModel":t.a;return f(jB,ly,DB());case"TradeModel":t.a;return f(jB,py,HB());case"MarketplaceModel":t.a;return f(jB,VS,UB());default:t.a;return f(jB,US,mB())}},GB=ze("userPubkeyResult",xE),zB=ze("walletSentryPort",xE),YB={$:"CheckForNewTrades"},WB=function(e){return f(PB,5e3,function(e){return YB})},JB=function(e){return{$:"Tick",a:e}},QB=function(e){return{$:"UserPubkeySet",a:e}},XB=function(e){return{$:"WalletStatus",a:e}},ZB=function(e){return f(Kf,"Error decoding JS walletSentry: "+e,fi)},ek=function(e){return{$:"ErrorDecoding",a:e}},tk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),rk=l(Fi,r(function(e,t){return{ref:e,txHash:t}}),f(vh,"ref",kC),f(vh,"txHash",nA(qE))),nk=function(e){var t=f(wh,rk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(tk,r.ref,di(a))}return f(tk,r.ref,li("Problem signing/broadcasting Tx. Ref #"+Ri(r.ref)))}t.a;return ek("Error decoding tx data")},ak=function(e){var t=e.a;return f(jB,t.tagger,t.inPort(nk))},ik=f(Mi,hB,kC),ok=Wo(f(Ao,xl,f(Ao,cd("Failure decoding stringy int"),Oo(hB)))),uk=LE(F([ok,ik])),sk=r(function(e,t){return{account:e,networkId:t}}),ck=l(Fi,sk,f(vh,"account",nA(OE)),f(vh,"networkId",uk)),fk=n(function(e,t,r){var n=f(wh,ck,r);if("Err"===n.$){var a=n.a;return e(Ui(a))}return t(n.a)}),lk=function(e){var t=f(Ao,ZB,f(Ao,ga,OS));return vB(O(F([f(PB,1e3,JB),zB(f(fk,t,XB)),f(pc,yB,f(Bo,ak,e.txSentry)),GB(QB),vB(f(ki,r(function(e,t){return f(jB,KS(e),t)}),f(Pa,WB,e.tradeCaches)))]),F([qB(e)])))},dk=function(e){return{$:"LinkClicked",a:e}},hk=function(e){return{$:"UrlChanged",a:e}},pk=n(function(e,t,r){return d(jI,e/255,t/255,r/255,1)}),gk=l(pk,10,33,108),vk={$:"Generic"},yk=vk,mk=r(function(e,t){return d(VI,nT,yk,f(Na,XS(JS),f(Na,YS(JS),e)),tT(F([t])))}),bk=function(e){return{$:"Fill",a:e}},Ck=bk(1),Ek=ji,Sk=function(e){return{$:"Px",a:e}},Tk=Sk,wk=RT(8),Ik=function(e){return f(YI,wk,l(zI,"bg-"+WI(e),"background-color",e))},Ak=f(mk,F([XS(Ck),YS(Tk(150)),Ik(gk)]),Ek),Bk=function(e){return{$:"GotoRoute",a:e}},kk={$:"Active"},Nk={$:"Important"},Rk={$:"Normal"},$k=l(qI,1,1,1),_k=RT(2),Lk=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),xk=r(function(e,t){return $(e,t)?f(YI,_k,h(Lk,"p-"+Ri(e),e,e,e,e)):f(YI,_k,h(Lk,"p-"+Ri(e)+"-"+Ri(t),t,e,t,e))}),Pk=RT(21),Dk=r(function(e,t){return{$:"Class",a:e,b:t}}),Uk=f(Dk,Pk,uT.cursorPointer),Ok=RT(17),Mk=function(e){return f(YI,Ok,l(EI,"br-"+Ri(e),"border-radius",Ri(e)+"px"))},Fk=function(e){return{$:"Normal",a:e}},Vk=Bn,Kk=r(function(e,t){return f(Vk,e,Fk(t))}),Hk=function(e){return f(Kk,"click",Vi(e))},jk=f(Ua,ZS,Hk),qk=RT(13),Gk=f(Dk,qk,uT.textSemiBold),zk=RT(4),Yk=function(e){return{$:"FontSize",a:e}},Wk=function(e){return f(YI,zk,Yk(e))},Jk=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return mr;case"Active":return F([Mk(4),Ik(l(qI,0,0,1))]);default:return F([Mk(4),Ik(l(qI,.9,0,0))])}}();return f(mk,O(F([f(xk,23,12),Wk(22),Gk,JI($k),Uk,jk(t)]),n),Vf(e))}),Qk=l(pk,244,0,103),Xk=function(e){return{$:"AlignX",a:e}},Zk={$:"CenterX"},eN=Xk(Zk),tN=RT(3),rN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),nN=r(function(e,t){return"spacing-"+Ri(e)+"-"+Ri(t)}),aN=function(e){return f(YI,tN,l(rN,f(nN,e,e),e,e))},iN=function(e){return{$:"Describe",a:e}},oN={$:"Paragraph"},uN=r(function(e,t){return d(VI,CT,yk,f(Na,iN(oN),f(Na,XS(Ck),f(Na,aN(5),e))),tT(t))}),sN=f(Dk,qk,uT.bold),cN=f(mk,F([Wk(29),JI($k),sN,eN,Uk,jk(Bk(Cv))]),f(uN,mr,F([Vf("DAI"),f(mk,F([JI(Qk)]),Vf("Hard"))]))),fN={$:"Right"},lN=Xk(fN),dN={$:"AsColumn"},hN=dN,pN=r(function(e,t){return d(VI,hN,yk,f(Na,KI(uT.contentTop+" "+uT.contentLeft),f(Na,YS(JS),f(Na,XS(JS),e))),tT(t))}),gN={$:"AsRow"},vN=gN,yN=r(function(e,t){return d(VI,vN,yk,f(Na,KI(uT.contentLeft+" "+uT.contentCenterY),f(Na,XS(JS),f(Na,YS(JS),e))),tT(t))}),mN=function(e){return f(yN,F([XS(Ck),aN(30),f(xk,30,17)]),F([l(Jk,"Browse Offers",Bk(Ev),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return kk}return Rk}()),l(Jk,"Create a New Offer",Bk(bv),function(){return"CreateModel"===e.submodel.$?kk:Rk}()),function(){var t=wd(e.wallet);if("Just"===t.$){var r=t.a;return l(Jk,"My Trades",Bk(mv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return $(t.a.agentAddress,r.address)?kk:Rk}return Rk}())}return l(Jk,"Connect to Wallet",FS,Nk)}(),f(pN,F([lN,aN(0),f(xk,8,0)]),F([cN]))]))},bN=jI,CN=r(function(e,t){return f(mk,F([Mk(4),Ik(d(bN,0,0,1,.1)),JI(l(pk,16,7,234)),Wk(e),Gk,f(xk,15,13)]),Vf(Hf(t)))}),EN=a(function(e,t,r,n){return"pad-"+Ri(e)+"-"+Ri(t)+"-"+Ri(r)+"-"+Ri(n)}),SN=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return $(t,r)&&$(t,n)&&$(t,a)?f(YI,_k,h(Lk,"p-"+Ri(t),t,t,t,t)):f(YI,_k,h(Lk,d(EN,t,r,n,a),t,r,n,a))},TN=function(e){return function(){var t=wd(e.wallet);return"Nothing"!==t.$&&$(t.a.address,e.agentAddress)}()?f(mk,F([f(xk,30,10),Wk(24),Gk]),Vf("Your Trades")):f(yN,F([aN(10),SN({bottom:30,left:30,right:30,top:10})]),F([f(mk,F([Wk(24),Gk]),Vf("Trade History for User")),f(CN,18,e.agentAddress)]))},wN=function(e){return function(t){return $(t.parameters.initiatorAddress,e.agentAddress)||$(t.state.responder,ci(e.agentAddress))}},IN=function(e){return Wf(e)},AN={$:"BurnWindow"},BN={$:"FiatPrice"},kN={$:"Margin"},NN={$:"Offer"},RN={$:"PaymentWindow"},$N=function(e){return{$:"AlignY",a:e}},_N={$:"CenterY"},LN=$N(_N),xN=RT(20),PN=f(Dk,xN,uT.clip),DN=bk,UN=function(e){return f(YI,_k,h(Lk,"p-"+Ri(e),e,e,e,e))},ON=r(function(e,t){return f(mk,F([XS(DN(e)),YS(Tk(60)),PN,Ik($k)]),f(mk,F([UN(12),LN,XS(Ck)]),t))}),MN=function(e){switch(e.$){case"Phase":return 1;case"Expires":return 2;case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},FN=function(e){return{$:"JustImage",a:e}},VN=FN({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),KN=HS("alt"),HN=function(e){return f(HS,"src",nt(e))},jN=r(function(e,t){var r=t.src,n=t.description,a=f(Wf,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(VI,nT,yk,f(Na,KI(uT.imageContainer),e),tT(F([d(VI,nT,eT("img"),O(F([ZS(HN(r)),ZS(KN(n))]),a),tT(mr))])))}),qN=r(function(e,t){if("None"===t.$)return Ek;var r=t.a;return f(jN,e,r)}),GN=FN({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),zN=function(e){return{$:"ChangeSort",a:e}},YN=f(Dk,qk,uT.textMedium),WN=function(e){return f(mk,F([YN,Wk(17)]),Vf(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},JN=r(function(e,t){return f(yN,F([aN(5),Uk,jk(zN(e))]),F([WN(e),function(){if("Just"===t.$){var e=t.a;return f(mk,F([LN]),f(qN,F([XS(Tk(8))]),function(){return"Ascending"===e.$?GN:VN}()))}return Ek}()]))}),QN=r(function(e,t){return f(ON,MN(t),f(JN,t,e))}),XN=r(function(e,t){return f(yN,F([XS(Ck)]),f(Pa,function(t){var r=$(e.a,t)?ci(e.b):fi;return f(QN,r,t)},t))}),ZN=l(pk,150,150,150),eR=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},tR=r(function(e,t){return f(Pu,e.amount,t.amount)}),rR=r(function(e,t){return f(Pu,Sl(e),Sl(t))}),nR=n(function(e,t,r){return f(e,r,t)}),aR=function(e){var t=e.a;return($(e.b,ho)?nR:Oa)(function(){switch(t.$){case"Phase":return r(function(e,t){return $(e.state.phase,t.state.phase)?l(aR,x(Qg,Rf),e,t):f(Su,eR(e.state.phase),eR(t.state.phase))});case"Expires":return r(function(e,t){return f(Gg,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(rR,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(tR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(pc,ba,l(Id,r(function(e,t){return f(Su,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(Gg,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(Gg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},iR=l(pk,233,237,242),oR=function(e){return f(mk,F([XS(Ck),YS(Ck),PN]),f(uN,F([Wk(12)]),F([Vf(e.info)])))},uR=function(e){return f(pc,Ek,f(Bo,oR,Nl(e)))},sR=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"}},cR=function(e){return{$:"TimeLeft",a:e}},fR=function(e){return{$:"TimeUp",a:e}},lR=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 bl(0)}}),dR=r(function(e,t){return bl(Sd(e)-Sd(t))}),hR=r(function(e,t){var r=f(lR,t.state.phase,t),n=f(dR,e,t.state.phaseStartTime),a=f(dR,r,n);return Sd(a)>0?cR(x(a,r)):fR(r)}),pR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},gR=l(qI,0,0,0),vR=l(pk,51,183,2),yR=function(e){var t=wu(100*e),r=t-ei(t),n=Ri(ei(t)),a=f(ti,0,3-$o(n));return n+(function(){if(a){return f(Do,a+1,f(Lo,1,WT(r)))}return""}()+"%")},mR=r(function(e,t){return FN({description:"",src:function(){var r=x(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"}()})}),bR=n(function(e,t,r){return f(qN,f(Na,YS(Tk(34)),e),f(mR,t,r))}),CR=r(function(e,t){var r=yR(t);if("0%"===r)return f(mk,F([Wk(16)]),Vf("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?vR:Qk;return f(yN,F([aN(4)]),F([l(bR,mr,a,ci(i)),f(mk,F([JI(o),Wk(16)]),Vf(n))]))}),ER=FN,SR=function(e){return l($a,r(function(e,t){var r=e.a,n=e.b;return l(ll,r,n,t)}),Vh,e)}(f(Pa,function(e){var t=e.a;return x(t,x(e.b,ER({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},F([x("AUD","$"),x("CLP","$"),x("EUR","€"),x("IDR","Rp"),x("KRW","₩"),x("NZD","$"),x("RUB","₽"),x("TRY","₺"),x("BRL","R$"),x("CNY","¥"),x("GBP","£"),x("ILS","₪"),x("MXN","$"),x("PHP","₱"),x("SEK","kr"),x("TWD","NT$"),x("CAD","$"),x("CZK","Kč"),x("HKD","$"),x("INR","₹"),x("MYR","RM"),x("PKR","₨"),x("SGD","$"),x("USD","$"),x("CHF","Fr"),x("DKK","kr"),x("HUF","Ft"),x("JPY","¥"),x("NOK","kr"),x("PLN","zł"),x("THB","฿"),x("ZAR","R"),x("VND","₫")]))),TR=function(e){return f(pc,"",f(Bo,Xa,f(Kh,e,SR)))},wR=function(e){return $o(e)<=3?e:wR(f(td,3,e))+","+f(Fo,3,e)},IR=function(e){return wR(ed(e))},AR=function(e){return O(TR(e.fiatType),IR(e.amount))},BR=function(e){var t=function(){var t=f(Kh,e.fiatType,SR);if("Nothing"===t.$)return Ek;var r=t.a,n=(r.a,r.b);return f(qN,F([YS(Tk(26))]),n)}();return f(yN,F([aN(4)]),F([t,f(mk,F([JI(d(bN,0,0,0,.5)),YN,XS(Tk(50))]),Vf(e.fiatType)),Vf(AR(e))]))},kR=function(e){return Sd(e)<0},NR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),RR=function(e){var t=Yp(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(NR,Mb(t),Mb(r),Mb(n),Mb(a))}(f(pc,x(Iu(0),Iu(0)),f(ns,n,Iu(60))))}(f(pc,x(Iu(0),Iu(0)),f(ns,r,Iu(3600))))}(f(pc,x(Iu(0),Iu(0)),f(ns,t,Iu(86400))))},$R=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!kR(a)){var u=r(function(e,t){return O(l(fs,2,D("0"),Ri(e)),t)}),s=Sd(a)>0?i:o,c=RR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(yN,O(F([aN(5)]),e),F([f(mk,O(F([JI(h)]),t),Vf(f(u,c.days,"d"))),f(mk,O(F([JI(d)]),t),Vf(f(u,c.hours,"h"))),f(mk,O(F([JI(s)]),t),Vf(f(u,c.min,"m")))]))}var p=e,g=t,v=x(i,o),y=bl(0);e=p,t=g,n=v,a=y}}),_R={$:"Behind"},LR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),xR=function(e){return f(LR,_R,e)},PR=r(function(e,t){var r=Vg(200*e),n=200-r,a=f(mk,F([XS(DN(n))]),Ek),i=F([YS(Tk(3)),Mk(20)]),o=f(mk,O(i,F([XS(DN(r)),Ik(t)])),Ek),u=f(mk,O(i,F([XS(Ck),Ik(iR)])),Ek);return f(yN,F([XS(Ck),xR(u)]),F([o,a]))}),DR=l(qI,1,1,0),UR=r(function(e,t){return Sd(e)/Sd(t)}),OR=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(UR,o,u),c=(f(mk,F([eN]),d($R,mr,mr,x(a,i),o)),s<.1?Qk:s<.2?DR:vR);return f(pN,O(F([aN(5)]),e),F([d($R,F([eN]),t,x(a,i),o),f(PR,1-s,c)]))}),MR=function(e){var t=rd(Sl(e)),r=f(Rl,".",t);if(!r.b)return t;if(r.b.b){Ff("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Do,3,t);case 1:return f(Do,4,f(pc,t,f(Bo,WT,f(Bo,function(e){return e/100},f(Bo,Ha,f(Bo,Vg,f(Bo,ri(100),id(t))))))));default:var n=r.a;return f(pc,f(Do,n,t),f(Bo,Ri,f(Bo,Vg,id(t))))}},FR=n(function(e,t,r){return f(ON,MN(t),function(){switch(t.$){case"Phase":return Vf(pR(r.state.phase));case"Expires":if("Open"===r.state.phase.$){var n=f(hR,e,r);if("TimeLeft"===n.$){var a=n.a,i=f(UR,a.a,a.b)<.05?Qk:gR;return d(OR,F([XS(Ck)]),F([Wk(16)]),x(i,iR),a)}var o=n.a;return d(OR,F([XS(Ck)]),F([Wk(16)]),x(Qk,iR),x(bl(0),o))}return Ek;case"Offer":return f(yN,F([aN(5)]),F([Vf(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(MR(r.parameters.tradeAmount)+" ")+sR(r.factory))]));case"FiatPrice":return BR(r.terms.price);case"Margin":var u=$(r.parameters.initiatorRole,cb);return f(pc,Ek,f(Bo,CR(u),r.derived.margin));case"PaymentWindow":var s=function(){return"Seller"===r.parameters.initiatorRole.$?Qk:vR}(),c=L(Sd(r.parameters.autoabortInterval),216e5)<0?s:gR;return d($R,mr,mr,x(c,iR),r.parameters.autoabortInterval);default:var s=function(){return"Seller"===r.parameters.initiatorRole.$?vR:Qk}(),c=L(Sd(r.parameters.autoabortInterval),216e5)<0?s:gR;return d($R,mr,mr,x(c,iR),r.parameters.autoreleaseInterval)}}())}),VR=n(function(e,t,r){return f(pN,F([XS(Ck),aN(1),Ik(iR),XS(DN(7))]),F([f(yN,F([XS(DN(6)),aN(1)]),f(Pa,function(t){return l(FR,e,t,r)},t)),f(ON,1,uR(r.terms.paymentMethods))]))}),KR=Sr,HR=RT(28),jR=function(e){return f(YI,HR,l(zI,"bc-"+WI(e),"border-color",e))},qR=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),GR=function(e){return f(YI,DI,h(qR,"b-"+Ri(e),e,e,e,e))},zR=a(function(e,t,r,n){return f(pN,F([XS(Ck),GR(2),Mk(8),jR(ZN),aN(2),Ik(ZN),PN]),f(Pa,f(VR,e,r),f(KR,aR(t.orderBy),n)))}),YR=a(function(e,t,r,n){return f(pN,F([XS(Ck),YS(Ck),UN(30),aN(5)]),F([f(XN,t.orderBy,r),d(zR,e,t,r,n)]))}),WR=n(function(e,t,r){return $(t,mr)?Ek:f(Wi,So,d(YR,e,r.tradeTable,F([po,NN,BN,kN,RN,AN]),t))}),JR=function(e){return f(Wf,function(e){return Gm(e.parameters)},yS(e))},QR={$:"NoneFound"},XR={$:"AllFetched"},ZR={$:"FetchingTrades"},e$={$:"QueryingNumTrades"},t$=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return e$;if(t.a){var r=t.a;return L(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?ZR:XR}return QR},r$=n(function(e,t,r){var n=_v(f(Pa,function(e){return f(IN,wN(r),JR(e))},t)),a=n,i=function(e){return f(mk,F([Wk(24),Gk,JI(ZN),eN,UN(20)]),Vf(e))},o=f(Zd,Qa(QR),f(Pa,t$,t))?F([i("No trades found.")]):f(Pa,i,AC(f(Pa,function(e){switch(t$(e).$){case"QueryingNumTrades":return ci(HA(e.factory)+"Querying Factory...");case"NoneFound":return fi;case"FetchingTrades":return ci(HA(e.factory)+"Fetching Trades");default:return fi}},t)));return f(pN,F([aN(10)]),F([function(){return o.b?f(pN,F([aN(5)]),o):Ek}(),l(WR,e,a,r)]))}),n$=n(function(e,t,r){return f(pN,F([Mk(5),Ik($k),XS(Ck),YS(Ck),f(xk,0,20)]),F([TN(r),l(r$,e,t,r)]))}),a$=function(e){return{$:"ShowCurrencyDropdown",a:e}},i$={$:"AbortCreate"},o$=function(e){return{$:"AppCmd",a:e}},u$=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),s$=function(e){return f(Pa,function(e){return F([f(mk,F([JI(Qk)]),Vf("Caution! ")),Vf(e)])},AC(F([$(f(Gg,e.autoreleaseInterval,bl(12e5)),Ca)?ci(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."}()):fi,$(f(Gg,e.autoabortInterval,bl(36e5)),Ca)?ci(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.'}()):fi])))},c$=l(qI,0,0,1),f$=function(e){return f(mk,F([SN({bottom:5,left:5,right:5,top:0}),jk(e),Mk(30),Ik(d(bN,1,1,1,.4)),GR(1),jR(d(bN,0,0,0,.3)),Uk,Wk(14)]),f(mk,F([JI(d(bN,0,0,0,.7))]),Vf("x")))},l$=kn,d$=l$,h$=ZS,p$=r(function(e,t){return f(mk,F([xR(f(mk,F([Ik(e),h$(f(d$,"position","fixed")),h$(f(d$,"z-index","1000")),h$(f(d$,"top","0")),h$(f(d$,"left","0")),h$(f(d$,"width","100%")),h$(f(d$,"height","100%"))]),Ek)),XS(Ck),YS(Ck)]),t)}),g$={$:"Top"},v$=$N(g$),y$={$:"InFront"},m$=function(e){return f(LR,y$,e)},b$=r(function(e,t){return{$:"Max",a:e,b:t}}),C$=r(function(e,t){return f(b$,e,t)}),E$=n(function(e,t,r){return l(Da,p$,d(bN,0,0,.3,.6),f(mk,O(F([eN,LN,XS(f(C$,500,JS)),Ik($k),Mk(8),m$(f(mk,F([lN,v$]),f$(r)))]),e),t))}),S$=r(function(e,t){if("Nothing"===t.$)return Ek;var r=t.a;return f(mk,O(F([Mk(5),jR(l(qI,.9,0,0)),GR(1),Ik(l(qI,1,.4,.4)),UN(5),eN,LN,XS(f(C$,200,JS)),Wk(14)]),e),f(uN,mr,F([Vf(r)])))}),T$={$:"Above"},w$=function(e){return f(LR,T$,e)},I$=RT(26),A$=function(e){return{$:"MoveY",a:e}},B$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),k$=function(e){return f(B$,I$,A$(-e))},N$=r(function(e,t){return f(mk,F([Mk(4),f(xk,25,17),Wk(18),Gk,Ik(iR),w$(f(S$,F([k$(5)]),t))]),Vf(e))}),R$=a(function(e,t,r,n){return d(jI,e/255,t/255,r/255,n)}),$$=d(R$,1,31,52,.64),_$=RT(32),L$={$:"Active"},x$=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),P$=_n,D$={$:"NoAttribute"},U$=r(function(e,t){switch(t.$){case"NoAttribute":return D$;case"Describe":var r=t.a;return iN(r);case"AlignX":var n=t.a;return Xk(n);case"AlignY":var a=t.a;return $N(a);case"Width":var n=t.a;return QS(n);case"Height":var n=t.a;return zS(n);case"Class":var n=t.a,a=t.b;return f(Dk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(YI,i,o);case"Nearby":var u=t.a,s=t.b;return f(LR,u,f(Yi,e,s));case"Attr":var c=t.a;return ZS(f(P$,e,c));default:var l=t.a,d=t.b;return f(B$,l,d)}}),O$=function(e){return f(U$,Ag,e)},M$=r(function(e,t){var r=t.a,n=t.b,a=O$(e);switch(a.$){case"StyleClass":var i=a.b;return x(f(Na,i,r),n);case"TransformComponent":var o=(a.a,a.b);return x(r,f(LI,n,o));default:return x(r,n)}}),F$=function(e){var t=l($a,M$,x(mr,MI),e),r=t.a,n=t.b;return f(Na,SI(n),r)},V$=function(e){return f(YI,_$,f(x$,L$,F$(e)))},K$=RT(33),H$={$:"Hover"},j$=function(e){return f(YI,K$,f(x$,H$,F$(e)))},q$=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(mk,F([Mk(4),Uk,jk(n),f(xk,25,17),JI(t),Wk(18),Gk,Ik(a),V$(F([Ik(o)])),j$(F([Ik(i)]))]),Vf(r))}),G$=r(function(e,t){return d(q$,P(d(bN,1,0,0,1),d(bN,1,0,0,.8),d(bN,1,0,0,.6)),$k,e,t)}),z$=RT(12),Y$=f(Dk,z$,uT.textCenter),W$=function(e){return p$(d(bN,0,0,.3,.6))(f(pN,F([aN(10),eN,LN,Ik(d(bN,0,0,0,.5)),Mk(8),UN(20)]),f(Pa,function(e){return f(uN,F([eN,LN,Wk(20),Gk,JI($k),Y$]),F([e]))},e)))},J$=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+iA(t)}e.a;return"https://kovan.etherscan.io/tx/"+iA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+iA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+iA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+iA(t)}}),Q$={$:"Bottom"},X$=$N(Q$),Z$=KI(uT.underline),e_=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return x(Vf(MR(lb(a))),f(G$,"Yes, I definitely want to open this trade.",l(u$,r,n,a)))}return x(Vf("??"),f(N$,"(loading exact fees...)",fi))}(),i=a.a,o=a.b;return l(E$,mr,f(pN,F([aN(20),UN(20),eN,YS(Ck),Y$]),F([f(mk,F([Wk(26),Gk,eN,LN]),Vf("Just to Confirm...")),f(pN,F([aN(20),eN,LN]),f(Pa,uN(F([eN,Wk(18),YN,JI($$)])),O(s$(n),O(F([F([Vf("You will deposit "),i,Vf(" "+sR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?F([F([Vf("This ususally requires two Metamask signatures. Your "+sR(r)+" will not be deposited until the final transaction has been mined.")])]):mr}())))),f(mk,F([X$,eN]),o)])),i$);case"ApproveNeedsSig":var u=e.a;return f(mk,F([jk(o$(d($d,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),W$(F([Vf("Waiting for user signature for the approve call."),Vf("(check Metamask!)"),Vf("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(mk,F([jk(o$(d($d,"txChainModal clicked","misclick","ApproveMining",0)))]),W$(F([Vf("Mining the initial approve transaction..."),f(HI,F([Z$,JI(c$)]),{label:Vf("See the transaction on Etherscan"),url:f(J$,to(u),s)}),Vf("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(mk,F([jk(o$(d($d,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),W$(F([Vf("Waiting for user signature for the create call."),Vf("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(mk,F([jk(o$(d($d,"txChainModal clicked","misclick","CreateMining",0)))]),W$(F([Vf("Mining the final create call..."),f(HI,F([Z$,JI(c$)]),{label:Vf("See the transaction on Etherscan"),url:f(J$,r,s)}),Vf("You will be redirected when it's mined.")])))}}),t_=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Ek;var r=t.a;return f(e_,r,e)},r_=function(e){return{$:"TradeAmountChanged",a:e}},n_=HS("id"),a_=h$(n_("inputError")),i_=l(pk,109,127,138),o_=FN({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),u_=function(e){return f(qN,f(Na,YS(Tk(26)),e),o_)},s_=function(e){return f(yN,F([aN(4)]),F([u_(mr),f(mk,F([Wk(24),YN,JI(i_)]),Vf(sR(e)))]))},c_={$:"Left"},f_=Xk(c_),l_=function(e){return{$:"HiddenLabel",a:e}},d_=l_,h_=HS("type"),p_=function(e){return x(e,!0)},g_=function(e){return{$:"MayStopPropagation",a:e}},v_=r(function(e,t){return f(Vk,e,g_(t))}),y_=r(function(e,t){return l(xa,vh,t,e)}),m_=f(y_,F(["target","value"]),Yo),b_=function(e){return f(v_,"input",f(Mi,p_,f(Mi,e,m_)))},C_=RT(0),E_=r(function(e,t){return{$:"Transparency",a:e,b:t}}),S_=function(e){var t=function(e){return 1-e}(f(nc,1,f(ti,0,e)));return f(YI,C_,f(E_,"transparency-"+HT(t),t))},T_=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),w_=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(VI,hN,eT("label"),e,tT(F([r])))}var n=t.a,a=t.b,i=t.c,o=d(VI,nT,yk,a,tT(F([i])));switch(n.$){case"Above":return d(VI,hN,eT("label"),e,tT(F([o,r])));case"Below":return d(VI,hN,eT("label"),e,tT(F([r,o])));case"OnRight":return d(VI,vN,eT("label"),e,tT(F([r,o])));default:return d(VI,vN,eT("label"),e,tT(F([o,r])))}}),I_=lI,A_=f(Ua,ZS,I_("autocomplete")),B_=l(qI,136/255,138/255,133/255),k_=l(qI,186/255,189/255,182/255),N_=f(xk,12,12),R_=l(qI,1,1,1),$_=F([N_,Mk(3),jR(k_),Ik(R_),GR(1),aN(3),XS(Ck)]),__=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},L_=function(e){return f(Xd,__,e)?D$:KI("focusable")},x_=function(e){return{$:"Label",a:e}},P_=function(e){if("HiddenLabel"===e.$){var t=e.a;return iN(x_(t))}return D$},D_=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},U_=function(e){return"HiddenLabel"===e.$},O_=me,M_=r(function(e,t){return f(Nn,e,O_(t))}),F_=M_("spellcheck"),V_=f(Ua,ZS,F_),K_=J,H_=RT(47),j_=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(wi(K_(e))),o=(i-1)*t+f(pc,0,f(Bo,a,r))+f(pc,0,f(Bo,a,n));return f(YI,H_,l(EI,"textarea-height-"+Ri(i),"height",function(e){return"calc("+Ri(e)+"em + "+Ri(o)+"px) !important"}(i)))}),q_=HS("value"),G_=f(Ua,ZS,q_),z_={$:"LivePolite"},Y_=iN(z_),W_=function(e){return l(xa,r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"NoAttribute":return x(r,n);case"Class":e.a;return x(f(Na,e,r),n);case"Attr":e.a;return x(f(Na,e,r),n);case"StyleClass":e.b;return x(f(Na,e,r),n);case"Width":e.a;return f(VT,"width",n)?x(r,n):x(f(Na,e,r),f(iS,"width",n));case"Height":e.a;return f(VT,"height",n)?x(r,n):x(f(Na,e,r),f(iS,"height",n));case"Describe":e.a;return f(VT,"described",n)?x(r,n):x(f(Na,e,r),f(iS,"described",n));case"Nearby":e.a,e.b;return x(f(Na,e,r),n);case"AlignX":return f(VT,"align-x",n)?x(r,n):x(f(Na,e,r),f(iS,"align-x",n));case"AlignY":return f(VT,"align-y",n)?x(r,n):x(f(Na,e,r),f(iS,"align-y",n));default:return f(VT,"transform",n)?x(r,n):x(f(Na,e,r),f(iS,"transform",n))}}),x(mr,Dy),e).a},J_=r(function(e,t){return l(xa,r(function(e,r){return t(e)?f(Na,e,r):r}),mr,W_(e))}),Q_=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}},X_=f(Ua,zi,Xu),Z_=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=F([ZS(b_(n.onChange))]),o=O($_,t),u=f(J_,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(Wf,D_,o),c=f(J_,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(J_,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(J_,o,function(e){return"Nearby"===e.$})),p=f(Wf,f(Ua,Uu,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return P("input",O(F([G_(n.text),ZS(h_(a)),V_(e.spellchecked),KI(uT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return D$;var r=t.a;return A_(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(Na,e,t.adjustedAttributes),heightContent:ci(Q_(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(Na,e,t.adjustedAttributes),maybeBorder:ci(d(T_,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:ci(d(T_,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(Na,e,t.adjustedAttributes),maybeSpacing:ci(g)}):t;default:break e}default:break e}return U(t,{adjustedAttributes:f(Na,e,t.adjustedAttributes)})}),{adjustedAttributes:mr,heightContent:fi,maybeBorder:fi,maybePadding:fi,maybeSpacing:fi},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(pc,5,c);return P("textarea",O(F([V_(e.spellchecked),KI(uT.inputMultiline),f(pc,D$,f(Bo,A_,e.autofill)),function(){if("Nothing"===u.$)return D$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return SN({bottom:f(ti,0,n-(v/2|0)),left:a,right:r,top:f(ti,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?D$:s.a?d(j_,n.text,v,u,g):D$}()]),h),F([X_(uI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(VI,nT,yk,f(Na,XS(Ck),_v(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([m$(f(mk,f(Na,N_,O(s,O(F([JI(B_),KI(uT.noTextSelection+" "+uT.passPointerEvents),jR(d(bN,0,0,0,0)),Ik(d(bN,0,0,0,0)),YS(Ck),XS(Ck),S_(""===n.text?1:0)]),r))),a))])}()]))),tT(F([d(VI,nT,eT(v),_v(F([F([L_(t),P_(n.label)]),y,i])),tT(m))])));return l(w_,f(Na,f(Dk,Pk,uT.cursorText),f(Na,U_(n.label)?D$:aN(5),f(Na,Y_,u))),n.label,b)}),eL=Z_({autofill:fi,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),tL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(eL,F([XS(Ck),YS(Tk(40)),GR(0)]),{label:d_(r),onChange:i,placeholder:n,text:a});return f(yN,O(F([aN(5)]),e),AC(F([f(Bo,mk(F([f_])),o),ci(s),f(Bo,mk(F([lN])),u)])))}),rL={$:"Below"},nL=function(e){return f(LR,rL,e)},aL=function(e){return f(B$,I$,A$(e))},iL=n(function(e,t,r){return p(tL,F([XS(Tk(150)),YN,Wk(24),nL(f(S$,F([a_,aL(5)]),r))]),x(fi,ci(f(mk,F([jk(o$(d($d,"click","misclick","dai symbol in dai input",0)))]),s_(e)))),"dai input",fi,t,r_)}),oL=r(function(e,t){return f(YI,DI,h(qR,"b-"+Ri(e)+"-"+Ri(t),t,e,t,e))}),uL=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return $(r,t)&&$(n,a)?$(r,a)?GR(r):f(oL,n,r):f(YI,DI,h(qR,"b-"+Ri(r)+"-"+Ri(a)+"-"+Ri(t)+"-"+Ri(n),r,a,t,n))},sL=mk(F([jR(iR),uL({bottom:2,left:0,right:0,top:0})])),cL=r(function(e,t){return f(pN,F([aN(10)]),F([f(mk,F([Wk(17),Gk]),Vf(e)),t]))}),fL=r(function(e,t){return sL(f(cL,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(iL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),lL=function(e){return f(pc,IE,mg(e))},dL=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 "+MR(f(wl,r,100))+" "+sR(lL(e.wallet))+"."}return"There is a 1% fee."}();return f(yN,F([eN,f(xk,20,10),Ik(l(pk,10,33,108)),Mk(8),aN(5),jk(o$(d($d,"click","misclick","fee notify element",0)))]),F([f(mk,F([Wk(18),JI(l(pk,0,226,255)),Gk]),Vf(t)),f(mk,F([Wk(17),JI($k),YN]),Vf("We only collect this fee when trades resolve successfully."))]))},hL=function(e){return{$:"ChangeRole",a:e}},pL=d(R$,1,31,52,.13),gL=r(function(e,t){var r=F([Wk(24),YN,Uk]),n=function(){return"Buyer"===t.$?x(r,O(r,F([JI(pL)]))):x(O(r,F([JI(pL)])),r)}(),a=n.a,i=n.b;return f(yN,F([aN(20)]),F([f(mk,O(F([jk(hL(yl))]),i),Vf("Sell "+e)),f(mk,O(F([jk(hL(cb))]),a),Vf("Buy "+e))]))}),vL=r(function(e,t){return f(cL,"Trade Type",f(gL,sR(e),t.inputs.userRole))}),yL=RT(19),mL=function(e){return Xl(F([e.inset?"box-inset":"box-",WT(e.offset.a)+"px",WT(e.offset.b)+"px",WT(e.blur)+"px",WT(e.size)+"px",WI(e.color)]))},bL=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(YI,yL,l(EI,mL(t),"box-shadow",QT(t)))},CL=bL({blur:20,color:d(R$,0,0,0,.04),offset:x(0,3),size:0}),EL=f(Dk,tN,uT.spaceEvenly),SL=function(e){var t=mg(e.wallet);if("Just"===t.$){var r=t.a;return f(pN,F([XS(Ck),aN(20),Ik($k),Mk(5),UN(20),CL]),F([f(yN,F([XS(Ck),EL]),F([f(vL,r,e),f(fL,r,e)])),dL(e)]))}return b("Create.View",{start:{line:75,column:13},end:{line:75,column:23}})("")},TL=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),wL={$:"Web3Connect"},IL=function(e){return f(mk,F([eN]),function(){var t=x(wd(e),mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(G$,"Open Trade",f(TL,n,r))}t.b;return f(N$,"Unsupported Network",fi)}t.a;return f(G$,"Connect to Wallet",wL)}())},AL=function(e){return{$:"AutoabortIntervalChanged",a:e}},BL=function(e){return{$:"ChangePaymentMethodText",a:e}},kL=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),NL=kL,RL=function(e){return f(NL,F([JI(d(bN,0,0,0,.2))]),function(){return Vf("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")}())},$L={$:"TextArea"},_L=r(function(e,t){return l(Z_,{autofill:fi,spellchecked:t.spellcheck,type_:$L},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),LL=n(function(e,t,r){var n=f(mk,F([Wk(22),Gk]),Vf("Payment Method")),a=f(_L,F([XS(Ck),YS(Tk(150)),Ik(d(R$,155,203,255,.2)),GR(0)]),{label:d_("payment method"),onChange:BL,placeholder:""===r?ci(RL(t)):fi,spellcheck:!0,text:r});return f(pN,F([aN(20),SN({bottom:15,left:45,right:45,top:0}),XS(Ck),w$(f(S$,F([a_,aL(30),UN(10),Wk(20),XS(Tk(400))]),e))]),F([n,a]))}),xL=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."},PL=a(function(e,t,r,n){var a=l(fs,e,D("0"),Ri(n));return f(mk,F([Wk(22),JI(t)]),Vf(O(a,r)))}),DL=function(e){return Sd(e)<0?bl(0):e},UL=n(function(e,t,n){var a=r(function(e,r){return f(pN,F([aN(4)]),F([f(mk,F([UN(4),Uk,jk(n(f(Wm,t,e)))]),f(qN,F([YS(Tk(10))]),GN)),r,f(mk,F([UN(4),Uk,jk(n(function(e){return Sd(e)?e:bl(3e5)}(DL(f(dR,t,e)))))]),f(qN,F([YS(Tk(10))]),VN))]))}),i=RR(t);return f(yN,F([EL,aN(10)]),F([f(a,bl(864e5),d(PL,3,e," days",i.days)),f(a,bl(36e5),d(PL,2,e," hours",i.hours)),f(a,bl(3e5),d(PL,2,e," min",i.min))]))}),OL=o(function(e,t,r,n,a,i){var o=f(mk,F([Ik(d(R$,155,203,255,.2)),Mk(5),UN(15),w$(f(S$,F([a_]),a))]),l(UL,gR,n,i)),u=f(yN,F([aN(30)]),F([f(qN,F([YS(Tk(40)),jk(o$(d($d,"click","misclick","symbol for "+t,0)))]),e),f(mk,F([Wk(22),Gk]),Vf(t))])),s=f(uN,F([Wk(17),YN,JI($$)]),F([Vf(r)]));return f(pN,F([XS(Ck),Mk(10),Ik(l(pk,237,237,237)),aN(2)]),f(Pa,mk(F([Ik($k),f(xk,45,18),XS(Ck)])),F([u,f(yN,F([XS(Ck),aN(25),Ik($k)]),F([o,s]))])))}),ML=FN({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),FL=f(Dk,xN,uT.clipX),VL=f(Dk,xN,uT.clipY),KL=i(function(e,t,r,n,a){return f(pN,F([aN(15),Mk(8),FL,VL,Ik($k)]),F([p(OL,ML,"Payment Window",xL(a),r,n,AL),l(LL,t,a,e)]))}),HL=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},jL=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."},qL=FN({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),GL=n(function(e,t,r){return f(mk,F([Mk(8),FL,VL,Ik($k)]),p(OL,qL,"Burn/Release Window",jL(r),e,t,HL))}),zL=function(e){return{$:"AutorecallIntervalChanged",a:e}},YL=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."},WL=FN({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),JL=n(function(e,t,r){return f(mk,F([Mk(8),Ik($k),FL,VL]),p(OL,WL,"Open Window",YL(r),e,t,zL))}),QL=function(e){return f(pN,F([XS(Ck),aN(20)]),F([l(JL,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(KL,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(GL,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},XL=function(e){return f(pN,F([XS(f(C$,1e3,Ck)),eN,aN(20),SN({bottom:30,left:40,right:40,top:0}),jk(a$(!1)),m$(t_(e))]),F([SL(e),QL(e),IL(e.wallet)]))},ZL=os(pm(8226)),ex=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(Na,e,f(Na,t,r))}),o=l(xa,i,mr,a);return f(Na,n,o)}return mr}),tx=r(function(e,t){return l($a,Na,t,e)}),rx=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(tx,r,e),a=t-1,i=r;e=n,t=a,r=i}}),nx=r(function(e,t){var r=wi(t);return!r||$(r,e)?t:L(r,e)<0?_a(f(tx,f(qs,e%r,t),l(rx,mr,e/r|0,t))):f(qs,e,t)}),ax=a(function(e,t,r,n){for(;;){if(!r.b)return _a(n);var a=r.a,i=r.b,o=e(a);if(f(VT,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(iS,o,t),c=i,l=f(Na,a,n);e=u,t=s,r=c,n=l}}}),ix=function(e){return d(ax,Oa,Dy,e,mr)},ox=r(function(e,t){return f(mk,F([XS(Ck),m$(f(yN,F([aN(3),XS(DN(100)),XS(t),PN]),f(ex,f(mk,F([JI(d(bN,0,0,0,.1)),Wk(14)]),Vf(ZL)),f(Pa,f(Ua,mk(F([JI(d(bN,0,0,0,.2))])),Vf),f(nx,100,(e?_a:Oa)(ix(f(Pa,f(Ao,jo,Xa),Aa(SR)))))))))]),Vf(" "))}),ux=r(function(e,t){var r=t.url,n=t.label;return d(VI,nT,eT("a"),f(Na,ZS(jS(r)),f(Na,ZS(qS("noopener noreferrer")),f(Na,XS(JS),f(Na,YS(JS),f(Na,KI(uT.contentCenterX+" "+uT.contentCenterY),e))))),tT(F([n])))}),sx=KI(uT.italic),cx=function(){var e=f(Ua,mk(F([JI(l(qI,.8,.2,.2))])),Vf),t=f(Ua,mk(F([sN])),Vf);return f(pN,F([XS(Ck),YS(Ck),Ik($k),Mk(6),aN(50),bL({blur:20,color:d(R$,0,0,0,.1),offset:x(0,3),size:0}),Mk(10),UN(20)]),F([f(ox,!1,Ck),f(pN,F([eN,XS(f(C$,700,Ck)),aN(20)]),F([f(uN,F([Wk(70),sN,eN,Y$]),F([Vf("DAI"),e("Hard")])),f(yN,F([Wk(30),Gk,eN,Y$,sx]),F([Vf("The "),e("Global"),Vf(", "),e("Unkillable"),Vf(" Crypto Gateway")]))])),f(yN,F([Ik(ZN),aN(2),eN,v$,XS(Ck)]),F([f(mk,F([f(xk,40,10),Ik($k),XS(Ck),YS(Ck)]),f(pN,F([aN(60),lN]),F([f(mk,F([Wk(40),Gk,eN]),Vf("Want to learn more?")),f(ux,F([Mk(4),Uk,f(xk,25,17),Ik(c$),JI($k),sN,Wk(24),eN]),{label:f(uN,F([Y$]),F([Vf("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"})]))),f(mk,F([f(xk,40,10),Ik($k),XS(Ck),YS(Ck)]),f(pN,F([f_,aN(60)]),F([f(mk,F([Wk(40),Gk,eN]),Vf("Ready to try it out?")),f(pN,F([aN(10),XS(Tk(400)),eN]),F([f(uN,F([Wk(24),XS(Ck)]),F([Vf("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f(uN,F([Wk(24),XS(Ck)]),F([Vf("Then follow the links at the top of this page to browse "),t("Sell Offers"),Vf(", browse "),t("Buy Offers"),Vf(", or "),t("Create Your Own Offer"),Vf(".")]))]))])))])),f(mk,F([X$,XS(Ck)]),f(ox,!0,Ck))]))}(),fx=function(e){return{$:"ShowCurrencyDropdown",a:e}},lx=r(function(e,t){return Wf(t(e))}),dx=n(function(e,t,r){return $(t,mr)?Ek:f(Wi,av,d(YR,e,r.tradeTable,F([Qg,NN,BN,kN,RN,AN]),t))}),hx=n(function(e,t,r){var n=l(lx,e,r.filterFunc,_v(f(Pa,JR,t))),a=function(e){return f(mk,F([Wk(24),Gk,JI(ZN),eN,UN(20)]),Vf(e))},i=f(Zd,Qa(QR),f(Pa,t$,t))?F([a("No trades found.")]):f(Pa,a,AC(f(Pa,function(e){switch(t$(e).$){case"QueryingNumTrades":return ci(HA(e.factory)+"Querying Factory...");case"NoneFound":return fi;case"FetchingTrades":return ci(HA(e.factory)+"Fetching Trades");default:return fi}},t)));return f(pN,F([aN(10)]),F([function(){return i.b?f(pN,F([aN(5)]),i):Ek}(),l(dx,e,n,r)]))}),px=function(e){return h$(f(v_,"click",Vi(x(e,!0))))},gx=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(YI,Ok,l(EI,"br-"+Ri(t)+"-"+Ri(r)+Ri(n)+"-"+Ri(a),"border-radius",Ri(t)+"px "+Ri(r)+"px "+Ri(a)+"px "+Ri(n)+"px"))},vx=function(e){return f(Kk,"focus",Vi(e))},yx=f(Ua,ZS,vx),mx=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return mr;var e=o.a;return F([yx(e(!0)),px(e(!0))])}();return f(yN,O(e,F([YS(Tk(40)),bL({blur:20,color:d(R$,233,237,242,.05),offset:x(0,3),size:0})])),F([f(mk,F([Ik(iR),YS(Tk(40)),gx({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(mk,F([LN,f(xk,10,0)]),r)),f(eL,O(s,O(t,F([XS(Tk(100)),YS(Tk(40)),jR(iR),gx({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),uL({bottom:1,left:0,right:1,top:1})]))),{label:d_(n),onChange:u,placeholder:i,text:a})]))}),bx=function(e){return{$:"MaxDaiChanged",a:e}},Cx=function(e){return{$:"MinDaiChanged",a:e}},Ex=r(function(e,t){return f(pN,F([XS(Ck),aN(8)]),F([f(mk,F([Wk(17),YN]),Vf(e)),t]))}),Sx=RT(25),Tx=function(e){return{$:"MoveX",a:e}},wx=function(e){return f(B$,Sx,Tx(-e))},Ix={$:"OnLeft"},Ax=function(e){return f(LR,Ix,e)},Bx=n(function(e,t,r){var n=u_(F([LN])),a=f(yN,F([aN(8),LN,XS(Tk(60))]),F([n,f(mk,F([Wk(16),LN]),Vf("max"))])),i=f(yN,F([aN(8),LN,XS(Tk(60))]),F([n,f(mk,F([Wk(16),LN]),Vf("min"))]));return f(Ex,"Dai Range",f(pN,F([aN(5),XS(Tk(200))]),F([v(mx,F([Ax(f(S$,F([wx(5),XS(Tk(200))]),r.minDai))]),F([yx(fx(!1))]),i,"min Dai",e,fi,fi,Cx),v(mx,F([Ax(f(S$,F([wx(5),XS(Tk(200))]),r.maxDai))]),F([yx(fx(!1))]),a,"max Dai",t,fi,fi,bx)])))}),kx=r(function(e,t){return l(tS,n(function(t,r,n){return f(e,t,r)?l(ll,t,r,n):n}),Vh,t)}),Nx=function(e){return f(kx,r(function(t,r){return f(Rg,e,t)}),SR)},Rx=FN({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),$x=function(e){return f(qN,F([YS(Tk(26))]),f(pc,Rx,f(Bo,jo,f(Kh,e,SR))))},_x=X_,Lx=function(e){return{$:"AppendProperty",a:e}},xx=r(function(e,t){return Lx(e+":"+t)}),Px=r(function(e,t){return f(xx,e,t.value)}),Dx=Px("cursor"),Ux={$:"Compatible"},Ox={cursor:Ux,value:"default"},Mx=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Fx=function(e){return{$:"PseudoClassSelector",a:e}},Vx=function(e){return Mx(Fx(e))}("hover"),Kx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),Hx=Kx,jx=Hx,qx=jx("span"),Gx=r(function(e,t){return f(Nn,tt(e),nt(t))}),zx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),Yx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),Wx=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),Jx=r(function(e,t){return t<>>32-e}),Qx=function(e){var t=e.hash?e.seed^f(Wx,461845907,f(Jx,15,f(Wx,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(Wx,2246822507,r^r>>>16),a=f(Wx,3266489909,n^n>>>13);return(a^a>>>16)>>>0},Xx=r(function(e,t){return f(Wx,5,f(Jx,13,e^f(Wx,461845907,f(Jx,15,f(Wx,3432918353,t)))))+3864292196}),Zx=r(function(e,t){var r=t.hash|(255&mi(e))<";default:return""}},uD=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+"]"}},sD=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f($i,"",f(Na,t,f(Pa,uD,r)));case"UniversalSelectorSequence":var r=e.a;return iu(r)?"*":f($i,"",f(Pa,uD,r));default:var t=e.a,r=e.b;return f($i,"",f(Na,t,f(Pa,uD,r)))}},cD=function(e){var t=e.a,r=e.b;return f($i," ",F([oD(t),sD(r)]))},fD=function(e){var t=e.a,r=e.b,n=e.c,a=f(Na,sD(t),f(Pa,cD,r)),i=f($i,"",F([f(pc,"",f(Bo,iD,n))]));return f(Fs,f($i," ",f(Wf,f(Ua,Uu,fd),a)),i)},lD=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f($i,", ",f(Pa,fD,f(Na,r,n)));return f($i,"",F([i," {\n",e,aD(a),"\n",e,"}"]))}),dD=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(lD,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f($i,",\n",f(Pa,XP,r))+" {\n"+f($i,"\n\n",f(Pa,f(Ua,rD,lD(" ")),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"}},hD=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f($i,"\n\n",f(Wf,f(Ua,Uu,fd),F([WP(t),f($i,"\n",f(Pa,eD,r)),f($i,"\n",f(Pa,tD,n)),f($i,"\n\n",f(Pa,dD,a))])))},pD=function(e){return hD(YP(qP(e)))},gD=function(e){return f($i,"\n\n",f(Pa,pD,e))},vD=function(e){return{$:"Snippet",a:e}},yD=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),mD=function(e){return{$:"StyleBlockDeclaration",a:e}},bD=r(function(e,t){var r=l(mP,t,mr,fi);return vD(F([mD(l(yD,r,mr,e))]))}),CD=function(e){return iu(e)?"unstyled":f(is,D("_"),gs(f(eP,15739,gD(sS(tP(sS(f(bD,e,RP(mr)))))))))},ED=function(e){var t=CD(e),r=f(Gx,"className",jf(t));return l(zx,r,e,t)},SD=a(function(e,t,r,n){return f(e,f(Na,ED(t),r),n)}),TD=function(e){return{$:"Unstyled",a:e}},wD=function(e){return TD(ew(e))},ID=wD,AD=r(function(e,t){return f(wn,e,Ze(t))}),BD=function(e){return Sn(Ze(e))},kD=r(function(e,t){var r=e.b,n=e.c;return iu(r)?t:l(ll,n,r,t)}),ND=function(e){return e.a},RD=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 x(f(Na,x(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l($a,kD,i,s),p=l($a,$D,x(mr,h),c),g=p.a,v=p.b,o=l(BT,u,f(Pa,ND,s),_a(g));return x(f(Na,x(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l($a,kD,i,s),m=l($a,$D,x(mr,h),c),g=m.a,v=m.b,o=d(BD,y,u,f(Pa,ND,s),_a(g));return x(f(Na,x(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l($a,kD,i,s),b=l($a,RD,x(mr,h),c),g=b.a,v=b.b,o=l(AT,u,f(Pa,ND,s),_a(g));return x(f(Na,x(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l($a,kD,i,s),C=l($a,RD,x(mr,h),c),g=C.a,v=C.b,o=d(AD,y,u,f(Pa,ND,s),_a(g));return x(f(Na,x(r,o),a),v)}}),$D=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return x(f(Na,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l($a,kD,n,o),c=l($a,$D,x(mr,s),u),h=c.a,p=c.b,a=l(BT,i,f(Pa,ND,o),_a(h));return x(f(Na,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l($a,kD,n,o),v=l($a,$D,x(mr,s),u),h=v.a,p=v.b,a=d(BD,g,i,f(Pa,ND,o),_a(h));return x(f(Na,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l($a,kD,n,o),y=l($a,RD,x(mr,s),u),h=y.a,p=y.b,a=l(AT,i,f(Pa,ND,o),_a(h));return x(f(Na,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l($a,kD,n,o),m=l($a,RD,x(mr,s),u),h=m.a,p=m.b,a=d(AD,g,i,f(Pa,ND,o),_a(h));return x(f(Na,a,r),p)}}),_D=r(function(e,t){return h(ol,il,e,t,ul,ul)}),LD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(fd(a)){var o=e,u=i;e=o,t=u}else{var o=ci(x(a,n)),u=i;e=o,t=u}}}),xD=function(e){var t=f(LD,fi,e);if("Nothing"===t.$)return Vh;var r=t.a,n=r.a,a=r.b;return f(_D,n,a)},PD=function(e){return{$:"ClassSelector",a:e}},DD=function(e){var t=e.a,r=e.b;return f(bD,r,RP(F([PD(t)])))},UD=function(e){return gD(sS(tP(f(Pa,DD,Aa(e)))))},OD=function(e){return l(BT,"style",mr,sS(ew(UD(e))))},MD=n(function(e,t,r){var n=f(Pa,ND,t),a=xD(t),i=l($a,$D,x(mr,a),r),o=i.a,u=i.b,s=OD(u);return l(BT,e,n,f(Na,s,_a(o)))}),FD=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}}),VD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(FD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),KD=r(function(e,t){return x(f(VD,"_",t),OD(e))}),HD=n(function(e,t,r){var n=f(Pa,ND,t),a=xD(t),i=l($a,RD,x(mr,a),r),o=i.a,u=i.b,s=f(KD,u,o);return l(AT,e,n,f(Na,s,_a(o)))}),jD=a(function(e,t,r,n){var a=f(Pa,ND,r),i=xD(r),o=l($a,RD,x(mr,i),n),u=o.a,s=o.b,c=f(KD,s,u);return d(AD,e,t,a,f(Na,c,_a(u)))}),qD=a(function(e,t,r,n){var a=f(Pa,ND,r),i=xD(r),o=l($a,$D,x(mr,i),n),u=o.a,s=o.b,c=OD(s);return d(BD,e,t,a,f(Na,c,_a(u)))}),GD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(MD,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(qD,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(HD,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(jD,a,t,r,n)}},zD=GD,YD=function(e){return _x(zD(d(SD,qx,F([Vx(F([Dx(Ox)]))]),mr,F([ID(e)]))))},WD=Q,JD=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),QD=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),XD=function(e){return l(xa,r(function(e,t){var r=t.a,n=t.b;return x(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 ci(h(JD,n,a,i,o,u))}return fi}(),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 ci(l(QD,a,t,i))}return fi}())}),x(fi,fi),e)},ZD=r(function(e,t){var r=XD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(VI,vN,yk,f(Na,KI(uT.contentLeft+" "+uT.contentCenterY+" "+uT.wrapped),f(Na,XS(JS),f(Na,YS(JS),e))),tT(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 L(r,u/2|0)>-1&&L(a,s/2|0)>-1?ci(SN({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):fi}return fi}();if("Just"===c.$){var h=c.a;return d(VI,vN,yk,f(Na,KI(uT.contentLeft+" "+uT.contentCenterY+" "+uT.wrapped),f(Na,XS(JS),f(Na,YS(JS),O(e,F([h]))))),tT(t))}var p=-s/2,g=-u/2;return d(VI,nT,yk,e,tT(F([d(VI,vN,yk,f(Na,KI(uT.contentLeft+" "+uT.contentCenterY+" "+uT.wrapped),f(Na,ZS(f(d$,"margin",WT(p)+"px "+WT(g)+"px")),f(Na,ZS(f(d$,"width","calc(100% + "+Ri(u)+"px)")),f(Na,ZS(f(d$,"height","calc(100% + "+Ri(s)+"px)")),f(Na,f(YI,tN,l(rN,o,u,s)),mr))))),tT(t))])))}),eU=i(function(e,t,r,n,a){var i=f(eL,F([XS(Tk(80)),YS(Tk(40)),Wk(24),YN,jR(iR),px(r)]),{label:d_("currency type"),onChange:f(Ao,WD,n),placeholder:fi,text:t}),o=f(Kh,t,SR),u=function(){var r=x(e,o);if(r.a){if("Just"===r.b.$)return Ek;r.b;return f(ZD,F([XS(Tk(350)),jR(gR),GR(1),Ik($k),UN(10),eN]),f(Pa,function(e){var t=e.a,r=e.b,a=r.b;return f(yN,F([XS(Tk(80)),aN(9),f(xk,0,5),px(n(t)),j$(F([Ik(l(qI,.8,.8,1))]))]),F([f(qN,F([YS(Tk(26))]),a),f(mk,F([Wk(16),Gk]),YD(t))]))},Aa(Nx(t))))}return Ek}();return f(yN,F([aN(4),nL(u)]),F([f(mk,F([jk(a)]),$x(t)),i]))}),tU=function(e){var t=f(Kh,e,SR);if("Nothing"===t.$)return Vf("*");var r=t.a,n=r.b;return f(qN,F([YS(Tk(26))]),n)},rU=function(e){return{$:"AppCmd",a:e}},nU=function(e){return{$:"FiatTypeInputChanged",a:e}},aU=n(function(e,t,r){var n=rU(d($d,"click","misclick","currency flag",0)),a=tU(t);f(yN,F([aN(8),LN,XS(Tk(60))]),F([a,f(mk,F([Wk(16),LN]),Vf("max"))])),f(yN,F([aN(8),LN,XS(Tk(60))]),F([a,f(mk,F([Wk(16),LN]),Vf("min"))]));return f(mk,F([v$,XS(Tk(120))]),f(Ex,"Fiat Type",h(eU,e,t,fx(!0),nU,n)))}),iU={$:"AddSearchTerm"},oU=function(e){return{$:"PaymentMethodInputChanged",a:e}},uU=f(vh,"keyCode",kC),sU=function(e){return f(Kk,"keyup",f(Go,function(t){return 13===t?Vi(e):zo(Ri(t))},uU))},cU=function(e){return f(Ex,"Search Payment Methods",f(eL,F([v$,XS(Tk(250)),YS(Tk(40)),jR(iR),bL({blur:20,color:d(R$,233,237,242,.05),offset:x(0,3),size:0}),h$(sU(iU))]),{label:d_("payment methods search"),onChange:oU,placeholder:fi,text:e}))},fU=function(e){return{$:"RemoveTerm",a:e}},lU=function(e){return f(mk,F([UN(3),v$,Uk,jk(fU(e)),Wk(10),JI(Qk)]),Vf("x"))},dU=function(e){if(e.b){var t=e;return f(yN,F([XS(Ck),UN(10),aN(10)]),f(Pa,function(e){return f(yN,F([Ik(d(R$,16,7,234,.2)),Mk(5),UN(4),aN(3)]),F([Vf(e),lU(e)]))},t))}return Ek},hU=n(function(e,t,r){return f(pN,F([aN(10),XS(JS),eN]),F([f(yN,F([XS(JS),aN(10)]),F([f(mk,F([XS(JS),v$]),l(Bx,e.minDai,e.maxDai,t)),f(mk,F([XS(JS),v$]),l(aU,r,e.fiatType,t)),f(pN,F([XS(JS),v$,aN(5)]),F([cU(e.paymentMethod),dU(e.paymentMethodTerms)]))]))]))}),pU=n(function(e,t,r){return f(pN,F([Mk(5),Ik($k),XS(Ck),YS(Ck),jk(fx(!1))]),F([f(yN,F([XS(Ck),aN(10),UN(30)]),F([l(hU,r.inputs,r.errors,r.showCurrencyDropdown)])),l(hx,e,t,r)]))}),gU=function(e){return{$:"MessageInputChanged",a:e}},vU={$:"MessageSubmit"},yU=M_("disabled"),mU=function(e){return f(Rn,"tabIndex",Ri(e))},bU=function(e){return{$:"MayPreventDefault",a:e}},CU=r(function(e,t){return f(Vk,e,bU(t))}),EU=r(function(e,t){var r=function(r){return $(r,e)?Vi(t):zo("Not the enter key")},n=f(Go,r,f(vh,"key",Yo));return ZS(f(CU,"keyup",f(Mi,function(e){return x(e,!0)},n)))}),SU=function(e){return f(EU,"Enter",e)},TU={$:"Button"},wU=r(function(e,t){var r=t.onPress,n=t.label;return d(VI,nT,yk,f(Na,XS(JS),f(Na,YS(JS),f(Na,KI(uT.contentCenterX+" "+uT.contentCenterY+" "+uT.seButton+" "+uT.noTextSelection),f(Na,Uk,f(Na,L_(e),f(Na,iN(TU),f(Na,ZS(mU(0)),function(){if("Nothing"===r.$)return f(Na,ZS(yU(!0)),e);var t=r.a;return f(Na,jk(t),f(Na,SU(t),e))}()))))))),tT(F([n])))}),IU=function(e){return f(pN,F([XS(Ck),aN(10)]),F([f(_L,F([XS(Ck),YS(Tk(100))]),{label:d_("messageInput"),onChange:gU,placeholder:fi,spellcheck:!1,text:e.messageInput}),f(wU,F([eN,Wk(24)]),{label:Vf("Submit"),onPress:ci(vU)})]))},AU=f(Dk,xN,uT.scrollbarsY),BU=r(function(e,t){return f(mk,F([YS(Ck),XS(Ck)]),f(mk,O(F([h$(f(d$,"position","absolute")),h$(f(d$,"top","0")),h$(f(d$,"right","0")),h$(f(d$,"bottom","0")),h$(f(d$,"left","0")),AU]),e),t))}),kU=l(pk,200,205,210),NU=n(function(e,t,r){var n=F([lN,Ik(c$),JI($k),gx({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=F([f_,Ik(kU),JI(gR),gx({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(mk,O(F([UN(7)]),u),f(uN,mr,F([Vf(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 ci(P(l(qI,0,0,1),$k,"Initiator opened the trade"));case"Recalled":return ci(P(l(qI,0,0,1),$k,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Do,8,Hf(t))+"..";return ci(P(l(qI,1,0,1),$k,r+" committed to the trade"));case"Aborted":return ci(P(l(qI,1,0,0),$k,"Buyer aborted the trade"));case"Claimed":return ci(P(l(qI,0,1,0),$k,"Buyer marked the fiat transfer complete"));case"Released":return ci(P(l(qI,0,0,1),$k,"Seller released the "+sR(e)+" and closed the contract"));default:return ci(P(l(qI,0,0,1),$k,"Seller burned the "+sR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Ek;var d=c.a,h=d.a,p=d.b,g=d.c;return f(mk,F([Mk(3),GR(1),jR(l(qI,1,0,1)),eN,Ik(h)]),f(uN,F([JI(p)]),F([Vf(g)])))}),RU=n(function(e,t,r){if(r.b){var n=r;return f(BU,F([XS(Ck),YS(Ck),Mk(5),GR(1),jR(gR),UN(10)]),f(pN,F([XS(Ck),YS(Ck),aN(10)]),f(Pa,f(NU,e,t),n)))}return f(mk,F([XS(Ck),YS(Ck),Mk(5),GR(1),jR(gR),eN,JI(l(qI,.5,.5,.5)),sx]),Vf("no messages found."))}),$U=Er,_U=function(e){return f(pN,F([XS(Ck),YS(Ck),aN(10),GR(1),Mk(5),UN(20)]),F([l(RU,e.trade.factory,e.userRole,f($U,function(e){return e.blocknum},Ta(e.history))),IU(e)]))},LU=function(e){return f(mk,F([Ik($k),Mk(8),CL,XS(Ck),YS(Ck)]),_U(e))},xU={$:"ToggleChat"},PU=function(e){if(e.showChatHistory){var t=f(pc,Ek,f(Bo,LU,e.chatHistoryModel));return f(mk,F([YS(Ck),XS(Tk(500)),UN(20),lN]),l(E$,F([YS(Ck),XS(Ck)]),f(Wi,ZC,t),xU))}return Ek},DU=function(e){return"Buyer"===e.initiatorRole.$?yl:cb},UU=function(e){return AR(e)+" "+e.fiatType},OU={$:"AbortAction"},MU=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),FU=function(e){var t=x(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return Ek}if("LoadedTrade"!==t.b.$)return Ek;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=UU(n.terms.price),u=MR(lb(i)),s=MR(n.parameters.tradeAmount)+" "+sR(n.factory),c=function(){return"Buyer"===DU(n.parameters).$?x(f(mk,F([YN,JI(gR)]),Vf("buyer")),F([Vf("pay the seller "),f(mk,F([JI(c$)]),Vf(o)),Vf(" in exchange for the "),f(mk,F([JI(c$)]),Vf(s)),Vf(" held in this contract.")])):x(f(mk,F([YN,JI(gR)]),Vf("seller")),F([Vf("accept "),f(mk,F([JI(c$)]),Vf(o)),Vf(" from the buyer in exchange for the "),f(mk,F([JI(c$)]),Vf(s)),Vf(" held in this contract.")]))}(),d=c.a,h=c.b;return l(E$,mr,f(pN,F([aN(20),UN(20),eN,YS(Ck),Y$]),F([f(mk,F([Wk(26),Gk,eN,LN]),Vf("Just to Confirm...")),f(pN,F([aN(20),eN,LN]),f(Pa,uN(F([eN,Wk(18),YN,JI($$)])),O(F([O(F([Vf("You will deposit "),f(mk,F([JI(c$)]),Vf(u+" "+sR(n.factory))),Vf(", thereby becoming the "),d,Vf(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?F([F([Vf("(This ususally requires two Metamask signatures. Your "+sR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):mr}()))),f(mk,F([X$,eN]),f(G$,"Yes, I definitely want to commit to this trade.",l(MU,n,a,i)))])),OU);case"ApproveNeedsSig":return W$(F([Vf("Waiting for user signature for the approve call."),Vf("(check Metamask!)"),Vf("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return W$(F([Vf("Mining the initial approve transaction..."),f(HI,F([Z$,JI(c$)]),{label:Vf("See the transaction on Etherscan"),url:f(J$,n.factory,p)}),Vf("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return W$(F([Vf("Waiting for user signature for the final commit call."),Vf("(check Metamask!)"),Vf("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return W$(F([Vf("Mining the final commit transaction..."),f(HI,F([Z$,JI(c$)]),{label:Vf("See the transaction"),url:f(J$,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(E$,mr,f(pN,F([aN(20),UN(20),eN,YS(Ck),Y$]),F([f(mk,F([Wk(26),Gk,eN,LN]),Vf("Just to Confirm...")),f(pN,F([aN(20),eN,LN]),f(Pa,uN(F([eN,Wk(18),YN,JI($$)])),function(){switch(g.$){case"Poke":case"Recall":return mr;case"Claim":return F([F([Vf('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 '+sR(n.factory)+" rather than release it to you.")])]);case"Abort":return F([F([Vf("Aborting will incur a small penalty on both parties, and refund the rest of the "+sR(n.factory)+".")])]);case"Release":return F([F([Vf("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([Vf("This will destroy the "+sR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(mk,F([X$,eN]),function(e){return f(G$,e,mE(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 "+sR(n.factory)+".";default:return"I understand. Burn the "+sR(n.factory)+"."}}()))])),OU);case"ActionNeedsSig":var g=r.a;return W$(F([Vf("Waiting for user signature for the "+CE(g)+" call."),Vf("(check Metamask!)")]));default:var g=r.a,p=r.b;return Ek}},VU=yN(F([XS(Ck),Ik($k),Mk(5),UN(20),EL,CL])),KU=function(e){return f(yN,F([aN(8)]),F([f(qN,mr,o_),f(mk,F([Wk(24),YN]),Vf(MR(e)))]))},HU=r(function(e,t){var r=f(yg,Hm(e),f(Bo,function(e){return e.address},wd(t)));return f(cL,function(){var t=x(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"}(),KU(e.parameters.tradeAmount))}),jU=function(e){return f(yN,F([aN(5)]),F([$x(e.fiatType),f(mk,F([Wk(24),YN]),Vf(UU(e)))]))},qU=function(e){return f(cL,"For Fiat",jU(e.terms.price))},GU=function(e){return"Buyer"===e.$?"Buyer":"Seller"},zU=l(pk,250,165,22),YU=l(pk,255,0,0),WU=l(pk,0,255,0),JU=FN({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),QU=FN({description:"burned",src:"/DAIHard/static/img/burned.svg"}),XU=FN({description:"released",src:"/DAIHard/static/img/released.svg"}),ZU={$:"ToggleStatsModal"},eO=function(e){return f($U,Oa,e)},tO=n(function(e,t,n){var a=_v(f(Pa,function(e){return f(Wf,function(e){return $(f(WC,e,n),ci(t))},f(vS,function(e){if("LoadedTrade"===e.$){var t=e.a;return ci(t)}return fi},Ta(e.trades)))},e)),i=wi(a),o=l($a,r(function(e,t){switch(e.state.closedReason.$){case"Released":return U(t,{amountReleased:f(Kd,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return U(t,{amountBurned:f(Kd,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return U(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Bl,amountReleased:Bl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,bl,Nl(eO(f(vS,function(e){return function(e){return e?ci(e):fi}(Sd(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}}),rO=r(function(e,t){return d(q$,P(d(bN,0,0,1,1),d(bN,0,0,1,.8),d(bN,0,0,1,.6)),$k,e,t)}),nO=function(e){return{$:"ViewUserHistory",a:e}},aO=f(BB,0,mr),iO=f(Dk,qk,uT.textNormalWeight),oO=r(function(e,t){return ei(e/t)}),uO=n(function(e,t,r){for(;;){if(!r.b)return t+e;var n=r.a,a=r.b;if(L(n.start,t)<0)return t+n.offset;var i=e,o=t,u=a;e=i,t=o,r=u}}),sO=r(function(e,t){var r=e.a,n=e.b;return l(uO,r,f(oO,Sd(t),6e4),n)}),cO=r(function(e,t){return f(ds,24,f(oO,f(sO,e,t),60))}),fO=r(function(e,t){return f(ds,1e3,Sd(t))}),lO=r(function(e,t){return f(ds,60,f(sO,e,t))}),dO={$:"Apr"},hO={$:"Aug"},pO={$:"Dec"},gO={$:"Feb"},vO={$:"Jan"},yO={$:"Jul"},mO={$:"Jun"},bO={$:"Mar"},CO={$:"May"},EO={$:"Nov"},SO={$:"Oct"},TO={$:"Sep"},wO=function(e){var t=f(oO,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)}},IO=r(function(e,t){switch(wO(f(sO,e,t)).month){case 1:return vO;case 2:return gO;case 3:return bO;case 4:return dO;case 5:return CO;case 6:return mO;case 7:return yO;case 8:return hO;case 9:return TO;case 10:return SO;case 11:return EO;default:return pO}}),AO=r(function(e,t){return f(ds,60,f(oO,Sd(t),1e3))}),BO={$:"Fri"},kO={$:"Mon"},NO={$:"Sat"},RO={$:"Sun"},$O={$:"Thu"},_O={$:"Tue"},LO={$:"Wed"},xO=r(function(e,t){switch(f(ds,7,f(oO,f(sO,e,t),1440))){case 0:return $O;case 1:return BO;case 2:return NO;case 3:return RO;case 4:return kO;case 5:return _O;default:return LO}}),PO=n(function(e,t,r){return e.toAmPm(f(cO,t,r))}),DO=r(function(e,t){return wO(f(sO,e,t)).day}),UO=DO,OO=F([RO,kO,_O,LO,$O,BO,NO]),MO=r(function(e,t){return function(e){return e.a}(f(pc,x(0,RO),Nl(f(Wf,function(r){return $(r.b,f(xO,e,t))},f(ki,r(function(e,t){return x(e,t)}),OO)))))}),FO=function(e){return l($a,Ra,0,e)},VO=r(function(e,t){return wO(f(sO,e,t)).year}),KO=function(e){return!f(ds,4,e)&&(!!f(ds,100,e)||!f(ds,400,e))},HO=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return KO(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}}),jO=F([vO,gO,bO,dO,CO,mO,yO,hO,TO,SO,EO,pO]),qO=r(function(e,t){return f(pc,x(0,vO),Nl(f(Wf,function(r){r.a;return $(r.b,f(IO,e,t))},f(ki,r(function(e,t){return x(e,t)}),jO))))}),GO=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(qO,e,t))}),zO=r(function(e,t){var r=f(qs,f(GO,e,t)-1,jO);return FO(f(Pa,HO(f(VO,e,t)),r))+f(UO,e,t)}),YO=r(function(e,t){return f(GO,e,t)/4|0}),WO=r(function(e,t){var r=Ri(t),n=e-$o(r);return O(f($i,"",f(Pa,function(e){return"0"},f(Bi,1,n))),r)}),JO=function(e){return e?e<=12?e:e-12:12},QO=Vg(315576e5),XO=r(function(e,t){return bl(QO*f(VO,e,t))}),ZO=r(function(e,t){var r=f(XO,e,t),n=f(MO,e,r);return 1+((f(zO,e,t)+n)/7|0)}),eM=r(function(e,t){return Ri(f(VO,e,t))}),tM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ri(f(GO,t,r));case"MonthSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(GO,t,r));case"MonthFixed":return f(WO,2,f(GO,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(IO,t,r));case"MonthNameFull":return e.toMonthName(f(IO,t,r));case"QuarterNumber":return Ri(1+f(YO,t,r));case"QuarterSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(1+f(YO,t,r));case"DayOfMonthNumber":return Ri(f(UO,t,r));case"DayOfMonthSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(UO,t,r));case"DayOfMonthFixed":return f(WO,2,f(UO,t,r));case"DayOfYearNumber":return Ri(f(zO,t,r));case"DayOfYearSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(zO,t,r));case"DayOfYearFixed":return f(WO,3,f(zO,t,r));case"DayOfWeekNumber":return Ri(f(MO,t,r));case"DayOfWeekSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(MO,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(xO,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(xO,t,r));case"WeekOfYearNumber":return Ri(f(ZO,t,r));case"WeekOfYearSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(ZO,t,r));case"WeekOfYearFixed":return f(WO,2,f(ZO,t,r));case"YearNumberLastTwo":return f(Fo,2,f(eM,t,r));case"YearNumber":return f(eM,t,r);case"AmPmUppercase":return WD(l(PO,e,t,r));case"AmPmLowercase":return Fl(l(PO,e,t,r));case"HourMilitaryNumber":return Ri(f(cO,t,r));case"HourMilitaryFixed":return f(WO,2,f(cO,t,r));case"HourNumber":return Ri(JO(f(cO,t,r)));case"HourFixed":return f(WO,2,JO(f(cO,t,r)));case"HourMilitaryFromOneNumber":return Ri(1+f(cO,t,r));case"HourMilitaryFromOneFixed":return f(WO,2,1+f(cO,t,r));case"MinuteNumber":return Ri(f(lO,t,r));case"MinuteFixed":return f(WO,2,f(lO,t,r));case"SecondNumber":return Ri(f(AO,t,r));case"SecondFixed":return f(WO,2,f(AO,t,r));case"MillisecondNumber":return Ri(f(fO,t,r));case"MillisecondFixed":return f(WO,3,f(fO,t,r));default:return n.a}}),rM=a(function(e,t,r,n){return f($i,"",f(Pa,l(tM,e,r,n),t))}),nM=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),aM=function(e){return e>11?"pm":"am"},iM=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"}},oM=function(e){switch(f(ds,100,e)){case 11:case 12:case 13:return"th";default:switch(f(ds,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},uM=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"}},sM=p(nM,iM,f(Ao,iM,Do(3)),uM,f(Ao,uM,Do(3)),aM,oM),cM=rM(sM),fM={$:"MonthNameFull"},lM=fM,dM=function(e){return{$:"Text",a:e}},hM=dM,pM={$:"YearNumber"},gM=pM,vM=n(function(e,t,n){var a=r(function(e,t){return f(pN,F([Wk(18),aN(6)]),F([f(mk,F([sN]),Vf(e)),f(mk,F([iO]),Vf(t))]))}),i=cM(F([lM,hM(", "),gM])),o=f(pN,F([aN(23),XS(Ck)]),O(f(Pa,function(e){var t=e.a,r=e.b;return f(a,t,r)},F([x("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,aO,t)}return"No Committed Trades yet!"}()),x("Release Outcomes",Ri(n.numReleases)+" trades / "+MR(n.amountReleased)+" "+sR(e)+" Released"),x("Abort Outcomes",Ri(n.numAborts)+" trades"),x("Burn Outcomes",Ri(n.numBurns)+" trades / "+MR(n.amountBurned)+" "+sR(e)+" Burned")])),F([f(mk,F([eN]),f(rO,"View User History",nO(n.asRole)))])));return f(pN,F([Mk(8),FL,VL,Ik(iR),aN(1),bL({blur:20,color:d(bN,0,0,0,.08),offset:x(0,0),size:0})]),F([f(mk,F([XS(Ck),Ik($k),UN(17)]),f(CN,18,t)),f(mk,F([XS(Ck),Ik($k),UN(17)]),o)]))}),yM=n(function(e,t,r){var n=l(tO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=GU(e.parameters.initiatorRole)+" Stats";return f(mk,r?F([nL(f(mk,F([aL(30),lN]),l(vM,e.factory,e.parameters.initiatorAddress,n)))]):mr,f(cL,a,f(yN,F([XS(Ck),aN(20),Uk,jk(ZU)]),f(Pa,yN(F([aN(5)])),F([F([f(qN,F([YS(Tk(28))]),XU),f(mk,F([Wk(24),YN,JI(WU)]),Vf(l(fs,2,D("0"),Ri(n.numReleases))))]),F([f(qN,F([YS(Tk(28))]),JU),f(mk,F([Wk(24),YN,JI(zU)]),Vf(l(fs,2,D("0"),Ri(n.numAborts))))]),F([f(qN,F([YS(Tk(28))]),QU),f(mk,F([Wk(24),YN,JI(YU)]),Vf(l(fs,2,D("0"),Ri(n.numBurns))))])])))))}),mM=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+Hf(t)}e.a;return"https://kovan.etherscan.io/address/"+Hf(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+Hf(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+Hf(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+Hf(t)}}),bM=n(function(e,t,r){return f(HI,e,{label:Vf(Hf(r)),url:f(mM,t,r)})}),CM=function(e){return f(cL,"Trade Status",f(pN,F([Wk(24),YN,aN(8)]),F([Vf(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(bM,F([Wk(12),JI(c$),Z$]),e.factory,e.creationInfo.address)])))},EM=i(function(e,t,r,n,a){return VU(F([CM(t),f(HU,t,r),qU(t),l(yM,t,n,a)]))}),SM=l(pk,9,32,107),TM=FN({description:"chat",src:"/DAIHard/static/img/chat.svg"}),wM=f(mk,F([Mk(4),Uk,jk(xU),UN(5),Ik(l(pk,22,0,255))]),f(qN,F([XS(Tk(42))]),TM)),IM=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},AM=function(e){return f(pN,F([Mk(12),Ik(iR),UN(15),aN(15)]),F([f(mk,F([Wk(24),Gk,sx]),Vf("Fiat Payment Method")),f(uN,F([Wk(18),YS(JS),Ik($k),bL({blur:5,color:d(bN,0,0,0,.2),offset:x(-3,3),size:0}),Mk(3),UN(5)]),F([f(pc,f(mk,F([JI(pL),sx]),Vf("No payment methods found.")),f(Bo,Vf,f(Bo,function(e){return e.info},Nl(e))))]))]))},BM={$:"Active"},kM=function(e){return{$:"ExpandPhase",a:e}},NM=F([Ik(SM),JI($k)]),RM=r(function(e,t){return{$:"Min",a:e,b:t}}),$M=r(function(e,t){return f(RM,e,t)}),_M=function(e){return F(e?[Mk(12),v$,YS(f($M,380,JS))]:[Mk(12),eN])},LM=F([Ik($k)]),xM=FN({description:"flame",src:"/DAIHard/static/img/flame.png"}),PM=r(function(e,t){return El(f(Gu,Sl(e),Sl(t)))}),DM=r(function(e,t){return d(q$,P(d(bN,1,.6,.2,1),d(bN,1,.6,.2,.8),d(bN,1,.6,.2,.6)),$k,e,t)}),UM=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),OM=function(e){return{$:"ContractActionClicked",a:e}},MM={$:"Web3Connect"},FM=n(function(e,t,r){var n=wd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(hR,e,t).$?Ek:f(yN,F([aN(8)]),function(){var e=P(t.state.phase,f(Hm,t,a.address),f(WC,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return F([f(Wi,mE,f(rO,"Remove and Refund this Trade",vE))])}break e}var r=(e.a,e.b,Sl(jm(t.parameters)));return F([f(G$,"Deposit and Commit to Trade",l(UM,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return F([f(Wi,OM,f(DM,"Abort Trade",tE)),f(Wi,OM,f(G$,"Confirm Payment",sE)),wM])}e.a,e.c.a;return F([wM])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return F([f(Wi,OM,f(G$,"Burn it All!",uE)),f(Wi,OM,f(rO,"Release Everything",yE)),wM])}e.a,e.c.a;return F([wM])}break e;default:break e}return mr}())}return f(G$,"Connect to Wallet",MM)}),VM={$:"Finished"},KM={$:"NotStarted"},HM=r(function(e,t){var r=x(eR(t),eR(e.state.phase)),n=r.a,a=r.b;return L(n,a)>0?KM:$(n,a)?BM:VM}),jM=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(Na,r,e),a=t-1,i=r;e=n,t=a,r=i}}),qM=r(function(e,t){return l(jM,mr,e,t)}),GM=a(function(e,t,r,n){var a=MR(f(Kd,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+sR(r.factory),i=MR(r.parameters.tradeAmount)+" "+sR(r.factory),o=f(yN,mr,f(qM,3,f(qN,F([YS(Tk(18))]),xM))),u=f(Ua,mk(F([JI(l(qI,1,0,0))])),Vf),s=$(e,r.state.phase),c=f(yg,WC(r),f(Bo,function(e){return e.address},wd(n))),d=s?$k:gR,h=uN(F([JI(d),Wk(18),Gk])),p=UU(r.terms.price),g=s?l(pk,0,226,255):l(pk,16,7,234),v=f(Ua,mk(F([JI(g)])),Vf),y=MR(r.parameters.buyerDeposit)+" "+sR(r.factory),m=r.parameters.abortPunishment,b=MR(m)+" "+sR(r.factory),C=MR(f(PM,r.parameters.buyerDeposit,m))+" "+sR(r.factory),E=MR(f(PM,r.parameters.tradeAmount,m))+" "+sR(r.factory),S=function(){var t=x(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return x("And Now, We Wait",function(){return"Buyer"===n.$?f(Pa,h,F([F([Vf("Your "),u("burnable deposit"),Vf(" of "),v(y),Vf(" is now held in this contract, and your offer to buy "),v(i),Vf(" for "),v(p),Vf(" is now listed in the marketplace.")]),F([Vf("If another user likes your offer, they can become the Seller by depositing the full "),v(i),Vf(" into this contract.")]),F([Vf("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),Vf(" to you.")])])):f(Pa,h,F([F([Vf("Your offer to sell the "),v(i),Vf(" held in this contract for "),v(p),Vf(" is now listed in the marketplace.")]),F([Vf("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),Vf(" of 1/3 of the trade amount "),v("("+y+")"),Vf(" into this contract.")]),F([Vf("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),Vf(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return x("Time to Pay Up",f(Pa,h,F([F([Vf("You must now pay the Seller "),v(p),Vf(" via the Fiat Payment Method, "),f(mk,F([Gk]),Vf("and then click ")),u("Confirm Payment"),Vf(" before the payment window runs out. Use the chat to coordinate.")]),F([Vf("If you abort the trade, or do not confirm payment before this time is up, "),v(b),Vf(" (1/4 of the "),u("burnable deposit"),Vf(") will be "),u("burned"),Vf(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Vf(" to the Seller, "),v(C),Vf(" to you).")]),F([Vf("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),Vf(" has been unmistakably transferred.")])])))}t.a,t.b.a;return x("Time to Get Paid",f(Pa,h,F([F([Vf("Work and communicate with the Buyer to receive "),v(p),Vf(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),F([Vf("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),Vf(" (1/4 of the "),u("burnable deposit"),Vf(") will be "),u("burned"),Vf(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Vf(" to you, "),v(C),Vf(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return x("Judgement",f(Pa,h,F([F([Vf("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),Vf(" will be released to you.")]),F([Vf("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),Vf(" In this case the "),v(a),Vf(" will be lost to both parties.")]),F([Vf("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return x("Judgement",f(Pa,h,F([F([Vf("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),F([Vf("So, have you recieved the "),v(p),Vf("? If so, you can click "),v("Release Everything"),Vf(".")]),F([Vf("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),Vf(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),F([Vf("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return x("Contract closed.",F([h(F([Vf("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return x("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(Pa,h,F([F([Vf("The Seller has deposited "),v(i),Vf(" into this contract, and offers to sell it for "),v(p),Vf(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),Vf(" into this contract by clicking "),u("Deposit and Commit to Trade"),Vf(".")]),F([Vf("If the trade is successful, the combined "+sR(r.factory)+" balance "),v("("+a+")"),Vf(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,Vf(" for both parties (see Payment Window for more on this).")]),F([Vf("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),Vf(" within the payment window.")])])):f(Pa,h,F([F([Vf("The Buyer is offering to buy "),v(i),Vf(" for "),v(p),Vf(", and has deposited "),v(y),Vf(" into this contract as a "),u("burnable deposit"),Vf(". To become the Seller, deposit "),v(i),Vf(" into this contract by clicking "),u("Deposit and Commit to Trade"),Vf(".")]),F([Vf("When you receive the "),v(p),Vf(" from the Buyer, the combined "+sR(r.factory)+" balance "),v("("+a+")"),Vf(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,Vf(" for both parties (see Payment Window for more on this).")]),F([Vf("Don't commit unless you can receive "),v(p),Vf(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return x("Making the Payment",f(Pa,h,F([F([Vf("During this phase, the Buyer is expected to transfer "),v(p),Vf(" to the Seller, as described in Fiat Payment Method, "),f(mk,F([Gk]),Vf("and ")),u("Confirm the Payment "),Vf(" before the payment window runs out. This would move the trade to the final phase.")]),F([Vf("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),Vf(" (1/4 of the "),u("burnable deposit"),Vf(" amount) will be "),u("burned"),Vf(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Vf(" to the Seller, "),v(C),Vf(" to the Buyer).")])])));case"Judgment":t.a,t.b;return x("Judgement",f(Pa,h,F([F([Vf("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),F([Vf("If the Seller can verify he has received the "),v(p),Vf(", he will probably release the total balance of "),v(i),Vf(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),Vf(".")]),F([Vf("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),Vf(" will be automaticall released.")])])));default:t.a,t.b;return x("Contract closed.",mr)}}(),T=S.a,w=S.b;return f(pN,F([XS(Ck),YS(Ck),UN(20),aN(30)]),F([f(yN,F([XS(Ck)]),F([f(mk,F([Wk(24),Gk,JI(g),f_]),Vf(T))])),f(pN,F([XS(Ck),LN,aN(13)]),w),f(mk,F([lN]),function(){switch(f(HM,r,e).$){case"Active":return l(FM,t,r,n);case"NotStarted":return f(mk,F([Wk(20),Gk,sx,JI(ZN)]),Vf("Phase not yet started."));default:return f(mk,F([Wk(20),Gk,sx]),Vf("Phase no longer active."))}}())]))}),zM=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},YM=FN({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),WM=FN({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),JM={$:"None"},QM=JM,XM=FN({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),ZM=function(e){switch(e.$){case"Open":return XM;case"Committed":return YM;case"Judgment":return WM;default:return QM}},eF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),tF=a(function(e,t,r,n){return d(eF,e,t,r,n)}),rF=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(tF,e.red,e.green,e.blue,e.alpha)}(rF(e))},aF=function(e){return{$:"Circle",a:e}},iF=aF,oF=d(eF,0,0,0,1),uF={$:"Flat"},sF={$:"Sharp"},cF=function(e){return{$:"Uniform",a:e}},fF=cF,lF={cap:uF,dashPattern:mr,dashPhase:0,fill:fF(oF),join:sF,thickness:2},dF=n(function(e,t,r){return U(lF,{dashPattern:e,fill:r,thickness:t})}),hF=dF(mr),pF={$:"Transparent"},gF=pF,vF=f(hF,0,gF),yF=r(function(e,t){return{$:"Shape",a:e,b:t}}),mF=function(e){return{basic:e,handlers:mr,name:fi,opacity:1,rotation:0,scale:x(1,1),shift:x(0,0)}},bF=function(e){return f(Ua,mF,yF(e))},CF=function(e){return bF(x(e,vF))},EF=function(e){return x(-e.a,-e.b)},SF=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return U(t,{shift:x(a.a+r,a.b+n)})}),TF=r(function(e,t){return f(SF,EF(e(t)),t)}),wF=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return x(f(Na,r,a),f(Na,n,i))});return l(xa,t,x(mr,mr),e)},IF=r(function(e,t){return{$:"Path",a:e,b:t}}),AF=Nr,BF=Rr,kF=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=BF(n),i=AF(n);return x(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 x(o*t,u*r)},c=t,l=c.a,d=c.b;return f(Ua,f(Ua,function(e){var t=e.a,r=e.b;return x(t+l,r+d)},s),a)},NF=function(e){return Pa(function(t){var r=t.a,n=t.b,a=e/2;return x(r<0?r-a:r+a,n<0?n-a:n+a)})},RF=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(NF,e,F([x(-i,-a),x(i,-a),x(i,a),x(-i,a)]))}),$F=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return F([x(-a,-r),x(n,-r),x(n,t),x(-a,t)])},_F=function(e){var t=LF(e.basic),r=wF(f(Pa,kF(e),t)),n=r.a,a=r.b;return{toBottom:-f(pc,0,Gw(a)),toLeft:-f(pc,0,Gw(n)),toRight:f(pc,0,qw(n)),toTop:f(pc,0,qw(a))}},LF=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(RF,r,x(a,a));case"Ellipse":var i=e.a,r=i.b.thickness,o=e.b,u=o.a,s=o.b;return f(RF,r,x(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(RF,r,x(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(NF,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(IF,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(NF,$(C,uF)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(RF,0,E);case"Group":var S=e.a;return f(NF,0,_v(f(Pa,f(Ao,_F,$F),S)));default:var T=e.b;return f(NF,0,$F(_F(T)))}},xF=function(e){var t=_F(e);return t.toTop+t.toBottom},PF=function(e){var t=_F(e);return x(-t.toLeft,t.toTop)},DF=function(e){var t=_F(e);return t.toLeft+t.toRight},UF=Sn("http://www.w3.org/2000/svg"),OF=UF("svg"),MF=Rn("height"),FF=Rn("version"),VF=Rn("width"),KF=UF("circle"),HF=UF("ellipse"),jF=UF("foreignObject"),qF=UF("g"),GF=UF("image"),zF=UF("polygon"),YF=UF("polyline"),WF=UF("rect"),JF=ew,QF=UF("text"),XF=Rn("id"),ZF=Rn("points"),eV=Rn("r"),tV=Rn("rx"),rV=Rn("ry"),nV=function(e){return l($n,"http://www.w3.org/1999/xlink","xlink:href",rt(e))},aV=function(e){return{$:"Group",a:e}},iV=Rn("dominant-baseline"),oV=Rn("fill"),uV=Rn("fill-opacity"),sV=Rn("font-family"),cV=Rn("font-size"),fV=Rn("font-style"),lV=Rn("font-variant"),dV=Rn("font-weight"),hV=Rn("opacity"),pV=Rn("stroke"),gV=Rn("stroke-dasharray"),vV=Rn("stroke-dashoffset"),yV=Rn("stroke-linecap"),mV=Rn("stroke-linejoin"),bV=Rn("stroke-opacity"),CV=Rn("stroke-width"),EV=Rn("text-anchor"),SV=Rn("text-decoration"),TV=Rn("transform"),wV=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},IV=function(e){return f($i," ",f(Pa,function(e){var t=e.a,r=e.b;return f($i,",",F([Ri(t),Ri(r)]))},e))},AV=n(function(e,t,r){return d(eF,e,t,r,1)}),BV=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Vg(1e4*e)/100};return Xl(F(["rgba(",WT(i(t)),"%,",WT(i(r)),"%,",WT(i(n)),"%,",WT(function(e){return Vg(1e3*e)/1e3}(a)),")"]))},kV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},NV=function(e){var t=kV(e),r=t.red,n=t.green,a=t.blue;return BV(l(AV,r,n,a))},RV=function(e){if("Uniform"===e.$){var t=e.a;return NV(t)}return"none"},$V=function(e){var t=kV(e),r=t.alpha;return WT(r)},_V=function(e){if("Uniform"===e.$){var t=e.a;return $V(t)}return"0"},LV=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},xV=kr,PV=function(e){var t=WT(e.scale.b),r=WT(e.scale.a),n=WT(-e.rotation/2/xV*360),a=WT(-e.shift.b),i=WT(e.shift.a);return Xl(F(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},DV=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return F([pV(RV(r.fill)),bV(_V(r.fill)),CV(WT(r.thickness)),yV(wV(r.cap)),mV(LV(r.join)),oV("none"),hV(WT(e.opacity)),TV(PV(e)),vV(Ri(r.dashPhase)),gV(IV(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return F([oV(RV(a)),uV(_V(a)),pV(RV(r.fill)),bV(_V(r.fill)),CV(WT(r.thickness)),yV(wV(r.cap)),mV(LV(r.join)),hV(WT(e.opacity)),TV(PV(e)),vV(Ri(r.dashPhase)),gV(IV(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return F([oV(RV(cF(o.color))),sV(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),cV(Ri(o.size)),dV(function(){switch(o.weight.$){case"Thin":return"200";case"Light":return"300";case"Regular":return"normal";case"Medium":return"500";case"SemiBold":return"600";case"Bold":return"bold";default:return"800"}}()),fV(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),lV(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),SV(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),EV("middle"),iV("middle"),TV(PV(e))]);default:return F([TV(PV(e))])}},UV=Rn("x"),OV=Rn("y"),MV=r(function(e,t){return F([VF(WT(e)),MF(WT(t)),UV(WT(-e/2)),OV(WT(-t/2))])}),FV=function(e){return f($i," ",f(Pa,function(e){var t=e.a,r=e.b;return f($i,",",F([WT(t),WT(-r)]))},e))},VV=Kk,KV=r(function(e,t){return f(e,t.a,t.b)}),HV=function(e){return f(Pa,KV(VV),e)},jV=function(e){e:for(;;){var t=f(pc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(YF,O(F([XF(t),ZF(FV(i))]),O(DV(e),HV(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(zF,O(F([XF(t),ZF(FV(i))]),O(DV(e),HV(e.handlers))),mr);case"Circle":var c=s.a;return f(KF,O(F([XF(t),eV(WT(c))]),O(DV(e),HV(e.handlers))),mr);case"Ellipse":var d=s.a,h=s.b;return f(HF,O(F([XF(t),tV(WT(d)),rV(WT(h))]),O(DV(e),HV(e.handlers))),mr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(WF,O(F([XF(t),tV(WT(c)),rV(WT(c))]),O(f(MV,p,g),O(DV(e),HV(e.handlers)))),mr);default:var a=s.a,v=U(e,{basic:f(IF,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(QF,O(F([XF(t)]),O(DV(e),HV(e.handlers))),F([JF(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(GF,O(F([XF(t),nV(C)]),O(f(MV,p,g),O(DV(e),HV(e.handlers)))),mr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(jF,O(F([XF(t)]),O(f(MV,p,g),O(DV(e),HV(e.handlers)))),F([S]));case"Group":var T=n.a;return f(qF,f(Na,XF(t),O(DV(e),HV(e.handlers))),l($a,r(function(e,t){return f(Na,jV(e),t)}),mr,T));default:var w=n.a,I=n.b,v=U(e,{basic:aV(F([w,I]))});e=v;continue e}}},qV=r(function(e,t){var r=e.a,n=e.b,a=WT(r),i=WT(n);return f(ET,mr,F([f(OF,F([VF(a),MF(i),FF("1.1")]),F([jV(t)]))]))}),GV=function(e){return f(qV,x(DF(e),xF(e)),f(TF,PF,e))},zV=r(function(e,t){var r=ZM(e),n=function(){switch(t.$){case"NotStarted":return l(pk,10,33,108);case"Active":return l(pk,0,100,170);default:return l(pk,1,129,104)}}(),a=_x(GV(f(CF,fF(nF(n)),iF(50))));return f(mk,F([eN,m$(f(qN,F([eN,LN,YS(Tk(60))]),r))]),a)}),YV=function(e){var t=F([sx,Gk,Wk(20)]);switch(e.$){case"Active":return f(mk,O(t,F([JI(Qk)])),Vf("Active"));case"NotStarted":return f(mk,O(t,F([JI(ZN)])),Vf("Not Started"));default:return f(mk,t,Vf("Finished"))}},WV=n(function(e,t,r){var n=f(HM,t,e),a=function(){return"Active"===n.$?l(pk,0,226,255):gR}(),i=f(mk,F([JI(a),Wk(20),Gk,eN]),Vf(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 Ek;switch(n.$){case"NotStarted":return d($R,F([eN]),F([Wk(22),YN]),x(gR,iR),f(lR,e,t));case"Active":var a=f(hR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(OR,F([eN]),F([Wk(22),YN]),x($k,iR),i)}return f(pN,F([eN,aN(10)]),F([f(mk,F([eN]),Vf(zM(e))),f(rO,"Poke",mE(gE))]));default:return f(mk,F([YS(Tk(1))]),Ek)}}();return f(pN,F([UN(20),aN(10),YS(Ck)]),F([f(mk,F([v$,eN]),i),f(mk,F([YS(Ck),eN]),f(mk,F([LN]),f(zV,e,n))),f(pN,F([aN(10),X$,eN]),F([f(mk,F([eN]),YV(n)),o]))]))}),JV=o(function(e,t,r,n,a,i){var o=f(HM,r,t),u=f(mk,F([UN(10),XS(Ck),YS(Ck)]),d(GM,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return bl(0)}}(),c=l(WV,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(dR,f(Wm,r.state.phaseStartTime,s),i);default:bl(0)}}(),f(mk,F([YS(Ck),XS(Tk(1)),Ik(function(){return"Active"===o.$?l(qI,0,0,1):iR}())]),Ek)),p=a?f(yN,O(_M(e),O($(o,BM)?NM:LM,F([XS(Ck)]))),F([c,h,u])):f(yN,O(_M(e),O($(o,BM)?NM:LM,F([Uk,jk(kM(t))]))),F([c]));return!e&&$(o,BM)?f(pN,F([XS(Ck),aN(20),SN({bottom:20,left:0,right:0,top:0})]),F([p,AM(r.terms.paymentMethods)])):p}),QV=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(yN,F([eN,Mk(12),UN(30),aN(10),Ik(SM),Wk(24),Gk,JI($k)]),F([Vf("Trade "+IM(t.state.closedReason)),wM])):e?f(pN,F([XS(Ck),aN(10)]),F([f(yN,F([XS(Ck),YS(JS),aN(20)]),F([p(JV,e,qg,t,n,$(r,qg),a),p(JV,e,$b,t,n,$(r,$b),a),p(JV,e,_b,t,n,$(r,_b),a)])),AM(t.terms.paymentMethods)])):f(pN,F([XS(Ck),YS(JS),aN(20)]),F([p(JV,e,qg,t,n,$(r,qg),a),p(JV,e,$b,t,n,$(r,$b),a),p(JV,e,_b,t,n,$(r,_b),a)]))}),XV=a(function(e,t,r,n){var a=e>1300;return x(function(){var e=n.trade;switch(e.$){case"LoadedTrade":var i=e.a;return f(pN,F([XS(Ck),YS(Ck),aN(40)]),F([h(EM,t,i,n.wallet,r,n.showStatsModal),f(mk,F([XS(Ck),f(xk,40,0),aN(40)]),h(QV,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(mk,F([eN,LN,Wk(30)]),Vf("Loading trade info..."));default:return f(mk,F([eN,LN,Wk(30)]),Vf("Invalid trade"))}}(),F([PU(n),FU(n)]))}),ZV=n(function(e,t,r){var n=r.a,a=r.b;return x(e(n),t(a))}),eK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return x(cx,mr);case"CreateModel":var n=r.a;return x(f(Wi,ly,XL(n)),mr);case"TradeModel":var a=r.a;return l(ZV,Wi(py),Pa(Wi(py)),d(XV,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return x(f(Wi,VS,l(pU,t.time,t.tradeCaches,i)),mr);default:var o=r.a;return x(f(Wi,US,l(n$,t.time,t.tradeCaches,o)),mr)}}(),n=r.a,a=r.b;return x(f(mk,F([XS(Ck),YS(Ck),Mk(10)]),n),a)}),tK=function(e){return{$:"DismissNotice",a:e}},rK=function(e){return f(B$,Sx,Tx(e))},nK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(qI,1,1,1):l(qI,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(pk,100,200,255);case"Caution":return l(pk,255,188,0);case"Error":return l(pk,255,70,70);default:return l(pk,200,200,200)}}(),o=f(mk,F([lN,v$,k$(5),rK(5)]),f$(tK(t)));return f(mk,F([Ik(i),Mk(10),UN(8),XS(Ck),GR(1),jR(d(bN,0,0,0,.15)),CL]),f(pN,F([aN(4),XS(Ck)]),f(ki,r(function(e,t){return f(uN,F([XS(Ck),JI(a)]),e?t:f(Na,o,t))}),n.mainParagraphs)))},aK=function(e){return $(e,mr)?mr:F([f(pN,F([wx(20),k$(20),aN(10),lN,X$,XS(Tk(300)),Wk(15)]),f(Pa,nK,f(Wf,function(e){return $(e.b.align,Of)},f(ki,r(function(e,t){return x(e,t)}),e)))),f(pN,F([rK(20),aL(100),aN(10),f_,v$,XS(Tk(300)),Wk(15)]),f(Pa,nK,f(Wf,function(e){return $(e.b.align,QA)},f(ki,r(function(e,t){return x(e,t)}),e))))])},iK=r(function(e,t){var r=f(eK,e,t),n=r.a,a=r.b;return x(f(pN,F([xR(Ak),m$(mN(t)),XS(Ck),YS(Ck),UN(30)]),F([f(mk,F([YS(Tk(50))]),Ek),n])),O(a,aK(t.userNotices)))}),oK=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),uK=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),sK={$:"AllowHover"},cK={$:"Layout"},fK={backgroundColor:fi,borderColor:fi,shadow:ci({blur:3,color:d(jI,155/255,203/255,1,1),offset:x(0,0),size:3})},lK=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?U(t,{hover:ci(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?U(t,{focus:ci(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?U(t,{mode:ci(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?fK:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?sK:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?cK:t.a}()}}(l(xa,t,{focus:fi,hover:fi,mode:fi},e))},dK=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(nT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),nT);case"Text":var a=t.a;return sI(a);default:return sI("")}}),hK=n(function(e,t,r){var n=lK(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?oK(n):uK(n)}();return f(dK,a,d(VI,nT,yk,t,tT(F([r]))))}),pK=RT(5),gK=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),vK={$:"SansSerif"},yK=function(e){return{$:"Typeface",a:e}},mK=W,bK=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($i,"-",mK(Fl(t)));case"ImportFont":var t=e.a;e.b;return f($i,"-",mK(Fl(t)));default:var t=e.a.name;return f($i,"-",mK(Fl(t)))}}())}),CK=function(){var e=F([yK("Open Sans"),yK("Helvetica"),yK("Verdana"),vK]);return F([f(YI,wk,l(zI,"bg-color-"+WI(d(jI,1,1,1,0)),"background-color",d(jI,1,1,1,0))),f(YI,GI,l(zI,"font-color-"+WI(d(jI,0,0,0,1)),"color",d(jI,0,0,0,1))),f(YI,zk,Yk(20)),f(YI,pK,f(gK,l($a,bK,"font-",e),e))])}(),EK=n(function(e,t,r){var n=e.options;return l(hK,n,f(Na,KI(f($i," ",F([uT.root,uT.any,uT.single]))),O(CK,t)),r)}),SK=EK({options:mr}),TK=function(e){return f(YI,pK,f(gK,l($a,bK,"ff-",e),e))},wK=vK,IK=yK,AK=function(e){return{body:F([function(){var t=f(iK,e.screenWidth,e),r=t.a,n=t.b,a=O(F([XS(Ck),YS(Ck),TK(F([IK("Soleil"),wK]))]),f(Pa,m$,n));return f(SK,a,r)}()]),title:"DAIHard"}},BK=jt,kK=BK({init:gB,onUrlChange:hk,onUrlRequest:dk,subscriptions:lk,update:MA,view:AK});!function(t){e.Elm?We("Elm",e.Elm,t):e.Elm=t}({App:{init:kK(f(Go,function(e){return f(Go,function(t){return f(Go,function(r){return Vi({height:r,networkId:t,width:e})},f(vh,"height",kC))},f(vh,"networkId",kC))},f(vh,"width",kC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/src/AgentHistory/State.elm b/src/AgentHistory/State.elm index 65e8386..470c62c 100644 --- a/src/AgentHistory/State.elm +++ b/src/AgentHistory/State.elm @@ -1,9 +1,10 @@ -module AgentHistory.State exposing (init, subscriptions, update, updateUserInfo, updateWeb3Context) +module AgentHistory.State exposing (init, subscriptions, update, updateWalletState) import AgentHistory.Types exposing (..) import AppCmd import Array exposing (Array) import BigInt exposing (BigInt) +import ChainCmd exposing (ChainCmd) import CommonTypes exposing (..) import Config exposing (..) import Contracts.Generated.DAIHardTrade as DHT @@ -15,7 +16,6 @@ import Eth.Types exposing (Address) import FiatValue exposing (FiatValue) import Flip exposing (flip) import Helpers.BigInt as BigIntHelpers -import Helpers.ChainCmd as ChainCmd exposing (ChainCmd) import Helpers.Eth as EthHelpers import Helpers.Time as TimeHelpers import PaymentMethods exposing (PaymentMethod) @@ -25,15 +25,18 @@ import Time import TokenValue exposing (TokenValue) import TradeCache.State as TradeCache import TradeCache.Types as TradeCache exposing (TradeCache) +import TradeTable.State as TradeTable +import TradeTable.Types as TradeTable +import Wallet -init : EthHelpers.Web3Context -> Address -> BuyerOrSeller -> Maybe UserInfo -> ( Model, Cmd Msg ) -init web3Context agentAddress agentRole maybeUserInfo = - ( { web3Context = web3Context +init : Wallet.State -> Address -> ( Model, Cmd Msg ) +init wallet agentAddress = + ( { wallet = wallet , agentAddress = agentAddress - , agentRole = agentRole - , userInfo = maybeUserInfo - , viewPhase = CTypes.Open + , tradeTable = + TradeTable.init + ( TradeTable.Phase, TradeTable.Ascending ) } , Cmd.none ) @@ -42,20 +45,6 @@ init web3Context agentAddress agentRole maybeUserInfo = update : Msg -> Model -> UpdateResult update msg prevModel = case msg of - ViewUserRoleChanged role -> - UpdateResult - prevModel - Cmd.none - ChainCmd.none - [ AppCmd.GotoRoute (Routing.AgentHistory prevModel.agentAddress role) ] - - ViewPhaseChanged phase -> - UpdateResult - { prevModel | viewPhase = phase } - Cmd.none - ChainCmd.none - [] - Poke address -> let txParams = @@ -80,12 +69,26 @@ update msg prevModel = chainCmd [] - TradeClicked id -> + TradeClicked factory id -> UpdateResult prevModel Cmd.none ChainCmd.none - [ AppCmd.GotoRoute (Routing.Trade id) ] + [ AppCmd.GotoRoute (Routing.Trade factory id) ] + + TradeTableMsg tradeTableMsg -> + let + ttUpdateResult = + prevModel.tradeTable + |> TradeTable.update tradeTableMsg + in + UpdateResult + { prevModel + | tradeTable = ttUpdateResult.model + } + (Cmd.map TradeTableMsg ttUpdateResult.cmd) + (ChainCmd.map TradeTableMsg ttUpdateResult.chainCmd) + (List.map (AppCmd.map TradeTableMsg) ttUpdateResult.appCmds) NoOp -> noUpdate prevModel @@ -100,14 +103,9 @@ noUpdate model = [] -updateUserInfo : Maybe UserInfo -> Model -> Model -updateUserInfo userInfo model = - { model | userInfo = userInfo } - - -updateWeb3Context : EthHelpers.Web3Context -> Model -> Model -updateWeb3Context newWeb3Context model = - { model | web3Context = newWeb3Context } +updateWalletState : Wallet.State -> Model -> Model +updateWalletState wallet model = + { model | wallet = wallet } subscriptions : Model -> Sub Msg diff --git a/src/AgentHistory/Types.elm b/src/AgentHistory/Types.elm index 1ae98ea..249f56c 100644 --- a/src/AgentHistory/Types.elm +++ b/src/AgentHistory/Types.elm @@ -3,14 +3,15 @@ module AgentHistory.Types exposing (Model, Msg(..), UpdateResult) import AppCmd exposing (AppCmd) import Array exposing (Array) import BigInt exposing (BigInt) +import ChainCmd exposing (ChainCmd) import CommonTypes exposing (..) import Contracts.Types as CTypes import Dict exposing (Dict) +import Eth.Net import Eth.Sentry.Event as EventSentry exposing (EventSentry) import Eth.Types exposing (Address) import FiatValue exposing (FiatValue) -import Helpers.ChainCmd as ChainCmd exposing (ChainCmd) -import Helpers.Eth as EthHelpers exposing (Web3Context) +import Helpers.Eth as EthHelpers import Http import Json.Decode import PaymentMethods exposing (PaymentMethod) @@ -19,22 +20,21 @@ import String.Extra import Time import TokenValue exposing (TokenValue) import TradeCache.Types as TradeCache exposing (TradeCache) +import TradeTable.Types as TradeTable +import Wallet type alias Model = - { web3Context : Web3Context + { wallet : Wallet.State , agentAddress : Address - , agentRole : BuyerOrSeller - , userInfo : Maybe UserInfo - , viewPhase : CTypes.Phase + , tradeTable : TradeTable.Model } type Msg - = ViewUserRoleChanged BuyerOrSeller - | ViewPhaseChanged CTypes.Phase - | Poke Address - | TradeClicked Int + = Poke Address + | TradeClicked FactoryType Int + | TradeTableMsg TradeTable.Msg | NoOp diff --git a/src/AgentHistory/View.elm b/src/AgentHistory/View.elm index 3290be4..569f914 100644 --- a/src/AgentHistory/View.elm +++ b/src/AgentHistory/View.elm @@ -17,15 +17,19 @@ import Helpers.Time as TimeHelpers import Html.Events.Extra import Images exposing (Image) import Margin +import Maybe.Extra import PaymentMethods exposing (PaymentMethod) import Time import TokenValue exposing (TokenValue) import TradeCache.State as TradeCache -import TradeCache.Types exposing (TradeCache) +import TradeCache.Types as TradeCache exposing (TradeCache) +import TradeTable.Types as TradeTable +import TradeTable.View as TradeTable +import Wallet -root : Time.Posix -> TradeCache -> Model -> Element Msg -root time tradeCache model = +root : Time.Posix -> List TradeCache -> Model -> Element Msg +root time tradeCaches model = Element.column [ Element.Border.rounded 5 , Element.Background.color EH.white @@ -34,9 +38,7 @@ root time tradeCache model = , Element.paddingXY 0 20 ] [ pageTitleElement model - , viewTypeElement model - , phaseElement model - , maybeResultsElement time tradeCache model + , resultsAndStatusElement time tradeCaches model ] @@ -44,7 +46,7 @@ pageTitleElement : Model -> Element Msg pageTitleElement model = let viewingOwnHistory = - case model.userInfo of + case Wallet.userInfo model.wallet of Nothing -> False @@ -78,98 +80,13 @@ pageTitleElement model = ] -viewTypeElement : Model -> Element Msg -viewTypeElement model = - Element.el - [ Element.paddingXY 30 10 ] - (userRoleToggle model.agentRole) - - -userRoleToggle : BuyerOrSeller -> Element Msg -userRoleToggle buyerOrSeller = - let - baseStyles = - [ Element.Font.size 24 - , Element.Font.semiBold - , Element.pointer - ] - - ( asBuyerStyles, asSellerStyles ) = - case buyerOrSeller of - Buyer -> - ( baseStyles - , baseStyles ++ [ Element.Font.color EH.disabledTextColor ] - ) - - Seller -> - ( baseStyles ++ [ Element.Font.color EH.disabledTextColor ] - , baseStyles - ) - in - Element.row [ Element.spacing 20 ] - [ Element.el - ([ Element.Events.onClick <| ViewUserRoleChanged Seller ] ++ asSellerStyles) - (Element.text "As the Seller") - , Element.el - ([ Element.Events.onClick <| ViewUserRoleChanged Buyer ] ++ asBuyerStyles) - (Element.text "As the Buyer") - ] - - -phaseElement : Model -> Element Msg -phaseElement model = - Element.el - [ Element.paddingXY 30 10 ] - (choosePhaseElement model.viewPhase) - - -choosePhaseElement : CTypes.Phase -> Element Msg -choosePhaseElement activePhase = - let - baseStyles = - [ Element.Font.size 20 - , Element.Font.bold - , Element.pointer - ] - - phaseButtonStyles isActive = - if isActive then - baseStyles ++ [ Element.Font.color EH.blue ] - - else - baseStyles - in - Element.row [ Element.spacing 30 ] - [ Element.el - ([ Element.Events.onClick <| ViewPhaseChanged CTypes.Open ] - ++ phaseButtonStyles (activePhase == CTypes.Open) - ) - (Element.text "Open") - , Element.el - ([ Element.Events.onClick <| ViewPhaseChanged CTypes.Committed ] - ++ phaseButtonStyles (activePhase == CTypes.Committed) - ) - (Element.text "Payment Due") - , Element.el - ([ Element.Events.onClick <| ViewPhaseChanged CTypes.Judgment ] - ++ phaseButtonStyles (activePhase == CTypes.Judgment) - ) - (Element.text "Release Due") - , Element.el - ([ Element.Events.onClick <| ViewPhaseChanged CTypes.Closed ] - ++ phaseButtonStyles (activePhase == CTypes.Closed) - ) - (Element.text "Closed") - ] - - tradeMatchesUserRole : CTypes.FullTradeInfo -> BuyerOrSeller -> Address -> Bool tradeMatchesUserRole trade role userAddress = CTypes.getBuyerOrSeller trade userAddress == Just role -maybeResultsElement : Time.Posix -> TradeCache -> Model -> Element Msg -maybeResultsElement time tradeCache model = +resultsAndStatusElement : Time.Posix -> List TradeCache -> Model -> Element Msg +resultsAndStatusElement time tradeCaches model = let statusMsgElement s = Element.el @@ -182,238 +99,73 @@ maybeResultsElement time tradeCache model = (Element.text s) userTrades = - TradeCache.loadedValidTrades tradeCache - |> filterAndSortTrades - (basicFilterFunc model) - (basicSortFunc model) + tradeCaches + |> List.map + (\tradeCache -> + TradeCache.loadedValidTrades tradeCache + |> filterTrades + (basicFilterFunc model) + ) + |> List.concat visibleTrades = userTrades - |> List.filter - (\trade -> - tradeMatchesUserRole trade model.agentRole model.agentAddress - && (trade.state.phase == model.viewPhase) - ) - in - case ( tradeCache.dataFetchStatus.total, visibleTrades ) of - ( Nothing, _ ) -> - statusMsgElement "Querying Factory contract..." - - ( Just 0, _ ) -> - statusMsgElement "No trades found." - ( Just totalTrades, [] ) -> - if tradeCache.dataFetchStatus.loaded < (totalTrades - tradeCache.dataFetchStatus.invalid) then - statusMsgElement "Searching for user trades..." + statusMessages : List (Element Msg) + statusMessages = + if List.all ((==) TradeCache.NoneFound) (List.map TradeCache.loadingStatus tradeCaches) then + [ statusMsgElement "No trades found." ] else - statusMsgElement "No matching trades found." - - ( Just totalTrades, _ ) -> - resultsElement time visibleTrades model - - -resultsElement : Time.Posix -> List CTypes.FullTradeInfo -> Model -> Element Msg -resultsElement time visibleTrades model = - let - amountTitleString = - case model.agentRole of - Buyer -> - "Buying" - - Seller -> - "Selling" - - phaseCountdownTitleString = - case model.viewPhase of - CTypes.Open -> - "Expires in" - - CTypes.Committed -> - "Payment Due" - - CTypes.Judgment -> - "Auto-Release" - - CTypes.Closed -> - "" + tradeCaches + |> List.map + (\tc -> + case TradeCache.loadingStatus tc of + TradeCache.QueryingNumTrades -> + Just <| factoryName tc.factory ++ "Querying Factory..." + + TradeCache.NoneFound -> + Nothing + + TradeCache.FetchingTrades -> + Just <| factoryName tc.factory ++ "Fetching Trades" + + TradeCache.AllFetched -> + Nothing + ) + |> Maybe.Extra.values + |> List.map statusMsgElement in Element.column - [ Element.width Element.fill - , Element.height Element.fill - , Element.paddingXY 30 10 - , Element.spacing 5 - ] - [ Element.row - [ Element.width Element.fill ] - [ if model.viewPhase /= CTypes.Closed then - cellMaker ( 2, columnHeader phaseCountdownTitleString ) - - else + [ Element.spacing 10 ] + [ case statusMessages of + [] -> Element.none - , cellMaker ( 1, columnHeader amountTitleString ) - , cellMaker ( 2, columnHeader "For Fiat" ) - , cellMaker ( 6, columnHeader "Payment Methods" ) - , cellMaker ( 2, Element.none ) - ] - , Element.column - [ Element.width Element.fill - , Element.Border.width 1 - , Element.Border.rounded 8 - , Element.Border.color EH.lightGray - , Element.spacing 1 - , Element.Background.color EH.lightGray - , Element.clip - ] - (visibleTrades - |> List.map - (viewTradeRow time (model.userInfo /= Nothing) model.agentRole model.viewPhase) - ) - ] - -viewTradeRow : Time.Posix -> Bool -> BuyerOrSeller -> CTypes.Phase -> CTypes.FullTradeInfo -> Element Msg -viewTradeRow time web3Connected userRole viewPhase trade = - Element.row - [ Element.width Element.fill - , Element.spacing 1 + _ -> + Element.column [ Element.spacing 5 ] statusMessages + , maybeResultsElement time visibleTrades model ] - [ case viewPhase of - CTypes.Open -> - cellMaker ( 2, phaseCountdown time trade False web3Connected ) - CTypes.Committed -> - cellMaker ( 2, phaseCountdown time trade (userRole == Buyer) web3Connected ) - CTypes.Judgment -> - cellMaker ( 2, phaseCountdown time trade (userRole == Seller) web3Connected ) +maybeResultsElement : Time.Posix -> List CTypes.FullTradeInfo -> Model -> Element Msg +maybeResultsElement time visibleTrades model = + if visibleTrades == [] then + Element.none - CTypes.Closed -> - Element.none - , cellMaker ( 1, viewTradeAmount trade.parameters.tradeAmount ) - , cellMaker ( 2, viewFiat trade.terms.price ) - , cellMaker ( 6, viewPaymentMethods trade.terms.paymentMethods ) - , cellMaker ( 2, viewTradeButton trade.id ) - ] - - -cellMaker : ( Int, Element Msg ) -> Element Msg -cellMaker ( portion, cellElement ) = - Element.el - [ Element.width <| Element.fillPortion portion - , Element.height <| Element.px 60 - , Element.clip - , Element.Background.color EH.white - ] - <| - Element.el - [ Element.padding 12 - , Element.centerY - , Element.width Element.fill + else + TradeTable.view + time + model.tradeTable + [ TradeTable.Phase + , TradeTable.Offer + , TradeTable.FiatPrice + , TradeTable.Margin + , TradeTable.PaymentWindow + , TradeTable.BurnWindow ] - cellElement - - -phaseCountdown : Time.Posix -> CTypes.FullTradeInfo -> Bool -> Bool -> Element Msg -phaseCountdown time trade userActionNeeded web3Connected = - case CTypes.getCurrentPhaseTimeoutInfo time trade of - CTypes.TimeLeft timeoutInfo -> - let - baseColor = - if userActionNeeded && (TimeHelpers.getRatio (Tuple.first timeoutInfo) (Tuple.second timeoutInfo) < 0.05) then - EH.red - - else - EH.black - in - EH.intervalWithElapsedBar - [ Element.width Element.fill ] - [ Element.Font.size 16 ] - ( baseColor, EH.lightGray ) - timeoutInfo - - CTypes.TimeUp _ -> - Element.column - [ Element.spacing 4 - , Element.width Element.fill - ] - ([ Element.el - [ Element.centerX - , Element.Font.size 14 - ] - (Element.text (CTypes.getPokeText trade.state.phase)) - ] - ++ (if web3Connected then - [ Element.el - [ Element.centerX ] - (pokeButton trade.creationInfo.address) - ] - - else - [] - ) - ) - - -pokeButton : Address -> Element Msg -pokeButton address = - Element.Input.button - [ Element.Background.color <| Element.rgba255 16 7 234 0.2 - , Element.padding 5 - , Element.Border.rounded 4 - , Element.width Element.fill - , Element.mouseOver [ Element.Background.color <| Element.rgba255 16 7 234 0.4 ] - ] - { onPress = Just <| Poke address - , label = - Element.el - [ Element.centerX - , Element.Font.color <| Element.rgb255 16 7 234 - , Element.Font.medium - , Element.Font.size 14 - ] - (Element.text "Poke") - } - - -viewTradeAmount : TokenValue -> Element Msg -viewTradeAmount tradeAmount = - EH.daiValue tradeAmount - - -viewFiat : FiatValue -> Element Msg -viewFiat price = - EH.fiatValue price - - -viewMargin : CTypes.FullTradeInfo -> Bool -> Element Msg -viewMargin trade upIsGreen = - trade.derived.margin - |> Maybe.map (EH.coloredMargin upIsGreen) - |> Maybe.withDefault Element.none - - -viewPaymentMethods : List PaymentMethod -> Element Msg -viewPaymentMethods paymentMethods = - paymentMethods - |> List.head - |> Maybe.map PaymentMethods.previewTextHack - |> Maybe.withDefault Element.none - - -viewTradeButton : Int -> Element Msg -viewTradeButton factoryID = - Element.Input.button - [ Element.Background.color <| Element.rgba255 16 7 234 0.2 - , Element.padding 11 - , Element.Border.rounded 4 - , Element.width Element.fill - , Element.mouseOver [ Element.Background.color <| Element.rgba255 16 7 234 0.4 ] - ] - { onPress = Just <| TradeClicked factoryID - , label = - Element.el [ Element.centerX, Element.Font.color <| Element.rgb255 16 7 234, Element.Font.medium ] <| Element.text "View Offer" - } + visibleTrades + |> Element.map TradeTableMsg getLoadedTrades : List CTypes.Trade -> List CTypes.FullTradeInfo @@ -429,19 +181,12 @@ getLoadedTrades = ) -filterAndSortTrades : +filterTrades : (CTypes.FullTradeInfo -> Bool) - -> (CTypes.FullTradeInfo -> CTypes.FullTradeInfo -> Order) -> List CTypes.FullTradeInfo -> List CTypes.FullTradeInfo -filterAndSortTrades filterFunc sortFunc = +filterTrades filterFunc = List.filter filterFunc - >> List.sortWith sortFunc - - -columnHeader : String -> Element Msg -columnHeader title = - Element.el [ Element.Font.medium, Element.Font.size 17 ] <| Element.text title basicFilterFunc : Model -> (CTypes.FullTradeInfo -> Bool) @@ -449,21 +194,3 @@ basicFilterFunc model = \trade -> (trade.parameters.initiatorAddress == model.agentAddress) || (trade.state.responder == Just model.agentAddress) - - -basicSortFunc : Model -> (CTypes.FullTradeInfo -> CTypes.FullTradeInfo -> Order) -basicSortFunc model = - \a b -> - let - phaseOrder = - compare - (CTypes.phaseToInt a.state.phase) - (CTypes.phaseToInt b.state.phase) - in - if phaseOrder == EQ then - phaseOrder - - else - TimeHelpers.compare - a.derived.phaseEndTime - b.derived.phaseEndTime diff --git a/src/Helpers/ChainCmd.elm b/src/ChainCmd.elm similarity index 63% rename from src/Helpers/ChainCmd.elm rename to src/ChainCmd.elm index 820f834..589a4c9 100644 --- a/src/Helpers/ChainCmd.elm +++ b/src/ChainCmd.elm @@ -1,7 +1,8 @@ -port module Helpers.ChainCmd exposing (ChainCmd, custom, execute, map, none) +port module ChainCmd exposing (ChainCmd(..), custom, execute, map, none) import Eth.Sentry.Tx as TxSentry import Eth.Types +import UserNotice as UN type ChainCmd msg @@ -19,14 +20,26 @@ custom customSend txParams = CustomSend customSend txParams -execute : TxSentry.TxSentry msg -> ChainCmd msg -> ( TxSentry.TxSentry msg, Cmd msg ) -execute txSentry chainCmdOrder = - case chainCmdOrder of - None -> - ( txSentry, Cmd.none ) +execute : Maybe (TxSentry.TxSentry msg) -> ChainCmd msg -> ( Maybe (TxSentry.TxSentry msg), Cmd msg, List (UN.UserNotice msg) ) +execute maybeTxSentry chainCmdOrder = + case ( maybeTxSentry, chainCmdOrder ) of + ( _, None ) -> + ( maybeTxSentry, Cmd.none, [] ) - CustomSend customSend txParams -> + ( Just txSentry, CustomSend customSend txParams ) -> TxSentry.customSend txSentry customSend txParams + |> (\( a, b ) -> + ( Just a, b, [] ) + ) + + _ -> + ( Nothing + , Cmd.none + , [ UN.unexpectedError + "submodel sent chainCmd, but there is no txSentry to use!" + Nothing + ] + ) map : (subMsg -> msg) -> ChainCmd subMsg -> ChainCmd msg diff --git a/src/CommonTypes.elm b/src/CommonTypes.elm index 0032e75..da1c86a 100644 --- a/src/CommonTypes.elm +++ b/src/CommonTypes.elm @@ -1,9 +1,11 @@ -module CommonTypes exposing (..) - +module CommonTypes exposing (BuyerOrSeller(..), FactoryType(..), GTagData, InitiatorOrResponder(..), NativeFactoryType(..), TokenFactoryType(..), UserInfo, buyerOrSellerToString, factoryName, tokenUnitName) + +import Eth.Net import Eth.Types exposing (Address) import Json.Decode import Json.Encode + type alias GTagData = { event : String , category : String @@ -11,6 +13,7 @@ type alias GTagData = , value : Int } + type FactoryType = Native NativeFactoryType | Token TokenFactoryType @@ -28,7 +31,8 @@ type TokenFactoryType type alias UserInfo = - { address : Address + { network : Eth.Net.NetworkId + , address : Address , commPubkey : String } @@ -51,3 +55,41 @@ buyerOrSellerToString role = Seller -> "Seller" + + +factoryName : FactoryType -> String +factoryName factoryType = + case factoryType of + Token EthDai -> + "Dai" + + Native Eth -> + "Ether" + + Token KovanDai -> + "Kovan Dai" + + Native Kovan -> + "Kovan Ether" + + Native XDai -> + "xDai" + + +tokenUnitName : FactoryType -> String +tokenUnitName factoryType = + case factoryType of + Token EthDai -> + "Dai" + + Token KovanDai -> + "Dai" + + Native Eth -> + "ETH" + + Native Kovan -> + "ETH" + + Native XDai -> + "xDai" diff --git a/src/Config.elm b/src/Config.elm index 6d21e5e..ef0230e 100644 --- a/src/Config.elm +++ b/src/Config.elm @@ -1,4 +1,4 @@ -module Config exposing (devFeeAddress, factoryAddress, tokenContractAddress, tokenDecimals, tokenUnitName) +module Config exposing (activeFactories, devFeeAddress, factoryAddress, tokenContractAddress, tokenDecimals) import CommonTypes exposing (..) import Eth.Net @@ -10,23 +10,11 @@ tokenDecimals = 18 -tokenUnitName : FactoryType -> String -tokenUnitName factoryType = - case factoryType of - Token EthDai -> - "Dai" - - Token KovanDai -> - "Dai" - - Native Eth -> - "ETH" - - Native Kovan -> - "ETH" - - Native XDai -> - "xDai" +activeFactories : List FactoryType +activeFactories = + [ Token EthDai + , Native XDai + ] tokenContractAddress : TokenFactoryType -> Address diff --git a/src/Contracts/Types.elm b/src/Contracts/Types.elm index d715b2b..2c18be0 100644 --- a/src/Contracts/Types.elm +++ b/src/Contracts/Types.elm @@ -1,4 +1,4 @@ -module Contracts.Types exposing (ClosedReason(..), CreateParameters, DAIHardEvent(..), FullTradeInfo, PartialTradeInfo, Phase(..), PhaseStartInfo, State, Terms, TimeoutInfo(..), Trade(..), TradeCreationInfo, TradeParameters, UserParameters, bigIntToPhase, buildCreateParameters, calculateFullInitialDeposit, decodeParameters, decodePhaseStartInfo, decodeState, decodeTerms, defaultAbortPunishment, defaultBuyerDeposit, encodeTerms, eventDecoder, getBuyerOrSeller, getCurrentPhaseTimeoutInfo, getDevFee, getInitiatorOrResponder, getPhaseInterval, getPokeText, getResponderRole, initiatorOrResponderToBuyerOrSeller, partialTradeInfo, phaseIcon, phaseToInt, phaseToString, responderDeposit, tradeHasDefaultParameters, txReceiptToCreatedTradeSellId, updateCreationInfo, updateParameters, updatePhaseStartInfo, updateState, updateTerms) +module Contracts.Types exposing (ClosedReason(..), CreateParameters, DAIHardEvent(..), FullTradeInfo, PartialTradeInfo, Phase(..), PhaseStartInfo, State, Terms, TimeoutInfo(..), Trade(..), TradeCreationInfo, TradeParameters, UserParameters, bigIntToPhase, buildCreateParameters, calculateFullInitialDeposit, decodeParameters, decodePhaseStartInfo, decodeState, decodeTerms, defaultAbortPunishment, defaultBuyerDeposit, encodeTerms, eventDecoder, getBuyerOrSeller, getCurrentPhaseTimeoutInfo, getDevFee, getInitiatorOrResponder, getPhaseInterval, getPokeText, getResponderRole, initiatorOrResponderToBuyerOrSeller, partialTradeInfo, phaseIcon, phaseToInt, phaseToString, responderDeposit, tradeAddress, tradeFactory, tradeHasDefaultParameters, txReceiptToCreatedTradeSellId, updateCreationInfo, updateParameters, updatePhaseStartInfo, updateState, updateTerms) import Abi.Decode import BigInt exposing (BigInt) @@ -28,7 +28,8 @@ type Trade type alias PartialTradeInfo = - { id : Int + { factory : FactoryType + , id : Int , creationInfo : Maybe TradeCreationInfo , parameters : Maybe TradeParameters , state : Maybe State @@ -38,7 +39,8 @@ type alias PartialTradeInfo = type alias FullTradeInfo = - { id : Int + { factory : FactoryType + , id : Int , creationInfo : TradeCreationInfo , parameters : TradeParameters , state : State @@ -155,6 +157,33 @@ type alias PhaseStartInfo = } +tradeFactory : Trade -> Maybe FactoryType +tradeFactory trade = + case trade of + Invalid -> + Nothing + + PartiallyLoadedTrade pTrade -> + Just pTrade.factory + + LoadedTrade fTrade -> + Just fTrade.factory + + +tradeAddress : Trade -> Maybe Address +tradeAddress trade = + case trade of + Invalid -> + Nothing + + PartiallyLoadedTrade pTrade -> + pTrade.creationInfo + |> Maybe.map .address + + LoadedTrade fTrade -> + Just fTrade.creationInfo.address + + defaultBuyerDeposit : TokenValue -> TokenValue defaultBuyerDeposit tradeAmount = TokenValue.div tradeAmount 3 @@ -190,9 +219,9 @@ responderDeposit parameters = parameters.buyerDeposit -partialTradeInfo : Int -> Trade -partialTradeInfo factoryID = - PartiallyLoadedTrade (PartialTradeInfo factoryID Nothing Nothing Nothing Nothing Nothing) +partialTradeInfo : FactoryType -> Int -> Trade +partialTradeInfo factory factoryID = + PartiallyLoadedTrade (PartialTradeInfo factory factoryID Nothing Nothing Nothing Nothing Nothing) updateCreationInfo : TradeCreationInfo -> Trade -> Trade @@ -287,6 +316,7 @@ checkIfTradeLoaded pInfo = ( ( Just creationInfo, Just parameters ), ( Just state, Just terms ), Just phaseStartInfo ) -> LoadedTrade (FullTradeInfo + pInfo.factory pInfo.id creationInfo parameters diff --git a/src/Contracts/Wrappers.elm b/src/Contracts/Wrappers.elm index c4ea368..ee0263a 100644 --- a/src/Contracts/Wrappers.elm +++ b/src/Contracts/Wrappers.elm @@ -63,64 +63,64 @@ openTrade factoryType parameters = ) -getAllowanceCmd : EthHelpers.Web3Context -> TokenFactoryType -> Address -> Address -> (Result Http.Error BigInt -> msg) -> Cmd msg -getAllowanceCmd web3Context tokenFactoryType owner spender msgConstructor = +getAllowanceCmd : TokenFactoryType -> Address -> Address -> (Result Http.Error BigInt -> msg) -> Cmd msg +getAllowanceCmd tokenType owner spender msgConstructor = Eth.call - web3Context.httpProvider + (EthHelpers.httpProviderForFactory (Token tokenType)) (TokenContract.allowance - (Config.tokenContractAddress tokenFactoryType) + (Config.tokenContractAddress tokenType) owner spender ) |> Task.attempt msgConstructor -getNumTradesCmd : EthHelpers.Web3Context -> (Result Http.Error BigInt -> msg) -> Cmd msg -getNumTradesCmd web3Context msgConstructor = - Eth.call web3Context.httpProvider (DHF.numTrades (Config.factoryAddress web3Context.factoryType)) +getNumTradesCmd : FactoryType -> (Result Http.Error BigInt -> msg) -> Cmd msg +getNumTradesCmd factoryType msgConstructor = + Eth.call (EthHelpers.httpProviderForFactory factoryType) (DHF.numTrades (Config.factoryAddress factoryType)) |> Task.attempt msgConstructor -getCreationInfoFromIdCmd : EthHelpers.Web3Context -> BigInt -> (Result Http.Error DHF.CreatedTrade -> msg) -> Cmd msg -getCreationInfoFromIdCmd web3Context ttId msgConstructor = - Eth.call web3Context.httpProvider (DHF.createdTrades (Config.factoryAddress web3Context.factoryType) ttId) +getCreationInfoFromIdCmd : FactoryType -> BigInt -> (Result Http.Error DHF.CreatedTrade -> msg) -> Cmd msg +getCreationInfoFromIdCmd factoryType ttId msgConstructor = + Eth.call (EthHelpers.httpProviderForFactory factoryType) (DHF.createdTrades (Config.factoryAddress factoryType) ttId) |> Task.attempt msgConstructor -getParametersAndStateCmd : EthHelpers.Web3Context -> Address -> (Result Http.Error (Result String TradeParameters) -> msg) -> (Result Http.Error (Maybe State) -> msg) -> Cmd msg -getParametersAndStateCmd web3Context address parametersMsgConstructor stateMsgConstructor = +getParametersAndStateCmd : FactoryType -> Address -> (Result Http.Error (Result String TradeParameters) -> msg) -> (Result Http.Error (Maybe State) -> msg) -> Cmd msg +getParametersAndStateCmd factoryType address parametersMsgConstructor stateMsgConstructor = Cmd.batch - [ getParametersCmd web3Context address parametersMsgConstructor - , getStateCmd web3Context address stateMsgConstructor + [ getParametersCmd factoryType address parametersMsgConstructor + , getStateCmd factoryType address stateMsgConstructor ] -getParametersStateAndPhaseInfoCmd : EthHelpers.Web3Context -> Address -> (Result Http.Error (Result String TradeParameters) -> msg) -> (Result Http.Error (Maybe State) -> msg) -> (Result Http.Error (Maybe PhaseStartInfo) -> msg) -> Cmd msg -getParametersStateAndPhaseInfoCmd web3Context address parametersMsgConstructor stateMsgConstructor phaseStartInfoConstructor = +getParametersStateAndPhaseInfoCmd : FactoryType -> Address -> (Result Http.Error (Result String TradeParameters) -> msg) -> (Result Http.Error (Maybe State) -> msg) -> (Result Http.Error (Maybe PhaseStartInfo) -> msg) -> Cmd msg +getParametersStateAndPhaseInfoCmd factoryType address parametersMsgConstructor stateMsgConstructor phaseStartInfoConstructor = Cmd.batch - [ getParametersCmd web3Context address parametersMsgConstructor - , getStateCmd web3Context address stateMsgConstructor - , getPhaseStartInfoCmd web3Context address phaseStartInfoConstructor + [ getParametersCmd factoryType address parametersMsgConstructor + , getStateCmd factoryType address stateMsgConstructor + , getPhaseStartInfoCmd factoryType address phaseStartInfoConstructor ] -getParametersCmd : EthHelpers.Web3Context -> Address -> (Result Http.Error (Result String TradeParameters) -> msg) -> Cmd msg -getParametersCmd web3Context ttAddress msgConstructor = - Eth.call web3Context.httpProvider (DHT.getParameters ttAddress) +getParametersCmd : FactoryType -> Address -> (Result Http.Error (Result String TradeParameters) -> msg) -> Cmd msg +getParametersCmd factoryType ttAddress msgConstructor = + Eth.call (EthHelpers.httpProviderForFactory factoryType) (DHT.getParameters ttAddress) |> Task.map decodeParameters |> Task.attempt msgConstructor -getStateCmd : EthHelpers.Web3Context -> Address -> (Result Http.Error (Maybe State) -> msg) -> Cmd msg -getStateCmd web3Context ttAddress msgConstructor = - Eth.call web3Context.httpProvider (DHT.getState ttAddress) +getStateCmd : FactoryType -> Address -> (Result Http.Error (Maybe State) -> msg) -> Cmd msg +getStateCmd factoryType ttAddress msgConstructor = + Eth.call (EthHelpers.httpProviderForFactory factoryType) (DHT.getState ttAddress) |> Task.map decodeState |> Task.attempt msgConstructor -getPhaseStartInfoCmd : EthHelpers.Web3Context -> Address -> (Result Http.Error (Maybe PhaseStartInfo) -> msg) -> Cmd msg -getPhaseStartInfoCmd web3Context ttAddress msgConstructor = - Eth.call web3Context.httpProvider (DHT.getPhaseStartInfo ttAddress) +getPhaseStartInfoCmd : FactoryType -> Address -> (Result Http.Error (Maybe PhaseStartInfo) -> msg) -> Cmd msg +getPhaseStartInfoCmd factoryType ttAddress msgConstructor = + Eth.call (EthHelpers.httpProviderForFactory factoryType) (DHT.getPhaseStartInfo ttAddress) |> Task.map decodePhaseStartInfo |> Task.attempt msgConstructor diff --git a/src/Create/State.elm b/src/Create/State.elm index b31937a..2f25540 100644 --- a/src/Create/State.elm +++ b/src/Create/State.elm @@ -1,7 +1,8 @@ -module Create.State exposing (init, subscriptions, update, updateUserInfo, updateWeb3Context) +module Create.State exposing (init, subscriptions, update, updateWalletState) import AppCmd import BigInt exposing (BigInt) +import ChainCmd exposing (ChainCmd) import CommonTypes exposing (..) import Config import Contracts.Generated.ERC20Token as TokenContract @@ -14,7 +15,6 @@ import Eth.Types exposing (Address) import FiatValue exposing (FiatValue) import Flip exposing (flip) import Helpers.BigInt as BigIntHelpers -import Helpers.ChainCmd as ChainCmd exposing (ChainCmd) import Helpers.Eth as EthHelpers import Helpers.Time as TimeHelpers import Helpers.Tuple exposing (extractTuple3Result, mapEachTuple3) @@ -27,14 +27,14 @@ import Task import Time import TokenValue exposing (TokenValue) import UserNotice as UN +import Wallet -init : EthHelpers.Web3Context -> Maybe UserInfo -> UpdateResult -init web3Context userInfo = +init : Wallet.State -> UpdateResult +init wallet = let model = - { web3Context = web3Context - , userInfo = userInfo + { wallet = wallet , inputs = initialInputs , errors = noErrors , showFiatTypeDropdown = False @@ -63,43 +63,36 @@ initialInputs = } -updateUserInfo : Maybe UserInfo -> Model -> ( Model, Cmd Msg ) -updateUserInfo userInfo model = - ( { model | userInfo = userInfo } +updateWalletState : Wallet.State -> Model -> ( Model, Cmd Msg ) +updateWalletState wallet model = + ( { model | wallet = wallet } |> updateInputs model.inputs - , case ( userInfo, model.web3Context.factoryType ) of - ( Just uInfo, Token tokenType ) -> + , case ( Wallet.userInfo wallet, Wallet.factory wallet ) of + ( Just uInfo, Just (Token tokenType) ) -> Contracts.Wrappers.getAllowanceCmd - model.web3Context tokenType uInfo.address - (Config.factoryAddress model.web3Context.factoryType) - AllowanceFetched + (Config.factoryAddress (Token tokenType)) + (AllowanceFetched tokenType) _ -> Cmd.none ) -updateWeb3Context : EthHelpers.Web3Context -> Model -> Model -updateWeb3Context newWeb3Context model = - { model | web3Context = newWeb3Context } - - update : Msg -> Model -> UpdateResult update msg prevModel = case msg of Refresh time -> - case ( prevModel.userInfo, prevModel.web3Context.factoryType ) of - ( Just userInfo, Token tokenType ) -> + case ( Wallet.userInfo prevModel.wallet, Wallet.factory prevModel.wallet ) of + ( Just userInfo, Just (Token tokenType) ) -> let cmd = Contracts.Wrappers.getAllowanceCmd - prevModel.web3Context tokenType userInfo.address - (Config.factoryAddress prevModel.web3Context.factoryType) - AllowanceFetched + (Config.factoryAddress (Token tokenType)) + (AllowanceFetched tokenType) in UpdateResult prevModel @@ -231,8 +224,8 @@ update msg prevModel = [] ) - CreateClicked userInfo -> - case validateInputs prevModel.web3Context.factoryType prevModel.inputs of + CreateClicked factoryType userInfo -> + case validateInputs prevModel.inputs of Ok userParameters -> let createParameters = @@ -240,7 +233,7 @@ update msg prevModel = in justModelUpdate { prevModel - | txChainStatus = Just <| Confirm createParameters + | txChainStatus = Just <| Confirm factoryType createParameters , depositAmount = Just <| (CTypes.calculateFullInitialDeposit createParameters @@ -273,12 +266,12 @@ update msg prevModel = ChainCmd.none [ AppCmd.gTag "abort" "abort" "create" 0 ] - ConfirmCreate createParameters fullDepositAmount -> + ConfirmCreate factoryType createParameters fullDepositAmount -> let ( txChainStatus, chainCmd ) = - case prevModel.web3Context.factoryType of + case factoryType of Native _ -> - initiateCreateCall prevModel.web3Context.factoryType createParameters + initiateCreateCall factoryType createParameters Token tokenType -> let @@ -287,13 +280,13 @@ update msg prevModel = txParams = TokenContract.approve (Config.tokenContractAddress tokenType) - (Config.factoryAddress prevModel.web3Context.factoryType) + (Config.factoryAddress factoryType) fullDepositAmount |> Eth.toSend customSend = { onMined = Nothing - , onSign = Just (ApproveSigned createParameters) + , onSign = Just (ApproveSigned tokenType createParameters) , onBroadcast = Nothing } in @@ -302,13 +295,13 @@ update msg prevModel = case prevModel.allowance of Just allowance -> if BigInt.compare allowance fullDepositAmount /= LT then - initiateCreateCall prevModel.web3Context.factoryType createParameters + initiateCreateCall factoryType createParameters else - ( Just ApproveNeedsSig, approveChainCmd ) + ( Just (ApproveNeedsSig tokenType), approveChainCmd ) Nothing -> - ( Just ApproveNeedsSig, approveChainCmd ) + ( Just (ApproveNeedsSig tokenType), approveChainCmd ) in UpdateResult { prevModel | txChainStatus = txChainStatus } @@ -316,10 +309,10 @@ update msg prevModel = chainCmd [] - ApproveSigned createParameters result -> + ApproveSigned tokenType createParameters result -> case result of Ok txHash -> - justModelUpdate { prevModel | txChainStatus = Just <| ApproveMining createParameters txHash } + justModelUpdate { prevModel | txChainStatus = Just <| ApproveMining tokenType createParameters txHash } Err s -> UpdateResult @@ -328,7 +321,7 @@ update msg prevModel = ChainCmd.none [ AppCmd.UserNotice <| UN.web3SigError "appove" s ] - AllowanceFetched fetchResult -> + AllowanceFetched tokenType fetchResult -> case fetchResult of Ok allowance -> let @@ -338,11 +331,11 @@ update msg prevModel = } in case ( newModel.txChainStatus, newModel.depositAmount ) of - ( Just (ApproveMining createParameters _), Just depositAmount ) -> + ( Just (ApproveMining _ createParameters _), Just depositAmount ) -> if BigInt.compare allowance depositAmount /= LT then let ( txChainStatus, chainCmd ) = - initiateCreateCall newModel.web3Context.factoryType createParameters + initiateCreateCall (Token tokenType) createParameters in UpdateResult { newModel | txChainStatus = txChainStatus } @@ -363,10 +356,10 @@ update msg prevModel = ChainCmd.none [ AppCmd.UserNotice <| UN.web3FetchError "allowance" httpError ] - CreateSigned result -> + CreateSigned factoryType result -> case result of Ok txHash -> - justModelUpdate { prevModel | txChainStatus = Just <| CreateMining txHash } + justModelUpdate { prevModel | txChainStatus = Just <| CreateMining factoryType txHash } Err s -> UpdateResult @@ -375,17 +368,17 @@ update msg prevModel = ChainCmd.none [ AppCmd.UserNotice <| UN.web3SigError "create" s ] - CreateMined (Err s) -> + CreateMined factoryType (Err s) -> UpdateResult prevModel Cmd.none ChainCmd.none [ AppCmd.UserNotice <| UN.web3MiningError "create" s ] - CreateMined (Ok txReceipt) -> + CreateMined factory (Ok txReceipt) -> let maybeId = - CTypes.txReceiptToCreatedTradeSellId prevModel.web3Context.factoryType txReceipt + CTypes.txReceiptToCreatedTradeSellId factory txReceipt |> Result.toMaybe |> Maybe.andThen BigIntHelpers.toInt in @@ -395,7 +388,7 @@ update msg prevModel = prevModel Cmd.none ChainCmd.none - [ AppCmd.GotoRoute (Routing.Trade id) ] + [ AppCmd.GotoRoute (Routing.Trade factory id) ] Nothing -> UpdateResult @@ -434,12 +427,12 @@ initiateCreateCall factoryType parameters = |> Eth.toSend customSend = - { onMined = Just ( CreateMined, Nothing ) - , onSign = Just CreateSigned + { onMined = Just ( CreateMined factoryType, Nothing ) + , onSign = Just (CreateSigned factoryType) , onBroadcast = Nothing } in - ( Just CreateNeedsSig + ( Just (CreateNeedsSig factoryType) , ChainCmd.custom customSend txParams ) @@ -454,7 +447,7 @@ updateParameters : Model -> Model updateParameters model = let validateResult = - validateInputs model.web3Context.factoryType model.inputs + validateInputs model.inputs -- Don't log errors right away (wait until the user tries to submit) -- But if there are already errors displaying, update them accordingly @@ -474,14 +467,14 @@ updateParameters model = | createParameters = Maybe.map2 CTypes.buildCreateParameters - model.userInfo + (Wallet.userInfo model.wallet) (Result.toMaybe validateResult) , errors = newErrors } -validateInputs : FactoryType -> Inputs -> Result Errors CTypes.UserParameters -validateInputs factoryType inputs = +validateInputs : Inputs -> Result Errors CTypes.UserParameters +validateInputs inputs = Result.map5 (\daiAmount fiatAmount fiatType paymentMethod ( autorecallInterval, autoabortInterval, autoreleaseInterval ) -> { initiatorRole = inputs.userRole @@ -497,7 +490,7 @@ validateInputs factoryType inputs = ] } ) - (interpretDaiAmount factoryType inputs.daiAmount + (interpretDaiAmount inputs.daiAmount |> Result.mapError (\e -> { noErrors | daiAmount = Just e }) ) (interpretFiatAmount inputs.fiatAmount @@ -536,8 +529,8 @@ validateInputs factoryType inputs = ) -interpretDaiAmount : FactoryType -> String -> Result String TokenValue -interpretDaiAmount factoryType input = +interpretDaiAmount : String -> Result String TokenValue +interpretDaiAmount input = if input == "" then Err "You must specify a trade amount." @@ -548,7 +541,7 @@ interpretDaiAmount factoryType input = Just value -> if TokenValue.getFloatValueWithWarning value < 1 then - Err <| "Trade amount must be a least 1 " ++ Config.tokenUnitName factoryType ++ "." + Err <| "Trade amount can't be less than 1." else Ok value diff --git a/src/Create/Types.elm b/src/Create/Types.elm index 6761f37..6a79474 100644 --- a/src/Create/Types.elm +++ b/src/Create/Types.elm @@ -6,18 +6,18 @@ import CommonTypes exposing (..) import Contracts.Types as CTypes import Create.PMWizard.Types as PMWizard import Eth.Types exposing (Address, TxHash, TxReceipt) -import Helpers.ChainCmd as ChainCmd exposing (ChainCmd) -import Helpers.Eth as EthHelpers exposing (Web3Context) +import ChainCmd exposing (ChainCmd) +import Helpers.Eth as EthHelpers import Http import PaymentMethods exposing (PaymentMethod) import Routing import Time import TokenValue exposing (TokenValue) +import Wallet type alias Model = - { web3Context : Web3Context - , userInfo : Maybe UserInfo + { wallet : Wallet.State , inputs : Inputs , errors : Errors , showFiatTypeDropdown : Bool @@ -40,24 +40,24 @@ type Msg | AutoabortIntervalChanged Time.Posix | AutoreleaseIntervalChanged Time.Posix | ChangePaymentMethodText String - | CreateClicked UserInfo + | CreateClicked FactoryType UserInfo | AbortCreate - | ConfirmCreate CTypes.CreateParameters BigInt - | AllowanceFetched (Result Http.Error BigInt) - | ApproveSigned CTypes.CreateParameters (Result String TxHash) - | CreateSigned (Result String TxHash) - | CreateMined (Result String TxReceipt) + | ConfirmCreate FactoryType CTypes.CreateParameters BigInt + | AllowanceFetched TokenFactoryType (Result Http.Error BigInt) + | ApproveSigned TokenFactoryType CTypes.CreateParameters (Result String TxHash) + | CreateSigned FactoryType (Result String TxHash) + | CreateMined FactoryType (Result String TxReceipt) | Web3Connect | NoOp | AppCmd (AppCmd Msg) type TxChainStatus - = Confirm CTypes.CreateParameters - | ApproveNeedsSig - | ApproveMining CTypes.CreateParameters TxHash - | CreateNeedsSig - | CreateMining TxHash + = Confirm FactoryType CTypes.CreateParameters + | ApproveNeedsSig TokenFactoryType + | ApproveMining TokenFactoryType CTypes.CreateParameters TxHash + | CreateNeedsSig FactoryType + | CreateMining FactoryType TxHash type alias Inputs = diff --git a/src/Create/View.elm b/src/Create/View.elm index 7e73a1e..82cdc3f 100644 --- a/src/Create/View.elm +++ b/src/Create/View.elm @@ -24,6 +24,7 @@ import Maybe.Extra import PaymentMethods exposing (PaymentMethod) import Time import TokenValue exposing (TokenValue) +import Wallet root : Model -> Element Msg @@ -44,41 +45,48 @@ root model = ] [ mainInputElement model , phasesElement model - , openButtonElement model.userInfo + , openButtonElement model.wallet ] mainInputElement : Model -> Element Msg mainInputElement model = - Element.column - [ Element.width Element.fill - , Element.spacing 20 - , Element.Background.color EH.white - , Element.Border.rounded 5 - , Element.padding 20 - , EH.subtleShadow - ] - [ Element.row - [ Element.width Element.fill - , Element.spaceEvenly - ] - [ tradeTypeElement model - , daiElement model - , fiatElement model - ] - , feeNotifyElement model - ] + case Wallet.factory model.wallet of + Just factory -> + Element.column + [ Element.width Element.fill + , Element.spacing 20 + , Element.Background.color EH.white + , Element.Border.rounded 5 + , Element.padding 20 + , EH.subtleShadow + ] + [ Element.row + [ Element.width Element.fill + , Element.spaceEvenly + ] + [ tradeTypeElement factory model + , daiElement factory model + ] + , feeNotifyElement model + ] + + Nothing -> + Debug.todo "" -tradeTypeElement : Model -> Element Msg -tradeTypeElement model = +tradeTypeElement : FactoryType -> Model -> Element Msg +tradeTypeElement factory model = EH.withHeader "Trade Type" - (roleToggleElement model.web3Context.factoryType model.inputs.userRole) + (roleToggleElement + (tokenUnitName factory) + model.inputs.userRole + ) -roleToggleElement : FactoryType -> BuyerOrSeller -> Element Msg -roleToggleElement factoryType userRole = +roleToggleElement : String -> BuyerOrSeller -> Element Msg +roleToggleElement tokenName userRole = let baseStyles = [ Element.Font.size 24 @@ -101,15 +109,15 @@ roleToggleElement factoryType userRole = Element.row [ Element.spacing 20 ] [ Element.el ([ Element.Events.onClick <| ChangeRole Seller ] ++ sellDaiStyles) - (Element.text <| "Sell " ++ Config.tokenUnitName factoryType) + (Element.text <| "Sell " ++ tokenName) , Element.el ([ Element.Events.onClick <| ChangeRole Buyer ] ++ buyDaiStyles) - (Element.text <| "Buy " ++ Config.tokenUnitName factoryType) + (Element.text <| "Buy " ++ tokenName) ] -daiElement : Model -> Element Msg -daiElement model = +daiElement : FactoryType -> Model -> Element Msg +daiElement factory model = EH.niceBottomBorderEl <| EH.withHeader (case model.inputs.userRole of @@ -119,7 +127,11 @@ daiElement model = Seller -> "You're selling" ) - (daiInputElement model.web3Context.factoryType model.inputs.daiAmount model.errors.daiAmount) + (daiInputElement + factory + model.inputs.daiAmount + model.errors.daiAmount + ) daiInputElement : FactoryType -> String -> Maybe String -> Element Msg @@ -207,16 +219,19 @@ fiatInputElement typeString amountString showFiatTypeDropdown maybeAmountError m FiatAmountChanged -openButtonElement : Maybe UserInfo -> Element Msg -openButtonElement maybeUserInfo = +openButtonElement : Wallet.State -> Element Msg +openButtonElement wallet = Element.el [ Element.centerX ] <| - case maybeUserInfo of - Just userInfo -> - EH.redButton "Open Trade" (CreateClicked userInfo) + case ( Wallet.userInfo wallet, Wallet.factory wallet ) of + ( Just userInfo, Just factory ) -> + EH.redButton "Open Trade" (CreateClicked factory userInfo) - Nothing -> + ( Nothing, _ ) -> EH.redButton "Connect to Wallet" Web3Connect + ( _, Nothing ) -> + EH.disabledButton "Unsupported Network" Nothing + feeNotifyElement : Model -> Element Msg feeNotifyElement model = @@ -228,7 +243,7 @@ feeNotifyElement model = ++ TokenValue.toConciseString (TokenValue.div daiAmount 100) ++ " " - ++ Config.tokenUnitName model.web3Context.factoryType + ++ tokenUnitName (Wallet.factoryWithDefault model.wallet) ++ "." Nothing -> @@ -511,18 +526,15 @@ getModalOrNone model = txChainStatusModal : TxChainStatus -> Model -> Element Msg txChainStatusModal txChainStatus model = case txChainStatus of - Confirm createParameters -> + Confirm factoryType createParameters -> let - tokenUnitName = - Config.tokenUnitName model.web3Context.factoryType - ( depositAmountEl, confirmButton ) = case model.depositAmount of Just depositAmount -> ( TokenValue.tokenValue depositAmount |> TokenValue.toConciseString |> Element.text - , EH.redButton "Yes, I definitely want to open this trade." (ConfirmCreate createParameters depositAmount) + , EH.redButton "Yes, I definitely want to open this trade." (ConfirmCreate factoryType createParameters depositAmount) ) Nothing -> @@ -562,12 +574,12 @@ txChainStatusModal txChainStatus model = (getWarningParagraphs createParameters ++ [ [ Element.text <| "You will deposit " , depositAmountEl - , Element.text <| " " ++ tokenUnitName ++ " (including the 1% dev fee) to open this trade." + , Element.text <| " " ++ tokenUnitName factoryType ++ " (including the 1% dev fee) to open this trade." ] ] - ++ (case model.web3Context.factoryType of + ++ (case factoryType of Token _ -> - [ [ Element.text <| "This ususally requires two Metamask signatures. Your " ++ tokenUnitName ++ " will not be deposited until the final transaction has been mined." ] ] + [ [ Element.text <| "This ususally requires two Metamask signatures. Your " ++ tokenUnitName factoryType ++ " will not be deposited until the final transaction has been mined." ] ] Native _ -> [] @@ -583,7 +595,7 @@ txChainStatusModal txChainStatus model = ) AbortCreate - ApproveNeedsSig -> + ApproveNeedsSig tokenType -> Element.el [ Element.Events.onClick <| AppCmd <| @@ -596,7 +608,7 @@ txChainStatusModal txChainStatus model = , Element.text "Note that there will be a second transaction to sign after this." ] - ApproveMining createParameters txHash -> + ApproveMining tokenType createParameters txHash -> Element.el [ Element.Events.onClick <| AppCmd <| @@ -606,13 +618,13 @@ txChainStatusModal txChainStatus model = EH.txProcessModal [ Element.text "Mining the initial approve transaction..." , Element.newTabLink [ Element.Font.underline, Element.Font.color EH.blue ] - { url = EthHelpers.makeViewTxUrl model.web3Context.factoryType txHash + { url = EthHelpers.makeViewTxUrl (Token tokenType) txHash , label = Element.text "See the transaction on Etherscan" } , Element.text "Funds will not leave your wallet until you sign the next transaction." ] - CreateNeedsSig -> + CreateNeedsSig _ -> Element.el [ Element.Events.onClick <| AppCmd <| @@ -624,7 +636,7 @@ txChainStatusModal txChainStatus model = , Element.text "(check Metamask!)" ] - CreateMining txHash -> + CreateMining factoryType txHash -> Element.el [ Element.Events.onClick <| AppCmd <| @@ -634,7 +646,7 @@ txChainStatusModal txChainStatus model = EH.txProcessModal [ Element.text "Mining the final create call..." , Element.newTabLink [ Element.Font.underline, Element.Font.color EH.blue ] - { url = EthHelpers.makeViewTxUrl model.web3Context.factoryType txHash + { url = EthHelpers.makeViewTxUrl factoryType txHash , label = Element.text "See the transaction on Etherscan" } , Element.text "You will be redirected when it's mined." diff --git a/src/Helpers/Element.elm b/src/Helpers/Element.elm index 78cd2a6..4fd9320 100644 --- a/src/Helpers/Element.elm +++ b/src/Helpers/Element.elm @@ -847,7 +847,7 @@ daiSymbolAndLabel factoryType = , Element.Font.medium , Element.Font.color currencyLabelColor ] - (Element.text <| Config.tokenUnitName factoryType) + (Element.text <| tokenUnitName factoryType) ] diff --git a/src/Helpers/Eth.elm b/src/Helpers/Eth.elm index 362afe9..1f8301d 100644 --- a/src/Helpers/Eth.elm +++ b/src/Helpers/Eth.elm @@ -1,134 +1,32 @@ -module Helpers.Eth exposing (Web3Context, addressIfNot0x0, factoryTypeToNetworkId, factoryTypeToString, getLogAt, intToFactoryType, makeViewAddressUrl, makeViewTxUrl, networkIdToFactoryType, updateCallValue, web3Context) +module Helpers.Eth exposing (addressIfNot0x0, getLogAt, httpProviderForFactory, makeViewAddressUrl, makeViewTxUrl, updateCallValue) import Array import BigInt exposing (BigInt) import CommonTypes exposing (..) import Config -import Eth.Net as Net +import Eth.Net import Eth.Sentry.Tx as TxSentry import Eth.Types exposing (Address, HttpProvider, TxHash, WebsocketProvider) import Eth.Utils -type alias Web3Context = - { factoryType : FactoryType - , httpProvider : HttpProvider - , wsProvider : WebsocketProvider - } - - -factoryTypeToString : FactoryType -> String -factoryTypeToString factoryType = - case factoryType of - Token EthDai -> - "Ethereum Dai" - - Native Eth -> - "Ethereum Eth" - - Token KovanDai -> - "Kovan Dai" - - Native Kovan -> - "Kovan Eth" - - Native XDai -> - "xDai" - - -networkIdToFactoryType : Net.NetworkId -> Maybe FactoryType -networkIdToFactoryType networkId = - case networkId of - Net.Mainnet -> - Just <| Token EthDai - - Net.Kovan -> - Just <| Token KovanDai - - -- Net.RskMain -> - -- Just <| Native Rootstock - -- Net.RskTest -> - -- Just <| Native RootstockTest - Net.Private 100 -> - Just <| Native XDai - - _ -> - Nothing - - -factoryTypeToNetworkId : FactoryType -> Net.NetworkId -factoryTypeToNetworkId factoryType = - case factoryType of - Token EthDai -> - Net.Mainnet - - Native Eth -> - Net.Mainnet - - Token KovanDai -> - Net.Kovan - - Native Kovan -> - Net.Kovan - - -- Native Rootstock -> - -- Net.RskMain - -- Native RootstockTest -> - -- Net.RskTest - Native XDai -> - Net.Private 100 - - -intToFactoryType : Int -> Maybe FactoryType -intToFactoryType = - Net.toNetworkId >> networkIdToFactoryType - - -web3Context : FactoryType -> Web3Context -web3Context factoryType = +httpProviderForFactory : FactoryType -> HttpProvider +httpProviderForFactory factoryType = case factoryType of Token EthDai -> - Web3Context - factoryType - "https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9" - "wss://mainnet.infura.io/ws" + "https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9" Native Eth -> - Web3Context - factoryType - "https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9" - "wss://mainnet.infura.io/ws" + "https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9" Token KovanDai -> - Web3Context - factoryType - "https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9" - "wss://kovan.infura.io/ws" + "https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9" Native Kovan -> - Web3Context - factoryType - "https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9" - "wss://kovan.infura.io/ws" + "https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9" Native XDai -> - 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" --- "" + "https://dai.poa.network" addressIfNot0x0 : Address -> Maybe Address diff --git a/src/Helpers/Tuple.elm b/src/Helpers/Tuple.elm index e243dd1..729b4c0 100644 --- a/src/Helpers/Tuple.elm +++ b/src/Helpers/Tuple.elm @@ -1,4 +1,4 @@ -module Helpers.Tuple exposing (extractTuple3Result, mapEachTuple3, mapTuple2, mapTuple3) +module Helpers.Tuple exposing (extractTuple3Result, mapEachTuple3, mapTuple2, mapTuple3, tuple3First, tuple3Second, tuple3Third) mapTuple2 : (a -> b) -> ( a, a ) -> ( b, b ) @@ -38,3 +38,18 @@ mapEachTuple3 f1 f2 f3 ( v1, v2, v3 ) = , f2 v2 , f3 v3 ) + + +tuple3First : ( a, b, c ) -> a +tuple3First ( a, b, c ) = + a + + +tuple3Second : ( a, b, c ) -> b +tuple3Second ( a, b, c ) = + b + + +tuple3Third : ( a, b, c ) -> c +tuple3Third ( a, b, c ) = + c diff --git a/src/Marketplace/State.elm b/src/Marketplace/State.elm index bc84184..01adb3a 100644 --- a/src/Marketplace/State.elm +++ b/src/Marketplace/State.elm @@ -1,8 +1,9 @@ -module Marketplace.State exposing (init, subscriptions, update, updateUserInfo, updateWeb3Context) +module Marketplace.State exposing (init, subscriptions, update, updateWalletState) import AppCmd import Array exposing (Array) import BigInt exposing (BigInt) +import ChainCmd exposing (ChainCmd) import CommonTypes exposing (..) import Config import Contracts.Types as CTypes @@ -22,20 +23,23 @@ import Time import TokenValue exposing (TokenValue) import TradeCache.State as TradeCache import TradeCache.Types as TradeCache exposing (TradeCache) +import TradeTable.State as TradeTable +import TradeTable.Types as TradeTable +import Wallet -init : EthHelpers.Web3Context -> BuyerOrSeller -> Maybe UserInfo -> ( Model, Cmd Msg ) -init web3Context browsingRole maybeUserInfo = - ( { web3Context = web3Context - , userInfo = maybeUserInfo - , browsingRole = browsingRole +init : Wallet.State -> ( Model, Cmd Msg ) +init wallet = + ( { wallet = wallet + , tradeTable = + TradeTable.init + ( TradeTable.Expires, TradeTable.Ascending ) , inputs = initialInputs , errors = noErrors , showCurrencyDropdown = False , filterFunc = baseFilterFunc - , sortFunc = initialSortFunc } - |> applyInputs + -- |> applyInputs , Cmd.none ) @@ -45,79 +49,36 @@ initialInputs = { minDai = "" , maxDai = "" , fiatType = "" - , minFiat = "" - , maxFiat = "" , paymentMethod = "" , paymentMethodTerms = [] } update : Msg -> Model -> UpdateResult -update msg model = +update msg prevModel = case msg of - -- Refresh time -> - -- let - -- cmd = - -- model.trades - -- |> Array.toList - -- |> List.indexedMap - -- (\id trade -> - -- case trade of - -- CTypes.PartiallyLoadedTrade _ -> - -- Cmd.none - -- CTypes.LoadedTrade info -> - -- let - -- address = - -- info.creationInfo.address - -- in - -- Contracts.Wrappers.getStateCmd model.web3Context address (StateFetched id) - -- ) - -- |> Cmd.batch - -- in - -- ( { model | time = time } - -- , cmd - -- , Nothing - -- ) MinDaiChanged input -> - UpdateResult - { model | inputs = model.inputs |> updateMinDaiInput input } - Cmd.none - [] + justModelUpdate + { prevModel | inputs = prevModel.inputs |> updateMinDaiInput input } MaxDaiChanged input -> - UpdateResult - { model | inputs = model.inputs |> updateMaxDaiInput input } - Cmd.none - [] - - MinFiatChanged input -> - UpdateResult - { model | inputs = model.inputs |> updateMinFiatInput input } - Cmd.none - [] - - MaxFiatChanged input -> - UpdateResult - { model | inputs = model.inputs |> updateMaxFiatInput input } - Cmd.none - [] + justModelUpdate + { prevModel | inputs = prevModel.inputs |> updateMaxDaiInput input } FiatTypeInputChanged input -> - UpdateResult - { model | inputs = model.inputs |> updateFiatTypeInput input } - Cmd.none - [] + justModelUpdate + { prevModel | inputs = prevModel.inputs |> updateFiatTypeInput input } ShowCurrencyDropdown flag -> let oldInputs = - model.inputs + prevModel.inputs in - UpdateResult - { model + justModelUpdate + { prevModel | showCurrencyDropdown = flag , inputs = - model.inputs + prevModel.inputs |> (if flag then updateFiatTypeInput "" @@ -125,101 +86,54 @@ update msg model = identity ) } - Cmd.none - [] FiatTypeLostFocus -> - UpdateResult - { model | showCurrencyDropdown = False } - Cmd.none - [] + justModelUpdate + { prevModel | showCurrencyDropdown = False } PaymentMethodInputChanged input -> - UpdateResult - { model | inputs = model.inputs |> updatePaymentMethodInput input } - Cmd.none - [] + justModelUpdate + { prevModel | inputs = prevModel.inputs |> updatePaymentMethodInput input } AddSearchTerm -> - UpdateResult - (model |> addPaymentInputTerm) - Cmd.none - [] + justModelUpdate + (prevModel |> addPaymentInputTerm) RemoveTerm term -> - UpdateResult - (model |> removePaymentInputTerm term) - Cmd.none - [] - - ApplyInputs -> - UpdateResult - (model |> applyInputs) - Cmd.none - [] - + justModelUpdate + (prevModel |> removePaymentInputTerm term) + + -- ApplyInputs -> + -- UpdateResult + -- (prevModel |> applyInputs) + -- Cmd.none + -- [] ResetSearch -> - UpdateResult - (model |> resetSearch) - Cmd.none - [] + justModelUpdate + (prevModel |> resetSearch) - TradeClicked id -> - UpdateResult - model - Cmd.none - [ AppCmd.GotoRoute (Routing.Trade id) ] - - SortBy colType ordering -> + TradeTableMsg tradeTableMsg -> let - newSortFunc = - (\a b -> - case colType of - Expiring -> - TimeHelpers.compare a.derived.phaseEndTime b.derived.phaseEndTime - - TradeAmount -> - TokenValue.compare a.parameters.tradeAmount b.parameters.tradeAmount - - Fiat -> - FiatValue.compare a.terms.price b.terms.price - - Margin -> - Maybe.map2 - (\marginA marginB -> compare marginA marginB) - a.derived.margin - b.derived.margin - |> Maybe.withDefault EQ - - -- The user shouldn't even be able to generate this message - PaymentMethods -> - initialSortFunc a b - - AutoabortWindow -> - TimeHelpers.compare a.parameters.autoabortInterval b.parameters.autoabortInterval - - AutoreleaseWindow -> - TimeHelpers.compare a.parameters.autoreleaseInterval b.parameters.autoreleaseInterval - ) - |> (if ordering == Ascending then - flip - - else - identity - ) + ttUpdateResult = + prevModel.tradeTable + |> TradeTable.update tradeTableMsg in UpdateResult - { model | sortFunc = newSortFunc } - Cmd.none - [] + { prevModel + | tradeTable = ttUpdateResult.model + } + (Cmd.map TradeTableMsg ttUpdateResult.cmd) + (ChainCmd.map TradeTableMsg ttUpdateResult.chainCmd) + (List.map (AppCmd.map TradeTableMsg) ttUpdateResult.appCmds) NoOp -> - noUpdate model + justModelUpdate prevModel AppCmd appCmd -> UpdateResult - model + prevModel Cmd.none + ChainCmd.none [ appCmd ] @@ -244,7 +158,10 @@ addPaymentInputTerm model = |> updatePaymentMethodInput "" |> updatePaymentMethodTerms newSearchTerms } - |> applyInputs + + + +-- |> applyInputs removePaymentInputTerm : String -> Model -> Model @@ -255,112 +172,101 @@ removePaymentInputTerm term model = |> List.filter ((/=) term) in { model | inputs = model.inputs |> updatePaymentMethodTerms newTermList } - |> applyInputs -applyInputs : Model -> Model -applyInputs prevModel = - let - model = - prevModel |> addPaymentInputTerm - in - case inputsToQuery model.inputs of - Err errors -> - { prevModel | errors = errors } - - Ok query -> - let - searchTest time trade = - case query.paymentMethodTerms of - [] -> - True - - terms -> - testTextMatch terms trade.terms.paymentMethods - - daiTest trade = - (case query.dai.min of - Nothing -> - True - Just min -> - TokenValue.compare trade.parameters.tradeAmount min /= LT - ) - && (case query.dai.max of - Nothing -> - True - - Just max -> - TokenValue.compare trade.parameters.tradeAmount max /= GT - ) - - fiatTest trade = - case query.fiat of - Nothing -> - True - - Just fiatQuery -> - (trade.terms.price.fiatType == fiatQuery.type_) - && (case fiatQuery.min of - Nothing -> - True - - Just min -> - BigInt.compare trade.terms.price.amount min /= LT - ) - && (case fiatQuery.max of - Nothing -> - True - - Just max -> - BigInt.compare trade.terms.price.amount max /= GT - ) - - newFilterFunc now trade = - baseFilterFunc now trade - && (trade.parameters.initiatorRole /= model.browsingRole) - && searchTest now trade - && daiTest trade - && fiatTest trade - in - { model - | filterFunc = newFilterFunc - } - - -inputsToQuery : SearchInputs -> Result Errors Query -inputsToQuery inputs = - Result.map4 - (\minDai maxDai fiatMin fiatMax -> - { dai = - { min = minDai - , max = maxDai - } - , fiat = - Maybe.map - (\typeString -> - { type_ = typeString - , min = fiatMin - , max = fiatMax - } - ) - (String.Extra.nonEmpty inputs.fiatType) - , paymentMethodTerms = - inputs.paymentMethodTerms - } - ) - (interpretDaiAmount inputs.minDai - |> Result.mapError (\e -> { noErrors | minDai = Just e }) - ) - (interpretDaiAmount inputs.maxDai - |> Result.mapError (\e -> { noErrors | maxDai = Just e }) - ) - (interpretFiatAmount inputs.minFiat - |> Result.mapError (\e -> { noErrors | minFiat = Just e }) - ) - (interpretFiatAmount inputs.maxFiat - |> Result.mapError (\e -> { noErrors | maxFiat = Just e }) - ) +-- |> applyInputs +-- applyInputs : Model -> Model +-- applyInputs prevModel = +-- let +-- model = +-- prevModel |> addPaymentInputTerm +-- in +-- case inputsToQuery model.inputs of +-- Err errors -> +-- { prevModel | errors = errors } +-- Ok query -> +-- let +-- searchTest time trade = +-- case query.paymentMethodTerms of +-- [] -> +-- True +-- terms -> +-- testTextMatch terms trade.terms.paymentMethods +-- daiTest trade = +-- (case query.dai.min of +-- Nothing -> +-- True +-- Just min -> +-- TokenValue.compare trade.parameters.tradeAmount min /= LT +-- ) +-- && (case query.dai.max of +-- Nothing -> +-- True +-- Just max -> +-- TokenValue.compare trade.parameters.tradeAmount max /= GT +-- ) +-- fiatTest trade = +-- case query.fiat of +-- Nothing -> +-- True +-- Just fiatQuery -> +-- (trade.terms.price.fiatType == fiatQuery.type_) +-- && (case fiatQuery.min of +-- Nothing -> +-- True +-- Just min -> +-- BigInt.compare trade.terms.price.amount min /= LT +-- ) +-- && (case fiatQuery.max of +-- Nothing -> +-- True +-- Just max -> +-- BigInt.compare trade.terms.price.amount max /= GT +-- ) +-- newFilterFunc now trade = +-- baseFilterFunc now trade +-- && (trade.parameters.initiatorRole /= model.browsingRole) +-- && searchTest now trade +-- && daiTest trade +-- && fiatTest trade +-- in +-- { model +-- | filterFunc = newFilterFunc +-- } +-- inputsToQuery : SearchInputs -> Result Errors Query +-- inputsToQuery inputs = +-- Result.map4 +-- (\minDai maxDai fiatMin fiatMax -> +-- { dai = +-- { min = minDai +-- , max = maxDai +-- } +-- , fiat = +-- Maybe.map +-- (\typeString -> +-- { type_ = typeString +-- , min = fiatMin +-- , max = fiatMax +-- } +-- ) +-- (String.Extra.nonEmpty inputs.fiatType) +-- , paymentMethodTerms = +-- inputs.paymentMethodTerms +-- } +-- ) +-- (interpretDaiAmount inputs.minDai +-- |> Result.mapError (\e -> { noErrors | minDai = Just e }) +-- ) +-- (interpretDaiAmount inputs.maxDai +-- |> Result.mapError (\e -> { noErrors | maxDai = Just e }) +-- ) +-- (interpretFiatAmount inputs.minFiat +-- |> Result.mapError (\e -> { noErrors | minFiat = Just e }) +-- ) +-- (interpretFiatAmount inputs.maxFiat +-- |> Result.mapError (\e -> { noErrors | maxFiat = Just e }) +-- ) interpretDaiAmount : String -> Result String (Maybe TokenValue) @@ -394,8 +300,7 @@ interpretFiatAmount input = resetSearch : Model -> Model resetSearch model = { model - | sortFunc = initialSortFunc - , filterFunc = baseFilterFunc + | filterFunc = baseFilterFunc , inputs = initialInputs } @@ -430,14 +335,9 @@ testTextMatch terms paymentMethods = ) -updateUserInfo : Maybe UserInfo -> Model -> Model -updateUserInfo userInfo model = - { model | userInfo = userInfo } - - -updateWeb3Context : EthHelpers.Web3Context -> Model -> Model -updateWeb3Context newWeb3Context model = - { model | web3Context = newWeb3Context } +updateWalletState : Wallet.State -> Model -> Model +updateWalletState wallet model = + { model | wallet = wallet } subscriptions : Model -> Sub Msg diff --git a/src/Marketplace/Types.elm b/src/Marketplace/Types.elm index 2609de2..a377327 100644 --- a/src/Marketplace/Types.elm +++ b/src/Marketplace/Types.elm @@ -1,15 +1,17 @@ -module Marketplace.Types exposing (Errors, FiatTypeAndRange, Model, Msg(..), Ordering(..), Query, ResultColumnType(..), SearchInputs, TokenRange, UpdateResult, noErrors, noUpdate, updateFiatTypeInput, updateMaxDaiInput, updateMaxFiatInput, updateMinDaiInput, updateMinFiatInput, updatePaymentMethodInput, updatePaymentMethodTerms) +module Marketplace.Types exposing (Errors, Model, Msg(..), ResultColumnType(..), SearchInputs, UpdateResult, justModelUpdate, noErrors, updateFiatTypeInput, updateMaxDaiInput, updateMinDaiInput, updatePaymentMethodInput, updatePaymentMethodTerms) import AppCmd exposing (AppCmd) import Array exposing (Array) import BigInt exposing (BigInt) +import ChainCmd exposing (ChainCmd) import CommonTypes exposing (..) import Contracts.Types as CTypes import Dict exposing (Dict) +import Eth.Net import Eth.Sentry.Event as EventSentry exposing (EventSentry) import Eth.Types exposing (Address) import FiatValue exposing (FiatValue) -import Helpers.Eth as EthHelpers exposing (Web3Context) +import Helpers.Eth as EthHelpers import Http import Json.Decode import PaymentMethods exposing (PaymentMethod) @@ -17,17 +19,17 @@ import String.Extra import Time import TokenValue exposing (TokenValue) import TradeCache.Types as TradeCache exposing (TradeCache) +import TradeTable.Types as TradeTable +import Wallet type alias Model = - { web3Context : Web3Context - , userInfo : Maybe UserInfo - , browsingRole : BuyerOrSeller + { wallet : Wallet.State + , tradeTable : TradeTable.Model , inputs : SearchInputs , errors : Errors , showCurrencyDropdown : Bool , filterFunc : Time.Posix -> CTypes.FullTradeInfo -> Bool - , sortFunc : CTypes.FullTradeInfo -> CTypes.FullTradeInfo -> Order } @@ -35,24 +37,16 @@ type Msg = MinDaiChanged String | MaxDaiChanged String | FiatTypeInputChanged String - | MinFiatChanged String - | MaxFiatChanged String | PaymentMethodInputChanged String | ShowCurrencyDropdown Bool | FiatTypeLostFocus | AddSearchTerm | RemoveTerm String - | ApplyInputs + -- | ApplyInputs | ResetSearch - | TradeClicked Int - | SortBy ResultColumnType Ordering - | NoOp + | TradeTableMsg TradeTable.Msg | AppCmd (AppCmd Msg) - - -type Ordering - = Ascending - | Descending + | NoOp @@ -63,15 +57,17 @@ type Ordering type alias UpdateResult = { model : Model , cmd : Cmd Msg + , chainCmd : ChainCmd Msg , appCmds : List (AppCmd Msg) } -noUpdate : Model -> UpdateResult -noUpdate model = +justModelUpdate : Model -> UpdateResult +justModelUpdate model = UpdateResult model Cmd.none + ChainCmd.none [] @@ -79,8 +75,6 @@ type alias SearchInputs = { minDai : String , maxDai : String , fiatType : String - , minFiat : String - , maxFiat : String , paymentMethod : String , paymentMethodTerms : List String } @@ -89,33 +83,28 @@ type alias SearchInputs = type alias Errors = { minDai : Maybe String , maxDai : Maybe String - , minFiat : Maybe String - , maxFiat : Maybe String } noErrors = - Errors Nothing Nothing Nothing Nothing + Errors Nothing Nothing -type alias Query = - { dai : TokenRange - , fiat : Maybe FiatTypeAndRange - , paymentMethodTerms : List String - } - -type alias TokenRange = - { min : Maybe TokenValue - , max : Maybe TokenValue - } - - -type alias FiatTypeAndRange = - { type_ : String - , min : Maybe BigInt - , max : Maybe BigInt - } +-- type alias Query = +-- { dai : TokenRange +-- , fiat : Maybe FiatTypeAndRange +-- , paymentMethodTerms : List String +-- } +-- type alias TokenRange = +-- { min : Maybe TokenValue +-- , max : Maybe TokenValue +-- } +-- type alias FiatTypeAndRange = +-- { type_ : String +-- , min : Maybe BigInt +-- , max : Maybe BigInt +-- } updatePaymentMethodInput : String -> SearchInputs -> SearchInputs @@ -138,16 +127,6 @@ updateMaxDaiInput input inputs = { inputs | maxDai = input } -updateMinFiatInput : String -> SearchInputs -> SearchInputs -updateMinFiatInput input inputs = - { inputs | minFiat = input } - - -updateMaxFiatInput : String -> SearchInputs -> SearchInputs -updateMaxFiatInput input inputs = - { inputs | maxFiat = input } - - updatePaymentMethodTerms : List String -> SearchInputs -> SearchInputs updatePaymentMethodTerms terms inputs = { inputs | paymentMethodTerms = terms } diff --git a/src/Marketplace/View.elm b/src/Marketplace/View.elm index c9f6c0c..6f207ab 100644 --- a/src/Marketplace/View.elm +++ b/src/Marketplace/View.elm @@ -18,14 +18,17 @@ import Html.Events.Extra import Images exposing (Image) import Margin import Marketplace.Types exposing (..) +import Maybe.Extra import PaymentMethods exposing (PaymentMethod) import Time import TradeCache.State as TradeCache -import TradeCache.Types exposing (TradeCache) +import TradeCache.Types as TradeCache exposing (TradeCache) +import TradeTable.Types as TradeTable +import TradeTable.View as TradeTable -root : Time.Posix -> TradeCache -> Model -> Element Msg -root time tradeCache model = +root : Time.Posix -> List TradeCache -> Model -> Element Msg +root time tradeCaches model = Element.column [ Element.Border.rounded 5 , Element.Background.color EH.white @@ -38,14 +41,14 @@ root time tradeCache model = , Element.spacing 10 , Element.padding 30 ] - [ searchInputElement model.web3Context.factoryType model.inputs model.errors model.showCurrencyDropdown + [ searchInputElement model.inputs model.errors model.showCurrencyDropdown ] - , maybeResultsElement time tradeCache model + , resultsAndStatusElement time tradeCaches model ] -searchInputElement : FactoryType -> SearchInputs -> Errors -> Bool -> Element Msg -searchInputElement factoryType inputs errors showCurrencyDropdown = +searchInputElement : SearchInputs -> Errors -> Bool -> Element Msg +searchInputElement inputs errors showCurrencyDropdown = Element.column [ Element.spacing 10 , Element.width Element.shrink @@ -60,13 +63,13 @@ searchInputElement factoryType inputs errors showCurrencyDropdown = , Element.alignTop ] <| - daiRangeInput factoryType inputs.minDai inputs.maxDai errors + daiRangeInput inputs.minDai inputs.maxDai errors , Element.el [ Element.width Element.shrink , Element.alignTop ] <| - fiatInput showCurrencyDropdown inputs.fiatType inputs.minFiat inputs.maxFiat errors + fiatInput showCurrencyDropdown inputs.fiatType errors , Element.column [ Element.width Element.shrink , Element.alignTop @@ -75,12 +78,13 @@ searchInputElement factoryType inputs errors showCurrencyDropdown = [ paymentMethodsInput inputs.paymentMethod , searchTermsDisplayElement inputs.paymentMethodTerms ] - , Element.column - [ Element.spacing 5 - , Element.width Element.shrink - ] - [ applyButton, resetButton ] - |> withInputHeader " " + + -- , Element.column + -- [ Element.spacing 5 + -- , Element.width Element.shrink + -- ] + -- [ applyButton, resetButton ] + -- |> withInputHeader " " ] ] @@ -122,8 +126,8 @@ removeSearchTermButton term = (Element.text "x") -maybeResultsElement : Time.Posix -> TradeCache -> Model -> Element Msg -maybeResultsElement time tradeCache model = +resultsAndStatusElement : Time.Posix -> List TradeCache -> Model -> Element Msg +resultsAndStatusElement time tradeCaches model = let statusMsgElement s = Element.el @@ -136,76 +140,70 @@ maybeResultsElement time tradeCache model = (Element.text s) visibleTrades = - TradeCache.loadedValidTrades tradeCache - |> filterAndSortTrades time model.filterFunc model.sortFunc - in - case ( tradeCache.dataFetchStatus.total, visibleTrades ) of - ( Nothing, _ ) -> - statusMsgElement "Querying Factory contract..." + tradeCaches + |> List.map TradeCache.loadedValidTrades + |> List.concat + |> filterTrades time model.filterFunc - ( Just 0, _ ) -> - statusMsgElement "No trades found." - - ( Just totalTrades, [] ) -> - if tradeCache.dataFetchStatus.loaded < (totalTrades - tradeCache.dataFetchStatus.invalid) then - statusMsgElement "Searching trades for Open offers..." + statusMessages : List (Element Msg) + statusMessages = + if List.all ((==) TradeCache.NoneFound) (List.map TradeCache.loadingStatus tradeCaches) then + [ statusMsgElement "No trades found." ] else - statusMsgElement "No open offers found." + tradeCaches + |> List.map + (\tc -> + case TradeCache.loadingStatus tc of + TradeCache.QueryingNumTrades -> + Just <| factoryName tc.factory ++ "Querying Factory..." - ( Just totalTrades, _ ) -> - resultsElement time visibleTrades model + TradeCache.NoneFound -> + Nothing + TradeCache.FetchingTrades -> + Just <| factoryName tc.factory ++ "Fetching Trades" -resultsElement : Time.Posix -> List CTypes.FullTradeInfo -> Model -> Element Msg -resultsElement time visibleTrades model = - let - buyingOrSellingString = - case model.browsingRole of - Buyer -> - "Selling" - - Seller -> - "Buying" + TradeCache.AllFetched -> + Nothing + ) + |> Maybe.Extra.values + |> List.map statusMsgElement in Element.column - [ Element.width Element.fill - , Element.height Element.fill - , Element.padding 30 - , Element.spacing 5 - ] - [ Element.row - [ Element.width Element.fill ] - [ Element.row - [ Element.width <| Element.fillPortion 7 ] - [ cellMaker ( 2, sortableColumnHeader "Expires" Expiring Nothing ) - , cellMaker ( 1, sortableColumnHeader buyingOrSellingString TradeAmount Nothing ) - , cellMaker ( 2, sortableColumnHeader "For Fiat" Fiat Nothing ) - , cellMaker ( 1, sortableColumnHeader "Margin" Margin Nothing ) - , cellMaker ( 2, sortableColumnHeader "Payment Window" AutoabortWindow Nothing ) - , cellMaker ( 2, sortableColumnHeader "Auto-Release" AutoreleaseWindow Nothing ) - ] - , Element.el - [ Element.width <| Element.fillPortion 1 ] + [ Element.spacing 10 ] + [ case statusMessages of + [] -> Element.none - ] - , Element.column - [ Element.width Element.fill - , Element.Border.width 2 - , Element.Border.rounded 8 - , Element.Border.color EH.darkGray - , Element.spacing 1 - , Element.Background.color EH.darkGray - , Element.clip - ] - (visibleTrades - |> List.map (viewTradeRow time model.browsingRole) - ) + + _ -> + Element.column [ Element.spacing 5 ] statusMessages + , maybeResultsElement time visibleTrades model ] -daiRangeInput : FactoryType -> String -> String -> Errors -> Element Msg -daiRangeInput factoryType minDai maxDai errors = +maybeResultsElement : Time.Posix -> List CTypes.FullTradeInfo -> Model -> Element Msg +maybeResultsElement time visibleTrades model = + if visibleTrades == [] then + Element.none + + else + TradeTable.view + time + model.tradeTable + [ TradeTable.Expires + , TradeTable.Offer + , TradeTable.FiatPrice + , TradeTable.Margin + , TradeTable.PaymentWindow + , TradeTable.BurnWindow + ] + visibleTrades + |> Element.map TradeTableMsg + + +daiRangeInput : String -> String -> Errors -> Element Msg +daiRangeInput minDai maxDai errors = let daiLabelElement = EH.daiSymbol [ Element.centerY ] @@ -231,7 +229,7 @@ daiRangeInput factoryType minDai maxDai errors = ] [ Element.Events.onFocus (ShowCurrencyDropdown False) ] minElement - ("min " ++ Config.tokenUnitName factoryType) + "min Dai" minDai Nothing Nothing @@ -244,17 +242,17 @@ daiRangeInput factoryType minDai maxDai errors = ] [ Element.Events.onFocus (ShowCurrencyDropdown False) ] maxElement - ("max " ++ Config.tokenUnitName factoryType) + "max Dai" maxDai Nothing Nothing MaxDaiChanged ] - |> withInputHeader (Config.tokenUnitName factoryType ++ " Range") + |> withInputHeader "Dai Range" -fiatInput : Bool -> String -> String -> String -> Errors -> Element Msg -fiatInput showTypeDropdown fiatType minFiat maxFiat errors = +fiatInput : Bool -> String -> Errors -> Element Msg +fiatInput showTypeDropdown fiatType errors = let fiatLabelElement = EH.fiatTypeToSymbolElement fiatType @@ -274,39 +272,11 @@ fiatInput showTypeDropdown fiatType minFiat maxFiat errors = flagClickedMsg = AppCmd <| AppCmd.gTag "click" "misclick" "currency flag" 0 in - Element.row [ Element.spacing 5, Element.width Element.shrink ] - [ Element.el [ Element.alignTop, Element.width <| Element.px 120 ] <| - EH.currencySelector showTypeDropdown fiatType (ShowCurrencyDropdown True) FiatTypeInputChanged flagClickedMsg - , Element.column [ Element.spacing 5, Element.alignTop, Element.width <| Element.px 200 ] - [ EH.textInputWithElement - [ Element.above <| - EH.maybeErrorElement - [ Element.moveUp 5, Element.width (Element.shrink |> Element.maximum 200) ] - errors.minFiat - ] - [ Element.Events.onFocus (ShowCurrencyDropdown False) ] - minElement - "min" - minFiat - Nothing - Nothing - MinFiatChanged - , EH.textInputWithElement - [ Element.below <| - EH.maybeErrorElement - [ Element.moveDown 5, Element.width (Element.shrink |> Element.maximum 200) ] - errors.maxFiat - ] - [ Element.Events.onFocus (ShowCurrencyDropdown False) ] - maxElement - "max" - maxFiat - Nothing - Nothing - MaxFiatChanged - ] - ] - |> withInputHeader "Fiat Type" + Element.el + [ Element.alignTop, Element.width <| Element.px 120 ] + (EH.currencySelector showTypeDropdown fiatType (ShowCurrencyDropdown True) FiatTypeInputChanged flagClickedMsg + |> withInputHeader "Fiat Type" + ) paymentMethodsInput : String -> Element Msg @@ -332,40 +302,39 @@ paymentMethodsInput searchString = |> withInputHeader "Search Payment Methods" -applyButton : Element Msg -applyButton = - Element.Input.button - [ Element.Background.color EH.blue - , Element.padding 10 - , Element.Border.rounded 5 - ] - { onPress = Just ApplyInputs - , label = - Element.el - [ Element.Font.color EH.white - , Element.centerX - , Element.centerY - ] - (Element.text "Apply") - } - -resetButton : Element Msg -resetButton = - Element.Input.button - [ Element.Background.color EH.blue - , Element.padding 10 - , Element.Border.rounded 5 - ] - { onPress = Just ResetSearch - , label = - Element.el - [ Element.Font.color EH.white - , Element.centerX - , Element.centerY - ] - (Element.text "Reset") - } +-- applyButton : Element Msg +-- applyButton = +-- Element.Input.button +-- [ Element.Background.color EH.blue +-- , Element.padding 10 +-- , Element.Border.rounded 5 +-- ] +-- { onPress = Just ApplyInputs +-- , label = +-- Element.el +-- [ Element.Font.color EH.white +-- , Element.centerX +-- , Element.centerY +-- ] +-- (Element.text "Apply") +-- } +-- resetButton : Element Msg +-- resetButton = +-- Element.Input.button +-- [ Element.Background.color EH.blue +-- , Element.padding 10 +-- , Element.Border.rounded 5 +-- ] +-- { onPress = Just ResetSearch +-- , label = +-- Element.el +-- [ Element.Font.color EH.white +-- , Element.centerX +-- , Element.centerY +-- ] +-- (Element.text "Reset") +-- } withInputHeader : String -> Element Msg -> Element Msg @@ -379,181 +348,6 @@ withInputHeader title element = ] -viewTradeRow : Time.Posix -> BuyerOrSeller -> CTypes.FullTradeInfo -> Element Msg -viewTradeRow time viewAsRole trade = - Element.row - [ Element.width Element.fill - , Element.spacing 1 - , Element.Background.color EH.lightGray - ] - [ Element.column - [ Element.width Element.fill - , Element.spacing 1 - , Element.width <| Element.fillPortion 7 - ] - [ Element.row - [ Element.width <| Element.fillPortion 6 - , Element.spacing 1 - ] - (List.map cellMaker - [ ( 2, viewExpiring time trade ) - , ( 1, viewTradeAmount trade ) - , ( 2, viewFiat trade ) - , ( 1, viewMargin trade (viewAsRole /= Buyer) ) - , ( 2, viewAutoabortWindow viewAsRole trade ) - , ( 2, viewAutoreleaseWindow viewAsRole trade ) - ] - ) - , cellMaker ( 1, viewPaymentMethods trade.terms.paymentMethods ) - ] - , Element.el - [ Element.width <| Element.fillPortion 1 - , Element.height Element.fill - , Element.clip - , Element.Background.color EH.white - ] - <| - Element.el - [ Element.centerX - , Element.centerY - ] - (viewTradeButton trade.id) - ] - - -cellMaker : ( Int, Element Msg ) -> Element Msg -cellMaker ( portion, cellElement ) = - Element.el - [ Element.width <| Element.fillPortion portion - , Element.height <| Element.px 60 - , Element.clip - , Element.Background.color EH.white - ] - <| - Element.el - [ Element.padding 12 - , Element.centerY - , Element.width Element.fill - ] - cellElement - - -viewExpiring : Time.Posix -> CTypes.FullTradeInfo -> Element Msg -viewExpiring time trade = - case CTypes.getCurrentPhaseTimeoutInfo time trade of - CTypes.TimeLeft timeoutInfo -> - let - baseIntervalColor = - if TimeHelpers.getRatio (Tuple.first timeoutInfo) (Tuple.second timeoutInfo) < 0.05 then - EH.red - - else - EH.black - in - EH.intervalWithElapsedBar - [ Element.width Element.fill ] - [ Element.Font.size 16 ] - ( baseIntervalColor, EH.lightGray ) - timeoutInfo - - CTypes.TimeUp totalInterval -> - EH.intervalWithElapsedBar - [ Element.width Element.fill ] - [ Element.Font.size 16 ] - ( EH.red, EH.lightGray ) - ( Time.millisToPosix 0, totalInterval ) - - -viewTradeAmount : CTypes.FullTradeInfo -> Element Msg -viewTradeAmount trade = - EH.daiValue trade.parameters.tradeAmount - - -viewFiat : CTypes.FullTradeInfo -> Element Msg -viewFiat trade = - EH.fiatValue trade.terms.price - - -viewMargin : CTypes.FullTradeInfo -> Bool -> Element Msg -viewMargin trade upIsGreen = - trade.derived.margin - |> Maybe.map (EH.coloredMargin upIsGreen) - |> Maybe.withDefault Element.none - - -viewPaymentMethods : List PaymentMethod -> Element Msg -viewPaymentMethods paymentMethods = - paymentMethods - |> List.head - |> Maybe.map PaymentMethods.previewTextHack - |> Maybe.withDefault Element.none - - -viewAutoabortWindow : BuyerOrSeller -> CTypes.FullTradeInfo -> Element Msg -viewAutoabortWindow viewAsRole trade = - let - lowValColor = - case viewAsRole of - Buyer -> - EH.red - - Seller -> - EH.green - - baseColor = - if Time.posixToMillis trade.parameters.autoabortInterval < (1000 * 60 * 60 * 6) then - lowValColor - - else - EH.black - in - EH.interval - [] - [] - ( baseColor, EH.lightGray ) - trade.parameters.autoabortInterval - - -viewAutoreleaseWindow : BuyerOrSeller -> CTypes.FullTradeInfo -> Element Msg -viewAutoreleaseWindow viewAsRole trade = - let - lowValColor = - case viewAsRole of - Buyer -> - EH.green - - Seller -> - EH.red - - baseColor = - if Time.posixToMillis trade.parameters.autoabortInterval < (1000 * 60 * 60 * 6) then - lowValColor - - else - EH.black - in - EH.interval - [] - [] - ( baseColor, EH.lightGray ) - trade.parameters.autoreleaseInterval - - -viewTradeButton : Int -> Element Msg -viewTradeButton factoryID = - Element.Input.button - [ Element.Background.color <| Element.rgba255 16 7 234 0.2 - , Element.padding 11 - , Element.Border.rounded 4 - , Element.width Element.fill - , Element.mouseOver [ Element.Background.color <| Element.rgba255 16 7 234 0.4 ] - ] - { onPress = Just <| TradeClicked factoryID - , label = - Element.el [ Element.centerX, Element.Font.color <| Element.rgb255 16 7 234, Element.Font.medium ] <| Element.text "View Offer" - } - - getLoadedTrades : List CTypes.Trade -> List CTypes.FullTradeInfo getLoadedTrades = List.filterMap @@ -567,53 +361,10 @@ getLoadedTrades = ) -filterAndSortTrades : +filterTrades : Time.Posix -> (Time.Posix -> CTypes.FullTradeInfo -> Bool) - -> (CTypes.FullTradeInfo -> CTypes.FullTradeInfo -> Order) -> List CTypes.FullTradeInfo -> List CTypes.FullTradeInfo -filterAndSortTrades time filterFunc sortFunc = +filterTrades time filterFunc = List.filter (filterFunc time) - >> List.sortWith sortFunc - - -sortableColumnHeader : String -> ResultColumnType -> Maybe Ordering -> Element Msg -sortableColumnHeader title colType sorting = - Element.row [ Element.spacing 8 ] - [ columnHeader title - , Element.column - [ Element.spacing 2 ] - [ Element.el - [ Element.padding 4 - , Element.pointer - , Element.Events.onClick <| - SortBy colType Ascending - ] - (Images.toElement - [ Element.width <| Element.px 8 - , Element.centerX - , Element.centerY - ] - Images.upArrow - ) - , Element.el - [ Element.padding 4 - , Element.pointer - , Element.Events.onClick <| - SortBy colType Descending - ] - (Images.toElement - [ Element.width <| Element.px 8 - , Element.centerX - , Element.centerY - ] - Images.downArrow - ) - ] - ] - - -columnHeader : String -> Element Msg -columnHeader title = - Element.el [ Element.Font.medium, Element.Font.size 17 ] <| Element.text title diff --git a/src/QuickCreate/State.elm b/src/QuickCreate/State.elm index f8215d9..31e258e 100644 --- a/src/QuickCreate/State.elm +++ b/src/QuickCreate/State.elm @@ -1,7 +1,8 @@ -module QuickCreate.State exposing (init, subscriptions, update, updateUserInfo, updateWeb3Context) +module QuickCreate.State exposing (init, subscriptions, update, updateWalletState) import AppCmd import BigInt exposing (BigInt) +import ChainCmd exposing (ChainCmd) import CommonTypes exposing (..) import Config import Contracts.Generated.ERC20Token as TokenContract @@ -12,8 +13,7 @@ import Eth.Types exposing (Address) import FiatValue exposing (FiatValue) import Flip exposing (flip) import Helpers.BigInt as BigIntHelpers -import Helpers.ChainCmd as ChainCmd exposing (ChainCmd) -import Helpers.Eth as EthHelpers exposing (Web3Context) +import Helpers.Eth as EthHelpers import Helpers.Time as TimeHelpers import Http import Maybe.Extra @@ -24,61 +24,38 @@ import Task import Time import TokenValue exposing (TokenValue) import UserNotice as UN exposing (UserNotice) +import Wallet -init : EthHelpers.Web3Context -> Maybe UserInfo -> UpdateResult -init web3Context userInfo = - let - model = - { web3Context = web3Context - , userInfo = userInfo - , state = Menu NoneStarted - , tokenAllowance = Nothing - , textInput = "" - } - - cmd = - case userInfo of - Just uInfo -> - getAllowanceCmdIfNeeded model.web3Context uInfo AllowanceFetched - - Nothing -> - Cmd.none - in +init : Wallet.State -> UpdateResult +init wallet = UpdateResult - model - cmd + { wallet = wallet + , state = Menu NoneStarted + , tokenAllowance = Nothing + , textInput = "" + } + (getAllowanceCmdIfNeeded wallet AllowanceFetched) ChainCmd.none [] -updateUserInfo : Maybe UserInfo -> Model -> ( Model, Cmd Msg ) -updateUserInfo maybeUserInfo model = - ( { model | userInfo = maybeUserInfo } - , case maybeUserInfo of - Just userInfo -> - getAllowanceCmdIfNeeded model.web3Context userInfo AllowanceFetched - - Nothing -> - Cmd.none +updateWalletState : Wallet.State -> Model -> ( Model, Cmd Msg ) +updateWalletState wallet model = + ( { model | wallet = wallet } + , getAllowanceCmdIfNeeded wallet AllowanceFetched ) -updateWeb3Context : EthHelpers.Web3Context -> Model -> Model -updateWeb3Context newWeb3Context model = - { model | web3Context = newWeb3Context } - - -getAllowanceCmdIfNeeded : Web3Context -> UserInfo -> (Result Http.Error BigInt -> Msg) -> Cmd Msg -getAllowanceCmdIfNeeded web3Context userInfo msgConstructor = - case web3Context.factoryType of - Token tokenType -> +getAllowanceCmdIfNeeded : Wallet.State -> (TokenFactoryType -> Result Http.Error BigInt -> Msg) -> Cmd Msg +getAllowanceCmdIfNeeded wallet msgConstructor = + case ( Wallet.factory wallet, Wallet.userInfo wallet ) of + ( Just (Token tokenType), Just userInfo ) -> Contracts.Wrappers.getAllowanceCmd - web3Context tokenType userInfo.address - (Config.factoryAddress web3Context.factoryType) - msgConstructor + (Config.factoryAddress (Token tokenType)) + (msgConstructor tokenType) _ -> Cmd.none @@ -88,29 +65,33 @@ update : Msg -> Model -> UpdateResult update msg prevModel = case msg of Refresh time -> - case ( prevModel.userInfo, prevModel.web3Context.factoryType ) of - ( Just userInfo, Token tokenType ) -> - let - cmd = - Contracts.Wrappers.getAllowanceCmd - prevModel.web3Context - tokenType - userInfo.address - (Config.factoryAddress prevModel.web3Context.factoryType) - AllowanceFetched - in - UpdateResult - prevModel - cmd - ChainCmd.none - [] + case prevModel.wallet of + Wallet.Active userInfo -> + case Wallet.factory prevModel.wallet of + Just (Token tokenType) -> + let + cmd = + Contracts.Wrappers.getAllowanceCmd + tokenType + userInfo.address + (Config.factoryAddress (Token tokenType)) + (AllowanceFetched tokenType) + in + UpdateResult + prevModel + cmd + ChainCmd.none + [] + + _ -> + justModelUpdate prevModel _ -> justModelUpdate prevModel - StartClicked tradeRecipe -> - case prevModel.web3Context.factoryType of - Token _ -> + StartClicked factoryType tradeRecipe -> + case factoryType of + Token tokenType -> let newState = case prevModel.tokenAllowance of @@ -119,10 +100,10 @@ update msg prevModel = Spec tradeRecipe ReadyToOpen else - Menu (StartPrompt tradeRecipe) + Menu (StartPrompt tokenType tradeRecipe) Nothing -> - Menu (StartPrompt tradeRecipe) + Menu (StartPrompt tokenType tradeRecipe) in justModelUpdate { prevModel | state = newState } @@ -133,31 +114,22 @@ update msg prevModel = Spec tradeRecipe ReadyToOpen } - ApproveClicked tradeRecipe -> - case prevModel.web3Context.factoryType of - Token tokenType -> - let - chainCmd = - approveChainCmd tokenType tradeRecipe.daiAmountIn - in - UpdateResult - { prevModel - | state = Menu (ApproveNeedsSig tradeRecipe) - } - Cmd.none - chainCmd - [] - - Native _ -> - UpdateResult - prevModel - Cmd.none - ChainCmd.none - [ AppCmd.UserNotice <| UN.unexpectedError "Approve Clicked msg received, but factoryType is not a token factory!" tradeRecipe ] + ApproveClicked tokenType tradeRecipe -> + let + chainCmd = + approveChainCmd tokenType tradeRecipe.daiAmountIn + in + UpdateResult + { prevModel + | state = Menu (ApproveNeedsSig tokenType tradeRecipe) + } + Cmd.none + chainCmd + [] - ApproveSigned txHashResult -> + ApproveSigned tokenType txHashResult -> case ( txHashResult, prevModel.state ) of - ( Ok txHash, Menu (ApproveNeedsSig tradeRecipe) ) -> + ( Ok txHash, Menu (ApproveNeedsSig _ tradeRecipe) ) -> justModelUpdate { prevModel | state = Spec tradeRecipe (ApproveMining txHash) } @@ -175,7 +147,7 @@ update msg prevModel = ChainCmd.none [ AppCmd.UserNotice <| UN.unexpectedError "Approve signed, but factoryType is not a token factory!" txHashResult ] - AllowanceFetched fetchResult -> + AllowanceFetched tokenType fetchResult -> case ( fetchResult, prevModel.state ) of ( Ok tokenAllowance, Spec tradeRecipe (ApproveMining _) ) -> if BigInt.compare tokenAllowance (TokenValue.getEvmValue tradeRecipe.daiAmountIn) /= LT then @@ -199,13 +171,13 @@ update msg prevModel = _ -> justModelUpdate prevModel - OpenClicked userInfo recipe -> + OpenClicked factoryType userInfo recipe -> let createParameters = constructCreateParameters userInfo recipe prevModel.textInput chainCmd = - initiateCreateCall prevModel.web3Context.factoryType createParameters + initiateCreateCall factoryType createParameters txChainStatus = OpenNeedsSig @@ -221,11 +193,11 @@ update msg prevModel = chainCmd [] - OpenSigned txHashResult -> + OpenSigned _ txHashResult -> case ( txHashResult, prevModel.state ) of - ( Ok txHash, Spec createParameters _ ) -> + ( Ok txHash, Spec recipe _ ) -> justModelUpdate - { prevModel | state = Spec createParameters OpenMining } + { prevModel | state = Spec recipe OpenMining } ( Err e, _ ) -> UpdateResult @@ -239,14 +211,14 @@ update msg prevModel = prevModel Cmd.none ChainCmd.none - [ AppCmd.UserNotice <| UN.unexpectedError "Open signed, but factoryType is not a token factory!" txHashResult ] + [ AppCmd.UserNotice <| UN.unexpectedError "Open signed, but there is no recipe!" txHashResult ] - OpenMined txReceiptResult -> + OpenMined factory txReceiptResult -> case txReceiptResult of Ok txReceipt -> let maybeId = - CTypes.txReceiptToCreatedTradeSellId prevModel.web3Context.factoryType txReceipt + CTypes.txReceiptToCreatedTradeSellId factory txReceipt |> Result.toMaybe |> Maybe.andThen BigIntHelpers.toInt in @@ -256,7 +228,7 @@ update msg prevModel = prevModel Cmd.none ChainCmd.none - [ AppCmd.GotoRoute (Routing.Trade id) ] + [ AppCmd.GotoRoute (Routing.Trade factory id) ] Nothing -> UpdateResult @@ -308,7 +280,7 @@ approveChainCmd tokenType amount = customSend = { onMined = Nothing - , onSign = Just ApproveSigned + , onSign = Just (ApproveSigned tokenType) , onBroadcast = Nothing } in @@ -325,8 +297,8 @@ initiateCreateCall factoryType parameters = |> Eth.toSend customSend = - { onMined = Just ( OpenMined, Nothing ) - , onSign = Just OpenSigned + { onMined = Just ( OpenMined factoryType, Nothing ) + , onSign = Just (OpenSigned factoryType) , onBroadcast = Nothing } in diff --git a/src/QuickCreate/Types.elm b/src/QuickCreate/Types.elm index b494f9a..d0e6579 100644 --- a/src/QuickCreate/Types.elm +++ b/src/QuickCreate/Types.elm @@ -4,20 +4,21 @@ import AppCmd exposing (AppCmd) import BigInt exposing (BigInt) import CommonTypes exposing (..) import Contracts.Types as CTypes +import Eth.Net import Eth.Types exposing (Address, TxHash, TxReceipt) import FiatValue exposing (FiatValue) -import Helpers.ChainCmd as ChainCmd exposing (ChainCmd) -import Helpers.Eth as EthHelpers exposing (Web3Context) +import ChainCmd exposing (ChainCmd) +import Helpers.Eth as EthHelpers import Http import PaymentMethods exposing (PaymentMethod) import Routing import Time import TokenValue exposing (TokenValue) +import Wallet type alias Model = - { web3Context : Web3Context - , userInfo : Maybe UserInfo + { wallet : Wallet.State , state : State , tokenAllowance : Maybe TokenValue , textInput : String @@ -31,8 +32,8 @@ type State type MenuState = NoneStarted - | StartPrompt TradeRecipe - | ApproveNeedsSig TradeRecipe + | StartPrompt TokenFactoryType TradeRecipe + | ApproveNeedsSig TokenFactoryType TradeRecipe type SpecState @@ -44,13 +45,13 @@ type SpecState type Msg = Refresh Time.Posix - | StartClicked TradeRecipe - | ApproveClicked TradeRecipe - | AllowanceFetched (Result Http.Error BigInt) - | OpenClicked UserInfo TradeRecipe - | ApproveSigned (Result String TxHash) - | OpenSigned (Result String TxHash) - | OpenMined (Result String TxReceipt) + | StartClicked FactoryType TradeRecipe + | ApproveClicked TokenFactoryType TradeRecipe + | AllowanceFetched TokenFactoryType (Result Http.Error BigInt) + | OpenClicked FactoryType UserInfo TradeRecipe + | ApproveSigned TokenFactoryType (Result String TxHash) + | OpenSigned FactoryType (Result String TxHash) + | OpenMined FactoryType (Result String TxReceipt) | TextInputChanged String | ChangeState State | AbortCreate diff --git a/src/QuickCreate/View.elm b/src/QuickCreate/View.elm index b479664..c7a2d40 100644 --- a/src/QuickCreate/View.elm +++ b/src/QuickCreate/View.elm @@ -33,7 +33,11 @@ root model = , Element.centerX ] (menuItems - |> List.map (menuItemElement model.web3Context.factoryType True) + |> List.map + (menuItemElement + (EthHelpers.factoryTypeWithDefault model.userInfo) + True + ) ) Spec recipe specState -> @@ -41,17 +45,20 @@ root model = [ Element.spacing 20 , Element.centerX ] - [ menuItemElement model.web3Context.factoryType False recipe + [ menuItemElement + (EthHelpers.factoryTypeWithDefault model.userInfo) + False + recipe , Element.column [ Element.spacing 10 , Element.centerX ] [ textInputPrompt recipe.initiatorRole recipe.fiatValue , textInputElement recipe.initiatorRole model.textInput - , openTradeButton model.userInfo model.state + , openTradeButton (EthHelpers.factoryTypeWithDefault model.userInfo) model.userInfo model.state ] ] - , [ txModalOrNone model.web3Context.factoryType model.userInfo model.state ] + , [ txModalOrNone (EthHelpers.factoryTypeWithDefault model.userInfo) model.userInfo model.state ] ) @@ -61,16 +68,16 @@ menuItemElement factoryType showButtons recipe = [ Element.spacing 40 ] [ recipeSummaryElement factoryType recipe , if showButtons then - startButton recipe + startButton factoryType recipe else Element.none ] -startButton : TradeRecipe -> Element Msg -startButton recipe = - EH.blueButton "Start" (StartClicked recipe) +startButton : FactoryType -> TradeRecipe -> Element Msg +startButton factoryType recipe = + EH.blueButton "Start" (StartClicked factoryType recipe) recipeSummaryElement : FactoryType -> TradeRecipe -> Element Msg @@ -204,8 +211,8 @@ textInputPlaceholder initiatorRole = |> Element.Input.placeholder [] -openTradeButton : Maybe UserInfo -> State -> Element Msg -openTradeButton maybeUserInfo state = +openTradeButton : FactoryType -> Maybe UserInfo -> State -> Element Msg +openTradeButton factoryType maybeUserInfo state = case maybeUserInfo of Just userInfo -> case state of @@ -215,7 +222,7 @@ openTradeButton maybeUserInfo state = EH.disabledButton "Mining Prepare tx..." Nothing ReadyToOpen -> - EH.redButton "Open Trade" (OpenClicked userInfo recipe) + EH.redButton "Open Trade" (OpenClicked factoryType userInfo recipe) OpenNeedsSig -> Element.none @@ -263,7 +270,7 @@ dollarValueString dollars = txModalOrNone : FactoryType -> Maybe UserInfo -> State -> Element Msg txModalOrNone factoryType maybeUserInfo state = (case state of - Menu (StartPrompt recipe) -> + Menu (StartPrompt tokenType recipe) -> Just <| EH.closeableModal [] @@ -282,7 +289,7 @@ txModalOrNone factoryType maybeUserInfo state = ++ Config.tokenUnitName factoryType ++ " for deposit" ) - (ApproveClicked recipe) + (ApproveClicked tokenType recipe) Nothing -> EH.redButton "Connect to Wallet" Web3Connect @@ -290,7 +297,7 @@ txModalOrNone factoryType maybeUserInfo state = ) (ChangeState <| Menu NoneStarted) - Menu (ApproveNeedsSig recipe) -> + Menu (ApproveNeedsSig tokenType recipe) -> Just <| EH.closeableModal [] (Element.column diff --git a/src/Routing.elm b/src/Routing.elm index 4040d9d..d10d8e5 100644 --- a/src/Routing.elm +++ b/src/Routing.elm @@ -12,11 +12,11 @@ import Url.Parser exposing ((), (), Parser) type Route = Home - | QuickCreate + -- | QuickCreate | Create - | Trade Int - | Marketplace BuyerOrSeller - | AgentHistory Address BuyerOrSeller + | Trade FactoryType Int + | Marketplace + | AgentHistory Address | NotFound @@ -25,12 +25,13 @@ routeParser = Url.Parser.s "DAIHard" Url.Parser.oneOf [ Url.Parser.map Home Url.Parser.top - , Url.Parser.map QuickCreate (Url.Parser.s "quickcreate") + + -- , Url.Parser.map QuickCreate (Url.Parser.s "quickcreate") , Url.Parser.map Create (Url.Parser.s "create") - , Url.Parser.map Trade (Url.Parser.s "trade" Url.Parser.int) - , Url.Parser.map Marketplace (Url.Parser.s "marketplace" buyerOrSellerParser) - , Url.Parser.map AgentHistory (Url.Parser.s "history" addressParser buyerOrSellerParser) - , Url.Parser.map (\address -> AgentHistory address Seller) (Url.Parser.s "history" addressParser) + , Url.Parser.map Trade (Url.Parser.s "trade" factoryParser Url.Parser.int) + , Url.Parser.map Marketplace (Url.Parser.s "marketplace") + , Url.Parser.map AgentHistory (Url.Parser.s "history" addressParser) + , Url.Parser.map (\address -> AgentHistory address) (Url.Parser.s "history" addressParser) ] @@ -41,6 +42,51 @@ addressParser = (Eth.Utils.toAddress >> Result.toMaybe) +factoryParser : Parser (FactoryType -> a) a +factoryParser = + Url.Parser.custom + "FACTORY" + (\s -> + case s of + "eth" -> + Just <| Native Eth + + "keth" -> + Just <| Native Kovan + + "dai" -> + Just <| Token EthDai + + "kdai" -> + Just <| Token KovanDai + + "xdai" -> + Just <| Native XDai + + _ -> + Nothing + ) + + +factoryToString : FactoryType -> String +factoryToString factory = + case factory of + Native Eth -> + "eth" + + Native Kovan -> + "keth" + + Token EthDai -> + "dai" + + Token KovanDai -> + "kdai" + + Native XDai -> + "xdai" + + buyerOrSellerParser : Parser (BuyerOrSeller -> a) a buyerOrSellerParser = Url.Parser.custom @@ -79,31 +125,19 @@ routeToString route = Home -> Url.Builder.absolute [ "DAIHard" ] [] - QuickCreate -> - Url.Builder.absolute [ "DAIHard", "quickcreate" ] [] - + -- QuickCreate -> + -- Url.Builder.absolute [ "DAIHard", "quickcreate" ] [] Create -> Url.Builder.absolute [ "DAIHard", "create" ] [] - Trade id -> - Url.Builder.absolute [ "DAIHard", "trade", String.fromInt id ] [] + Trade factory id -> + Url.Builder.absolute [ "DAIHard", "trade", factoryToString factory, String.fromInt id ] [] - Marketplace buyerOrSeller -> - Url.Builder.absolute [ "DAIHard", "marketplace", buyerOrSellerToString buyerOrSeller ] [] + Marketplace -> + Url.Builder.absolute [ "DAIHard", "marketplace" ] [] - AgentHistory address buyerOrSeller -> - Url.Builder.absolute - [ "DAIHard" - , "history" - , Eth.Utils.addressToString address - , case buyerOrSeller of - Buyer -> - "buyer" - - Seller -> - "seller" - ] - [] + AgentHistory address -> + Url.Builder.absolute [ "DAIHard", "history", Eth.Utils.addressToString address ] [] NotFound -> Url.Builder.absolute [] [] diff --git a/src/State.elm b/src/State.elm index 7e023c8..ce60978 100644 --- a/src/State.elm +++ b/src/State.elm @@ -1,13 +1,18 @@ port module State exposing (init, subscriptions, update) +-- import QuickCreate.State + import AgentHistory.State import AppCmd +import Array exposing (Array) import BigInt import Browser import Browser.Dom import Browser.Navigation +import ChainCmd exposing (ChainCmd) import CommonTypes exposing (..) import Config +import Contracts.Types as CTypes import Create.State import Element import Eth.Net @@ -15,15 +20,14 @@ import Eth.Sentry.Tx as TxSentry import Eth.Sentry.Wallet as WalletSentry exposing (WalletSentry) import Eth.Types exposing (Address) import Eth.Utils -import Helpers.ChainCmd as ChainCmd exposing (ChainCmd) -import Helpers.Eth as EthHelpers exposing (Web3Context) +import Helpers.Eth as EthHelpers +import Helpers.Tuple import Json.Decode import Json.Encode import List.Extra import Marketplace.State import Maybe.Extra import Notifications -import QuickCreate.State import Routing import Time import Trade.State @@ -32,6 +36,7 @@ import TradeCache.Types exposing (TradeCache) import Types exposing (..) import Url exposing (Url) import UserNotice as UN exposing (UserNotice) +import Wallet init : Flags -> Url -> Browser.Navigation.Key -> ( Model, Cmd Msg ) @@ -44,68 +49,79 @@ init flags url key = else Nothing - ( factoryType, initialWeb3State ) = + wallet = if flags.networkId == 0 then - ( Native XDai - , NoWeb3 - ) + Wallet.NoneDetected else - case EthHelpers.intToFactoryType flags.networkId of - Nothing -> - ( Native XDai - , WrongNetwork - ) - - Just factoryType_ -> - ( factoryType_ - , AllGood - ) + Wallet.OnlyNetwork <| Eth.Net.toNetworkId flags.networkId providerNotice = - case initialWeb3State of - NoWeb3 -> - Just UN.noWeb3Provider + if wallet == Wallet.NoneDetected then + Just UN.noWeb3Provider - WrongNetwork -> - Just UN.wrongWeb3Network + else + case Wallet.factory wallet of + Nothing -> + Just UN.wrongWeb3Network - AllGood -> - Nothing + Just _ -> + Nothing userNotices = Maybe.Extra.values [ tooSmallNotice, providerNotice ] - web3Context = - EthHelpers.web3Context factoryType - txSentry = - TxSentry.init ( txOut, txIn ) TxSentryMsg web3Context.httpProvider + Wallet.httpProvider wallet + |> Maybe.map + (\httpProvider -> + TxSentry.init ( txOut, txIn ) TxSentryMsg httpProvider + ) - ( tradeCache, tcCmd, tcAppCmds ) = - TradeCache.initAndStartCaching web3Context + tcInitResults = + Config.activeFactories + |> List.map TradeCache.initAndStartCaching + + ( tradeCaches, tcCmds, tcAppCmdLists ) = + ( List.map Helpers.Tuple.tuple3First tcInitResults + , List.map Helpers.Tuple.tuple3Second tcInitResults + , List.map Helpers.Tuple.tuple3Third tcInitResults + ) + + appCmds = + tcAppCmdLists + |> List.indexedMap + (\tcId tcAppCmds -> + AppCmd.mapList (TradeCacheMsg tcId) tcAppCmds + ) + |> List.concat + + tcCmd = + tcCmds + |> List.indexedMap + (\tcId cmd -> + Cmd.map (TradeCacheMsg tcId) cmd + ) + |> Cmd.batch ( model, fromUrlCmd ) = { key = key - , initialWeb3State = initialWeb3State + , wallet = wallet + , userAddress = Nothing , time = Time.millisToPosix 0 - , web3Context = web3Context , txSentry = txSentry - , userAddress = Nothing - , userInfo = Nothing - , tradeCache = tradeCache + , tradeCaches = tradeCaches , submodel = BetaLandingPage , userNotices = [] , screenWidth = flags.width } |> updateFromUrl url - |> runAppCmds - (AppCmd.mapList TradeCacheMsg tcAppCmds) + |> runAppCmds appCmds in ( model |> addUserNotices userNotices , Cmd.batch - [ Cmd.map TradeCacheMsg tcCmd + [ tcCmd , fromUrlCmd ] ) @@ -199,69 +215,9 @@ update msg model = Tick newTime -> ( { model | time = newTime }, Cmd.none ) - NetworkUpdate newNetworkValue -> - let - newNetworkIdResult = - Json.Decode.decodeValue Json.Decode.int newNetworkValue - |> Result.map Eth.Net.toNetworkId - - maybeNewFactoryType = - newNetworkIdResult - |> Result.toMaybe - |> Maybe.andThen EthHelpers.networkIdToFactoryType - in - case ( newNetworkIdResult, maybeNewFactoryType ) of - ( Ok newNetworkId, Just newFactoryType ) -> - if newNetworkId /= EthHelpers.factoryTypeToNetworkId model.web3Context.factoryType then - let - newWeb3Context = - EthHelpers.web3Context newFactoryType - - ( submodel, submodelCmd, maybeRoute ) = - model.submodel |> updateSubmodelWeb3Context newWeb3Context - - ( newTradeCache, tradeCacheCmd, appCmds ) = - TradeCache.initAndStartCaching newWeb3Context - in - ( { model - | submodel = submodel - , tradeCache = newTradeCache - , web3Context = newWeb3Context - } - , Cmd.batch - [ Cmd.map TradeCacheMsg tradeCacheCmd - , case maybeRoute of - Just newRoute -> - beginRouteChange model.key newRoute - - Nothing -> - submodelCmd - ] - ) - |> runAppCmds - (AppCmd.mapList TradeCacheMsg appCmds) - - else - ( model - , Cmd.none - ) - - ( Err jsonDecodeError, _ ) -> - ( model - |> (addUserNotice <| UN.unexpectedError "Can't decode networkID from Javascript" jsonDecodeError) - , Cmd.none - ) - - ( _, Nothing ) -> - ( model - |> addUserNotice - UN.wrongWeb3Network - , Cmd.none - ) - ConnectToWeb3 -> - case model.initialWeb3State of - NoWeb3 -> + case model.wallet of + Wallet.NoneDetected -> ( model |> addUserNotice UN.cantConnectNoWeb3 , Cmd.none ) @@ -293,26 +249,27 @@ update msg model = UserPubkeySet commPubkeyValue -> case Json.Decode.decodeValue Json.Decode.string commPubkeyValue of Ok commPubkey -> - case model.userAddress of - Just userAddress -> + case ( model.userAddress, model.wallet ) of + ( Just userAddress, Wallet.OnlyNetwork network ) -> let - userInfo = - Just - { address = userAddress - , commPubkey = commPubkey - } + wallet = + Wallet.Active <| + UserInfo + network + userAddress + commPubkey ( submodel, cmd ) = - model.submodel |> updateSubmodelUserInfo userInfo + model.submodel |> updateSubmodelWalletState wallet in ( { model - | userInfo = userInfo + | wallet = wallet , submodel = submodel } , cmd ) - Nothing -> + ( Nothing, _ ) -> ( model |> addUserNotice (UN.unexpectedError @@ -322,6 +279,16 @@ update msg model = , Cmd.none ) + ( _, _ ) -> + ( model + |> addUserNotice + (UN.unexpectedError + "Unexpected wallet state encounted when setting commPubkey!" + Nothing + ) + , Cmd.none + ) + Err s -> ( model |> (addUserNotice <| UN.unexpectedError "error decoding commPubkey from JS" s) , Cmd.none @@ -334,7 +301,7 @@ update msg model = updateResult = Create.State.update createMsg createModel - ( newTxSentry, chainCmd ) = + ( newTxSentry, chainCmd, userNotices ) = ChainCmd.execute model.txSentry (ChainCmd.map CreateMsg updateResult.chainCmd) in ( { model @@ -347,36 +314,37 @@ update msg model = ] ) |> runAppCmds - (AppCmd.mapList CreateMsg updateResult.appCmds) - - _ -> - ( model, Cmd.none ) - - QuickCreateMsg quickCreateMsg -> - case model.submodel of - QuickCreateModel quickCreateModel -> - let - updateResult = - QuickCreate.State.update quickCreateMsg quickCreateModel - - ( newTxSentry, chainCmd ) = - ChainCmd.execute model.txSentry (ChainCmd.map QuickCreateMsg updateResult.chainCmd) - in - ( { model - | submodel = QuickCreateModel updateResult.model - , txSentry = newTxSentry - } - , Cmd.batch - [ Cmd.map QuickCreateMsg updateResult.cmd - , chainCmd - ] - ) - |> runAppCmds - (AppCmd.mapList QuickCreateMsg updateResult.appCmds) + (AppCmd.mapList CreateMsg updateResult.appCmds + ++ List.map AppCmd.UserNotice userNotices + ) _ -> ( model, Cmd.none ) + -- QuickCreateMsg quickCreateMsg -> + -- case model.submodel of + -- QuickCreateModel quickCreateModel -> + -- let + -- updateResult = + -- QuickCreate.State.update quickCreateMsg quickCreateModel + -- ( newTxSentry, chainCmd, userNotices ) = + -- ChainCmd.execute model.txSentry (ChainCmd.map QuickCreateMsg updateResult.chainCmd) + -- in + -- ( { model + -- | submodel = QuickCreateModel updateResult.model + -- , txSentry = newTxSentry + -- } + -- , Cmd.batch + -- [ Cmd.map QuickCreateMsg updateResult.cmd + -- , chainCmd + -- ] + -- ) + -- |> runAppCmds + -- (AppCmd.mapList QuickCreateMsg updateResult.appCmds + -- ++ List.map AppCmd.UserNotice userNotices + -- ) + -- _ -> + -- ( model, Cmd.none ) TradeMsg tradeMsg -> case model.submodel of TradeModel tradeModel -> @@ -384,7 +352,7 @@ update msg model = updateResult = Trade.State.update tradeMsg tradeModel - ( newTxSentry, chainCmd ) = + ( newTxSentry, chainCmd, userNotices ) = ChainCmd.execute model.txSentry (ChainCmd.map TradeMsg updateResult.chainCmd) in ( { model @@ -397,7 +365,9 @@ update msg model = ] ) |> runAppCmds - (AppCmd.mapList TradeMsg updateResult.appCmds) + (AppCmd.mapList TradeMsg updateResult.appCmds + ++ List.map AppCmd.UserNotice userNotices + ) _ -> ( model, Cmd.none ) @@ -425,7 +395,7 @@ update msg model = updateResult = AgentHistory.State.update agentHistoryMsg agentHistoryModel - ( newTxSentry, chainCmd ) = + ( newTxSentry, chainCmd, userNotices ) = ChainCmd.execute model.txSentry (ChainCmd.map AgentHistoryMsg updateResult.chainCmd) in ( { model @@ -438,28 +408,46 @@ update msg model = ] ) |> runAppCmds - (AppCmd.mapList AgentHistoryMsg updateResult.appCmds) + (AppCmd.mapList AgentHistoryMsg updateResult.appCmds + ++ List.map AppCmd.UserNotice userNotices + ) _ -> ( model, Cmd.none ) TxSentryMsg subMsg -> let - ( submodel, subCmd ) = - TxSentry.update subMsg model.txSentry - in - ( { model | txSentry = submodel }, subCmd ) + ( newTxSentry, subCmd ) = + case model.txSentry of + Just txSentry -> + TxSentry.update subMsg txSentry + |> Tuple.mapFirst Just - TradeCacheMsg tradeCacheMsg -> - let - updateResult = - TradeCache.update - tradeCacheMsg - model.tradeCache + Nothing -> + ( Nothing, Cmd.none ) in - ( { model | tradeCache = updateResult.tradeCache } - , updateResult.cmd |> Cmd.map TradeCacheMsg - ) + ( { model | txSentry = newTxSentry }, subCmd ) + + TradeCacheMsg tcId tradeCacheMsg -> + case List.Extra.getAt tcId model.tradeCaches of + Nothing -> + ( model, Cmd.none ) + |> runAppCmd (AppCmd.UserNotice <| UN.unexpectedError "Encountered an out-of-range error when trying to route a TradeCacheMsg" Nothing) + + Just tradeCache -> + let + updateResult = + TradeCache.update + tradeCacheMsg + tradeCache + in + ( { model + | tradeCaches = + model.tradeCaches + |> List.Extra.setAt tcId updateResult.tradeCache + } + , updateResult.cmd |> Cmd.map (TradeCacheMsg tcId) + ) NoOp -> ( model, Cmd.none ) @@ -559,9 +547,9 @@ gotoRoute oldModel route = Routing.Create -> let updateResult = - Create.State.init oldModel.web3Context oldModel.userInfo + Create.State.init oldModel.wallet - ( newTxSentry, chainCmd ) = + ( newTxSentry, chainCmd, userNotices ) = ChainCmd.execute oldModel.txSentry (ChainCmd.map CreateMsg updateResult.chainCmd) in ( { oldModel @@ -574,34 +562,41 @@ gotoRoute oldModel route = ] ) |> runAppCmds - (AppCmd.mapList CreateMsg updateResult.appCmds) + (AppCmd.mapList CreateMsg updateResult.appCmds + ++ List.map AppCmd.UserNotice userNotices + ) - Routing.QuickCreate -> + -- Routing.QuickCreate -> + -- let + -- updateResult = + -- QuickCreate.State.init oldModel.wallet + -- ( newTxSentry, chainCmd, userNotices ) = + -- ChainCmd.execute oldModel.txSentry (ChainCmd.map QuickCreateMsg updateResult.chainCmd) + -- in + -- ( { oldModel + -- | submodel = QuickCreateModel updateResult.model + -- , txSentry = newTxSentry + -- } + -- , Cmd.batch + -- [ Cmd.map QuickCreateMsg updateResult.cmd + -- , chainCmd + -- ] + -- ) + -- |> runAppCmds + -- (AppCmd.mapList QuickCreateMsg updateResult.appCmds + -- ++ List.map AppCmd.UserNotice userNotices + -- ) + Routing.Trade factory id -> let updateResult = - QuickCreate.State.init oldModel.web3Context oldModel.userInfo + case getTradeFromCaches factory id oldModel.tradeCaches of + Just (CTypes.LoadedTrade trade) -> + Trade.State.initFromCached oldModel.wallet trade - ( newTxSentry, chainCmd ) = - ChainCmd.execute oldModel.txSentry (ChainCmd.map QuickCreateMsg updateResult.chainCmd) - in - ( { oldModel - | submodel = QuickCreateModel updateResult.model - , txSentry = newTxSentry - } - , Cmd.batch - [ Cmd.map QuickCreateMsg updateResult.cmd - , chainCmd - ] - ) - |> runAppCmds - (AppCmd.mapList QuickCreateMsg updateResult.appCmds) - - Routing.Trade id -> - let - updateResult = - Trade.State.init oldModel.web3Context oldModel.userInfo id + _ -> + Trade.State.init oldModel.wallet factory id - ( newTxSentry, chainCmd ) = + ( newTxSentry, chainCmd, userNotices ) = ChainCmd.execute oldModel.txSentry (ChainCmd.map TradeMsg updateResult.chainCmd) in ( { oldModel @@ -614,12 +609,14 @@ gotoRoute oldModel route = ] ) |> runAppCmds - (AppCmd.mapList TradeMsg updateResult.appCmds) + (AppCmd.mapList TradeMsg updateResult.appCmds + ++ List.map AppCmd.UserNotice userNotices + ) - Routing.Marketplace browsingRole -> + Routing.Marketplace -> let ( marketplaceModel, marketplaceCmd ) = - Marketplace.State.init oldModel.web3Context browsingRole oldModel.userInfo + Marketplace.State.init oldModel.wallet in ( { oldModel | submodel = MarketplaceModel marketplaceModel @@ -629,10 +626,10 @@ gotoRoute oldModel route = ] ) - Routing.AgentHistory address agentRole -> + Routing.AgentHistory address -> let ( agentHistoryModel, agentHistoryCmd ) = - AgentHistory.State.init oldModel.web3Context address agentRole oldModel.userInfo + AgentHistory.State.init oldModel.wallet address in ( { oldModel | submodel = AgentHistoryModel agentHistoryModel @@ -648,8 +645,16 @@ gotoRoute oldModel route = ) -updateSubmodelUserInfo : Maybe UserInfo -> Submodel -> ( Submodel, Cmd Msg ) -updateSubmodelUserInfo userInfo submodel = +getTradeFromCaches : FactoryType -> Int -> List TradeCache -> Maybe CTypes.Trade +getTradeFromCaches factory id tradeCaches = + tradeCaches + |> List.Extra.find (\tc -> tc.factory == factory) + |> Maybe.map .trades + |> Maybe.andThen (Array.get id) + + +updateSubmodelWalletState : Wallet.State -> Submodel -> ( Submodel, Cmd Msg ) +updateSubmodelWalletState wallet submodel = case submodel of BetaLandingPage -> ( submodel @@ -659,80 +664,40 @@ updateSubmodelUserInfo userInfo submodel = CreateModel createModel -> let ( newCreateModel, createCmd ) = - createModel |> Create.State.updateUserInfo userInfo + createModel |> Create.State.updateWalletState wallet in ( CreateModel newCreateModel , Cmd.map CreateMsg createCmd ) - QuickCreateModel quickCreateModel -> - let - ( newQuickCreateModel, quickCreateCmd ) = - quickCreateModel |> QuickCreate.State.updateUserInfo userInfo - in - ( QuickCreateModel newQuickCreateModel - , Cmd.map QuickCreateMsg quickCreateCmd - ) - + -- QuickCreateModel quickCreateModel -> + -- let + -- ( newQuickCreateModel, quickCreateCmd ) = + -- quickCreateModel |> QuickCreate.State.updateWalletState wallet + -- in + -- ( QuickCreateModel newQuickCreateModel + -- , Cmd.map QuickCreateMsg quickCreateCmd + -- ) TradeModel tradeModel -> let ( newTradeModel, tradeCmd ) = - tradeModel |> Trade.State.updateUserInfo userInfo + tradeModel |> Trade.State.updateWalletState wallet in ( TradeModel newTradeModel , Cmd.map TradeMsg tradeCmd ) MarketplaceModel marketplaceModel -> - ( MarketplaceModel (marketplaceModel |> Marketplace.State.updateUserInfo userInfo) + ( MarketplaceModel (marketplaceModel |> Marketplace.State.updateWalletState wallet) , Cmd.none ) AgentHistoryModel agentHistoryModel -> - ( AgentHistoryModel (agentHistoryModel |> AgentHistory.State.updateUserInfo userInfo) + ( AgentHistoryModel (agentHistoryModel |> AgentHistory.State.updateWalletState wallet) , Cmd.none ) -updateSubmodelWeb3Context : EthHelpers.Web3Context -> Submodel -> ( Submodel, Cmd Msg, Maybe Routing.Route ) -updateSubmodelWeb3Context newWeb3Context submodel = - case submodel of - BetaLandingPage -> - ( submodel, Cmd.none, Nothing ) - - CreateModel createModel -> - ( CreateModel (createModel |> Create.State.updateWeb3Context newWeb3Context) - , Cmd.none - , Nothing - ) - - QuickCreateModel quickCreateModel -> - ( QuickCreateModel (quickCreateModel |> QuickCreate.State.updateWeb3Context newWeb3Context) - , Cmd.none - , Nothing - ) - - TradeModel tradeModel -> - -- Doesn't make sense to look at the same trade on a new network - -- so just redirect to marketplace - ( submodel - , Cmd.none - , Just <| Routing.Marketplace Buyer - ) - - MarketplaceModel marketplaceModel -> - ( MarketplaceModel (marketplaceModel |> Marketplace.State.updateWeb3Context newWeb3Context) - , Cmd.none - , Nothing - ) - - AgentHistoryModel agentHistoryModel -> - ( AgentHistoryModel (agentHistoryModel |> AgentHistory.State.updateWeb3Context newWeb3Context) - , Cmd.none - , Nothing - ) - - subscriptions : Model -> Sub Msg subscriptions model = let @@ -743,10 +708,14 @@ subscriptions model = Sub.batch ([ Time.every 1000 Tick , walletSentryPort (WalletSentry.decodeToMsg failedWalletDecodeToMsg WalletStatus) - , TxSentry.listen model.txSentry + , Maybe.map TxSentry.listen model.txSentry + |> Maybe.withDefault Sub.none , userPubkeyResult UserPubkeySet - , Sub.map TradeCacheMsg <| TradeCache.subscriptions model.tradeCache - , networkSentryPort NetworkUpdate + , model.tradeCaches + |> List.map TradeCache.subscriptions + |> List.indexedMap + (\tcId sub -> Sub.map (TradeCacheMsg tcId) sub) + |> Sub.batch ] ++ [ submodelSubscriptions model ] ) @@ -761,9 +730,8 @@ submodelSubscriptions model = CreateModel createModel -> Sub.map CreateMsg <| Create.State.subscriptions createModel - QuickCreateModel quickCreateModel -> - Sub.map QuickCreateMsg <| QuickCreate.State.subscriptions quickCreateModel - + -- QuickCreateModel quickCreateModel -> + -- Sub.map QuickCreateMsg <| QuickCreate.State.subscriptions quickCreateModel TradeModel tradeModel -> Sub.map TradeMsg <| Trade.State.subscriptions tradeModel @@ -777,9 +745,6 @@ submodelSubscriptions model = port walletSentryPort : (Json.Decode.Value -> msg) -> Sub msg -port networkSentryPort : (Json.Decode.Value -> msg) -> Sub msg - - port connectToWeb3 : () -> Cmd msg diff --git a/src/Trade/ChatHistory/State.elm b/src/Trade/ChatHistory/State.elm index 7d2c6d5..d72a1cc 100644 --- a/src/Trade/ChatHistory/State.elm +++ b/src/Trade/ChatHistory/State.elm @@ -5,22 +5,22 @@ import Array exposing (Array) import CommonTypes exposing (..) import Contracts.Types as CTypes import Eth -import Helpers.Eth as EthHelpers exposing (Web3Context) +import Helpers.Eth as EthHelpers import Json.Decode import Json.Encode import Maybe.Extra import Trade.ChatHistory.SecureComm exposing (..) import Trade.ChatHistory.Types exposing (..) import UserNotice as UN +import Wallet -init : Web3Context -> UserInfo -> BuyerOrSeller -> BuyerOrSeller -> List ( Int, CTypes.DAIHardEvent ) -> Int -> ( Model, Bool, List (AppCmd Msg) ) -init web3Context userInfo buyerOrSeller initiatorRole initialEvents currentBlocknum = +init : Wallet.State -> BuyerOrSeller -> CTypes.FullTradeInfo -> List ( Int, CTypes.DAIHardEvent ) -> Int -> ( Model, Bool, List (AppCmd Msg) ) +init wallet userRole trade initialEvents currentBlocknum = Model - web3Context - userInfo - buyerOrSeller - initiatorRole + wallet + trade + userRole Array.empty currentBlocknum "" @@ -133,7 +133,7 @@ handleNewEvent : Int -> CTypes.DAIHardEvent -> Model -> ( Model, Bool, List (App handleNewEvent blocknum event prevModel = let toBuyerOrSeller = - CTypes.initiatorOrResponderToBuyerOrSeller prevModel.initiatorRole + CTypes.initiatorOrResponderToBuyerOrSeller prevModel.trade.parameters.initiatorRole maybeHistoryEventInfo = case event of @@ -194,7 +194,7 @@ handleNewEvent blocknum event prevModel = ( maybeHistoryEventInfo |> Maybe.map (historyEventToBrowserNotifcationAppCmd - (prevModel.userRole == prevModel.initiatorRole) + (prevModel.userRole == prevModel.trade.parameters.initiatorRole) ) , blocknum ) diff --git a/src/Trade/ChatHistory/Types.elm b/src/Trade/ChatHistory/Types.elm index 825b682..26ef9a8 100644 --- a/src/Trade/ChatHistory/Types.elm +++ b/src/Trade/ChatHistory/Types.elm @@ -4,17 +4,18 @@ import AppCmd exposing (AppCmd) import Array exposing (Array) import CommonTypes exposing (..) import Contracts.Types as CTypes +import Eth.Net import Eth.Types exposing (Address) -import Helpers.Eth as EthHelpers exposing (Web3Context) +import Helpers.Eth as EthHelpers import Json.Decode import Time +import Wallet type alias Model = - { web3Context : Web3Context - , userInfo : UserInfo + { wallet : Wallet.State + , trade : CTypes.FullTradeInfo , userRole : BuyerOrSeller - , initiatorRole : BuyerOrSeller , history : Array Event , lastNotificationBlocknum : Int , messageInput : String diff --git a/src/Trade/ChatHistory/View.elm b/src/Trade/ChatHistory/View.elm index 2193ca5..d862921 100644 --- a/src/Trade/ChatHistory/View.elm +++ b/src/Trade/ChatHistory/View.elm @@ -12,6 +12,7 @@ import Element.Input import Eth.Utils import Helpers.Element as EH import Trade.ChatHistory.Types exposing (..) +import Wallet window : Model -> Element Msg @@ -37,7 +38,7 @@ historyAndCommsElement model = , Element.padding 20 ] [ historyElement - model.web3Context.factoryType + model.trade.factory model.userRole (model.history |> Array.toList |> List.sortBy .blocknum) , commInputElement model @@ -175,10 +176,10 @@ renderEvent factoryType userRole event = Just ( Element.rgb 0 1 0, EH.white, "Buyer marked the fiat transfer complete" ) Released -> - Just ( Element.rgb 0 0 1, EH.white, "Seller released the " ++ Config.tokenUnitName factoryType ++ " and closed the contract" ) + Just ( Element.rgb 0 0 1, EH.white, "Seller released the " ++ tokenUnitName factoryType ++ " and closed the contract" ) Burned -> - Just ( Element.rgb 0 0 1, EH.white, "Seller burned the " ++ Config.tokenUnitName factoryType ++ " and closed the contract" ) + Just ( Element.rgb 0 0 1, EH.white, "Seller burned the " ++ tokenUnitName factoryType ++ " and closed the contract" ) in case maybeElementInfo of Nothing -> diff --git a/src/Trade/State.elm b/src/Trade/State.elm index cfb2ccd..6f6d64e 100644 --- a/src/Trade/State.elm +++ b/src/Trade/State.elm @@ -1,8 +1,9 @@ -port module Trade.State exposing (init, subscriptions, update, updateUserInfo) +port module Trade.State exposing (init, initFromCached, subscriptions, update, updateWalletState) import AppCmd exposing (AppCmd) import Array exposing (Array) import BigInt exposing (BigInt) +import ChainCmd exposing (ChainCmd) import CommonTypes exposing (..) import Config import Contracts.Generated.DAIHardNativeTrade as DHNT @@ -17,8 +18,7 @@ import Eth.Sentry.Tx exposing (CustomSend) import Eth.Types exposing (Address) import Eth.Utils import Helpers.BigInt as BigIntHelpers -import Helpers.ChainCmd as ChainCmd exposing (ChainCmd) -import Helpers.Eth as EthHelpers exposing (Web3Context) +import Helpers.Eth as EthHelpers import Http import Json.Decode import Json.Encode @@ -35,58 +35,88 @@ import Trade.ChatHistory.State as ChatHistory import Trade.ChatHistory.Types as ChatHistory import Trade.Types exposing (..) import UserNotice as UN +import Wallet -init : EthHelpers.Web3Context -> Maybe UserInfo -> Int -> UpdateResult -init web3Context userInfo tradeId = +init : Wallet.State -> FactoryType -> Int -> UpdateResult +init wallet factory tradeId = let - getCreationInfoCmd = - getContractCreationInfoCmd web3Context tradeId + creationInfoCmd = + getCreationInfoCmd factory tradeId ( eventSentry, eventSentryCmd ) = - EventSentry.init EventSentryMsg web3Context.httpProvider + initEventSentry factory in UpdateResult - { web3Context = web3Context - , userInfo = userInfo - , trade = CTypes.partialTradeInfo tradeId - , expandedPhase = CTypes.Open - , chatHistoryModel = Nothing - , showChatHistory = False - , showStatsModal = False - , eventsWaitingForChatHistory = [] - , secureCommInfo = partialCommInfo - , eventSentry = eventSentry - , allowance = Nothing - , txChainStatus = Nothing - , blocknumOnInit = Nothing - } + (initModel (CTypes.partialTradeInfo factory tradeId) eventSentry wallet) (Cmd.batch - [ getCreationInfoCmd + [ creationInfoCmd , eventSentryCmd - , getBlockCmd web3Context + , getBlockCmd (EthHelpers.httpProviderForFactory factory) ] ) ChainCmd.none [ AppCmd.RequestBrowserNotificationPermission ] -getContractCreationInfoCmd : EthHelpers.Web3Context -> Int -> Cmd Msg -getContractCreationInfoCmd web3Context id = - Contracts.Wrappers.getCreationInfoFromIdCmd web3Context (BigInt.fromInt id) CreationInfoFetched +initFromCached : Wallet.State -> CTypes.FullTradeInfo -> UpdateResult +initFromCached wallet trade = + let + ( eventSentry, eventSentryCmd ) = + initEventSentry trade.factory + in + UpdateResult + (initModel (CTypes.LoadedTrade trade) eventSentry wallet) + (Cmd.batch + [ eventSentryCmd + , getBlockCmd (EthHelpers.httpProviderForFactory trade.factory) + ] + ) + ChainCmd.none + [ AppCmd.RequestBrowserNotificationPermission ] + + +initModel : CTypes.Trade -> EventSentry Msg -> Wallet.State -> Model +initModel trade eventSentry wallet = + { wallet = wallet + , trade = trade + , expandedPhase = CTypes.Open + , chatHistoryModel = Nothing + , showChatHistory = False + , showStatsModal = False + , eventsWaitingForChatHistory = [] + , secureCommInfo = partialCommInfo + , eventSentry = eventSentry + , allowance = Nothing + , txChainStatus = Nothing + , blocknumOnInit = Nothing + } -updateUserInfo : Maybe UserInfo -> Model -> ( Model, Cmd Msg ) -updateUserInfo userInfo model = - ( { model | userInfo = userInfo } - , case ( userInfo, model.trade, model.web3Context.factoryType ) of - ( Just uInfo, CTypes.LoadedTrade trade, Token tokenType ) -> - Contracts.Wrappers.getAllowanceCmd - model.web3Context - tokenType - uInfo.address - trade.creationInfo.address - AllowanceFetched +initEventSentry : FactoryType -> ( EventSentry Msg, Cmd Msg ) +initEventSentry factory = + EventSentry.init EventSentryMsg (EthHelpers.httpProviderForFactory factory) + + +getCreationInfoCmd : FactoryType -> Int -> Cmd Msg +getCreationInfoCmd factoryType id = + Contracts.Wrappers.getCreationInfoFromIdCmd factoryType (BigInt.fromInt id) CreationInfoFetched + + +updateWalletState : Wallet.State -> Model -> ( Model, Cmd Msg ) +updateWalletState wallet model = + ( { model | wallet = wallet } + , case ( Wallet.userInfo wallet, Wallet.factory wallet, model.trade ) of + ( Just uInfo, Just (Token tokenType), CTypes.LoadedTrade trade ) -> + if Wallet.factory wallet == Just trade.factory then + Contracts.Wrappers.getAllowanceCmd + tokenType + uInfo.address + trade.creationInfo.address + AllowanceFetched + + else + Cmd.none _ -> Cmd.none @@ -103,7 +133,7 @@ update msg prevModel = CTypes.PartiallyLoadedTrade pInfo -> case pInfo.creationInfo of Nothing -> - getContractCreationInfoCmd prevModel.web3Context pInfo.id + getCreationInfoCmd pInfo.factory pInfo.id _ -> Cmd.none @@ -114,7 +144,7 @@ update msg prevModel = ( newChatHistoryModel, shouldDecrypt, appCmds ) = case prevModel.chatHistoryModel of Nothing -> - tryInitChatHistory prevModel.web3Context prevModel.trade prevModel.userInfo prevModel.blocknumOnInit prevModel.eventsWaitingForChatHistory + tryInitChatHistory prevModel.wallet prevModel.trade prevModel.blocknumOnInit prevModel.eventsWaitingForChatHistory _ -> ( prevModel.chatHistoryModel, False, [] ) @@ -127,14 +157,17 @@ update msg prevModel = Cmd.none fetchAllowanceCmd = - case ( prevModel.userInfo, prevModel.trade, prevModel.web3Context.factoryType ) of - ( Just userInfo, CTypes.LoadedTrade trade, Token tokenType ) -> - Contracts.Wrappers.getAllowanceCmd - prevModel.web3Context - tokenType - userInfo.address - trade.creationInfo.address - AllowanceFetched + case ( Wallet.userInfo prevModel.wallet, Wallet.factory prevModel.wallet, prevModel.trade ) of + ( Just userInfo, Just (Token tokenType), CTypes.LoadedTrade trade ) -> + if Wallet.factory prevModel.wallet == Just trade.factory then + Contracts.Wrappers.getAllowanceCmd + tokenType + userInfo.address + trade.creationInfo.address + AllowanceFetched + + else + Cmd.none _ -> Cmd.none @@ -147,9 +180,10 @@ update msg prevModel = UpdateResult newModel (Cmd.batch - [ Contracts.Wrappers.getStateCmd prevModel.web3Context tradeInfo.creationInfo.address StateFetched + [ Contracts.Wrappers.getStateCmd tradeInfo.factory tradeInfo.creationInfo.address StateFetched , decryptCmd - , fetchCreationInfoCmd + + -- , fetchCreationInfoCmd , fetchAllowanceCmd ] ) @@ -183,12 +217,12 @@ update msg prevModel = | allowance = Just allowance } in - case ( newModel.txChainStatus, newModel.trade, newModel.userInfo ) of - ( Just (ApproveMining _), CTypes.LoadedTrade trade, Just userInfo ) -> + case ( newModel.txChainStatus, newModel.trade, newModel.wallet ) of + ( Just (ApproveMining _), CTypes.LoadedTrade trade, Wallet.Active userInfo ) -> if BigInt.compare allowance (CTypes.responderDeposit trade.parameters |> TokenValue.getEvmValue) /= LT then let ( txChainStatus, chainCmd ) = - initiateCommitCall prevModel.web3Context trade userInfo.address userInfo.commPubkey + initiateCommitCall trade userInfo.address userInfo.commPubkey in UpdateResult { newModel | txChainStatus = txChainStatus } @@ -213,11 +247,11 @@ update msg prevModel = CreationInfoFetched fetchResult -> case fetchResult of - Ok createdSell -> + Ok createdTrade -> let newCreationInfo = - { address = createdSell.address_ - , blocknum = BigIntHelpers.toIntWithWarning createdSell.blocknum + { address = createdTrade.address_ + , blocknum = BigIntHelpers.toIntWithWarning createdTrade.blocknum } ( newSentry, sentryCmd, _ ) = @@ -236,10 +270,14 @@ update msg prevModel = , eventSentry = newSentry } + factory = + CTypes.tradeFactory newModel.trade + |> Maybe.withDefault Wallet.defaultFactory + cmd = Cmd.batch [ sentryCmd - , Contracts.Wrappers.getParametersStateAndPhaseInfoCmd newModel.web3Context newCreationInfo.address ParametersFetched StateFetched PhaseInfoFetched + , Contracts.Wrappers.getParametersStateAndPhaseInfoCmd factory newCreationInfo.address ParametersFetched StateFetched PhaseInfoFetched ] in UpdateResult @@ -436,7 +474,7 @@ update msg prevModel = Nothing -> -- chat is uninitialized; initialize if we can - tryInitChatHistory prevModel.web3Context newTrade prevModel.userInfo prevModel.blocknumOnInit prevModel.eventsWaitingForChatHistory + tryInitChatHistory prevModel.wallet newTrade prevModel.blocknumOnInit prevModel.eventsWaitingForChatHistory eventsToSave = case newChatHistoryModel of @@ -507,7 +545,7 @@ update msg prevModel = prevModel Cmd.none ChainCmd.none - [ AppCmd.GotoRoute (Routing.AgentHistory trade.parameters.initiatorAddress asRole) ] + [ AppCmd.GotoRoute (Routing.AgentHistory trade.parameters.initiatorAddress) ] _ -> UpdateResult @@ -519,7 +557,7 @@ update msg prevModel = ] CommitClicked trade userInfo depositAmount -> - justModelUpdate { prevModel | txChainStatus = Just <| ConfirmingCommit trade userInfo depositAmount } + justModelUpdate { prevModel | txChainStatus = Just <| ConfirmingCommit userInfo depositAmount } AbortAction -> justModelUpdate { prevModel | txChainStatus = Nothing } @@ -527,9 +565,9 @@ update msg prevModel = ConfirmCommit trade userInfo depositAmount -> let ( txChainStatus, chainCmd ) = - case prevModel.web3Context.factoryType of + case trade.factory of Native _ -> - initiateCommitCall prevModel.web3Context trade userInfo.address userInfo.commPubkey + initiateCommitCall trade userInfo.address userInfo.commPubkey Token tokenType -> let @@ -553,7 +591,7 @@ update msg prevModel = case prevModel.allowance of Just allowance -> if BigInt.compare allowance (CTypes.responderDeposit trade.parameters |> TokenValue.getEvmValue) /= LT then - initiateCommitCall prevModel.web3Context trade userInfo.address userInfo.commPubkey + initiateCommitCall trade userInfo.address userInfo.commPubkey else ( Just ApproveNeedsSig, approveChainCmd ) @@ -795,8 +833,8 @@ update msg prevModel = decodeEncryptionResult encryptedMessagesValue |> Result.andThen encodeEncryptedMessages in - case ( prevModel.userInfo, prevModel.trade, encodedEncryptionMessages ) of - ( Just userInfo, CTypes.LoadedTrade tradeInfo, Ok encodedEncryptedMessages ) -> + case ( prevModel.wallet, prevModel.trade, encodedEncryptionMessages ) of + ( Wallet.Active userInfo, CTypes.LoadedTrade tradeInfo, Ok encodedEncryptedMessages ) -> case CTypes.getInitiatorOrResponder tradeInfo userInfo.address of Nothing -> UpdateResult @@ -869,11 +907,11 @@ update msg prevModel = [ AppCmd.Web3Connect ] -initiateCommitCall : EthHelpers.Web3Context -> CTypes.FullTradeInfo -> Address -> String -> ( Maybe TxChainStatus, ChainCmd Msg ) -initiateCommitCall web3Context trade userAddress commPubkey = +initiateCommitCall : CTypes.FullTradeInfo -> Address -> String -> ( Maybe TxChainStatus, ChainCmd Msg ) +initiateCommitCall trade userAddress commPubkey = let commitConstructor = - case web3Context.factoryType of + case trade.factory of Token _ -> DHT.commit @@ -882,7 +920,7 @@ initiateCommitCall web3Context trade userAddress commPubkey = txParams = commitConstructor trade.creationInfo.address userAddress commPubkey - |> (case web3Context.factoryType of + |> (case trade.factory of Token _ -> identity @@ -902,9 +940,9 @@ initiateCommitCall web3Context trade userAddress commPubkey = ) -tryInitChatHistory : Web3Context -> CTypes.Trade -> Maybe UserInfo -> Maybe Int -> List ( Int, CTypes.DAIHardEvent ) -> ( Maybe ChatHistory.Model, Bool, List (AppCmd Msg) ) -tryInitChatHistory web3Context maybeTrade maybeUserInfo maybeCurrentBlocknum pendingEvents = - case ( maybeTrade, maybeUserInfo, maybeCurrentBlocknum ) of +tryInitChatHistory : Wallet.State -> CTypes.Trade -> Maybe Int -> List ( Int, CTypes.DAIHardEvent ) -> ( Maybe ChatHistory.Model, Bool, List (AppCmd Msg) ) +tryInitChatHistory wallet maybeTrade maybeCurrentBlocknum pendingEvents = + case ( maybeTrade, Wallet.userInfo wallet, maybeCurrentBlocknum ) of ( CTypes.LoadedTrade tradeInfo, Just userInfo, Just blocknum ) -> let maybeBuyerOrSeller = @@ -913,10 +951,9 @@ tryInitChatHistory web3Context maybeTrade maybeUserInfo maybeCurrentBlocknum pen case maybeBuyerOrSeller of Just buyerOrSeller -> ChatHistory.init - web3Context - userInfo + wallet buyerOrSeller - tradeInfo.parameters.initiatorRole + tradeInfo pendingEvents blocknum |> (\( chModel, shouldDecrypt, appCmds ) -> @@ -946,7 +983,7 @@ tryBuildDecryptCmd model = _ -> Nothing ) - (model.userInfo + (Wallet.userInfo model.wallet |> Maybe.map (\i -> i.address) ) |> Maybe.Extra.join @@ -990,9 +1027,9 @@ decryptNewMessagesCmd model userRole = |> Cmd.batch -getBlockCmd : EthHelpers.Web3Context -> Cmd Msg -getBlockCmd web3Context = - Eth.getBlockNumber web3Context.httpProvider +getBlockCmd : Eth.Types.HttpProvider -> Cmd Msg +getBlockCmd httpProvider = + Eth.getBlockNumber httpProvider |> Task.attempt CurrentBlockFetched diff --git a/src/Trade/Types.elm b/src/Trade/Types.elm index 8ed9170..2ca2bd8 100644 --- a/src/Trade/Types.elm +++ b/src/Trade/Types.elm @@ -1,24 +1,16 @@ -module Trade.Types exposing - ( ContractAction(..) - , Model - , Msg(..) - , PhaseState(..) - , TxChainStatus(..) - , UpdateResult - , actionName - , justModelUpdate - ) +module Trade.Types exposing (ContractAction(..), Model, Msg(..), PhaseState(..), TxChainStatus(..), UpdateResult, actionName, justModelUpdate) import AppCmd exposing (AppCmd) import Array exposing (Array) import BigInt exposing (BigInt) +import ChainCmd exposing (ChainCmd) import CommonTypes exposing (..) import Contracts.Generated.DAIHardFactory as DHF import Contracts.Generated.DAIHardTrade as DHT import Contracts.Types as CTypes +import Eth.Net import Eth.Sentry.Event as EventSentry exposing (EventSentry) import Eth.Types exposing (Address, TxHash, TxReceipt) -import Helpers.ChainCmd as ChainCmd exposing (ChainCmd) import Helpers.Eth as EthHelpers import Http import Json.Decode @@ -26,11 +18,11 @@ import Routing import Time import Trade.ChatHistory.SecureComm exposing (..) import Trade.ChatHistory.Types as ChatHistory +import Wallet type alias Model = - { web3Context : EthHelpers.Web3Context - , userInfo : Maybe UserInfo + { wallet : Wallet.State , trade : CTypes.Trade , expandedPhase : CTypes.Phase , chatHistoryModel : Maybe ChatHistory.Model @@ -93,7 +85,7 @@ justModelUpdate model = type TxChainStatus - = ConfirmingCommit CTypes.FullTradeInfo UserInfo BigInt + = ConfirmingCommit UserInfo BigInt | ApproveNeedsSig | ApproveMining TxHash | CommitNeedsSig diff --git a/src/Trade/View.elm b/src/Trade/View.elm index 9001508..ccefb3c 100644 --- a/src/Trade/View.elm +++ b/src/Trade/View.elm @@ -18,7 +18,7 @@ import Eth.Types exposing (Address) import Eth.Utils import FiatValue exposing (FiatValue) import Helpers.Element as EH -import Helpers.Eth as EthHelpers exposing (Web3Context) +import Helpers.Eth as EthHelpers import Helpers.Time as TimeHelpers import Images exposing (Image) import PaymentMethods exposing (PaymentMethod) @@ -27,10 +27,11 @@ import TokenValue exposing (TokenValue) import Trade.ChatHistory.View as ChatHistory import Trade.Types exposing (..) import TradeCache.Types exposing (TradeCache) +import Wallet -root : Int -> Time.Posix -> TradeCache -> Model -> ( Element Msg, List (Element Msg) ) -root screenWidth time tradeCache model = +root : Int -> Time.Posix -> List TradeCache -> Model -> ( Element Msg, List (Element Msg) ) +root screenWidth time tradeCaches model = let inRow = screenWidth > 1300 @@ -42,13 +43,13 @@ root screenWidth time tradeCache model = , Element.height Element.fill , Element.spacing 40 ] - [ header time tradeInfo model.userInfo model.web3Context.factoryType tradeCache model.showStatsModal + [ header time tradeInfo model.wallet tradeCaches model.showStatsModal , Element.el [ Element.width Element.fill , Element.paddingXY 40 0 , Element.spacing 40 ] - (phasesElement inRow model.web3Context.factoryType tradeInfo model.expandedPhase model.userInfo time) + (phasesElement inRow tradeInfo model.expandedPhase model.wallet time) ] CTypes.PartiallyLoadedTrade partialTradeInfo -> @@ -72,18 +73,18 @@ root screenWidth time tradeCache model = ) -header : Time.Posix -> FullTradeInfo -> Maybe UserInfo -> FactoryType -> TradeCache -> Bool -> Element Msg -header currentTime trade maybeUserInfo factoryType tradeCache showStatsModal = +header : Time.Posix -> FullTradeInfo -> Wallet.State -> List TradeCache -> Bool -> Element Msg +header currentTime trade wallet tradeCaches showStatsModal = EH.niceFloatingRow - [ tradeStatusElement trade factoryType - , daiAmountElement trade maybeUserInfo + [ tradeStatusElement trade + , daiAmountElement trade wallet , fiatElement trade - , statsElement factoryType trade tradeCache showStatsModal + , statsElement trade tradeCaches showStatsModal ] -tradeStatusElement : FullTradeInfo -> FactoryType -> Element Msg -tradeStatusElement trade factoryType = +tradeStatusElement : FullTradeInfo -> Element Msg +tradeStatusElement trade = EH.withHeader "Trade Status" (Element.column @@ -115,19 +116,19 @@ tradeStatusElement trade factoryType = , Element.Font.color EH.blue , Element.Font.underline ] - factoryType + trade.factory trade.creationInfo.address ] ) -daiAmountElement : FullTradeInfo -> Maybe UserInfo -> Element Msg -daiAmountElement trade maybeUserInfo = +daiAmountElement : FullTradeInfo -> Wallet.State -> Element Msg +daiAmountElement trade wallet = let maybeInitiatorOrResponder = - Maybe.andThen - (CTypes.getInitiatorOrResponder trade) - (Maybe.map .address maybeUserInfo) + Wallet.userInfo wallet + |> Maybe.map .address + |> Maybe.andThen (CTypes.getInitiatorOrResponder trade) in EH.withHeader (case ( trade.parameters.initiatorRole, maybeInitiatorOrResponder ) of @@ -191,26 +192,31 @@ type alias Stats = } -generateUserStats : TradeCache -> BuyerOrSeller -> Address -> Stats -generateUserStats tradeCache forRole userAddress = +generateUserStats : List TradeCache -> BuyerOrSeller -> Address -> Stats +generateUserStats tradeCaches forRole userAddress = let fullTradesByUserAsRole = - tradeCache.trades - |> Array.toList - |> List.filterMap - (\t -> - case t of - CTypes.LoadedTrade loadedT -> - Just loadedT + tradeCaches + |> List.map + (\tradeCache -> + tradeCache.trades + |> Array.toList + |> List.filterMap + (\t -> + case t of + CTypes.LoadedTrade loadedT -> + Just loadedT - _ -> - Nothing - ) - |> List.filter - -- filter for trades that share the same Seller - (\t -> - CTypes.getBuyerOrSeller t userAddress == Just forRole + _ -> + Nothing + ) + |> List.filter + -- filter for trades that share the same user in the same role + (\t -> + CTypes.getBuyerOrSeller t userAddress == Just forRole + ) ) + |> List.concat talliedVals = fullTradesByUserAsRole @@ -279,12 +285,12 @@ generateUserStats tradeCache forRole userAddress = } -statsElement : FactoryType -> FullTradeInfo -> TradeCache -> Bool -> Element Msg -statsElement factoryType trade tradeCache showModal = +statsElement : FullTradeInfo -> List TradeCache -> Bool -> Element Msg +statsElement trade tradeCaches showModal = let userStats = trade.parameters.initiatorAddress - |> generateUserStats tradeCache trade.parameters.initiatorRole + |> generateUserStats tradeCaches trade.parameters.initiatorRole headerText = buyerOrSellerToString trade.parameters.initiatorRole @@ -297,7 +303,7 @@ statsElement factoryType trade tradeCache showModal = [ Element.moveDown 30 , Element.alignRight ] - (statsModal factoryType trade.parameters.initiatorAddress userStats) + (statsModal trade.factory trade.parameters.initiatorAddress userStats) ) ] @@ -391,7 +397,7 @@ statsModal factoryType address stats = ++ " trades / " ++ TokenValue.toConciseString stats.amountReleased ++ " " - ++ Config.tokenUnitName factoryType + ++ tokenUnitName factoryType ++ " Released" ) , ( "Abort Outcomes" @@ -403,7 +409,7 @@ statsModal factoryType address stats = ++ " trades / " ++ TokenValue.toConciseString stats.amountBurned ++ " " - ++ Config.tokenUnitName factoryType + ++ tokenUnitName factoryType ++ " Burned" ) ] @@ -447,8 +453,8 @@ statsModal factoryType address stats = ] -phasesElement : Bool -> FactoryType -> FullTradeInfo -> CTypes.Phase -> Maybe UserInfo -> Time.Posix -> Element Msg -phasesElement inRow factoryType trade expandedPhase maybeUserInfo currentTime = +phasesElement : Bool -> FullTradeInfo -> CTypes.Phase -> Wallet.State -> Time.Posix -> Element Msg +phasesElement inRow trade expandedPhase wallet currentTime = case trade.state.phase of CTypes.Closed -> Element.row @@ -476,9 +482,9 @@ phasesElement inRow factoryType trade expandedPhase maybeUserInfo currentTime = , Element.height Element.shrink , Element.spacing 20 ] - [ phaseAndPaymentMethodElement inRow factoryType CTypes.Open trade maybeUserInfo (expandedPhase == CTypes.Open) currentTime - , phaseAndPaymentMethodElement inRow factoryType CTypes.Committed trade maybeUserInfo (expandedPhase == CTypes.Committed) currentTime - , phaseAndPaymentMethodElement inRow factoryType CTypes.Judgment trade maybeUserInfo (expandedPhase == CTypes.Judgment) currentTime + [ phaseAndPaymentMethodElement inRow CTypes.Open trade wallet (expandedPhase == CTypes.Open) currentTime + , phaseAndPaymentMethodElement inRow CTypes.Committed trade wallet (expandedPhase == CTypes.Committed) currentTime + , phaseAndPaymentMethodElement inRow CTypes.Judgment trade wallet (expandedPhase == CTypes.Judgment) currentTime ] , paymentMethodElement trade.terms.paymentMethods ] @@ -489,9 +495,9 @@ phasesElement inRow factoryType trade expandedPhase maybeUserInfo currentTime = , Element.height Element.shrink , Element.spacing 20 ] - [ phaseAndPaymentMethodElement inRow factoryType CTypes.Open trade maybeUserInfo (expandedPhase == CTypes.Open) currentTime - , phaseAndPaymentMethodElement inRow factoryType CTypes.Committed trade maybeUserInfo (expandedPhase == CTypes.Committed) currentTime - , phaseAndPaymentMethodElement inRow factoryType CTypes.Judgment trade maybeUserInfo (expandedPhase == CTypes.Judgment) currentTime + [ phaseAndPaymentMethodElement inRow CTypes.Open trade wallet (expandedPhase == CTypes.Open) currentTime + , phaseAndPaymentMethodElement inRow CTypes.Committed trade wallet (expandedPhase == CTypes.Committed) currentTime + , phaseAndPaymentMethodElement inRow CTypes.Judgment trade wallet (expandedPhase == CTypes.Judgment) currentTime ] @@ -538,8 +544,8 @@ phaseState trade phase = Finished -phaseAndPaymentMethodElement : Bool -> FactoryType -> CTypes.Phase -> FullTradeInfo -> Maybe UserInfo -> Bool -> Time.Posix -> Element Msg -phaseAndPaymentMethodElement inRow factoryType viewPhase trade maybeUserInfo expanded currentTime = +phaseAndPaymentMethodElement : Bool -> CTypes.Phase -> FullTradeInfo -> Wallet.State -> Bool -> Time.Posix -> Element Msg +phaseAndPaymentMethodElement inRow viewPhase trade wallet expanded currentTime = let viewPhaseState = phaseState trade viewPhase @@ -583,7 +589,7 @@ phaseAndPaymentMethodElement inRow factoryType viewPhase trade maybeUserInfo exp , Element.width Element.fill , Element.height Element.fill ] - (phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo) + (phaseBodyElement viewPhase currentTime trade wallet) borderEl = Element.el @@ -853,14 +859,14 @@ phaseStateElement pState = (Element.text "Finished") -phaseBodyElement : FactoryType -> CTypes.Phase -> Time.Posix -> CTypes.FullTradeInfo -> Maybe UserInfo -> Element Msg -phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = +phaseBodyElement : CTypes.Phase -> Time.Posix -> CTypes.FullTradeInfo -> Wallet.State -> Element Msg +phaseBodyElement viewPhase currentTime trade wallet = let phaseIsActive = viewPhase == trade.state.phase maybeBuyerOrSeller = - maybeUserInfo + Wallet.userInfo wallet |> Maybe.map .address |> Maybe.andThen (CTypes.getBuyerOrSeller trade) @@ -892,13 +898,13 @@ phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = Element.el [ Element.Font.color <| Element.rgb 1 0 0 ] << Element.text tradeAmountString = - TokenValue.toConciseString trade.parameters.tradeAmount ++ " " ++ Config.tokenUnitName factoryType + TokenValue.toConciseString trade.parameters.tradeAmount ++ " " ++ tokenUnitName trade.factory fiatAmountString = FiatValue.renderToStringFull trade.terms.price buyerDepositString = - TokenValue.toConciseString trade.parameters.buyerDeposit ++ " " ++ Config.tokenUnitName factoryType + TokenValue.toConciseString trade.parameters.buyerDeposit ++ " " ++ tokenUnitName trade.factory tradePlusDepositString = (TokenValue.add @@ -907,7 +913,7 @@ phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = |> TokenValue.toConciseString ) ++ " " - ++ Config.tokenUnitName factoryType + ++ tokenUnitName trade.factory abortPunishment = trade.parameters.abortPunishment @@ -916,7 +922,7 @@ phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = TokenValue.toConciseString abortPunishment ++ " " - ++ Config.tokenUnitName factoryType + ++ tokenUnitName trade.factory sellerAbortRefundString = TokenValue.toConciseString @@ -925,7 +931,7 @@ phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = abortPunishment ) ++ " " - ++ Config.tokenUnitName factoryType + ++ tokenUnitName trade.factory buyerAbortRefundString = TokenValue.toConciseString @@ -934,7 +940,7 @@ phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = abortPunishment ) ++ " " - ++ Config.tokenUnitName factoryType + ++ tokenUnitName trade.factory threeFlames = Element.row [] @@ -957,7 +963,7 @@ phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = , scaryText "Deposit and Commit to Trade" , Element.text "." ] - , [ Element.text <| "If the trade is successful, the combined " ++ Config.tokenUnitName factoryType ++ " balance " + , [ Element.text <| "If the trade is successful, the combined " ++ tokenUnitName trade.factory ++ " balance " , emphasizedText <| "(" ++ tradePlusDepositString ++ ")" , Element.text " will be released to you. If anything goes wrong, there are " , scaryText "burnable punishments " @@ -988,7 +994,7 @@ phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = ] , [ Element.text "When you receive the " , emphasizedText fiatAmountString - , Element.text <| " from the Buyer, the combined " ++ Config.tokenUnitName factoryType ++ " balance " + , Element.text <| " from the Buyer, the combined " ++ tokenUnitName trade.factory ++ " balance " , emphasizedText <| "(" ++ tradePlusDepositString ++ ")" , Element.text " will be released to the Buyer. If anything goes wrong, there are " , scaryText "burnable punishments " @@ -1221,7 +1227,7 @@ phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = ] (case phaseState trade viewPhase of Active -> - actionButtonsElement currentTime trade maybeUserInfo + actionButtonsElement currentTime trade wallet NotStarted -> Element.el @@ -1243,9 +1249,9 @@ phaseBodyElement factoryType viewPhase currentTime trade maybeUserInfo = ] -actionButtonsElement : Time.Posix -> FullTradeInfo -> Maybe UserInfo -> Element Msg -actionButtonsElement currentTime trade maybeUserInfo = - case maybeUserInfo of +actionButtonsElement : Time.Posix -> FullTradeInfo -> Wallet.State -> Element Msg +actionButtonsElement currentTime trade wallet = + case Wallet.userInfo wallet of Just userInfo -> case CTypes.getCurrentPhaseTimeoutInfo currentTime trade of CTypes.TimeUp _ -> @@ -1342,217 +1348,222 @@ chatOverlayElement model = getModalOrNone : Model -> Element Msg getModalOrNone model = - case model.txChainStatus of - Nothing -> - Element.none - - Just (ConfirmingCommit trade userInfo deposit) -> - let - depositAmountString = - TokenValue.tokenValue deposit - |> TokenValue.toConciseString - - fiatPriceString = - FiatValue.renderToStringFull trade.terms.price + case ( model.txChainStatus, model.trade ) of + ( Just txChainStatus, CTypes.LoadedTrade trade ) -> + case txChainStatus of + ConfirmingCommit userInfo deposit -> + let + depositAmountString = + TokenValue.tokenValue deposit + |> TokenValue.toConciseString + + fiatPriceString = + FiatValue.renderToStringFull trade.terms.price + + daiAmountString = + TokenValue.toConciseString trade.parameters.tradeAmount ++ " " ++ tokenUnitName trade.factory + + ( buyerOrSellerEl, agreeToWhatTextList ) = + case CTypes.getResponderRole trade.parameters of + Buyer -> + ( Element.el [ Element.Font.medium, Element.Font.color EH.black ] <| Element.text "buyer" + , [ Element.text "pay the seller " + , Element.el [ Element.Font.color EH.blue ] <| Element.text fiatPriceString + , Element.text " in exchange for the " + , Element.el [ Element.Font.color EH.blue ] <| Element.text daiAmountString + , Element.text " held in this contract." + ] + ) + + Seller -> + ( Element.el [ Element.Font.medium, Element.Font.color EH.black ] <| Element.text "seller" + , [ Element.text "accept " + , Element.el [ Element.Font.color EH.blue ] <| Element.text fiatPriceString + , Element.text " from the buyer in exchange for the " + , Element.el [ Element.Font.color EH.blue ] <| Element.text daiAmountString + , Element.text " held in this contract." + ] + ) + in + EH.closeableModal + [] + (Element.column + [ Element.spacing 20 + , Element.padding 20 + , Element.centerX + , Element.height Element.fill + , Element.Font.center + ] + [ Element.el + [ Element.Font.size 26 + , Element.Font.semiBold + , Element.centerX + , Element.centerY + ] + (Element.text "Just to Confirm...") + , Element.column + [ Element.spacing 20 + , Element.centerX + , Element.centerY + ] + (List.map + (Element.paragraph + [ Element.centerX + , Element.Font.size 18 + , Element.Font.medium + , Element.Font.color EH.permanentTextColor + ] + ) + ([ [ Element.text <| "You will deposit " + , Element.el [ Element.Font.color EH.blue ] <| Element.text <| depositAmountString ++ " " ++ tokenUnitName trade.factory + , Element.text ", thereby becoming the " + , buyerOrSellerEl + , Element.text " of this trade. By doing so, you are agreeing to " + ] + ++ agreeToWhatTextList + ] + ++ (case trade.factory of + Token _ -> + [ [ Element.text <| "(This ususally requires two Metamask signatures. Your " ++ tokenUnitName trade.factory ++ " will not be deposited until the second transaction has been mined.)" ] ] + + _ -> + [] + ) + ) + ) + , Element.el + [ Element.alignBottom + , Element.centerX + ] + (EH.redButton "Yes, I definitely want to commit to this trade." (ConfirmCommit trade userInfo deposit)) + ] + ) + AbortAction - daiAmountString = - TokenValue.toConciseString trade.parameters.tradeAmount ++ " " ++ Config.tokenUnitName model.web3Context.factoryType + ApproveNeedsSig -> + EH.txProcessModal + [ Element.text "Waiting for user signature for the approve call." + , Element.text "(check Metamask!)" + , Element.text "Note that there will be a second transaction to sign after this." + ] - ( buyerOrSellerEl, agreeToWhatTextList ) = - case CTypes.getResponderRole trade.parameters of - Buyer -> - ( Element.el [ Element.Font.medium, Element.Font.color EH.black ] <| Element.text "buyer" - , [ Element.text "pay the seller " - , Element.el [ Element.Font.color EH.blue ] <| Element.text fiatPriceString - , Element.text " in exchange for the " - , Element.el [ Element.Font.color EH.blue ] <| Element.text daiAmountString - , Element.text " held in this contract." - ] - ) + ApproveMining txHash -> + EH.txProcessModal + [ Element.text "Mining the initial approve transaction..." + , Element.newTabLink [ Element.Font.underline, Element.Font.color EH.blue ] + { url = EthHelpers.makeViewTxUrl trade.factory txHash + , label = Element.text "See the transaction on Etherscan" + } + , Element.text "Funds will not leave your wallet until you sign the next transaction." + ] - Seller -> - ( Element.el [ Element.Font.medium, Element.Font.color EH.black ] <| Element.text "seller" - , [ Element.text "accept " - , Element.el [ Element.Font.color EH.blue ] <| Element.text fiatPriceString - , Element.text " from the buyer in exchange for the " - , Element.el [ Element.Font.color EH.blue ] <| Element.text daiAmountString - , Element.text " held in this contract." - ] - ) - in - EH.closeableModal - [] - (Element.column - [ Element.spacing 20 - , Element.padding 20 - , Element.centerX - , Element.height Element.fill - , Element.Font.center - ] - [ Element.el - [ Element.Font.size 26 - , Element.Font.semiBold - , Element.centerX - , Element.centerY + CommitNeedsSig -> + EH.txProcessModal + [ Element.text "Waiting for user signature for the final commit call." + , Element.text "(check Metamask!)" + , Element.text "This will make the deposit and commit you to the trade." ] - (Element.text "Just to Confirm...") - , Element.column - [ Element.spacing 20 - , Element.centerX - , Element.centerY + + CommitMining txHash -> + EH.txProcessModal + [ Element.text "Mining the final commit transaction..." + , Element.newTabLink [ Element.Font.underline, Element.Font.color EH.blue ] + { url = EthHelpers.makeViewTxUrl trade.factory txHash + , label = Element.text "See the transaction" + } ] - (List.map - (Element.paragraph - [ Element.centerX - , Element.Font.size 18 - , Element.Font.medium - , Element.Font.color EH.permanentTextColor - ] - ) - ([ [ Element.text <| "You will deposit " - , Element.el [ Element.Font.color EH.blue ] <| Element.text <| depositAmountString ++ " " ++ Config.tokenUnitName model.web3Context.factoryType - , Element.text ", thereby becoming the " - , buyerOrSellerEl - , Element.text " of this trade. By doing so, you are agreeing to " - ] - ++ agreeToWhatTextList - ] - ++ (case model.web3Context.factoryType of - Token _ -> - [ [ Element.text <| "(This ususally requires two Metamask signatures. Your " ++ Config.tokenUnitName model.web3Context.factoryType ++ " will not be deposited until the second transaction has been mined.)" ] ] - _ -> + ConfirmingAction action -> + EH.closeableModal [] + (Element.column + [ Element.spacing 20 + , Element.padding 20 + , Element.centerX + , Element.height Element.fill + , Element.Font.center + ] + [ Element.el + [ Element.Font.size 26 + , Element.Font.semiBold + , Element.centerX + , Element.centerY + ] + (Element.text "Just to Confirm...") + , Element.column + [ Element.spacing 20 + , Element.centerX + , Element.centerY + ] + (List.map + (Element.paragraph + [ Element.centerX + , Element.Font.size 18 + , Element.Font.medium + , Element.Font.color EH.permanentTextColor + ] + ) + (case action of + Poke -> [] - ) - ) - ) - , Element.el - [ Element.alignBottom - , Element.centerX - ] - (EH.redButton "Yes, I definitely want to commit to this trade." (ConfirmCommit trade userInfo deposit)) - ] - ) - AbortAction - Just ApproveNeedsSig -> - EH.txProcessModal - [ Element.text "Waiting for user signature for the approve call." - , Element.text "(check Metamask!)" - , Element.text "Note that there will be a second transaction to sign after this." - ] + Recall -> + [] - Just (ApproveMining txHash) -> - EH.txProcessModal - [ Element.text "Mining the initial approve transaction..." - , Element.newTabLink [ Element.Font.underline, Element.Font.color EH.blue ] - { url = EthHelpers.makeViewTxUrl model.web3Context.factoryType txHash - , label = Element.text "See the transaction on Etherscan" - } - , Element.text "Funds will not leave your wallet until you sign the next transaction." - ] + Claim -> + [ [ Element.text <| "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 " ++ tokenUnitName trade.factory ++ " rather than release it to you." ] ] - Just CommitNeedsSig -> - EH.txProcessModal - [ Element.text "Waiting for user signature for the final commit call." - , Element.text "(check Metamask!)" - , Element.text "This will make the deposit and commit you to the trade." - ] + Abort -> + [ [ Element.text <| "Aborting will incur a small penalty on both parties, and refund the rest of the " ++ tokenUnitName trade.factory ++ "." ] ] - Just (CommitMining txHash) -> - EH.txProcessModal - [ Element.text "Mining the final commit transaction..." - , Element.newTabLink [ Element.Font.underline, Element.Font.color EH.blue ] - { url = EthHelpers.makeViewTxUrl model.web3Context.factoryType txHash - , label = Element.text "See the transaction" - } - ] + Release -> + [ [ Element.text "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." ] ] - Just (ConfirmingAction action) -> - EH.closeableModal [] - (Element.column - [ Element.spacing 20 - , Element.padding 20 - , Element.centerX - , Element.height Element.fill - , Element.Font.center - ] - [ Element.el - [ Element.Font.size 26 - , Element.Font.semiBold - , Element.centerX - , Element.centerY - ] - (Element.text "Just to Confirm...") - , Element.column - [ Element.spacing 20 - , Element.centerX - , Element.centerY - ] - (List.map - (Element.paragraph - [ Element.centerX - , Element.Font.size 18 - , Element.Font.medium - , Element.Font.color EH.permanentTextColor + Burn -> + [ [ Element.text <| "This will destroy the " ++ tokenUnitName trade.factory ++ " in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment." ] ] + ) + ) + , Element.el + [ Element.alignBottom + , Element.centerX ] - ) - (case action of - Poke -> - [] + ((case action of + Poke -> + "Poke" - Recall -> - [] + Recall -> + "Recall" - Claim -> - [ [ Element.text <| "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 " ++ Config.tokenUnitName model.web3Context.factoryType ++ " rather than release it to you." ] ] + Claim -> + "I understand. Confirm Payment" - Abort -> - [ [ Element.text <| "Aborting will incur a small penalty on both parties, and refund the rest of the " ++ Config.tokenUnitName model.web3Context.factoryType ++ "." ] ] + Abort -> + "I understand. Abort the trade." - Release -> - [ [ Element.text "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." ] ] + Release -> + "I understand. Release the " ++ tokenUnitName trade.factory ++ "." - Burn -> - [ [ Element.text <| "This will destroy the " ++ Config.tokenUnitName model.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." ] ] - ) + Burn -> + "I understand. Burn the " ++ tokenUnitName trade.factory ++ "." + ) + |> (\s -> EH.redButton s (StartContractAction action)) + ) + ] ) - , Element.el - [ Element.alignBottom - , Element.centerX - ] - ((case action of - Poke -> - "Poke" - - Recall -> - "Recall" - - Claim -> - "I understand. Confirm Payment" + AbortAction - Abort -> - "I understand. Abort the trade." - - Release -> - "I understand. Release the " ++ Config.tokenUnitName model.web3Context.factoryType ++ "." + ActionNeedsSig action -> + EH.txProcessModal + [ Element.text <| "Waiting for user signature for the " ++ actionName action ++ " call." + , Element.text "(check Metamask!)" + ] - Burn -> - "I understand. Burn the " ++ Config.tokenUnitName model.web3Context.factoryType ++ "." - ) - |> (\s -> EH.redButton s (StartContractAction action)) - ) - ] - ) - AbortAction + ActionMining action txHash -> + Element.none - Just (ActionNeedsSig action) -> - EH.txProcessModal - [ Element.text <| "Waiting for user signature for the " ++ actionName action ++ " call." - , Element.text "(check Metamask!)" - ] + ( Nothing, _ ) -> + Element.none - Just (ActionMining action txHash) -> + ( _, _ ) -> Element.none diff --git a/src/TradeCache/State.elm b/src/TradeCache/State.elm index 2f993de..079627a 100644 --- a/src/TradeCache/State.elm +++ b/src/TradeCache/State.elm @@ -3,6 +3,7 @@ module TradeCache.State exposing (init, initAndStartCaching, loadedValidTrades, import AppCmd exposing (AppCmd) import Array exposing (Array) import BigInt exposing (BigInt) +import CommonTypes exposing (..) import Contracts.Types as CTypes import Contracts.Wrappers import Dict exposing (Dict) @@ -10,41 +11,42 @@ import Eth.Sentry.Event as EventSentry import Helpers.BigInt as BigIntHelpers import Helpers.Eth as EthHelpers import List.Extra +import Maybe.Extra import PaymentMethods exposing (PaymentMethod) import Time import TradeCache.Types exposing (..) import UserNotice as UN exposing (UserNotice) -init : EthHelpers.Web3Context -> ( TradeCache, Cmd Msg, List (AppCmd Msg) ) -init web3Context = +init : FactoryType -> ( TradeCache, Cmd Msg, List (AppCmd Msg) ) +init factoryType = let ( sentry, sentryCmd ) = EventSentry.init EventSentryMsg - web3Context.httpProvider + (EthHelpers.httpProviderForFactory factoryType) in - ( { web3Context = web3Context + ( { factory = factoryType , eventSentry = sentry , trades = Array.empty - , dataFetchStatus = - Status Nothing 0 0 + , dataFetchState = + DataState Nothing 0 0 } , sentryCmd - , [ AppCmd.gTag "tradeCache init" "processing" (EthHelpers.factoryTypeToString web3Context.factoryType) 0 ] + , [ AppCmd.gTag "tradeCache init" "processing" (factoryName factoryType) 0 ] ) startCaching : TradeCache -> Cmd Msg startCaching tradeCache = - Contracts.Wrappers.getNumTradesCmd tradeCache.web3Context InitialNumTradesFetched + Contracts.Wrappers.getNumTradesCmd tradeCache.factory InitialNumTradesFetched -initAndStartCaching : EthHelpers.Web3Context -> ( TradeCache, Cmd Msg, List (AppCmd Msg) ) -initAndStartCaching web3Context = +initAndStartCaching : FactoryType -> ( TradeCache, Cmd Msg, List (AppCmd Msg) ) +initAndStartCaching factoryType = let ( tc, cmd1, appCmds ) = - init web3Context + init factoryType in ( tc , Cmd.batch @@ -55,6 +57,23 @@ initAndStartCaching web3Context = ) +updateStates : List Int -> TradeCache -> Cmd Msg +updateStates tradeIds tradeCache = + tradeIds + |> List.map + (\id -> + Array.get id tradeCache.trades + |> Maybe.andThen CTypes.tradeAddress + |> Maybe.map (\address -> ( id, address )) + ) + |> Maybe.Extra.values + |> List.map + (\( id, address ) -> + Contracts.Wrappers.getStateCmd tradeCache.factory address (StateFetched id) + ) + |> Cmd.batch + + update : Msg -> TradeCache -> UpdateResult update msg prevModel = case msg of @@ -70,19 +89,19 @@ update msg prevModel = (List.range 0 (numTrades - 1) |> List.map (\id -> - Contracts.Wrappers.getCreationInfoFromIdCmd prevModel.web3Context (BigInt.fromInt id) (CreationInfoFetched id) + Contracts.Wrappers.getCreationInfoFromIdCmd prevModel.factory (BigInt.fromInt id) (CreationInfoFetched id) ) ) trades = List.range 0 (numTrades - 1) - |> List.map CTypes.partialTradeInfo + |> List.map (CTypes.partialTradeInfo prevModel.factory) |> Array.fromList in UpdateResult { prevModel | trades = trades - , dataFetchStatus = Status (Just numTrades) 0 0 + , dataFetchState = DataState (Just numTrades) 0 0 } fetchCreationInfoCmd [] @@ -98,11 +117,11 @@ update msg prevModel = CheckForNewTrades -> UpdateResult prevModel - (Contracts.Wrappers.getNumTradesCmd prevModel.web3Context NumTradesFetchedAgain) + (Contracts.Wrappers.getNumTradesCmd prevModel.factory NumTradesFetchedAgain) [] NumTradesFetchedAgain fetchResult -> - case ( fetchResult, prevModel.dataFetchStatus.total ) of + case ( fetchResult, prevModel.dataFetchState.total ) of ( Ok bigInt, Just oldNumTrades ) -> let newNumTrades = @@ -115,22 +134,22 @@ update msg prevModel = (List.range oldNumTrades (newNumTrades - 1) |> List.map (\id -> - Contracts.Wrappers.getCreationInfoFromIdCmd prevModel.web3Context (BigInt.fromInt id) (CreationInfoFetched id) + Contracts.Wrappers.getCreationInfoFromIdCmd prevModel.factory (BigInt.fromInt id) (CreationInfoFetched id) ) ) additionalTrades = List.range oldNumTrades (newNumTrades - 1) - |> List.map CTypes.partialTradeInfo + |> List.map (CTypes.partialTradeInfo prevModel.factory) |> Array.fromList - oldStatus = - prevModel.dataFetchStatus + oldState = + prevModel.dataFetchState in UpdateResult { prevModel | trades = Array.append prevModel.trades additionalTrades - , dataFetchStatus = { oldStatus | total = Just newNumTrades } + , dataFetchState = { oldState | total = Just newNumTrades } } fetchCreationInfoCmd [] @@ -172,7 +191,7 @@ update msg prevModel = cmd = Cmd.batch - [ Contracts.Wrappers.getParametersStateAndPhaseInfoCmd prevModel.web3Context creationInfo.address (ParametersFetched id) (StateFetched id) (PhaseStartInfoFetched id) + [ Contracts.Wrappers.getParametersStateAndPhaseInfoCmd prevModel.factory creationInfo.address (ParametersFetched id) (StateFetched id) (PhaseStartInfoFetched id) , sentryCmd ] in @@ -280,12 +299,12 @@ update msg prevModel = updateStatus : TradeCache -> TradeCache updateStatus tradeCache = let - oldStatus = - tradeCache.dataFetchStatus + oldState = + tradeCache.dataFetchState in { tradeCache - | dataFetchStatus = - { oldStatus + | dataFetchState = + { oldState | loaded = List.length <| loadedTrades tradeCache diff --git a/src/TradeCache/Types.elm b/src/TradeCache/Types.elm index 7539ffd..886866a 100644 --- a/src/TradeCache/Types.elm +++ b/src/TradeCache/Types.elm @@ -1,14 +1,15 @@ -module TradeCache.Types exposing (Msg(..), Status, TradeCache, UpdateResult, justModelUpdate) +module TradeCache.Types exposing (DataState, LoadingStatus(..), Msg(..), TradeCache, UpdateResult, justModelUpdate, loadingStatus) import AppCmd exposing (AppCmd) import Array exposing (Array) import BigInt exposing (BigInt) +import CommonTypes exposing (..) import Contracts.Generated.DAIHardFactory as DHF import Contracts.Generated.DAIHardTrade as DHT import Contracts.Types as CTypes import Eth.Sentry.Event as EventSentry exposing (EventSentry) import Eth.Types exposing (Address) -import Helpers.Eth as EthHelpers exposing (Web3Context) +import Helpers.Eth as EthHelpers import Http import Json.Decode import Time @@ -16,20 +17,27 @@ import TokenValue exposing (TokenValue) type alias TradeCache = - { web3Context : Web3Context + { factory : FactoryType , eventSentry : EventSentry Msg , trades : Array CTypes.Trade - , dataFetchStatus : Status + , dataFetchState : DataState } -type alias Status = +type alias DataState = { total : Maybe Int , loaded : Int , invalid : Int } +type LoadingStatus + = QueryingNumTrades + | NoneFound + | FetchingTrades + | AllFetched + + type Msg = InitialNumTradesFetched (Result Http.Error BigInt) | CheckForNewTrades @@ -49,6 +57,23 @@ type alias UpdateResult = } +loadingStatus : TradeCache -> LoadingStatus +loadingStatus tc = + case tc.dataFetchState.total of + Nothing -> + QueryingNumTrades + + Just 0 -> + NoneFound + + Just totalTrades -> + if tc.dataFetchState.loaded < (totalTrades - tc.dataFetchState.invalid) then + FetchingTrades + + else + AllFetched + + justModelUpdate : TradeCache -> UpdateResult justModelUpdate tc = UpdateResult diff --git a/src/TradeTable/State.elm b/src/TradeTable/State.elm new file mode 100644 index 0000000..6f10792 --- /dev/null +++ b/src/TradeTable/State.elm @@ -0,0 +1,40 @@ +module TradeTable.State exposing (init, update) + +import AppCmd exposing (AppCmd) +import ChainCmd exposing (ChainCmd) +import Routing +import TradeTable.Types exposing (..) + + +init : ( ColType, Ordering ) -> Model +init = + Model + + +update : Msg -> Model -> UpdateResult +update msg prevModel = + case msg of + TradeClicked factory id -> + UpdateResult + prevModel + Cmd.none + ChainCmd.none + [ AppCmd.GotoRoute <| Routing.Trade factory id ] + + ChangeSort newOrderCol -> + let + newOrderBy = + if Tuple.first prevModel.orderBy == newOrderCol then + prevModel.orderBy + |> Tuple.mapSecond flipOrdering + + else + ( newOrderCol, Ascending ) + in + justModelUpdate + { prevModel + | orderBy = newOrderBy + } + + NoOp -> + justModelUpdate prevModel diff --git a/src/TradeTable/Types.elm b/src/TradeTable/Types.elm new file mode 100644 index 0000000..7e9e8be --- /dev/null +++ b/src/TradeTable/Types.elm @@ -0,0 +1,59 @@ +module TradeTable.Types exposing (ColType(..), Model, Msg(..), Ordering(..), UpdateResult, flipOrdering, justModelUpdate) + +import AppCmd exposing (AppCmd) +import ChainCmd exposing (ChainCmd) +import CommonTypes exposing (..) +import Contracts.Types as CTypes + + +type alias Model = + { orderBy : ( ColType, Ordering ) + } + + +type Msg + = TradeClicked FactoryType Int + | ChangeSort ColType + | NoOp + + +type alias UpdateResult = + { model : Model + , cmd : Cmd Msg + , chainCmd : ChainCmd Msg + , appCmds : List (AppCmd Msg) + } + + +type ColType + = Phase + | Expires + | Offer + | FiatPrice + | Margin + | PaymentWindow + | BurnWindow + + +type Ordering + = Ascending + | Descending + + +flipOrdering : Ordering -> Ordering +flipOrdering ordering = + case ordering of + Ascending -> + Descending + + Descending -> + Ascending + + +justModelUpdate : Model -> UpdateResult +justModelUpdate model = + UpdateResult + model + Cmd.none + ChainCmd.none + [] diff --git a/src/TradeTable/View.elm b/src/TradeTable/View.elm new file mode 100644 index 0000000..e8a065a --- /dev/null +++ b/src/TradeTable/View.elm @@ -0,0 +1,357 @@ +module TradeTable.View exposing (view) + +import CommonTypes exposing (..) +import Contracts.Types as CTypes +import Element exposing (Element) +import Element.Background +import Element.Border +import Element.Events +import Element.Font +import FiatValue exposing (FiatValue) +import Flip exposing (flip) +import Helpers.Element as EH +import Helpers.Time as TimeHelpers +import Images exposing (Image) +import PaymentMethods exposing (PaymentMethod) +import Time +import TokenValue exposing (TokenValue) +import TradeTable.Types exposing (..) + + +view : Time.Posix -> Model -> List ColType -> List CTypes.FullTradeInfo -> Element Msg +view time model colTypes trades = + Element.column + [ Element.width Element.fill + , Element.height Element.fill + , Element.padding 30 + , Element.spacing 5 + ] + [ viewColHeaders model.orderBy colTypes + , viewTradeRows time model colTypes trades + ] + + +viewColHeaders : ( ColType, Ordering ) -> List ColType -> Element Msg +viewColHeaders orderBy colTypes = + Element.row [ Element.width Element.fill ] + (colTypes + |> List.map + (\colType -> + let + maybeOrdering = + if Tuple.first orderBy == colType then + Just <| Tuple.second orderBy + + else + Nothing + in + viewColHeader maybeOrdering colType + ) + ) + + +viewColHeader : Maybe Ordering -> ColType -> Element Msg +viewColHeader maybeOrdering colType = + cellMaker (colTypePortion colType) (sortableColumnHeader colType maybeOrdering) + + +colTypePortion : ColType -> Int +colTypePortion colType = + case colType of + Phase -> + 1 + + Expires -> + 2 + + Offer -> + 1 + + FiatPrice -> + 2 + + Margin -> + 1 + + PaymentWindow -> + 2 + + BurnWindow -> + 2 + + +sortableColumnHeader : ColType -> Maybe Ordering -> Element Msg +sortableColumnHeader colType maybeOrdering = + Element.row + [ Element.spacing 5 + , Element.pointer + , Element.Events.onClick (ChangeSort colType) + ] + [ colTitleEl colType + , case maybeOrdering of + Just ordering -> + Element.el + [ Element.centerY ] + (Images.toElement + [ Element.width <| Element.px 8 ] + (case ordering of + Ascending -> + Images.upArrow + + Descending -> + Images.downArrow + ) + ) + + Nothing -> + Element.none + ] + + +colTitleEl : ColType -> Element Msg +colTitleEl colType = + Element.el [ Element.Font.medium, Element.Font.size 17 ] <| + Element.text <| + case colType of + Phase -> + "Phase" + + Expires -> + "Expiring" + + Offer -> + "Offer" + + FiatPrice -> + "For Fiat" + + Margin -> + "Margin" + + PaymentWindow -> + "Payment Window" + + BurnWindow -> + "Burn Window" + + +viewTradeRows : Time.Posix -> Model -> List ColType -> List CTypes.FullTradeInfo -> Element Msg +viewTradeRows time model colTypes trades = + Element.column + [ Element.width Element.fill + , Element.Border.width 2 + , Element.Border.rounded 8 + , Element.Border.color EH.darkGray + , Element.spacing 2 + , Element.Background.color EH.darkGray + , Element.clip + ] + (trades + |> List.sortWith (sortByFunc model.orderBy) + |> List.map (viewTradeRow time colTypes) + ) + + +viewTradeRow : Time.Posix -> List ColType -> CTypes.FullTradeInfo -> Element Msg +viewTradeRow time colTypes trade = + Element.column + [ Element.width Element.fill + , Element.spacing 1 + , Element.Background.color EH.lightGray + , Element.width <| Element.fillPortion 7 + ] + [ Element.row + [ Element.width <| Element.fillPortion 6 + , Element.spacing 1 + ] + (colTypes + |> List.map + (\colType -> + viewTradeCell time colType trade + ) + ) + , cellMaker 1 <| viewPaymentMethods trade.terms.paymentMethods + ] + + +viewPaymentMethods : List PaymentMethod -> Element Msg +viewPaymentMethods paymentMethods = + paymentMethods + |> List.head + |> Maybe.map PaymentMethods.previewTextHack + |> Maybe.withDefault Element.none + + +viewTradeCell : Time.Posix -> ColType -> CTypes.FullTradeInfo -> Element Msg +viewTradeCell time colType trade = + cellMaker + (colTypePortion colType) + (case colType of + Phase -> + Element.text <| + CTypes.phaseToString trade.state.phase + + Expires -> + case trade.state.phase of + CTypes.Open -> + case CTypes.getCurrentPhaseTimeoutInfo time trade of + CTypes.TimeLeft timeoutInfo -> + let + baseIntervalColor = + if TimeHelpers.getRatio (Tuple.first timeoutInfo) (Tuple.second timeoutInfo) < 0.05 then + EH.red + + else + EH.black + in + EH.intervalWithElapsedBar + [ Element.width Element.fill ] + [ Element.Font.size 16 ] + ( baseIntervalColor, EH.lightGray ) + timeoutInfo + + CTypes.TimeUp totalInterval -> + EH.intervalWithElapsedBar + [ Element.width Element.fill ] + [ Element.Font.size 16 ] + ( EH.red, EH.lightGray ) + ( Time.millisToPosix 0, totalInterval ) + + _ -> + Element.none + + Offer -> + Element.row + [ Element.spacing 5 ] + [ Element.text <| + ((case trade.parameters.initiatorRole of + Buyer -> + "Buying " + + Seller -> + "Selling " + ) + ++ TokenValue.toConciseString trade.parameters.tradeAmount + ++ " " + ++ tokenUnitName trade.factory + ) + ] + + FiatPrice -> + EH.fiatValue trade.terms.price + + Margin -> + let + upIsGreen = + trade.parameters.initiatorRole == Buyer + in + trade.derived.margin + |> Maybe.map (EH.coloredMargin upIsGreen) + |> Maybe.withDefault Element.none + + PaymentWindow -> + let + lowValColor = + case trade.parameters.initiatorRole of + Seller -> + EH.red + + Buyer -> + EH.green + + baseColor = + if Time.posixToMillis trade.parameters.autoabortInterval < (1000 * 60 * 60 * 6) then + lowValColor + + else + EH.black + in + EH.interval + [] + [] + ( baseColor, EH.lightGray ) + trade.parameters.autoabortInterval + + BurnWindow -> + let + lowValColor = + case trade.parameters.initiatorRole of + Seller -> + EH.green + + Buyer -> + EH.red + + baseColor = + if Time.posixToMillis trade.parameters.autoabortInterval < (1000 * 60 * 60 * 6) then + lowValColor + + else + EH.black + in + EH.interval + [] + [] + ( baseColor, EH.lightGray ) + trade.parameters.autoreleaseInterval + ) + + +cellMaker : Int -> Element Msg -> Element Msg +cellMaker portion cellElement = + Element.el + [ Element.width <| Element.fillPortion portion + , Element.height <| Element.px 60 + , Element.clip + , Element.Background.color EH.white + ] + <| + Element.el + [ Element.padding 12 + , Element.centerY + , Element.width Element.fill + ] + cellElement + + +sortByFunc : ( ColType, Ordering ) -> (CTypes.FullTradeInfo -> CTypes.FullTradeInfo -> Order) +sortByFunc ( sortCol, ordering ) = + (case sortCol of + Phase -> + \a b -> + if a.state.phase == b.state.phase then + sortByFunc ( Expires, Descending ) a b + + else + compare (CTypes.phaseToInt a.state.phase) (CTypes.phaseToInt b.state.phase) + + Expires -> + \a b -> TimeHelpers.compare a.derived.phaseEndTime b.derived.phaseEndTime + + Offer -> + \a b -> TokenValue.compare a.parameters.tradeAmount b.parameters.tradeAmount + + FiatPrice -> + \a b -> FiatValue.compare a.terms.price b.terms.price + + Margin -> + \a b -> + Maybe.map2 + (\marginA marginB -> compare marginA marginB) + a.derived.margin + b.derived.margin + |> Maybe.withDefault EQ + + PaymentWindow -> + \a b -> TimeHelpers.compare a.parameters.autoabortInterval b.parameters.autoabortInterval + + BurnWindow -> + \a b -> + TimeHelpers.compare a.parameters.autoreleaseInterval b.parameters.autoreleaseInterval + ) + |> (if ordering == Ascending then + flip + + else + identity + ) diff --git a/src/Types.elm b/src/Types.elm index dca687b..1d61232 100644 --- a/src/Types.elm +++ b/src/Types.elm @@ -1,4 +1,6 @@ -module Types exposing (Flags, InitialWeb3State(..), Model, Msg(..), Submodel(..)) +module Types exposing (Flags, Model, Msg(..), Submodel(..)) + +-- import QuickCreate.Types import AgentHistory.Types import AppCmd @@ -8,19 +10,20 @@ import Browser import Browser.Navigation import CommonTypes exposing (..) import Create.Types +import Eth.Net import Eth.Sentry.Tx as TxSentry exposing (TxSentry) import Eth.Sentry.Wallet as WalletSentry exposing (WalletSentry) import Eth.Types exposing (Address) -import Helpers.Eth as EthHelpers exposing (Web3Context) +import Helpers.Eth as EthHelpers import Json.Decode import Marketplace.Types -import QuickCreate.Types import Routing import Time import Trade.Types import TradeCache.Types as TradeCache exposing (TradeCache) import Url exposing (Url) import UserNotice as UN exposing (UserNotice) +import Wallet type alias Flags = @@ -32,29 +35,21 @@ type alias Flags = type alias Model = { key : Browser.Navigation.Key - , initialWeb3State : InitialWeb3State + , userAddress : Maybe Address -- `wallet` will store this but only after commPubkey has been generated + , wallet : Wallet.State , time : Time.Posix - , web3Context : Web3Context - , txSentry : TxSentry Msg - , userAddress : Maybe Address - , userInfo : Maybe UserInfo - , tradeCache : TradeCache + , txSentry : Maybe (TxSentry Msg) + , tradeCaches : List TradeCache , submodel : Submodel , userNotices : List (UserNotice Msg) , screenWidth : Int } -type InitialWeb3State - = AllGood - | WrongNetwork - | NoWeb3 - - type Submodel = BetaLandingPage | CreateModel Create.Types.Model - | QuickCreateModel QuickCreate.Types.Model + -- | QuickCreateModel QuickCreate.Types.Model | TradeModel Trade.Types.Model | MarketplaceModel Marketplace.Types.Model | AgentHistoryModel AgentHistory.Types.Model @@ -68,12 +63,11 @@ type Msg | AppCmd (AppCmd.AppCmd Msg) | ConnectToWeb3 | WalletStatus WalletSentry - | NetworkUpdate Json.Decode.Value | TxSentryMsg TxSentry.Msg | UserPubkeySet Json.Decode.Value | CreateMsg Create.Types.Msg - | QuickCreateMsg QuickCreate.Types.Msg - | TradeCacheMsg TradeCache.Msg + -- | QuickCreateMsg QuickCreate.Types.Msg + | TradeCacheMsg Int TradeCache.Msg | TradeMsg Trade.Types.Msg | MarketplaceMsg Marketplace.Types.Msg | AgentHistoryMsg AgentHistory.Types.Msg diff --git a/src/View.elm b/src/View.elm index b512c2f..4c964d1 100644 --- a/src/View.elm +++ b/src/View.elm @@ -1,5 +1,7 @@ module View exposing (root) +-- import QuickCreate.View + import AgentHistory.View import Browser import CommonTypes exposing (..) @@ -19,11 +21,11 @@ import Helpers.Tuple exposing (mapTuple2) import Landing.View import Marketplace.Types import Marketplace.View -import QuickCreate.View import Routing import Trade.View import Types exposing (..) import UserNotice as UN exposing (UserNotice) +import Wallet root : Model -> Browser.Document Msg @@ -91,48 +93,30 @@ headerContent model = , Element.paddingXY 30 17 ] [ headerLink - "Create a New Offer" - (GotoRoute Routing.Create) - (case model.submodel of - CreateModel _ -> - Active - - _ -> - Normal - ) - , headerLink - "Sell Offers" - (GotoRoute <| Routing.Marketplace Buyer) + "Browse Offers" + (GotoRoute Routing.Marketplace) (case model.submodel of MarketplaceModel marketplaceModel -> - if marketplaceModel.browsingRole == Buyer then - Active - - else - Normal + Active _ -> Normal ) , headerLink - "Buy Offers" - (GotoRoute <| Routing.Marketplace Seller) + "Create a New Offer" + (GotoRoute Routing.Create) (case model.submodel of - MarketplaceModel marketplaceModel -> - if marketplaceModel.browsingRole == Seller then - Active - - else - Normal + CreateModel _ -> + Active _ -> Normal ) - , case model.userInfo of + , case Wallet.userInfo model.wallet of Just userInfo -> headerLink "My Trades" - (GotoRoute <| Routing.AgentHistory userInfo.address Seller) + (GotoRoute <| Routing.AgentHistory userInfo.address) (case model.submodel of AgentHistoryModel agentHistoryModel -> if agentHistoryModel.agentAddress == userInfo.address then @@ -156,42 +140,10 @@ headerContent model = , Element.paddingXY 8 0 ] [ logoElement - , networkModeElement model ] ] -networkModeElement : Model -> Element Msg -networkModeElement model = - Element.el - [ Element.Font.size 18 - , Element.Font.color <| Element.rgb 0.8 0.8 1 - , Element.Font.semiBold - , Element.Font.italic - , Element.centerX - ] - (Element.text (networkModeText model)) - - -networkModeText : Model -> String -networkModeText model = - case model.web3Context.factoryType of - Native Eth -> - "Mainnet ETH" - - Native Kovan -> - "Testnet ETH" - - Native XDai -> - "xDai" - - Token EthDai -> - "Mainnet Dai" - - Token KovanDai -> - "Testnet Dai" - - type HeaderLinkStyle = Normal | Active @@ -387,25 +339,23 @@ submodelElementAndModal screenWidth model = , [] ) - QuickCreateModel quickCreateModel -> - QuickCreate.View.root quickCreateModel - |> Tuple.mapBoth - (Element.map QuickCreateMsg) - (List.map (Element.map QuickCreateMsg)) - + -- QuickCreateModel quickCreateModel -> + -- QuickCreate.View.root quickCreateModel + -- (Element.map QuickCreateMsg) + -- (List.map (Element.map QuickCreateMsg)) TradeModel tradeModel -> - Trade.View.root screenWidth model.time model.tradeCache tradeModel + Trade.View.root screenWidth model.time model.tradeCaches tradeModel |> Tuple.mapBoth (Element.map TradeMsg) (List.map (Element.map TradeMsg)) MarketplaceModel marketplaceModel -> - ( Element.map MarketplaceMsg (Marketplace.View.root model.time model.tradeCache marketplaceModel) + ( Element.map MarketplaceMsg (Marketplace.View.root model.time model.tradeCaches marketplaceModel) , [] ) AgentHistoryModel agentHistoryModel -> - ( Element.map AgentHistoryMsg (AgentHistory.View.root model.time model.tradeCache agentHistoryModel) + ( Element.map AgentHistoryMsg (AgentHistory.View.root model.time model.tradeCaches agentHistoryModel) , [] ) in diff --git a/src/Wallet.elm b/src/Wallet.elm new file mode 100644 index 0000000..f13ce59 --- /dev/null +++ b/src/Wallet.elm @@ -0,0 +1,98 @@ +module Wallet exposing (State(..), defaultFactory, factory, factoryForNetwork, factoryWithDefault, httpProvider, httpProviderWithDefault, network, networkForFactory, userInfo) + +import CommonTypes exposing (..) +import Eth.Net +import Eth.Types exposing (Address, HttpProvider, TxHash, WebsocketProvider) +import Helpers.Eth as EthHelpers + + +type State + = NoneDetected + | OnlyNetwork Eth.Net.NetworkId + | Active UserInfo + + +userInfo : State -> Maybe UserInfo +userInfo walletState = + case walletState of + Active uInfo -> + Just uInfo + + _ -> + Nothing + + +factory : State -> Maybe FactoryType +factory walletState = + network walletState + |> Maybe.andThen factoryForNetwork + + +factoryWithDefault : State -> FactoryType +factoryWithDefault walletState = + factory walletState + |> Maybe.withDefault defaultFactory + + +httpProvider : State -> Maybe HttpProvider +httpProvider walletState = + factory walletState + |> Maybe.map EthHelpers.httpProviderForFactory + + +httpProviderWithDefault : State -> HttpProvider +httpProviderWithDefault = + factoryWithDefault >> EthHelpers.httpProviderForFactory + + +network : State -> Maybe Eth.Net.NetworkId +network walletState = + case walletState of + NoneDetected -> + Nothing + + OnlyNetwork network_ -> + Just network_ + + Active uInfo -> + Just uInfo.network + + +factoryForNetwork : Eth.Net.NetworkId -> Maybe FactoryType +factoryForNetwork networkId = + case networkId of + Eth.Net.Mainnet -> + Just <| Token EthDai + + Eth.Net.Kovan -> + Just <| Token KovanDai + + Eth.Net.Private 100 -> + Just <| Native XDai + + _ -> + Nothing + + +networkForFactory : FactoryType -> Eth.Net.NetworkId +networkForFactory factory_ = + case factory_ of + Token EthDai -> + Eth.Net.Mainnet + + Native Eth -> + Eth.Net.Mainnet + + Token KovanDai -> + Eth.Net.Kovan + + Native Kovan -> + Eth.Net.Kovan + + Native XDai -> + Eth.Net.Private 100 + + +defaultFactory : FactoryType +defaultFactory = + Token EthDai From 690de8fa63a0b3767fc14b4d9d21c0ee6be4cf5d Mon Sep 17 00:00:00 2001 From: oglog Date: Sat, 10 Aug 2019 09:19:13 +0200 Subject: [PATCH 02/19] Wrapping up TC overhaul. Click on trade row goes to Trade screen --- docs/404.html | 2 +- docs/index.html | 2 +- docs/static/js/main-6db0b05de0e6b3762895.js | 7 ++++ docs/static/js/main-8b815b70735337f0c99f.js | 7 ---- src/Create/View.elm | 44 ++++++++++----------- src/TradeTable/View.elm | 3 +- 6 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 docs/static/js/main-6db0b05de0e6b3762895.js delete mode 100644 docs/static/js/main-8b815b70735337f0c99f.js diff --git a/docs/404.html b/docs/404.html index 28cf5bd..7dd114d 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 28cf5bd..7dd114d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-6db0b05de0e6b3762895.js b/docs/static/js/main-6db0b05de0e6b3762895.js new file mode 100644 index 0000000..15f14f7 --- /dev/null +++ b/docs/static/js/main-6db0b05de0e6b3762895.js @@ -0,0 +1,7 @@ +!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/DAIHard/",t(t.s=43)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t,n,a,i){function o(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(l.isArrayBuffer(e)||l.isArrayBufferView(e))if(void 0!==i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(i=Date.now(),s(e)):(a.push(e),1===a.length&&u.setAttribute("a",o=!o))}}l.nextTick=l.setImmediate}(),l.isNodejs=void 0!==t&&t.versions&&t.versions.node,l.globalScope=function(){return l.isNodejs?a:"undefined"==typeof self?window:self}(),l.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},l.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},l.isArrayBufferView=function(e){return e&&l.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},l.ByteBuffer=u,l.ByteStringBuffer=u;l.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},l.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},l.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},l.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},l.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},l.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},l.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(l.encodeUtf8(e))},l.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},l.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},l.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},l.ByteStringBuffer.prototype.putInt=function(e,t){o(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},l.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},l.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},l.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},l.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},l.ByteStringBuffer.prototype.copy=function(){var e=l.createBuffer(this.data);return e.read=this.read,e},l.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},l.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},l.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},l.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},l.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},l.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},l.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},l.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},l.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},l.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},l.DataBuffer.prototype.putInt=function(e,t){o(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},l.DataBuffer.prototype.putSignedInt=function(e,t){return o(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},l.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},l.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},l.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},l.DataBuffer.prototype.copy=function(){return new l.DataBuffer(this)},l.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},l.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},l.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},l.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},l.xorBytes=function(e,t,r){for(var n="",a="",i="",o=0,u=0;r>0;--r,++o)a=e.charCodeAt(o)^t.charCodeAt(o),u>=10&&(n+=i,i="",u=0),i+=String.fromCharCode(a),++u;return n+=i},l.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";l.encode64=function(e,t){for(var r,n,a,i="",o="",u=0;u>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,a,i="",o=0;o>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==a&&(i+=String.fromCharCode((3&n)<<6|a)));return i},l.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},l.decodeUtf8=function(e){return decodeURIComponent(escape(e))},l.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:f.encode,decode:f.decode}},l.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},l.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var a,i,o,u,s=0,c=r;s>4,64!==o&&(n[c++]=(15&i)<<4|o>>2,64!==u&&(n[c++]=(3&o)<<6|u));return t?c-r:n.subarray(0,c)},l.binary.base58.encode=function(e,t){return l.binary.baseN.encode(e,p,t)},l.binary.base58.decode=function(e,t){return l.binary.baseN.decode(e,p,t)},l.text={utf8:{},utf16:{}},l.text.utf8.encode=function(e,t,r){e=l.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i0?(a=r[n].substring(0,o),i=r[n].substring(o+1)):(a=r[n],i=null),a in t||(t[a]=[]),a in Object.prototype||null===i||t[a].push(unescape(i))}return t};return void 0===e?(null===S&&(S="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=S):t=r(e),t},l.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var a=t.split("/");return a.length>0&&""===a[0]&&a.shift(),{pathString:t,queryString:r,path:a,query:""===r?{}:l.getQueryVariables(r)}},l.makeRequest=function(e){var t=l.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},l.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},l.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,a=t.length;n0&&i.push(r),o=n.lastIndex;var u=t[0][1];switch(u){case"s":case"o":a");break;case"%":i.push("%");break;default:i.push("<%"+u+"?>")}}return i.push(e.substring(o)),i.join("")},l.formatNumber=function(e,t,r,n){var a=e,i=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,u=void 0===n?".":n,s=a<0?"-":"",c=parseInt(a=Math.abs(+a||0).toFixed(i),10)+"",f=c.length>3?c.length%3:0;return s+(f?c.substr(0,f)+u:"")+c.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+u)+(i?o+Math.abs(a-c).toFixed(i).slice(2):"")},l.formatSize=function(e){return e=e>=1073741824?l.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?l.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?l.formatNumber(e/1024,0)+" KiB":l.formatNumber(e,0)+" bytes"},l.bytesFromIP=function(e){return-1!==e.indexOf(".")?l.bytesFromIPv4(e):-1!==e.indexOf(":")?l.bytesFromIPv6(e):null},l.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=l.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(i)}if(r.length>0){var s=r[n];s.end-s.start>0&&(t.splice(s.start,s.end-s.start+1,""),0===s.start&&t.unshift(""),7===s.end&&t.push(""))}return t.join(":")},l.estimateCores=function(e,t){function r(e,o,u){if(0===o){var s=Math.floor(e.reduce(function(e,t){return e+t},0)/e.length);return l.cores=Math.max(1,s),URL.revokeObjectURL(i),t(null,l.cores)}n(u,function(t,n){e.push(a(u,n)),r(e,o-1,u)})}function n(e,t){for(var r=[],n=[],a=0;au.st&&a.sta.st&&u.st0)return l.cores=navigator.hardwareConcurrency,t(null,l.cores);if("undefined"==typeof Worker)return l.cores=1,t(null,l.cores);if("undefined"==typeof Blob)return l.cores=2,t(null,l.cores);var i=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}function a(e,t,r,i){var s;n(e,t,2);var c=e.getByte();t--;var f=192&c,l=31&c;s=e.length();var d=u(e,t);if(t-=s-e.length(),void 0!==d&&d>t){if(i.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=e.length(),h.remaining=t,h.requested=d,h}d=t}var p,g,v=32==(32&c);if(v)if(p=[],void 0===d)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}s=e.length(),p.push(a(e,t,r+1,i)),t-=s-e.length()}else for(;d>0;)s=e.length(),p.push(a(e,d,r+1,i)),t-=s-e.length(),d-=s-e.length();if(void 0===p&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&(g=e.bytes(d)),void 0===p&&i.decodeBitStrings&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&d>1){var y=e.read,m=t,b=0;if(l===o.Type.BITSTRING&&(n(e,t,1),b=e.getByte(),t--),0===b)try{s=e.length();var C={verbose:i.verbose,strict:!0,decodeBitStrings:!0},E=a(e,t,r+1,C),S=s-e.length();t-=S,l==o.Type.BITSTRING&&S++;var T=E.tagClass;S!==d||T!==o.Class.UNIVERSAL&&T!==o.Class.CONTEXT_SPECIFIC||(p=[E])}catch(e){}void 0===p&&(e.read=y,t=m)}if(void 0===p){if(void 0===d){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=t}if(l===o.Type.BMPSTRING)for(p="";d>0;d-=2)n(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(d)}var w=void 0===g?null:{bitStringContents:g};return o.create(f,l,v,p,w)}var i=r(0);r(1),r(6);var o=e.exports=i.asn1=i.asn1||{};o.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},o.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},o.create=function(e,t,r,n,a){if(i.util.isArray(n)){for(var u=[],s=0;s1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?n.putBytes(e.value.substr(1)):n.putBytes(e.value);if(t.putByte(r),n.length()<=127)t.putByte(127&n.length());else{var s=n.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);t.putByte(128|c.length);for(var u=c.length-1;u>=0;--u)t.putByte(c.charCodeAt(u))}return t.putBuffer(n),t},o.oidToDer=function(e){var t=e.split("."),r=i.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var n,a,o,u,s=2;s>>=7,n||(u|=128),a.push(u),n=!1}while(o>0);for(var c=a.length-1;c>=0;--c)r.putByte(a[c])}return r},o.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)r=e.getByte(),n<<=7,128&r?n+=127&r:(t+="."+(n+r),n=0);return t},o.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),u=0;if(e.length>11){var s=e.charAt(10),c=10;"+"!==s&&"-"!==s&&(u=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,0),c&&("+"===(s=e.charAt(c))||"-"===s)){var f=parseInt(e.substr(c+1,2),10),l=parseInt(e.substr(c+4,2),10),d=60*f+l;d*=6e4,"+"===s?t.setTime(+t-d):t.setTime(+t+d)}return t},o.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),u=parseInt(e.substr(12,2),10),s=0,c=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var l=e.length-5,d=e.charAt(l);if("+"===d||"-"===d){c=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10),c*=6e4,"+"===d&&(c*=-1),f=!0}return"."===e.charAt(14)&&(s=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,s),t.setTime(+t+c)):(t.setFullYear(r,n,a),t.setHours(i,o,u,s)),t},o.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},o.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},o.validate=function(e,t,r,n){var a=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(a=!0,t.value&&i.util.isArray(t.value))for(var u=0,s=0;a&&s0&&(n+="\n");for(var a="",u=0;u1?n+="0x"+i.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?n+=" (1 unused bit shown)":d>1&&(n+=" ("+d+" unused bits shown)")}}else e.type===o.Type.OCTETSTRING?(s.test(e.value)||(n+="("+e.value+") "),n+="0x"+i.util.bytesToHex(e.value)):e.type===o.Type.UTF8?n+=i.util.decodeUtf8(e.value):e.type===o.Type.PRINTABLESTRING||e.type===o.Type.IA5String?n+=e.value:s.test(e.value)?n+="0x"+i.util.bytesToHex(e.value):0===e.value.length?n+="[null]":n+=e.value}return n}},function(e,t,r){var n=r(0);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){function n(e,t){var r=function(){return new s.aes.Algorithm(e,t)};s.cipher.registerAlgorithm(e,r)}function a(){p=!0,l=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;c=new Array(256),f=new Array(256),d=new Array(4),h=new Array(4);for(var t=0;t<4;++t)d[t]=new Array(256),h[t]=new Array(256);for(var r,n,a,i,o,u,s,g=0,v=0,t=0;t<256;++t){i=v^v<<1^v<<2^v<<3^v<<4,i=i>>8^255&i^99,c[g]=i,f[i]=g,o=e[i],r=e[g],n=e[r],a=e[n],u=o<<24^i<<16^i<<8^i^o,s=(r^n^a)<<24^(g^a)<<16^(g^n^a)<<8^g^r^a;for(var y=0;y<4;++y)d[y][g]=u,h[y][i]=s,u=u<<24|u>>>8,s=s<<24|s>>>8;0===g?g=v=1:(g=r^e[e[e[r^a]]],v^=e[e[v]])}}function i(e,t){for(var r,n=e.slice(0),a=1,i=n.length,o=i+6+1,u=g*o,s=i;s>>16&255]<<24^c[r>>>8&255]<<16^c[255&r]<<8^c[r>>>24]^l[a]<<24,a++):i>6&&s%i==4&&(r=c[r>>>24]<<24^c[r>>>16&255]<<16^c[r>>>8&255]<<8^c[255&r]),n[s]=n[s-i]^r;if(t){var f,d=h[0],p=h[1],v=h[2],y=h[3],m=n.slice(0);u=n.length;for(var s=0,b=u-g;s>>24]]^p[c[f>>>16&255]]^v[c[f>>>8&255]]^y[c[255&f]];n=m}return n}function o(e,t,r,n){var a,i,o,u,s,l=e.length/4-1;n?(a=h[0],i=h[1],o=h[2],u=h[3],s=f):(a=d[0],i=d[1],o=d[2],u=d[3],s=c);var p,g,v,y,m,b,C;p=t[0]^e[0],g=t[n?3:1]^e[1],v=t[2]^e[2],y=t[n?1:3]^e[3];for(var E=3,S=1;S>>24]^i[g>>>16&255]^o[v>>>8&255]^u[255&y]^e[++E],b=a[g>>>24]^i[v>>>16&255]^o[y>>>8&255]^u[255&p]^e[++E],C=a[v>>>24]^i[y>>>16&255]^o[p>>>8&255]^u[255&g]^e[++E],y=a[y>>>24]^i[p>>>16&255]^o[g>>>8&255]^u[255&v]^e[++E],p=m,g=b,v=C;r[0]=s[p>>>24]<<24^s[g>>>16&255]<<16^s[v>>>8&255]<<8^s[255&y]^e[++E],r[n?3:1]=s[g>>>24]<<24^s[v>>>16&255]<<16^s[y>>>8&255]<<8^s[255&p]^e[++E],r[2]=s[v>>>24]<<24^s[y>>>16&255]<<16^s[p>>>8&255]<<8^s[255&g]^e[++E],r[n?1:3]=s[y>>>24]<<24^s[p>>>16&255]<<16^s[g>>>8&255]<<8^s[255&v]^e[++E]}function u(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="AES-"+r;t=e.decrypt?s.cipher.createDecipher(n,e.key):s.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof s.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var s=r(0);r(15),r(23),r(1),e.exports=s.aes=s.aes||{},s.aes.startEncrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!1,mode:n});return a.start(t),a},s.aes.createEncryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!1,mode:t})},s.aes.startDecrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!0,mode:n});return a.start(t),a},s.aes.createDecryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!0,mode:t})},s.aes.Algorithm=function(e,t){p||a();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return o(r._w,e,t,!1)},decrypt:function(e,t){return o(r._w,e,t,!0)}}}),r._init=!1},s.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(s.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=s.util.createBuffer();for(var n=0;n>>=2;for(var n=0;n65&&-1!==o){var u=t[o];","===u?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+u+t.substr(o+1),i=a-o-1,o=-1,++a}else" "!==t[a]&&"\t"!==t[a]&&","!==t[a]||(o=a);return t}function a(e){return e.replace(/^\s+/,"")}var i=r(0);r(1);var o=e.exports=i.pem=i.pem||{};o.encode=function(e,t){t=t||{};var r,a="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=n(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=n(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=n(r)),e.headers)for(var o=0;ot.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),a=n.util.createBuffer(),c=o.length();for(var s=0;s=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,s=e.h4,f=0;f<16;++f)n=r.getInt32(),t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<20;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<32;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<40;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<60;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i&o|u&(i^o),n=(a<<5|a>>>27)+c+s+2400959708+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<80;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+3395469782+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,e.h4=e.h4+s|0,l-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=o,o.create=function(){s||n();var e=null,t=i.util.createBuffer(),r=new Array(80),o={algorithm:"sha1",blockLength:64,digestLength:20,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};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},o};var u=null,s=!1},function(e,t,r){"use strict";(function(e){function n(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),i.alloc(+e)}function v(e,t){if(i.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(n)return j(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return _(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return $(this,t,r);case"base64":return B(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,a){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:C(e,t,r,n,a);if("number"==typeof t)return t&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):C(e,[t],r,n,a);throw new TypeError("val must be string, number or Buffer")}function C(e,t,r,n,a){function i(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,u=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,u/=2,s/=2,r/=2}var c;if(a){var f=-1;for(c=r;cu&&(r=u-s),c=r;c>=0;c--){for(var l=!0,d=0;da&&(n=a):n=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(a+u<=r){var s,c,f,l;switch(u){case 1:i<128&&(o=i);break;case 2:s=e[a+1],128==(192&s)&&(l=(31&i)<<6|63&s)>127&&(o=l);break;case 3:s=e[a+1],c=e[a+2],128==(192&s)&&128==(192&c)&&(l=(15&i)<<12|(63&s)<<6|63&c)>2047&&(l<55296||l>57343)&&(o=l);break;case 4:s=e[a+1],c=e[a+2],f=e[a+3],128==(192&s)&&128==(192&c)&&128==(192&f)&&(l=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&f)>65535&&l<1114112&&(o=l)}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),a+=u}return N(n)}function N(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var a="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,a,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function D(e,t,r,n){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-r,2);a>>8*(n?a:1-a)}function U(e,t,r,n){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-r,4);a>>8*(n?a:3-a)&255}function O(e,t,r,n,a,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,a){return a||O(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,a){return a||O(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(e,t,r,n,52,8),r+8}function V(e){if(e=K(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function K(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function j(e,t){t=t||1/0;for(var r,n=e.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(e){for(var t=[],r=0;r>8,a=r%256,i.push(a),i.push(n);return i}function z(e){return J.toByteArray(V(e))}function Y(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function W(e){return e!==e}/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r,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 S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(Jh,o,function(e){return si(Qh(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Zh,e,L(r,ip({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Zh,e,L(r,ap({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=Pg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?Tg(o):Sg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return Pg(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(wg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Ag,Ig,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(Io,xa(Us),f(Io,ms,Ds))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(qd,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(qd,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(np)}),i.addEventListener("timeout",function(){a(op)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Qh(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(tp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Ag,Ig,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Ag,Ig,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Ag,Ig,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=function(e){return{orderBy:e}},fo=co,lo={$:"Ascending"},ho={$:"Phase"},po=Oe,go=po(yr),vo=r(function(e,t){return L({agentAddress:t,tradeTable:fo(L(ho,lo)),wallet:e},go)}),yo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),mo={$:"None"},bo=mo,Co=function(e){return d(yo,e,go,bo,yr)},Eo=function(e){return{$:"TradeTableMsg",a:e}},So=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),To=r(function(e,t){return f(So,e,t)}),wo=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Io=n(function(e,t,r){return t(e(r))}),Ao=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),Bo=r(function(e,t){if("None"===t.$)return mo;var r=t.a,n=t.b,a=l(wo,f(Ao,Da(e),r.onSign),f(Ao,Da(e),r.onBroadcast),f(Ao,function(t){var r=t.a,n=t.b;return L(f(Io,r,e),f(Ao,function(t){return{confirmations:t.confirmations,toMsg:f(Io,t.toMsg,e)}},n))},r.onMined));return f(So,a,n)}),ko=function(e){return{$:"AbiDecoder",a:e}},No=r(function(e,t){return{$:"Tape",a:e,b:t}}),Ro=z,$o=Fr,_o=r(function(e,t){return e<1?t:l($o,e,Ro(t),t)}),Lo=_o(64),xo=n(function(e,t,r){return L(f(No,e,Lo(t)),r)}),Po=r(function(e,t){return e<1?"":l($o,0,e,t)}),Do=Po(64),Uo=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),Oo=function(e){return-e},Mo=r(function(e,t){return e<1?"":l($o,-e,Ro(t),t)}),Fo=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(Po,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(Mo,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return ko(function(t){var r=t.a,n=t.b;return f(Uo,f(xo,r,n),e(Do(n)))})}(),Vo=Hr,Ko=function(e){return f(Vo,"0x",e)||f(Vo,"0X",e)?f(_o,2,e):e},Ho=function(e){return e.b},jo=r(function(e,t){var r=e.a;return f(Uo,Ho,r(function(e){return f(No,e,e)}(Ko(t))))}),qo=Xr,Go=ae,zo=Wr,Yo=function(e){return f(qo,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return Go(a)},zo)},Wo=f(Io,jo,Yo),Jo=function(e){return{$:"Magnitude",a:e}},Qo=function(e){return{$:"Pos",a:e}},Xo=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Zo=function(e){return{$:"MagnitudeNotNormalised",a:e}},eu=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 si(n)}return ci}},tu=function(e){var t=eu(e);return"Nothing"!==t.$&&t.a<0},ru=function(e){return{$:"Neg",a:e}},nu={$:"Zer"},au=function(e){return!e.b},iu=r(function(e,t){var r=t.a;if(au(r))return nu;switch(e.$){case"Zero":return nu;case"Positive":return Qo(t);default:return ru(t)}}),ou=r(function(e,t){return f(Xo,e,Zo(t))}),uu=function(e){return f(La,r(function(t,r){return e(t)&&au(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),su=Ir,cu=-1+f(su,10,7),fu=cu+1,lu=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),du=function(e){return e<0?f(lu,Na(-1),du(e+fu)):L(e/fu|0,e%fu)},hu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=du(r+e),i=a.a,o=a.b;return f(ka,o,f(hu,i,n))}{if(!(_(e,fu)>0))return M([e]);var u=M([e]);e=0,t=u}}}),pu=function(e){var t=e.a;return Jo(uu(f(hu,0,t)))},gu=xa(Oo),vu={$:"Negative"},yu={$:"Positive"},mu={$:"Zero"},bu=function(e){switch(e.$){case"Positive":return vu;case"Negative":return yu;default:return mu}},Cu=function(e){for(;;){var t=e.a,r=e.b,n=pu(r),a=n.a;if(!tu(a))return f(iu,t,Jo(a));e=f(ou,bu(t),gu(a))}},Eu=pr,Su=function(e){switch(f(Eu,e,0).$){case"LT":return vu;case"GT":return yu;default:return mu}},Tu=function(e){return e<0?-e:e},wu=function(e){return Cu(f(Xo,Su(e),Zo(M([Tu(e)]))))},Iu=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(su,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},Au=function(e){switch(e.$){case"Zer":return nu;case"Neg":var t=e.a;return Qo(t);default:return e}},Bu=function(e){return{$:"MagnitudePair",a:e}},ku=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(ka,L(a,u),f(ku,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(ku,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(ku,yr,s))}return yr}),Nu=r(function(e,t){var r=e.a,n=t.a;return Bu(f(ku,r,n))}),Ru=function(e){switch(e.$){case"Zer":return f(ou,mu,yr);case"Neg":var t=e.a.a;return f(ou,yu,gu(t));default:var t=e.a.a;return f(ou,yu,t)}},$u=r(function(e,t){var r=Ru(t),n=r.b,a=Ru(e),i=a.b,o=f(Nu,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Cu(f(Xo,yu,Zo(s)))}),_u=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(R(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 Ta}return a.b.b?ba:f(Eu,e,t)}}),Lu=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},xu=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(_u,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Lu(d(_u,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),Pu=r(function(e,t){return R(f(xu,e,t),Ta)}),Du=K,Uu=r(function(e,t){return!f(Pu,e,t)}),Ou=function(e){switch(e.$){case"Zer":return Jo(yr);case"Pos":default:var t=e.a;return t}},Mu=r(function(e,t){var r=e.a;return pu(Zo(f(xa,ti(t),r)))}),Fu=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(Mu,Jo(n),a),u=f(Fu,Jo(i),Jo(n)),s=u.a,c=f($u,f(iu,yu,o),f(iu,yu,Jo(f(ka,0,s))));return Ou(c)}var a=r.a;return f(Mu,Jo(n),a)}return Jo(yr)}),Vu=function(e){switch(e.$){case"Zer":return mu;case"Pos":return yu;default:return vu}},Ku=r(function(e,t){return R(e,mu)||R(t,mu)?mu:R(e,t)?yu:vu}),Hu=r(function(e,t){return f(iu,f(Ku,Vu(e),Vu(t)),f(Fu,Ou(e),Ou(t)))}),ju=function(e){switch(e.$){case"Zer":return nu;case"Pos":var t=e.a;return ru(t);default:var t=e.a;return Qo(t)}},qu=r(function(e,t){return f($u,e,ju(t))}),Gu=wu(0),zu=a(function(e,t,r,n){if(e){var a=wu(e),i=f(Hu,f(Hu,a,n),t),o=f(Uu,i,r)?L(f(Hu,a,t),f(qu,r,i)):L(Gu,r),u=o.a,s=o.b,c=d(zu,e/2|0,t,s,n),l=c.a,h=c.b;return L(f($u,u,l),h)}return L(Gu,r)}),Yu=Fa(f(Va,2,cu)),Wu=n(function(e,t,r){return d(zu,f(su,2,Yu),e,t,r)}),Ju=wu(1),Qu=r(function(e,t){return e}),Xu=n(function(e,t,r){return l(Ra,Qu(e),t,f(Ai,1,r))}),Zu=function(e){return l(Xu,Hu(wu(fu)),Ju,e)},es=n(function(e,t,r){if(e){var n=l(Wu,Zu(e),t,r),a=n.a,i=n.b,o=l(es,e-1,i,r),u=o.a,s=o.b;return L(f($u,a,u),s)}return l(Wu,Zu(e),t,r)}),ts=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},rs=r(function(e,t){if(R(t,Gu))return ci;var r=Ti(ts(e))-Ti(ts(t))+1,n=l(es,f(ei,0,r),Au(e),Au(t)),a=n.a,i=n.b;return si(L(f(iu,f(Ku,Vu(e),Vu(t)),Ou(a)),f(iu,Vu(e),Ou(i))))}),ns=f(Hu,wu(2),wu(2147483648)),as=xr,is=function(e){return f(as,e,"")},os=Pn,us=n(function(e,t,r){return e<=0?r:l(us,e>>1,U(t,t),1&e?U(r,t):r)}),ss=r(function(e,t){return l(us,e,t,"")}),cs=n(function(e,t,r){return U(f(ss,e-Ro(r),is(t)),r)}),fs=te,ls=Ar,ds=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},hs=r(function(e,t){for(;;){if(t<16)return f(ka,ds(t),e);var r=f(ka,ds(f(ls,16,t)),e),n=t/16|0;e=r,t=n}}),ps=function(e){return fs(e<0?f(ka,P("-"),f(hs,yr,-e)):f(hs,yr,e))},gs=function(e){var t=f(rs,e,ns);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=ps(Iu(a));return R(n,wu(0))?i:U(gs(n),l(cs,8,P("0"),i))},vs=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,Jo(yr))?"0":gs(Qo(t));default:var t=e.a;return"-"+vs(f(Hu,wu(-1),e))}},ys=function(e){return l(cs,64,P("0"),e)},ms=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=ys(ps(a)),c=function(e){return U(e,n)}(ys(ps(u)));return x(a+32+(Ro(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},bs=Dr,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))))}),Es=n(function(e,t,n){return l(bs,r(function(t,r){return l(Cs,e,yi(t),r)}),t,n)}),Ss=function(e){return $a(l(Es,ka,yr,e))},Ts=function(e){return f(Ri,"",f(xa,f(Io,ps,f(cs,2,P("0"))),Ss(e)))},ws=function(e){return 64-f(ls,64,e)},Is=function(e){return U(e,f(ss,ws(Ro(e)),"0"))},As=function(e){return L(si(Ro(e)/2|0),Is(e))},Bs=function(e){return L(ci,ys(e))},ks=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Ns=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"}},Rs=Ur,$s=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(as,P("1"),r),!0);case"1":return L(f(as,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(as,P("0"),r),!1);case"1":return L(f(as,P("1"),r),!0);default:break e}return L(r,!0)});return l(Rs,t,L("",!1),e).a},_s=function(e){return l(Rs,ka,yr,e)},Ls=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(_o,e,t),i=f(ka,l($o,0,e,t),r);e=n,t=a,r=i}}),xs=r(function(e,t){return e&&""!==t?l(Ls,e,t,yr):M([t])}),Ps=function(e){var t=function(){var t=_s(vs(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(Io,$s,f(cs,256,P("1"))))}var r=t;return L(r,f(cs,256,P("0")))}(),r=t.a,n=t.b;return fs(f(xa,ks,f(xs,4,n(f(Ri,"",f(xa,Ns,r))))))},Ds=function(e){return{$:"Hex",a:e}},Us=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Bs(t);case"UintE":var r=e.a;return Bs(vs(r));case"IntE":var n=e.a;return Bs(Ps(n));case"BoolE":return Bs(e.a?"1":"0");case"DBytesE":var a=e.a.a;return As(a);case"BytesE":var a=e.a.a;return Bs(Ko(a));case"StringE":var i=e.a;return As(Ts(i));case"ListE":var o=e.a;return function(e){var t=e.a;return As(t)}(Xt()(o));default:var i=e.a;return Bs(Ko(i))}};try{var Os=Xt();Xt=function(){return Os}}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 Ms=Pr,Fs=function(e){return 1===Ro(e)?f(Ms,"0",e):e},Vs=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(ka,n,r);e=i,t=o,r=u}}}),Ks=r(function(e,t){return $a(l(Vs,e,t,yr))}),Hs=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(Ks,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(Hs,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),js=r(function(e,t){return l(Hs,0,e,t)}),qs=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),Gs=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 Pt(e.a)}},zs={$:"LE"},Ys=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,zs));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,zs));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,zs));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,zs));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,zs));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,zs));case"Seq":var i=e.b;return l(Ws,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),Ws=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Ys,n,t,r);e=i,t=o,r=u}}),Js=Dt,Qs=r(function(e,t){return{$:"Seq",a:e,b:t}}),Xs=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+Gs(r),i=n;e=a,t=i}}),Zs=function(e){return f(Qs,f(Xs,0,e),e)},ec=function(e){return{$:"U8",a:e}},tc=ec,rc=r(function(e,t){return _(e,t)<0?e:t}),nc=hr,ac=function(e){return{$:"Bytes",a:e}},ic=ac,oc=function(e){return Js(Zs(f(xa,ic,$a(e))))},uc=Pt,sc=r(function(e,t){var r=e.a;return f(zn,r,t)}),cc=function(e){return{$:"Decoder",a:e}},fc=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}}),lc=r(function(e,t){return cc(f(fc,e,t))}),dc=cc(Yn),hc=r(function(e,t){if("Just"===t.$){return t.a}return e}),pc=function(e){return{$:"Done",a:e}},gc=function(e){return{$:"Loop",a:e}},vc=r(function(e,t){var n=t.a;return cc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),yc=function(e){return cc(r(function(t,r){return L(r,e)}))},mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?yc(pc($a(n))):f(vc,function(e){return gc(L(r-1,f(ka,e,n)))},e)}),bc=function(e){return f(hc,yr,f(sc,f(lc,L(uc(e),yr),mc(dc)),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))}),Ec=r(function(e,t){return l(Cc,os,e,t)}),Sc=f(Ai,0,4),Tc=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}}),wc=xt,Ic=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),Ac=function(e){return f(Ic,f(Io,wc,os(4294967295)),e)},Bc=r(function(e,t){return 5*t+e}),kc=4294967295>>>32-Ha,Nc=ar,Rc=n(function(e,t,r){for(;;){var n=kc&t>>>e,a=f(Nc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Nc,kc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),$c=function(e){return e>>>5<<5},_c=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,$c(r))>-1?f(Nc,kc&e,i):l(Rc,n,e,a))}),Lc=r(function(e,t){var r=f(_c,e,t);if("Just"===r.$){return r.a}return L(0,0)}),xc=n(function(e,t,r){var n=f(Bc,e,t);return f(Lc,n,r)}),Pc=ir,Dc=a(function(e,t,r,n){var a=kc&t>>>e,i=f(Nc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Dc,e-Ha,t,r,o);return l(Pc,a,za(u),n)}var s=i.a,c=l(Pc,kc&t,r,s);return l(Pc,a,Ga(c),n)}),Uc=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,$c(n))>-1?d(Ma,n,a,i,l(Pc,kc&e,t,o)):d(Ma,n,a,d(Dc,a,e,t,i),o)}),Oc=n(function(e,t,r){return l(Uc,e,t,r)}),Mc=a(function(e,t,r,n){var a=f(Bc,e,t);return l(Oc,a,r,n)}),Fc=Dn,Vc=r(function(e,t){return l(Cc,Fc,e,t)}),Kc=function(e){var t=l(La,r(function(t,n){var a={d0:l(xc,0,t,e.state),d1:l(xc,1,t,e.state),d2:l(xc,2,t,e.state),d3:l(xc,3,t,e.state),d4:l(xc,4,t,e.state)},i=r(function(e,r){return d(Mc,e,t,f(Vc,f(Tc,e,a),f(Ec,Ac(f(Tc,f(ls,5,e+1),a)),f(Tc,f(ls,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Sc);return D(e,{state:t})},Hc=L(0,0),jc=function(e){return{current:Hc,lfsrstate:1,state:e,x:1,y:0}},qc=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},Gc=L(1,0),zc=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),Yc=r(function(e,t){if(e){var n=f(zc,1,t);return l(Cc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),Wc=r(function(e,t){var r=f(ls,32,e/32|0),n=f(zc,r,t),a=f(ls,32,e);return f(Yc,a,n)}),Jc=n(function(e,t,r){var n=f(_c,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(Uc,e,t(a),r)}),Qc=n(function(e,t,r){return l(Jc,e,Vc(t),r)}),Xc=a(function(e,t,r,n){var a=f(Bc,e,t);return l(Qc,a,r,n)}),Zc=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),sf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(rc,n,r),i=f(xa,function(e){return f(uf,e,g)},f(Ai,0,a)),o=of(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(js,i.outputLen,l(v,g,yr,i.outputLen))},df=function(e){return{$:"KS",a:e}},hf=function(e){var t=e.a;return df({config:t,inputLength:0,partial:yr,state:f(ui,25,Qu(Hc))})},pf=function(e){return cc(Wn(e))},gf=Js(Zs(yr)),vf=r(function(e,t){var n=t.a;return cc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),yf=r(function(e,t){return f(vf,function(e){return pf(t)},pf(e))}),mf=r(function(e,t){return f(hc,gf,f(sc,f(yf,e,uc(t)-e),t))}),bf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=uc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+uc(e)}),0,i),a)>-1))return df(D(n,{inputLength:uc(e)+n.inputLength,partial:i}));var o=oc(i),u=f(hc,gf,f(sc,pf(a),o)),s=bc(u),c=f(ff,s,n.state),d=of(c),h=f(mf,a,o),p=gf,g=df(D(n,{inputLength:uc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Cf=r(function(e,t){return lf(f(bf,Js(Zs(f(xa,tc,t))),hf(e)))}),Ef=Cf(qs),Sf=function(e){return Ds(f(Ri,"",f(xa,f(Io,ps,Fs),f(js,4,Ef(f(xa,yi,_s(e)))))))},Tf=function(e){return f(Vo,"0x",e)||f(Vo,"0X",e)?e:"0x"+e},wf=function(e){var t=e.a;return Tf(t)},If=r(function(e,t){var r=ms(f(xa,Us,t)),n=function(e){return U(e,r)}(Ko(wf(Sf(e))));return Ds(n)}),Af=function(e){return{data:si(f(If,"poke()",yr)),decoder:Wo(Fo),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Bf=r(function(e,t){return{$:"Trade",a:e,b:t}}),kf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Nf={$:"Descending"},Rf=function(e){return"Ascending"===e.$?Nf:lo},$f=function(e){return d(kf,e,go,bo,yr)},_f=r(function(e,t){return L(t.a,e(t.b))}),Lf=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(kf,t,go,bo,M([da(f(Bf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(_f,Rf,t.orderBy):L(a,lo);return $f(D(t,{orderBy:i}));default:return $f(t)}}),xf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},Pf=yn,Df=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=xf(Af(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(To,a,n);return d(yo,t,go,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(yo,t,go,bo,M([da(f(Bf,o,u))]));case"TradeTableMsg":var s=e.a,c=f(Lf,s,t.tradeTable);return d(yo,D(t,{tradeTable:c.model}),f(Pf,Eo,c.cmd),f(Bo,Eo,c.chainCmd),f(xa,Ji(Eo),c.appCmds));default:return Co(t)}}),Uf={$:"BottomRight"},Of={$:"ShouldBeImpossible"},Mf=lr,Ff=function(e){return qi(e)},Vf=r(function(e,t){f(Mf,e,t);return{align:Uf,label:"unexpectedError",mainParagraphs:M([M([Ff(e)])]),noticeType:Of}}),Kf=function(e){var t=e.a;return Tf(t)},Hf=ye,jf=f(Io,Kf,Hf),qf=f(Io,vs,f(Io,Tf,Hf)),Gf=f(Io,wf,Hf),zf=f(Io,ps,f(Io,Tf,Hf)),Yf=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),Wf=un,Jf=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},Qf=function(e){return Jf(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(hc,Wf,r))},f(Yf,function(e){e.a;return!R(e.b,ci)},e)))},Xf=function(e){return Qf(M([L("to",f(Ao,jf,e.to)),L("from",f(Ao,jf,e.from)),L("gas",f(Ao,zf,e.gas)),L("gasPrice",f(Ao,qf,e.gasPrice)),L("value",f(Ao,qf,e.value)),L("data",f(Ao,Gf,e.data)),L("nonce",f(Ao,zf,e.nonce))]))},Zf=function(e){return{$:"TxSentry",a:e}},el=ye,tl=r(function(e,t){return Jf(M([L("ref",el(e)),L("txParams",t)]))}),rl=function(e){return{$:"Signing",a:e}},nl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:rl(e)}}),al={$:"Black"},il=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),ol={$:"RBEmpty_elm_builtin"},ul={$:"Red"},sl=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(il,ul,t,r,h(il,al,c,f,l,d),h(il,al,i,o,u,s))}return h(il,e,i,o,h(il,ul,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(il,ul,c,f,h(il,al,g,v,y,m),h(il,al,t,r,d,a))}return h(il,e,t,r,n,a)}),cl=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(il,ul,e,t,ol,ol);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Eu,e,a).$){case"LT":return h(sl,n,a,i,l(cl,e,t,o),u);case"EQ":return h(il,n,a,t,o,u);default:return h(sl,n,a,i,o,l(cl,e,t,u))}}),fl=n(function(e,t,r){var n=l(cl,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(il,al,a,i,o,u)}return n}),ll=n(function(e,t,r){var n=e.a,a=Xf(r),i=l(fl,n.ref,f(nl,r,t),n.txs);return L(Zf(D(n,{ref:n.ref+1,txs:i})),f(Pf,n.tagger,n.outPort(f(tl,n.ref,a))))}),dl=ll,hl=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,go,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(dl,n,i,o))}return x(ci,go,M([f(Vf,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),pl=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),gl=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),vl={$:"Seller"},yl=function(e){return{$:"Posix",a:e}},ml=yl,bl={autoabortInterval:ml(0),autorecallInterval:ml(0),autoreleaseInterval:ml(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:vl},Cl=function(e){return{$:"TokenValue",a:e}},El=function(e){return e.a},Sl=r(function(e,t){return f(hc,Gu,f(Ao,Qa,f(rs,e,t)))}),Tl=r(function(e,t){return Cl(f(Sl,El(e),wu(t)))}),wl=function(e){return f(Tl,e,12)},Il=function(e){return f(Tl,e,3)},Al=Cl(wu(0)),Bl=r(function(e,t){var r=Al;return{abortPunishment:wl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Il(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),kl=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Nl=qr,Rl=function(e){var t=kl(f(Nl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Ro(e)-1-r;return L(U(f(Po,r,e),f(_o,r+1,e)),n)},$l=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 yr}}),_l=function(e){var t=e.a,r=f($l,Ja(0),t);return Jo(r.b?t:yr)},Ll=Z,xl=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}}}),Pl=n(function(e,t,r){var n=f(xl,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(js,e,r),l(Pl,e,t,n)):yr}),Dl=r(function(e,t){return l(Pl,e,e,t)}),Ul=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Ao,ka(a),r)});return f(La,t,si(yr))}(Ua),Ol=function(e){return f(Ao,f(Da,_l,Jo),Ul(f(xa,f(Io,$a,f(Io,fs,Ll)),f(Dl,7,$a(e)))))},Ml=Q,Fl=function(e){var t=_s(Ml(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Ao,iu(vu),Ol(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Ao,iu(yu),Ol(r))}return ci;default:var r=t;return f(Ao,iu(yu),Ol(r))}},Vl=function(e){var t=function(e){return!f(ls,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(hc,0,kl(r)))}},Kl=function(e){return f(Hu,e,e)},Hl=wu(2),jl=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Ju;case"Neg":return nu;default:if(R(r,Ju))return f(Hu,e,t);if(Vl(r)){var n=e,a=Kl(t),i=f(Sl,r,Hl);e=n,t=a,r=i;continue e}var n=f(Hu,t,e),a=Kl(t),i=f(Sl,f(qu,r,Ju),Hl);e=n,t=a,r=i;continue e}}),ql=r(function(e,t){return l(jl,Ju,e,t)}),Gl=function(e){if(""===e)return ci;var t=Rl(e),r=t.a,n=t.b,a=Fl(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(Hu,o,f(ql,wu(10),wu(i)));return si(u)},zl=function(e){return f(Ao,Cl,Gl(e))},Yl=jr,Wl=function(e){for(;;){if(f(Yl,".",e))return l($o,0,-1,e);{if(!f(Yl,"0",e))return""===e?"0":e;e=l($o,0,-1,e)}}},Jl=f(Da,f(cs,7,P("0")),Ni),Ql=function(e){return f(Ri,"",e)},Xl=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Ql(f(ka,Ni(n),f(xa,Jl,a)))}return"0"},Zl=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Xl(t);default:var t=e.a;return"-"+Xl(t)}},ed=r(function(e,t){return e<1?t:l($o,0,-e,t)}),td=function(e){var t=l(cs,18,P("0"),Zl(e)),r=f(ed,18,t)+"."+f(Mo,18,t);return function(e){return""===e?"0":e}(Wl(r))},rd=r(function(e,t){var r=td(t),n=kl(f(Nl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Po,a+1+e,r):f(Po,a,r)}),nd=r(function(e,t){if("Nothing"===e.$)return td(El(t));var r=e.a;return f(rd,r,El(t))}),ad=ee,id=function(e){var t=ad(f(nd,ci,e));if("Just"===t.$){return t.a}f(Mf,"Error converting tokenValue to float: string -> float failed",e);return 0},od=function(e){if(""===e)return fi("You must specify a trade amount.");var t=zl(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return id(r)<1?fi("Trade amount can't be less than 1."):li(r)},ud=function(e){if(""===e)return fi("You must specify a fiat price.");var t=Fl(e);if("Nothing"===t.$){var r=ad(e);return fi("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 li(n)},sd=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),cd=function(e){return""===e},fd=function(e){return cd(e)?ci:si(e)},ld=function(e){return f(sd,"You must specify a fiat type.",fd(e))},dd=function(e){return""===e?fi("Must specify a payment method."):li(e)},hd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),pd=g(hd,ci,ci,ci,ci,ci,ci,ci),gd=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},vd=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),yd={$:"Custom"},md=r(function(e,t){return{info:t,type_:e}}),bd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Cd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),Ed=function(e){return e.a},Sd=function(e){return p(bd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(md,yd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Cd,function(e){return D(pd,{daiAmount:si(e)})},od(e.daiAmount)),f(Cd,function(e){return D(pd,{fiatAmount:si(e)})},ud(e.fiatAmount)),f(Cd,function(e){return D(pd,{fiatType:si(e)})},ld(e.fiatType)),f(Cd,function(e){return D(pd,{paymentMethod:si(e)})},dd(e.paymentMethod)),gd(d(vd,function(e){return Ed(e)>0?li(e):fi(D(pd,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return Ed(e)>0?li(e):fi(D(pd,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return Ed(e)>0?li(e):fi(D(pd,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Td=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},wd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Id=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Ad=function(e){var t=Sd(e.inputs),r=function(){return R(e.errors,pd)?pd:"Ok"===t.$?pd:t.a}();return D(e,{createParameters:l(wd,Bl,Td(e.wallet),Id(t)),errors:r})},Bd=r(function(e,t){return Ad(D(t,{inputs:e}))}),kd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Nd=function(e){return d(kd,f(Bd,bl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:pd,inputs:bl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),go,bo,yr)},Rd=a(function(e,t,r,n){return la(d(pl,e,t,r,n))}),$d=function(e){return{$:"Address",a:e}},_d=f(Io,Ko,f(Io,Ml,$d)),Ld=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return _d("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return _d("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return _d("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return _d("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return _d("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},xd=function(e){return _d("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},Pd=function(e){return{$:"AddressE",a:e}},Dd=Pd,Ud=function(e){return{$:"UintE",a:e}},Od=Ud,Md=n(function(e,t,r){return{data:si(f(If,"approve(address,uint256)",M([Dd(t),Od(r)]))),decoder:Wo(Fo),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Fd=function(e){return f(Tl,e,200)},Vd=r(function(e,t){return Cl(f($u,El(e),El(t)))}),Kd=function(e){var t=f(Tl,e.tradeAmount,200);return f(Vd,e.pokeReward,f(Vd,Fd(e.tradeAmount),f(Vd,t,function(){return"Buyer"===e.initiatorRole.$?Il(e.tradeAmount):e.tradeAmount}())))},Hd=Mi(ya),jd=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),qd=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),Gd=Xn,zd=Qn,Yd=function(e){return f(zd,{caseInsensitive:!1,multiline:!1},e)},Wd=Jn,Jd=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Qd=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}}),Xd=r(function(e,t){return!f(Qd,f(Da,Du,e),t)}),Zd=Xd(Ua),eh=q,th=r(function(e,t){if("Ok"===t.$){return t.a}return e}),rh=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),nh=f(La,rh(ka),li(yr)),ah=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},ih=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(su,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(su,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(su,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(su,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(su,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(su,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(su,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(su,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(su,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(su,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(su,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(su,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(su,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(su,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(su,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(is(s)+" is not a valid hexadecimal character.")}}}),oh=function(e){if(cd(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(Vo,"-",e)){var t=f(hc,yr,ah(_s(e)));return f(Uo,Oo,l(ih,Ti(t)-1,t,0))}return l(ih,Ro(e)-1,_s(e),0)}();return f(Cd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},uh=function(e){var t=_s(e);return function(e){return L(t,e)}(f(th,yr,nh(f(xa,oh,f(_i,"",f(Ri,"",f(xa,f(Io,ps,Fs),f(js,20,Ef(f(xa,f(Io,eh,yi),t))))))))))},sh=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=uh(Ko(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!Jd(e)&&Zd(o)},ch=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9a-f]{40}$"))),fh=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9A-F]{40}$"))),lh=function(e){return'"'+e+'"'},dh=function(e){var t=Ko(e),r=f(Po,24,t),n=f(Mo,40,e);return 64===Ro(t)&&f(ki,Ja(P("0")),r)?fh(n)||ch(n)?li($d(n)):sh(n)?li($d(n)):fi("Given address "+lh(e)+" failed the EIP-55 checksum test."):40!==Ro(t)?fi("Given address "+lh(e)+" is not the correct length."):Jd(t)?fh(t)||ch(t)?li($d(t)):sh(t)?li($d(t)):fi("Given address "+lh(e)+" failed the EIP-55 checksum test."):fi("Given address "+lh(e)+" contains invalid hex characters.")},hh=ko(function(e){var t=e.a,r=e.b;return f(Uo,f(xo,t,r),dh(Do(r)))}),ph=r(function(e,t){var r=t.a;return ko(function(t){var n=t.a,a=t.b;return r(f(No,n,f(_o,64*e,a)))})}),gh=Jr,vh=r(function(e,t){return f(gh,"data",Wo(f(ph,e,t)))}),yh=Qr,mh=r(function(e,t){return f(gh,"topics",f(yh,e,Wo(t)))}),bh=function(e){return f(Ao,f(Io,$a,f(Ra,r(function(e,t){return f($u,wu(e),f(Hu,t,ns))}),Gu)),Ul(f(xa,f(Io,$a,f(Io,fs,f(Io,oh,Id))),f(Dl,8,$a(e)))))},Ch=function(e){var t=_s(Ml(e));e:for(;;){if(!t.b)return ci;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(Ao,Hu(wu(-1)),bh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Ao,Hu(wu(-1)),bh(a))}return ci;case"+":if(t.b.b){var a=t.b;return bh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return bh(a)}t.b;return ci}break e;default:break e}}var a=t;return bh(a)},Eh=ko(function(e){var t=e.a,r=e.b;return f(Uo,f(xo,t,r),f(sd,"Error Decoding Uint into BigInt",Ch(Tf(Do(r)))))}),Sh=f(Hd,f(mh,1,hh),f(Hd,f(vh,1,hh),f(Hd,f(vh,0,Eh),Fi(jd)))),Th=nn,wh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Ih=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(Th,e,Jf(M([L("data",Hf(t.data)),L("topics",f(wh,Gf,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Ah=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Bh=r(function(e,t){return f(Uo,function(e){return e.id},f(Ah,function(e){return f(Cd,Di,f(Ih,Sh,e).returnData)},f(sd,"No log found from that factoryAddress in that txReceipt",kl(f(Yf,function(t){return R(f(Io,Kf,Ml)(t.address),f(Io,Kf,Ml)(Ld(e)))},t.logs)))))}),kh=n(function(e,t,r){return{data:si(f(If,"allowance(address,address)",M([Dd(t),Dd(r)]))),decoder:Wo(Eh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Nh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Rh=function(e){switch(e.$){case"BlockNum":var t=e.a;return Hf(Tf(ps(t)));case"EarliestBlock":return Hf("earliest");case"LatestBlock":return Hf("latest");default:return Hf("pending")}},$h=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return Qf(M([L("to",f(Ao,jf,t)),L("from",f(Ao,jf,r)),L("gas",f(Ao,zf,n)),L("gasPrice",f(Ao,qf,a)),L("value",f(Ao,qf,i)),L("data",f(Ao,Gf,o))]))},_h=function(e){return{$:"BadBody",a:e}},Lh=function(e){return{$:"BadStatus",a:e}},xh=function(e){return{$:"BadUrl",a:e}},Ph={$:"NetworkError"},Dh={$:"Timeout"},Uh=rn,Oh=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(xh(r));case"Timeout_":return fi(Dh);case"NetworkError_":return fi(Ph);case"BadStatus_":var n=t.a,a=t.b;return fi(Lh(n.statusCode));default:var n=t.a,a=t.b,i=f(Uh,f(gh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(_h(Di(u)))}}),Mh=n(function(e,t,r){return Jf(M([L("id",el(e)),L("jsonrpc",Hf("2.0")),L("method",Hf(t)),L("params",f(wh,Ua,r))]))}),Fh=ol,Vh=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Eu,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),Kh=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},Hh=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(il,ul,p,g,h(il,al,r,n,h(il,ul,i,o,u,s),v),h(il,al,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(il,al,r,n,h(il,ul,i,o,u,s),h(il,ul,f,l,d,m))}return e},jh=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(il,ul,i,o,h(il,al,s,c,f,l),h(il,al,r,n,d,h(il,ul,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(il,al,r,n,h(il,ul,i,o,C,d),h(il,ul,g,v,y,m))}return e},qh=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(il,r,u,s,c,h(il,ul,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 jh(t)}break e}o.a,o.d;return jh(t)}break e}return t}),Gh=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(il,t,r,n,Gh(a),u)}var s=Hh(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(sl,c,f,l,Gh(d),p)}return ol}return h(il,t,r,n,Gh(a),u)}return ol},zh=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return ol;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(il,r,n,a,f(zh,e,i),o)}var s=Hh(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(sl,c,l,d,f(zh,e,p),v)}return ol}return h(il,r,n,a,f(zh,e,i),o)}return f(Yh,e,g(qh,e,t,r,n,a,i,o))}),Yh=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(R(e,n)){var u=Kh(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(sl,r,s,c,i,Gh(o))}return ol}return h(sl,r,n,a,i,f(zh,e,o))}return ol}),Wh=r(function(e,t){var r=f(zh,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(il,al,n,a,i,o)}return r}),Jh=n(function(e,t,r){var n=t(f(Vh,e,r));if("Just"===n.$){var a=n.a;return l(fl,e,a,r)}return f(Wh,e,r)}),Qh=function(e){return"Just"===e.$},Xh=gn,Zh=vn,ep=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),tp=function(e){return{$:"BadUrl_",a:e}},rp=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),np={$:"NetworkError_"},ap=function(e){return{$:"Receiving",a:e}},ip=function(e){return{$:"Sending",a:e}},op={$:"Timeout_"},up=function(e){return f(ta,"application/json",f(xi,0,e))},sp=n(function(e,t,r){return up(l(Mh,e,t,r))}),cp=f(ea,"",Ua),fp=Te,lp=Se,dp=function(e){if("Ok"===e.$){var t=e.a;return lp(t)}var r=e.a;return fp(r)},hp=function(e){return l(Zn,gr,dp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},pp=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return hp({body:l(sp,1,r,n),headers:yr,method:"POST",resolver:cp(Oh(a)),timeout:ci,url:t})},gp=n(function(e,t,r){return pp({decoder:t.decoder,method:"eth_call",params:M([$h(t),Rh(r)]),url:e})}),vp={$:"LatestBlock"},yp=r(function(e,t){return l(gp,e,t,vp)}),mp=function(e){return{$:"Perform",a:e}},bp=sn,Cp=lp(gr),Ep=r(function(e,t){return f(bp,function(t){return lp(e(t))},t)}),Sp=n(function(e,t,r){return f(bp,function(t){return f(bp,function(r){return lp(f(e,t,r))},r)},t)}),Tp=function(e){return l(La,Sp(ka),lp(yr),e)},wp=r(function(e,t){var r=t.a;return Be(f(bp,Xh(e),r))}),Ip=n(function(e,t,r){return f(Ep,function(e){return gr},Tp(f(xa,wp(e),t)))}),Ap=n(function(e,t,r){return lp(gr)}),Bp=r(function(e,t){var r=t.a;return mp(f(Ep,e,r))});pn.Task=Pe(Cp,Ip,Ap,Bp);var kp=Ue("Task"),Np=cn,Rp=r(function(e,t){return kp(mp(f(Np,f(Da,f(Da,lp,e),fi),f(bp,f(Da,f(Da,lp,e),li),t))))}),$p=a(function(e,t,r,n){return f(Rp,n,f(yp,Nh(eo(e)),l(kh,xd(e),t,r)))}),_p=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return _d("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return _d("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return _d("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return _d("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return _d("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Lp=function(e){return{$:"BoolE",a:e}},xp=Lp,Pp=function(e){return{$:"StringE",a:e}},Dp=Pp,Up=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:si(f(If,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([Dd(t),Dd(r),xp(n),Od(a),Od(i),Od(o),Od(u),Od(s),Od(c),Od(l),Od(d),Dp(h),Dp(p)]))),decoder:Wo(hh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},Op=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:si(f(If,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([Dd(t),Dd(r),xp(n),Od(a),Od(i),Od(o),Od(u),Od(s),Od(c),Od(l),Od(d),Dp(h),Dp(p)]))),decoder:Wo(hh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},Mp=r(function(e,t){return{paymentMethods:t,price:e}}),Fp=function(e){return Hf(Zl(e))},Vp=function(e){return f(wh,Ua,M([Hf(e.fiatType),Fp(e.amount)]))},Kp=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},Hp=function(e){return Jf(M([L("type",Hf(Kp(e.type_))),L("info",Hf(e.info))]))},jp=function(e){var t=Vp(e.price),r=f(wh,Hp,e.paymentMethods);return f(xi,0,Jf(M([L("paymentmethods",r),L("price",t)])))},qp=r(function(e,t){return D(t,{value:si(e)})}),Gp=function(e){return wu(Ed(e))},zp=function(e){return f(Sl,Gp(e),wu(1e3))},Yp=r(function(e,t){var r=function(){return"Token"===e.$?Up:Op}();return function(){return"Native"===e.$?qp(El(Kd(t))):Ua}()(r(Ld(e))(t.initiatorAddress)(_p(e))(R(t.initiatorRole,vl))(El(t.tradeAmount))(El(Il(t.tradeAmount)))(El(wl(t.tradeAmount)))(El(t.pokeReward))(zp(t.autorecallInterval))(zp(t.autoabortInterval))(zp(t.autoreleaseInterval))(El(Fd(t.tradeAmount)))(jp(f(Mp,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Wp=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),Jp=function(e){return{$:"CreateNeedsSig",a:e}},Qp=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Xp=r(function(e,t){var r=xf(f(Yp,e,t)),n={onBroadcast:ci,onMined:si(L(Wp(e),ci)),onSign:si(Qp(e))};return L(si(Jp(e)),f(To,n,r))}),Zp=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),eg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),tg=function(e){return{$:"ApproveNeedsSig",a:e}},rg=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),ng=r(function(e,t){return{$:"Confirm",a:e,b:t}}),ag=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),ig={$:"NoOp"},og=function(e){return{appCmds:yr,chainCmd:bo,cmd:go,model:e}},ug=function(e){return Ll(Zl(e))},sg={$:"Error"},cg=r(function(e,t){f(Mf,e+" fetch error",t);return{align:Uf,label:"web3FetchError",mainParagraphs:M([M([Ff('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:sg}}),fg=r(function(e,t){return{align:Uf,label:"web3MiningError",mainParagraphs:M([M([Ff('Error mining "'+e+'" transaction: '+t)])]),noticeType:sg}}),lg={$:"Caution"},dg=r(function(e,t){return{align:Uf,label:"web3SigError",mainParagraphs:M([M([Ff('Error signing "'+e+'" transaction: '+t)])]),noticeType:lg}}),hg={$:"KovanDai"},pg=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(hg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},gg=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},vg=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),yg=function(e){return f(vg,pg,gg(e))},mg=r(function(e,t){return 1-e(1-t)}),bg=function(e){return f(su,e,5)},Cg=mg(bg),Eg={easing:Cg,offset:12,speed:200},Sg=function(e){return{$:"External",a:e}},Tg=function(e){return{$:"Internal",a:e}},wg=function(e){return{$:"NotFound",a:e}},Ig=function(e){for(;;){e=e.a}},Ag=r(function(e,t){return kp(mp(f(Ep,e,t)))}),Bg={$:"Http"},kg={$:"Https"},Ng=Kr,Rg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),$g=i(function(e,t,r,n,a){if(cd(a)||f(Ng,"@",a))return ci;var i=f(Nl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=Ll(f(_o,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Rg,e,f(Po,o,a),s,t,r,n))}return si(p(Rg,e,a,ci,t,r,n))}),_g=a(function(e,t,r,n){if(cd(n))return ci;var a=f(Nl,"/",n);if(a.b){var i=a.a;return h($g,e,f(_o,i,n),t,r,f(Po,i,n))}return h($g,e,"/",t,r,n)}),Lg=n(function(e,t,r){if(cd(r))return ci;var n=f(Nl,"?",r);if(n.b){var a=n.a;return d(_g,e,si(f(_o,a+1,r)),t,f(Po,a,r))}return d(_g,e,ci,t,r)}),xg=r(function(e,t){if(cd(t))return ci;var r=f(Nl,"#",t);if(r.b){var n=r.a;return l(Lg,e,si(f(_o,n+1,t)),f(Po,n,t))}return l(Lg,e,ci,t)}),Pg=function(e){return f(Vo,"http://",e)?f(xg,Bg,f(_o,7,e)):f(Vo,"https://",e)?f(xg,kg,f(_o,8,e)):ci},Dg=Wt,Ug=Gt(zt),Og=sa,Mg=r(function(e,t){return L(e,t)}),Fg=_r,Vg=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=Tu(r-n),o=f(ei,1,Fg(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),Kg=r(function(e,t){var n=r(function(t,r){return Tp(f(xa,Og(0),d(Vg,e.speed,e.easing,t,r-e.offset)))});return f(bp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(Sp,Mg,Ug,Dg(t)))}),Hg=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Td(t.wallet),yg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d($p,a,n.address,Ld(eo(a)),Zp(a));return d(kd,t,i,bo,yr)}return og(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(kd,D(t,{inputs:D(u,{userRole:o})}),go,bo,M([function(){return"Buyer"===o.$?d(Rd,"create offer type changed","input","sell dai",0):d(Rd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return og(f(Bd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return og(f(Bd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return og(f(Bd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return og(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return og(f(Bd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return og(f(Bd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return og(f(Bd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return og(f(Bd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(kd,(g?Bd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),go,bo,g?M([d(Rd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=Sd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Bl,n,m);return og(D(t,{depositAmount:si(El(Kd(b))),txChainStatus:si(f(ng,v,b))}))}var C=y.a;return d(kd,D(t,{errors:C}),f(Rp,Qu(ig),function(){return f(Kg,D(Eg,{offset:60}),"inputError")}()),bo,yr);case"AbortCreate":return d(kd,D(t,{txChainStatus:ci}),go,bo,M([d(Rd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Xp,v,b);var e=v.a,r=function(){var t=xf(l(Md,xd(e),Ld(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(rg,e,b))};return f(To,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(xu,a,E),ba)?L(si(tg(e)),r):f(Xp,v,b)}return L(si(tg(e)),r)}(),T=S.a,w=S.b;return d(kd,D(t,{txChainStatus:T}),go,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return og(D(t,{txChainStatus:si(l(eg,a,b,A))}))}var B=I.a;return d(kd,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(xu,N,P),ba))return og($);var U=f(Xp,eo(a),b),T=U.a,w=U.b;return d(kd,D($,{txChainStatus:T}),go,w,yr)}return og($)}var O=k.a;return d(kd,t,go,bo,M([pa(f(cg,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return og(D(t,{txChainStatus:si(f(ag,v,A))}))}var B=I.a;return d(kd,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(kd,t,go,bo,M([pa(f(fg,"create",B))]))}var F=e.a,V=e.b.a,K=f(vg,ug,Id(f(Bh,F,V)));if("Just"===K.$){var H=K.a;return d(kd,t,go,bo,M([da(f(Bf,F,H))]))}return d(kd,t,go,bo,M([pa(f(Vf,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(kd,t,go,bo,M([ga]));case"NoOp":return og(t);default:var j=e.a;return d(kd,t,go,bo,M([j]))}}),jg={$:"Open"},qg=r(function(e,t){return f(Eu,Ed(e),Ed(t))}),Gg=r(function(e,t){return R(t.state.phase,jg)&&R(f(qg,t.derived.phaseEndTime,e),Ta)}),zg={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Yg=r(function(e,t){return{maxDai:t,minDai:e}}),Wg=f(Yg,ci,ci),Jg={$:"Expires"},Qg=function(e){return L({errors:Wg,filterFunc:Gg,inputs:zg,showCurrencyDropdown:!1,tradeTable:fo(L(Jg,lo)),wallet:e},go)},Xg=r(function(e,t){return D(t,{paymentMethod:e})}),Zg=r(function(e,t){return D(t,{paymentMethodTerms:e})}),ev=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return D(e,{inputs:f(Zg,r,f(Xg,"",e.inputs))})},tv=r(function(e,t){var r=f(Yf,nc(e),t.inputs.paymentMethodTerms);return D(t,{inputs:f(Zg,r,t.inputs)})}),rv=function(e){return D(e,{filterFunc:Gg,inputs:zg})},nv=function(e){return{$:"TradeTableMsg",a:e}},av=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),iv=function(e){return d(av,e,go,bo,yr)},ov=r(function(e,t){return D(t,{fiatType:e})}),uv=r(function(e,t){return D(t,{maxDai:e})}),sv=r(function(e,t){return D(t,{minDai:e})}),cv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return iv(D(t,{inputs:f(sv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return iv(D(t,{inputs:f(uv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return iv(D(t,{inputs:f(ov,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return iv(D(t,{inputs:(n?ov(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return iv(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return iv(D(t,{inputs:f(Xg,r,t.inputs)}));case"AddSearchTerm":return iv(ev(t));case"RemoveTerm":var a=e.a;return iv(f(tv,a,t));case"ResetSearch":return iv(rv(t));case"TradeTableMsg":var i=e.a,o=f(Lf,i,t.tradeTable);return d(av,D(t,{tradeTable:o.model}),f(Pf,nv,o.cmd),f(Bo,nv,o.chainCmd),f(xa,Ji(nv),o.appCmds));case"NoOp":return iv(t);default:var u=e.a;return d(av,t,go,bo,M([u]))}}),fv=a(function(e,t,r,n){return e(Jf(M([L("title",Hf(t)),L("body",function(){if("Nothing"===r.$)return Wf;var e=r.a;return Hf(e)}()),L("image",function(){if("Nothing"===n.$)return Wf;var e=n.a;return Hf(e)}())])))}),lv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},dv=function(e){return e.a+"="+e.b},hv=function(e){return e.b?"?"+f(Ri,"&",f(xa,dv,e)):""},pv=r(function(e,t){return"/"+(f(Ri,"/",e)+hv(t))}),gv=function(e){switch(e.$){case"Home":return f(pv,M(["DAIHard"]),yr);case"Create":return f(pv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(pv,M(["DAIHard","trade",lv(t),Ni(r)]),yr);case"Marketplace":return f(pv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(pv,M(["DAIHard","history",Kf(n)]),yr);default:return f(pv,yr,yr)}},vv={$:"NotFound"},yv=function(e){return{$:"AgentHistory",a:e}},mv={$:"Create"},bv={$:"Home"},Cv={$:"Marketplace"},Ev=function(e){return{$:"Parser",a:e}},Sv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Tv=r(function(e,t){return Ev(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Sv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),wv=f(Tv,"ADDRESS",f(Io,dh,Id)),Iv={$:"Eth"},Av={$:"Kovan"},Bv=f(Tv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Iv));case"keth":return si(Zi(Av));case"dai":return si(eo(Xi));case"kdai":return si(eo(hg));case"xdai":return si(Zi(to));default:return ci}}),kv=f(Tv,"NUMBER",Ll),Nv=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Sv,r,n,a,i,e(o))}),Rv=r(function(e,t){var r=t.a;return Ev(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,Nv(u),r(h(Sv,n,a,i,o,e)))})}),$v=function(e){return l(La,oo,yr,e)},_v=r(function(e,t){return $v(f(xa,e,t))}),Lv=function(e){return Ev(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 R(u,e)?M([h(Sv,f(ka,u,r),s,a,i,o)]):yr}return yr})},xv=r(function(e,t){var r=e.a,n=t.a;return Ev(function(e){return f(_v,n,r(e))})}),Pv=Ev(function(e){return M([e])}),Dv=f(xv,Lv("DAIHard"),function(e){return Ev(function(t){return f(_v,function(e){return(0,e.a)(t)},e)})}(M([f(Rv,bv,Pv),f(Rv,mv,Lv("create")),f(Rv,Bf,f(xv,Lv("trade"),f(xv,Bv,kv))),f(Rv,Cv,Lv("marketplace")),f(Rv,yv,f(xv,Lv("history"),wv)),f(Rv,function(e){return yv(e)},f(xv,Lv("history"),wv))]))),Uv=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 si(t.value)}return si(t.value)}return ci}},Ov=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,Ov(r))}return yr}return yr},Mv=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return Ov(r)}var r=t;return Ov(r)},Fv=Qt,Vv=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),Kv=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=Fv(n);if("Nothing"===o.$)return t;var u=o.a,s=Fv(i);if("Nothing"===s.$)return t;var c=s.a;return l(Jh,u,Vv(c),t)}return t}),Hv=function(e){if("Nothing"===e.$)return Fh;var t=e.a;return l(La,Kv,Fh,f(_i,"&",t))},jv=r(function(e,t){var r=e.a;return Uv(r(h(Sv,yr,Mv(t.path),Hv(t.query),t.fragment,Ua)))}),qv=function(e){return f(hc,vv,f(jv,Dv,e))},Gv=aa,zv=r(function(e,t){return f(Gv,e,gv(t))}),Yv=je("connectToWeb3",function(e){return Wf}),Wv=function(e){return Jf(M([L("event",Hf(e.event)),L("category",Hf(e.category)),L("label",Hf(e.label)),L("value",el(e.value))]))},Jv=r(function(e,t){return Jf(M([L("address",Hf(Kf(e))),L("signSeedMsg",Hf(t))]))}),Qv=je("gTagOut",Ua),Xv=je("genPrivkey",Ua),Zv=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),ey=n(function(e,t,r){return f(vg,_c(t),f(Ao,function(e){return e.trades},f(Zv,function(t){return R(t.factory,e)},r)))}),ty=je("notifyPort",Ua),ry=je("requestNotifyPermissionPort",function(e){return Wf}),ny=r(function(e,t){return D(t,{wallet:e})}),ay=r(function(e,t){return L(f(Bd,t.inputs,D(t,{wallet:e})),function(){var t=L(Td(e),yg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d($p,n,r.address,Ld(eo(n)),Zp(n))}return go}())}),iy=r(function(e,t){return D(t,{wallet:e})}),oy=function(e){return{$:"AllowanceFetched",a:e}},uy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Td(e),yg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(yg(e),si(i.factory))?d($p,a,n.address,i.creationInfo.address,oy):go}return go}())}),sy=function(e){return{$:"AgentHistoryModel",a:e}},cy=function(e){return{$:"CreateModel",a:e}},fy=function(e){return{$:"CreateMsg",a:e}},ly=function(e){return{$:"MarketplaceModel",a:e}},dy=function(e){return{$:"TradeModel",a:e}},hy=function(e){return{$:"TradeMsg",a:e}},py=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,go);case"CreateModel":var r=t.a,n=f(ay,e,r),a=n.a,i=n.b;return L(cy(a),f(Pf,fy,i));case"TradeModel":var o=t.a,u=f(uy,e,o),s=u.a,c=u.b;return L(dy(s),f(Pf,hy,c));case"MarketplaceModel":var l=t.a;return L(ly(f(iy,e,l)),go);default:var d=t.a;return L(sy(f(ny,e,d)),go)}}),gy=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),vy=function(e){return{$:"PartiallyLoadedTrade",a:e}},yy=r(function(e,t){return vy(g(gy,e,t,ci,ci,ci,ci,ci))}),my=function(e){return{$:"CurrentBlockFetched",a:e}},by=Yo(f(Io,Ko,oh)),Cy=function(e){return pp({decoder:by,method:"eth_blockNumber",params:yr,url:e})},Ey=function(e){return f(Rp,my,Cy(e))},Sy=r(function(e,t){return{address_:e,blocknum:t}}),Ty=function(e){return ko(function(t){return li(L(t,e))})},wy=n(function(e,t,r){var n=t.a,a=r.a;return ko(function(t){return f(Ah,function(t){var r=t.a,n=t.b;return f(Uo,_f(e(n)),a(r))},n(t))})}),Iy=r(function(e,t){return l(wy,r(function(e,t){return e(t)}),t,e)}),Ay=Wo(f(Iy,Eh,f(Iy,hh,Ty(Sy)))),By=r(function(e,t){return{data:si(f(If,"createdTrades(uint256)",M([Od(t)]))),decoder:Ay,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ky=n(function(e,t,r){return f(Rp,r,f(yp,Nh(e),f(By,Ld(e),t)))}),Ny=function(e){return{$:"CreationInfoFetched",a:e}},Ry=r(function(e,t){return l(ky,e,wu(t),Ny)}),$y=function(e){return{$:"EventSentryMsg",a:e}},_y=function(e){return{$:"BlockNumber",a:e}},Ly=function(e){return{$:"EventSentry",a:e}},xy=function(e){return{$:"Set_elm_builtin",a:e}},Py=xy(Fh),Dy=r(function(e,t){return L(Ly({blockNumber:ci,errors:yr,nodePath:t,pending:Py,ref:1,requests:Fh,tagger:e,watching:Py}),f(Rp,f(Io,_y,e),Cy(t)))}),Uy=function(e){return f(Dy,$y,Nh(e))},Oy=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),My=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},Fy=My(f(Oy,ci,ci)),Vy=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:jg,secureCommInfo:Fy,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),Ky=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Hy=n(function(e,t,r){var n=f(Ry,t,r),a=Uy(t),i=a.a,o=a.b;return d(Ky,l(Vy,f(yy,t,r),i,e),po(M([n,o,Ey(Nh(t))])),bo,M([ha]))}),jy=function(e){return{$:"LoadedTrade",a:e}},qy=r(function(e,t){var r=Uy(t.factory),n=r.a,a=r.b;return d(Ky,l(Vy,jy(t),n,e),po(M([a,Ey(Nh(t.factory))])),bo,M([ha]))}),Gy=function(e){return{data:si(f(If,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},zy=function(e){return{data:si(f(If,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yy=function(e){return{data:si(f(If,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Wy=r(function(e,t){return{data:si(f(If,"initiatorStatement(string)",M([Dp(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Jy=function(e){return{data:si(f(If,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Qy=function(e){return{data:si(f(If,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Xy=r(function(e,t){return{data:si(f(If,"responderStatement(string)",M([Dp(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Zy=r(function(e,t){return{amount:t,fiatType:e}}),em=f(qo,function(e){var t=Fl(e);if("Just"===t.$){var r=t.a;return Fi(r)}return Go("Can't convert that to a BigInt")},zo),tm=l(Mi,Zy,f(yh,0,zo),f(yh,1,em)),rm={$:"Bank"},nm={$:"Cash"},am=function(e){switch(e){case"cash":return si(nm);case"bank":return si(rm);case"custom":return si(yd);default:return ci}},im=f(qo,function(e){var t=am(e);if("Just"===t.$){var r=t.a;return Fi(r)}return Go("")},zo),om=l(Mi,md,f(gh,"type",im),f(gh,"info",zo)),um=oe,sm=function(e){var t=l(Mi,Mp,f(gh,"price",tm),f(gh,"paymentmethods",um(om)));return f(Uh,t,e)},cm=r(function(e,t){return{commPubkey:t,responder:e}}),fm=r(function(e,t){var n=r(function(t,r){return l($o,t,t+2*r,e)}),a=f(Io,oh,Uo(ti(2)));return f(Ah,function(t){return f(Uo,function(e){return f(n,t+64,e)},oh(l($o,t,t+64,e)))},a(t))}),lm=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),dm=n(function(e,t,r){var n=l(Ra,lm(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),hm=j,pm=function(e){return is(hm(e))},gm=function(e){return l(dm,r(function(e,t){return U(t,pm(e))}),"",e)},vm=ko(function(e){var t=e.a,r=e.b;return f(Uo,f(xo,t,r),f(Ah,gm,f(Ah,f(Io,xa(oh),nh),f(Uo,Yf(f(Io,cd,Du)),f(Uo,xs(2),f(fm,t,Do(r)))))))}),ym=f(Hd,f(vh,1,vm),f(Hd,f(vh,0,hh),Fi(cm))),mm=r(function(e,t){return{commPubkey:t,terms:e}}),bm=f(Hd,f(vh,1,vm),f(Hd,f(vh,0,vm),Fi(mm))),Cm=function(e){return{statement:e}},Em=f(Hd,f(vh,0,vm),Fi(Cm)),Sm=function(e){return{statement:e}},Tm=f(Hd,f(vh,0,vm),Fi(Sm)),wm={$:"AbortedEvent"},Im={$:"BurnedEvent"},Am={$:"ClaimedEvent"},Bm=function(e){return{$:"CommittedEvent",a:e}},km=function(e){return{$:"InitiatedEvent",a:e}},Nm=function(e){return{$:"InitiatorStatementLogEvent",a:e}},Rm={$:"PokeEvent"},$m={$:"RecalledEvent"},_m={$:"ReleasedEvent"},Lm=function(e){return{$:"ResponderStatementLogEvent",a:e}},xm=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9a-fA-F]+$"))),Pm=function(e){return xm(e)?li(Ds(Ko(e))):fi("Something in here is not very hexy: "+lh(e))},Dm=Yo(Pm),Um=f(gh,"topics",f(yh,0,Dm)),Om=function(e){return Ds(f(Ri,"",f(xa,f(Io,ps,Fs),Ef(f(xa,yi,_s(e))))))},Mm=f(qo,function(e){return R(e,Om("Initiated(string,string)"))?f(Oi,km,bm):R(e,Om("Committed(address,string)"))?f(Oi,Bm,ym):R(e,Om("Recalled()"))?Fi($m):R(e,Om("Claimed()"))?Fi(Am):R(e,Om("Aborted()"))?Fi(wm):R(e,Om("Released()"))?Fi(_m):R(e,Om("Burned()"))?Fi(Im):R(e,Om("InitiatorStatementLog(string)"))?f(Oi,Nm,Em):R(e,Om("ResponderStatementLog(string)"))?f(Oi,Lm,Tm):R(e,Om("Poke()"))?Fi(Rm):Go("Unrecognized topic hash")},Um),Fm={$:"Initiator"},Vm={$:"Responder"},Km=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(Fm):f(vg,function(e){return R(t,e)?si(Vm):ci},e.state.responder)}),Hm=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},jm=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},qm=function(e){return R(e.buyerDeposit,Il(e.tradeAmount))&&R(e.abortPunishment,wl(e.tradeAmount))},Gm={$:"Invalid"},zm=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Ym=r(function(e,t){return ml(Ed(t)+Ed(e))}),Wm=function(e){var t=ad(Zl(e.amount));if("Just"===t.$){return t.a}f(Mf,"Error converting FiatValue to float--string -> float failed!",e);return 0},Jm=r(function(e,t){return(t-e)/e}),Qm=r(function(e,t){var r=Wm(t),n=id(e);return"USD"===t.fiatType?si(f(Jm,n,r)):ci}),Xm=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 ml(0)}}();return{margin:f(Qm,e.tradeAmount,r.price),phaseEndTime:f(Ym,t.phaseStartTime,n)}}),Zm=function(e){var t=x(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 jy(v(zm,e.factory,e.id,n,a,o,u,s,l(Xm,a,o,u)))}return vy(e)},eb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(Mf,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Gm}}),tb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(Mf,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Gm}}),rb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(Mf,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Gm}}),nb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return jy(D(n,{state:e}));default:return Gm}}),ab=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(Mf,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Gm}}),ib=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}}),ob=Wo(f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Fo,f(Iy,hh,Ty(ib))))))))))),ub=function(e){return{data:si(f(If,"getParameters()",yr)),decoder:ob,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},sb={$:"Buyer"},cb=function(e){return f(Ao,function(e){return ml(1e3*e)},Ll(Zl(e)))},fb=function(e){return Cl(e)},lb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),db=function(e){var t=f(sd,"error converting BigInt to Time.Posix",cb(e.autoabortInterval)),r=f(sd,"error converting BigInt to Time.Posix",cb(e.autoreleaseInterval)),a=f(sd,"error converting BigInt to Time.Posix",cb(e.autorecallInterval));return d(lb,n(function(t,r,n){return{abortPunishment:fb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:fb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?vl:sb,pokeReward:fb(e.pokeReward),tradeAmount:fb(e.tradeAmount)}}),a,t,r)},hb=n(function(e,t,r){return f(Rp,r,f(Ep,db,f(yp,Nh(e),ub(t))))}),pb=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}}}}}}}}}}},gb=Wo(f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,Ty(pb)))))))))))),vb=function(e){return{data:si(f(If,"getPhaseStartInfo()",yr)),decoder:gb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},yb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),mb=function(e){return h(yb,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}}),cb(e.v6),cb(e.v7),cb(e.v8),cb(e.v9))},bb=n(function(e,t,r){return f(Rp,r,f(Ep,mb,f(yp,Nh(e),vb(t))))}),Cb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Eb=Wo(f(Iy,Eh,f(Iy,hh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,Ty(Cb))))))),Sb=function(e){return{data:si(f(If,"getState()",yr)),decoder:Eb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Tb={$:"Aborted"},wb={$:"Burned"},Ib={$:"NotClosed"},Ab={$:"Recalled"},Bb={$:"Released"},kb=function(e){switch(f(hc,99,Ll(Zl(e)))){case 0:return si(Ib);case 1:return si(Ab);case 2:return si(Tb);case 3:return si(Bb);case 4:return si(wb);default:return ci}},Nb={$:"Closed"},Rb={$:"Committed"},$b={$:"Judgment"},_b=function(e){switch(f(hc,99,Ll(Zl(e)))){case 1:return si(jg);case 2:return si(Rb);case 3:return si($b);case 4:return si(Nb);default:return ci}},Lb=function(e){return R(e,_d("0x0000000000000000000000000000000000000000"))?ci:si(e)},xb=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),Pb=function(e){var t=cb(e.phaseStartTimestamp),r=_b(e.phase),a=kb(e.closedReason);return d(xb,n(function(t,r,n){return{balance:fb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:Lb(e.responder)}}),r,t,a)},Db=n(function(e,t,r){return f(Rp,r,f(Ep,Pb,f(yp,Nh(e),Sb(t))))}),Ub=i(function(e,t,r,n,a){return po(M([l(hb,e,t,r),l(Db,e,t,n),l(bb,e,t,a)]))}),Ob=function(e){var t=ug(e);if("Just"===t.$){return t.a}f(Mf,"Warning! BigInt to Int conversion failed!",Zl(e));return 0},Mb=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),Fb=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),Vb=function(e){return e.b?l(Fb,e,yr,0):qa},Kb=tn,Hb=function(e){var t=h(Kb,Mb,f(gh,"encapsulation",zo),f(gh,"iv",zo),f(gh,"tag",zo),f(gh,"encrypted",zo)),r=um(t),n=f(Th,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(_c,0,e),f(_c,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(Vb(i))},jb=function(e){var t=function(e){var t=Ro(e);return t>1114111?fi("string is too long"):li(f(as,hm(t),e))};return f(Uo,Ri(""),nh(f(xa,t,e)))},qb=function(e){var t=e.a,r=e.b;return jb(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},Gb=r(function(e,t){return Jf(M([L("message",Hf(e)),L("pubkeyHexStrings",f(wh,Hf,M([t.initiatorPubkey,t.responderPubkey])))]))}),zb=function(e){return{$:"LoadedCommInfo",a:e}},Yb=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),Wb=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 zb(f(Yb,r,n))}return My(e)},Jb=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return Wb(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return zb(D(n,{initiatorPubkey:e}))}),Qb=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return Wb(D(r,{responderPubkey:si(e)}))}var n=t.a;return zb(D(n,{responderPubkey:e}))}),Xb=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return sb}r.a,r.b;return vl}if("Buyer"===r.b.$){r.a,r.b;return vl}r.a,r.b;return sb}),Zb=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(xl,a,n),o=fs(f(js,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),eC=function(e){var t=Vb(f(Zb,_s(e),yr));return l(wd,Mg,h(yb,Mb,f(_c,0,t),f(_c,1,t),f(_c,2,t),f(_c,3,t)),h(yb,Mb,f(_c,4,t),f(_c,5,t),f(_c,6,t),f(_c,7,t)))},tC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),rC={$:"Aborted"},nC={$:"Burned"},aC={$:"Claimed"},iC=function(e){return{$:"Committed",a:e}},oC=function(e){return{$:"Encrypted",a:e}},uC={$:"FailedDecode"},sC={$:"Initiated"},cC={$:"Recalled"},fC={$:"Released"},lC=function(e){return{$:"StateChange",a:e}},dC=function(e){return{$:"Statement",a:e}},hC=fr,pC=cr,gC=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(hC,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(pC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),vC=or,yC=y,mC=a(function(e,t,r,n){var a=kc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(vC,Ga(r),n);var i=za(d(mC,e-Ha,t,r,ja));return f(vC,i,n)}var o=f(Nc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(mC,e-Ha,t,r,u));return l(Pc,a,i,n)}var i=za(d(mC,e-Ha,t,r,yC(o)));return l(Pc,a,i,n)}),bC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(mC,c,r,e,yC(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(mC,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),CC=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(hC,32,r,e),o=f(bC,i,t);if(a<0){var u=l(pC,a,n,e);return f(bC,u,o)}return o}),EC=ur,SC=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(EC,i,t,r)}return f(ka,e,t)});return{nodeList:l(EC,i,yr,n),nodeListSize:t/32|0,tail:a}},TC=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(EC,o,t,r)}var n=e.a;return f(CC,n,t)});return f(CC,i,l(EC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(EC,o,t,r)}var n=e.a;return f(gC,n,t)});return f(ai,!0,f(gC,i,l(EC,o,SC(e),a)))}),wC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),IC=f(La,wC,yr),AC=n(function(e,t,r){var n=Xb(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(lC(sC));case"CommittedEvent":var r=t.a;return si(lC(iC(r.responder)));case"RecalledEvent":return si(lC(cC));case"ClaimedEvent":return si(lC(aC));case"AbortedEvent":return si(lC(rC));case"ReleasedEvent":return si(lC(fC));case"BurnedEvent":return si(lC(nC));case"InitiatorStatementLogEvent":var r=t.a;return si(dC({blocknum:e,message:function(){var e=eC(r.statement);if("Just"===e.$){var t=e.a;return oC(t)}return uC}(),who:n(Fm)}));case"ResponderStatementLogEvent":var r=t.a;return si(dC({blocknum:e,message:function(){var e=eC(r.statement);if("Just"===e.$){var t=e.a;return oC(t)}return uC}(),who:n(Vm)}));default:return ci}}(),i=f(Ao,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(TC,r.history,Vb(IC(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Ao,tC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),IC(M([s])))}),BC=Gr,kC=function(e){var t=l(Mi,Mg,f(gh,"id",BC),f(gh,"message",zo));return f(Cd,Di,f(Th,t,e))},NC=function(e){return{$:"Decrypted",a:e}},RC=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),$C=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(AC,n,a,t),o=i.a,u=i.b,s=i.c;return d(RC,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(RC,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(RC,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=kC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(_c,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:NC(y)}),T=D(b,{eventInfo:dC(S)}),w=l(Uc,v,T,t.history);return d(RC,D(t,{history:w}),!1,ci,yr)}return d(RC,t,!1,ci,M([pa(f(Vf,"got a decryption result, but for an event that is not a message!",b))]))}return d(RC,t,!1,ci,M([pa(f(Vf,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(RC,t,!1,ci,M([pa(f(Vf,"Error decoding decryption result",I))]))}}),_C=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),LC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),xC=function(e){return{onBroadcast:ci,onMined:si(L(_C(e),ci)),onSign:si(LC(e))}},PC=je("encryptToPubkeys",Ua),DC=n(function(e,t,r){return{data:si(f(If,"commit(address,string)",M([Dd(t),Dp(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),UC=n(function(e,t,r){return{data:si(f(If,"commit(address,string)",M([Dd(t),Dp(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),OC=function(e){return{$:"CommitMined",a:e}},MC={$:"CommitNeedsSig"},FC=function(e){return{$:"CommitSigned",a:e}},VC=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?UC:DC}(),a=xf(function(){return"Token"===e.factory.$?Ua:qp(El(Hm(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(MC),f(To,{onBroadcast:ci,onMined:si(L(OC,ci)),onSign:si(FC)},a))}),KC=r(function(e,t){return Jf(M([L("id",el(e)),L("encapsulation",Hf(t.encapsulatedKey)),L("iv",Hf(t.iv)),L("tag",Hf(t.tag)),L("encrypted",Hf(t.message))]))}),HC=je("decryptMessage",Ua),jC=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},qC=r(function(e,t){return po(f(xa,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 HC(f(KC,r,s))}return go}return go},jC(e.history)))}),GC=function(e){if("Just"===e.$){return e.a}return ci},zC=function(e){var t=GC(l(wd,Km,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Ao,function(e){return e.address},Td(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(qC,n,a)}return go},YC=r(function(e,t){return f(Ao,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return vl}r.a,r.b;return sb}if("Seller"===r.b.$){r.a,r.b;return sb}r.a,r.b;return vl},f(Km,e,t))}),WC=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(AC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),JC=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),QC=i(function(e,t,r,n,a){return f(WC,n,p(JC,e,r,t,qa,a,""))}),XC=function(e){return{$:"ChatHistoryMsg",a:e}},ZC=a(function(e,t,r,n){var a=x(t,Td(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(YC,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(XC),n))}(h(QC,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),eE={$:"Abort"},tE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),rE=function(e){return{$:"ActionNeedsSig",a:e}},nE=function(e){return{$:"ApproveMining",a:e}},aE={$:"ApproveNeedsSig"},iE=function(e){return{$:"ApproveSigned",a:e}},oE={$:"Burn"},uE={$:"Claim"},sE=function(e){return{$:"CommitMining",a:e}},cE=function(e){return{$:"ConfirmingAction",a:e}},fE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),lE=function(e){return{$:"EventLogFetched",a:e}},dE=function(e){return{$:"ParametersFetched",a:e}},hE=function(e){return{$:"PhaseInfoFetched",a:e}},pE={$:"Poke"},gE={$:"Recall"},vE={$:"Release"},yE=function(e){return{$:"StartContractAction",a:e}},mE=function(e){return{$:"StateFetched",a:e}},bE=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"}},CE=function(e){return d(Ky,e,go,bo,yr)},EE={align:Uf,label:"cantFindTradeWillRetry",mainParagraphs:M([M([Ff("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:sg},SE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(cg,e,r)}if("Nothing"===t.a.$){t.a;return f(Vf,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(Vf,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),TE={align:Uf,label:"tradeParametersNotDefault",mainParagraphs:M([M([Ff("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:sg},wE=eo(Xi),IE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),AE=n(function(e,t,r){return l(Jh,e,Ao(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),BE=r(function(e,t){var r=t.a;return xy(f(Wh,e,r))}),kE=n(function(e,t,r){var n=e.a,a=f(Vh,t,n.requests);if("Nothing"===a.$)return L(Ly(n),go);var i=a.a,o=L(i.watchOnce,kl(r));if("Nothing"===o.b.$){o.b;return L(Ly(D(n,{requests:l(AE,t,r,n.requests)})),go)}if(o.a){var u=o.b.a;return L(Ly(D(n,{requests:l(AE,t,r,n.requests),watching:f(BE,t,n.watching)})),f(Ag,i.tagger,lp(u)))}return L(Ly(D(n,{requests:l(AE,t,r,n.requests)})),po(f(xa,function(e){return f(Ag,i.tagger,lp(e))},r)))}),NE=_e,RE=r(function(e,t){return f(Rp,f(Io,_y,t),f(bp,function(t){return Cy(e)},NE(2e3)))}),$E=ue,_E=ce,LE=Yr,xE=n(function(e,t,r){var n=function(e){return _E(M([e,$E(r)]))};return f(qo,function(a){var i=f(Th,e,a);if("Ok"===i.$){var o=i.a,u=f(Th,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return Go(Di(c))}return Fi(r)},LE)}),PE=a(function(e,t,r,n){return f(Hd,l(xE,f(gh,e,LE),t,r),n)}),DE=n(function(e,t,r){return f(Hd,f(gh,e,t),r)}),UE=Yo(dh),OE=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),ME=function(e){return{$:"BlockHash",a:e}},FE=function(e){return OE(e)?li(ME(Ko(e))):fi("Given blockHash "+lh(e)+" is not valid.")},VE=Yo(FE),KE=function(e){return{$:"TxHash",a:e}},HE=function(e){return OE(e)?li(KE(Ko(e))):fi("Given txHash "+lh(e)+" is not valid.")},jE=Yo(HE),qE=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}}),GE=zr,zE=l(DE,"blockNumber",by,l(DE,"blockHash",VE,l(DE,"transactionHash",jE,l(DE,"transactionIndex",by,l(DE,"logIndex",by,d(PE,"removed",GE,!1,l(DE,"topics",um(Dm),l(DE,"data",zo,l(DE,"address",UE,Fi(qE)))))))))),YE=function(e){return f(wh,function(e){if("Just"===e.$){var t=e.a;return Hf(wf(t))}return Wf},e)},WE=function(e){return Jf(M([L("fromBlock",Rh(e.fromBlock)),L("toBlock",Rh(e.toBlock)),L("address",jf(e.address)),L("topics",YE(e.topics))]))},JE=r(function(e,t){return pp({decoder:um(zE),method:"eth_getLogs",params:M([WE(t)]),url:e})}),QE=function(e){return{$:"BlockNum",a:e}},XE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(bp,function(r){return f(Ep,vi(r),f(JE,e,D(t,{fromBlock:QE(n),toBlock:QE(a)})))},f(JE,e,t)):f(JE,e,t)}),ZE=n(function(e,t,r){var n=r.a,a=r.b;return f(JE,e,D(t,{fromBlock:QE(n),toBlock:QE(a)}))}),eS=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(eS,e,t,i)),c=o;e=u,t=s,r=c}}),tS=r(function(e,t){return l(eS,fl,t,e)}),rS=r(function(e,t){var r=e.a,n=t.a;return xy(f(tS,r,n))}),nS=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 po(f(xa,function(t){return f(Rp,f(Io,IE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},IC(f(xa,function(e){return f(Vh,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(Ly(D(r,{blockNumber:si(a)})),po(M([f(RE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,ZE)]))):L(t,f(RE,r.nodePath,r.tagger))}return L(Ly(D(r,{blockNumber:si(a),pending:Py,watching:f(rS,r.watching,r.pending)})),po(M([f(RE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,XE),l(i,L(a,a),r.watching,ZE)])))}var s=e.a.a;return L(Ly(D(r,{errors:f(ka,s,r.errors)})),f(RE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(kE,t,c,d)}var s=e.b.a;return L(Ly(D(r,{errors:f(ka,s,r.errors)})),go)}),aS=r(function(e,t){var r=t.a;return xy(l(fl,e,gr,r))}),iS=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(fl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(Ly(D(o,{watching:f(aS,a.ref,o.watching)})),f(Rp,f(Io,IE(a.ref),a.tagger),e),a.ref)}(l(XE,a.nodePath,n,L(s,s)))}return x(Ly(D(o,{pending:f(aS,a.ref,o.pending)})),go,a.ref)}),oS=iS(!1),uS=function(e){return M([e])},sS=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(Ry,r.factory,r.id):go}}(),function(){var e=x(Td(t.wallet),yg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(yg(t.wallet),si(a.factory))?d($p,n,r.address,a.creationInfo.address,oy):go}return go}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(ZC,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?zC(t):go,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(Ky,u,po(M([l(Db,p.factory,p.creationInfo.address,mE),s,r])),bo,o)}return CE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return CE(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(xu,m,El(Hm(C.parameters))),ba))return CE(u);var S=l(VC,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(Ky,D(u,{txChainStatus:T}),go,w,yr)}return CE(u)}var y=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:Ob(I.blocknum)},B=l(oS,lE,t.eventSentry,{address:A.address,fromBlock:QE(A.blocknum),toBlock:vp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(eb,A,t.trade)}),$=f(hc,wE,jm(u.trade)),_=po(M([N,h(Ub,$,A.address,dE,mE,hE)]));return d(Ky,u,_,bo,yr)}if("BadBody"===g.a.$){g.a.a;return d(Ky,t,go,bo,M([pa(EE)]))}var y=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(nb,P,t.trade)});return d(Ky,u,zC(u),bo,yr)}return d(Ky,t,go,bo,M([pa(f(SE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(qm(F)){var u=D(t,{trade:f(tb,F,t.trade)});return d(Ky,u,zC(u),bo,yr)}return d(Ky,t,go,bo,M([pa(TE)]))}var V=g.a.a;return d(Ky,t,go,bo,M([pa(f(Vf,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(rb,H,t.trade)});return d(Ky,u,zC(u),bo,yr)}return d(Ky,t,go,bo,M([pa(f(SE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Ih,Mm,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(Ky,t,go,bo,M([pa(f(Vf,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(Jb,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(Qb,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=sm(e.terms);if("Ok"===r.$){var n=r.a;return L(f(ab,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(Vf,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(XC),n))}(l(AC,q.blockNumber,Y,r))}return d(ZC,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?zC(u):go;return d(Ky,u,_,bo,f(oo,f(xa,pa,IC(M([X]))),o));case"ExpandPhase":var te=e.a;return CE(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return CE(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return CE(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(Ky,t,go,bo,M([da(yv(C.parameters.initiatorAddress))]))}return d(Ky,t,go,bo,M([pa(f(Vf,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return CE(D(t,{txChainStatus:si(f(fE,E,ie))}));case"AbortAction":return CE(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(VC,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=xf(l(Md,xd(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(iE)};return f(To,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(xu,i,El(Hm(C.parameters))),ba)?L(si(aE),n):l(VC,C,E.address,E.commPubkey)}return L(si(aE),n)}(),T=oe.a,w=oe.b;return d(Ky,D(t,{txChainStatus:T}),go,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,pE)||R(ue,gE)){var se=yE(ue),ce=t;e=se,t=ce;continue e}return CE(D(t,{txChainStatus:si(cE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,bo,M([pa(f(Vf,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=xf(Jy(n.creationInfo.address));return x(si(rE(gE)),f(To,xC(gE),a),yr);case"Claim":var a=xf(Yy(n.creationInfo.address));return x(si(rE(uE)),f(To,xC(uE),a),yr);case"Abort":var a=xf(Gy(n.creationInfo.address));return x(si(rE(eE)),f(To,xC(eE),a),yr);case"Release":var a=xf(Qy(n.creationInfo.address));return x(si(rE(vE)),f(To,xC(vE),a),yr);case"Burn":var a=xf(zy(n.creationInfo.address));return x(si(rE(oE)),f(To,xC(oE),a),yr);default:var a=xf(Af(n.creationInfo.address));return x(si(rE(pE)),f(To,xC(pE),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(Ky,D(t,{txChainStatus:T}),go,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return CE(D(t,{txChainStatus:si(nE(he))}))}var V=de.a;return d(Ky,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return CE(D(t,{txChainStatus:si(sE(he))}))}var V=de.a;return d(Ky,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"commit",V))]));case"CommitMined":return CE(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return CE(D(t,{txChainStatus:si(f(tE,ue,he))}))}var V=de.a;return d(Ky,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,bE(ue),V))]));case"ActionMined":var ue=e.a;return CE(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(nS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(Ky,D(t,{eventSentry:ve}),_,bo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f($C,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?zC(t):go,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(PC(f(Gb,r,a)),ci)}return L(go,si(f(Vf,"Trying to encrypt, but commInfo is not loaded",n)))}return L(go,ci)}(),Te=Se.a,we=Se.b;return d(Ky,Ee,po(M([s,Te])),bo,U(f(Qi,XC,Ce.appCmds),f(hc,yr,f(Ao,uS,f(Ao,pa,we)))))}return d(Ky,t,go,bo,M([pa(f(Vf,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Ah,qb,Hb(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Km,p,E.address);if("Nothing"===Ne.$)return d(Ky,t,go,bo,M([pa(f(Vf,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return xf("Initiator"===Re.$?f(Wy,p.creationInfo.address,ke):f(Xy,p.creationInfo.address,ke))}();return d(Ky,t,go,f(To,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(Ky,t,go,bo,M([pa(f(Vf,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(Ky,t,go,bo,M([pa(f(Vf,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return CE(t)}var V=e.a.a;return d(Ky,t,go,bo,M([pa(f(fg,"message",V))]));default:return d(Ky,t,go,bo,M([ga]))}}),cS=r(function(e,t){return{address:e,blocknum:t}}),fS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(iS,!0,e,t,r))}),lS=n(function(e,t,r){var n=function(e){return r(f(Ih,bm,e).returnData)},a={address:t.address,fromBlock:QE(t.blocknum),toBlock:QE(t.blocknum),topics:M([si(Om("Initiated(string,string)"))])};return l(fS,n,e,a)}),dS=function(e){return{data:si(f(If,"numTrades()",yr)),decoder:Wo(Eh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},hS=r(function(e,t){return f(Rp,t,f(yp,Nh(e),dS(Ld(e))))}),pS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),gS=r(function(e,t){return l(La,pS(e),yr,t)}),vS=function(e){return f(gS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},yS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},mS=function(e){return f(yS,Ja(Gm),Sa(e.trades))},bS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:mS(e),loaded:Ti(vS(e))})})},CS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),ES=r(function(e,t){var r=f(_c,e,t.trades);if("Just"===r.$){var n=(r.a,l(Uc,e,Gm,t.trades));return l(CS,bS(D(t,{trades:n})),go,yr)}return l(CS,t,go,M([pa(f(Vf,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),SS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(eb,t,a),o=l(Uc,e,i,r.trades);return L(bS(D(r,{trades:o})),yr)}return L(r,M([f(Vf,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),TS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tb,t,a),o=l(Uc,e,i,r.trades);return l(CS,bS(D(r,{trades:o})),go,yr)}return l(CS,r,go,M([pa(f(Vf,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),wS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(rb,t,a),o=l(Uc,e,i,r.trades);return l(CS,bS(D(r,{trades:o})),go,yr)}return l(CS,r,go,M([pa(f(Vf,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),IS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(nb,t,a),o=l(Uc,e,i,r.trades);return l(CS,bS(D(r,{trades:o})),go,yr)}return l(CS,r,go,M([pa(f(Vf,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),AS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(ab,t,a),o=l(Uc,e,i,r.trades);return l(CS,bS(D(r,{trades:o})),go,yr)}return l(CS,r,go,M([pa(f(Vf,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),BS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),kS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),NS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),RS=function(e){return{$:"NumTradesFetchedAgain",a:e}},$S=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),_S=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),LS=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),xS=function(e){return l(CS,e,go,yr)},PS=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=Ob(n),i=Vb(f(xa,yy(t.factory),f(Ai,0,a-1))),o=po(f(xa,function(e){return l(ky,t.factory,wu(e),BS(e))},f(Ai,0,a-1)));return l(CS,D(t,{dataFetchState:l(kS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(CS,t,go,M([pa(f(cg,"Factory numTrades",u))]));case"CheckForNewTrades":return l(CS,t,f(hS,t.factory,RS),yr);case"NumTradesFetchedAgain":var r=e.a,s=L(r,t.dataFetchState.total);if("Ok"===s.a.$){if("Just"===s.b.$){var n=s.a.a,c=s.b.a,d=Ob(n);if(_(c,d)<0){var p=t.dataFetchState,o=po(f(xa,function(e){return l(ky,t.factory,wu(e),BS(e))},f(Ai,c,d-1))),g=Vb(f(xa,yy(t.factory),f(Ai,c,d-1)));return l(CS,D(t,{dataFetchState:D(p,{total:si(d)}),trades:f(TC,t.trades,g)}),o,yr)}return xS(t)}s.b;return l(CS,t,go,M([pa(f(Vf,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=s.a.a;return l(CS,t,go,M([pa(f(cg,"Factory numTrades",u))]));case"CreationInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$){var y=r.a,m=f(cS,y.address_,Ob(y.blocknum)),b=l(lS,t.eventSentry,m,NS(v)),C=b.a,E=b.b,S=po(M([h(Ub,t.factory,m.address,$S(v),LS(v),_S(v)),E])),T=l(SS,v,m,t),w=T.a,I=T.b;return l(CS,bS(D(w,{eventSentry:C})),S,f(xa,pa,I))}var u=r.a;return l(CS,t,go,M([pa(f(cg,"creationInfo",u))]));case"ParametersFetched":var v=e.a,r=e.b;if("Err"===r.$){var A=r.a;return l(CS,t,go,M([pa(f(cg,"parameters",A))]))}if("Ok"===r.a.$){var B=r.a.a;return l(TS,v,B,t)}var k=r.a.a;return l(CS,t,go,M([pa(f(Vf,"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(IS,v,N,t)}return l(CS,t,go,M([pa(f(SE,"state",r))]));case"PhaseStartInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var R=r.a.a;return l(wS,v,R,t)}return l(CS,t,go,M([pa(f(SE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var v=e.a,r=e.b;if("Ok"===r.$){var $=r.a,x=sm($.terms);if("Ok"===x.$){var P=x.a;return l(AS,v,P,t)}var U=x.a;return f(ES,v,t)}var U=r.a;return l(CS,t,go,M([pa(f(Vf,"Error decoding initiated event",U))]));default:var O=e.a,F=f(nS,O,t.eventSentry),V=F.a,S=F.b;return l(CS,D(t,{eventSentry:V}),S,yr)}}),DS=function(e){return{$:"AgentHistoryMsg",a:e}},US=function(e){return{$:"AppCmd",a:e}},OS={$:"BetaLandingPage"},MS={$:"ConnectToWeb3"},FS=function(e){return{$:"MarketplaceMsg",a:e}},VS=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),KS=r(function(e,t){return f(kn,e,Hf(t))}),HS=function(e){return f(KS,"href",tt(e))},jS=Nn("rel"),qS=KS("target"),GS=function(e){return{$:"Height",a:e}},zS=GS,YS={$:"Content"},WS=YS,JS=function(e){return{$:"Width",a:e}},QS=JS,XS=function(e){return{$:"Attr",a:e}},ZS=function(e){return{$:"NodeName",a:e}},eT=function(e){return{$:"Unkeyed",a:e}},tT={$:"AsEl"},rT=tT,nT=r(function(e,t){return{$:"Field",a:e,b:t}}),aT=f(nT,0,0),iT={$:"NoNearbyChildren"},oT={above:"a",active:"atv",alignBottom:"ab",alignCenterX:"cx",alignCenterY:"cy",alignContainerBottom:"acb",alignContainerCenterX:"accx",alignContainerCenterY:"accy",alignContainerRight:"acr",alignLeft:"al",alignRight:"ar",alignTop:"at",alignedHorizontally:"ah",alignedVertically:"av",any:"s",behind:"bh",below:"b",bold:"w7",borderDashed:"bd",borderDotted:"bdt",borderNone:"bn",borderSolid:"bs",capturePointerEvents:"cpe",clip:"cp",clipX:"cpx",clipY:"cpy",column:"c",container:"ctr",contentBottom:"cb",contentCenterX:"ccx",contentCenterY:"ccy",contentLeft:"cl",contentRight:"cr",contentTop:"ct",cursorPointer:"cptr",cursorText:"ctxt",focus:"fcs",fullSize:"fs",grid:"g",hasBehind:"hbh",heightContent:"hc",heightFill:"hf",heightFillPortion:"hfp",hover:"hv",imageContainer:"ic",inFront:"fr",inputMultiline:"iml",inputText:"it",italic:"i",nearby:"nb",noTextSelection:"notxt",onLeft:"ol",onRight:"or",opaque:"oq",overflowHidden:"oh",page:"pg",paragraph:"p",passPointerEvents:"ppe",root:"ui",row:"r",scrollbars:"sb",scrollbarsX:"sbx",scrollbarsY:"sby",seButton:"sbt",single:"e",sizeByCapital:"cap",spaceEvenly:"sev",strike:"sk",text:"t",textCenter:"tc",textExtraBold:"w8",textExtraLight:"w2",textHeavy:"w9",textJustify:"tj",textJustifyAll:"tja",textLeft:"tl",textLight:"w3",textMedium:"w5",textNormalWeight:"w4",textRight:"tr",textSemiBold:"w6",textThin:"w1",textUnitalicized:"tun",transition:"ts",transparent:"clr",underline:"u",widthContent:"wc",widthExact:"we",widthFill:"wf",widthFillPortion:"wfp",wrapped:"wrp"},uT=oT.any+" "+oT.column,sT=oT.any+" "+oT.grid,cT=oT.any+" "+oT.page,fT=oT.any+" "+oT.paragraph,lT=oT.any+" "+oT.row,dT=oT.any+" "+oT.single,hT=function(e){switch(e.$){case"AsRow":return lT;case"AsColumn":return uT;case"AsEl":return dT;case"AsGrid":return sT;case"AsParagraph":return fT;default:return cT}},pT=function(e){return{$:"Keyed",a:e}},gT={$:"NoStyleSheet"},vT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),yT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),mT={$:"AsParagraph"},bT=mT,CT=Sn("div"),ET=Sn("p"),ST=Sn("s"),TT=Sn("u"),wT=KS("className"),IT=function(e){return wn(Xe(e))},AT=function(e){return Sn(Xe(e))},BT=function(e){return{$:"Flag",a:e}},kT=function(e){return{$:"Second",a:e}},NT=function(e){return e>31?kT(1< .ctr > ."+oT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",Rw="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+QT(oT.any)+QT(oT.row)+" > "+QT(oT.any)+" { flex-basis: auto !important; } "+QT(oT.any)+QT(oT.row)+" > "+QT(oT.any)+QT(oT.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"+Nw,$w=function(e){return{$:"Intermediate",a:e}},_w=r(function(e,t){return $w({closing:t,others:yr,props:yr,selector:e})}),Lw=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,$w({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(Lw,f(_w,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(Lw,f(_w,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(Lw,f(_w,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(Lw,f(_w,n.selector,""),v),t.others)})}});return $w(l(La,a,n,t))}),xw=U(Rw,function(e){var t=function(e){return Ql(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Ql(f(xa,a,t.others)))};return Ql(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(Lw,f(_w,r,""),n),t)}),yr,e)))}(U(Aw,kw))),Pw=l(AT,"style",yr,M([ZT(xw)])),Dw=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+'"'}},Uw=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}},Ow=function(e){if("FontWith"===e.$){var t=e.a;return f(Qd,Uw,t.variants)}return!1},Mw=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),Fw=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),Vw=n(function(e,t,r){var n=r.a,a=r.b;return M([f(Fw,"."+e+"."+t+", ."+e+" ."+t,n),f(Fw,"."+e+"."+t+"> ."+oT.text+", ."+e+" ."+t+" > ."+oT.text,a)])}),Kw=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(Vw,i,oT.sizeByCapital,a),l(Vw,i,oT.fullSize,n)))}),Hw=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(Fw,"."+r+"."+oT.sizeByCapital+", ."+r+" ."+oT.sizeByCapital,M([L("line-height","1")])),f(Fw,"."+r+"."+oT.sizeByCapital+"> ."+oT.text+", ."+r+" ."+oT.sizeByCapital+" > ."+oT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),jw=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},qw=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,rc,t,r))}return ci},Gw=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),zw=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(hc,e.descender,qw(t)),n=f(hc,e.baseline,qw(f(Yf,function(e){return!R(e,r)},t))),a=f(hc,e.capital,jw(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(Gw,i,a-n,o),full:l(Gw,u,a-r,s)}},Yw=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",YT(e.height)),L("vertical-align",YT(e.vertical)+"em"),L("font-size",YT(e.size)+"em")]))},Ww=function(e){return l(Ra,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 si(L(Yw(function(e){return e.full}(zw(a))),Yw(function(e){return e.capital}(zw(a)))))}return t}return t}),ci,e)},Jw=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(gS,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=Ww(r);if("Nothing"===a.$)return f(Ri,"",f(xa,Hw(t),n));var i=a.a;return f(Ri,"",f(xa,f(Kw,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},Qw=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+'" '+Ni(r)}},Xw=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,Qw,t.variants)))}return ci},Zw=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},eI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+YT(r)+"px, "+YT(n)+"px, "+YT(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("+YT(o)+"px, "+YT(u)+"px, "+YT(s)+"px)",b="scale3d("+YT(f)+", "+YT(l)+", "+YT(d)+")",C="rotate3d("+YT(p)+", "+YT(g)+", "+YT(v)+", "+YT(y)+"rad)";return si(m+" "+b+" "+C)}},tI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,Mw(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,Mw(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,Mw(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,Mw(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+oT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+oT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+oT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,Mw(!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,M([f(GT,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(rc,1,1-c));return l(a,t,"."+u,M([f(GT,"opacity",YT(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(GT,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(gS,Xw,p)),v=M([f(GT,"font-family",f(Ri,", ",f(xa,Dw,p))),f(GT,"font-feature-settings",g),f(GT,"font-variant",f(Qd,Ow,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(GT,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(GT,s,WT(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+oT.row,A="."+(oT.wrapped+I),B="."+oT.alignRight,k="."+oT.paragraph,N="."+oT.page,R="."+oT.alignLeft,$=YT(S/2)+"px",_=YT(E/2)+"px",x="."+oT.column,y="."+C,P="."+oT.any;return Ql(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(GT,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(GT,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(GT,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(GT,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(GT,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(GT,"margin-left",w)])),l(a,t,U(y,k),M([f(GT,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(GT,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(GT,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(GT,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(GT,"content","''"),f(GT,"display","block"),f(GT,"height","0"),f(GT,"width","0"),f(GT,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(GT,"content","''"),f(GT,"display","block"),f(GT,"height","0"),f(GT,"width","0"),f(GT,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(GT,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(GT,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,VT,F.rows))+"-cols-"+f(Ri,"-",f(xa,VT,F.columns))+"-space-x-"+VT(F.spacing.a)+"-space-y-"+VT(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=eI(ne),y=HT(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,M([f(GT,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=Zw(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(Jw(s),c)}),rI=r(function(e,t){return l(AT,"style",yr,M([ZT(f(tI,e,t))]))}),nI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",Pw),f(ka,L("dynamic-stylesheet",f(rI,t,l(Ra,qT,L(Py,M([XT(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(rI,t,l(Ra,qT,L(Py,M([XT(t.focus)])),r).b)),n)}),aI=a(function(e,t,r,n){return e?f(ka,Pw,f(ka,f(rI,t,l(Ra,qT,L(Py,M([XT(t.focus)])),r).b),n)):f(ka,f(rI,t,l(Ra,qT,L(Py,M([XT(t.focus)])),r).b),n)}),iI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(IT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(nI,!1,e,t,r);default:var e=i.a,t=i.b;return d(nI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return CT;case"p":return ET;default:return AT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(aI,!1,e,t,n);default:var e=i.a,t=i.b;return d(aI,!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(AT,e,n,M([f(u,r,M([wT(oT.any+" "+oT.single)]))]))}}();switch(o.$){case"AsRow":return f(DT,OT,e)&&!f(DT,UT,e)?s:f(DT,$T,e)?f(TT,M([wT(f(Ri," ",M([oT.any,oT.single,oT.container,oT.contentCenterY,oT.alignContainerRight])))]),M([s])):f(DT,_T,e)?f(ST,M([wT(f(Ri," ",M([oT.any,oT.single,oT.container,oT.contentCenterY,oT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(DT,PT,e)&&!f(DT,xT,e)?s:f(DT,LT,e)?f(ST,M([wT(f(Ri," ",M([oT.any,oT.single,oT.container,oT.alignContainerCenterY])))]),M([s])):f(DT,RT,e)?f(TT,M([wT(f(Ri," ",M([oT.any,oT.single,oT.container,oT.alignContainerBottom])))]),M([s])):s;default:return s}}),oI=ZT,uI=function(e){return f(CT,M([wT(f(Ri," ",M([oT.any,oT.text,oT.widthContent,oT.heightContent])))]),M([oI(e)]))},sI=function(e){return l(AT,"div",M([wT(f(Ri," ",M([oT.any,oT.text,oT.widthFill,oT.heightFill])))]),M([ZT(e)]))},cI=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 R(e,bT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,bT),L(f(ka,L(n,f(s.html,gT,e)),i),au(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,rT)?sI(c):uI(c)),i),o);default:return L(i,o)}}),i=r(function(t,r){var n=r.a,a=r.b;switch(t.$){case"Unstyled":var i=t.a;return R(e,bT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,bT),L(f(ka,f(o.html,gT,e),n),au(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,rT)?sI(u):uI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=au(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(iI,n.has,n.node,n.attributes,pT(l(yT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(iI,n.has,n.node,n.attributes,pT(l(yT,"nearby-element-pls",s,n.children)),gT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=au(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(iI,n.has,n.node,n.attributes,eT(f(vT,m,n.children))),styles:g})}return Gi(h(iI,n.has,n.node,n.attributes,eT(f(vT,m,n.children)),gT))}),fI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),lI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(nT,a|r,n)}var i=e.a;return f(nT,r,i|n)}),dI=NT(7),hI=NT(36),pI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(nT,r|a,n|i)}),gI=NT(6),vI=NT(38),yI=NT(30),mI=NT(29),bI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),CI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),EI=function(e){return{$:"Transform",a:e}},SI=function(e){return{$:"ChildrenBehind",a:e}},TI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),wI=function(e){return{$:"ChildrenInFront",a:e}},II=r(function(e,t){return f(CT,M([wT(function(){switch(e.$){case"Above":return f(Ri," ",M([oT.nearby,oT.single,oT.above]));case"Below":return f(Ri," ",M([oT.nearby,oT.single,oT.below]));case"OnRight":return f(Ri," ",M([oT.nearby,oT.single,oT.onRight]));case"OnLeft":return f(Ri," ",M([oT.nearby,oT.single,oT.onLeft]));case"InFront":return f(Ri," ",M([oT.nearby,oT.single,oT.inFront]));default:return f(Ri," ",M([oT.nearby,oT.single,oT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return ZT("");case"Text":var e=t.a;return uI(e);case"Unstyled":return(0,t.a)(rT);default:return f(t.a.html,gT,rT)}}()]))}),AI=n(function(e,t,r){var n=f(II,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?SI(M([n])):wI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?SI(f(ka,n,a)):f(TI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(TI,M([n]),i):wI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(TI,f(ka,n,a),i):f(TI,a,f(ka,n,i))}}),BI=r(function(e,t){switch(t.$){case"Generic":return ZS(e);case"NodeName":var r=t.a;return f(bI,r,e);default:var n=t.a,a=t.b;return f(bI,n,a)}}),kI=function(e){switch(e.$){case"Left":return oT.alignedHorizontally+" "+oT.alignLeft;case"Right":return oT.alignedHorizontally+" "+oT.alignRight;default:return oT.alignedHorizontally+" "+oT.alignCenterX}},NI=function(e){switch(e.$){case"Top":return oT.alignedVertically+" "+oT.alignTop;case"Bottom":return oT.alignedVertically+" "+oT.alignBottom;default:return oT.alignedVertically+" "+oT.alignCenterY}},RI=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),$I=function(e){return{$:"Moved",a:e}},_I=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return $I(x(r,0,0));case"MoveY":var n=t.a;return $I(x(0,n,0));case"MoveZ":var a=t.a;return $I(x(0,0,a));case"MoveXYZ":var i=t.a;return $I(i);case"Rotate":var i=t.a,o=t.b;return d(RI,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(RI,x(0,0,0),i,x(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 $I(x(s,n,a));case"MoveY":var c=t.a;return $I(x(r,c,a));case"MoveZ":var f=t.a;return $I(x(r,n,f));case"MoveXYZ":var i=t.a;return $I(i);case"Rotate":var i=t.a,o=t.b;return d(RI,u,x(1,1,1),i,o);default:var l=t.a;return d(RI,u,l,x(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(RI,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(RI,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(RI,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(RI,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(RI,u,h,v,y);default:var m=t.a;return d(RI,u,m,p,o)}}}),LI=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(aT,n,M([l(CI,n,"height",r+"px")]));case"Content":return x(f(lI,hI,aT),oT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(lI,PT,aT),oT.heightFill,yr):x(f(lI,PT,aT),oT.heightFillPortion+" height-fill-"+Ni(a),M([l(CI,oT.any+"."+oT.row+" > "+QT("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(CI,u,"min-height",Ni(i)+"px"),c=LI(o),d=c.a,h=c.b,p=c.c;return x(f(lI,xT,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(CI,u,"max-height",Ni(g)+"px"),v=LI(o),d=v.a,h=v.b,p=v.c;return x(f(lI,xT,d),u+" "+h,f(ka,s,p))}},xI=function(e){switch(e.$){case"Px":var t=e.a;return x(aT,oT.widthExact+" width-px-"+Ni(t),M([l(CI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(lI,vI,aT),oT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(lI,OT,aT),oT.widthFill,yr):x(f(lI,OT,aT),oT.widthFillPortion+" width-fill-"+Ni(r),M([l(CI,oT.any+"."+oT.row+" > "+QT("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(CI,i,"min-width",Ni(n)+"px"),u=xI(a),s=u.a,c=u.b,d=u.c;return x(f(lI,UT,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(CI,i,"max-width",Ni(h)+"px"),p=xI(a),s=p.a,c=p.b,d=p.c;return x(f(lI,UT,s),i+" "+c,f(ka,o,d))}},PI=NT(27),DI=r(function(e,t){if(R(e,PI)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),UI=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=HT(n);if("Nothing"===s.$)return{attributes:f(ka,wT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,wT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,EI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(DT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(lI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(DT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(DI,S,I)){var p=jT(I)+" "+e,g=t,v=f(lI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=jT(I)+" "+e,g=t,v=f(lI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(lI,S,r),y=f(_I,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(DT,gI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=oT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(lI,gI,r),y=n,m=f(ka,l(CI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+oT.widthContent,g=t,v=f(lI,vI,f(lI,gI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+oT.widthFill,g=t,v=f(lI,OT,f(lI,gI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+oT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(lI,OT,f(lI,gI,r)),y=n,m=f(ka,l(CI,oT.any+"."+oT.row+" > "+QT("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=xI(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(pI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(DT,dI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(lI,dI,r),y=n,m=f(ka,l(CI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=oT.heightContent+" "+e,g=t,v=f(lI,hI,f(lI,dI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=oT.heightFill+" "+e,g=t,v=f(lI,PT,f(lI,dI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+oT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(lI,PT,f(lI,dI,r)),y=n,m=f(ka,l(CI,oT.any+"."+oT.column+" > "+QT("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=LI(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(pI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(BI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(BI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(BI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(BI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(BI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(BI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(BI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return ZS("p");case"NodeName":var e=t.a;return ZS(e);default:var r=t.a,n=t.b;return f(bI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(fI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(fI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(fI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(fI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(AI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(DT,yI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=kI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(lI,_T,e);case"Right":return f(lI,$T,e);default:return e}}(f(lI,yI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(DT,mI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=NI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(lI,LT,e);case"Bottom":return f(lI,RT,e);default:return e}}(f(lI,mI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),OI={$:"Untransformed"},MI=OI,FI=a(function(e,t,r,n){return l(cI,e,n,v(UI,hT(e),t,aT,MI,yr,yr,iT,$a(r)))}),VI=function(e){return XS(wT(e))},KI=r(function(e,t){var r=t.url,n=t.label;return d(FI,rT,ZS("a"),f(ka,XS(HS(r)),f(ka,XS(jS("noopener noreferrer")),f(ka,XS(qS("_blank")),f(ka,QS(WS),f(ka,zS(WS),f(ka,VI(oT.contentCenterX+" "+oT.contentCenterY),e)))))),eT(M([n])))}),HI=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),jI=n(function(e,t,r){return d(HI,e,t,r,1)}),qI=NT(14),GI=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),zI=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),YI=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return KT(t)+"-"+KT(r)+"-"+KT(n)+"-"+KT(a)},WI=function(e){return f(zI,qI,l(GI,"fc-"+YI(e),"color",e))},JI={align:Uf,label:"cantConnectNoWeb3",mainParagraphs:M([M([Ff("You need a web3 provider (such as "),f(KI,M([WI(l(jI,0,0,1))]),{label:Ff("Metamask"),url:"https://metamask.io/"}),Ff(") to Connect.")]),M([Ff("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:lg},QI={align:Uf,label:"invalidUrl",mainParagraphs:M([M([Ff("I don't understand that URL...")]),M([Ff("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:sg},XI=function(e){return{$:"Active",a:e}},ZI=Yo(f(Io,Tf,f(Io,Ch,sd("Error decoding hex to BigInt")))),eA=function(){return Yo(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),tA=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}}}}}}}}}}}},rA=function(e){return _E(M([f(Oi,si,e),Fi(ci)]))},nA=f(Hd,rA(f(gh,"status",eA)),f(Hd,rA(f(gh,"root",zo)),l(DE,"logsBloom",zo,l(DE,"logs",um(zE),f(Hd,rA(f(gh,"contractAddress",UE)),l(DE,"cumulativeGasUsed",ZI,l(DE,"gasUsed",ZI,l(DE,"blockNumber",by,l(DE,"blockHash",VE,l(DE,"transactionIndex",by,l(DE,"transactionHash",jE,Fi(tA)))))))))))),aA=function(e){var t=e.a;return Tf(t)},iA=f(Io,aA,Hf),oA=r(function(e,t){return pp({decoder:nA,method:"eth_getTransactionReceipt",params:M([iA(t)]),url:e})}),uA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),sA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),cA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),fA=r(function(e,t){return f(Ao,function(e){return e.toMsg},f(vg,function(e){return e.b},f(vg,function(e){return e.onMinedTagger},f(Vh,t,e))))}),lA=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}}}}}}}}}}}},dA=function(e){return _E(M([$E(ci),f(Oi,si,e)]))},hA=l(DE,"input",zo,l(DE,"gas",by,l(DE,"gasPrice",ZI,l(DE,"value",ZI,l(DE,"to",dA(UE),l(DE,"from",UE,l(DE,"transactionIndex",by,l(DE,"blockNumber",dA(by),l(DE,"blockHash",function(e){return f(qo,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},Ko(t))?Fi(ci):f(Oi,si,e)},zo)}(VE),l(DE,"nonce",by,l(DE,"hash",jE,Fi(lA)))))))))))),pA=r(function(e,t){return pp({decoder:hA,method:"eth_getTransactionByHash",params:M([iA(t)]),url:e})}),gA=r(function(e,t){return{attempts:e,sleep:t}}),vA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Np,function(e){return a>0?f(bp,function(e){return f(vA,f(gA,a,n),t)},NE(1e3*n)):fp(e)},t)}),yA=r(function(e,t){return f(bp,function(r){return f(vA,{attempts:30,sleep:1},f(pA,e,t))},NE(250))}),mA=r(function(e,t){return f(vA,{attempts:60,sleep:5},f(oA,e,t))}),bA=function(e){return{$:"Mined",a:e}},CA=function(e){return Ao(function(t){return D(t,{status:bA(e)})})},EA=function(e){return{$:"Sent",a:e}},SA=function(e){return Ao(function(t){return D(t,{status:EA(e)})})},TA=function(e){return{$:"Signed",a:e}},wA=function(e){return Ao(function(t){return D(t,{status:TA(e)})})},IA=function(e){return"Nothing"!==e.$},AA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Zf(r),go);case"TxSigned":var n=e.a,a=e.b,i=f(Vh,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(Ag,t,lp(a))}return go}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return go;if("Just"===t.b.$){var r=t.b.a;return f(Ag,r,lp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Ag,a,lp(fi(e)))}t.a,t.b,t.c;return go};if("Ok"===a.$){var c=a.a,d=IA(o.onBroadcastTagger)||IA(o.onMinedTagger)?f(Pf,r.tagger,f(Rp,cA(n),f(yA,r.nodePath,c))):go;return L(Zf(D(r,{txs:l(Jh,n,wA(c),r.txs)})),po(M([u,d])))}var h=a.a;return L(Zf(r),po(M([u,s(h)])))}return L(Zf(r),go);case"TxSent":var n=e.a,p=e.b,g=f(Vh,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Pf,r.tagger,f(Rp,sA(n),f(mA,r.nodePath,v.hash))):go}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Ag,t,lp(li(v)))}return go}();return L(Zf(D(r,{txs:l(Jh,n,SA(v),r.txs)})),po(M([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(Ag,t,lp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Ag,n,lp(fi("Error with TxSent stuff")))}e.a,e.b;return go}();return L(Zf(r),s)}return L(Zf(r),go);case"TxMined":var n=e.a,m=e.b,b=f(Vh,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Ag,a,lp(li(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 po(M([f(Pf,r.tagger,f(Rp,f(uA,n,s),Cy(r.nodePath))),f(Ag,a,lp(li(C))),f(Ag,u.toMsg,lp(s))]))}return go}();return L(Zf(D(r,{txs:l(Jh,n,CA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Ag,r,lp(fi("TxReceipt decoding failure")))}return go}();return L(Zf(r),S)}return L(Zf(r),go);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(fA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Zf(r),f(Ag,B,f(Np,function(e){return lp(D(I,{doneWatching:!0,reOrg:!0}))},f(bp,function(e){return lp(D(I,{doneWatching:!0}))},f(oA,r.nodePath,T.txHash)))))}return L(Zf(r),go)}if(R(w,T.lastCheckedBlock))return L(Zf(r),f(Pf,r.tagger,f(Rp,f(uA,n,T),f(bp,function(e){return Cy(r.nodePath)},NE(2e3)))));var k=f(fA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Zf(r),po(M([f(Pf,r.tagger,f(Rp,f(uA,n,I),f(bp,function(e){return Cy(r.nodePath)},NE(2e3)))),f(Ag,B,lp(I))])))}return L(Zf(r),go)}var n=e.a,h=e.c.a;return L(Zf(r),go);default:var h=e.a;return L(Zf(r),go)}}),BA=Jt,kA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),NA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),RA=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(NA,"#",e.fragment,l(NA,"?",e.query,U(f(kA,e.port_,U(t,e.host)),e.path)))},$A=r(function(e,t){return e<0?ci:kl(f(xl,e,t))}),_A=r(function(e,t){if(e<0)return t;var r=ah(f(xl,e,t)),n=f(js,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),LA=n(function(e,t,r){if(e<0)return r;var n=f(xl,e,r),a=f(js,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),xA=r(function(e,t){return f(LA,e,Qu(t))}),PA=r(function(e,t){gv(t);switch(t.$){case"Home":return L(D(e,{submodel:OS}),go);case"Create":var r=Nd(e.wallet),n=f(hl,e.txSentry,f(Bo,fy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(UA,U(f(Qi,fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:cy(r.model),txSentry:a}),po(M([f(Pf,fy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(ey,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(qy,e.wallet,r)}return l(Hy,e.wallet,u,s)}(),c=f(hl,e.txSentry,f(Bo,hy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(UA,U(f(Qi,hy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:dy(r.model),txSentry:a}),po(M([f(Pf,hy,r.cmd),i]))));case"Marketplace":var d=Qg(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:ly(h)}),po(M([f(Pf,FS,p)])));case"AgentHistory":var g=t.a,v=f(vo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:sy(y)}),po(M([f(Pf,DS,m)])));default:return L(f(uo,QI,e),go)}}),DA=r(function(e,t){var r=t.a,n=t.b,a=f(OA,US(e),r),i=a.a,o=a.b;return L(i,po(M([n,o])))}),UA=r(function(e,t){var r=t.a,n=t.b;return l(Ra,DA,L(r,n),e)}),OA=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(OA,MS,t);case"GotoRoute":var n=r.a;return L(t,f(zv,t.key,n));case"GTag":var a=r.a;return L(t,Qv(Wv(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),Qv(Wv(d(pl,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(fv,ty,o,u,s));default:return L(t,ry(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(_A,c,t.userNotices)}),go);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(Gv,t.key,RA(e))}var r=h.a;return BA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(MA,g,t);case"GotoRoute":var v=e.a;return L(t,po(M([Qv(Wv(d(pl,"GotoRoute","navigation",gv(v),0))),f(zv,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),go);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,JI,t),go):L(t,Yv(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return go;var t=e.a;return Xv(f(Jv,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Th,zo,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=XI(l(gl,I,w,S)),B=f(py,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(Vf,"Unexpected wallet state encounted when setting commPubkey!",ci),t),go)}T.a;return L(f(uo,f(Vf,"User pubkey set, but I can no longer find the user address!",ci),t),go)}var N=E.a;return L(l(Pa,uo,f(Vf,"error decoding commPubkey from JS",N),t),go);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(Hg,R,_),P=f(hl,t.txSentry,f(Bo,fy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(UA,U(f(Qi,fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:cy(x.model),txSentry:O}),po(M([f(Pf,fy,x.cmd),F]))))}return L(t,go);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(sS,K,j),q=f(hl,t.txSentry,f(Bo,hy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(UA,U(f(Qi,hy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:dy(x.model),txSentry:O}),po(M([f(Pf,hy,x.cmd),F]))))}return L(t,go);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(cv,G,Y);return f(UA,f(Qi,FS,x.appCmds),L(D(t,{submodel:ly(x.model)}),f(Pf,FS,x.cmd)))}return L(t,go);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(Df,W,Q),X=f(hl,t.txSentry,f(Bo,DS,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(UA,U(f(Qi,DS,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:sy(x.model),txSentry:O}),po(M([f(Pf,DS,x.cmd),F]))))}return L(t,go);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(lu,si,f(AA,Z,r))}return L(ci,go)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f($A,re,t.tradeCaches);if("Nothing"===ae.$)return f(DA,pa(f(Vf,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,go));var ie=ae.a,x=f(PS,ne,ie);return L(D(t,{tradeCaches:l(xA,re,x.tradeCache,t.tradeCaches)}),f(Pf,VS(re),x.cmd));case"NoOp":return L(t,go);default:var N=e.a;f(Mf,"test",N);return L(t,go)}}),MA=r(function(e,t){return f(PA,t,qv(e))}),FA=Ge("txIn",LE),VA=je("txOut",Ua),KA=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},HA=function(e){return{$:"EventSentryMsg",a:e}},jA=function(e){var t=f(Dy,HA,Nh(e)),r=t.a,n=t.b;return x({dataFetchState:l(kS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Rd,"tradeCache init","processing",KA(e),0)]))},qA=function(e){return{$:"InitialNumTradesFetched",a:e}},GA=function(e){return f(hS,e.factory,qA)},zA=function(e){var t=jA(e),r=t.a,n=t.b,a=t.c;return x(r,po(M([n,GA(r)])),a)},YA=function(e){return{$:"TxSentryMsg",a:e}},WA={align:Uf,label:"noWeb3Provider",mainParagraphs:M([M([Ff("No web3 provider detected. Is "),f(KI,M([WI(l(jI,0,0,1))]),{label:Ff("Metamask"),url:"https://metamask.io/"}),Ff(" or some other web3 provider installed and unlocked?")])]),noticeType:lg},JA={$:"TopLeft"},QA={align:JA,label:"screenToSmall",mainParagraphs:M([M([Ff("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:lg},XA={align:Uf,label:"wrongWeb3Network",mainParagraphs:M([M([Ff("Your wallet is set to an incorrect network.")]),M([Ff("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:sg},ZA={$:"NoneDetected"},eB=function(e){return{$:"OnlyNetwork",a:e}},tB=function(e){return f(Ao,Nh,yg(e))},rB={$:"ETCMain"},nB={$:"ETCTest"},aB={$:"Expanse"},iB={$:"Kovan"},oB={$:"Mainnet"},uB=function(e){return{$:"Private",a:e}},sB={$:"Rinkeby"},cB={$:"Ropsten"},fB={$:"RskMain"},lB={$:"RskTest"},dB=function(e){switch(e){case 1:return oB;case 2:return aB;case 3:return cB;case 4:return sB;case 30:return fB;case 31:return lB;case 42:return iB;case 41:return rB;case 62:return nB;default:return uB(e)}},hB=n(function(e,t,r){var n=e.a,a=e.b;return Zf({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Fh})}),pB=n(function(e,t,n){var a=e.networkId?eB(dB(e.networkId)):ZA,i=f(Ao,function(e){return l(hB,L(VA,FA),YA,e)},tB(a)),o=e.width<1024?si(QA):ci,u=f(xa,zA,ro),s=function(){return R(a,ZA)?si(WA):"Nothing"===yg(a).$?si(XA):ci}(),c=IC(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=$v(f(Bi,r(function(e,t){return f(Qi,VS(e),t)}),g)),y=po(f(Bi,r(function(e,t){return f(Pf,VS(e),t)}),p)),m=f(UA,v,f(MA,t,{key:n,screenWidth:e.width,submodel:OS,time:ml(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),po(M([y,C])))}),gB=Oe,vB=gB(yr),yB=function(e){return vB},mB=function(e){return{$:"Refresh",a:e}},bB=r(function(e,t){return{$:"Every",a:e,b:t}}),CB=r(function(e,t){return{processes:t,taggers:e}}),EB=lp(f(CB,Fh,Fh)),SB=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(eS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),TB=Ne,wB=r(function(e,t){var r=e.a,n=e.b,a=f(Vh,r,t);if("Nothing"===a.$)return l(fl,r,M([n]),t);var i=a.a;return l(fl,r,f(ka,n,i),t)}),IB=Be,AB=r(function(e,t){return{$:"Zone",a:e,b:t}}),BB=ca,kB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=IB(f(BB,n,f(Zh,e,n)));return f(bp,function(t){return l(kB,e,a,l(fl,n,t,r))},i)}return lp(r)}),NB=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 x(n,a,f(bp,function(e){return i},TB(t)))}),u=l(Ra,wB,Fh,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(fl,e,r,i),o)}),d=p(SB,s,c,o,u,i,x(yr,Fh,lp(gr))),h=d.a,g=d.b,v=d.c;return f(bp,function(e){return lp(f(CB,u,e))},f(bp,function(t){return l(kB,e,h,g)},v))}),RB=function(e){return we(function(t){t(Se(e(Date.now())))})}(ml),$B=n(function(e,t,r){var n=f(Vh,t,r.taggers);if("Nothing"===n.$)return lp(r);var a=n.a,i=function(t){return Tp(f(xa,function(r){return f(Xh,e,r(t))},a))};return f(bp,function(e){return lp(r)},f(bp,i,RB))}),_B=r(function(e,t){var r=t.a,n=t.b;return f(bB,r,f(Da,e,n))});pn.Time=Pe(EB,NB,$B,0,_B);var LB=Ue("Time"),xB=r(function(e,t){return LB(f(bB,e,t))}),PB=function(e){return f(xB,2e3,mB)},DB=function(e){return vB},UB=function(e){return{$:"DecryptionFinished",a:e}},OB=Ge("decryptionFinished",LE),MB=Ge("encryptionFinished",LE),FB=function(e){return{$:"EncryptionFinished",a:e}},VB=function(e){return{$:"Refresh",a:e}},KB=function(e){return gB(M([f(xB,3e3,VB),MB(FB),OB(function(e){return XC(UB(e))})]))},HB=yn,jB=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return vB;case"CreateModel":t.a;return f(HB,fy,PB());case"TradeModel":t.a;return f(HB,hy,KB());case"MarketplaceModel":t.a;return f(HB,FS,DB());default:t.a;return f(HB,DS,yB())}},qB=Ge("userPubkeyResult",LE),GB=Ge("walletSentryPort",LE),zB={$:"CheckForNewTrades"},YB=function(e){return f(xB,5e3,function(e){return zB})},WB=function(e){return{$:"Tick",a:e}},JB=function(e){return{$:"UserPubkeySet",a:e}},QB=function(e){return{$:"WalletStatus",a:e}},XB=function(e){return f(Vf,"Error decoding JS walletSentry: "+e,ci)},ZB=function(e){return{$:"ErrorDecoding",a:e}},ek=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),tk=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(gh,"ref",BC),f(gh,"txHash",rA(jE))),rk=function(e){var t=f(Th,tk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(ek,r.ref,li(a))}return f(ek,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return ZB("Error decoding tx data")},nk=function(e){var t=e.a;return f(HB,t.tagger,t.inPort(rk))},ak=f(Oi,dB,BC),ik=Yo(f(Io,Ll,f(Io,sd("Failure decoding stringy int"),Uo(dB)))),ok=_E(M([ik,ak])),uk=r(function(e,t){return{account:e,networkId:t}}),sk=l(Mi,uk,f(gh,"account",rA(UE)),f(gh,"networkId",ok)),ck=n(function(e,t,r){var n=f(Th,sk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),fk=function(e){var t=f(Io,XB,f(Io,pa,US));return gB(U(M([f(xB,1e3,WB),GB(f(ck,t,QB)),f(hc,vB,f(Ao,nk,e.txSentry)),qB(JB),gB(f(Bi,r(function(e,t){return f(HB,VS(e),t)}),f(xa,YB,e.tradeCaches)))]),M([jB(e)])))},lk=function(e){return{$:"LinkClicked",a:e}},dk=function(e){return{$:"UrlChanged",a:e}},hk=n(function(e,t,r){return d(HI,e/255,t/255,r/255,1)}),pk=l(hk,10,33,108),gk={$:"Generic"},vk=gk,yk=r(function(e,t){return d(FI,rT,vk,f(ka,QS(WS),f(ka,zS(WS),e)),eT(M([t])))}),mk=function(e){return{$:"Fill",a:e}},bk=mk(1),Ck=Hi,Ek=function(e){return{$:"Px",a:e}},Sk=Ek,Tk=NT(8),wk=function(e){return f(zI,Tk,l(GI,"bg-"+YI(e),"background-color",e))},Ik=f(yk,M([QS(bk),zS(Sk(150)),wk(pk)]),Ck),Ak=function(e){return{$:"GotoRoute",a:e}},Bk={$:"Active"},kk={$:"Important"},Nk={$:"Normal"},Rk=l(jI,1,1,1),$k=NT(2),_k=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),Lk=r(function(e,t){return R(e,t)?f(zI,$k,h(_k,"p-"+Ni(e),e,e,e,e)):f(zI,$k,h(_k,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),xk=NT(21),Pk=r(function(e,t){return{$:"Class",a:e,b:t}}),Dk=f(Pk,xk,oT.cursorPointer),Uk=NT(17),Ok=function(e){return f(zI,Uk,l(CI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},Mk=function(e){return{$:"Normal",a:e}},Fk=An,Vk=r(function(e,t){return f(Fk,e,Mk(t))}),Kk=function(e){return f(Vk,"click",Fi(e))},Hk=f(Da,XS,Kk),jk=NT(13),qk=f(Pk,jk,oT.textSemiBold),Gk=NT(4),zk=function(e){return{$:"FontSize",a:e}},Yk=function(e){return f(zI,Gk,zk(e))},Wk=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([Ok(4),wk(l(jI,0,0,1))]);default:return M([Ok(4),wk(l(jI,.9,0,0))])}}();return f(yk,U(M([f(Lk,23,12),Yk(22),qk,WI(Rk),Dk,Hk(t)]),n),Ff(e))}),Jk=l(hk,244,0,103),Qk=function(e){return{$:"AlignX",a:e}},Xk={$:"CenterX"},Zk=Qk(Xk),eN=NT(3),tN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),rN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),nN=function(e){return f(zI,eN,l(tN,f(rN,e,e),e,e))},aN=function(e){return{$:"Describe",a:e}},iN={$:"Paragraph"},oN=r(function(e,t){return d(FI,bT,vk,f(ka,aN(iN),f(ka,QS(bk),f(ka,nN(5),e))),eT(t))}),uN=f(Pk,jk,oT.bold),sN=f(yk,M([Yk(29),WI(Rk),uN,Zk,Dk,Hk(Ak(bv))]),f(oN,yr,M([Ff("DAI"),f(yk,M([WI(Jk)]),Ff("Hard"))]))),cN={$:"Right"},fN=Qk(cN),lN={$:"AsColumn"},dN=lN,hN=r(function(e,t){return d(FI,dN,vk,f(ka,VI(oT.contentTop+" "+oT.contentLeft),f(ka,zS(WS),f(ka,QS(WS),e))),eT(t))}),pN={$:"AsRow"},gN=pN,vN=r(function(e,t){return d(FI,gN,vk,f(ka,VI(oT.contentLeft+" "+oT.contentCenterY),f(ka,QS(WS),f(ka,zS(WS),e))),eT(t))}),yN=function(e){return f(vN,M([QS(bk),nN(30),f(Lk,30,17)]),M([l(Wk,"Browse Offers",Ak(Cv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Bk}return Nk}()),l(Wk,"Create a New Offer",Ak(mv),function(){return"CreateModel"===e.submodel.$?Bk:Nk}()),function(){var t=Td(e.wallet);if("Just"===t.$){var r=t.a;return l(Wk,"My Trades",Ak(yv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Bk:Nk}return Nk}())}return l(Wk,"Connect to Wallet",MS,kk)}(),f(hN,M([fN,nN(0),f(Lk,8,0)]),M([sN]))]))},mN=HI,bN=r(function(e,t){return f(yk,M([Ok(4),wk(d(mN,0,0,1,.1)),WI(l(hk,16,7,234)),Yk(e),qk,f(Lk,15,13)]),Ff(Kf(t)))}),CN=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),EN=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(zI,$k,h(_k,"p-"+Ni(t),t,t,t,t)):f(zI,$k,h(_k,d(CN,t,r,n,a),t,r,n,a))},SN=function(e){return function(){var t=Td(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?f(yk,M([f(Lk,30,10),Yk(24),qk]),Ff("Your Trades")):f(vN,M([nN(10),EN({bottom:30,left:30,right:30,top:10})]),M([f(yk,M([Yk(24),qk]),Ff("Trade History for User")),f(bN,18,e.agentAddress)]))},TN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},wN=function(e){return Yf(e)},IN={$:"BurnWindow"},AN={$:"FiatPrice"},BN={$:"Margin"},kN={$:"Offer"},NN={$:"PaymentWindow"},RN=function(e){return{$:"AlignY",a:e}},$N={$:"CenterY"},_N=RN($N),LN=NT(20),xN=f(Pk,LN,oT.clip),PN=mk,DN=function(e){return f(zI,$k,h(_k,"p-"+Ni(e),e,e,e,e))},UN=r(function(e,t){return f(yk,M([QS(PN(e)),zS(Sk(60)),xN,wk(Rk)]),f(yk,M([DN(12),_N,QS(bk)]),t))}),ON=function(e){switch(e.$){case"Phase":return 1;case"Expires":return 2;case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},MN=function(e){return{$:"JustImage",a:e}},FN=MN({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),VN=KS("alt"),KN=function(e){return f(KS,"src",rt(e))},HN=r(function(e,t){var r=t.src,n=t.description,a=f(Yf,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(FI,rT,vk,f(ka,VI(oT.imageContainer),e),eT(M([d(FI,rT,ZS("img"),U(M([XS(KN(r)),XS(VN(n))]),a),eT(yr))])))}),jN=r(function(e,t){if("None"===t.$)return Ck;var r=t.a;return f(HN,e,r)}),qN=MN({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),GN=function(e){return{$:"ChangeSort",a:e}},zN=f(Pk,jk,oT.textMedium),YN=function(e){return f(yk,M([zN,Yk(17)]),Ff(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},WN=r(function(e,t){return f(vN,M([nN(5),Dk,Hk(GN(e))]),M([YN(e),function(){if("Just"===t.$){var e=t.a;return f(yk,M([_N]),f(jN,M([QS(Sk(8))]),function(){return"Ascending"===e.$?qN:FN}()))}return Ck}()]))}),JN=r(function(e,t){return f(UN,ON(t),f(WN,t,e))}),QN=r(function(e,t){return f(vN,M([QS(bk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(JN,r,t)},t))}),XN=l(hk,150,150,150),ZN=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},eR=r(function(e,t){return f(xu,e.amount,t.amount)}),tR=r(function(e,t){return f(xu,El(e),El(t))}),rR=n(function(e,t,r){return f(e,r,t)}),nR=function(e){var t=e.a;return(R(e.b,lo)?rR:Ua)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(nR,L(Jg,Nf),e,t):f(Eu,ZN(e.state.phase),ZN(t.state.phase))});case"Expires":return r(function(e,t){return f(qg,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(tR,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(eR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(hc,ma,l(wd,r(function(e,t){return f(Eu,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(qg,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(qg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},aR=l(hk,233,237,242),iR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),oR=function(e){return f(yk,M([QS(bk),zS(bk),xN]),f(oN,M([Yk(12)]),M([Ff(e.info)])))},uR=function(e){return f(hc,Ck,f(Ao,oR,kl(e)))},sR=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"}},cR=function(e){return{$:"TimeLeft",a:e}},fR=function(e){return{$:"TimeUp",a:e}},lR=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 ml(0)}}),dR=r(function(e,t){return ml(Ed(e)-Ed(t))}),hR=r(function(e,t){var r=f(lR,t.state.phase,t),n=f(dR,e,t.state.phaseStartTime),a=f(dR,r,n);return Ed(a)>0?cR(L(a,r)):fR(r)}),pR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},gR=l(jI,0,0,0),vR=l(hk,51,183,2),yR=function(e){var t=Tu(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Ro(n));return n+(function(){if(a){return f(Po,a+1,f(_o,1,YT(r)))}return""}()+"%")},mR=r(function(e,t){return MN({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"}()})}),bR=n(function(e,t,r){return f(jN,f(ka,zS(Sk(34)),e),f(mR,t,r))}),CR=r(function(e,t){var r=yR(t);if("0%"===r)return f(yk,M([Yk(16)]),Ff("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?vR:Jk;return f(vN,M([nN(4)]),M([l(bR,yr,a,si(i)),f(yk,M([WI(o),Yk(16)]),Ff(n))]))}),ER=MN,SR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(fl,r,n,t)}),Fh,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,ER({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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","₫")]))),TR=function(e){return f(hc,"",f(Ao,Qa,f(Vh,e,SR)))},wR=function(e){return Ro(e)<=3?e:wR(f(ed,3,e))+","+f(Mo,3,e)},IR=function(e){return wR(Zl(e))},AR=function(e){return U(TR(e.fiatType),IR(e.amount))},BR=function(e){var t=function(){var t=f(Vh,e.fiatType,SR);if("Nothing"===t.$)return Ck;var r=t.a,n=(r.a,r.b);return f(jN,M([zS(Sk(26))]),n)}();return f(vN,M([nN(4)]),M([t,f(yk,M([WI(d(mN,0,0,0,.5)),zN,QS(Sk(50))]),Ff(e.fiatType)),Ff(AR(e))]))},kR=function(e){return Ed(e)<0},NR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),RR=function(e){var t=zp(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(NR,Ob(t),Ob(r),Ob(n),Ob(a))}(f(hc,L(wu(0),wu(0)),f(rs,n,wu(60))))}(f(hc,L(wu(0),wu(0)),f(rs,r,wu(3600))))}(f(hc,L(wu(0),wu(0)),f(rs,t,wu(86400))))},$R=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!kR(a)){var u=r(function(e,t){return U(l(cs,2,P("0"),Ni(e)),t)}),s=Ed(a)>0?i:o,c=RR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(vN,U(M([nN(5)]),e),M([f(yk,U(M([WI(h)]),t),Ff(f(u,c.days,"d"))),f(yk,U(M([WI(d)]),t),Ff(f(u,c.hours,"h"))),f(yk,U(M([WI(s)]),t),Ff(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=ml(0);e=p,t=g,n=v,a=y}}),_R={$:"Behind"},LR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),xR=function(e){return f(LR,_R,e)},PR=r(function(e,t){var r=Fg(200*e),n=200-r,a=f(yk,M([QS(PN(n))]),Ck),i=M([zS(Sk(3)),Ok(20)]),o=f(yk,U(i,M([QS(PN(r)),wk(t)])),Ck),u=f(yk,U(i,M([QS(bk),wk(aR)])),Ck);return f(vN,M([QS(bk),xR(u)]),M([o,a]))}),DR=l(jI,1,1,0),UR=r(function(e,t){return Ed(e)/Ed(t)}),OR=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(UR,o,u),c=(f(yk,M([Zk]),d($R,yr,yr,L(a,i),o)),s<.1?Jk:s<.2?DR:vR);return f(hN,U(M([nN(5)]),e),M([d($R,M([Zk]),t,L(a,i),o),f(PR,1-s,c)]))}),MR=function(e){var t=td(El(e)),r=f(Nl,".",t);if(!r.b)return t;if(r.b.b){Mf("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Po,3,t);case 1:return f(Po,4,f(hc,t,f(Ao,YT,f(Ao,function(e){return e/100},f(Ao,Ka,f(Ao,Fg,f(Ao,ti(100),ad(t))))))));default:var n=r.a;return f(hc,f(Po,n,t),f(Ao,Ni,f(Ao,Fg,ad(t))))}},FR=n(function(e,t,r){return f(UN,ON(t),function(){switch(t.$){case"Phase":return Ff(pR(r.state.phase));case"Expires":if("Open"===r.state.phase.$){var n=f(hR,e,r);if("TimeLeft"===n.$){var a=n.a,i=f(UR,a.a,a.b)<.05?Jk:gR;return d(OR,M([QS(bk)]),M([Yk(16)]),L(i,aR),a)}var o=n.a;return d(OR,M([QS(bk)]),M([Yk(16)]),L(Jk,aR),L(ml(0),o))}return Ck;case"Offer":return f(vN,M([nN(5)]),M([Ff(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(MR(r.parameters.tradeAmount)+" ")+sR(r.factory))]));case"FiatPrice":return BR(r.terms.price);case"Margin":var u=R(r.parameters.initiatorRole,sb);return f(hc,Ck,f(Ao,CR(u),r.derived.margin));case"PaymentWindow":var s=function(){return"Seller"===r.parameters.initiatorRole.$?Jk:vR}(),c=_(Ed(r.parameters.autoabortInterval),216e5)<0?s:gR;return d($R,yr,yr,L(c,aR),r.parameters.autoabortInterval);default:var s=function(){return"Seller"===r.parameters.initiatorRole.$?vR:Jk}(),c=_(Ed(r.parameters.autoabortInterval),216e5)<0?s:gR;return d($R,yr,yr,L(c,aR),r.parameters.autoreleaseInterval)}}())}),VR=n(function(e,t,r){return f(hN,M([QS(bk),nN(1),wk(aR),Dk,Hk(f(iR,r.factory,r.id))]),M([f(vN,M([QS(PN(6)),nN(1)]),f(xa,function(t){return l(FR,e,t,r)},t)),f(UN,1,uR(r.terms.paymentMethods))]))}),KR=Er,HR=NT(28),jR=function(e){return f(zI,HR,l(GI,"bc-"+YI(e),"border-color",e))},qR=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),GR=function(e){return f(zI,PI,h(qR,"b-"+Ni(e),e,e,e,e))},zR=a(function(e,t,r,n){return f(hN,M([QS(bk),GR(2),Ok(8),jR(XN),nN(2),wk(XN),xN]),f(xa,f(VR,e,r),f(KR,nR(t.orderBy),n)))}),YR=a(function(e,t,r,n){return f(hN,M([QS(bk),zS(bk),DN(30),nN(5)]),M([f(QN,t.orderBy,r),d(zR,e,t,r,n)]))}),WR=n(function(e,t,r){return R(t,yr)?Ck:f(Yi,Eo,d(YR,e,r.tradeTable,M([ho,kN,AN,BN,NN,IN]),t))}),JR=function(e){return f(Yf,function(e){return qm(e.parameters)},vS(e))},QR={$:"NoneFound"},XR={$:"AllFetched"},ZR={$:"FetchingTrades"},e$={$:"QueryingNumTrades"},t$=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return e$;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?ZR:XR}return QR},r$=n(function(e,t,r){var n=$v(f(xa,function(e){return f(wN,TN(r),JR(e))},t)),a=n,i=function(e){return f(yk,M([Yk(24),qk,WI(XN),Zk,DN(20)]),Ff(e))},o=f(Xd,Ja(QR),f(xa,t$,t))?M([i("No trades found.")]):f(xa,i,IC(f(xa,function(e){switch(t$(e).$){case"QueryingNumTrades":return si(KA(e.factory)+"Querying Factory...");case"NoneFound":return ci;case"FetchingTrades":return si(KA(e.factory)+"Fetching Trades");default:return ci}},t)));return f(hN,M([nN(10)]),M([function(){return o.b?f(hN,M([nN(5)]),o):Ck}(),l(WR,e,a,r)]))}),n$=n(function(e,t,r){return f(hN,M([Ok(5),wk(Rk),QS(bk),zS(bk),f(Lk,0,20)]),M([SN(r),l(r$,e,t,r)]))}),a$=function(e){return{$:"ShowCurrencyDropdown",a:e}},i$={$:"AbortCreate"},o$=function(e){return{$:"AppCmd",a:e}},u$=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),s$=function(e){return f(xa,function(e){return M([f(yk,M([WI(Jk)]),Ff("Caution! ")),Ff(e)])},IC(M([R(f(qg,e.autoreleaseInterval,ml(12e5)),ba)?si(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."}()):ci,R(f(qg,e.autoabortInterval,ml(36e5)),ba)?si(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.'}()):ci])))},c$=l(jI,0,0,1),f$=function(e){return f(yk,M([EN({bottom:5,left:5,right:5,top:0}),Hk(e),Ok(30),wk(d(mN,1,1,1,.4)),GR(1),jR(d(mN,0,0,0,.3)),Dk,Yk(14)]),f(yk,M([WI(d(mN,0,0,0,.7))]),Ff("x")))},l$=Bn,d$=l$,h$=XS,p$=r(function(e,t){return f(yk,M([xR(f(yk,M([wk(e),h$(f(d$,"position","fixed")),h$(f(d$,"z-index","1000")),h$(f(d$,"top","0")),h$(f(d$,"left","0")),h$(f(d$,"width","100%")),h$(f(d$,"height","100%"))]),Ck)),QS(bk),zS(bk)]),t)}),g$={$:"Top"},v$=RN(g$),y$={$:"InFront"},m$=function(e){return f(LR,y$,e)},b$=r(function(e,t){return{$:"Max",a:e,b:t}}),C$=r(function(e,t){return f(b$,e,t)}),E$=n(function(e,t,r){return l(Pa,p$,d(mN,0,0,.3,.6),f(yk,U(M([Zk,_N,QS(f(C$,500,WS)),wk(Rk),Ok(8),m$(f(yk,M([fN,v$]),f$(r)))]),e),t))}),S$=r(function(e,t){if("Nothing"===t.$)return Ck;var r=t.a;return f(yk,U(M([Ok(5),jR(l(jI,.9,0,0)),GR(1),wk(l(jI,1,.4,.4)),DN(5),Zk,_N,QS(f(C$,200,WS)),Yk(14)]),e),f(oN,yr,M([Ff(r)])))}),T$={$:"Above"},w$=function(e){return f(LR,T$,e)},I$=NT(26),A$=function(e){return{$:"MoveY",a:e}},B$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),k$=function(e){return f(B$,I$,A$(-e))},N$=r(function(e,t){return f(yk,M([Ok(4),f(Lk,25,17),Yk(18),qk,wk(aR),w$(f(S$,M([k$(5)]),t))]),Ff(e))}),R$=a(function(e,t,r,n){return d(HI,e/255,t/255,r/255,n)}),$$=d(R$,1,31,52,.64),_$=NT(32),L$={$:"Active"},x$=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),P$=$n,D$={$:"NoAttribute"},U$=r(function(e,t){switch(t.$){case"NoAttribute":return D$;case"Describe":var r=t.a;return aN(r);case"AlignX":var n=t.a;return Qk(n);case"AlignY":var a=t.a;return RN(a);case"Width":var n=t.a;return JS(n);case"Height":var n=t.a;return GS(n);case"Class":var n=t.a,a=t.b;return f(Pk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(zI,i,o);case"Nearby":var u=t.a,s=t.b;return f(LR,u,f(zi,e,s));case"Attr":var c=t.a;return XS(f(P$,e,c));default:var l=t.a,d=t.b;return f(B$,l,d)}}),O$=function(e){return f(U$,Ig,e)},M$=r(function(e,t){var r=t.a,n=t.b,a=O$(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(_I,n,o));default:return L(r,n)}}),F$=function(e){var t=l(Ra,M$,L(yr,OI),e),r=t.a,n=t.b;return f(ka,EI(n),r)},V$=function(e){return f(zI,_$,f(x$,L$,F$(e)))},K$=NT(33),H$={$:"Hover"},j$=function(e){return f(zI,K$,f(x$,H$,F$(e)))},q$=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(yk,M([Ok(4),Dk,Hk(n),f(Lk,25,17),WI(t),Yk(18),qk,wk(a),V$(M([wk(o)])),j$(M([wk(i)]))]),Ff(r))}),G$=r(function(e,t){return d(q$,x(d(mN,1,0,0,1),d(mN,1,0,0,.8),d(mN,1,0,0,.6)),Rk,e,t)}),z$=NT(12),Y$=f(Pk,z$,oT.textCenter),W$=function(e){return p$(d(mN,0,0,.3,.6))(f(hN,M([nN(10),Zk,_N,wk(d(mN,0,0,0,.5)),Ok(8),DN(20)]),f(xa,function(e){return f(oN,M([Zk,_N,Yk(20),qk,WI(Rk),Y$]),M([e]))},e)))},J$=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+aA(t)}e.a;return"https://kovan.etherscan.io/tx/"+aA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+aA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+aA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+aA(t)}}),Q$={$:"Bottom"},X$=RN(Q$),Z$=VI(oT.underline),e_=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(Ff(MR(fb(a))),f(G$,"Yes, I definitely want to open this trade.",l(u$,r,n,a)))}return L(Ff("??"),f(N$,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(E$,yr,f(hN,M([nN(20),DN(20),Zk,zS(bk),Y$]),M([f(yk,M([Yk(26),qk,Zk,_N]),Ff("Just to Confirm...")),f(hN,M([nN(20),Zk,_N]),f(xa,oN(M([Zk,Yk(18),zN,WI($$)])),U(s$(n),U(M([M([Ff("You will deposit "),i,Ff(" "+sR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([Ff("This ususally requires two Metamask signatures. Your "+sR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(yk,M([X$,Zk]),o)])),i$);case"ApproveNeedsSig":var u=e.a;return f(yk,M([Hk(o$(d(Rd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),W$(M([Ff("Waiting for user signature for the approve call."),Ff("(check Metamask!)"),Ff("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(yk,M([Hk(o$(d(Rd,"txChainModal clicked","misclick","ApproveMining",0)))]),W$(M([Ff("Mining the initial approve transaction..."),f(KI,M([Z$,WI(c$)]),{label:Ff("See the transaction on Etherscan"),url:f(J$,eo(u),s)}),Ff("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(yk,M([Hk(o$(d(Rd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),W$(M([Ff("Waiting for user signature for the create call."),Ff("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(yk,M([Hk(o$(d(Rd,"txChainModal clicked","misclick","CreateMining",0)))]),W$(M([Ff("Mining the final create call..."),f(KI,M([Z$,WI(c$)]),{label:Ff("See the transaction on Etherscan"),url:f(J$,r,s)}),Ff("You will be redirected when it's mined.")])))}}),t_=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Ck;var r=t.a;return f(e_,r,e)},r_=function(e){return{$:"TradeAmountChanged",a:e}},n_=KS("id"),a_=h$(n_("inputError")),i_=l(hk,109,127,138),o_=MN({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),u_=function(e){return f(jN,f(ka,zS(Sk(26)),e),o_)},s_=function(e){return f(vN,M([nN(4)]),M([u_(yr),f(yk,M([Yk(24),zN,WI(i_)]),Ff(sR(e)))]))},c_={$:"Left"},f_=Qk(c_),l_=function(e){return{$:"HiddenLabel",a:e}},d_=l_,h_=KS("type"),p_=function(e){return L(e,!0)},g_=function(e){return{$:"MayStopPropagation",a:e}},v_=r(function(e,t){return f(Fk,e,g_(t))}),y_=r(function(e,t){return l(La,gh,t,e)}),m_=f(y_,M(["target","value"]),zo),b_=function(e){return f(v_,"input",f(Oi,p_,f(Oi,e,m_)))},C_=NT(0),E_=r(function(e,t){return{$:"Transparency",a:e,b:t}}),S_=function(e){var t=function(e){return 1-e}(f(rc,1,f(ei,0,e)));return f(zI,C_,f(E_,"transparency-"+KT(t),t))},T_=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),w_=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(FI,dN,ZS("label"),e,eT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(FI,rT,vk,a,eT(M([i])));switch(n.$){case"Above":return d(FI,dN,ZS("label"),e,eT(M([o,r])));case"Below":return d(FI,dN,ZS("label"),e,eT(M([r,o])));case"OnRight":return d(FI,gN,ZS("label"),e,eT(M([r,o])));default:return d(FI,gN,ZS("label"),e,eT(M([o,r])))}}),I_=fI,A_=f(Da,XS,I_("autocomplete")),B_=l(jI,136/255,138/255,133/255),k_=l(jI,186/255,189/255,182/255),N_=f(Lk,12,12),R_=l(jI,1,1,1),$_=M([N_,Ok(3),jR(k_),wk(R_),GR(1),nN(3),QS(bk)]),__=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},L_=function(e){return f(Qd,__,e)?D$:VI("focusable")},x_=function(e){return{$:"Label",a:e}},P_=function(e){if("HiddenLabel"===e.$){var t=e.a;return aN(x_(t))}return D$},D_=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},U_=function(e){return"HiddenLabel"===e.$},O_=ye,M_=r(function(e,t){return f(kn,e,O_(t))}),F_=M_("spellcheck"),V_=f(Da,XS,F_),K_=W,H_=NT(47),j_=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(K_(e))),o=(i-1)*t+f(hc,0,f(Ao,a,r))+f(hc,0,f(Ao,a,n));return f(zI,H_,l(CI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),q_=KS("value"),G_=f(Da,XS,q_),z_={$:"LivePolite"},Y_=aN(z_),W_=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(FT,"width",n)?L(r,n):L(f(ka,e,r),f(aS,"width",n));case"Height":e.a;return f(FT,"height",n)?L(r,n):L(f(ka,e,r),f(aS,"height",n));case"Describe":e.a;return f(FT,"described",n)?L(r,n):L(f(ka,e,r),f(aS,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(FT,"align-x",n)?L(r,n):L(f(ka,e,r),f(aS,"align-x",n));case"AlignY":return f(FT,"align-y",n)?L(r,n):L(f(ka,e,r),f(aS,"align-y",n));default:return f(FT,"transform",n)?L(r,n):L(f(ka,e,r),f(aS,"transform",n))}}),L(yr,Py),e).a},J_=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,W_(e))}),Q_=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}},X_=f(Da,Gi,Qu),Z_=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([XS(b_(n.onChange))]),o=U($_,t),u=f(J_,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(Yf,D_,o),c=f(J_,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(J_,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(J_,o,function(e){return"Nearby"===e.$})),p=f(Yf,f(Da,Du,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([G_(n.text),XS(h_(a)),V_(e.spellchecked),VI(oT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return D$;var r=t.a;return A_(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(Q_(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(T_,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(T_,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(hc,5,c);return x("textarea",U(M([V_(e.spellchecked),VI(oT.inputMultiline),f(hc,D$,f(Ao,A_,e.autofill)),function(){if("Nothing"===u.$)return D$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return EN({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?D$:s.a?d(j_,n.text,v,u,g):D$}()]),h),M([X_(oI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(FI,rT,vk,f(ka,QS(bk),$v(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([m$(f(yk,f(ka,N_,U(s,U(M([WI(B_),VI(oT.noTextSelection+" "+oT.passPointerEvents),jR(d(mN,0,0,0,0)),wk(d(mN,0,0,0,0)),zS(bk),QS(bk),S_(""===n.text?1:0)]),r))),a))])}()]))),eT(M([d(FI,rT,ZS(v),$v(M([M([L_(t),P_(n.label)]),y,i])),eT(m))])));return l(w_,f(ka,f(Pk,xk,oT.cursorText),f(ka,U_(n.label)?D$:nN(5),f(ka,Y_,u))),n.label,b)}),eL=Z_({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),tL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(eL,M([QS(bk),zS(Sk(40)),GR(0)]),{label:d_(r),onChange:i,placeholder:n,text:a});return f(vN,U(M([nN(5)]),e),IC(M([f(Ao,yk(M([f_])),o),si(s),f(Ao,yk(M([fN])),u)])))}),rL={$:"Below"},nL=function(e){return f(LR,rL,e)},aL=function(e){return f(B$,I$,A$(e))},iL=n(function(e,t,r){return p(tL,M([QS(Sk(150)),zN,Yk(24),nL(f(S$,M([a_,aL(5)]),r))]),L(ci,si(f(yk,M([Hk(o$(d(Rd,"click","misclick","dai symbol in dai input",0)))]),s_(e)))),"dai input",ci,t,r_)}),oL=r(function(e,t){return f(zI,PI,h(qR,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),uL=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?GR(r):f(oL,n,r):f(zI,PI,h(qR,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},sL=yk(M([jR(aR),uL({bottom:2,left:0,right:0,top:0})])),cL=r(function(e,t){return f(hN,M([nN(10)]),M([f(yk,M([Yk(17),qk]),Ff(e)),t]))}),fL=r(function(e,t){return sL(f(cL,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(iL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),lL=function(e){return f(hc,wE,yg(e))},dL=function(e){var t=function(){var t=zl(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+MR(f(Tl,r,100))+" "+sR(lL(e.wallet))+"."}return"There is a 1% fee."}();return f(vN,M([Zk,f(Lk,20,10),wk(l(hk,10,33,108)),Ok(8),nN(5),Hk(o$(d(Rd,"click","misclick","fee notify element",0)))]),M([f(yk,M([Yk(18),WI(l(hk,0,226,255)),qk]),Ff(t)),f(yk,M([Yk(17),WI(Rk),zN]),Ff("We only collect this fee when trades resolve successfully."))]))},hL=function(e){return{$:"FiatAmountChanged",a:e}},pL=function(e){return{$:"FiatTypeChanged",a:e}},gL=r(function(e,t){return l(eS,n(function(t,r,n){return f(e,t,r)?l(fl,t,r,n):n}),Fh,t)}),vL=function(e){return f(gL,r(function(t,r){return f(Ng,e,t)}),SR)},yL=MN({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),mL=function(e){return f(jN,M([zS(Sk(26))]),f(hc,yL,f(Ao,Ho,f(Vh,e,SR))))},bL=function(e){return h$(f(v_,"click",Fi(L(e,!0))))},CL=X_,EL=function(e){return{$:"AppendProperty",a:e}},SL=r(function(e,t){return EL(e+":"+t)}),TL=r(function(e,t){return f(SL,e,t.value)}),wL=TL("cursor"),IL={$:"Compatible"},AL={cursor:IL,value:"default"},BL=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),kL=function(e){return{$:"PseudoClassSelector",a:e}},NL=function(e){return BL(kL(e))}("hover"),RL=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),$L=RL,_L=$L,LL=_L("span"),xL=r(function(e,t){return f(kn,et(e),rt(t))}),PL=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),DL=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),UL=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),OL=r(function(e,t){return t<>>32-e}),ML=function(e){var t=e.hash?e.seed^f(UL,461845907,f(OL,15,f(UL,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(UL,2246822507,r^r>>>16),a=f(UL,3266489909,n^n>>>13);return(a^a>>>16)>>>0},FL=r(function(e,t){return f(UL,5,f(OL,13,e^f(UL,461845907,f(OL,15,f(UL,3432918353,t)))))+3864292196}),VL=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},Wx=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+"]"}},Jx=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,Wx,r)));case"UniversalSelectorSequence":var r=e.a;return au(r)?"*":f(Ri,"",f(xa,Wx,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,Wx,r)))}},Qx=function(e){var t=e.a,r=e.b;return f(Ri," ",M([Yx(t),Jx(r)]))},Xx=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,Jx(t),f(xa,Qx,r)),i=f(Ri,"",M([f(hc,"",f(Ao,zx,n))]));return f(Ms,f(Ri," ",f(Yf,f(Da,Du,cd),a)),i)},Zx=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,Xx,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,Gx(a),"\n",e,"}"]))}),eP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(Zx,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,Fx,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,jx,Zx(" ")),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"}},tP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(Yf,f(Da,Du,cd),M([Ux(t),f(Ri,"\n",f(xa,Kx,r)),f(Ri,"\n",f(xa,Hx,n)),f(Ri,"\n\n",f(xa,eP,a))])))},rP=function(e){return tP(Dx(Lx(e)))},nP=function(e){return f(Ri,"\n\n",f(xa,rP,e))},aP=function(e){return{$:"Snippet",a:e}},iP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),oP=function(e){return{$:"StyleBlockDeclaration",a:e}},uP=r(function(e,t){var r=l(ox,t,yr,ci);return aP(M([oP(l(iP,r,yr,e))]))}),sP=function(e){return au(e)?"unstyled":f(as,P("_"),ps(f(KL,15739,nP(uS(HL(uS(f(uP,e,mx(yr)))))))))},cP=function(e){var t=sP(e),r=f(xL,"className",Hf(t));return l(PL,r,e,t)},fP=a(function(e,t,r,n){return f(e,f(ka,cP(t),r),n)}),lP=function(e){return{$:"Unstyled",a:e}},dP=function(e){return lP(ZT(e))},hP=dP,pP=r(function(e,t){return f(Tn,e,Xe(t))}),gP=function(e){return En(Xe(e))},vP=r(function(e,t){var r=e.b,n=e.c;return au(r)?t:l(fl,n,r,t)}),yP=function(e){return e.a},mP=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,vP,i,s),p=l(Ra,bP,L(yr,h),c),g=p.a,v=p.b,o=l(AT,u,f(xa,yP,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,vP,i,s),m=l(Ra,bP,L(yr,h),c),g=m.a,v=m.b,o=d(gP,y,u,f(xa,yP,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,vP,i,s),b=l(Ra,mP,L(yr,h),c),g=b.a,v=b.b,o=l(IT,u,f(xa,yP,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,vP,i,s),C=l(Ra,mP,L(yr,h),c),g=C.a,v=C.b,o=d(pP,y,u,f(xa,yP,s),$a(g));return L(f(ka,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(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,vP,n,o),c=l(Ra,bP,L(yr,s),u),h=c.a,p=c.b,a=l(AT,i,f(xa,yP,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,vP,n,o),v=l(Ra,bP,L(yr,s),u),h=v.a,p=v.b,a=d(gP,g,i,f(xa,yP,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,vP,n,o),y=l(Ra,mP,L(yr,s),u),h=y.a,p=y.b,a=l(IT,i,f(xa,yP,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,vP,n,o),m=l(Ra,mP,L(yr,s),u),h=m.a,p=m.b,a=d(pP,g,i,f(xa,yP,o),$a(h));return L(f(ka,a,r),p)}}),CP=r(function(e,t){return h(il,al,e,t,ol,ol)}),EP=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(cd(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),SP=function(e){var t=f(EP,ci,e);if("Nothing"===t.$)return Fh;var r=t.a,n=r.a,a=r.b;return f(CP,n,a)},TP=function(e){return{$:"ClassSelector",a:e}},wP=function(e){var t=e.a,r=e.b;return f(uP,r,mx(M([TP(t)])))},IP=function(e){return nP(uS(HL(f(xa,wP,Ia(e)))))},AP=function(e){return l(AT,"style",yr,uS(ZT(IP(e))))},BP=n(function(e,t,r){var n=f(xa,yP,t),a=SP(t),i=l(Ra,bP,L(yr,a),r),o=i.a,u=i.b,s=AP(u);return l(AT,e,n,f(ka,s,$a(o)))}),kP=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),NP=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(kP,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),RP=r(function(e,t){return L(f(NP,"_",t),AP(e))}),$P=n(function(e,t,r){var n=f(xa,yP,t),a=SP(t),i=l(Ra,mP,L(yr,a),r),o=i.a,u=i.b,s=f(RP,u,o);return l(IT,e,n,f(ka,s,$a(o)))}),_P=a(function(e,t,r,n){var a=f(xa,yP,r),i=SP(r),o=l(Ra,mP,L(yr,i),n),u=o.a,s=o.b,c=f(RP,s,u);return d(pP,e,t,a,f(ka,c,$a(u)))}),LP=a(function(e,t,r,n){var a=f(xa,yP,r),i=SP(r),o=l(Ra,bP,L(yr,i),n),u=o.a,s=o.b,c=AP(s);return d(gP,e,t,a,f(ka,c,$a(u)))}),xP=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(BP,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(LP,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l($P,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(_P,a,t,r,n)}},PP=xP,DP=function(e){return CL(PP(d(fP,LL,M([NL(M([wL(AL)]))]),yr,M([hP(e)]))))},UP=J,OP=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),MP=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),FP=function(e){return l(La,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 si(h(OP,n,a,i,o,u))}return ci}(),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 si(l(MP,a,t,i))}return ci}())}),L(ci,ci),e)},VP=r(function(e,t){var r=FP(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(FI,gN,vk,f(ka,VI(oT.contentLeft+" "+oT.contentCenterY+" "+oT.wrapped),f(ka,QS(WS),f(ka,zS(WS),e))),eT(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?si(EN({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(FI,gN,vk,f(ka,VI(oT.contentLeft+" "+oT.contentCenterY+" "+oT.wrapped),f(ka,QS(WS),f(ka,zS(WS),U(e,M([h]))))),eT(t))}var p=-s/2,g=-u/2;return d(FI,rT,vk,e,eT(M([d(FI,gN,vk,f(ka,VI(oT.contentLeft+" "+oT.contentCenterY+" "+oT.wrapped),f(ka,XS(f(d$,"margin",YT(p)+"px "+YT(g)+"px")),f(ka,XS(f(d$,"width","calc(100% + "+Ni(u)+"px)")),f(ka,XS(f(d$,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(zI,eN,l(tN,o,u,s)),yr))))),eT(t))])))}),KP=i(function(e,t,r,n,a){var i=f(eL,M([QS(Sk(80)),zS(Sk(40)),Yk(24),zN,jR(aR),bL(r)]),{label:d_("currency type"),onChange:f(Io,UP,n),placeholder:ci,text:t}),o=f(Vh,t,SR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return Ck;r.b;return f(VP,M([QS(Sk(350)),jR(gR),GR(1),wk(Rk),DN(10),Zk]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(vN,M([QS(Sk(80)),nN(9),f(Lk,0,5),bL(n(t)),j$(M([wk(l(jI,.8,.8,1))]))]),M([f(jN,M([zS(Sk(26))]),a),f(yk,M([Yk(16),qk]),DP(t))]))},Ia(vL(t))))}return Ck}();return f(vN,M([nN(4),nL(u)]),M([f(yk,M([Hk(a)]),mL(t)),i]))}),HP=i(function(e,t,r,n,a){var i=o$(d(Rd,"click","misclick","currency flag",0)),o=f(yk,M([Hk(o$(d(Rd,"click","misclick","currency symbol",0)))]),Ff(TR(e))),u=f(yk,M([nL(f(S$,M([a_,aL(5)]),a))]),h(KP,r,e,a$(!0),pL,i));return p(tL,M([QS(Sk(250)),zN,Yk(24),nL(f(S$,M([a_,aL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,hL)}),jP=function(e){return sL(f(cL,"For fiat",h(HP,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},qP=function(e){return{$:"ChangeRole",a:e}},GP=d(R$,1,31,52,.13),zP=r(function(e,t){var r=M([Yk(24),zN,Dk]),n=function(){return"Buyer"===t.$?L(r,U(r,M([WI(GP)]))):L(U(r,M([WI(GP)])),r)}(),a=n.a,i=n.b;return f(vN,M([nN(20)]),M([f(yk,U(M([Hk(qP(vl))]),i),Ff("Sell "+e)),f(yk,U(M([Hk(qP(sb))]),a),Ff("Buy "+e))]))}),YP=r(function(e,t){return f(cL,"Trade Type",f(zP,sR(e),t.inputs.userRole))}),WP=NT(19),JP=function(e){return Ql(M([e.inset?"box-inset":"box-",YT(e.offset.a)+"px",YT(e.offset.b)+"px",YT(e.blur)+"px",YT(e.size)+"px",YI(e.color)]))},QP=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(zI,WP,l(CI,JP(t),"box-shadow",JT(t)))},XP=QP({blur:20,color:d(R$,0,0,0,.04),offset:L(0,3),size:0}),ZP=f(Pk,eN,oT.spaceEvenly),eD=function(e){var t=lL(e.wallet);return f(hN,M([QS(bk),nN(20),wk(Rk),Ok(5),DN(20),XP]),M([f(vN,M([QS(bk),ZP]),M([f(YP,t,e),f(fL,t,e),jP(e)])),dL(e)]))},tD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),rD={$:"Web3Connect"},nD=function(e){return f(yk,M([Zk]),function(){var t=L(Td(e),yg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(G$,"Open Trade",f(tD,n,r))}t.b;return f(N$,"Unsupported Network",ci)}t.a;return f(G$,"Connect to Wallet",rD)}())},aD=function(e){return{$:"AutoabortIntervalChanged",a:e}},iD=function(e){return{$:"ChangePaymentMethodText",a:e}},oD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),uD=oD,sD=function(e){return f(uD,M([WI(d(mN,0,0,0,.2))]),function(){return Ff("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")}())},cD={$:"TextArea"},fD=r(function(e,t){return l(Z_,{autofill:ci,spellchecked:t.spellcheck,type_:cD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),lD=n(function(e,t,r){var n=f(yk,M([Yk(22),qk]),Ff("Payment Method")),a=f(fD,M([QS(bk),zS(Sk(150)),wk(d(R$,155,203,255,.2)),GR(0)]),{label:d_("payment method"),onChange:iD,placeholder:""===r?si(sD(t)):ci,spellcheck:!0,text:r});return f(hN,M([nN(20),EN({bottom:15,left:45,right:45,top:0}),QS(bk),w$(f(S$,M([a_,aL(30),DN(10),Yk(20),QS(Sk(400))]),e))]),M([n,a]))}),dD=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."},hD=a(function(e,t,r,n){var a=l(cs,e,P("0"),Ni(n));return f(yk,M([Yk(22),WI(t)]),Ff(U(a,r)))}),pD=function(e){return Ed(e)<0?ml(0):e},gD=n(function(e,t,n){var a=r(function(e,r){return f(hN,M([nN(4)]),M([f(yk,M([DN(4),Dk,Hk(n(f(Ym,t,e)))]),f(jN,M([zS(Sk(10))]),qN)),r,f(yk,M([DN(4),Dk,Hk(n(function(e){return Ed(e)?e:ml(3e5)}(pD(f(dR,t,e)))))]),f(jN,M([zS(Sk(10))]),FN))]))}),i=RR(t);return f(vN,M([ZP,nN(10)]),M([f(a,ml(864e5),d(hD,3,e," days",i.days)),f(a,ml(36e5),d(hD,2,e," hours",i.hours)),f(a,ml(3e5),d(hD,2,e," min",i.min))]))}),vD=o(function(e,t,r,n,a,i){var o=f(yk,M([wk(d(R$,155,203,255,.2)),Ok(5),DN(15),w$(f(S$,M([a_]),a))]),l(gD,gR,n,i)),u=f(vN,M([nN(30)]),M([f(jN,M([zS(Sk(40)),Hk(o$(d(Rd,"click","misclick","symbol for "+t,0)))]),e),f(yk,M([Yk(22),qk]),Ff(t))])),s=f(oN,M([Yk(17),zN,WI($$)]),M([Ff(r)]));return f(hN,M([QS(bk),Ok(10),wk(l(hk,237,237,237)),nN(2)]),f(xa,yk(M([wk(Rk),f(Lk,45,18),QS(bk)])),M([u,f(vN,M([QS(bk),nN(25),wk(Rk)]),M([o,s]))])))}),yD=MN({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),mD=f(Pk,LN,oT.clipX),bD=f(Pk,LN,oT.clipY),CD=i(function(e,t,r,n,a){return f(hN,M([nN(15),Ok(8),mD,bD,wk(Rk)]),M([p(vD,yD,"Payment Window",dD(a),r,n,aD),l(lD,t,a,e)]))}),ED=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},SD=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."},TD=MN({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),wD=n(function(e,t,r){return f(yk,M([Ok(8),mD,bD,wk(Rk)]),p(vD,TD,"Burn/Release Window",SD(r),e,t,ED))}),ID=function(e){return{$:"AutorecallIntervalChanged",a:e}},AD=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."},BD=MN({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),kD=n(function(e,t,r){return f(yk,M([Ok(8),wk(Rk),mD,bD]),p(vD,BD,"Open Window",AD(r),e,t,ID))}),ND=function(e){return f(hN,M([QS(bk),nN(20)]),M([l(kD,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(CD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(wD,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},RD=function(e){return f(hN,M([QS(f(C$,1e3,bk)),Zk,nN(20),EN({bottom:30,left:40,right:40,top:0}),Hk(a$(!1)),m$(t_(e))]),M([eD(e),ND(e),nD(e.wallet)]))},$D=is(hm(8226)),_D=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),LD=r(function(e,t){return l(Ra,ka,t,e)}),xD=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(LD,r,e),a=t-1,i=r;e=n,t=a,r=i}}),PD=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(LD,f(js,e%r,t),l(xD,yr,e/r|0,t))):f(js,e,t)}),DD=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(FT,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(aS,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),UD=function(e){return d(DD,Ua,Py,e,yr)},OD=r(function(e,t){return f(yk,M([QS(bk),m$(f(vN,M([nN(3),QS(PN(100)),QS(t),xN]),f(_D,f(yk,M([WI(d(mN,0,0,0,.1)),Yk(14)]),Ff($D)),f(xa,f(Da,yk(M([WI(d(mN,0,0,0,.2))])),Ff),f(PD,100,(e?$a:Ua)(UD(f(xa,f(Io,Ho,Qa),Ia(SR)))))))))]),Ff(" "))}),MD=r(function(e,t){var r=t.url,n=t.label;return d(FI,rT,ZS("a"),f(ka,XS(HS(r)),f(ka,XS(jS("noopener noreferrer")),f(ka,QS(WS),f(ka,zS(WS),f(ka,VI(oT.contentCenterX+" "+oT.contentCenterY),e))))),eT(M([n])))}),FD=VI(oT.italic),VD=function(){var e=f(Da,yk(M([WI(l(jI,.8,.2,.2))])),Ff),t=f(Da,yk(M([uN])),Ff);return f(hN,M([QS(bk),zS(bk),wk(Rk),Ok(6),nN(50),QP({blur:20,color:d(R$,0,0,0,.1),offset:L(0,3),size:0}),Ok(10),DN(20)]),M([f(OD,!1,bk),f(hN,M([Zk,QS(f(C$,700,bk)),nN(20)]),M([f(oN,M([Yk(70),uN,Zk,Y$]),M([Ff("DAI"),e("Hard")])),f(vN,M([Yk(30),qk,Zk,Y$,FD]),M([Ff("The "),e("Global"),Ff(", "),e("Unkillable"),Ff(" Crypto Gateway")]))])),f(vN,M([wk(XN),nN(2),Zk,v$,QS(bk)]),M([f(yk,M([f(Lk,40,10),wk(Rk),QS(bk),zS(bk)]),f(hN,M([nN(60),fN]),M([f(yk,M([Yk(40),qk,Zk]),Ff("Want to learn more?")),f(MD,M([Ok(4),Dk,f(Lk,25,17),wk(c$),WI(Rk),uN,Yk(24),Zk]),{label:f(oN,M([Y$]),M([Ff("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"})]))),f(yk,M([f(Lk,40,10),wk(Rk),QS(bk),zS(bk)]),f(hN,M([f_,nN(60)]),M([f(yk,M([Yk(40),qk,Zk]),Ff("Ready to try it out?")),f(hN,M([nN(10),QS(Sk(400)),Zk]),M([f(oN,M([Yk(24),QS(bk)]),M([Ff("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f(oN,M([Yk(24),QS(bk)]),M([Ff("Then follow the links at the top of this page to browse "),t("Sell Offers"),Ff(", browse "),t("Buy Offers"),Ff(", or "),t("Create Your Own Offer"),Ff(".")]))]))])))])),f(yk,M([X$,QS(bk)]),f(OD,!0,bk))]))}(),KD=function(e){return{$:"ShowCurrencyDropdown",a:e}},HD=r(function(e,t){return Yf(t(e))}),jD=n(function(e,t,r){return R(t,yr)?Ck:f(Yi,nv,d(YR,e,r.tradeTable,M([Jg,kN,AN,BN,NN,IN]),t))}),qD=n(function(e,t,r){var n=l(HD,e,r.filterFunc,$v(f(xa,JR,t))),a=function(e){return f(yk,M([Yk(24),qk,WI(XN),Zk,DN(20)]),Ff(e))},i=f(Xd,Ja(QR),f(xa,t$,t))?M([a("No trades found.")]):f(xa,a,IC(f(xa,function(e){switch(t$(e).$){case"QueryingNumTrades":return si(KA(e.factory)+"Querying Factory...");case"NoneFound":return ci;case"FetchingTrades":return si(KA(e.factory)+"Fetching Trades");default:return ci}},t)));return f(hN,M([nN(10)]),M([function(){return i.b?f(hN,M([nN(5)]),i):Ck}(),l(jD,e,n,r)]))}),GD=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(zI,Uk,l(CI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},zD=function(e){return f(Vk,"focus",Fi(e))},YD=f(Da,XS,zD),WD=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([YD(e(!0)),bL(e(!0))])}();return f(vN,U(e,M([zS(Sk(40)),QP({blur:20,color:d(R$,233,237,242,.05),offset:L(0,3),size:0})])),M([f(yk,M([wk(aR),zS(Sk(40)),GD({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(yk,M([_N,f(Lk,10,0)]),r)),f(eL,U(s,U(t,M([QS(Sk(100)),zS(Sk(40)),jR(aR),GD({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),uL({bottom:1,left:0,right:1,top:1})]))),{label:d_(n),onChange:u,placeholder:i,text:a})]))}),JD=function(e){return{$:"MaxDaiChanged",a:e}},QD=function(e){return{$:"MinDaiChanged",a:e}},XD=r(function(e,t){return f(hN,M([QS(bk),nN(8)]),M([f(yk,M([Yk(17),zN]),Ff(e)),t]))}),ZD=NT(25),eU=function(e){return{$:"MoveX",a:e}},tU=function(e){return f(B$,ZD,eU(-e))},rU={$:"OnLeft"},nU=function(e){return f(LR,rU,e)},aU=n(function(e,t,r){var n=u_(M([_N])),a=f(vN,M([nN(8),_N,QS(Sk(60))]),M([n,f(yk,M([Yk(16),_N]),Ff("max"))])),i=f(vN,M([nN(8),_N,QS(Sk(60))]),M([n,f(yk,M([Yk(16),_N]),Ff("min"))]));return f(XD,"Dai Range",f(hN,M([nN(5),QS(Sk(200))]),M([v(WD,M([nU(f(S$,M([tU(5),QS(Sk(200))]),r.minDai))]),M([YD(KD(!1))]),i,"min Dai",e,ci,ci,QD),v(WD,M([nU(f(S$,M([tU(5),QS(Sk(200))]),r.maxDai))]),M([YD(KD(!1))]),a,"max Dai",t,ci,ci,JD)])))}),iU=function(e){var t=f(Vh,e,SR);if("Nothing"===t.$)return Ff("*");var r=t.a,n=r.b;return f(jN,M([zS(Sk(26))]),n)},oU=function(e){return{$:"AppCmd",a:e}},uU=function(e){return{$:"FiatTypeInputChanged",a:e}},sU=n(function(e,t,r){var n=oU(d(Rd,"click","misclick","currency flag",0)),a=iU(t);f(vN,M([nN(8),_N,QS(Sk(60))]),M([a,f(yk,M([Yk(16),_N]),Ff("max"))])),f(vN,M([nN(8),_N,QS(Sk(60))]),M([a,f(yk,M([Yk(16),_N]),Ff("min"))]));return f(yk,M([v$,QS(Sk(120))]),f(XD,"Fiat Type",h(KP,e,t,KD(!0),uU,n)))}),cU={$:"AddSearchTerm"},fU=function(e){return{$:"PaymentMethodInputChanged",a:e}},lU=f(gh,"keyCode",BC),dU=function(e){return f(Vk,"keyup",f(qo,function(t){return 13===t?Fi(e):Go(Ni(t))},lU))},hU=function(e){return f(XD,"Search Payment Methods",f(eL,M([v$,QS(Sk(250)),zS(Sk(40)),jR(aR),QP({blur:20,color:d(R$,233,237,242,.05),offset:L(0,3),size:0}),h$(dU(cU))]),{label:d_("payment methods search"),onChange:fU,placeholder:ci,text:e}))},pU=function(e){return{$:"RemoveTerm",a:e}},gU=function(e){return f(yk,M([DN(3),v$,Dk,Hk(pU(e)),Yk(10),WI(Jk)]),Ff("x"))},vU=function(e){if(e.b){var t=e;return f(vN,M([QS(bk),DN(10),nN(10)]),f(xa,function(e){return f(vN,M([wk(d(R$,16,7,234,.2)),Ok(5),DN(4),nN(3)]),M([Ff(e),gU(e)]))},t))}return Ck},yU=n(function(e,t,r){return f(hN,M([nN(10),QS(WS),Zk]),M([f(vN,M([QS(WS),nN(10)]),M([f(yk,M([QS(WS),v$]),l(aU,e.minDai,e.maxDai,t)),f(yk,M([QS(WS),v$]),l(sU,r,e.fiatType,t)),f(hN,M([QS(WS),v$,nN(5)]),M([hU(e.paymentMethod),vU(e.paymentMethodTerms)]))]))]))}),mU=n(function(e,t,r){return f(hN,M([Ok(5),wk(Rk),QS(bk),zS(bk),Hk(KD(!1))]),M([f(vN,M([QS(bk),nN(10),DN(30)]),M([l(yU,r.inputs,r.errors,r.showCurrencyDropdown)])),l(qD,e,t,r)]))}),bU=function(e){return{$:"MessageInputChanged",a:e}},CU={$:"MessageSubmit"},EU=M_("disabled"),SU=function(e){return f(Nn,"tabIndex",Ni(e))},TU=function(e){return{$:"MayPreventDefault",a:e}},wU=r(function(e,t){return f(Fk,e,TU(t))}),IU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):Go("Not the enter key")},n=f(qo,r,f(gh,"key",zo));return XS(f(wU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),AU=function(e){return f(IU,"Enter",e)},BU={$:"Button"},kU=r(function(e,t){var r=t.onPress,n=t.label;return d(FI,rT,vk,f(ka,QS(WS),f(ka,zS(WS),f(ka,VI(oT.contentCenterX+" "+oT.contentCenterY+" "+oT.seButton+" "+oT.noTextSelection),f(ka,Dk,f(ka,L_(e),f(ka,aN(BU),f(ka,XS(SU(0)),function(){if("Nothing"===r.$)return f(ka,XS(EU(!0)),e);var t=r.a;return f(ka,Hk(t),f(ka,AU(t),e))}()))))))),eT(M([n])))}),NU=function(e){return f(hN,M([QS(bk),nN(10)]),M([f(fD,M([QS(bk),zS(Sk(100))]),{label:d_("messageInput"),onChange:bU,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(kU,M([Zk,Yk(24)]),{label:Ff("Submit"),onPress:si(CU)})]))},RU=f(Pk,LN,oT.scrollbarsY),$U=r(function(e,t){return f(yk,M([zS(bk),QS(bk)]),f(yk,U(M([h$(f(d$,"position","absolute")),h$(f(d$,"top","0")),h$(f(d$,"right","0")),h$(f(d$,"bottom","0")),h$(f(d$,"left","0")),RU]),e),t))}),_U=l(hk,200,205,210),LU=n(function(e,t,r){var n=M([fN,wk(c$),WI(Rk),GD({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([f_,wk(_U),WI(gR),GD({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(yk,U(M([DN(7)]),u),f(oN,yr,M([Ff(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(jI,0,0,1),Rk,"Initiator opened the trade"));case"Recalled":return si(x(l(jI,0,0,1),Rk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Po,8,Kf(t))+"..";return si(x(l(jI,1,0,1),Rk,r+" committed to the trade"));case"Aborted":return si(x(l(jI,1,0,0),Rk,"Buyer aborted the trade"));case"Claimed":return si(x(l(jI,0,1,0),Rk,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(jI,0,0,1),Rk,"Seller released the "+sR(e)+" and closed the contract"));default:return si(x(l(jI,0,0,1),Rk,"Seller burned the "+sR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Ck;var d=c.a,h=d.a,p=d.b,g=d.c;return f(yk,M([Ok(3),GR(1),jR(l(jI,1,0,1)),Zk,wk(h)]),f(oN,M([WI(p)]),M([Ff(g)])))}),xU=n(function(e,t,r){if(r.b){var n=r;return f($U,M([QS(bk),zS(bk),Ok(5),GR(1),jR(gR),DN(10)]),f(hN,M([QS(bk),zS(bk),nN(10)]),f(xa,f(LU,e,t),n)))}return f(yk,M([QS(bk),zS(bk),Ok(5),GR(1),jR(gR),Zk,WI(l(jI,.5,.5,.5)),FD]),Ff("no messages found."))}),PU=Cr,DU=function(e){return f(hN,M([QS(bk),zS(bk),nN(10),GR(1),Ok(5),DN(20)]),M([l(xU,e.trade.factory,e.userRole,f(PU,function(e){return e.blocknum},Sa(e.history))),NU(e)]))},UU=function(e){return f(yk,M([wk(Rk),Ok(8),XP,QS(bk),zS(bk)]),DU(e))},OU={$:"ToggleChat"},MU=function(e){if(e.showChatHistory){var t=f(hc,Ck,f(Ao,UU,e.chatHistoryModel));return f(yk,M([zS(bk),QS(Sk(500)),DN(20),fN]),l(E$,M([zS(bk),QS(bk)]),f(Yi,XC,t),OU))}return Ck},FU=function(e){return"Buyer"===e.initiatorRole.$?vl:sb},VU=function(e){return AR(e)+" "+e.fiatType},KU={$:"AbortAction"},HU=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),jU=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return Ck}if("LoadedTrade"!==t.b.$)return Ck;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=VU(n.terms.price),u=MR(fb(i)),s=MR(n.parameters.tradeAmount)+" "+sR(n.factory),c=function(){return"Buyer"===FU(n.parameters).$?L(f(yk,M([zN,WI(gR)]),Ff("buyer")),M([Ff("pay the seller "),f(yk,M([WI(c$)]),Ff(o)),Ff(" in exchange for the "),f(yk,M([WI(c$)]),Ff(s)),Ff(" held in this contract.")])):L(f(yk,M([zN,WI(gR)]),Ff("seller")),M([Ff("accept "),f(yk,M([WI(c$)]),Ff(o)),Ff(" from the buyer in exchange for the "),f(yk,M([WI(c$)]),Ff(s)),Ff(" held in this contract.")]))}(),d=c.a,h=c.b;return l(E$,yr,f(hN,M([nN(20),DN(20),Zk,zS(bk),Y$]),M([f(yk,M([Yk(26),qk,Zk,_N]),Ff("Just to Confirm...")),f(hN,M([nN(20),Zk,_N]),f(xa,oN(M([Zk,Yk(18),zN,WI($$)])),U(M([U(M([Ff("You will deposit "),f(yk,M([WI(c$)]),Ff(u+" "+sR(n.factory))),Ff(", thereby becoming the "),d,Ff(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([Ff("(This ususally requires two Metamask signatures. Your "+sR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(yk,M([X$,Zk]),f(G$,"Yes, I definitely want to commit to this trade.",l(HU,n,a,i)))])),KU);case"ApproveNeedsSig":return W$(M([Ff("Waiting for user signature for the approve call."),Ff("(check Metamask!)"),Ff("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return W$(M([Ff("Mining the initial approve transaction..."),f(KI,M([Z$,WI(c$)]),{label:Ff("See the transaction on Etherscan"),url:f(J$,n.factory,p)}),Ff("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return W$(M([Ff("Waiting for user signature for the final commit call."),Ff("(check Metamask!)"),Ff("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return W$(M([Ff("Mining the final commit transaction..."),f(KI,M([Z$,WI(c$)]),{label:Ff("See the transaction"),url:f(J$,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(E$,yr,f(hN,M([nN(20),DN(20),Zk,zS(bk),Y$]),M([f(yk,M([Yk(26),qk,Zk,_N]),Ff("Just to Confirm...")),f(hN,M([nN(20),Zk,_N]),f(xa,oN(M([Zk,Yk(18),zN,WI($$)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([Ff('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 '+sR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([Ff("Aborting will incur a small penalty on both parties, and refund the rest of the "+sR(n.factory)+".")])]);case"Release":return M([M([Ff("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([Ff("This will destroy the "+sR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(yk,M([X$,Zk]),function(e){return f(G$,e,yE(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 "+sR(n.factory)+".";default:return"I understand. Burn the "+sR(n.factory)+"."}}()))])),KU);case"ActionNeedsSig":var g=r.a;return W$(M([Ff("Waiting for user signature for the "+bE(g)+" call."),Ff("(check Metamask!)")]));default:var g=r.a,p=r.b;return Ck}},qU=vN(M([QS(bk),wk(Rk),Ok(5),DN(20),ZP,XP])),GU=function(e){return f(vN,M([nN(8)]),M([f(jN,yr,o_),f(yk,M([Yk(24),zN]),Ff(MR(e)))]))},zU=r(function(e,t){var r=f(vg,Km(e),f(Ao,function(e){return e.address},Td(t)));return f(cL,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"}(),GU(e.parameters.tradeAmount))}),YU=function(e){return f(vN,M([nN(5)]),M([mL(e.fiatType),f(yk,M([Yk(24),zN]),Ff(VU(e)))]))},WU=function(e){return f(cL,"For Fiat",YU(e.terms.price))},JU=function(e){return"Buyer"===e.$?"Buyer":"Seller"},QU=l(hk,250,165,22),XU=l(hk,255,0,0),ZU=l(hk,0,255,0),eO=MN({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),tO=MN({description:"burned",src:"/DAIHard/static/img/burned.svg"}),rO=MN({description:"released",src:"/DAIHard/static/img/released.svg"}),nO={$:"ToggleStatsModal"},aO=function(e){return f(PU,Ua,e)},iO=n(function(e,t,n){var a=$v(f(xa,function(e){return f(Yf,function(e){return R(f(YC,e,n),si(t))},f(gS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(Vd,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(Vd,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Al,amountReleased:Al,numAborts:0,numBurns:0,numReleases:0},a),u=f(Ao,ml,kl(aO(f(gS,function(e){return function(e){return e?si(e):ci}(Ed(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}}),oO=r(function(e,t){return d(q$,x(d(mN,0,0,1,1),d(mN,0,0,1,.8),d(mN,0,0,1,.6)),Rk,e,t)}),uO=function(e){return{$:"ViewUserHistory",a:e}},sO=f(AB,0,yr),cO=f(Pk,jk,oT.textNormalWeight),fO=r(function(e,t){return Za(e/t)}),lO=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}}),dO=r(function(e,t){var r=e.a,n=e.b;return l(lO,r,f(fO,Ed(t),6e4),n)}),hO=r(function(e,t){return f(ls,24,f(fO,f(dO,e,t),60))}),pO=r(function(e,t){return f(ls,1e3,Ed(t))}),gO=r(function(e,t){return f(ls,60,f(dO,e,t))}),vO={$:"Apr"},yO={$:"Aug"},mO={$:"Dec"},bO={$:"Feb"},CO={$:"Jan"},EO={$:"Jul"},SO={$:"Jun"},TO={$:"Mar"},wO={$:"May"},IO={$:"Nov"},AO={$:"Oct"},BO={$:"Sep"},kO=function(e){var t=f(fO,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)}},NO=r(function(e,t){switch(kO(f(dO,e,t)).month){case 1:return CO;case 2:return bO;case 3:return TO;case 4:return vO;case 5:return wO;case 6:return SO;case 7:return EO;case 8:return yO;case 9:return BO;case 10:return AO;case 11:return IO;default:return mO}}),RO=r(function(e,t){return f(ls,60,f(fO,Ed(t),1e3))}),$O={$:"Fri"},_O={$:"Mon"},LO={$:"Sat"},xO={$:"Sun"},PO={$:"Thu"},DO={$:"Tue"},UO={$:"Wed"},OO=r(function(e,t){switch(f(ls,7,f(fO,f(dO,e,t),1440))){case 0:return PO;case 1:return $O;case 2:return LO;case 3:return xO;case 4:return _O;case 5:return DO;default:return UO}}),MO=n(function(e,t,r){return e.toAmPm(f(hO,t,r))}),FO=r(function(e,t){return kO(f(dO,e,t)).day}),VO=FO,KO=M([xO,_O,DO,UO,PO,$O,LO]),HO=r(function(e,t){return function(e){return e.a}(f(hc,L(0,xO),kl(f(Yf,function(r){return R(r.b,f(OO,e,t))},f(Bi,r(function(e,t){return L(e,t)}),KO)))))}),jO=function(e){return l(Ra,Na,0,e)},qO=r(function(e,t){return kO(f(dO,e,t)).year}),GO=function(e){return!f(ls,4,e)&&(!!f(ls,100,e)||!f(ls,400,e))},zO=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return GO(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}}),YO=M([CO,bO,TO,vO,wO,SO,EO,yO,BO,AO,IO,mO]),WO=r(function(e,t){return f(hc,L(0,CO),kl(f(Yf,function(r){r.a;return R(r.b,f(NO,e,t))},f(Bi,r(function(e,t){return L(e,t)}),YO))))}),JO=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(WO,e,t))}),QO=r(function(e,t){var r=f(js,f(JO,e,t)-1,YO);return jO(f(xa,zO(f(qO,e,t)),r))+f(VO,e,t)}),XO=r(function(e,t){return f(JO,e,t)/4|0}),ZO=r(function(e,t){var r=Ni(t),n=e-Ro(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),eM=function(e){return e?e<=12?e:e-12:12},tM=Fg(315576e5),rM=r(function(e,t){return ml(tM*f(qO,e,t))}),nM=r(function(e,t){var r=f(rM,e,t),n=f(HO,e,r);return 1+((f(QO,e,t)+n)/7|0)}),aM=r(function(e,t){return Ni(f(qO,e,t))}),iM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(JO,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(JO,t,r));case"MonthFixed":return f(ZO,2,f(JO,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(NO,t,r));case"MonthNameFull":return e.toMonthName(f(NO,t,r));case"QuarterNumber":return Ni(1+f(XO,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(XO,t,r));case"DayOfMonthNumber":return Ni(f(VO,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(VO,t,r));case"DayOfMonthFixed":return f(ZO,2,f(VO,t,r));case"DayOfYearNumber":return Ni(f(QO,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(QO,t,r));case"DayOfYearFixed":return f(ZO,3,f(QO,t,r));case"DayOfWeekNumber":return Ni(f(HO,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(HO,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(OO,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(OO,t,r));case"WeekOfYearNumber":return Ni(f(nM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(nM,t,r));case"WeekOfYearFixed":return f(ZO,2,f(nM,t,r));case"YearNumberLastTwo":return f(Mo,2,f(aM,t,r));case"YearNumber":return f(aM,t,r);case"AmPmUppercase":return UP(l(MO,e,t,r));case"AmPmLowercase":return Ml(l(MO,e,t,r));case"HourMilitaryNumber":return Ni(f(hO,t,r));case"HourMilitaryFixed":return f(ZO,2,f(hO,t,r));case"HourNumber":return Ni(eM(f(hO,t,r)));case"HourFixed":return f(ZO,2,eM(f(hO,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(hO,t,r));case"HourMilitaryFromOneFixed":return f(ZO,2,1+f(hO,t,r));case"MinuteNumber":return Ni(f(gO,t,r));case"MinuteFixed":return f(ZO,2,f(gO,t,r));case"SecondNumber":return Ni(f(RO,t,r));case"SecondFixed":return f(ZO,2,f(RO,t,r));case"MillisecondNumber":return Ni(f(pO,t,r));case"MillisecondFixed":return f(ZO,3,f(pO,t,r));default:return n.a}}),oM=a(function(e,t,r,n){return f(Ri,"",f(xa,l(iM,e,r,n),t))}),uM=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),sM=function(e){return e>11?"pm":"am"},cM=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"}},fM=function(e){switch(f(ls,100,e)){case 11:case 12:case 13:return"th";default:switch(f(ls,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},lM=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"}},dM=p(uM,cM,f(Io,cM,Po(3)),lM,f(Io,lM,Po(3)),sM,fM),hM=oM(dM),pM={$:"MonthNameFull"},gM=pM,vM=function(e){return{$:"Text",a:e}},yM=vM,mM={$:"YearNumber"},bM=mM,CM=n(function(e,t,n){var a=r(function(e,t){return f(hN,M([Yk(18),nN(6)]),M([f(yk,M([uN]),Ff(e)),f(yk,M([cO]),Ff(t))]))}),i=hM(M([gM,yM(", "),bM])),o=f(hN,M([nN(23),QS(bk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,sO,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+MR(n.amountReleased)+" "+sR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+MR(n.amountBurned)+" "+sR(e)+" Burned")])),M([f(yk,M([Zk]),f(oO,"View User History",uO(n.asRole)))])));return f(hN,M([Ok(8),mD,bD,wk(aR),nN(1),QP({blur:20,color:d(mN,0,0,0,.08),offset:L(0,0),size:0})]),M([f(yk,M([QS(bk),wk(Rk),DN(17)]),f(bN,18,t)),f(yk,M([QS(bk),wk(Rk),DN(17)]),o)]))}),EM=n(function(e,t,r){var n=l(iO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=JU(e.parameters.initiatorRole)+" Stats";return f(yk,r?M([nL(f(yk,M([aL(30),fN]),l(CM,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(cL,a,f(vN,M([QS(bk),nN(20),Dk,Hk(nO)]),f(xa,vN(M([nN(5)])),M([M([f(jN,M([zS(Sk(28))]),rO),f(yk,M([Yk(24),zN,WI(ZU)]),Ff(l(cs,2,P("0"),Ni(n.numReleases))))]),M([f(jN,M([zS(Sk(28))]),eO),f(yk,M([Yk(24),zN,WI(QU)]),Ff(l(cs,2,P("0"),Ni(n.numAborts))))]),M([f(jN,M([zS(Sk(28))]),tO),f(yk,M([Yk(24),zN,WI(XU)]),Ff(l(cs,2,P("0"),Ni(n.numBurns))))])])))))}),SM=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+Kf(t)}e.a;return"https://kovan.etherscan.io/address/"+Kf(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+Kf(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+Kf(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+Kf(t)}}),TM=n(function(e,t,r){return f(KI,e,{label:Ff(Kf(r)),url:f(SM,t,r)})}),wM=function(e){return f(cL,"Trade Status",f(hN,M([Yk(24),zN,nN(8)]),M([Ff(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(TM,M([Yk(12),WI(c$),Z$]),e.factory,e.creationInfo.address)])))},IM=i(function(e,t,r,n,a){return qU(M([wM(t),f(zU,t,r),WU(t),l(EM,t,n,a)]))}),AM=l(hk,9,32,107),BM=MN({description:"chat",src:"/DAIHard/static/img/chat.svg"}),kM=f(yk,M([Ok(4),Dk,Hk(OU),DN(5),wk(l(hk,22,0,255))]),f(jN,M([QS(Sk(42))]),BM)),NM=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},RM=function(e){return f(hN,M([Ok(12),wk(aR),DN(15),nN(15)]),M([f(yk,M([Yk(24),qk,FD]),Ff("Fiat Payment Method")),f(oN,M([Yk(18),zS(WS),wk(Rk),QP({blur:5,color:d(mN,0,0,0,.2),offset:L(-3,3),size:0}),Ok(3),DN(5)]),M([f(hc,f(yk,M([WI(GP),FD]),Ff("No payment methods found.")),f(Ao,Ff,f(Ao,function(e){return e.info},kl(e))))]))]))},$M={$:"Active"},_M=function(e){return{$:"ExpandPhase",a:e}},LM=M([wk(AM),WI(Rk)]),xM=r(function(e,t){return{$:"Min",a:e,b:t}}),PM=r(function(e,t){return f(xM,e,t)}),DM=function(e){return M(e?[Ok(12),v$,zS(f(PM,380,WS))]:[Ok(12),Zk])},UM=M([wk(Rk)]),OM=MN({description:"flame",src:"/DAIHard/static/img/flame.png"}),MM=r(function(e,t){return Cl(f(qu,El(e),El(t)))}),FM=r(function(e,t){return d(q$,x(d(mN,1,.6,.2,1),d(mN,1,.6,.2,.8),d(mN,1,.6,.2,.6)),Rk,e,t)}),VM=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),KM=function(e){return{$:"ContractActionClicked",a:e}},HM={$:"Web3Connect"},jM=n(function(e,t,r){var n=Td(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(hR,e,t).$?Ck:f(vN,M([nN(8)]),function(){var e=x(t.state.phase,f(Km,t,a.address),f(YC,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,yE,f(oO,"Remove and Refund this Trade",gE))])}break e}var r=(e.a,e.b,El(Hm(t.parameters)));return M([f(G$,"Deposit and Commit to Trade",l(VM,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,KM,f(FM,"Abort Trade",eE)),f(Yi,KM,f(G$,"Confirm Payment",uE)),kM])}e.a,e.c.a;return M([kM])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,KM,f(G$,"Burn it All!",oE)),f(Yi,KM,f(oO,"Release Everything",vE)),kM])}e.a,e.c.a;return M([kM])}break e;default:break e}return yr}())}return f(G$,"Connect to Wallet",HM)}),qM={$:"Finished"},GM={$:"NotStarted"},zM=r(function(e,t){var r=L(ZN(t),ZN(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?GM:R(n,a)?$M:qM}),YM=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),WM=r(function(e,t){return l(YM,yr,e,t)}),JM=a(function(e,t,r,n){var a=MR(f(Vd,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+sR(r.factory),i=MR(r.parameters.tradeAmount)+" "+sR(r.factory),o=f(vN,yr,f(WM,3,f(jN,M([zS(Sk(18))]),OM))),u=f(Da,yk(M([WI(l(jI,1,0,0))])),Ff),s=R(e,r.state.phase),c=f(vg,YC(r),f(Ao,function(e){return e.address},Td(n))),d=s?Rk:gR,h=oN(M([WI(d),Yk(18),qk])),p=VU(r.terms.price),g=s?l(hk,0,226,255):l(hk,16,7,234),v=f(Da,yk(M([WI(g)])),Ff),y=MR(r.parameters.buyerDeposit)+" "+sR(r.factory),m=r.parameters.abortPunishment,b=MR(m)+" "+sR(r.factory),C=MR(f(MM,r.parameters.buyerDeposit,m))+" "+sR(r.factory),E=MR(f(MM,r.parameters.tradeAmount,m))+" "+sR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([Ff("Your "),u("burnable deposit"),Ff(" of "),v(y),Ff(" is now held in this contract, and your offer to buy "),v(i),Ff(" for "),v(p),Ff(" is now listed in the marketplace.")]),M([Ff("If another user likes your offer, they can become the Seller by depositing the full "),v(i),Ff(" into this contract.")]),M([Ff("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),Ff(" to you.")])])):f(xa,h,M([M([Ff("Your offer to sell the "),v(i),Ff(" held in this contract for "),v(p),Ff(" is now listed in the marketplace.")]),M([Ff("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),Ff(" of 1/3 of the trade amount "),v("("+y+")"),Ff(" into this contract.")]),M([Ff("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),Ff(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([Ff("You must now pay the Seller "),v(p),Ff(" via the Fiat Payment Method, "),f(yk,M([qk]),Ff("and then click ")),u("Confirm Payment"),Ff(" before the payment window runs out. Use the chat to coordinate.")]),M([Ff("If you abort the trade, or do not confirm payment before this time is up, "),v(b),Ff(" (1/4 of the "),u("burnable deposit"),Ff(") will be "),u("burned"),Ff(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Ff(" to the Seller, "),v(C),Ff(" to you).")]),M([Ff("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),Ff(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([Ff("Work and communicate with the Buyer to receive "),v(p),Ff(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([Ff("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),Ff(" (1/4 of the "),u("burnable deposit"),Ff(") will be "),u("burned"),Ff(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Ff(" to you, "),v(C),Ff(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([Ff("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),Ff(" will be released to you.")]),M([Ff("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),Ff(" In this case the "),v(a),Ff(" will be lost to both parties.")]),M([Ff("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([Ff("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([Ff("So, have you recieved the "),v(p),Ff("? If so, you can click "),v("Release Everything"),Ff(".")]),M([Ff("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),Ff(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([Ff("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([Ff("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([Ff("The Seller has deposited "),v(i),Ff(" into this contract, and offers to sell it for "),v(p),Ff(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),Ff(" into this contract by clicking "),u("Deposit and Commit to Trade"),Ff(".")]),M([Ff("If the trade is successful, the combined "+sR(r.factory)+" balance "),v("("+a+")"),Ff(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,Ff(" for both parties (see Payment Window for more on this).")]),M([Ff("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),Ff(" within the payment window.")])])):f(xa,h,M([M([Ff("The Buyer is offering to buy "),v(i),Ff(" for "),v(p),Ff(", and has deposited "),v(y),Ff(" into this contract as a "),u("burnable deposit"),Ff(". To become the Seller, deposit "),v(i),Ff(" into this contract by clicking "),u("Deposit and Commit to Trade"),Ff(".")]),M([Ff("When you receive the "),v(p),Ff(" from the Buyer, the combined "+sR(r.factory)+" balance "),v("("+a+")"),Ff(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,Ff(" for both parties (see Payment Window for more on this).")]),M([Ff("Don't commit unless you can receive "),v(p),Ff(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([Ff("During this phase, the Buyer is expected to transfer "),v(p),Ff(" to the Seller, as described in Fiat Payment Method, "),f(yk,M([qk]),Ff("and ")),u("Confirm the Payment "),Ff(" before the payment window runs out. This would move the trade to the final phase.")]),M([Ff("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),Ff(" (1/4 of the "),u("burnable deposit"),Ff(" amount) will be "),u("burned"),Ff(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Ff(" to the Seller, "),v(C),Ff(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([Ff("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([Ff("If the Seller can verify he has received the "),v(p),Ff(", he will probably release the total balance of "),v(i),Ff(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),Ff(".")]),M([Ff("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),Ff(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(hN,M([QS(bk),zS(bk),DN(20),nN(30)]),M([f(vN,M([QS(bk)]),M([f(yk,M([Yk(24),qk,WI(g),f_]),Ff(T))])),f(hN,M([QS(bk),_N,nN(13)]),w),f(yk,M([fN]),function(){switch(f(zM,r,e).$){case"Active":return l(jM,t,r,n);case"NotStarted":return f(yk,M([Yk(20),qk,FD,WI(XN)]),Ff("Phase not yet started."));default:return f(yk,M([Yk(20),qk,FD]),Ff("Phase no longer active."))}}())]))}),QM=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},XM=MN({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),ZM=MN({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),eF={$:"None"},tF=eF,rF=MN({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),nF=function(e){switch(e.$){case"Open":return rF;case"Committed":return XM;case"Judgment":return ZM;default:return tF}},aF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),iF=a(function(e,t,r,n){return d(aF,e,t,r,n)}),oF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},uF=function(e){return function(e){return d(iF,e.red,e.green,e.blue,e.alpha)}(oF(e))},sF=function(e){return{$:"Circle",a:e}},cF=sF,fF=d(aF,0,0,0,1),lF={$:"Flat"},dF={$:"Sharp"},hF=function(e){return{$:"Uniform",a:e}},pF=hF,gF={cap:lF,dashPattern:yr,dashPhase:0,fill:pF(fF),join:dF,thickness:2},vF=n(function(e,t,r){return D(gF,{dashPattern:e,fill:r,thickness:t})}),yF=vF(yr),mF={$:"Transparent"},bF=mF,CF=f(yF,0,bF),EF=r(function(e,t){return{$:"Shape",a:e,b:t}}),SF=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},TF=function(e){return f(Da,SF,EF(e))},wF=function(e){return TF(L(e,CF))},IF=function(e){return L(-e.a,-e.b)},AF=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),BF=r(function(e,t){return f(AF,IF(e(t)),t)}),kF=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},NF=r(function(e,t){return{$:"Path",a:e,b:t}}),RF=kr,$F=Nr,_F=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=$F(n),i=RF(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},LF=function(e){return xa(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)})},xF=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(LF,e,M([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),PF=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},DF=function(e){var t=UF(e.basic),r=kF(f(xa,_F(e),t)),n=r.a,a=r.b;return{toBottom:-f(hc,0,qw(a)),toLeft:-f(hc,0,qw(n)),toRight:f(hc,0,jw(n)),toTop:f(hc,0,jw(a))}},UF=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(xF,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(xF,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(xF,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(LF,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(NF,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(LF,R(C,lF)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(xF,0,E);case"Group":var S=e.a;return f(LF,0,$v(f(xa,f(Io,DF,PF),S)));default:var T=e.b;return f(LF,0,PF(DF(T)))}},OF=function(e){var t=DF(e);return t.toTop+t.toBottom},MF=function(e){var t=DF(e);return L(-t.toLeft,t.toTop)},FF=function(e){var t=DF(e);return t.toLeft+t.toRight},VF=En("http://www.w3.org/2000/svg"),KF=VF("svg"),HF=Nn("height"),jF=Nn("version"),qF=Nn("width"),GF=VF("circle"),zF=VF("ellipse"),YF=VF("foreignObject"),WF=VF("g"),JF=VF("image"),QF=VF("polygon"),XF=VF("polyline"),ZF=VF("rect"),eV=ZT,tV=VF("text"),rV=Nn("id"),nV=Nn("points"),aV=Nn("r"),iV=Nn("rx"),oV=Nn("ry"),uV=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},sV=function(e){return{$:"Group",a:e}},cV=Nn("dominant-baseline"),fV=Nn("fill"),lV=Nn("fill-opacity"),dV=Nn("font-family"),hV=Nn("font-size"),pV=Nn("font-style"),gV=Nn("font-variant"),vV=Nn("font-weight"),yV=Nn("opacity"),mV=Nn("stroke"),bV=Nn("stroke-dasharray"),CV=Nn("stroke-dashoffset"),EV=Nn("stroke-linecap"),SV=Nn("stroke-linejoin"),TV=Nn("stroke-opacity"),wV=Nn("stroke-width"),IV=Nn("text-anchor"),AV=Nn("text-decoration"),BV=Nn("transform"),kV=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},NV=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},RV=n(function(e,t,r){return d(aF,e,t,r,1)}),$V=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Fg(1e4*e)/100};return Ql(M(["rgba(",YT(i(t)),"%,",YT(i(r)),"%,",YT(i(n)),"%,",YT(function(e){return Fg(1e3*e)/1e3}(a)),")"]))},_V=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},LV=function(e){var t=_V(e),r=t.red,n=t.green,a=t.blue;return $V(l(RV,r,n,a))},xV=function(e){if("Uniform"===e.$){var t=e.a;return LV(t)}return"none"},PV=function(e){var t=_V(e),r=t.alpha;return YT(r)},DV=function(e){if("Uniform"===e.$){var t=e.a;return PV(t)}return"0"},UV=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},OV=Br,MV=function(e){var t=YT(e.scale.b),r=YT(e.scale.a),n=YT(-e.rotation/2/OV*360),a=YT(-e.shift.b),i=YT(e.shift.a);return Ql(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},FV=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([mV(xV(r.fill)),TV(DV(r.fill)),wV(YT(r.thickness)),EV(kV(r.cap)),SV(UV(r.join)),fV("none"),yV(YT(e.opacity)),BV(MV(e)),CV(Ni(r.dashPhase)),bV(NV(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([fV(xV(a)),lV(DV(a)),mV(xV(r.fill)),TV(DV(r.fill)),wV(YT(r.thickness)),EV(kV(r.cap)),SV(UV(r.join)),yV(YT(e.opacity)),BV(MV(e)),CV(Ni(r.dashPhase)),bV(NV(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([fV(xV(hF(o.color))),dV(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),hV(Ni(o.size)),vV(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"}}()),pV(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),gV(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),AV(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),IV("middle"),cV("middle"),BV(MV(e))]);default:return M([BV(MV(e))])}},VV=Nn("x"),KV=Nn("y"),HV=r(function(e,t){return M([qF(YT(e)),HF(YT(t)),VV(YT(-e/2)),KV(YT(-t/2))])}),jV=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([YT(t),YT(-r)]))},e))},qV=Vk,GV=r(function(e,t){return f(e,t.a,t.b)}),zV=function(e){return f(xa,GV(qV),e)},YV=function(e){e:for(;;){var t=f(hc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(XF,U(M([rV(t),nV(jV(i))]),U(FV(e),zV(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(QF,U(M([rV(t),nV(jV(i))]),U(FV(e),zV(e.handlers))),yr);case"Circle":var c=s.a;return f(GF,U(M([rV(t),aV(YT(c))]),U(FV(e),zV(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(zF,U(M([rV(t),iV(YT(d)),oV(YT(h))]),U(FV(e),zV(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(ZF,U(M([rV(t),iV(YT(c)),oV(YT(c))]),U(f(HV,p,g),U(FV(e),zV(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(NF,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(tV,U(M([rV(t)]),U(FV(e),zV(e.handlers))),M([eV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(JF,U(M([rV(t),uV(C)]),U(f(HV,p,g),U(FV(e),zV(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(YF,U(M([rV(t)]),U(f(HV,p,g),U(FV(e),zV(e.handlers)))),M([S]));case"Group":var T=n.a;return f(WF,f(ka,rV(t),U(FV(e),zV(e.handlers))),l(Ra,r(function(e,t){return f(ka,YV(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:sV(M([w,I]))});e=v;continue e}}},WV=r(function(e,t){var r=e.a,n=e.b,a=YT(r),i=YT(n);return f(CT,yr,M([f(KF,M([qF(a),HF(i),jF("1.1")]),M([YV(t)]))]))}),JV=function(e){return f(WV,L(FF(e),OF(e)),f(BF,MF,e))},QV=r(function(e,t){var r=nF(e),n=function(){switch(t.$){case"NotStarted":return l(hk,10,33,108);case"Active":return l(hk,0,100,170);default:return l(hk,1,129,104)}}(),a=CL(JV(f(wF,pF(uF(n)),cF(50))));return f(yk,M([Zk,m$(f(jN,M([Zk,_N,zS(Sk(60))]),r))]),a)}),XV=function(e){var t=M([FD,qk,Yk(20)]);switch(e.$){case"Active":return f(yk,U(t,M([WI(Jk)])),Ff("Active"));case"NotStarted":return f(yk,U(t,M([WI(XN)])),Ff("Not Started"));default:return f(yk,t,Ff("Finished"))}},ZV=n(function(e,t,r){var n=f(zM,t,e),a=function(){return"Active"===n.$?l(hk,0,226,255):gR}(),i=f(yk,M([WI(a),Yk(20),qk,Zk]),Ff(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 Ck;switch(n.$){case"NotStarted":return d($R,M([Zk]),M([Yk(22),zN]),L(gR,aR),f(lR,e,t));case"Active":var a=f(hR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(OR,M([Zk]),M([Yk(22),zN]),L(Rk,aR),i)}return f(hN,M([Zk,nN(10)]),M([f(yk,M([Zk]),Ff(QM(e))),f(oO,"Poke",yE(pE))]));default:return f(yk,M([zS(Sk(1))]),Ck)}}();return f(hN,M([DN(20),nN(10),zS(bk)]),M([f(yk,M([v$,Zk]),i),f(yk,M([zS(bk),Zk]),f(yk,M([_N]),f(QV,e,n))),f(hN,M([nN(10),X$,Zk]),M([f(yk,M([Zk]),XV(n)),o]))]))}),eK=o(function(e,t,r,n,a,i){var o=f(zM,r,t),u=f(yk,M([DN(10),QS(bk),zS(bk)]),d(JM,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return ml(0)}}(),c=l(ZV,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(dR,f(Ym,r.state.phaseStartTime,s),i);default:ml(0)}}(),f(yk,M([zS(bk),QS(Sk(1)),wk(function(){return"Active"===o.$?l(jI,0,0,1):aR}())]),Ck)),p=a?f(vN,U(DM(e),U(R(o,$M)?LM:UM,M([QS(bk)]))),M([c,h,u])):f(vN,U(DM(e),U(R(o,$M)?LM:UM,M([Dk,Hk(_M(t))]))),M([c]));return!e&&R(o,$M)?f(hN,M([QS(bk),nN(20),EN({bottom:20,left:0,right:0,top:0})]),M([p,RM(r.terms.paymentMethods)])):p}),tK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(vN,M([Zk,Ok(12),DN(30),nN(10),wk(AM),Yk(24),qk,WI(Rk)]),M([Ff("Trade "+NM(t.state.closedReason)),kM])):e?f(hN,M([QS(bk),nN(10)]),M([f(vN,M([QS(bk),zS(WS),nN(20)]),M([p(eK,e,jg,t,n,R(r,jg),a),p(eK,e,Rb,t,n,R(r,Rb),a),p(eK,e,$b,t,n,R(r,$b),a)])),RM(t.terms.paymentMethods)])):f(hN,M([QS(bk),zS(WS),nN(20)]),M([p(eK,e,jg,t,n,R(r,jg),a),p(eK,e,Rb,t,n,R(r,Rb),a),p(eK,e,$b,t,n,R(r,$b),a)]))}),rK=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(hN,M([QS(bk),zS(bk),nN(40)]),M([h(IM,t,i,n.wallet,r,n.showStatsModal),f(yk,M([QS(bk),f(Lk,40,0),nN(40)]),h(tK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(yk,M([Zk,_N,Yk(30)]),Ff("Loading trade info..."));default:return f(yk,M([Zk,_N,Yk(30)]),Ff("Invalid trade"))}}(),M([MU(n),jU(n)]))}),nK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),aK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(VD,yr);case"CreateModel":var n=r.a;return L(f(Yi,fy,RD(n)),yr);case"TradeModel":var a=r.a;return l(nK,Yi(hy),xa(Yi(hy)),d(rK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,FS,l(mU,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,DS,l(n$,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(yk,M([QS(bk),zS(bk),Ok(10)]),n),a)}),iK=function(e){return{$:"DismissNotice",a:e}},oK=function(e){return f(B$,ZD,eU(e))},uK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(jI,1,1,1):l(jI,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(hk,100,200,255);case"Caution":return l(hk,255,188,0);case"Error":return l(hk,255,70,70);default:return l(hk,200,200,200)}}(),o=f(yk,M([fN,v$,k$(5),oK(5)]),f$(iK(t)));return f(yk,M([wk(i),Ok(10),DN(8),QS(bk),GR(1),jR(d(mN,0,0,0,.15)),XP]),f(hN,M([nN(4),QS(bk)]),f(Bi,r(function(e,t){return f(oN,M([QS(bk),WI(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},sK=function(e){return R(e,yr)?yr:M([f(hN,M([tU(20),k$(20),nN(10),fN,X$,QS(Sk(300)),Yk(15)]),f(xa,uK,f(Yf,function(e){return R(e.b.align,Uf)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(hN,M([oK(20),aL(100),nN(10),f_,v$,QS(Sk(300)),Yk(15)]),f(xa,uK,f(Yf,function(e){return R(e.b.align,JA)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},cK=r(function(e,t){var r=f(aK,e,t),n=r.a,a=r.b;return L(f(hN,M([xR(Ik),m$(yN(t)),QS(bk),zS(bk),DN(30)]),M([f(yk,M([zS(Sk(50))]),Ck),n])),U(a,sK(t.userNotices)))}),fK=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),lK=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),dK={$:"AllowHover"},hK={$:"Layout"},pK={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(HI,155/255,203/255,1,1),offset:L(0,0),size:3})},gK=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?pK:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?dK:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?hK:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},vK=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(rT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),rT);case"Text":var a=t.a;return uI(a);default:return uI("")}}),yK=n(function(e,t,r){var n=gK(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?fK(n):lK(n)}();return f(vK,a,d(FI,rT,vk,t,eT(M([r]))))}),mK=NT(5),bK=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),CK={$:"SansSerif"},EK=function(e){return{$:"Typeface",a:e}},SK=Y,TK=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",SK(Ml(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",SK(Ml(t)));default:var t=e.a.name;return f(Ri,"-",SK(Ml(t)))}}())}),wK=function(){var e=M([EK("Open Sans"),EK("Helvetica"),EK("Verdana"),CK]);return M([f(zI,Tk,l(GI,"bg-color-"+YI(d(HI,1,1,1,0)),"background-color",d(HI,1,1,1,0))),f(zI,qI,l(GI,"font-color-"+YI(d(HI,0,0,0,1)),"color",d(HI,0,0,0,1))),f(zI,Gk,zk(20)),f(zI,mK,f(bK,l(Ra,TK,"font-",e),e))])}(),IK=n(function(e,t,r){var n=e.options;return l(yK,n,f(ka,VI(f(Ri," ",M([oT.root,oT.any,oT.single]))),U(wK,t)),r)}),AK=IK({options:yr}),BK=function(e){return f(zI,mK,f(bK,l(Ra,TK,"ff-",e),e))},kK=CK,NK=EK,RK=function(e){return{body:M([function(){var t=f(cK,e.screenWidth,e),r=t.a,n=t.b,a=U(M([QS(bk),zS(bk),BK(M([NK("Soleil"),kK]))]),f(xa,m$,n));return f(AK,a,r)}()]),title:"DAIHard"}},$K=Ht,_K=$K({init:pB,onUrlChange:dk,onUrlRequest:lk,subscriptions:fk,update:OA,view:RK});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:_K(f(qo,function(e){return f(qo,function(t){return f(qo,function(r){return Fi({height:r,networkId:t,width:e})},f(gh,"height",BC))},f(gh,"networkId",BC))},f(gh,"width",BC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/docs/static/js/main-8b815b70735337f0c99f.js b/docs/static/js/main-8b815b70735337f0c99f.js deleted file mode 100644 index dbd2d9c..0000000 --- a/docs/static/js/main-8b815b70735337f0c99f.js +++ /dev/null @@ -1,7 +0,0 @@ -!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/DAIHard/",t(t.s=43)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t,n,a,i){function o(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(l.isArrayBuffer(e)||l.isArrayBufferView(e))if(void 0!==i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(i=Date.now(),s(e)):(a.push(e),1===a.length&&u.setAttribute("a",o=!o))}}l.nextTick=l.setImmediate}(),l.isNodejs=void 0!==t&&t.versions&&t.versions.node,l.globalScope=function(){return l.isNodejs?a:"undefined"==typeof self?window:self}(),l.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},l.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},l.isArrayBufferView=function(e){return e&&l.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},l.ByteBuffer=u,l.ByteStringBuffer=u;l.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},l.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},l.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},l.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},l.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},l.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},l.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(l.encodeUtf8(e))},l.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},l.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},l.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},l.ByteStringBuffer.prototype.putInt=function(e,t){o(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},l.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},l.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},l.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},l.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},l.ByteStringBuffer.prototype.copy=function(){var e=l.createBuffer(this.data);return e.read=this.read,e},l.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},l.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},l.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},l.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},l.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},l.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},l.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},l.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},l.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},l.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},l.DataBuffer.prototype.putInt=function(e,t){o(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},l.DataBuffer.prototype.putSignedInt=function(e,t){return o(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},l.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},l.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},l.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},l.DataBuffer.prototype.copy=function(){return new l.DataBuffer(this)},l.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},l.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},l.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},l.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},l.xorBytes=function(e,t,r){for(var n="",a="",i="",o=0,u=0;r>0;--r,++o)a=e.charCodeAt(o)^t.charCodeAt(o),u>=10&&(n+=i,i="",u=0),i+=String.fromCharCode(a),++u;return n+=i},l.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";l.encode64=function(e,t){for(var r,n,a,i="",o="",u=0;u>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,a,i="",o=0;o>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==a&&(i+=String.fromCharCode((3&n)<<6|a)));return i},l.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},l.decodeUtf8=function(e){return decodeURIComponent(escape(e))},l.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:f.encode,decode:f.decode}},l.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},l.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var a,i,o,u,s=0,c=r;s>4,64!==o&&(n[c++]=(15&i)<<4|o>>2,64!==u&&(n[c++]=(3&o)<<6|u));return t?c-r:n.subarray(0,c)},l.binary.base58.encode=function(e,t){return l.binary.baseN.encode(e,p,t)},l.binary.base58.decode=function(e,t){return l.binary.baseN.decode(e,p,t)},l.text={utf8:{},utf16:{}},l.text.utf8.encode=function(e,t,r){e=l.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i0?(a=r[n].substring(0,o),i=r[n].substring(o+1)):(a=r[n],i=null),a in t||(t[a]=[]),a in Object.prototype||null===i||t[a].push(unescape(i))}return t};return void 0===e?(null===S&&(S="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=S):t=r(e),t},l.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var a=t.split("/");return a.length>0&&""===a[0]&&a.shift(),{pathString:t,queryString:r,path:a,query:""===r?{}:l.getQueryVariables(r)}},l.makeRequest=function(e){var t=l.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},l.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},l.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,a=t.length;n0&&i.push(r),o=n.lastIndex;var u=t[0][1];switch(u){case"s":case"o":a");break;case"%":i.push("%");break;default:i.push("<%"+u+"?>")}}return i.push(e.substring(o)),i.join("")},l.formatNumber=function(e,t,r,n){var a=e,i=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,u=void 0===n?".":n,s=a<0?"-":"",c=parseInt(a=Math.abs(+a||0).toFixed(i),10)+"",f=c.length>3?c.length%3:0;return s+(f?c.substr(0,f)+u:"")+c.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+u)+(i?o+Math.abs(a-c).toFixed(i).slice(2):"")},l.formatSize=function(e){return e=e>=1073741824?l.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?l.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?l.formatNumber(e/1024,0)+" KiB":l.formatNumber(e,0)+" bytes"},l.bytesFromIP=function(e){return-1!==e.indexOf(".")?l.bytesFromIPv4(e):-1!==e.indexOf(":")?l.bytesFromIPv6(e):null},l.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=l.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(i)}if(r.length>0){var s=r[n];s.end-s.start>0&&(t.splice(s.start,s.end-s.start+1,""),0===s.start&&t.unshift(""),7===s.end&&t.push(""))}return t.join(":")},l.estimateCores=function(e,t){function r(e,o,u){if(0===o){var s=Math.floor(e.reduce(function(e,t){return e+t},0)/e.length);return l.cores=Math.max(1,s),URL.revokeObjectURL(i),t(null,l.cores)}n(u,function(t,n){e.push(a(u,n)),r(e,o-1,u)})}function n(e,t){for(var r=[],n=[],a=0;au.st&&a.sta.st&&u.st0)return l.cores=navigator.hardwareConcurrency,t(null,l.cores);if("undefined"==typeof Worker)return l.cores=1,t(null,l.cores);if("undefined"==typeof Blob)return l.cores=2,t(null,l.cores);var i=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}function a(e,t,r,i){var s;n(e,t,2);var c=e.getByte();t--;var f=192&c,l=31&c;s=e.length();var d=u(e,t);if(t-=s-e.length(),void 0!==d&&d>t){if(i.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=e.length(),h.remaining=t,h.requested=d,h}d=t}var p,g,v=32==(32&c);if(v)if(p=[],void 0===d)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}s=e.length(),p.push(a(e,t,r+1,i)),t-=s-e.length()}else for(;d>0;)s=e.length(),p.push(a(e,d,r+1,i)),t-=s-e.length(),d-=s-e.length();if(void 0===p&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&(g=e.bytes(d)),void 0===p&&i.decodeBitStrings&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&d>1){var y=e.read,m=t,b=0;if(l===o.Type.BITSTRING&&(n(e,t,1),b=e.getByte(),t--),0===b)try{s=e.length();var C={verbose:i.verbose,strict:!0,decodeBitStrings:!0},E=a(e,t,r+1,C),S=s-e.length();t-=S,l==o.Type.BITSTRING&&S++;var T=E.tagClass;S!==d||T!==o.Class.UNIVERSAL&&T!==o.Class.CONTEXT_SPECIFIC||(p=[E])}catch(e){}void 0===p&&(e.read=y,t=m)}if(void 0===p){if(void 0===d){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=t}if(l===o.Type.BMPSTRING)for(p="";d>0;d-=2)n(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(d)}var w=void 0===g?null:{bitStringContents:g};return o.create(f,l,v,p,w)}var i=r(0);r(1),r(6);var o=e.exports=i.asn1=i.asn1||{};o.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},o.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},o.create=function(e,t,r,n,a){if(i.util.isArray(n)){for(var u=[],s=0;s1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?n.putBytes(e.value.substr(1)):n.putBytes(e.value);if(t.putByte(r),n.length()<=127)t.putByte(127&n.length());else{var s=n.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);t.putByte(128|c.length);for(var u=c.length-1;u>=0;--u)t.putByte(c.charCodeAt(u))}return t.putBuffer(n),t},o.oidToDer=function(e){var t=e.split("."),r=i.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var n,a,o,u,s=2;s>>=7,n||(u|=128),a.push(u),n=!1}while(o>0);for(var c=a.length-1;c>=0;--c)r.putByte(a[c])}return r},o.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)r=e.getByte(),n<<=7,128&r?n+=127&r:(t+="."+(n+r),n=0);return t},o.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),u=0;if(e.length>11){var s=e.charAt(10),c=10;"+"!==s&&"-"!==s&&(u=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,0),c&&("+"===(s=e.charAt(c))||"-"===s)){var f=parseInt(e.substr(c+1,2),10),l=parseInt(e.substr(c+4,2),10),d=60*f+l;d*=6e4,"+"===s?t.setTime(+t-d):t.setTime(+t+d)}return t},o.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),u=parseInt(e.substr(12,2),10),s=0,c=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var l=e.length-5,d=e.charAt(l);if("+"===d||"-"===d){c=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10),c*=6e4,"+"===d&&(c*=-1),f=!0}return"."===e.charAt(14)&&(s=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,s),t.setTime(+t+c)):(t.setFullYear(r,n,a),t.setHours(i,o,u,s)),t},o.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},o.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},o.validate=function(e,t,r,n){var a=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(a=!0,t.value&&i.util.isArray(t.value))for(var u=0,s=0;a&&s0&&(n+="\n");for(var a="",u=0;u1?n+="0x"+i.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?n+=" (1 unused bit shown)":d>1&&(n+=" ("+d+" unused bits shown)")}}else e.type===o.Type.OCTETSTRING?(s.test(e.value)||(n+="("+e.value+") "),n+="0x"+i.util.bytesToHex(e.value)):e.type===o.Type.UTF8?n+=i.util.decodeUtf8(e.value):e.type===o.Type.PRINTABLESTRING||e.type===o.Type.IA5String?n+=e.value:s.test(e.value)?n+="0x"+i.util.bytesToHex(e.value):0===e.value.length?n+="[null]":n+=e.value}return n}},function(e,t,r){var n=r(0);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){function n(e,t){var r=function(){return new s.aes.Algorithm(e,t)};s.cipher.registerAlgorithm(e,r)}function a(){p=!0,l=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;c=new Array(256),f=new Array(256),d=new Array(4),h=new Array(4);for(var t=0;t<4;++t)d[t]=new Array(256),h[t]=new Array(256);for(var r,n,a,i,o,u,s,g=0,v=0,t=0;t<256;++t){i=v^v<<1^v<<2^v<<3^v<<4,i=i>>8^255&i^99,c[g]=i,f[i]=g,o=e[i],r=e[g],n=e[r],a=e[n],u=o<<24^i<<16^i<<8^i^o,s=(r^n^a)<<24^(g^a)<<16^(g^n^a)<<8^g^r^a;for(var y=0;y<4;++y)d[y][g]=u,h[y][i]=s,u=u<<24|u>>>8,s=s<<24|s>>>8;0===g?g=v=1:(g=r^e[e[e[r^a]]],v^=e[e[v]])}}function i(e,t){for(var r,n=e.slice(0),a=1,i=n.length,o=i+6+1,u=g*o,s=i;s>>16&255]<<24^c[r>>>8&255]<<16^c[255&r]<<8^c[r>>>24]^l[a]<<24,a++):i>6&&s%i==4&&(r=c[r>>>24]<<24^c[r>>>16&255]<<16^c[r>>>8&255]<<8^c[255&r]),n[s]=n[s-i]^r;if(t){var f,d=h[0],p=h[1],v=h[2],y=h[3],m=n.slice(0);u=n.length;for(var s=0,b=u-g;s>>24]]^p[c[f>>>16&255]]^v[c[f>>>8&255]]^y[c[255&f]];n=m}return n}function o(e,t,r,n){var a,i,o,u,s,l=e.length/4-1;n?(a=h[0],i=h[1],o=h[2],u=h[3],s=f):(a=d[0],i=d[1],o=d[2],u=d[3],s=c);var p,g,v,y,m,b,C;p=t[0]^e[0],g=t[n?3:1]^e[1],v=t[2]^e[2],y=t[n?1:3]^e[3];for(var E=3,S=1;S>>24]^i[g>>>16&255]^o[v>>>8&255]^u[255&y]^e[++E],b=a[g>>>24]^i[v>>>16&255]^o[y>>>8&255]^u[255&p]^e[++E],C=a[v>>>24]^i[y>>>16&255]^o[p>>>8&255]^u[255&g]^e[++E],y=a[y>>>24]^i[p>>>16&255]^o[g>>>8&255]^u[255&v]^e[++E],p=m,g=b,v=C;r[0]=s[p>>>24]<<24^s[g>>>16&255]<<16^s[v>>>8&255]<<8^s[255&y]^e[++E],r[n?3:1]=s[g>>>24]<<24^s[v>>>16&255]<<16^s[y>>>8&255]<<8^s[255&p]^e[++E],r[2]=s[v>>>24]<<24^s[y>>>16&255]<<16^s[p>>>8&255]<<8^s[255&g]^e[++E],r[n?1:3]=s[y>>>24]<<24^s[p>>>16&255]<<16^s[g>>>8&255]<<8^s[255&v]^e[++E]}function u(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="AES-"+r;t=e.decrypt?s.cipher.createDecipher(n,e.key):s.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof s.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var s=r(0);r(15),r(23),r(1),e.exports=s.aes=s.aes||{},s.aes.startEncrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!1,mode:n});return a.start(t),a},s.aes.createEncryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!1,mode:t})},s.aes.startDecrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!0,mode:n});return a.start(t),a},s.aes.createDecryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!0,mode:t})},s.aes.Algorithm=function(e,t){p||a();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return o(r._w,e,t,!1)},decrypt:function(e,t){return o(r._w,e,t,!0)}}}),r._init=!1},s.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(s.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=s.util.createBuffer();for(var n=0;n>>=2;for(var n=0;n65&&-1!==o){var u=t[o];","===u?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+u+t.substr(o+1),i=a-o-1,o=-1,++a}else" "!==t[a]&&"\t"!==t[a]&&","!==t[a]||(o=a);return t}function a(e){return e.replace(/^\s+/,"")}var i=r(0);r(1);var o=e.exports=i.pem=i.pem||{};o.encode=function(e,t){t=t||{};var r,a="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=n(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=n(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=n(r)),e.headers)for(var o=0;ot.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),a=n.util.createBuffer(),c=o.length();for(var s=0;s=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,s=e.h4,f=0;f<16;++f)n=r.getInt32(),t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<20;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<32;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<40;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<60;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i&o|u&(i^o),n=(a<<5|a>>>27)+c+s+2400959708+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<80;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+3395469782+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,e.h4=e.h4+s|0,l-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=o,o.create=function(){s||n();var e=null,t=i.util.createBuffer(),r=new Array(80),o={algorithm:"sha1",blockLength:64,digestLength:20,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};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},o};var u=null,s=!1},function(e,t,r){"use strict";(function(e){function n(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),i.alloc(+e)}function v(e,t){if(i.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(n)return j(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return _(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return $(this,t,r);case"base64":return B(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,a){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:C(e,t,r,n,a);if("number"==typeof t)return t&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):C(e,[t],r,n,a);throw new TypeError("val must be string, number or Buffer")}function C(e,t,r,n,a){function i(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,u=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,u/=2,s/=2,r/=2}var c;if(a){var f=-1;for(c=r;cu&&(r=u-s),c=r;c>=0;c--){for(var l=!0,d=0;da&&(n=a):n=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(a+u<=r){var s,c,f,l;switch(u){case 1:i<128&&(o=i);break;case 2:s=e[a+1],128==(192&s)&&(l=(31&i)<<6|63&s)>127&&(o=l);break;case 3:s=e[a+1],c=e[a+2],128==(192&s)&&128==(192&c)&&(l=(15&i)<<12|(63&s)<<6|63&c)>2047&&(l<55296||l>57343)&&(o=l);break;case 4:s=e[a+1],c=e[a+2],f=e[a+3],128==(192&s)&&128==(192&c)&&128==(192&f)&&(l=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&f)>65535&&l<1114112&&(o=l)}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),a+=u}return N(n)}function N(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var a="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,a,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function D(e,t,r,n){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-r,2);a>>8*(n?a:1-a)}function U(e,t,r,n){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-r,4);a>>8*(n?a:3-a)&255}function O(e,t,r,n,a,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,a){return a||O(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,a){return a||O(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(e,t,r,n,52,8),r+8}function V(e){if(e=K(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function K(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function j(e,t){t=t||1/0;for(var r,n=e.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(e){for(var t=[],r=0;r>8,a=r%256,i.push(a),i.push(n);return i}function z(e){return J.toByteArray(V(e))}function Y(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function W(e){return e!==e}/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r,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,"'"+S(t,!0)+"'");if("string"==typeof t)return I(e,'"'+S(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(E(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return T(e,"Set")+B(e,".fromList")+" "+E(e,ka(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return T(e,"Dict")+B(e,".fromList")+" "+E(e,Aa(t));if("Array_elm_builtin"===r)return T(e,"Array")+B(e,".fromList")+" "+E(e,Ta(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=E(e,t.a),t=t.b);t.b;t=t.b)n+=","+E(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=E(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)+" = "+E(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return k(e,"")}function S(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=_(e,t,0,n);a&&(r=n.pop());a=_(r.a,r.b,0,n));return a}function _(e,t,r,n){if(r>100)return n.push(x(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=ka(e),t=ka(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Aa(e),t=Aa(t));for(var a in e)if(!_(e[a],t[a],r+1,n))return!1;return!0}function L(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 Ma(n)?n:li(f(gi,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(!Ma(n))return li(f(pi,o,n.a));i=M(x(o,n.a),i)}return di(_a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=gn[e].r,o=Le(0);return gn[e].b=o,gn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=be(i(t.a)),s=0;s0&&vt(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 vt(r,0,n,t):((h?mt(l,d):l===d)||vt(r,2,n,d),void yt(p,g,r,n+1));case 0:return void(e.a!==t.a&&vt(r,3,n,t.a));case 1:return void bt(e,t,r,n,Et);case 2:return void bt(e,t,r,n,St);case 3:if(e.h!==t.h)return void vt(r,0,n,t);var v=Ct(e.d,t.d);v&&vt(r,4,n,v);var y=t.i(e.g,t.g);return void(y&&vt(r,5,n,y))}}}function mt(e,t){for(var r=0;ru?vt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&&vt(r,8,n,{w:a,x:o,y:k})}function Tt(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 yt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}Tt(e,t,r+Pn,n,a,i)}function wt(e,t,r,n,a){var i=e[r];if(!i){var o=vt(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 yt(n,i.z,u,a),void vt(t,9,a,{w:u,A:i})}wt(e,t,r+Pn,n,a)}function It(e,t,r,n){At(e,t,r,0,0,t.b,n)}function At(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)It(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&At(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&&At(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 At(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 Bt(e,t,r,n){return 0===r.length?e:(It(e,t,r,n),kt(e,r))}function kt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(Qh,o,function(e){return ci(Xh(e)?u+", "+e.a:u)},t)}}return t}function Kt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Be(f(ep,e,x(r,op({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Be(f(ep,e,x(r,ip({received:n.loaded,size:n.lengthComputable?ci(n.total):fi}))))})}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=Dg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?wg(o):Tg(a)))}})},init:function(t){return l(e.init,t,qt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function qt(){return Dg(En.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(Ig(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(Bg,Ag,Ie(function(t){try{sa.location=e}catch(e){En.location.reload(!1)}}))}function Xt(e){try{return ci(decodeURIComponent(e))}catch(e){return fi}}function Zt(){return f(Ao,Pa(Os),f(Ao,bs,Us))}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 L(e,t)>=0}),r(function(e,t){var r=L(e,t);return r<0?Ca:r?wa:ba})),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)}),Er=(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 L(e(t),e(r))}))})),Sr=r(function(e,t){return F(V(t).sort(function(t,r){var n=f(e,t,r);return n===ba?0:n===Ca?-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),_r=Math.floor,Lr=Math.round,xr=(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})),Mn=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Fn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Vn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Kn=a(function(e,t,r,n){return e.setUint16(t,r,n),t+2}),Hn=a(function(e,t,r,n){return e.setUint32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),qn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),Gn=n(function(e,t,r){for(var n=0,a=r.byteLength,i=a-4;n<=i;n+=4)e.setUint32(t+n,r.getUint32(n));for(;n>>6&31)<<8|63&a),2):a<55296||56319>>12&15)<<8|a>>>6&63),e.setUint8(t+2,128|63&a),3):(a=1024*(a-55296)+r.charCodeAt(++n)-56320+65536,e.setUint32(t,4034953344|(a>>>18&7)<<24|(a>>>12&63)<<16|(a>>>6&63)<<8|63&a),4)}return t}),Yn=r(function(e,t){try{return ci(f(e,t,0).b)}catch(e){return fi}}),Wn=(r(function(e,t){return x(t+1,e.getInt8(t))}),n(function(e,t,r){return x(r+2,t.getInt16(r,e))}),n(function(e,t,r){return x(r+4,t.getInt32(r,e))}),r(function(e,t){return x(t+1,e.getUint8(t))})),Jn=(n(function(e,t,r){return x(r+2,t.getUint16(r,e))}),n(function(e,t,r){return x(r+4,t.getUint32(r,e))}),n(function(e,t,r){return x(r+4,t.getFloat32(r,e))}),n(function(e,t,r){return x(r+8,t.getFloat64(r,e))}),n(function(e,t,r){return x(r+e,new DataView(t.buffer,t.byteOffset+r,e))})),Qn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?ci(l):fi}a.push(d(Gd,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?ci(o):fi}return r(d(Gd,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(ap)}),i.addEventListener("timeout",function(){a(up)}),i.addEventListener("load",function(){a(Mt(r.expect.b,i))}),Xh(r.tracker)&&Kt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(rp(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 xe(t,n,e.init,e.update,e.subscriptions,function(t,r){var a=e.view,i=n&&n.node?n.node:N(0),o=Lt(i);return Ht(r,function(e){var r=a(e),n=gt(o,r);i=Bt(i,o,n,t),o=r})})}),a(function(e,t,r,n){return xe(t,n,e.init,e.update,e.subscriptions,function(t,r){var n=e.setup&&e.setup(t),a=e.view,i=En.title,o=En.body,u=Lt(o);return Ht(r,function(e){er=n;var r=a(e),s=Tn("body")(mr)(r.body),c=gt(u,s);o=Bt(o,u,c,t),u=s,er=0,i!==r.title&&(En.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(Bg,Ag,Ie(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Bg,Ag,Ie(function(){history.pushState({},"",t),e()}))})),oa=(r(function(e,t){return f(Bg,Ag,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 Ma(r)?ci(r.a):fi}),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=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),da=function(e){return{$:"GTag",a:e}},ha=function(e){return{$:"GotoRoute",a:e}},pa={$:"RequestBrowserNotificationPermission"},ga=function(e){return{$:"UserNotice",a:e}},va={$:"Web3Connect"},ya=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ma=r(function(e,t){return t(e)}),ba={$:"EQ"},Ca={$:"LT"},Ea=cr,Sa=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(Ea,o,r,n)}var a=t.a;return l(Ea,e,r,a)});return l(Ea,o,l(Ea,e,t,i),a)}),Ta=function(e){return l(Sa,Na,mr,e)},wa={$:"GT"},Ia=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(Ia,e,t,o)),c=i;e=u,t=s,r=c}}),Aa=function(e){return l(Ia,n(function(e,t,r){return f(Na,x(e,t),r)}),mr,e)},Ba=function(e){return l(Ia,n(function(e,t,r){return f(Na,e,r)}),mr,e)},ka=function(e){var t=e.a;return Ba(t)},Na=br,Ra=Tr,$a=n(function(e,t,r){for(;;){if(!r.b)return t;var n=r.a,a=r.b,i=e,o=f(e,n,t),u=a;e=i,t=o,r=u}}),_a=function(e){return l($a,Na,mr,e)},La=a(function(e,t,r,n){if(n.b){var a=n.a,i=n.b;if(i.b){var o=i.a,u=i.b;if(u.b){var s=u.a,c=u.b;if(c.b){var h=c.a,p=c.b;return f(e,a,f(e,o,f(e,s,f(e,h,r>500?l($a,e,t,_a(p)):d(La,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(La,e,t,0,r)}),Pa=r(function(e,t){return l(xa,r(function(t,r){return f(Na,e(t),r)}),mr,t)}),Da=r(function(e,t){return e(t)}),Ua=n(function(e,t,r){return e(t(r))}),Oa=function(e){return e},Ma=function(e){return"Ok"===e.$},Fa=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Va=$r,Ka=r(function(e,t){return xr(t)/xr(e)}),Ha=K,ja=Va(f(Ka,2,32)),qa=rr,Ga=d(Fa,0,ja,qa,qa),za=function(e){return{$:"Leaf",a:e}},Ya=function(e){return{$:"SubTree",a:e}},Wa=ar,Ja=r(function(e,t){for(;;){var r=f(Wa,32,e),n=r.a,a=r.b,i=f(Na,Ya(n),t);if(!a.b)return _a(i);var o=a,u=i;e=o,t=u}}),Qa=hr,Xa=function(e){return e.a},Za=r(function(e,t){for(;;){var r=Va(t/32);if(1===r)return f(Wa,32,e).a;var n=f(Ja,e,mr),a=r;e=n,t=a}}),ei=_r,ti=r(function(e,t){return L(e,t)>0?e:t}),ri=Ir,ni=wr,ai=m,ii=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=ei(f(Ka,32,r-1)),a=e?_a(t.nodeList):t.nodeList,i=f(Za,a,t.nodeListSize);return d(Fa,ai(t.tail)+r,f(ti,5,n*ja),i,t.tail)}return d(Fa,ai(t.tail),ja,qa,t.tail)}),oi=nr,ui=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ii,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=za(l(oi,32,t,e)),o=e,u=t-32,s=r,c=f(Na,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),si=r(function(e,t){if(e<=0)return Ga;var r=e%32,n=l(oi,r,e-r,t);return h(ui,t,e-r-32,e,mr,n)}),ci=function(e){return{$:"Just",a:e}},fi={$:"Nothing"},li=function(e){return{$:"Err",a:e}},di=function(e){return{$:"Ok",a:e}},hi=r(function(e,t){return{$:"Failure",a:e,b:t}}),pi=r(function(e,t){return{$:"Field",a:e,b:t}}),gi=r(function(e,t){return{$:"Index",a:e,b:t}}),vi=function(e){return{$:"OneOf",a:e}},yi=yr,mi=j,bi=function(e){var t=mi(e);return 97<=t&&t<=122},Ci=function(e){var t=mi(e);return t<=90&&65<=t},Ei=function(e){return bi(e)||Ci(e)},Si=function(e){var t=mi(e);return t<=57&&48<=t},Ti=function(e){return bi(e)||Ci(e)||Si(e)},wi=function(e){return l($a,r(function(e,t){return t+1}),0,e)},Ii=Cr,Ai=n(function(e,t,r){for(;;){if(!(L(e,t)<1))return r;var n=e,a=t-1,i=f(Na,t,r);e=n,t=a,r=i}}),Bi=r(function(e,t){return l(Ai,e,t,mr)}),ki=r(function(e,t){return l(Ii,e,f(Bi,0,wi(t)-1),t)}),Ni=Kr,Ri=Z,$i=r(function(e,t){return f(Fr,e,V(t))}),_i=z,Li=r(function(e,t){return F(f(Mr,e,t))}),xi=function(e){return f($i,"\n ",f(Li,"\n",e))},Pi=on,Di=r(function(e,t){return"\n\n("+Ri(e+1)+") "+xi(Ui(t))}),Ui=function(e){return f(Oi,e,mr)},Oi=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=_i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ei(n)&&f(Ni,Ti,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(Na,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ri(s)+"]",o=n,u=f(Na,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($i,"",_a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ri(wi(l))+" ways:";return f($i,"\n\n",f(Na,h,f(ki,Di,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($i,"",_a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f($i,"",_a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(xi(f(Pi,4,g))+"\n\n")+p}}),Mi=en,Fi=tn,Vi=ae,Ki=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Hi=An,ji={$:"Empty"},qi=function(e){return{$:"Styled",a:e}},Gi=function(e){return{$:"Text",a:e}},zi=function(e){return{$:"Unstyled",a:e}},Yi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return qi({html:r(function(t,r){return f(Hi,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return zi(f(Ua,Hi(e),a));case"Text":var i=t.a;return Gi(i);default:return ji}}),Wi=Yi,Ji=r(function(e,t){return d(ya,t.noticeType,f(Pa,Pa(Wi(e)),t.mainParagraphs),t.align,t.label)}),Qi=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return ga(f(Ji,e,r));case"Web3Connect":return va;case"GotoRoute":var n=t.a;return ha(n);case"GTag":var a=t.a;return da(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(la,i,o,u);default:return pa}}),Xi=r(function(e,t){return f(Pa,Qi(e),t)}),Zi={$:"EthDai"},eo=function(e){return{$:"Native",a:e}},to=function(e){return{$:"Token",a:e}},ro={$:"XDai"},no=F([to(Zi),eo(ro)]),ao=function(e){var t=e.a;e.b,e.c;return t},io=function(e){var t=(e.a,e.b);e.c;return t},oo=function(e){e.a,e.b;return e.c},uo=r(function(e,t){return t.b?l(xa,Na,t,e):e}),so=r(function(e,t){return U(t,{userNotices:f(uo,t.userNotices,F([e]))})}),co=r(function(e,t){return l($a,so,t,e)}),fo=function(e){return{orderBy:e}},lo=fo,ho={$:"Ascending"},po={$:"Phase"},go=Me,vo=go(mr),yo=r(function(e,t){return x({agentAddress:t,tradeTable:lo(x(po,ho)),wallet:e},vo)}),mo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),bo={$:"None"},Co=bo,Eo=function(e){return d(mo,e,vo,Co,mr)},So=function(e){return{$:"TradeTableMsg",a:e}},To=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),wo=r(function(e,t){return f(To,e,t)}),Io=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Ao=n(function(e,t,r){return t(e(r))}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return ci(e(r))}return fi}),ko=r(function(e,t){if("None"===t.$)return bo;var r=t.a,n=t.b,a=l(Io,f(Bo,Ua(e),r.onSign),f(Bo,Ua(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return x(f(Ao,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(Ao,t.toMsg,e)}},n))},r.onMined));return f(To,a,n)}),No=function(e){return{$:"AbiDecoder",a:e}},Ro=r(function(e,t){return{$:"Tape",a:e,b:t}}),$o=Y,_o=Vr,Lo=r(function(e,t){return e<1?t:l(_o,e,$o(t),t)}),xo=Lo(64),Po=n(function(e,t,r){return x(f(Ro,e,xo(t)),r)}),Do=r(function(e,t){return e<1?"":l(_o,0,e,t)}),Uo=Do(64),Oo=r(function(e,t){if("Ok"===t.$){var r=t.a;return di(e(r))}var n=t.a;return li(n)}),Mo=function(e){return-e},Fo=r(function(e,t){return e<1?"":l(_o,-e,$o(t),t)}),Vo=function(){var e=function(e){if(!f(Ni,Qa(D("0")),f(Do,63,e)))return li("Boolean decode error. "+e+" is not 1 or 0.");switch(f(Fo,1,e)){case"0":return di(!1);case"1":return di(!0);default:return li("Boolean decode error. "+e+" is not 1 or 0.")}};return No(function(t){var r=t.a,n=t.b;return f(Oo,f(Po,r,n),e(Uo(n)))})}(),Ko=jr,Ho=function(e){return f(Ko,"0x",e)||f(Ko,"0X",e)?f(Lo,2,e):e},jo=function(e){return e.b},qo=r(function(e,t){var r=e.a;return f(Oo,jo,r(function(e){return f(Ro,e,e)}(Ho(t))))}),Go=Zr,zo=ie,Yo=Jr,Wo=function(e){return f(Go,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Vi(n)}var a=r.a;return zo(a)},Yo)},Jo=f(Ao,qo,Wo),Qo=function(e){return{$:"Magnitude",a:e}},Xo=function(e){return{$:"Pos",a:e}},Zo=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),eu=function(e){return{$:"MagnitudeNotNormalised",a:e}},tu=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 ci(n)}return fi}},ru=function(e){var t=tu(e);return"Nothing"!==t.$&&t.a<0},nu=function(e){return{$:"Neg",a:e}},au={$:"Zer"},iu=function(e){return!e.b},ou=r(function(e,t){var r=t.a;if(iu(r))return au;switch(e.$){case"Zero":return au;case"Positive":return Xo(t);default:return nu(t)}}),uu=r(function(e,t){return f(Zo,e,eu(t))}),su=function(e){return f(xa,r(function(t,r){return e(t)&&iu(r)?mr:f(Na,t,r)}),mr)}(Qa(0)),cu=Ar,fu=-1+f(cu,10,7),lu=fu+1,du=r(function(e,t){var r=t.a,n=t.b;return x(e(r),n)}),hu=function(e){return e<0?f(du,Ra(-1),hu(e+lu)):x(e/lu|0,e%lu)},pu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=hu(r+e),i=a.a,o=a.b;return f(Na,o,f(pu,i,n))}{if(!(L(e,lu)>0))return F([e]);var u=F([e]);e=0,t=u}}}),gu=function(e){var t=e.a;return Qo(su(f(pu,0,t)))},vu=Pa(Mo),yu={$:"Negative"},mu={$:"Positive"},bu={$:"Zero"},Cu=function(e){switch(e.$){case"Positive":return yu;case"Negative":return mu;default:return bu}},Eu=function(e){for(;;){var t=e.a,r=e.b,n=gu(r),a=n.a;if(!ru(a))return f(ou,t,Qo(a));e=f(uu,Cu(t),vu(a))}},Su=gr,Tu=function(e){switch(f(Su,e,0).$){case"LT":return yu;case"GT":return mu;default:return bu}},wu=function(e){return e<0?-e:e},Iu=function(e){return Eu(f(Zo,Tu(e),eu(F([wu(e)]))))},Au=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(cu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},Bu=function(e){switch(e.$){case"Zer":return au;case"Neg":var t=e.a;return Xo(t);default:return e}},ku=function(e){return{$:"MagnitudePair",a:e}},Nu=r(function(e,t){var r=x(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(Na,x(a,u),f(Nu,i,s))}var c=r.a,a=c.a,i=c.b;return f(Na,x(a,0),f(Nu,i,mr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(Na,x(0,u),f(Nu,mr,s))}return mr}),Ru=r(function(e,t){var r=e.a,n=t.a;return ku(f(Nu,r,n))}),$u=function(e){switch(e.$){case"Zer":return f(uu,bu,mr);case"Neg":var t=e.a.a;return f(uu,mu,vu(t));default:var t=e.a.a;return f(uu,mu,t)}},_u=r(function(e,t){var r=$u(t),n=r.b,a=$u(e),i=a.b,o=f(Ru,i,n),u=o.a,s=f(Pa,function(e){return e.a+e.b},u);return Eu(f(Zo,mu,eu(s)))}),Lu=a(function(e,t,r,n){e:for(;;){var a=x(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 wa}return a.b.b?Ca:f(Su,e,t)}}),xu=function(e){switch(e.$){case"LT":return wa;case"EQ":return ba;default:return Ca}},Pu=r(function(e,t){var r=x(e,t);switch(r.a.$){case"Pos":if("Pos"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return d(Lu,0,0,n,a)}return wa;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return xu(d(Lu,0,0,n,a))}return Ca;default:switch(r.b.$){case"Pos":r.a;return Ca;case"Zer":r.a,r.b;return ba;default:r.a;return wa}}}),Du=r(function(e,t){return $(f(Pu,e,t),wa)}),Uu=H,Ou=r(function(e,t){return!f(Du,e,t)}),Mu=function(e){switch(e.$){case"Zer":return Qo(mr);case"Pos":default:var t=e.a;return t}},Fu=r(function(e,t){var r=e.a;return gu(eu(f(Pa,ri(t),r)))}),Vu=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(Fu,Qo(n),a),u=f(Vu,Qo(i),Qo(n)),s=u.a,c=f(_u,f(ou,mu,o),f(ou,mu,Qo(f(Na,0,s))));return Mu(c)}var a=r.a;return f(Fu,Qo(n),a)}return Qo(mr)}),Ku=function(e){switch(e.$){case"Zer":return bu;case"Pos":return mu;default:return yu}},Hu=r(function(e,t){return $(e,bu)||$(t,bu)?bu:$(e,t)?mu:yu}),ju=r(function(e,t){return f(ou,f(Hu,Ku(e),Ku(t)),f(Vu,Mu(e),Mu(t)))}),qu=function(e){switch(e.$){case"Zer":return au;case"Pos":var t=e.a;return nu(t);default:var t=e.a;return Xo(t)}},Gu=r(function(e,t){return f(_u,e,qu(t))}),zu=Iu(0),Yu=a(function(e,t,r,n){if(e){var a=Iu(e),i=f(ju,f(ju,a,n),t),o=f(Ou,i,r)?x(f(ju,a,t),f(Gu,r,i)):x(zu,r),u=o.a,s=o.b,c=d(Yu,e/2|0,t,s,n),l=c.a,h=c.b;return x(f(_u,u,l),h)}return x(zu,r)}),Wu=Va(f(Ka,2,fu)),Ju=n(function(e,t,r){return d(Yu,f(cu,2,Wu),e,t,r)}),Qu=Iu(1),Xu=r(function(e,t){return e}),Zu=n(function(e,t,r){return l($a,Xu(e),t,f(Bi,1,r))}),es=function(e){return l(Zu,ju(Iu(lu)),Qu,e)},ts=n(function(e,t,r){if(e){var n=l(Ju,es(e),t,r),a=n.a,i=n.b,o=l(ts,e-1,i,r),u=o.a,s=o.b;return x(f(_u,a,u),s)}return l(Ju,es(e),t,r)}),rs=function(e){switch(e.$){case"Zer":return mr;case"Pos":default:var t=e.a.a;return t}},ns=r(function(e,t){if($(t,zu))return fi;var r=wi(rs(e))-wi(rs(t))+1,n=l(ts,f(ti,0,r),Bu(e),Bu(t)),a=n.a,i=n.b;return ci(x(f(ou,f(Hu,Ku(e),Ku(t)),Mu(a)),f(ou,Ku(e),Mu(i))))}),as=f(ju,Iu(2),Iu(2147483648)),is=Pr,os=function(e){return f(is,e,"")},us=Dn,ss=n(function(e,t,r){return e<=0?r:l(ss,e>>1,O(t,t),1&e?O(r,t):r)}),cs=r(function(e,t){return l(ss,e,t,"")}),fs=n(function(e,t,r){return O(f(cs,e-$o(r),os(t)),r)}),ls=re,ds=Br,hs=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}},ps=r(function(e,t){for(;;){if(t<16)return f(Na,hs(t),e);var r=f(Na,hs(f(ds,16,t)),e),n=t/16|0;e=r,t=n}}),gs=function(e){return ls(e<0?f(Na,D("-"),f(ps,mr,-e)):f(ps,mr,e))},vs=function(e){var t=f(ns,e,as);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=gs(Au(a));return $(n,Iu(0))?i:O(vs(n),l(fs,8,D("0"),i))},ys=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return $(t,Qo(mr))?"0":vs(Xo(t));default:var t=e.a;return"-"+ys(f(ju,Iu(-1),e))}},ms=function(e){return l(fs,64,D("0"),e)},bs=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=ms(gs(a)),c=function(e){return O(e,n)}(ms(gs(u)));return P(a+32+($o(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($a,t,P(32*wi(e),"",""),e))},Cs=Ur,Es=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(Cs,r(function(t,r){return l(Es,e,mi(t),r)}),t,n)}),Ts=function(e){return _a(l(Ss,Na,mr,e))},ws=function(e){return f($i,"",f(Pa,f(Ao,gs,f(fs,2,D("0"))),Ts(e)))},Is=function(e){return 64-f(ds,64,e)},As=function(e){return O(e,f(cs,Is($o(e)),"0"))},Bs=function(e){return x(ci($o(e)/2|0),As(e))},ks=function(e){return x(fi,ms(e))},Ns=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("!")}},Rs=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"}},$s=Or,_s=function(e){var t=r(function(e,t){var r=t.a,n=t.b,a=x(e,n);e:for(;;)if(a.b)switch(a.a.valueOf()){case"0":return x(f(is,D("1"),r),!0);case"1":return x(f(is,D("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return x(f(is,D("0"),r),!1);case"1":return x(f(is,D("1"),r),!0);default:break e}return x(r,!0)});return l($s,t,x("",!1),e).a},Ls=function(e){return l($s,Na,mr,e)},xs=n(function(e,t,r){for(;;){if(""===t)return _a(r);var n=e,a=f(Lo,e,t),i=f(Na,l(_o,0,e,t),r);e=n,t=a,r=i}}),Ps=r(function(e,t){return e&&""!==t?l(xs,e,t,mr):F([t])}),Ds=function(e){var t=function(){var t=Ls(ys(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return x(r,f(Ao,_s,f(fs,256,D("1"))))}var r=t;return x(r,f(fs,256,D("0")))}(),r=t.a,n=t.b;return ls(f(Pa,Ns,f(Ps,4,n(f($i,"",f(Pa,Rs,r))))))},Us=function(e){return{$:"Hex",a:e}},Os=function(e){switch(e.$){case"AddressE":var t=e.a.a;return ks(t);case"UintE":var r=e.a;return ks(ys(r));case"IntE":var n=e.a;return ks(Ds(n));case"BoolE":return ks(e.a?"1":"0");case"DBytesE":var a=e.a.a;return Bs(a);case"BytesE":var a=e.a.a;return ks(Ho(a));case"StringE":var i=e.a;return Bs(ws(i));case"ListE":var o=e.a;return function(e){var t=e.a;return Bs(t)}(Zt()(o));default:var i=e.a;return ks(Ho(i))}};try{var Ms=Zt();Zt=function(){return Ms}}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 Fs=Dr,Vs=function(e){return 1===$o(e)?f(Fs,"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(Na,n,r);e=i,t=o,r=u}}}),Hs=r(function(e,t){return _a(l(Ks,e,t,mr))}),js=n(function(e,t,r){if(t<=0)return mr;var n=x(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(Na,i,f(Na,u,f(Na,h,f(Na,m,f(Hs,t-4,b))))):f(Na,i,f(Na,u,f(Na,h,f(Na,m,l(js,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return F([i])}),qs=r(function(e,t){return l(js,0,e,t)}),Gs=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),zs=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 Dt(e.a)}},Ys={$:"LE"},Ws=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(On,t,r,n);case"I16":var a=e.a,n=e.b;return d(Mn,t,r,n,$(a,Ys));case"I32":var a=e.a,n=e.b;return d(Fn,t,r,n,$(a,Ys));case"U8":var n=e.a;return l(Vn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Kn,t,r,n,$(a,Ys));case"U32":var a=e.a,n=e.b;return d(Hn,t,r,n,$(a,Ys));case"F32":var a=e.a,n=e.b;return d(jn,t,r,n,$(a,Ys));case"F64":var a=e.a,n=e.b;return d(qn,t,r,n,$(a,Ys));case"Seq":var i=e.b;return l(Js,i,t,r);case"Utf8":var o=e.b;return l(zn,t,r,o);default:var i=e.a;return l(Gn,t,r,i)}}),Js=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Ws,n,t,r);e=i,t=o,r=u}}),Qs=Ut,Xs=r(function(e,t){return{$:"Seq",a:e,b:t}}),Zs=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+zs(r),i=n;e=a,t=i}}),ec=function(e){return f(Xs,f(Zs,0,e),e)},tc=function(e){return{$:"U8",a:e}},rc=tc,nc=r(function(e,t){return L(e,t)<0?e:t}),ac=pr,ic=function(e){return{$:"Bytes",a:e}},oc=ic,uc=function(e){return Qs(ec(f(Pa,oc,_a(e))))},sc=Dt,cc=r(function(e,t){var r=e.a;return f(Yn,r,t)}),fc=function(e){return{$:"Decoder",a:e}},lc=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 x(u,s.a)}var c=s.a,l=c,d=t,h=r,p=u;e=l,t=d,r=h,n=p}}),dc=r(function(e,t){return fc(f(lc,e,t))}),hc=fc(Wn),pc=r(function(e,t){if("Just"===t.$){return t.a}return e}),gc=function(e){return{$:"Done",a:e}},vc=function(e){return{$:"Loop",a:e}},yc=r(function(e,t){var n=t.a;return fc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return x(i,e(o))}))}),mc=function(e){return fc(r(function(t,r){return x(r,e)}))},bc=r(function(e,t){var r=t.a,n=t.b;return r<=0?mc(gc(_a(n))):f(yc,function(e){return vc(x(r-1,f(Na,e,n)))},e)}),Cc=function(e){return f(pc,mr,f(cc,f(dc,x(sc(e),mr),bc(hc)),e))},Ec=n(function(e,t,r){var n=t.a,a=t.b,i=r.a,o=r.b;return x(f(e,n,i),f(e,a,o))}),Sc=r(function(e,t){return l(Ec,us,e,t)}),Tc=f(Bi,0,4),wc=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}}),Ic=Pt,Ac=r(function(e,t){var r=t.a,n=t.b;return x(e(r),e(n))}),Bc=function(e){return f(Ac,f(Ao,Ic,us(4294967295)),e)},kc=r(function(e,t){return 5*t+e}),Nc=4294967295>>>32-ja,Rc=ir,$c=n(function(e,t,r){for(;;){var n=Nc&t>>>e,a=f(Rc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Rc,Nc&t,i)}var o=a.a,u=e-ja,s=t,c=o;e=u,t=s,r=c}}),_c=function(e){return e>>>5<<5},Lc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||L(e,r)>-1?fi:ci(L(e,_c(r))>-1?f(Rc,Nc&e,i):l($c,n,e,a))}),xc=r(function(e,t){var r=f(Lc,e,t);if("Just"===r.$){return r.a}return x(0,0)}),Pc=n(function(e,t,r){var n=f(kc,e,t);return f(xc,n,r)}),Dc=or,Uc=a(function(e,t,r,n){var a=Nc&t>>>e,i=f(Rc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Uc,e-ja,t,r,o);return l(Dc,a,Ya(u),n)}var s=i.a,c=l(Dc,Nc&t,r,s);return l(Dc,a,za(c),n)}),Oc=n(function(e,t,r){var n=r.a,a=r.b,i=r.c,o=r.d;return e<0||L(e,n)>-1?r:L(e,_c(n))>-1?d(Fa,n,a,i,l(Dc,Nc&e,t,o)):d(Fa,n,a,d(Uc,a,e,t,i),o)}),Mc=n(function(e,t,r){return l(Oc,e,t,r)}),Fc=a(function(e,t,r,n){var a=f(kc,e,t);return l(Mc,a,r,n)}),Vc=Un,Kc=r(function(e,t){return l(Ec,Vc,e,t)}),Hc=function(e){var t=l(xa,r(function(t,n){var a={d0:l(Pc,0,t,e.state),d1:l(Pc,1,t,e.state),d2:l(Pc,2,t,e.state),d3:l(Pc,3,t,e.state),d4:l(Pc,4,t,e.state)},i=r(function(e,r){return d(Fc,e,t,f(Kc,f(wc,e,a),f(Sc,Bc(f(wc,f(ds,5,e+1),a)),f(wc,f(ds,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Tc);return U(e,{state:t})},jc=x(0,0),qc=function(e){return{current:jc,lfsrstate:1,state:e,x:1,y:0}},Gc=function(e){var t=1&e;return 128&e?x(t,e<<1^113):x(t,e<<1)},zc=x(1,0),Yc=r(function(e,t){var r=t.a,n=t.b;return e?x(n,r):x(r,n)}),Wc=r(function(e,t){if(e){var n=f(Yc,1,t);return l(Ec,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),Jc=r(function(e,t){var r=f(ds,32,e/32|0),n=f(Yc,r,t),a=f(ds,32,e);return f(Wc,a,n)}),Qc=n(function(e,t,r){var n=f(Lc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(Oc,e,t(a),r)}),Xc=n(function(e,t,r){return l(Qc,e,Kc(t),r)}),Zc=a(function(e,t,r,n){var a=f(kc,e,t);return l(Xc,a,r,n)}),ef=function(e){return l($a,r(function(e,t){var r=(1<>r}),cf=n(function(e,t,r){return t?x(0,r<0))return t;var a=f(nc,n,r),i=f(Pa,function(e){return f(sf,e,g)},f(Bi,0,a)),o=uf(e),u=O(t,i),s=n-a;e=o,t=u,n=s}});return f(qs,i.outputLen,l(v,g,mr,i.outputLen))},hf=function(e){return{$:"KS",a:e}},pf=function(e){var t=e.a;return hf({config:t,inputLength:0,partial:mr,state:f(si,25,Xu(jc))})},gf=function(e){return fc(Jn(e))},vf=Qs(ec(mr)),yf=r(function(e,t){var n=t.a;return fc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),mf=r(function(e,t){return f(yf,function(e){return gf(t)},gf(e))}),bf=r(function(e,t){return f(pc,vf,f(cc,f(mf,e,sc(t)-e),t))}),Cf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=sc(e)?f(Na,e,n.partial):n.partial;if(!(L(l($a,r(function(e,t){return t+sc(e)}),0,i),a)>-1))return hf(U(n,{inputLength:sc(e)+n.inputLength,partial:i}));var o=uc(i),u=f(pc,vf,f(cc,gf(a),o)),s=Cc(u),c=f(lf,s,n.state),d=uf(c),h=f(bf,a,o),p=vf,g=hf(U(n,{inputLength:sc(e)+n.inputLength,partial:F([h]),state:d}));e=p,t=g}}),Ef=r(function(e,t){return df(f(Cf,Qs(ec(f(Pa,rc,t))),pf(e)))}),Sf=Ef(Gs),Tf=function(e){return Us(f($i,"",f(Pa,f(Ao,gs,Vs),f(qs,4,Sf(f(Pa,mi,Ls(e)))))))},wf=function(e){return f(Ko,"0x",e)||f(Ko,"0X",e)?e:"0x"+e},If=function(e){var t=e.a;return wf(t)},Af=r(function(e,t){var r=bs(f(Pa,Os,t)),n=function(e){return O(e,r)}(Ho(If(Tf(e))));return Us(n)}),Bf=function(e){return{data:ci(f(Af,"poke()",mr)),decoder:Jo(Vo),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},kf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Nf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Rf={$:"Descending"},$f=function(e){return"Ascending"===e.$?Rf:ho},_f=function(e){return d(Nf,e,vo,Co,mr)},Lf=r(function(e,t){return x(t.a,e(t.b))}),xf=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Nf,t,vo,Co,F([ha(f(kf,r,n))]));case"ChangeSort":var a=e.a,i=$(t.orderBy.a,a)?f(Lf,$f,t.orderBy):x(a,ho);return _f(U(t,{orderBy:i}));default:return _f(t)}}),Pf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},Df=mn,Uf=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=Pf(Bf(r)),a={onBroadcast:fi,onMined:fi,onSign:fi},i=f(wo,a,n);return d(mo,t,vo,i,mr);case"TradeClicked":var o=e.a,u=e.b;return d(mo,t,vo,Co,F([ha(f(kf,o,u))]));case"TradeTableMsg":var s=e.a,c=f(xf,s,t.tradeTable);return d(mo,U(t,{tradeTable:c.model}),f(Df,So,c.cmd),f(ko,So,c.chainCmd),f(Pa,Qi(So),c.appCmds));default:return Eo(t)}}),Of={$:"BottomRight"},Mf={$:"ShouldBeImpossible"},Ff=dr,Vf=function(e){return Gi(e)},Kf=r(function(e,t){f(Ff,e,t);return{align:Of,label:"unexpectedError",mainParagraphs:F([F([Vf(e)])]),noticeType:Mf}}),Hf=function(e){var t=e.a;return wf(t)},jf=me,qf=f(Ao,Hf,jf),Gf=f(Ao,ys,f(Ao,wf,jf)),zf=f(Ao,If,jf),Yf=f(Ao,gs,f(Ao,wf,jf)),Wf=r(function(e,t){return l(xa,r(function(t,r){return e(t)?f(Na,t,r):r}),mr,t)}),Jf=sn,Qf=function(e){return me(l($a,r(function(e,t){var r=e.a,n=e.b;return l(un,r,n,t)}),Ee(),e))},Xf=function(e){return Qf(f(Pa,function(e){var t=e.a,r=e.b;return x(t,f(pc,Jf,r))},f(Wf,function(e){e.a;return!$(e.b,fi)},e)))},Zf=function(e){return Xf(F([x("to",f(Bo,qf,e.to)),x("from",f(Bo,qf,e.from)),x("gas",f(Bo,Yf,e.gas)),x("gasPrice",f(Bo,Gf,e.gasPrice)),x("value",f(Bo,Gf,e.value)),x("data",f(Bo,zf,e.data)),x("nonce",f(Bo,Yf,e.nonce))]))},el=function(e){return{$:"TxSentry",a:e}},tl=me,rl=r(function(e,t){return Qf(F([x("ref",tl(e)),x("txParams",t)]))}),nl=function(e){return{$:"Signing",a:e}},al=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:nl(e)}}),il={$:"Black"},ol=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),ul={$:"RBEmpty_elm_builtin"},sl={$:"Red"},cl=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(ol,sl,t,r,h(ol,il,c,f,l,d),h(ol,il,i,o,u,s))}return h(ol,e,i,o,h(ol,sl,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(ol,sl,c,f,h(ol,il,g,v,y,m),h(ol,il,t,r,d,a))}return h(ol,e,t,r,n,a)}),fl=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(ol,sl,e,t,ul,ul);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(cl,n,a,i,l(fl,e,t,o),u);case"EQ":return h(ol,n,a,t,o,u);default:return h(cl,n,a,i,o,l(fl,e,t,u))}}),ll=n(function(e,t,r){var n=l(fl,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(ol,il,a,i,o,u)}return n}),dl=n(function(e,t,r){var n=e.a,a=Zf(r),i=l(ll,n.ref,f(al,r,t),n.txs);return x(el(U(n,{ref:n.ref+1,txs:i})),f(Df,n.tagger,n.outPort(f(rl,n.ref,a))))}),hl=dl,pl=r(function(e,t){var r=x(e,t);if("None"===r.b.$){r.b;return P(e,vo,mr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return P(ci(t),r,mr)}(l(hl,n,i,o))}return P(fi,vo,F([f(Kf,"submodel sent chainCmd, but there is no txSentry to use!",fi)]))}),gl=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),vl=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),yl={$:"Seller"},ml=function(e){return{$:"Posix",a:e}},bl=ml,Cl={autoabortInterval:bl(0),autorecallInterval:bl(0),autoreleaseInterval:bl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:yl},El=function(e){return{$:"TokenValue",a:e}},Sl=function(e){return e.a},Tl=r(function(e,t){return f(pc,zu,f(Bo,Xa,f(ns,e,t)))}),wl=r(function(e,t){return El(f(Tl,Sl(e),Iu(t)))}),Il=function(e){return f(wl,e,12)},Al=function(e){return f(wl,e,3)},Bl=El(Iu(0)),kl=r(function(e,t){var r=Bl;return{abortPunishment:Il(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Al(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Nl=function(e){if(e.b){var t=e.a;e.b;return ci(t)}return fi},Rl=Gr,$l=function(e){var t=Nl(f(Rl,".",e));if("Nothing"===t.$)return x(e,0);var r=t.a,n=$o(e)-1-r;return x(O(f(Do,r,e),f(Lo,r+1,e)),n)},_l=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}}),Ll=function(e){var t=e.a,r=f(_l,Qa(0),t);return Qo(r.b?t:mr)},xl=ee,Pl=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}}}),Dl=n(function(e,t,r){var n=f(Pl,t,r),a=wi(r)>0;return e>0&&t>0&&a?f(Na,f(qs,e,r),l(Dl,e,t,n)):mr}),Ul=r(function(e,t){return l(Dl,e,e,t)}),Ol=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return fi;var a=n.a;return f(Bo,Na(a),r)});return f(xa,t,ci(mr))}(Oa),Ml=function(e){return f(Bo,f(Ua,Ll,Qo),Ol(f(Pa,f(Ao,_a,f(Ao,ls,xl)),f(Ul,7,_a(e)))))},Fl=X,Vl=function(e){var t=Ls(Fl(e));if(!t.b)return fi;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,ou(yu),Ml(r))}return fi;case"+":if(t.b.b){var r=t.b;return f(Bo,ou(mu),Ml(r))}return fi;default:var r=t;return f(Bo,ou(mu),Ml(r))}},Kl=function(e){var t=function(e){return!f(ds,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(pc,0,Nl(r)))}},Hl=function(e){return f(ju,e,e)},jl=Iu(2),ql=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Qu;case"Neg":return au;default:if($(r,Qu))return f(ju,e,t);if(Kl(r)){var n=e,a=Hl(t),i=f(Tl,r,jl);e=n,t=a,r=i;continue e}var n=f(ju,t,e),a=Hl(t),i=f(Tl,f(Gu,r,Qu),jl);e=n,t=a,r=i;continue e}}),Gl=r(function(e,t){return l(ql,Qu,e,t)}),zl=function(e){if(""===e)return fi;var t=$l(e),r=t.a,n=t.b,a=Vl(r),i=18-n;if(i<0)return fi;if("Nothing"===a.$)return fi;var o=a.a,u=f(ju,o,f(Gl,Iu(10),Iu(i)));return ci(u)},Yl=function(e){return f(Bo,El,zl(e))},Wl=qr,Jl=function(e){for(;;){if(f(Wl,".",e))return l(_o,0,-1,e);{if(!f(Wl,"0",e))return""===e?"0":e;e=l(_o,0,-1,e)}}},Ql=f(Ua,f(fs,7,D("0")),Ri),Xl=function(e){return f($i,"",e)},Zl=function(e){var t=e.a,r=_a(t);if(r.b){var n=r.a,a=r.b;return Xl(f(Na,Ri(n),f(Pa,Ql,a)))}return"0"},ed=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Zl(t);default:var t=e.a;return"-"+Zl(t)}},td=r(function(e,t){return e<1?t:l(_o,0,-e,t)}),rd=function(e){var t=l(fs,18,D("0"),ed(e)),r=f(td,18,t)+"."+f(Fo,18,t);return function(e){return""===e?"0":e}(Jl(r))},nd=r(function(e,t){var r=rd(t),n=Nl(f(Rl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Do,a+1+e,r):f(Do,a,r)}),ad=r(function(e,t){if("Nothing"===e.$)return rd(Sl(t));var r=e.a;return f(nd,r,Sl(t))}),id=te,od=function(e){var t=id(f(ad,fi,e));if("Just"===t.$){return t.a}f(Ff,"Error converting tokenValue to float: string -> float failed",e);return 0},ud=function(e){if(""===e)return li("You must specify a trade amount.");var t=Yl(e);if("Nothing"===t.$)return li("I don't understand this number.");var r=t.a;return od(r)<1?li("Trade amount can't be less than 1."):di(r)},sd=function(e){if(""===e)return li("You must specify a fiat price.");var t=Vl(e);if("Nothing"===t.$){var r=id(e);return li("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 di(n)},cd=r(function(e,t){if("Just"===t.$){var r=t.a;return di(r)}return li(e)}),fd=function(e){return""===e},ld=function(e){return fd(e)?fi:ci(e)},dd=function(e){return f(cd,"You must specify a fiat type.",ld(e))},hd=function(e){return""===e?li("Must specify a payment method."):di(e)},pd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),gd=g(pd,fi,fi,fi,fi,fi,fi,fi),vd=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 di(P(i,o,u))}var s=a.c.a;return li(s)}var c=a.b.a;return li(c)}var f=a.a.a;return li(f)},yd=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return P(e(a),t(i),r(o))}),md={$:"Custom"},bd=r(function(e,t){return{info:t,type_:e}}),Cd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return li(o)}var u=t.a;if("Err"===r.$){var o=r.a;return li(o)}var s=r.a;if("Err"===n.$){var o=n.a;return li(o)}var c=n.a;if("Err"===a.$){var o=a.a;return li(o)}var f=a.a;if("Err"===i.$){var o=i.a;return li(o)}var l=i.a;return di(h(e,u,s,c,f,l))}),Ed=r(function(e,t){if("Ok"===t.$){var r=t.a;return di(r)}var n=t.a;return li(e(n))}),Sd=function(e){return e.a},Td=function(e){return p(Cd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:F([f(bd,md,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Ed,function(e){return U(gd,{daiAmount:ci(e)})},ud(e.daiAmount)),f(Ed,function(e){return U(gd,{fiatAmount:ci(e)})},sd(e.fiatAmount)),f(Ed,function(e){return U(gd,{fiatType:ci(e)})},dd(e.fiatType)),f(Ed,function(e){return U(gd,{paymentMethod:ci(e)})},hd(e.paymentMethod)),vd(d(yd,function(e){return Sd(e)>0?di(e):li(U(gd,{autorecallInterval:ci("Must specify a non-zero time for this window")}))},function(e){return Sd(e)>0?di(e):li(U(gd,{autoabortInterval:ci("Must specify a non-zero time for this window")}))},function(e){return Sd(e)>0?di(e):li(U(gd,{autoreleaseInterval:ci("Must specify a non-zero time for this window")}))},P(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},wd=function(e){if("Active"===e.$){var t=e.a;return ci(t)}return fi},Id=n(function(e,t,r){if("Nothing"===t.$)return fi;var n=t.a;if("Nothing"===r.$)return fi;var a=r.a;return ci(f(e,n,a))}),Ad=function(e){if("Ok"===e.$){var t=e.a;return ci(t)}return fi},Bd=function(e){var t=Td(e.inputs),r=function(){return $(e.errors,gd)?gd:"Ok"===t.$?gd:t.a}();return U(e,{createParameters:l(Id,kl,wd(e.wallet),Ad(t)),errors:r})},kd=r(function(e,t){return Bd(U(t,{inputs:e}))}),Nd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Rd=function(e){return d(Nd,f(kd,Cl,{allowance:fi,createParameters:fi,depositAmount:fi,errors:gd,inputs:Cl,showFiatTypeDropdown:!1,txChainStatus:fi,wallet:e}),vo,Co,mr)},$d=a(function(e,t,r,n){return da(d(gl,e,t,r,n))}),_d=function(e){return{$:"Address",a:e}},Ld=f(Ao,Ho,f(Ao,Fl,_d)),xd=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Ld("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return Ld("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return Ld("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return Ld("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return Ld("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},Pd=function(e){return Ld("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},Dd=function(e){return{$:"AddressE",a:e}},Ud=Dd,Od=function(e){return{$:"UintE",a:e}},Md=Od,Fd=n(function(e,t,r){return{data:ci(f(Af,"approve(address,uint256)",F([Ud(t),Md(r)]))),decoder:Jo(Vo),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),Vd=function(e){return f(wl,e,200)},Kd=r(function(e,t){return El(f(_u,Sl(e),Sl(t)))}),Hd=function(e){var t=f(wl,e.tradeAmount,200);return f(Kd,e.pokeReward,f(Kd,Vd(e.tradeAmount),f(Kd,t,function(){return"Buyer"===e.initiatorRole.$?Al(e.tradeAmount):e.tradeAmount}())))},jd=Fi(ma),qd=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),Gd=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),zd=Zn,Yd=Xn,Wd=function(e){return f(Yd,{caseInsensitive:!1,multiline:!1},e)},Jd=Qn,Qd=zd(f(pc,Jd,Wd("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Xd=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}}),Zd=r(function(e,t){return!f(Xd,f(Ua,Uu,e),t)}),eh=Zd(Oa),th=G,rh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),nh=n(function(e,t,r){if("Err"===t.$){var n=t.a;return li(n)}var a=t.a;if("Err"===r.$){var n=r.a;return li(n)}var i=r.a;return di(f(e,a,i))}),ah=f(xa,nh(Na),di(mr)),ih=function(e){if(e.b){var t=(e.a,e.b);return ci(t)}return fi},oh=n(function(e,t,r){e:for(;;){if(!t.b)return di(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(cu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(cu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(cu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(cu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(cu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(cu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(cu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(cu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(cu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(cu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(cu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(cu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(cu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(cu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(cu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return li(os(s)+" is not a valid hexadecimal character.")}}}),uh=function(e){if(fd(e))return li("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(Ko,"-",e)){var t=f(pc,mr,ih(Ls(e)));return f(Oo,Mo,l(oh,wi(t)-1,t,0))}return l(oh,$o(e)-1,Ls(e),0)}();return f(Ed,function(t){return f($i," ",F(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},sh=function(e){var t=Ls(e);return function(e){return x(t,e)}(f(rh,mr,ah(f(Pa,uh,f(Li,"",f($i,"",f(Pa,f(Ao,gs,Vs),f(qs,20,Sf(f(Pa,f(Ao,th,mi),t))))))))))},ch=function(e){var t=r(function(e,t){return!(t>=8&&bi(e)||t<8&&Ci(e))}),n=sh(Ho(e)),a=n.a,i=n.b,o=l(Ii,t,a,i);return!!Qd(e)&&eh(o)},fh=zd(f(pc,Jd,Wd("^((0[Xx]){1})?[0-9a-f]{40}$"))),lh=zd(f(pc,Jd,Wd("^((0[Xx]){1})?[0-9A-F]{40}$"))),dh=function(e){return'"'+e+'"'},hh=function(e){var t=Ho(e),r=f(Do,24,t),n=f(Fo,40,e);return 64===$o(t)&&f(Ni,Qa(D("0")),r)?lh(n)||fh(n)?di(_d(n)):ch(n)?di(_d(n)):li("Given address "+dh(e)+" failed the EIP-55 checksum test."):40!==$o(t)?li("Given address "+dh(e)+" is not the correct length."):Qd(t)?lh(t)||fh(t)?di(_d(t)):ch(t)?di(_d(t)):li("Given address "+dh(e)+" failed the EIP-55 checksum test."):li("Given address "+dh(e)+" contains invalid hex characters.")},ph=No(function(e){var t=e.a,r=e.b;return f(Oo,f(Po,t,r),hh(Uo(r)))}),gh=r(function(e,t){var r=t.a;return No(function(t){var n=t.a,a=t.b;return r(f(Ro,n,f(Lo,64*e,a)))})}),vh=Qr,yh=r(function(e,t){return f(vh,"data",Jo(f(gh,e,t)))}),mh=Xr,bh=r(function(e,t){return f(vh,"topics",f(mh,e,Jo(t)))}),Ch=function(e){return f(Bo,f(Ao,_a,f($a,r(function(e,t){return f(_u,Iu(e),f(ju,t,as))}),zu)),Ol(f(Pa,f(Ao,_a,f(Ao,ls,f(Ao,uh,Ad))),f(Ul,8,_a(e)))))},Eh=function(e){var t=Ls(Fl(e));e:for(;;){if(!t.b)return fi;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(Bo,ju(Iu(-1)),Ch(a))}var i=t.b;i.b;return fi}var a=t.b;return f(Bo,ju(Iu(-1)),Ch(a))}return fi;case"+":if(t.b.b){var a=t.b;return Ch(a)}return fi;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Ch(a)}t.b;return fi}break e;default:break e}}var a=t;return Ch(a)},Sh=No(function(e){var t=e.a,r=e.b;return f(Oo,f(Po,t,r),f(cd,"Error Decoding Uint into BigInt",Eh(wf(Uo(r)))))}),Th=f(jd,f(bh,1,ph),f(jd,f(yh,1,ph),f(jd,f(yh,0,Sh),Vi(qd)))),wh=an,Ih=r(function(e,t){return me(l($a,Se(e),Ce(),t))}),Ah=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(wh,e,Qf(F([x("data",jf(t.data)),x("topics",f(Ih,zf,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Bh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return li(r)}),kh=r(function(e,t){return f(Oo,function(e){return e.id},f(Bh,function(e){return f(Ed,Ui,f(Ah,Th,e).returnData)},f(cd,"No log found from that factoryAddress in that txReceipt",Nl(f(Wf,function(t){return $(f(Ao,Hf,Fl)(t.address),f(Ao,Hf,Fl)(xd(e)))},t.logs)))))}),Nh=n(function(e,t,r){return{data:ci(f(Af,"allowance(address,address)",F([Ud(t),Ud(r)]))),decoder:Jo(Sh),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),Rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},$h=function(e){switch(e.$){case"BlockNum":var t=e.a;return jf(wf(gs(t)));case"EarliestBlock":return jf("earliest");case"LatestBlock":return jf("latest");default:return jf("pending")}},_h=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return Xf(F([x("to",f(Bo,qf,t)),x("from",f(Bo,qf,r)),x("gas",f(Bo,Yf,n)),x("gasPrice",f(Bo,Gf,a)),x("value",f(Bo,Gf,i)),x("data",f(Bo,zf,o))]))},Lh=function(e){return{$:"BadBody",a:e}},xh=function(e){return{$:"BadStatus",a:e}},Ph=function(e){return{$:"BadUrl",a:e}},Dh={$:"NetworkError"},Uh={$:"Timeout"},Oh=nn,Mh=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return li(Ph(r));case"Timeout_":return li(Uh);case"NetworkError_":return li(Dh);case"BadStatus_":var n=t.a,a=t.b;return li(xh(n.statusCode));default:var n=t.a,a=t.b,i=f(Oh,f(vh,"result",e),a);if("Ok"===i.$){var o=i.a;return di(o)}var u=i.a;return li(Lh(Ui(u)))}}),Fh=n(function(e,t,r){return Qf(F([x("id",tl(e)),x("jsonrpc",jf("2.0")),x("method",jf(t)),x("params",f(Ih,Oa,r))]))}),Vh=ul,Kh=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return fi;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 ci(n);default:var u=e,s=i;e=u,t=s;continue e}}}),Hh=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},jh=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(ol,sl,p,g,h(ol,il,r,n,h(ol,sl,i,o,u,s),v),h(ol,il,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(ol,il,r,n,h(ol,sl,i,o,u,s),h(ol,sl,f,l,d,m))}return e},qh=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(ol,sl,i,o,h(ol,il,s,c,f,l),h(ol,il,r,n,d,h(ol,sl,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(ol,il,r,n,h(ol,sl,i,o,C,d),h(ol,sl,g,v,y,m))}return e},Gh=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(ol,r,u,s,c,h(ol,sl,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 qh(t)}break e}o.a,o.d;return qh(t)}break e}return t}),zh=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(ol,t,r,n,zh(a),u)}var s=jh(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(cl,c,f,l,zh(d),p)}return ul}return h(ol,t,r,n,zh(a),u)}return ul},Yh=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return ul;var r=t.a,n=t.b,a=t.c,i=t.d,o=t.e;if(L(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(ol,r,n,a,f(Yh,e,i),o)}var s=jh(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(cl,c,l,d,f(Yh,e,p),v)}return ul}return h(ol,r,n,a,f(Yh,e,i),o)}return f(Wh,e,g(Gh,e,t,r,n,a,i,o))}),Wh=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=Hh(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(cl,r,s,c,i,zh(o))}return ul}return h(cl,r,n,a,i,f(Yh,e,o))}return ul}),Jh=r(function(e,t){var r=f(Yh,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(ol,il,n,a,i,o)}return r}),Qh=n(function(e,t,r){var n=t(f(Kh,e,r));if("Just"===n.$){var a=n.a;return l(ll,e,a,r)}return f(Jh,e,r)}),Xh=function(e){return"Just"===e.$},Zh=vn,ep=yn,tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),rp=function(e){return{$:"BadUrl_",a:e}},np=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),ap={$:"NetworkError_"},ip=function(e){return{$:"Receiving",a:e}},op=function(e){return{$:"Sending",a:e}},up={$:"Timeout_"},sp=function(e){return f(ra,"application/json",f(Pi,0,e))},cp=n(function(e,t,r){return sp(l(Fh,e,t,r))}),fp=f(ta,"",Oa),lp=we,dp=Te,hp=function(e){if("Ok"===e.$){var t=e.a;return dp(t)}var r=e.a;return lp(r)},pp=function(e){return l(ea,vr,hp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:fi,url:e.url})},gp=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return pp({body:l(cp,1,r,n),headers:mr,method:"POST",resolver:fp(Mh(a)),timeout:fi,url:t})},vp=n(function(e,t,r){return gp({decoder:t.decoder,method:"eth_call",params:F([_h(t),$h(r)]),url:e})}),yp={$:"LatestBlock"},mp=r(function(e,t){return l(vp,e,t,yp)}),bp=function(e){return{$:"Perform",a:e}},Cp=cn,Ep=dp(vr),Sp=r(function(e,t){return f(Cp,function(t){return dp(e(t))},t)}),Tp=n(function(e,t,r){return f(Cp,function(t){return f(Cp,function(r){return dp(f(e,t,r))},r)},t)}),wp=function(e){return l(xa,Tp(Na),dp(mr),e)},Ip=r(function(e,t){var r=t.a;return ke(f(Cp,Zh(e),r))}),Ap=n(function(e,t,r){return f(Sp,function(e){return vr},wp(f(Pa,Ip(e),t)))}),Bp=n(function(e,t,r){return dp(vr)}),kp=r(function(e,t){var r=t.a;return bp(f(Sp,e,r))});gn.Task=De(Ep,Ap,Bp,kp);var Np=Oe("Task"),Rp=fn,$p=r(function(e,t){return Np(bp(f(Rp,f(Ua,f(Ua,dp,e),li),f(Cp,f(Ua,f(Ua,dp,e),di),t))))}),_p=a(function(e,t,r,n){return f($p,n,f(mp,Rh(to(e)),l(Nh,Pd(e),t,r)))}),Lp=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Ld("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return Ld("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return Ld("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return Ld("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return Ld("0x092110996699c3E06e998d89F0f4586026e44F0F")}},xp=function(e){return{$:"BoolE",a:e}},Pp=xp,Dp=function(e){return{$:"StringE",a:e}},Up=Dp,Op=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:ci(f(Af,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([Ud(t),Ud(r),Pp(n),Md(a),Md(i),Md(o),Md(u),Md(s),Md(c),Md(l),Md(d),Up(h),Up(p)]))),decoder:Jo(ph),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}}}}}}}}}}}}}},Mp=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:ci(f(Af,"createOpenTrade(address[2],bool,uint256[8],string,string)",F([Ud(t),Ud(r),Pp(n),Md(a),Md(i),Md(o),Md(u),Md(s),Md(c),Md(l),Md(d),Up(h),Up(p)]))),decoder:Jo(ph),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}}}}}}}}}}}}}},Fp=r(function(e,t){return{paymentMethods:t,price:e}}),Vp=function(e){return jf(ed(e))},Kp=function(e){return f(Ih,Oa,F([jf(e.fiatType),Vp(e.amount)]))},Hp=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},jp=function(e){return Qf(F([x("type",jf(Hp(e.type_))),x("info",jf(e.info))]))},qp=function(e){var t=Kp(e.price),r=f(Ih,jp,e.paymentMethods);return f(Pi,0,Qf(F([x("paymentmethods",r),x("price",t)])))},Gp=r(function(e,t){return U(t,{value:ci(e)})}),zp=function(e){return Iu(Sd(e))},Yp=function(e){return f(Tl,zp(e),Iu(1e3))},Wp=r(function(e,t){var r=function(){return"Token"===e.$?Op:Mp}();return function(){return"Native"===e.$?Gp(Sl(Hd(t))):Oa}()(r(xd(e))(t.initiatorAddress)(Lp(e))($(t.initiatorRole,yl))(Sl(t.tradeAmount))(Sl(Al(t.tradeAmount)))(Sl(Il(t.tradeAmount)))(Sl(t.pokeReward))(Yp(t.autorecallInterval))(Yp(t.autoabortInterval))(Yp(t.autoreleaseInterval))(Sl(Vd(t.tradeAmount)))(qp(f(Fp,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Jp=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),Qp=function(e){return{$:"CreateNeedsSig",a:e}},Xp=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Zp=r(function(e,t){var r=Pf(f(Wp,e,t)),n={onBroadcast:fi,onMined:ci(x(Jp(e),fi)),onSign:ci(Xp(e))};return x(ci(Qp(e)),f(wo,n,r))}),eg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),rg=function(e){return{$:"ApproveNeedsSig",a:e}},ng=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),ig=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),og={$:"NoOp"},ug=function(e){return{appCmds:mr,chainCmd:Co,cmd:vo,model:e}},sg=function(e){return xl(ed(e))},cg={$:"Error"},fg=r(function(e,t){f(Ff,e+" fetch error",t);return{align:Of,label:"web3FetchError",mainParagraphs:F([F([Vf('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:cg}}),lg=r(function(e,t){return{align:Of,label:"web3MiningError",mainParagraphs:F([F([Vf('Error mining "'+e+'" transaction: '+t)])]),noticeType:cg}}),dg={$:"Caution"},hg=r(function(e,t){return{align:Of,label:"web3SigError",mainParagraphs:F([F([Vf('Error signing "'+e+'" transaction: '+t)])]),noticeType:dg}}),pg={$:"KovanDai"},gg=function(e){e:for(;;)switch(e.$){case"Mainnet":return ci(to(Zi));case"Kovan":return ci(to(pg));case"Private":if(100===e.a)return ci(eo(ro));break e;default:break e}return fi},vg=function(e){switch(e.$){case"NoneDetected":return fi;case"OnlyNetwork":var t=e.a;return ci(t);default:var r=e.a;return ci(r.network)}},yg=r(function(e,t){if("Just"===t.$){return e(t.a)}return fi}),mg=function(e){return f(yg,gg,vg(e))},bg=r(function(e,t){return 1-e(1-t)}),Cg=function(e){return f(cu,e,5)},Eg=bg(Cg),Sg={easing:Eg,offset:12,speed:200},Tg=function(e){return{$:"External",a:e}},wg=function(e){return{$:"Internal",a:e}},Ig=function(e){return{$:"NotFound",a:e}},Ag=function(e){for(;;){e=e.a}},Bg=r(function(e,t){return Np(bp(f(Sp,e,t)))}),kg={$:"Http"},Ng={$:"Https"},Rg=Hr,$g=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),_g=i(function(e,t,r,n,a){if(fd(a)||f(Rg,"@",a))return fi;var i=f(Rl,":",a);if(i.b){if(i.b.b)return fi;var o=i.a,u=xl(f(Lo,o+1,a));if("Nothing"===u.$)return fi;var s=u;return ci(p($g,e,f(Do,o,a),s,t,r,n))}return ci(p($g,e,a,fi,t,r,n))}),Lg=a(function(e,t,r,n){if(fd(n))return fi;var a=f(Rl,"/",n);if(a.b){var i=a.a;return h(_g,e,f(Lo,i,n),t,r,f(Do,i,n))}return h(_g,e,"/",t,r,n)}),xg=n(function(e,t,r){if(fd(r))return fi;var n=f(Rl,"?",r);if(n.b){var a=n.a;return d(Lg,e,ci(f(Lo,a+1,r)),t,f(Do,a,r))}return d(Lg,e,fi,t,r)}),Pg=r(function(e,t){if(fd(t))return fi;var r=f(Rl,"#",t);if(r.b){var n=r.a;return l(xg,e,ci(f(Lo,n+1,t)),f(Do,n,t))}return l(xg,e,fi,t)}),Dg=function(e){return f(Ko,"http://",e)?f(Pg,kg,f(Lo,7,e)):f(Ko,"https://",e)?f(Pg,Ng,f(Lo,8,e)):fi},Ug=Jt,Og=zt(Yt),Mg=ca,Fg=r(function(e,t){return x(e,t)}),Vg=Lr,Kg=a(function(e,t,r,n){var a=L(r,n)>0?ni:Ra,i=wu(r-n),o=f(ti,1,Vg(i)/e|0),u=o,s=f(Pa,function(e){return t(e/u)},f(Bi,0,o));return e<=0||$(r,n)?mr:f(Pa,function(e){return f(a,r,e*i)},s)}),Hg=r(function(e,t){var n=r(function(t,r){return wp(f(Pa,Mg(0),d(Kg,e.speed,e.easing,t,r-e.offset)))});return f(Cp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(Tp,Fg,Og,Ug(t)))}),jg=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,x(wd(t.wallet),mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(_p,a,n.address,xd(to(a)),eg(a));return d(Nd,t,i,Co,mr)}return ug(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Nd,U(t,{inputs:U(u,{userRole:o})}),vo,Co,F([function(){return"Buyer"===o.$?d($d,"create offer type changed","input","sell dai",0):d($d,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return ug(f(kd,U(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return ug(f(kd,U(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return ug(f(kd,U(u,{fiatType:c}),t));case"FiatTypeLostFocus":return ug(U(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return ug(f(kd,U(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return ug(f(kd,U(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return ug(f(kd,U(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return ug(f(kd,U(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Nd,(g?kd(U(u,{fiatType:""})):Oa)(U(t,{showFiatTypeDropdown:g})),vo,Co,g?F([d($d,"currency-selector-clicked","input","",0)]):mr);case"CreateClicked":var v=e.a,n=e.b,y=Td(t.inputs);if("Ok"===y.$){var m=y.a,b=f(kl,n,m);return ug(U(t,{depositAmount:ci(Sl(Hd(b))),txChainStatus:ci(f(ag,v,b))}))}var C=y.a;return d(Nd,U(t,{errors:C}),f($p,Xu(og),function(){return f(Hg,U(Sg,{offset:60}),"inputError")}()),Co,mr);case"AbortCreate":return d(Nd,U(t,{txChainStatus:fi}),vo,Co,F([d($d,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Zp,v,b);var e=v.a,r=function(){var t=Pf(l(Fd,Pd(e),xd(v),E)),r={onBroadcast:fi,onMined:fi,onSign:ci(f(ng,e,b))};return f(wo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return $(f(Pu,a,E),Ca)?x(ci(rg(e)),r):f(Zp,v,b)}return x(ci(rg(e)),r)}(),T=S.a,w=S.b;return d(Nd,U(t,{txChainStatus:T}),vo,w,mr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return ug(U(t,{txChainStatus:ci(l(tg,a,b,A))}))}var B=I.a;return d(Nd,U(t,{txChainStatus:fi}),vo,Co,F([ga(f(hg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,R=U(t,{allowance:ci(N)}),_=x(R.txChainStatus,R.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var L=_.a.a,b=L.b,P=_.b.a;if($(f(Pu,N,P),Ca))return ug(R);var D=f(Zp,to(a),b),T=D.a,w=D.b;return d(Nd,U(R,{txChainStatus:T}),vo,w,mr)}return ug(R)}var O=k.a;return d(Nd,t,vo,Co,F([ga(f(fg,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return ug(U(t,{txChainStatus:ci(f(ig,v,A))}))}var B=I.a;return d(Nd,U(t,{txChainStatus:fi}),vo,Co,F([ga(f(hg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Nd,t,vo,Co,F([ga(f(lg,"create",B))]))}var M=e.a,V=e.b.a,K=f(yg,sg,Ad(f(kh,M,V)));if("Just"===K.$){var H=K.a;return d(Nd,t,vo,Co,F([ha(f(kf,M,H))]))}return d(Nd,t,vo,Co,F([ga(f(Kf,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Nd,t,vo,Co,F([va]));case"NoOp":return ug(t);default:var j=e.a;return d(Nd,t,vo,Co,F([j]))}}),qg={$:"Open"},Gg=r(function(e,t){return f(Su,Sd(e),Sd(t))}),zg=r(function(e,t){return $(t.state.phase,qg)&&$(f(Gg,t.derived.phaseEndTime,e),wa)}),Yg={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:mr},Wg=r(function(e,t){return{maxDai:t,minDai:e}}),Jg=f(Wg,fi,fi),Qg={$:"Expires"},Xg=function(e){return x({errors:Jg,filterFunc:zg,inputs:Yg,showCurrencyDropdown:!1,tradeTable:lo(x(Qg,ho)),wallet:e},vo)},Zg=r(function(e,t){return U(t,{paymentMethod:e})}),ev=r(function(e,t){return U(t,{paymentMethodTerms:e})}),tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(uo,e.inputs.paymentMethodTerms,F([t]));return U(e,{inputs:f(ev,r,f(Zg,"",e.inputs))})},rv=r(function(e,t){var r=f(Wf,ac(e),t.inputs.paymentMethodTerms);return U(t,{inputs:f(ev,r,t.inputs)})}),nv=function(e){return U(e,{filterFunc:zg,inputs:Yg})},av=function(e){return{$:"TradeTableMsg",a:e}},iv=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),ov=function(e){return d(iv,e,vo,Co,mr)},uv=r(function(e,t){return U(t,{fiatType:e})}),sv=r(function(e,t){return U(t,{maxDai:e})}),cv=r(function(e,t){return U(t,{minDai:e})}),fv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return ov(U(t,{inputs:f(cv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return ov(U(t,{inputs:f(sv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return ov(U(t,{inputs:f(uv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return ov(U(t,{inputs:(n?uv(""):Oa)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return ov(U(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return ov(U(t,{inputs:f(Zg,r,t.inputs)}));case"AddSearchTerm":return ov(tv(t));case"RemoveTerm":var a=e.a;return ov(f(rv,a,t));case"ResetSearch":return ov(nv(t));case"TradeTableMsg":var i=e.a,o=f(xf,i,t.tradeTable);return d(iv,U(t,{tradeTable:o.model}),f(Df,av,o.cmd),f(ko,av,o.chainCmd),f(Pa,Qi(av),o.appCmds));case"NoOp":return ov(t);default:var u=e.a;return d(iv,t,vo,Co,F([u]))}}),lv=a(function(e,t,r,n){return e(Qf(F([x("title",jf(t)),x("body",function(){if("Nothing"===r.$)return Jf;var e=r.a;return jf(e)}()),x("image",function(){if("Nothing"===n.$)return Jf;var e=n.a;return jf(e)}())])))}),dv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},hv=function(e){return e.a+"="+e.b},pv=function(e){return e.b?"?"+f($i,"&",f(Pa,hv,e)):""},gv=r(function(e,t){return"/"+(f($i,"/",e)+pv(t))}),vv=function(e){switch(e.$){case"Home":return f(gv,F(["DAIHard"]),mr);case"Create":return f(gv,F(["DAIHard","create"]),mr);case"Trade":var t=e.a,r=e.b;return f(gv,F(["DAIHard","trade",dv(t),Ri(r)]),mr);case"Marketplace":return f(gv,F(["DAIHard","marketplace"]),mr);case"AgentHistory":var n=e.a;return f(gv,F(["DAIHard","history",Hf(n)]),mr);default:return f(gv,mr,mr)}},yv={$:"NotFound"},mv=function(e){return{$:"AgentHistory",a:e}},bv={$:"Create"},Cv={$:"Home"},Ev={$:"Marketplace"},Sv=function(e){return{$:"Parser",a:e}},Tv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),wv=r(function(e,t){return Sv(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(Tv,f(Na,u,r),s,a,i,o(l))])}return mr}return mr})}),Iv=f(wv,"ADDRESS",f(Ao,hh,Ad)),Av={$:"Eth"},Bv={$:"Kovan"},kv=f(wv,"FACTORY",function(e){switch(e){case"eth":return ci(eo(Av));case"keth":return ci(eo(Bv));case"dai":return ci(to(Zi));case"kdai":return ci(to(pg));case"xdai":return ci(eo(ro));default:return fi}}),Nv=f(wv,"NUMBER",xl),Rv=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Tv,r,n,a,i,e(o))}),$v=r(function(e,t){var r=t.a;return Sv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(Pa,Rv(u),r(h(Tv,n,a,i,o,e)))})}),_v=function(e){return l(xa,uo,mr,e)},Lv=r(function(e,t){return _v(f(Pa,e,t))}),xv=function(e){return Sv(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(Tv,f(Na,u,r),s,a,i,o)]):mr}return mr})},Pv=r(function(e,t){var r=e.a,n=t.a;return Sv(function(e){return f(Lv,n,r(e))})}),Dv=Sv(function(e){return F([e])}),Uv=f(Pv,xv("DAIHard"),function(e){return Sv(function(t){return f(Lv,function(e){return(0,e.a)(t)},e)})}(F([f($v,Cv,Dv),f($v,bv,xv("create")),f($v,kf,f(Pv,xv("trade"),f(Pv,kv,Nv))),f($v,Ev,xv("marketplace")),f($v,mv,f(Pv,xv("history"),Iv)),f($v,function(e){return mv(e)},f(Pv,xv("history"),Iv))]))),Ov=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 ci(t.value)}return ci(t.value)}return fi}},Mv=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(Na,t,Mv(r))}return mr}return mr},Fv=function(e){var t=f(Li,"/",e);if(t.b&&""===t.a){var r=t.b;return Mv(r)}var r=t;return Mv(r)},Vv=Xt,Kv=r(function(e,t){if("Nothing"===t.$)return ci(F([e]));var r=t.a;return ci(f(Na,e,r))}),Hv=r(function(e,t){var r=f(Li,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=Vv(n);if("Nothing"===o.$)return t;var u=o.a,s=Vv(i);if("Nothing"===s.$)return t;var c=s.a;return l(Qh,u,Kv(c),t)}return t}),jv=function(e){if("Nothing"===e.$)return Vh;var t=e.a;return l(xa,Hv,Vh,f(Li,"&",t))},qv=r(function(e,t){var r=e.a;return Ov(r(h(Tv,mr,Fv(t.path),jv(t.query),t.fragment,Oa)))}),Gv=function(e){return f(pc,yv,f(qv,Uv,e))},zv=ia,Yv=r(function(e,t){return f(zv,e,vv(t))}),Wv=qe("connectToWeb3",function(e){return Jf}),Jv=function(e){return Qf(F([x("event",jf(e.event)),x("category",jf(e.category)),x("label",jf(e.label)),x("value",tl(e.value))]))},Qv=r(function(e,t){return Qf(F([x("address",jf(Hf(e))),x("signSeedMsg",jf(t))]))}),Xv=qe("gTagOut",Oa),Zv=qe("genPrivkey",Oa),ey=r(function(e,t){for(;;){if(!t.b)return fi;var r=t.a,n=t.b;if(e(r))return ci(r);var a=e,i=n;e=a,t=i}}),ty=n(function(e,t,r){return f(yg,Lc(t),f(Bo,function(e){return e.trades},f(ey,function(t){return $(t.factory,e)},r)))}),ry=qe("notifyPort",Oa),ny=qe("requestNotifyPermissionPort",function(e){return Jf}),ay=r(function(e,t){return U(t,{wallet:e})}),iy=r(function(e,t){return x(f(kd,t.inputs,U(t,{wallet:e})),function(){var t=x(wd(e),mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(_p,n,r.address,xd(to(n)),eg(n))}return vo}())}),oy=r(function(e,t){return U(t,{wallet:e})}),uy=function(e){return{$:"AllowanceFetched",a:e}},sy=r(function(e,t){return x(U(t,{wallet:e}),function(){var r=P(wd(e),mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return $(mg(e),ci(i.factory))?d(_p,a,n.address,i.creationInfo.address,uy):vo}return vo}())}),cy=function(e){return{$:"AgentHistoryModel",a:e}},fy=function(e){return{$:"CreateModel",a:e}},ly=function(e){return{$:"CreateMsg",a:e}},dy=function(e){return{$:"MarketplaceModel",a:e}},hy=function(e){return{$:"TradeModel",a:e}},py=function(e){return{$:"TradeMsg",a:e}},gy=r(function(e,t){switch(t.$){case"BetaLandingPage":return x(t,vo);case"CreateModel":var r=t.a,n=f(iy,e,r),a=n.a,i=n.b;return x(fy(a),f(Df,ly,i));case"TradeModel":var o=t.a,u=f(sy,e,o),s=u.a,c=u.b;return x(hy(s),f(Df,py,c));case"MarketplaceModel":var l=t.a;return x(dy(f(oy,e,l)),vo);default:var d=t.a;return x(cy(f(ay,e,d)),vo)}}),vy=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),yy=function(e){return{$:"PartiallyLoadedTrade",a:e}},my=r(function(e,t){return yy(g(vy,e,t,fi,fi,fi,fi,fi))}),by=function(e){return{$:"CurrentBlockFetched",a:e}},Cy=Wo(f(Ao,Ho,uh)),Ey=function(e){return gp({decoder:Cy,method:"eth_blockNumber",params:mr,url:e})},Sy=function(e){return f($p,by,Ey(e))},Ty=r(function(e,t){return{address_:e,blocknum:t}}),wy=function(e){return No(function(t){return di(x(t,e))})},Iy=n(function(e,t,r){var n=t.a,a=r.a;return No(function(t){return f(Bh,function(t){var r=t.a,n=t.b;return f(Oo,Lf(e(n)),a(r))},n(t))})}),Ay=r(function(e,t){return l(Iy,r(function(e,t){return e(t)}),t,e)}),By=Jo(f(Ay,Sh,f(Ay,ph,wy(Ty)))),ky=r(function(e,t){return{data:ci(f(Af,"createdTrades(uint256)",F([Md(t)]))),decoder:By,from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),Ny=n(function(e,t,r){return f($p,r,f(mp,Rh(e),f(ky,xd(e),t)))}),Ry=function(e){return{$:"CreationInfoFetched",a:e}},$y=r(function(e,t){return l(Ny,e,Iu(t),Ry)}),_y=function(e){return{$:"EventSentryMsg",a:e}},Ly=function(e){return{$:"BlockNumber",a:e}},xy=function(e){return{$:"EventSentry",a:e}},Py=function(e){return{$:"Set_elm_builtin",a:e}},Dy=Py(Vh),Uy=r(function(e,t){return x(xy({blockNumber:fi,errors:mr,nodePath:t,pending:Dy,ref:1,requests:Vh,tagger:e,watching:Dy}),f($p,f(Ao,Ly,e),Ey(t)))}),Oy=function(e){return f(Uy,_y,Rh(e))},My=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),Fy=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},Vy=Fy(f(My,fi,fi)),Ky=n(function(e,t,r){return{allowance:fi,blocknumOnInit:fi,chatHistoryModel:fi,eventSentry:t,eventsWaitingForChatHistory:mr,expandedPhase:qg,secureCommInfo:Vy,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:fi,wallet:r}}),Hy=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),jy=n(function(e,t,r){var n=f($y,t,r),a=Oy(t),i=a.a,o=a.b;return d(Hy,l(Ky,f(my,t,r),i,e),go(F([n,o,Sy(Rh(t))])),Co,F([pa]))}),qy=function(e){return{$:"LoadedTrade",a:e}},Gy=r(function(e,t){var r=Oy(t.factory),n=r.a,a=r.b;return d(Hy,l(Ky,qy(t),n,e),go(F([a,Sy(Rh(t.factory))])),Co,F([pa]))}),zy=function(e){return{data:ci(f(Af,"abort()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Yy=function(e){return{data:ci(f(Af,"burn()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Wy=function(e){return{data:ci(f(Af,"claim()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Jy=r(function(e,t){return{data:ci(f(Af,"initiatorStatement(string)",F([Up(t)]))),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),Qy=function(e){return{data:ci(f(Af,"recall()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Xy=function(e){return{data:ci(f(Af,"release()",mr)),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},Zy=r(function(e,t){return{data:ci(f(Af,"responderStatement(string)",F([Up(t)]))),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),em=r(function(e,t){return{amount:t,fiatType:e}}),tm=f(Go,function(e){var t=Vl(e);if("Just"===t.$){var r=t.a;return Vi(r)}return zo("Can't convert that to a BigInt")},Yo),rm=l(Fi,em,f(mh,0,Yo),f(mh,1,tm)),nm={$:"Bank"},am={$:"Cash"},im=function(e){switch(e){case"cash":return ci(am);case"bank":return ci(nm);case"custom":return ci(md);default:return fi}},om=f(Go,function(e){var t=im(e);if("Just"===t.$){var r=t.a;return Vi(r)}return zo("")},Yo),um=l(Fi,bd,f(vh,"type",om),f(vh,"info",Yo)),sm=ue,cm=function(e){var t=l(Fi,Fp,f(vh,"price",rm),f(vh,"paymentmethods",sm(um)));return f(Oh,t,e)},fm=r(function(e,t){return{commPubkey:t,responder:e}}),lm=r(function(e,t){var n=r(function(t,r){return l(_o,t,t+2*r,e)}),a=f(Ao,uh,Oo(ri(2)));return f(Bh,function(t){return f(Oo,function(e){return f(n,t+64,e)},uh(l(_o,t,t+64,e)))},a(t))}),dm=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($a,dm(e),P(0,0,t),r);if(n.b)return li("invalid UTF-8 sequence");var a=n.c;return di(a)}),pm=q,gm=function(e){return os(pm(e))},vm=function(e){return l(hm,r(function(e,t){return O(t,gm(e))}),"",e)},ym=No(function(e){var t=e.a,r=e.b;return f(Oo,f(Po,t,r),f(Bh,vm,f(Bh,f(Ao,Pa(uh),ah),f(Oo,Wf(f(Ao,fd,Uu)),f(Oo,Ps(2),f(lm,t,Uo(r)))))))}),mm=f(jd,f(yh,1,ym),f(jd,f(yh,0,ph),Vi(fm))),bm=r(function(e,t){return{commPubkey:t,terms:e}}),Cm=f(jd,f(yh,1,ym),f(jd,f(yh,0,ym),Vi(bm))),Em=function(e){return{statement:e}},Sm=f(jd,f(yh,0,ym),Vi(Em)),Tm=function(e){return{statement:e}},wm=f(jd,f(yh,0,ym),Vi(Tm)),Im={$:"AbortedEvent"},Am={$:"BurnedEvent"},Bm={$:"ClaimedEvent"},km=function(e){return{$:"CommittedEvent",a:e}},Nm=function(e){return{$:"InitiatedEvent",a:e}},Rm=function(e){return{$:"InitiatorStatementLogEvent",a:e}},$m={$:"PokeEvent"},_m={$:"RecalledEvent"},Lm={$:"ReleasedEvent"},xm=function(e){return{$:"ResponderStatementLogEvent",a:e}},Pm=zd(f(pc,Jd,Wd("^((0[Xx]){1})?[0-9a-fA-F]+$"))),Dm=function(e){return Pm(e)?di(Us(Ho(e))):li("Something in here is not very hexy: "+dh(e))},Um=Wo(Dm),Om=f(vh,"topics",f(mh,0,Um)),Mm=function(e){return Us(f($i,"",f(Pa,f(Ao,gs,Vs),Sf(f(Pa,mi,Ls(e))))))},Fm=f(Go,function(e){return $(e,Mm("Initiated(string,string)"))?f(Mi,Nm,Cm):$(e,Mm("Committed(address,string)"))?f(Mi,km,mm):$(e,Mm("Recalled()"))?Vi(_m):$(e,Mm("Claimed()"))?Vi(Bm):$(e,Mm("Aborted()"))?Vi(Im):$(e,Mm("Released()"))?Vi(Lm):$(e,Mm("Burned()"))?Vi(Am):$(e,Mm("InitiatorStatementLog(string)"))?f(Mi,Rm,Sm):$(e,Mm("ResponderStatementLog(string)"))?f(Mi,xm,wm):$(e,Mm("Poke()"))?Vi($m):zo("Unrecognized topic hash")},Om),Vm={$:"Initiator"},Km={$:"Responder"},Hm=r(function(e,t){return $(t,e.parameters.initiatorAddress)?ci(Vm):f(yg,function(e){return $(t,e)?ci(Km):fi},e.state.responder)}),jm=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},qm=function(e){switch(e.$){case"Invalid":return fi;case"PartiallyLoadedTrade":var t=e.a;return ci(t.factory);default:var r=e.a;return ci(r.factory)}},Gm=function(e){return $(e.buyerDeposit,Al(e.tradeAmount))&&$(e.abortPunishment,Il(e.tradeAmount))},zm={$:"Invalid"},Ym=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Wm=r(function(e,t){return bl(Sd(t)+Sd(e))}),Jm=function(e){var t=id(ed(e.amount));if("Just"===t.$){return t.a}f(Ff,"Error converting FiatValue to float--string -> float failed!",e);return 0},Qm=r(function(e,t){return(t-e)/e}),Xm=r(function(e,t){var r=Jm(t),n=od(e);return"USD"===t.fiatType?ci(f(Qm,n,r)):fi}),Zm=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 bl(0)}}();return{margin:f(Xm,e.tradeAmount,r.price),phaseEndTime:f(Wm,t.phaseStartTime,n)}}),eb=function(e){var t=P(x(e.creationInfo,e.parameters),x(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 qy(v(Ym,e.factory,e.id,n,a,o,u,s,l(Zm,a,o,u)))}return yy(e)},tb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return eb(U(r,{creationInfo:ci(e)}));case"LoadedTrade":f(Ff,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return zm}}),rb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return eb(U(r,{parameters:ci(e)}));case"LoadedTrade":t.a,f(Ff,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return zm}}),nb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return eb(U(r,{phaseStartInfo:ci(e)}));case"LoadedTrade":t.a,f(Ff,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return zm}}),ab=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return eb(U(r,{state:ci(e)}));case"LoadedTrade":var n=t.a;return qy(U(n,{state:e}));default:return zm}}),ib=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return eb(U(r,{terms:ci(e)}));case"LoadedTrade":t.a,f(Ff,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return zm}}),ob=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}}),ub=Jo(f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Vo,f(Ay,ph,wy(ob))))))))))),sb=function(e){return{data:ci(f(Af,"getParameters()",mr)),decoder:ub,from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},cb={$:"Buyer"},fb=function(e){return f(Bo,function(e){return bl(1e3*e)},xl(ed(e)))},lb=function(e){return El(e)},db=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return li(a)}var i=t.a;if("Err"===r.$){var a=r.a;return li(a)}var o=r.a;if("Err"===n.$){var a=n.a;return li(a)}var u=n.a;return di(l(e,i,o,u))}),hb=function(e){var t=f(cd,"error converting BigInt to Time.Posix",fb(e.autoabortInterval)),r=f(cd,"error converting BigInt to Time.Posix",fb(e.autoreleaseInterval)),a=f(cd,"error converting BigInt to Time.Posix",fb(e.autorecallInterval));return d(db,n(function(t,r,n){return{abortPunishment:lb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:lb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?yl:cb,pokeReward:lb(e.pokeReward),tradeAmount:lb(e.tradeAmount)}}),a,t,r)},pb=n(function(e,t,r){return f($p,r,f(Sp,hb,f(mp,Rh(e),sb(t))))}),gb=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}}}}}}}}}}},vb=Jo(f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,wy(gb)))))))))))),yb=function(e){return{data:ci(f(Af,"getPhaseStartInfo()",mr)),decoder:vb,from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},mb=i(function(e,t,r,n,a){if("Nothing"===t.$)return fi;var i=t.a;if("Nothing"===r.$)return fi;var o=r.a;if("Nothing"===n.$)return fi;var u=n.a;if("Nothing"===a.$)return fi;var s=a.a;return ci(d(e,i,o,u,s))}),bb=function(e){return h(mb,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}}),fb(e.v6),fb(e.v7),fb(e.v8),fb(e.v9))},Cb=n(function(e,t,r){return f($p,r,f(Sp,bb,f(mp,Rh(e),yb(t))))}),Eb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Sb=Jo(f(Ay,Sh,f(Ay,ph,f(Ay,Sh,f(Ay,Sh,f(Ay,Sh,wy(Eb))))))),Tb=function(e){return{data:ci(f(Af,"getState()",mr)),decoder:Sb,from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},wb={$:"Aborted"},Ib={$:"Burned"},Ab={$:"NotClosed"},Bb={$:"Recalled"},kb={$:"Released"},Nb=function(e){switch(f(pc,99,xl(ed(e)))){case 0:return ci(Ab);case 1:return ci(Bb);case 2:return ci(wb);case 3:return ci(kb);case 4:return ci(Ib);default:return fi}},Rb={$:"Closed"},$b={$:"Committed"},_b={$:"Judgment"},Lb=function(e){switch(f(pc,99,xl(ed(e)))){case 1:return ci(qg);case 2:return ci($b);case 3:return ci(_b);case 4:return ci(Rb);default:return fi}},xb=function(e){return $(e,Ld("0x0000000000000000000000000000000000000000"))?fi:ci(e)},Pb=a(function(e,t,r,n){if("Nothing"===t.$)return fi;var a=t.a;if("Nothing"===r.$)return fi;var i=r.a;if("Nothing"===n.$)return fi;var o=n.a;return ci(l(e,a,i,o))}),Db=function(e){var t=fb(e.phaseStartTimestamp),r=Lb(e.phase),a=Nb(e.closedReason);return d(Pb,n(function(t,r,n){return{balance:lb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:xb(e.responder)}}),r,t,a)},Ub=n(function(e,t,r){return f($p,r,f(Sp,Db,f(mp,Rh(e),Tb(t))))}),Ob=i(function(e,t,r,n,a){return go(F([l(pb,e,t,r),l(Ub,e,t,n),l(Cb,e,t,a)]))}),Mb=function(e){var t=sg(e);if("Just"===t.$){return t.a}f(Ff,"Warning! BigInt to Int conversion failed!",ed(e));return 0},Fb=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),Vb=n(function(e,t,r){for(;;){var n=f(Wa,32,e),a=n.a,i=n.b;if(L(ai(a),32)<0)return f(ii,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(Na,za(a),t),s=r+1;e=o,t=u,r=s}}),Kb=function(e){return e.b?l(Vb,e,mr,0):Ga},Hb=rn,jb=function(e){var t=h(Hb,Fb,f(vh,"encapsulation",Yo),f(vh,"iv",Yo),f(vh,"tag",Yo),f(vh,"encrypted",Yo)),r=sm(t),n=f(wh,r,e);if("Err"===n.$){var a=n.a;return li(Ui(a))}var i=n.a;return function(e){var t=x(f(Lc,0,e),f(Lc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return di(x(r,n))}return li("Decoded list has less than 2 items.")}(Kb(i))},qb=function(e){var t=function(e){var t=$o(e);return t>1114111?li("string is too long"):di(f(is,pm(t),e))};return f(Oo,$i(""),ah(f(Pa,t,e)))},Gb=function(e){var t=e.a,r=e.b;return qb(F([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},zb=r(function(e,t){return Qf(F([x("message",jf(e)),x("pubkeyHexStrings",f(Ih,jf,F([t.initiatorPubkey,t.responderPubkey])))]))}),Yb=function(e){return{$:"LoadedCommInfo",a:e}},Wb=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),Jb=function(e){var t=x(e.initiatorPubkey,e.responderPubkey);if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return Yb(f(Wb,r,n))}return Fy(e)},Qb=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return Jb(U(r,{initiatorPubkey:ci(e)}))}var n=t.a;return Yb(U(n,{initiatorPubkey:e}))}),Xb=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return Jb(U(r,{responderPubkey:ci(e)}))}var n=t.a;return Yb(U(n,{responderPubkey:e}))}),Zb=r(function(e,t){var r=x(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return cb}r.a,r.b;return yl}if("Buyer"===r.b.$){r.a,r.b;return yl}r.a,r.b;return cb}),eC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=mi(r),i=f(Pl,a,n),o=ls(f(qs,a,n)),u=O(t,F([o])),s=i,c=u;e=s,t=c}}),tC=function(e){var t=Kb(f(eC,Ls(e),mr));return l(Id,Fg,h(mb,Fb,f(Lc,0,t),f(Lc,1,t),f(Lc,2,t),f(Lc,3,t)),h(mb,Fb,f(Lc,4,t),f(Lc,5,t),f(Lc,6,t),f(Lc,7,t)))},rC=r(function(e,t){if("Statement"===t.$){t.a;return l(la,"New Message from Trade",fi,fi)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(la,n,fi,fi)}),nC={$:"Aborted"},aC={$:"Burned"},iC={$:"Claimed"},oC=function(e){return{$:"Committed",a:e}},uC=function(e){return{$:"Encrypted",a:e}},sC={$:"FailedDecode"},cC={$:"Initiated"},fC={$:"Recalled"},lC={$:"Released"},dC=function(e){return{$:"StateChange",a:e}},hC=function(e){return{$:"Statement",a:e}},pC=lr,gC=fr,vC=r(function(e,t){var r=ai(e),n=32-ai(t.tail)-r,a=l(pC,32,t.tail,e);return n<0?{nodeList:f(Na,za(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(gC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(Na,za(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:qa}}),yC=ur,mC=y,bC=a(function(e,t,r,n){var a=Nc&t>>>e;if(L(a,ai(n))>-1){if(5===e)return f(yC,za(r),n);var i=Ya(d(bC,e-ja,t,r,qa));return f(yC,i,n)}var o=f(Rc,a,n);if("SubTree"===o.$){var u=o.a,i=Ya(d(bC,e-ja,t,r,u));return l(Dc,a,i,n)}var i=Ya(d(bC,e-ja,t,r,mC(o)));return l(Dc,a,i,n)}),CC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ai(i),u=ai(e),s=r+(u-o);if($(u,32)){if(L(s>>>ja,1<0){var c=n+ja,f=d(bC,c,r,e,mC(Ya(a)));return d(Fa,s,c,f,qa)}return d(Fa,s,n,d(bC,n,r,e,a),qa)}return d(Fa,s,n,a,e)}),EC=r(function(e,t){var r=(t.a,t.c,t.d),n=ai(e),a=32-ai(r)-n,i=l(pC,32,r,e),o=f(CC,i,t);if(a<0){var u=l(gC,a,n,e);return f(CC,u,o)}return o}),SC=sr,TC=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(SC,i,t,r)}return f(Na,e,t)});return{nodeList:l(SC,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(L(n,128)<1){var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(SC,o,t,r)}var n=e.a;return f(EC,n,t)});return f(EC,i,l(SC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(SC,o,t,r)}var n=e.a;return f(vC,n,t)});return f(ii,!0,f(vC,i,l(SC,o,TC(e),a)))}),IC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(Na,r,t)}),AC=f(xa,IC,mr),BC=n(function(e,t,r){var n=Zb(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return ci(dC(cC));case"CommittedEvent":var r=t.a;return ci(dC(oC(r.responder)));case"RecalledEvent":return ci(dC(fC));case"ClaimedEvent":return ci(dC(iC));case"AbortedEvent":return ci(dC(nC));case"ReleasedEvent":return ci(dC(lC));case"BurnedEvent":return ci(dC(aC));case"InitiatorStatementLogEvent":var r=t.a;return ci(hC({blocknum:e,message:function(){var e=tC(r.statement);if("Just"===e.$){var t=e.a;return uC(t)}return sC}(),who:n(Vm)}));case"ResponderStatementLogEvent":var r=t.a;return ci(hC({blocknum:e,message:function(){var e=tC(r.statement);if("Just"===e.$){var t=e.a;return uC(t)}return sC}(),who:n(Km)}));default:return fi}}(),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:fi}},a),o=f(wC,r.history,Kb(AC(F([i])))),u=L(e,r.lastNotificationBlocknum)>0?x(f(Bo,rC($(r.userRole,r.trade.parameters.initiatorRole)),a),e):x(fi,r.lastNotificationBlocknum),s=u.a;return P(U(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),AC(F([s])))}),kC=zr,NC=function(e){var t=l(Fi,Fg,f(vh,"id",kC),f(vh,"message",Yo));return f(Ed,Ui,f(wh,t,e))},RC=function(e){return{$:"Decrypted",a:e}},$C=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),_C=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(BC,n,a,t),o=i.a,u=i.b,s=i.c;return d($C,o,u,fi,s);case"MessageInputChanged":var c=e.a;return d($C,U(t,{messageInput:c}),!1,fi,mr);case"MessageSubmit":return d($C,U(t,{messageInput:""}),!1,ci(t.messageInput),mr);default:var h=e.a,p=NC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Lc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=U(E,{message:RC(y)}),T=U(b,{eventInfo:hC(S)}),w=l(Oc,v,T,t.history);return d($C,U(t,{history:w}),!1,fi,mr)}return d($C,t,!1,fi,F([ga(f(Kf,"got a decryption result, but for an event that is not a message!",b))]))}return d($C,t,!1,fi,F([ga(f(Kf,"got a decryption result, but for an id out of bounds!",x(v,t.history)))]))}var I=p.a;return d($C,t,!1,fi,F([ga(f(Kf,"Error decoding decryption result",I))]))}}),LC=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),xC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),PC=function(e){return{onBroadcast:fi,onMined:ci(x(LC(e),fi)),onSign:ci(xC(e))}},DC=qe("encryptToPubkeys",Oa),UC=n(function(e,t,r){return{data:ci(f(Af,"commit(address,string)",F([Ud(t),Up(r)]))),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),OC=n(function(e,t,r){return{data:ci(f(Af,"commit(address,string)",F([Ud(t),Up(r)]))),decoder:Vi(vr),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}}),MC=function(e){return{$:"CommitMined",a:e}},FC={$:"CommitNeedsSig"},VC=function(e){return{$:"CommitSigned",a:e}},KC=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?OC:UC}(),a=Pf(function(){return"Token"===e.factory.$?Oa:Gp(Sl(jm(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return x(ci(FC),f(wo,{onBroadcast:fi,onMined:ci(x(MC,fi)),onSign:ci(VC)},a))}),HC=r(function(e,t){return Qf(F([x("id",tl(e)),x("encapsulation",jf(t.encapsulatedKey)),x("iv",jf(t.iv)),x("tag",jf(t.tag)),x("encrypted",jf(t.message))]))}),jC=qe("decryptMessage",Oa),qC=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return x(r-1,f(Na,x(r,e),n))});return l(Sa,n,x(t-1,mr),e).b},GC=r(function(e,t){return go(f(Pa,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 jC(f(HC,r,s))}return vo}return vo},qC(e.history)))}),zC=function(e){if("Just"===e.$){return e.a}return fi},YC=function(e){var t=zC(l(Id,Hm,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return ci(r)}return fi}(),f(Bo,function(e){return e.address},wd(e.wallet)))),r=x(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(GC,n,a)}return vo},WC=r(function(e,t){return f(Bo,function(t){var r=x(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return yl}r.a,r.b;return cb}if("Seller"===r.b.$){r.a,r.b;return cb}r.a,r.b;return yl},f(Hm,e,t))}),JC=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return P(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(BC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=P(d,n||h,f(uo,a,p));e=g,t=v}}),e,P(t,!1,mr))}),QC=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),XC=i(function(e,t,r,n,a){return f(JC,n,p(QC,e,r,t,Ga,a,""))}),ZC=function(e){return{$:"ChatHistoryMsg",a:e}},eE=a(function(e,t,r,n){var a=P(t,wd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(WC,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return P(ci(t),r,f(Pa,Qi(ZC),n))}(h(XC,e,c,i,n,u))}return P(fi,!1,mr)}return P(fi,!1,mr)}),tE={$:"Abort"},rE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),nE=function(e){return{$:"ActionNeedsSig",a:e}},aE=function(e){return{$:"ApproveMining",a:e}},iE={$:"ApproveNeedsSig"},oE=function(e){return{$:"ApproveSigned",a:e}},uE={$:"Burn"},sE={$:"Claim"},cE=function(e){return{$:"CommitMining",a:e}},fE=function(e){return{$:"ConfirmingAction",a:e}},lE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),dE=function(e){return{$:"EventLogFetched",a:e}},hE=function(e){return{$:"ParametersFetched",a:e}},pE=function(e){return{$:"PhaseInfoFetched",a:e}},gE={$:"Poke"},vE={$:"Recall"},yE={$:"Release"},mE=function(e){return{$:"StartContractAction",a:e}},bE=function(e){return{$:"StateFetched",a:e}},CE=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"}},EE=function(e){return d(Hy,e,vo,Co,mr)},SE={align:Of,label:"cantFindTradeWillRetry",mainParagraphs:F([F([Vf("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:cg},TE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(fg,e,r)}if("Nothing"===t.a.$){t.a;return f(Kf,"Couldn't decode the fetched \""+e+'" result.',fi)}return f(Kf,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),wE={align:Of,label:"tradeParametersNotDefault",mainParagraphs:F([F([Vf("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:cg},IE=to(Zi),AE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),BE=n(function(e,t,r){return l(Qh,e,Bo(function(e){return U(e,{logCount:wi(t)+e.logCount})}),r)}),kE=r(function(e,t){var r=t.a;return Py(f(Jh,e,r))}),NE=n(function(e,t,r){var n=e.a,a=f(Kh,t,n.requests);if("Nothing"===a.$)return x(xy(n),vo);var i=a.a,o=x(i.watchOnce,Nl(r));if("Nothing"===o.b.$){o.b;return x(xy(U(n,{requests:l(BE,t,r,n.requests)})),vo)}if(o.a){var u=o.b.a;return x(xy(U(n,{requests:l(BE,t,r,n.requests),watching:f(kE,t,n.watching)})),f(Bg,i.tagger,dp(u)))}return x(xy(U(n,{requests:l(BE,t,r,n.requests)})),go(f(Pa,function(e){return f(Bg,i.tagger,dp(e))},r)))}),RE=Le,$E=r(function(e,t){return f($p,f(Ao,Ly,t),f(Cp,function(t){return Ey(e)},RE(2e3)))}),_E=se,LE=fe,xE=Wr,PE=n(function(e,t,r){var n=function(e){return LE(F([e,_E(r)]))};return f(Go,function(a){var i=f(wh,e,a);if("Ok"===i.$){var o=i.a,u=f(wh,n(t),o);if("Ok"===u.$){var s=u.a;return Vi(s)}var c=u.a;return zo(Ui(c))}return Vi(r)},xE)}),DE=a(function(e,t,r,n){return f(jd,l(PE,f(vh,e,xE),t,r),n)}),UE=n(function(e,t,r){return f(jd,f(vh,e,t),r)}),OE=Wo(hh),ME=zd(f(pc,Jd,Wd("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),FE=function(e){return{$:"BlockHash",a:e}},VE=function(e){return ME(e)?di(FE(Ho(e))):li("Given blockHash "+dh(e)+" is not valid.")},KE=Wo(VE),HE=function(e){return{$:"TxHash",a:e}},jE=function(e){return ME(e)?di(HE(Ho(e))):li("Given txHash "+dh(e)+" is not valid.")},qE=Wo(jE),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}}),zE=Yr,YE=l(UE,"blockNumber",Cy,l(UE,"blockHash",KE,l(UE,"transactionHash",qE,l(UE,"transactionIndex",Cy,l(UE,"logIndex",Cy,d(DE,"removed",zE,!1,l(UE,"topics",sm(Um),l(UE,"data",Yo,l(UE,"address",OE,Vi(GE)))))))))),WE=function(e){return f(Ih,function(e){if("Just"===e.$){var t=e.a;return jf(If(t))}return Jf},e)},JE=function(e){return Qf(F([x("fromBlock",$h(e.fromBlock)),x("toBlock",$h(e.toBlock)),x("address",qf(e.address)),x("topics",WE(e.topics))]))},QE=r(function(e,t){return gp({decoder:sm(YE),method:"eth_getLogs",params:F([JE(t)]),url:e})}),XE=function(e){return{$:"BlockNum",a:e}},ZE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Cp,function(r){return f(Sp,yi(r),f(QE,e,U(t,{fromBlock:XE(n),toBlock:XE(a)})))},f(QE,e,t)):f(QE,e,t)}),eS=n(function(e,t,r){var n=r.a,a=r.b;return f(QE,e,U(t,{fromBlock:XE(n),toBlock:XE(a)}))}),tS=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(tS,e,t,i)),c=o;e=u,t=s,r=c}}),rS=r(function(e,t){return l(tS,ll,t,e)}),nS=r(function(e,t){var r=e.a,n=t.a;return Py(f(rS,r,n))}),aS=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 go(f(Pa,function(t){return f($p,f(Ao,AE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},AC(f(Pa,function(e){return f(Kh,e,r.requests)},ka(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?x(xy(U(r,{blockNumber:ci(a)})),go(F([f($E,r.nodePath,r.tagger),l(i,x(u+1,a),r.watching,eS)]))):x(t,f($E,r.nodePath,r.tagger))}return x(xy(U(r,{blockNumber:ci(a),pending:Dy,watching:f(nS,r.watching,r.pending)})),go(F([f($E,r.nodePath,r.tagger),l(i,x(a,a),r.pending,ZE),l(i,x(a,a),r.watching,eS)])))}var s=e.a.a;return x(xy(U(r,{errors:f(Na,s,r.errors)})),f($E,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(NE,t,c,d)}var s=e.b.a;return x(xy(U(r,{errors:f(Na,s,r.errors)})),vo)}),iS=r(function(e,t){var r=t.a;return Py(l(ll,e,vr,r))}),oS=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(ll,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return P(xy(U(o,{watching:f(iS,a.ref,o.watching)})),f($p,f(Ao,AE(a.ref),a.tagger),e),a.ref)}(l(ZE,a.nodePath,n,x(s,s)))}return P(xy(U(o,{pending:f(iS,a.ref,o.pending)})),vo,a.ref)}),uS=oS(!1),sS=function(e){return F([e])},cS=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($y,r.factory,r.id):vo}}(),function(){var e=P(wd(t.wallet),mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return $(mg(t.wallet),ci(a.factory))?d(_p,n,r.address,a.creationInfo.address,uy):vo}return vo}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(eE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):P(t.chatHistoryModel,!1,mr)}(),a=n.a,i=n.b,o=n.c,u=U(t,{chatHistoryModel:a}),s=i?YC(t):vo,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(Hy,u,go(F([l(Ub,p.factory,p.creationInfo.address,bE),s,r])),Co,o)}return EE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return EE(U(t,{blocknumOnInit:ci(v)}))}var y=g.a;return d(Hy,t,vo,Co,F([ga(f(fg,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=U(t,{allowance:ci(m)}),b=P(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if($(f(Pu,m,Sl(jm(C.parameters))),Ca))return EE(u);var S=l(KC,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(Hy,U(u,{txChainStatus:T}),vo,w,mr)}return EE(u)}var y=g.a;return d(Hy,t,vo,Co,F([ga(f(fg,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:Mb(I.blocknum)},B=l(uS,dE,t.eventSentry,{address:A.address,fromBlock:XE(A.blocknum),toBlock:yp,topics:mr}),k=B.a,N=B.b,u=U(t,{eventSentry:k,trade:f(tb,A,t.trade)}),R=f(pc,IE,qm(u.trade)),_=go(F([N,h(Ob,R,A.address,hE,bE,pE)]));return d(Hy,u,_,Co,mr)}if("BadBody"===g.a.$){g.a.a;return d(Hy,t,vo,Co,F([ga(SE)]))}var y=g.a;return d(Hy,t,vo,Co,F([ga(f(fg,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var L=g.a.a,D=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!$(e.a.state.phase,L.phase);default:return!1}}(),u=U(t,{expandedPhase:D?L.phase:t.expandedPhase,trade:f(ab,L,t.trade)});return d(Hy,u,YC(u),Co,mr)}return d(Hy,t,vo,Co,F([ga(f(TE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var M=g.a.a;if(Gm(M)){var u=U(t,{trade:f(rb,M,t.trade)});return d(Hy,u,YC(u),Co,mr)}return d(Hy,t,vo,Co,F([ga(wE)]))}var V=g.a.a;return d(Hy,t,vo,Co,F([ga(f(Kf,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(Hy,t,vo,Co,F([ga(f(fg,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=U(t,{trade:f(nb,H,t.trade)});return d(Hy,u,YC(u),Co,mr)}return d(Hy,t,vo,Co,F([ga(f(TE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Ah,Fm,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(Hy,t,vo,Co,F([ga(f(Kf,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(Qb,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(Xb,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=cm(e.terms);if("Ok"===r.$){var n=r.a;return x(f(ib,n,t.trade),fi)}var a=r.a;return x(t.trade,ci(f(Kf,"Couldn't decode payment methods!",a)))}return x(t.trade,fi)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return P(ci(t),r,f(Pa,Qi(ZC),n))}(l(BC,q.blockNumber,Y,r))}return d(eE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(uo,t.eventsWaitingForChatHistory,F([x(q.blockNumber,Y)])):mr}(),u=U(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?YC(u):vo;return d(Hy,u,_,Co,f(uo,f(Pa,ga,AC(F([X]))),o));case"ExpandPhase":var te=e.a;return EE(U(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return EE(U(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return EE(U(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(Hy,t,vo,Co,F([ha(mv(C.parameters.initiatorAddress))]))}return d(Hy,t,vo,Co,F([ga(f(Kf,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return EE(U(t,{txChainStatus:ci(f(lE,E,ie))}));case"AbortAction":return EE(U(t,{txChainStatus:fi}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(KC,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=Pf(l(Fd,Pd(r),C.creationInfo.address,ie)),t={onBroadcast:fi,onMined:fi,onSign:ci(oE)};return f(wo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return $(f(Pu,i,Sl(jm(C.parameters))),Ca)?x(ci(iE),n):l(KC,C,E.address,E.commPubkey)}return x(ci(iE),n)}(),T=oe.a,w=oe.b;return d(Hy,U(t,{txChainStatus:T}),vo,w,mr);case"ContractActionClicked":var ue=e.a;if($(ue,gE)||$(ue,vE)){var se=mE(ue),ce=t;e=se,t=ce;continue e}return EE(U(t,{txChainStatus:ci(fE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return P(t.txChainStatus,Co,F([ga(f(Kf,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=Pf(Qy(n.creationInfo.address));return P(ci(nE(vE)),f(wo,PC(vE),a),mr);case"Claim":var a=Pf(Wy(n.creationInfo.address));return P(ci(nE(sE)),f(wo,PC(sE),a),mr);case"Abort":var a=Pf(zy(n.creationInfo.address));return P(ci(nE(tE)),f(wo,PC(tE),a),mr);case"Release":var a=Pf(Xy(n.creationInfo.address));return P(ci(nE(yE)),f(wo,PC(yE),a),mr);case"Burn":var a=Pf(Yy(n.creationInfo.address));return P(ci(nE(uE)),f(wo,PC(uE),a),mr);default:var a=Pf(Bf(n.creationInfo.address));return P(ci(nE(gE)),f(wo,PC(gE),a),mr)}}(),T=le.a,w=le.b,o=le.c;return d(Hy,U(t,{txChainStatus:T}),vo,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return EE(U(t,{txChainStatus:ci(aE(he))}))}var V=de.a;return d(Hy,U(t,{txChainStatus:fi}),vo,Co,F([ga(f(hg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return EE(U(t,{txChainStatus:ci(cE(he))}))}var V=de.a;return d(Hy,U(t,{txChainStatus:fi}),vo,Co,F([ga(f(hg,"commit",V))]));case"CommitMined":return EE(U(t,{txChainStatus:fi}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return EE(U(t,{txChainStatus:ci(f(rE,ue,he))}))}var V=de.a;return d(Hy,U(t,{txChainStatus:fi}),vo,Co,F([ga(f(hg,CE(ue),V))]));case"ActionMined":var ue=e.a;return EE(U(t,{txChainStatus:fi}));case"EventSentryMsg":var pe=e.a,ge=f(aS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(Hy,U(t,{eventSentry:ve}),_,Co,mr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(_C,ye,be),Ee=U(t,{chatHistoryModel:ci(Ce.model)}),s=Ce.shouldCallDecrypt?YC(t):vo,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return x(DC(f(zb,r,a)),fi)}return x(vo,ci(f(Kf,"Trying to encrypt, but commInfo is not loaded",n)))}return x(vo,fi)}(),Te=Se.a,we=Se.b;return d(Hy,Ee,go(F([s,Te])),Co,O(f(Xi,ZC,Ce.appCmds),f(pc,mr,f(Bo,sS,f(Bo,ga,we)))))}return d(Hy,t,vo,Co,F([ga(f(Kf,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Bh,Gb,jb(Ie)),Be=P(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Hm,p,E.address);if("Nothing"===Ne.$)return d(Hy,t,vo,Co,F([ga(f(Kf,"Trying to encrypt, but the user is not involved in this trade.",fi))]));var Re=Ne.a,$e=function(){return Pf("Initiator"===Re.$?f(Jy,p.creationInfo.address,ke):f(Zy,p.creationInfo.address,ke))}();return d(Hy,t,vo,f(wo,{onBroadcast:fi,onMined:fi,onSign:fi},$e),mr)}var _e=Be.a,Le=Be.b;return d(Hy,t,vo,Co,F([ga(f(Kf,"Encryption successful, but the user or trade is no longer valid.",x(_e,Le)))]))}var xe=Be.c.a;return d(Hy,t,vo,Co,F([ga(f(Kf,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return EE(t)}var V=e.a.a;return d(Hy,t,vo,Co,F([ga(f(lg,"message",V))]));default:return d(Hy,t,vo,Co,F([va]))}}),fS=r(function(e,t){return{address:e,blocknum:t}}),lS=n(function(e,t,r){return function(e){return x(e.a,e.b)}(d(oS,!0,e,t,r))}),dS=n(function(e,t,r){var n=function(e){return r(f(Ah,Cm,e).returnData)},a={address:t.address,fromBlock:XE(t.blocknum),toBlock:XE(t.blocknum),topics:F([ci(Mm("Initiated(string,string)"))])};return l(lS,n,e,a)}),hS=function(e){return{data:ci(f(Af,"numTrades()",mr)),decoder:Jo(Sh),from:fi,gas:fi,gasPrice:fi,nonce:fi,to:ci(e),value:fi}},pS=r(function(e,t){return f($p,t,f(mp,Rh(e),hS(xd(e))))}),gS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(Na,a,r)}return r}),vS=r(function(e,t){return l(xa,gS(e),mr,t)}),yS=function(e){return f(vS,function(e){if("LoadedTrade"===e.$){var t=e.a;return ci(t)}return fi},Ta(e.trades))},mS=function(e){return f($a,r(function(t,r){return e(t)?r+1:r}),0)},bS=function(e){return f(mS,Qa(zm),Ta(e.trades))},CS=function(e){return U(e,{dataFetchState:U(e.dataFetchState,{invalid:bS(e),loaded:wi(yS(e))})})},ES=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),SS=r(function(e,t){var r=f(Lc,e,t.trades);if("Just"===r.$){var n=(r.a,l(Oc,e,zm,t.trades));return l(ES,CS(U(t,{trades:n})),vo,mr)}return l(ES,t,vo,F([ga(f(Kf,"markTradeInvalid ran into an out-of-range error",x(e,t.trades)))]))}),TS=n(function(e,t,r){var n=f(Lc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tb,t,a),o=l(Oc,e,i,r.trades);return x(CS(U(r,{trades:o})),mr)}return x(r,F([f(Kf,"updateTradeAddress ran into an out-of-range error",x(e,r.trades))]))}),wS=n(function(e,t,r){var n=f(Lc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(rb,t,a),o=l(Oc,e,i,r.trades);return l(ES,CS(U(r,{trades:o})),vo,mr)}return l(ES,r,vo,F([ga(f(Kf,"updateTradeParameters ran into an out-of-range error",x(e,r.trades)))]))}),IS=n(function(e,t,r){var n=f(Lc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(nb,t,a),o=l(Oc,e,i,r.trades);return l(ES,CS(U(r,{trades:o})),vo,mr)}return l(ES,r,vo,F([ga(f(Kf,"updateTradePhaseTimeInfo ran into an out-of-range error",x(e,r.trades)))]))}),AS=n(function(e,t,r){var n=f(Lc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(ab,t,a),o=l(Oc,e,i,r.trades);return l(ES,CS(U(r,{trades:o})),vo,mr)}return l(ES,r,vo,F([ga(f(Kf,"updateTradeState ran into an out-of-range error",x(e,r.trades)))]))}),BS=n(function(e,t,r){var n=f(Lc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(ib,t,a),o=l(Oc,e,i,r.trades);return l(ES,CS(U(r,{trades:o})),vo,mr)}return l(ES,r,vo,F([ga(f(Kf,"updateTTPaymentMethods ran into an out-of-range error",x(e,r.trades)))]))}),kS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),NS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),RS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),$S=function(e){return{$:"NumTradesFetchedAgain",a:e}},_S=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),LS=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),xS=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),PS=function(e){return l(ES,e,vo,mr)},DS=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=Mb(n),i=Kb(f(Pa,my(t.factory),f(Bi,0,a-1))),o=go(f(Pa,function(e){return l(Ny,t.factory,Iu(e),kS(e))},f(Bi,0,a-1)));return l(ES,U(t,{dataFetchState:l(NS,ci(a),0,0),trades:i}),o,mr)}var u=r.a;return l(ES,t,vo,F([ga(f(fg,"Factory numTrades",u))]));case"CheckForNewTrades":return l(ES,t,f(pS,t.factory,$S),mr);case"NumTradesFetchedAgain":var r=e.a,s=x(r,t.dataFetchState.total);if("Ok"===s.a.$){if("Just"===s.b.$){var n=s.a.a,c=s.b.a,d=Mb(n);if(L(c,d)<0){var p=t.dataFetchState,o=go(f(Pa,function(e){return l(Ny,t.factory,Iu(e),kS(e))},f(Bi,c,d-1))),g=Kb(f(Pa,my(t.factory),f(Bi,c,d-1)));return l(ES,U(t,{dataFetchState:U(p,{total:ci(d)}),trades:f(wC,t.trades,g)}),o,mr)}return PS(t)}s.b;return l(ES,t,vo,F([ga(f(Kf,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=s.a.a;return l(ES,t,vo,F([ga(f(fg,"Factory numTrades",u))]));case"CreationInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$){var y=r.a,m=f(fS,y.address_,Mb(y.blocknum)),b=l(dS,t.eventSentry,m,RS(v)),C=b.a,E=b.b,S=go(F([h(Ob,t.factory,m.address,_S(v),xS(v),LS(v)),E])),T=l(TS,v,m,t),w=T.a,I=T.b;return l(ES,CS(U(w,{eventSentry:C})),S,f(Pa,ga,I))}var u=r.a;return l(ES,t,vo,F([ga(f(fg,"creationInfo",u))]));case"ParametersFetched":var v=e.a,r=e.b;if("Err"===r.$){var A=r.a;return l(ES,t,vo,F([ga(f(fg,"parameters",A))]))}if("Ok"===r.a.$){var B=r.a.a;return l(wS,v,B,t)}var k=r.a.a;return l(ES,t,vo,F([ga(f(Kf,"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(AS,v,N,t)}return l(ES,t,vo,F([ga(f(TE,"state",r))]));case"PhaseStartInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var R=r.a.a;return l(IS,v,R,t)}return l(ES,t,vo,F([ga(f(TE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var v=e.a,r=e.b;if("Ok"===r.$){var $=r.a,_=cm($.terms);if("Ok"===_.$){var P=_.a;return l(BS,v,P,t)}var D=_.a;return f(SS,v,t)}var D=r.a;return l(ES,t,vo,F([ga(f(Kf,"Error decoding initiated event",D))]));default:var O=e.a,M=f(aS,O,t.eventSentry),V=M.a,S=M.b;return l(ES,U(t,{eventSentry:V}),S,mr)}}),US=function(e){return{$:"AgentHistoryMsg",a:e}},OS=function(e){return{$:"AppCmd",a:e}},MS={$:"BetaLandingPage"},FS={$:"ConnectToWeb3"},VS=function(e){return{$:"MarketplaceMsg",a:e}},KS=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),HS=r(function(e,t){return f(Nn,e,jf(t))}),jS=function(e){return f(HS,"href",rt(e))},qS=Rn("rel"),GS=HS("target"),zS=function(e){return{$:"Height",a:e}},YS=zS,WS={$:"Content"},JS=WS,QS=function(e){return{$:"Width",a:e}},XS=QS,ZS=function(e){return{$:"Attr",a:e}},eT=function(e){return{$:"NodeName",a:e}},tT=function(e){return{$:"Unkeyed",a:e}},rT={$:"AsEl"},nT=rT,aT=r(function(e,t){return{$:"Field",a:e,b:t}}),iT=f(aT,0,0),oT={$:"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"},sT=uT.any+" "+uT.column,cT=uT.any+" "+uT.grid,fT=uT.any+" "+uT.page,lT=uT.any+" "+uT.paragraph,dT=uT.any+" "+uT.row,hT=uT.any+" "+uT.single,pT=function(e){switch(e.$){case"AsRow":return dT;case"AsColumn":return sT;case"AsEl":return hT;case"AsGrid":return cT;case"AsParagraph":return lT;default:return fT}},gT=function(e){return{$:"Keyed",a:e}},vT={$:"NoStyleSheet"},yT=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))}}),mT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return O(f(Pa,function(t){return x(e,t)},n),t);case"ChildrenInFront":var a=r.a;return O(t,f(Pa,function(t){return x(e,t)},a));default:var n=r.a,a=r.b;return O(f(Pa,function(t){return x(e,t)},n),O(t,f(Pa,function(t){return x(e,t)},a)))}}),bT={$:"AsParagraph"},CT=bT,ET=Tn("div"),ST=Tn("p"),TT=Tn("s"),wT=Tn("u"),IT=HS("className"),AT=function(e){return In(Ze(e))},BT=function(e){return Tn(Ze(e))},kT=function(e){return{$:"Flag",a:e}},NT=function(e){return{$:"Second",a:e}},RT=function(e){return e>31?NT(1< .ctr > ."+uT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",$w="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+XT(uT.any)+XT(uT.row)+" > "+XT(uT.any)+" { flex-basis: auto !important; } "+XT(uT.any)+XT(uT.row)+" > "+XT(uT.any)+XT(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"+Rw,_w=function(e){return{$:"Intermediate",a:e}},Lw=r(function(e,t){return _w({closing:t,others:mr,props:mr,selector:e})}),xw=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(Na,x(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return U(t,{others:f(Na,_w({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(Na,f(xw,f(Lw,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return U(t,{others:f(Na,f(xw,f(Lw,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return U(t,{others:f(Na,f(xw,f(Lw,O(n.selector,p),""),g),t.others)});default:var v=e.a;return U(t,{others:f(Na,f(xw,f(Lw,n.selector,""),v),t.others)})}});return _w(l(xa,a,n,t))}),Pw=O($w,function(e){var t=function(e){return Xl(f(Pa,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),Xl(f(Pa,a,t.others)))};return Xl(f(Pa,a,l(xa,r(function(e,t){var r=e.a,n=e.b;return f(Na,f(xw,f(Lw,r,""),n),t)}),mr,e)))}(O(Bw,Nw))),Dw=l(BT,"style",mr,F([ew(Pw)])),Uw=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+'"'}},Ow=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}},Mw=function(e){if("FontWith"===e.$){var t=e.a;return f(Xd,Ow,t.variants)}return!1},Fw=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),Vw=r(function(e,t){return e+" {"+f($i,"",f(Pa,function(e){return e.a+": "+e.b+";"},t))+"}"}),Kw=n(function(e,t,r){var n=r.a,a=r.b;return F([f(Vw,"."+e+"."+t+", ."+e+" ."+t,n),f(Vw,"."+e+"."+t+"> ."+uT.text+", ."+e+" ."+t+" > ."+uT.text,a)])}),Hw=n(function(e,t,r){var n=t.a,a=t.b,i=$(e,r)?e:r+" ."+e;return f($i," ",O(l(Kw,i,uT.sizeByCapital,a),l(Kw,i,uT.fullSize,n)))}),jw=r(function(e,t){var r=$(e,t)?e:t+" ."+e;return f($i," ",F([f(Vw,"."+r+"."+uT.sizeByCapital+", ."+r+" ."+uT.sizeByCapital,F([x("line-height","1")])),f(Vw,"."+r+"."+uT.sizeByCapital+"> ."+uT.text+", ."+r+" ."+uT.sizeByCapital+" > ."+uT.text,F([x("vertical-align","0"),x("line-height","1")]))]))}),qw=function(e){if(e.b){var t=e.a,r=e.b;return ci(l($a,ti,t,r))}return fi},Gw=function(e){if(e.b){var t=e.a,r=e.b;return ci(l($a,nc,t,r))}return fi},zw=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),Yw=function(e){var t=F([e.capital,e.baseline,e.descender,e.lowercase]),r=f(pc,e.descender,Gw(t)),n=f(pc,e.baseline,Gw(f(Wf,function(e){return!$(e,r)},t))),a=f(pc,e.capital,qw(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(zw,i,a-n,o),full:l(zw,u,a-r,s)}},Ww=function(e){return x(F([x("display","block")]),F([x("display","inline-block"),x("line-height",WT(e.height)),x("vertical-align",WT(e.vertical)+"em"),x("font-size",WT(e.size)+"em")]))},Jw=function(e){return l($a,r(function(e,t){if("Nothing"===t.$){if("FontWith"===e.$){var r=e.a,n=r.adjustment;if("Nothing"===n.$)return t;var a=n.a;return ci(x(Ww(function(e){return e.full}(Yw(a))),Ww(function(e){return e.capital}(Yw(a)))))}return t}return t}),fi,e)},Qw=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return ci("@import url('"+t+"');")}return fi},r=function(e){var r=(e.a,e.b);return f($i,"\n",f(vS,t,r))},n=f(Pa,Xa,e),a=function(e){var t=e.a,r=e.b,a=Jw(r);if("Nothing"===a.$)return f($i,"",f(Pa,jw(t),n));var i=a.a;return f($i,"",f(Pa,f(Hw,t,i),n))};return O(f($i,"\n",f(Pa,r,e)),f($i,"\n",f(Pa,a,e)))},Xw=function(e){switch(e.$){case"VariantActive":var t=e.a;return'"'+t+'"';case"VariantOff":var t=e.a;return'"'+t+'" 0';default:var t=e.a,r=e.b;return'"'+t+'" '+Ri(r)}},Zw=function(e){if("FontWith"===e.$){var t=e.a;return ci(f($i,", ",f(Pa,Xw,t.variants)))}return fi},eI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return ci(x(t,r))}return fi},tI=function(e){switch(e.$){case"Untransformed":return fi;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return ci("translate3d("+WT(r)+"px, "+WT(n)+"px, "+WT(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("+WT(o)+"px, "+WT(u)+"px, "+WT(s)+"px)",b="scale3d("+WT(f)+", "+WT(l)+", "+WT(d)+")",C="rotate3d("+WT(p)+", "+WT(g)+", "+WT(v)+", "+WT(y)+"rad)";return ci(m+" "+b+" "+C)}},rI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l($a,Fw(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l($a,Fw(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l($a,Fw(!1),"",n)+"\n}"}case"Focus":var a=l($a,Fw(!1),"",n);return f($i,"\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($a,Fw(!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(zT,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ti,0,f(nc,1,1-c));return l(a,t,"."+u,F([f(zT,"opacity",WT(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ri(h),F([f(zT,"font-size",Ri(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f($i,", ",f(vS,Zw,p)),v=F([f(zT,"font-family",f($i,", ",f(Pa,Uw,p))),f(zT,"font-feature-settings",g),f(zT,"font-variant",f(Xd,Mw,p)?"small-caps":"normal")]);return f($i," ",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(zT,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,F([f(zT,s,JT(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ri(S)+"px",w=Ri(E)+"px",I="."+uT.row,A="."+(uT.wrapped+I),B="."+uT.alignRight,k="."+uT.paragraph,N="."+uT.page,R="."+uT.alignLeft,$=WT(S/2)+"px",_=WT(E/2)+"px",L="."+uT.column,y="."+C,P="."+uT.any;return Xl(F([l(a,t,y+(I+" > ")+P+" + "+P,F([f(zT,"margin-left",w)])),l(a,t,y+(A+" > ")+P,F([f(zT,"margin",$+" "+_)])),l(a,t,y+(L+" > ")+P+" + "+P,F([f(zT,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,F([f(zT,"margin-top",T)])),l(a,t,y+(N+" > ")+R,F([f(zT,"margin-right",w)])),l(a,t,y+(N+" > ")+B,F([f(zT,"margin-left",w)])),l(a,t,O(y,k),F([f(zT,"line-height","calc(1em + "+Ri(S)+"px)")])),l(a,t,"textarea"+y,F([f(zT,"line-height","calc(1em + "+Ri(S)+"px)")])),l(a,t,y+(k+" > ")+R,F([f(zT,"margin-right",w)])),l(a,t,y+(k+" > ")+B,F([f(zT,"margin-left",w)])),l(a,t,y+(k+"::after"),F([f(zT,"content","''"),f(zT,"display","block"),f(zT,"height","0"),f(zT,"width","0"),f(zT,"margin-top",Ri(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),F([f(zT,"content","''"),f(zT,"display","block"),f(zT,"height","0"),f(zT,"width","0"),f(zT,"margin-bottom",Ri(-1*(S/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(zT,"padding",Ri(D)+"px "+Ri(B)+"px "+Ri(U)+"px "+Ri(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(zT,"border-width",Ri(D)+"px "+Ri(B)+"px "+Ri(U)+"px "+Ri(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 Ri(n)+"px";case"Content":var a=x(e,t);if("Nothing"===a.a.$){if("Nothing"===a.b.$){a.a,a.b;return"max-content"}var i=(a.a,a.b.a);return"minmax(max-content, "+Ri(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ri(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ri(o)+"px, "+Ri(i)+"px)";case"Fill":var u=r.a,s=x(e,t);if("Nothing"===s.a.$){if("Nothing"===s.b.$){s.a,s.b;return Ri(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ri(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ri(o)+"px, "+Ri(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ri(o)+"px, "+Ri(i)+"px)";case"Min":var c=r.a,f=r.b,l=ci(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=ci(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,fi,fi,e)},H=(K(M.spacing.a),K(M.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f($i," ",f(Pa,K,M.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f($i,H,f(Pa,K,M.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f($i,H,f(Pa,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($i," ",f(Pa,K,M.columns))),y=".grid-rows-"+f($i,"-",f(Pa,KT,M.rows))+"-cols-"+f($i,"-",f(Pa,KT,M.columns))+"-space-x-"+KT(M.spacing.a)+"-space-y-"+KT(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($i," ",F(["-ms-grid-row: "+Ri(Z.row)+";","-ms-grid-row-span: "+Ri(Z.height)+";","-ms-grid-column: "+Ri(Z.col)+";","-ms-grid-column-span: "+Ri(Z.width)+";"])),te=f($i," ",F(["grid-row: "+Ri(Z.row)+" / "+Ri(Z.row+Z.height)+";","grid-column: "+Ri(Z.col)+" / "+Ri(Z.col+Z.width)+";"])),y=".grid-pos-"+Ri(Z.row)+"-"+Ri(Z.col)+"-"+Ri(Z.width)+"-"+Ri(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return O(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f($i," ",f(Pa,function(e){return f(i,e,ci(y))},re));default:var ne=e.a,m=tI(ne),y=jT(ne),ae=x(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(zT,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:O(t.rules,f(i,e,fi)),topLevel:function(){var r=eI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(Na,n,t.topLevel)}()}}),u=l($a,o,{rules:"",topLevel:mr},t),s=u.topLevel,c=u.rules;return O(Qw(s),c)}),nI=r(function(e,t){return l(BT,"style",mr,F([ew(f(rI,e,t))]))}),aI=a(function(e,t,r,n){return e?f(Na,x("static-stylesheet",Dw),f(Na,x("dynamic-stylesheet",f(nI,t,l($a,GT,x(Dy,F([ZT(t.focus)])),r).b)),n)):f(Na,x("dynamic-stylesheet",f(nI,t,l($a,GT,x(Dy,F([ZT(t.focus)])),r).b)),n)}),iI=a(function(e,t,r,n){return e?f(Na,Dw,f(Na,f(nI,t,l($a,GT,x(Dy,F([ZT(t.focus)])),r).b),n)):f(Na,f(nI,t,l($a,GT,x(Dy,F([ZT(t.focus)])),r).b),n)}),oI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(AT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(aI,!1,e,t,r);default:var e=i.a,t=i.b;return d(aI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return ET;case"p":return ST;default:return BT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(iI,!1,e,t,n);default:var e=i.a,t=i.b;return d(iI,!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(BT,e,n,F([f(u,r,F([IT(uT.any+" "+uT.single)]))]))}}();switch(o.$){case"AsRow":return f(UT,MT,e)&&!f(UT,OT,e)?s:f(UT,_T,e)?f(wT,F([IT(f($i," ",F([uT.any,uT.single,uT.container,uT.contentCenterY,uT.alignContainerRight])))]),F([s])):f(UT,LT,e)?f(TT,F([IT(f($i," ",F([uT.any,uT.single,uT.container,uT.contentCenterY,uT.alignContainerCenterX])))]),F([s])):s;case"AsColumn":return f(UT,DT,e)&&!f(UT,PT,e)?s:f(UT,xT,e)?f(TT,F([IT(f($i," ",F([uT.any,uT.single,uT.container,uT.alignContainerCenterY])))]),F([s])):f(UT,$T,e)?f(wT,F([IT(f($i," ",F([uT.any,uT.single,uT.container,uT.alignContainerBottom])))]),F([s])):s;default:return s}}),uI=ew,sI=function(e){return f(ET,F([IT(f($i," ",F([uT.any,uT.text,uT.widthContent,uT.heightContent])))]),F([uI(e)]))},cI=function(e){return l(BT,"div",F([IT(f($i," ",F([uT.any,uT.text,uT.widthFill,uT.heightFill])))]),F([ew(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,CT),x(f(Na,x(n,u(e)),i),o);case"Styled":var s=a.a;return $(e,CT),x(f(Na,x(n,f(s.html,vT,e)),i),iu(o)?s.styles:O(s.styles,o));case"Text":var c=a.a;return x(f(Na,x(n,$(e,nT)?cI(c):sI(c)),i),o);default:return x(i,o)}}),i=r(function(t,r){var n=r.a,a=r.b;switch(t.$){case"Unstyled":var i=t.a;return $(e,CT),x(f(Na,i(e),n),a);case"Styled":var o=t.a;return $(e,CT),x(f(Na,f(o.html,vT,e),n),iu(a)?o.styles:O(o.styles,a));case"Text":var u=t.a;return x(f(Na,$(e,nT)?cI(u):sI(u),n),a);default:return x(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(xa,a,x(mr,mr),o),s=u.a,c=u.b,p=iu(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return qi({html:d(oI,n.has,n.node,n.attributes,gT(l(mT,"nearby-element-pls",s,n.children))),styles:g})}return zi(h(oI,n.has,n.node,n.attributes,gT(l(mT,"nearby-element-pls",s,n.children)),vT))}var v=t.a,y=l(xa,i,x(mr,mr),v),m=y.a,c=y.b,p=iu(c)?n.styles:O(n.styles,c);if(p.b){var g=p;return qi({html:d(oI,n.has,n.node,n.attributes,tT(f(yT,m,n.children))),styles:g})}return zi(h(oI,n.has,n.node,n.attributes,tT(f(yT,m,n.children)),vT))}),lI=r(function(e,t){return f(Rn,et(e),nt(t))}),dI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(aT,a|r,n)}var i=e.a;return f(aT,r,i|n)}),hI=RT(7),pI=RT(36),gI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(aT,r|a,n|i)}),vI=RT(6),yI=RT(38),mI=RT(30),bI=RT(29),CI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),EI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),SI=function(e){return{$:"Transform",a:e}},TI=function(e){return{$:"ChildrenBehind",a:e}},wI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),II=function(e){return{$:"ChildrenInFront",a:e}},AI=r(function(e,t){return f(ET,F([IT(function(){switch(e.$){case"Above":return f($i," ",F([uT.nearby,uT.single,uT.above]));case"Below":return f($i," ",F([uT.nearby,uT.single,uT.below]));case"OnRight":return f($i," ",F([uT.nearby,uT.single,uT.onRight]));case"OnLeft":return f($i," ",F([uT.nearby,uT.single,uT.onLeft]));case"InFront":return f($i," ",F([uT.nearby,uT.single,uT.inFront]));default:return f($i," ",F([uT.nearby,uT.single,uT.behind]))}}())]),F([function(){switch(t.$){case"Empty":return ew("");case"Text":var e=t.a;return sI(e);case"Unstyled":return(0,t.a)(nT);default:return f(t.a.html,vT,nT)}}()]))}),BI=n(function(e,t,r){var n=f(AI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?TI(F([n])):II(F([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?TI(f(Na,n,a)):f(wI,a,F([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(wI,F([n]),i):II(f(Na,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(wI,f(Na,n,a),i):f(wI,a,f(Na,n,i))}}),kI=r(function(e,t){switch(t.$){case"Generic":return eT(e);case"NodeName":var r=t.a;return f(CI,r,e);default:var n=t.a,a=t.b;return f(CI,n,a)}}),NI=function(e){switch(e.$){case"Left":return uT.alignedHorizontally+" "+uT.alignLeft;case"Right":return uT.alignedHorizontally+" "+uT.alignRight;default:return uT.alignedHorizontally+" "+uT.alignCenterX}},RI=function(e){switch(e.$){case"Top":return uT.alignedVertically+" "+uT.alignTop;case"Bottom":return uT.alignedVertically+" "+uT.alignBottom;default:return uT.alignedVertically+" "+uT.alignCenterY}},$I=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),_I=function(e){return{$:"Moved",a:e}},LI=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return _I(P(r,0,0));case"MoveY":var n=t.a;return _I(P(0,n,0));case"MoveZ":var a=t.a;return _I(P(0,0,a));case"MoveXYZ":var i=t.a;return _I(i);case"Rotate":var i=t.a,o=t.b;return d($I,P(0,0,0),P(1,1,1),i,o);default:var i=t.a;return d($I,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 _I(P(s,n,a));case"MoveY":var c=t.a;return _I(P(r,c,a));case"MoveZ":var f=t.a;return _I(P(r,n,f));case"MoveXYZ":var i=t.a;return _I(i);case"Rotate":var i=t.a,o=t.b;return d($I,u,P(1,1,1),i,o);default:var l=t.a;return d($I,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($I,P(s,n,a),h,p,o);case"MoveY":var c=t.a;return d($I,P(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d($I,P(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d($I,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d($I,u,h,v,y);default:var m=t.a;return d($I,u,m,p,o)}}}),xI=function(e){switch(e.$){case"Px":var t=e.a,r=Ri(t),n="height-px-"+r;return P(iT,n,F([l(EI,n,"height",r+"px")]));case"Content":return P(f(dI,pI,iT),uT.heightContent,mr);case"Fill":var a=e.a;return 1===a?P(f(dI,DT,iT),uT.heightFill,mr):P(f(dI,DT,iT),uT.heightFillPortion+" height-fill-"+Ri(a),F([l(EI,uT.any+"."+uT.row+" > "+XT("height-fill-"+Ri(a)),"flex-grow",Ri(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ri(i),s=l(EI,u,"min-height",Ri(i)+"px"),c=xI(o),d=c.a,h=c.b,p=c.c;return P(f(dI,PT,d),u+" "+h,f(Na,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ri(g),s=l(EI,u,"max-height",Ri(g)+"px"),v=xI(o),d=v.a,h=v.b,p=v.c;return P(f(dI,PT,d),u+" "+h,f(Na,s,p))}},PI=function(e){switch(e.$){case"Px":var t=e.a;return P(iT,uT.widthExact+" width-px-"+Ri(t),F([l(EI,"width-px-"+Ri(t),"width",Ri(t)+"px")]));case"Content":return P(f(dI,yI,iT),uT.widthContent,mr);case"Fill":var r=e.a;return 1===r?P(f(dI,MT,iT),uT.widthFill,mr):P(f(dI,MT,iT),uT.widthFillPortion+" width-fill-"+Ri(r),F([l(EI,uT.any+"."+uT.row+" > "+XT("width-fill-"+Ri(r)),"flex-grow",Ri(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ri(n),o=l(EI,i,"min-width",Ri(n)+"px"),u=PI(a),s=u.a,c=u.b,d=u.c;return P(f(dI,OT,s),i+" "+c,f(Na,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ri(h),o=l(EI,i,"max-width",Ri(h)+"px"),p=PI(a),s=p.a,c=p.b,d=p.c;return P(f(dI,OT,s),i+" "+c,f(Na,o,d))}},DI=RT(27),UI=r(function(e,t){if($(e,DI)){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}}),OI=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=jT(n);if("Nothing"===s.$)return{attributes:f(Na,IT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(Na,IT(e+" "+c),i),children:o,has:r,node:t,styles:f(Na,SI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(UT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(dI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(Na,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(UT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(UI,S,I)){var p=qT(I)+" "+e,g=t,v=f(dI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=qT(I)+" "+e,g=t,v=f(dI,S,r),y=n,m=f(Na,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(dI,S,r),y=f(LI,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(UT,vI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=uT.widthExact+" width-px-"+Ri(k)+" "+e,g=t,v=f(dI,vI,r),y=n,m=f(Na,l(EI,"width-px-"+Ri(k),"width",Ri(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+uT.widthContent,g=t,v=f(dI,yI,f(dI,vI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+uT.widthFill,g=t,v=f(dI,MT,f(dI,vI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+uT.widthFillPortion+" width-fill-"+Ri(N),g=t,v=f(dI,MT,f(dI,vI,r)),y=n,m=f(Na,l(EI,uT.any+"."+uT.row+" > "+XT("width-fill-"+Ri(N)),"flex-grow",Ri(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=PI(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(gI,$,r),y=n,m=O(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(UT,hI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ri(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(dI,hI,r),y=n,m=f(Na,l(EI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=uT.heightContent+" "+e,g=t,v=f(dI,pI,f(dI,hI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=uT.heightFill+" "+e,g=t,v=f(dI,DT,f(dI,hI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+uT.heightFillPortion+" height-fill-"+Ri(N),g=t,v=f(dI,DT,f(dI,hI,r)),y=n,m=f(Na,l(EI,uT.any+"."+uT.column+" > "+XT("height-fill-"+Ri(N)),"flex-grow",Ri(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var U=xI(x),$=U.a,_=U.b,L=U.c,p=e+" "+_,g=t,v=f(gI,$,r),y=n,m=O(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(kI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(kI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(kI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(kI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(kI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(kI,"h"+Ri(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(kI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return eT("p");case"NodeName":var e=t.a;return eT(e);default:var r=t.a,n=t.b;return f(CI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(Na,f(lI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(Na,f(lI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(Na,f(lI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(Na,f(lI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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=L,b=i,C=l(BI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(UT,mI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=NI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(dI,LT,e);case"Right":return f(dI,_T,e);default:return e}}(f(dI,mI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(UT,bI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=RI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(dI,xT,e);case"Bottom":return f(dI,$T,e);default:return e}}(f(dI,bI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),MI={$:"Untransformed"},FI=MI,VI=a(function(e,t,r,n){return l(fI,e,n,v(OI,pT(e),t,iT,FI,mr,mr,oT,_a(r)))}),KI=function(e){return ZS(IT(e))},HI=r(function(e,t){var r=t.url,n=t.label;return d(VI,nT,eT("a"),f(Na,ZS(jS(r)),f(Na,ZS(qS("noopener noreferrer")),f(Na,ZS(GS("_blank")),f(Na,XS(JS),f(Na,YS(JS),f(Na,KI(uT.contentCenterX+" "+uT.contentCenterY),e)))))),tT(F([n])))}),jI=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),qI=n(function(e,t,r){return d(jI,e,t,r,1)}),GI=RT(14),zI=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),YI=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),WI=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return HT(t)+"-"+HT(r)+"-"+HT(n)+"-"+HT(a)},JI=function(e){return f(YI,GI,l(zI,"fc-"+WI(e),"color",e))},QI={align:Of,label:"cantConnectNoWeb3",mainParagraphs:F([F([Vf("You need a web3 provider (such as "),f(HI,F([JI(l(qI,0,0,1))]),{label:Vf("Metamask"),url:"https://metamask.io/"}),Vf(") to Connect.")]),F([Vf("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:dg},XI={align:Of,label:"invalidUrl",mainParagraphs:F([F([Vf("I don't understand that URL...")]),F([Vf("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:cg},ZI=function(e){return{$:"Active",a:e}},eA=Wo(f(Ao,wf,f(Ao,Eh,cd("Error decoding hex to BigInt")))),tA=function(){return Wo(function(e){switch(e){case"0x0":return di(!1);case"0x1":return di(!0);default:return li("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}}}}}}}}}}}},nA=function(e){return LE(F([f(Mi,ci,e),Vi(fi)]))},aA=f(jd,nA(f(vh,"status",tA)),f(jd,nA(f(vh,"root",Yo)),l(UE,"logsBloom",Yo,l(UE,"logs",sm(YE),f(jd,nA(f(vh,"contractAddress",OE)),l(UE,"cumulativeGasUsed",eA,l(UE,"gasUsed",eA,l(UE,"blockNumber",Cy,l(UE,"blockHash",KE,l(UE,"transactionIndex",Cy,l(UE,"transactionHash",qE,Vi(rA)))))))))))),iA=function(e){var t=e.a;return wf(t)},oA=f(Ao,iA,jf),uA=r(function(e,t){return gp({decoder:aA,method:"eth_getTransactionReceipt",params:F([oA(t)]),url:e})}),sA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),cA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),fA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),lA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(yg,function(e){return e.b},f(yg,function(e){return e.onMinedTagger},f(Kh,t,e))))}),dA=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 LE(F([_E(fi),f(Mi,ci,e)]))},pA=l(UE,"input",Yo,l(UE,"gas",Cy,l(UE,"gasPrice",eA,l(UE,"value",eA,l(UE,"to",hA(OE),l(UE,"from",OE,l(UE,"transactionIndex",Cy,l(UE,"blockNumber",hA(Cy),l(UE,"blockHash",function(e){return f(Go,function(t){return"0x"===t||"0x0"===t?Vi(fi):f(Ni,function(e){return $(e,D("0"))},Ho(t))?Vi(fi):f(Mi,ci,e)},Yo)}(KE),l(UE,"nonce",Cy,l(UE,"hash",qE,Vi(dA)))))))))))),gA=r(function(e,t){return gp({decoder:pA,method:"eth_getTransactionByHash",params:F([oA(t)]),url:e})}),vA=r(function(e,t){return{attempts:e,sleep:t}}),yA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Rp,function(e){return a>0?f(Cp,function(e){return f(yA,f(vA,a,n),t)},RE(1e3*n)):lp(e)},t)}),mA=r(function(e,t){return f(Cp,function(r){return f(yA,{attempts:30,sleep:1},f(gA,e,t))},RE(250))}),bA=r(function(e,t){return f(yA,{attempts:60,sleep:5},f(uA,e,t))}),CA=function(e){return{$:"Mined",a:e}},EA=function(e){return Bo(function(t){return U(t,{status:CA(e)})})},SA=function(e){return{$:"Sent",a:e}},TA=function(e){return Bo(function(t){return U(t,{status:SA(e)})})},wA=function(e){return{$:"Signed",a:e}},IA=function(e){return Bo(function(t){return U(t,{status:wA(e)})})},AA=function(e){return"Nothing"!==e.$},BA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return x(el(r),vo);case"TxSigned":var n=e.a,a=e.b,i=f(Kh,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(Bg,t,dp(a))}return vo}(),s=function(e){var t=P(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return vo;if("Just"===t.b.$){var r=t.b.a;return f(Bg,r,dp(li(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Bg,a,dp(li(e)))}t.a,t.b,t.c;return vo};if("Ok"===a.$){var c=a.a,d=AA(o.onBroadcastTagger)||AA(o.onMinedTagger)?f(Df,r.tagger,f($p,fA(n),f(mA,r.nodePath,c))):vo;return x(el(U(r,{txs:l(Qh,n,IA(c),r.txs)})),go(F([u,d])))}var h=a.a;return x(el(r),go(F([u,s(h)])))}return x(el(r),vo);case"TxSent":var n=e.a,p=e.b,g=f(Kh,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Df,r.tagger,f($p,cA(n),f(bA,r.nodePath,v.hash))):vo}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Bg,t,dp(di(v)))}return vo}();return x(el(U(r,{txs:l(Qh,n,TA(v),r.txs)})),go(F([d,y])))}var h=p.a,s=function(){var e=x(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(Bg,t,dp(li("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Bg,n,dp(li("Error with TxSent stuff")))}e.a,e.b;return vo}();return x(el(r),s)}return x(el(r),vo);case"TxMined":var n=e.a,m=e.b,b=f(Kh,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Bg,a,dp(di(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 go(F([f(Df,r.tagger,f($p,f(sA,n,s),Ey(r.nodePath))),f(Bg,a,dp(di(C))),f(Bg,u.toMsg,dp(s))]))}return vo}();return x(el(U(r,{txs:l(Qh,n,EA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Bg,r,dp(li("TxReceipt decoding failure")))}return vo}();return x(el(r),S)}return x(el(r),vo);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(lA,r.txs,n);if("Just"===A.$){var B=A.a;return x(el(r),f(Bg,B,f(Rp,function(e){return dp(U(I,{doneWatching:!0,reOrg:!0}))},f(Cp,function(e){return dp(U(I,{doneWatching:!0}))},f(uA,r.nodePath,T.txHash)))))}return x(el(r),vo)}if($(w,T.lastCheckedBlock))return x(el(r),f(Df,r.tagger,f($p,f(sA,n,T),f(Cp,function(e){return Ey(r.nodePath)},RE(2e3)))));var k=f(lA,r.txs,n);if("Just"===k.$){var B=k.a;return x(el(r),go(F([f(Df,r.tagger,f($p,f(sA,n,I),f(Cp,function(e){return Ey(r.nodePath)},RE(2e3)))),f(Bg,B,dp(I))])))}return x(el(r),vo)}var n=e.a,h=e.c.a;return x(el(r),vo);default:var h=e.a;return x(el(r),vo)}}),kA=Qt,NA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ri(r)}),RA=n(function(e,t,r){return"Nothing"===t.$?r:O(r,O(e,t.a))}),$A=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(RA,"#",e.fragment,l(RA,"?",e.query,O(f(NA,e.port_,O(t,e.host)),e.path)))},_A=r(function(e,t){return e<0?fi:Nl(f(Pl,e,t))}),LA=r(function(e,t){if(e<0)return t;var r=ih(f(Pl,e,t)),n=f(qs,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(uo,n,a)}),xA=n(function(e,t,r){if(e<0)return r;var n=f(Pl,e,r),a=f(qs,e,r);if(n.b){var i=n.a,o=n.b;return O(a,f(Na,t(i),o))}return r}),PA=r(function(e,t){return f(xA,e,Xu(t))}),DA=r(function(e,t){vv(t);switch(t.$){case"Home":return x(U(e,{submodel:MS}),vo);case"Create":var r=Rd(e.wallet),n=f(pl,e.txSentry,f(ko,ly,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(OA,O(f(Xi,ly,r.appCmds),f(Pa,ga,o)),x(U(e,{submodel:fy(r.model),txSentry:a}),go(F([f(Df,ly,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(ty,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(Gy,e.wallet,r)}return l(jy,e.wallet,u,s)}(),c=f(pl,e.txSentry,f(ko,py,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(OA,O(f(Xi,py,r.appCmds),f(Pa,ga,o)),x(U(e,{submodel:hy(r.model),txSentry:a}),go(F([f(Df,py,r.cmd),i]))));case"Marketplace":var d=Xg(e.wallet),h=d.a,p=d.b;return x(U(e,{submodel:dy(h)}),go(F([f(Df,VS,p)])));case"AgentHistory":var g=t.a,v=f(yo,e.wallet,g),y=v.a,m=v.b;return x(U(e,{submodel:cy(y)}),go(F([f(Df,US,m)])));default:return x(f(so,XI,e),vo)}}),UA=r(function(e,t){var r=t.a,n=t.b,a=f(MA,OS(e),r),i=a.a,o=a.b;return x(i,go(F([n,o])))}),OA=r(function(e,t){var r=t.a,n=t.b;return l($a,UA,x(r,n),e)}),MA=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(MA,FS,t);case"GotoRoute":var n=r.a;return x(t,f(Yv,t.key,n));case"GTag":var a=r.a;return x(t,Xv(Jv(a)));case"UserNotice":var i=r.a;return x(f(so,i,t),Xv(Jv(d(gl,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return x(t,d(lv,ry,o,u,s));default:return x(t,ny(vr))}case"DismissNotice":var c=e.a;return x(U(t,{userNotices:f(LA,c,t.userNotices)}),vo);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(zv,t.key,$A(e))}var r=h.a;return kA(r)}();return x(t,p);case"UrlChanged":var g=e.a;return f(FA,g,t);case"GotoRoute":var v=e.a;return x(t,go(F([Xv(Jv(d(gl,"GotoRoute","navigation",vv(v),0))),f(Yv,t.key,v)])));case"Tick":var y=e.a;return x(U(t,{time:y}),vo);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?x(f(so,QI,t),vo):x(t,Wv(vr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return vo;var t=e.a;return Zv(f(Qv,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 x(U(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(wh,Yo,C);if("Ok"===E.$){var S=E.a,T=x(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=ZI(l(vl,I,w,S)),B=f(gy,A,t.submodel),k=B.a,p=B.b;return x(U(t,{submodel:k,wallet:A}),p)}return x(f(so,f(Kf,"Unexpected wallet state encounted when setting commPubkey!",fi),t),vo)}T.a;return x(f(so,f(Kf,"User pubkey set, but I can no longer find the user address!",fi),t),vo)}var N=E.a;return x(l(Da,so,f(Kf,"error decoding commPubkey from JS",N),t),vo);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,L=f(jg,R,_),P=f(pl,t.txSentry,f(ko,ly,L.chainCmd)),D=P.a,M=P.b,V=P.c;return f(OA,O(f(Xi,ly,L.appCmds),f(Pa,ga,V)),x(U(t,{submodel:fy(L.model),txSentry:D}),go(F([f(Df,ly,L.cmd),M]))))}return x(t,vo);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,L=f(cS,K,j),q=f(pl,t.txSentry,f(ko,py,L.chainCmd)),D=q.a,M=q.b,V=q.c;return f(OA,O(f(Xi,py,L.appCmds),f(Pa,ga,V)),x(U(t,{submodel:hy(L.model),txSentry:D}),go(F([f(Df,py,L.cmd),M]))))}return x(t,vo);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,L=f(fv,G,Y);return f(OA,f(Xi,VS,L.appCmds),x(U(t,{submodel:dy(L.model)}),f(Df,VS,L.cmd)))}return x(t,vo);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,L=f(Uf,W,Q),X=f(pl,t.txSentry,f(ko,US,L.chainCmd)),D=X.a,M=X.b,V=X.c;return f(OA,O(f(Xi,US,L.appCmds),f(Pa,ga,V)),x(U(t,{submodel:cy(L.model),txSentry:D}),go(F([f(Df,US,L.cmd),M]))))}return x(t,vo);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(du,ci,f(BA,Z,r))}return x(fi,vo)}(),D=ee.a,te=ee.b;return x(U(t,{txSentry:D}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(_A,re,t.tradeCaches);if("Nothing"===ae.$)return f(UA,ga(f(Kf,"Encountered an out-of-range error when trying to route a TradeCacheMsg",fi)),x(t,vo));var ie=ae.a,L=f(DS,ne,ie);return x(U(t,{tradeCaches:l(PA,re,L.tradeCache,t.tradeCaches)}),f(Df,KS(re),L.cmd));case"NoOp":return x(t,vo);default:var N=e.a;f(Ff,"test",N);return x(t,vo)}}),FA=r(function(e,t){return f(DA,t,Gv(e))}),VA=ze("txIn",xE),KA=qe("txOut",Oa),HA=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},jA=function(e){return{$:"EventSentryMsg",a:e}},qA=function(e){var t=f(Uy,jA,Rh(e)),r=t.a,n=t.b;return P({dataFetchState:l(NS,fi,0,0),eventSentry:r,factory:e,trades:Ga},n,F([d($d,"tradeCache init","processing",HA(e),0)]))},GA=function(e){return{$:"InitialNumTradesFetched",a:e}},zA=function(e){return f(pS,e.factory,GA)},YA=function(e){var t=qA(e),r=t.a,n=t.b,a=t.c;return P(r,go(F([n,zA(r)])),a)},WA=function(e){return{$:"TxSentryMsg",a:e}},JA={align:Of,label:"noWeb3Provider",mainParagraphs:F([F([Vf("No web3 provider detected. Is "),f(HI,F([JI(l(qI,0,0,1))]),{label:Vf("Metamask"),url:"https://metamask.io/"}),Vf(" or some other web3 provider installed and unlocked?")])]),noticeType:dg},QA={$:"TopLeft"},XA={align:QA,label:"screenToSmall",mainParagraphs:F([F([Vf("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:dg},ZA={align:Of,label:"wrongWeb3Network",mainParagraphs:F([F([Vf("Your wallet is set to an incorrect network.")]),F([Vf("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:cg},eB={$:"NoneDetected"},tB=function(e){return{$:"OnlyNetwork",a:e}},rB=function(e){return f(Bo,Rh,mg(e))},nB={$:"ETCMain"},aB={$:"ETCTest"},iB={$:"Expanse"},oB={$:"Kovan"},uB={$:"Mainnet"},sB=function(e){return{$:"Private",a:e}},cB={$:"Rinkeby"},fB={$:"Ropsten"},lB={$:"RskMain"},dB={$:"RskTest"},hB=function(e){switch(e){case 1:return uB;case 2:return iB;case 3:return fB;case 4:return cB;case 30:return lB;case 31:return dB;case 42:return oB;case 41:return nB;case 62:return aB;default:return sB(e)}},pB=n(function(e,t,r){var n=e.a,a=e.b;return el({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Vh})}),gB=n(function(e,t,n){var a=e.networkId?tB(hB(e.networkId)):eB,i=f(Bo,function(e){return l(pB,x(KA,VA),WA,e)},rB(a)),o=e.width<1024?ci(XA):fi,u=f(Pa,YA,no),s=function(){return $(a,eB)?ci(JA):"Nothing"===mg(a).$?ci(ZA):fi}(),c=AC(F([o,s])),d=P(f(Pa,ao,u),f(Pa,io,u),f(Pa,oo,u)),h=d.a,p=d.b,g=d.c,v=_v(f(ki,r(function(e,t){return f(Xi,KS(e),t)}),g)),y=go(f(ki,r(function(e,t){return f(Df,KS(e),t)}),p)),m=f(OA,v,f(FA,t,{key:n,screenWidth:e.width,submodel:MS,time:bl(0),tradeCaches:h,txSentry:i,userAddress:fi,userNotices:mr,wallet:a})),b=m.a,C=m.b;return x(f(co,c,b),go(F([y,C])))}),vB=Me,yB=vB(mr),mB=function(e){return yB},bB=function(e){return{$:"Refresh",a:e}},CB=r(function(e,t){return{$:"Every",a:e,b:t}}),EB=r(function(e,t){return{processes:t,taggers:e}}),SB=dp(f(EB,Vh,Vh)),TB=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(L(c,r)<0){var p=r,g=n,v=x(h,l(e,c,f,u));r=p,n=g,i=v;continue e}return L(c,r)>0?x(o,l(a,r,n,u)):x(h,d(t,c,f,n,u))}return x(o,l(a,r,n,u))}}),c=l(tS,s,x(Aa(i),u),o),f=c.a,h=c.b;return l($a,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),wB=Re,IB=r(function(e,t){var r=e.a,n=e.b,a=f(Kh,r,t);if("Nothing"===a.$)return l(ll,r,F([n]),t);var i=a.a;return l(ll,r,f(Na,n,i),t)}),AB=ke,BB=r(function(e,t){return{$:"Zone",a:e,b:t}}),kB=fa,NB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=AB(f(kB,n,f(ep,e,n)));return f(Cp,function(t){return l(NB,e,a,l(ll,n,t,r))},i)}return dp(r)}),RB=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(Cp,function(e){return i},wB(t)))}),u=l($a,IB,Vh,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return P(f(Na,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(ll,e,r,i),o)}),d=p(TB,s,c,o,u,i,P(mr,Vh,dp(vr))),h=d.a,g=d.b,v=d.c;return f(Cp,function(e){return dp(f(EB,u,e))},f(Cp,function(t){return l(NB,e,h,g)},v))}),$B=function(e){return Ie(function(t){t(Te(e(Date.now())))})}(bl),_B=n(function(e,t,r){var n=f(Kh,t,r.taggers);if("Nothing"===n.$)return dp(r);var a=n.a,i=function(t){return wp(f(Pa,function(r){return f(Zh,e,r(t))},a))};return f(Cp,function(e){return dp(r)},f(Cp,i,$B))}),LB=r(function(e,t){var r=t.a,n=t.b;return f(CB,r,f(Ua,e,n))});gn.Time=De(SB,RB,_B,0,LB);var xB=Oe("Time"),PB=r(function(e,t){return xB(f(CB,e,t))}),DB=function(e){return f(PB,2e3,bB)},UB=function(e){return yB},OB=function(e){return{$:"DecryptionFinished",a:e}},MB=ze("decryptionFinished",xE),FB=ze("encryptionFinished",xE),VB=function(e){return{$:"EncryptionFinished",a:e}},KB=function(e){return{$:"Refresh",a:e}},HB=function(e){return vB(F([f(PB,3e3,KB),FB(VB),MB(function(e){return ZC(OB(e))})]))},jB=mn,qB=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return yB;case"CreateModel":t.a;return f(jB,ly,DB());case"TradeModel":t.a;return f(jB,py,HB());case"MarketplaceModel":t.a;return f(jB,VS,UB());default:t.a;return f(jB,US,mB())}},GB=ze("userPubkeyResult",xE),zB=ze("walletSentryPort",xE),YB={$:"CheckForNewTrades"},WB=function(e){return f(PB,5e3,function(e){return YB})},JB=function(e){return{$:"Tick",a:e}},QB=function(e){return{$:"UserPubkeySet",a:e}},XB=function(e){return{$:"WalletStatus",a:e}},ZB=function(e){return f(Kf,"Error decoding JS walletSentry: "+e,fi)},ek=function(e){return{$:"ErrorDecoding",a:e}},tk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),rk=l(Fi,r(function(e,t){return{ref:e,txHash:t}}),f(vh,"ref",kC),f(vh,"txHash",nA(qE))),nk=function(e){var t=f(wh,rk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(tk,r.ref,di(a))}return f(tk,r.ref,li("Problem signing/broadcasting Tx. Ref #"+Ri(r.ref)))}t.a;return ek("Error decoding tx data")},ak=function(e){var t=e.a;return f(jB,t.tagger,t.inPort(nk))},ik=f(Mi,hB,kC),ok=Wo(f(Ao,xl,f(Ao,cd("Failure decoding stringy int"),Oo(hB)))),uk=LE(F([ok,ik])),sk=r(function(e,t){return{account:e,networkId:t}}),ck=l(Fi,sk,f(vh,"account",nA(OE)),f(vh,"networkId",uk)),fk=n(function(e,t,r){var n=f(wh,ck,r);if("Err"===n.$){var a=n.a;return e(Ui(a))}return t(n.a)}),lk=function(e){var t=f(Ao,ZB,f(Ao,ga,OS));return vB(O(F([f(PB,1e3,JB),zB(f(fk,t,XB)),f(pc,yB,f(Bo,ak,e.txSentry)),GB(QB),vB(f(ki,r(function(e,t){return f(jB,KS(e),t)}),f(Pa,WB,e.tradeCaches)))]),F([qB(e)])))},dk=function(e){return{$:"LinkClicked",a:e}},hk=function(e){return{$:"UrlChanged",a:e}},pk=n(function(e,t,r){return d(jI,e/255,t/255,r/255,1)}),gk=l(pk,10,33,108),vk={$:"Generic"},yk=vk,mk=r(function(e,t){return d(VI,nT,yk,f(Na,XS(JS),f(Na,YS(JS),e)),tT(F([t])))}),bk=function(e){return{$:"Fill",a:e}},Ck=bk(1),Ek=ji,Sk=function(e){return{$:"Px",a:e}},Tk=Sk,wk=RT(8),Ik=function(e){return f(YI,wk,l(zI,"bg-"+WI(e),"background-color",e))},Ak=f(mk,F([XS(Ck),YS(Tk(150)),Ik(gk)]),Ek),Bk=function(e){return{$:"GotoRoute",a:e}},kk={$:"Active"},Nk={$:"Important"},Rk={$:"Normal"},$k=l(qI,1,1,1),_k=RT(2),Lk=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),xk=r(function(e,t){return $(e,t)?f(YI,_k,h(Lk,"p-"+Ri(e),e,e,e,e)):f(YI,_k,h(Lk,"p-"+Ri(e)+"-"+Ri(t),t,e,t,e))}),Pk=RT(21),Dk=r(function(e,t){return{$:"Class",a:e,b:t}}),Uk=f(Dk,Pk,uT.cursorPointer),Ok=RT(17),Mk=function(e){return f(YI,Ok,l(EI,"br-"+Ri(e),"border-radius",Ri(e)+"px"))},Fk=function(e){return{$:"Normal",a:e}},Vk=Bn,Kk=r(function(e,t){return f(Vk,e,Fk(t))}),Hk=function(e){return f(Kk,"click",Vi(e))},jk=f(Ua,ZS,Hk),qk=RT(13),Gk=f(Dk,qk,uT.textSemiBold),zk=RT(4),Yk=function(e){return{$:"FontSize",a:e}},Wk=function(e){return f(YI,zk,Yk(e))},Jk=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return mr;case"Active":return F([Mk(4),Ik(l(qI,0,0,1))]);default:return F([Mk(4),Ik(l(qI,.9,0,0))])}}();return f(mk,O(F([f(xk,23,12),Wk(22),Gk,JI($k),Uk,jk(t)]),n),Vf(e))}),Qk=l(pk,244,0,103),Xk=function(e){return{$:"AlignX",a:e}},Zk={$:"CenterX"},eN=Xk(Zk),tN=RT(3),rN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),nN=r(function(e,t){return"spacing-"+Ri(e)+"-"+Ri(t)}),aN=function(e){return f(YI,tN,l(rN,f(nN,e,e),e,e))},iN=function(e){return{$:"Describe",a:e}},oN={$:"Paragraph"},uN=r(function(e,t){return d(VI,CT,yk,f(Na,iN(oN),f(Na,XS(Ck),f(Na,aN(5),e))),tT(t))}),sN=f(Dk,qk,uT.bold),cN=f(mk,F([Wk(29),JI($k),sN,eN,Uk,jk(Bk(Cv))]),f(uN,mr,F([Vf("DAI"),f(mk,F([JI(Qk)]),Vf("Hard"))]))),fN={$:"Right"},lN=Xk(fN),dN={$:"AsColumn"},hN=dN,pN=r(function(e,t){return d(VI,hN,yk,f(Na,KI(uT.contentTop+" "+uT.contentLeft),f(Na,YS(JS),f(Na,XS(JS),e))),tT(t))}),gN={$:"AsRow"},vN=gN,yN=r(function(e,t){return d(VI,vN,yk,f(Na,KI(uT.contentLeft+" "+uT.contentCenterY),f(Na,XS(JS),f(Na,YS(JS),e))),tT(t))}),mN=function(e){return f(yN,F([XS(Ck),aN(30),f(xk,30,17)]),F([l(Jk,"Browse Offers",Bk(Ev),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return kk}return Rk}()),l(Jk,"Create a New Offer",Bk(bv),function(){return"CreateModel"===e.submodel.$?kk:Rk}()),function(){var t=wd(e.wallet);if("Just"===t.$){var r=t.a;return l(Jk,"My Trades",Bk(mv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return $(t.a.agentAddress,r.address)?kk:Rk}return Rk}())}return l(Jk,"Connect to Wallet",FS,Nk)}(),f(pN,F([lN,aN(0),f(xk,8,0)]),F([cN]))]))},bN=jI,CN=r(function(e,t){return f(mk,F([Mk(4),Ik(d(bN,0,0,1,.1)),JI(l(pk,16,7,234)),Wk(e),Gk,f(xk,15,13)]),Vf(Hf(t)))}),EN=a(function(e,t,r,n){return"pad-"+Ri(e)+"-"+Ri(t)+"-"+Ri(r)+"-"+Ri(n)}),SN=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return $(t,r)&&$(t,n)&&$(t,a)?f(YI,_k,h(Lk,"p-"+Ri(t),t,t,t,t)):f(YI,_k,h(Lk,d(EN,t,r,n,a),t,r,n,a))},TN=function(e){return function(){var t=wd(e.wallet);return"Nothing"!==t.$&&$(t.a.address,e.agentAddress)}()?f(mk,F([f(xk,30,10),Wk(24),Gk]),Vf("Your Trades")):f(yN,F([aN(10),SN({bottom:30,left:30,right:30,top:10})]),F([f(mk,F([Wk(24),Gk]),Vf("Trade History for User")),f(CN,18,e.agentAddress)]))},wN=function(e){return function(t){return $(t.parameters.initiatorAddress,e.agentAddress)||$(t.state.responder,ci(e.agentAddress))}},IN=function(e){return Wf(e)},AN={$:"BurnWindow"},BN={$:"FiatPrice"},kN={$:"Margin"},NN={$:"Offer"},RN={$:"PaymentWindow"},$N=function(e){return{$:"AlignY",a:e}},_N={$:"CenterY"},LN=$N(_N),xN=RT(20),PN=f(Dk,xN,uT.clip),DN=bk,UN=function(e){return f(YI,_k,h(Lk,"p-"+Ri(e),e,e,e,e))},ON=r(function(e,t){return f(mk,F([XS(DN(e)),YS(Tk(60)),PN,Ik($k)]),f(mk,F([UN(12),LN,XS(Ck)]),t))}),MN=function(e){switch(e.$){case"Phase":return 1;case"Expires":return 2;case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},FN=function(e){return{$:"JustImage",a:e}},VN=FN({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),KN=HS("alt"),HN=function(e){return f(HS,"src",nt(e))},jN=r(function(e,t){var r=t.src,n=t.description,a=f(Wf,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(VI,nT,yk,f(Na,KI(uT.imageContainer),e),tT(F([d(VI,nT,eT("img"),O(F([ZS(HN(r)),ZS(KN(n))]),a),tT(mr))])))}),qN=r(function(e,t){if("None"===t.$)return Ek;var r=t.a;return f(jN,e,r)}),GN=FN({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),zN=function(e){return{$:"ChangeSort",a:e}},YN=f(Dk,qk,uT.textMedium),WN=function(e){return f(mk,F([YN,Wk(17)]),Vf(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},JN=r(function(e,t){return f(yN,F([aN(5),Uk,jk(zN(e))]),F([WN(e),function(){if("Just"===t.$){var e=t.a;return f(mk,F([LN]),f(qN,F([XS(Tk(8))]),function(){return"Ascending"===e.$?GN:VN}()))}return Ek}()]))}),QN=r(function(e,t){return f(ON,MN(t),f(JN,t,e))}),XN=r(function(e,t){return f(yN,F([XS(Ck)]),f(Pa,function(t){var r=$(e.a,t)?ci(e.b):fi;return f(QN,r,t)},t))}),ZN=l(pk,150,150,150),eR=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},tR=r(function(e,t){return f(Pu,e.amount,t.amount)}),rR=r(function(e,t){return f(Pu,Sl(e),Sl(t))}),nR=n(function(e,t,r){return f(e,r,t)}),aR=function(e){var t=e.a;return($(e.b,ho)?nR:Oa)(function(){switch(t.$){case"Phase":return r(function(e,t){return $(e.state.phase,t.state.phase)?l(aR,x(Qg,Rf),e,t):f(Su,eR(e.state.phase),eR(t.state.phase))});case"Expires":return r(function(e,t){return f(Gg,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(rR,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(tR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(pc,ba,l(Id,r(function(e,t){return f(Su,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(Gg,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(Gg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},iR=l(pk,233,237,242),oR=function(e){return f(mk,F([XS(Ck),YS(Ck),PN]),f(uN,F([Wk(12)]),F([Vf(e.info)])))},uR=function(e){return f(pc,Ek,f(Bo,oR,Nl(e)))},sR=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"}},cR=function(e){return{$:"TimeLeft",a:e}},fR=function(e){return{$:"TimeUp",a:e}},lR=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 bl(0)}}),dR=r(function(e,t){return bl(Sd(e)-Sd(t))}),hR=r(function(e,t){var r=f(lR,t.state.phase,t),n=f(dR,e,t.state.phaseStartTime),a=f(dR,r,n);return Sd(a)>0?cR(x(a,r)):fR(r)}),pR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},gR=l(qI,0,0,0),vR=l(pk,51,183,2),yR=function(e){var t=wu(100*e),r=t-ei(t),n=Ri(ei(t)),a=f(ti,0,3-$o(n));return n+(function(){if(a){return f(Do,a+1,f(Lo,1,WT(r)))}return""}()+"%")},mR=r(function(e,t){return FN({description:"",src:function(){var r=x(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"}()})}),bR=n(function(e,t,r){return f(qN,f(Na,YS(Tk(34)),e),f(mR,t,r))}),CR=r(function(e,t){var r=yR(t);if("0%"===r)return f(mk,F([Wk(16)]),Vf("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?vR:Qk;return f(yN,F([aN(4)]),F([l(bR,mr,a,ci(i)),f(mk,F([JI(o),Wk(16)]),Vf(n))]))}),ER=FN,SR=function(e){return l($a,r(function(e,t){var r=e.a,n=e.b;return l(ll,r,n,t)}),Vh,e)}(f(Pa,function(e){var t=e.a;return x(t,x(e.b,ER({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},F([x("AUD","$"),x("CLP","$"),x("EUR","€"),x("IDR","Rp"),x("KRW","₩"),x("NZD","$"),x("RUB","₽"),x("TRY","₺"),x("BRL","R$"),x("CNY","¥"),x("GBP","£"),x("ILS","₪"),x("MXN","$"),x("PHP","₱"),x("SEK","kr"),x("TWD","NT$"),x("CAD","$"),x("CZK","Kč"),x("HKD","$"),x("INR","₹"),x("MYR","RM"),x("PKR","₨"),x("SGD","$"),x("USD","$"),x("CHF","Fr"),x("DKK","kr"),x("HUF","Ft"),x("JPY","¥"),x("NOK","kr"),x("PLN","zł"),x("THB","฿"),x("ZAR","R"),x("VND","₫")]))),TR=function(e){return f(pc,"",f(Bo,Xa,f(Kh,e,SR)))},wR=function(e){return $o(e)<=3?e:wR(f(td,3,e))+","+f(Fo,3,e)},IR=function(e){return wR(ed(e))},AR=function(e){return O(TR(e.fiatType),IR(e.amount))},BR=function(e){var t=function(){var t=f(Kh,e.fiatType,SR);if("Nothing"===t.$)return Ek;var r=t.a,n=(r.a,r.b);return f(qN,F([YS(Tk(26))]),n)}();return f(yN,F([aN(4)]),F([t,f(mk,F([JI(d(bN,0,0,0,.5)),YN,XS(Tk(50))]),Vf(e.fiatType)),Vf(AR(e))]))},kR=function(e){return Sd(e)<0},NR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),RR=function(e){var t=Yp(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(NR,Mb(t),Mb(r),Mb(n),Mb(a))}(f(pc,x(Iu(0),Iu(0)),f(ns,n,Iu(60))))}(f(pc,x(Iu(0),Iu(0)),f(ns,r,Iu(3600))))}(f(pc,x(Iu(0),Iu(0)),f(ns,t,Iu(86400))))},$R=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!kR(a)){var u=r(function(e,t){return O(l(fs,2,D("0"),Ri(e)),t)}),s=Sd(a)>0?i:o,c=RR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(yN,O(F([aN(5)]),e),F([f(mk,O(F([JI(h)]),t),Vf(f(u,c.days,"d"))),f(mk,O(F([JI(d)]),t),Vf(f(u,c.hours,"h"))),f(mk,O(F([JI(s)]),t),Vf(f(u,c.min,"m")))]))}var p=e,g=t,v=x(i,o),y=bl(0);e=p,t=g,n=v,a=y}}),_R={$:"Behind"},LR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),xR=function(e){return f(LR,_R,e)},PR=r(function(e,t){var r=Vg(200*e),n=200-r,a=f(mk,F([XS(DN(n))]),Ek),i=F([YS(Tk(3)),Mk(20)]),o=f(mk,O(i,F([XS(DN(r)),Ik(t)])),Ek),u=f(mk,O(i,F([XS(Ck),Ik(iR)])),Ek);return f(yN,F([XS(Ck),xR(u)]),F([o,a]))}),DR=l(qI,1,1,0),UR=r(function(e,t){return Sd(e)/Sd(t)}),OR=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(UR,o,u),c=(f(mk,F([eN]),d($R,mr,mr,x(a,i),o)),s<.1?Qk:s<.2?DR:vR);return f(pN,O(F([aN(5)]),e),F([d($R,F([eN]),t,x(a,i),o),f(PR,1-s,c)]))}),MR=function(e){var t=rd(Sl(e)),r=f(Rl,".",t);if(!r.b)return t;if(r.b.b){Ff("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Do,3,t);case 1:return f(Do,4,f(pc,t,f(Bo,WT,f(Bo,function(e){return e/100},f(Bo,Ha,f(Bo,Vg,f(Bo,ri(100),id(t))))))));default:var n=r.a;return f(pc,f(Do,n,t),f(Bo,Ri,f(Bo,Vg,id(t))))}},FR=n(function(e,t,r){return f(ON,MN(t),function(){switch(t.$){case"Phase":return Vf(pR(r.state.phase));case"Expires":if("Open"===r.state.phase.$){var n=f(hR,e,r);if("TimeLeft"===n.$){var a=n.a,i=f(UR,a.a,a.b)<.05?Qk:gR;return d(OR,F([XS(Ck)]),F([Wk(16)]),x(i,iR),a)}var o=n.a;return d(OR,F([XS(Ck)]),F([Wk(16)]),x(Qk,iR),x(bl(0),o))}return Ek;case"Offer":return f(yN,F([aN(5)]),F([Vf(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(MR(r.parameters.tradeAmount)+" ")+sR(r.factory))]));case"FiatPrice":return BR(r.terms.price);case"Margin":var u=$(r.parameters.initiatorRole,cb);return f(pc,Ek,f(Bo,CR(u),r.derived.margin));case"PaymentWindow":var s=function(){return"Seller"===r.parameters.initiatorRole.$?Qk:vR}(),c=L(Sd(r.parameters.autoabortInterval),216e5)<0?s:gR;return d($R,mr,mr,x(c,iR),r.parameters.autoabortInterval);default:var s=function(){return"Seller"===r.parameters.initiatorRole.$?vR:Qk}(),c=L(Sd(r.parameters.autoabortInterval),216e5)<0?s:gR;return d($R,mr,mr,x(c,iR),r.parameters.autoreleaseInterval)}}())}),VR=n(function(e,t,r){return f(pN,F([XS(Ck),aN(1),Ik(iR),XS(DN(7))]),F([f(yN,F([XS(DN(6)),aN(1)]),f(Pa,function(t){return l(FR,e,t,r)},t)),f(ON,1,uR(r.terms.paymentMethods))]))}),KR=Sr,HR=RT(28),jR=function(e){return f(YI,HR,l(zI,"bc-"+WI(e),"border-color",e))},qR=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),GR=function(e){return f(YI,DI,h(qR,"b-"+Ri(e),e,e,e,e))},zR=a(function(e,t,r,n){return f(pN,F([XS(Ck),GR(2),Mk(8),jR(ZN),aN(2),Ik(ZN),PN]),f(Pa,f(VR,e,r),f(KR,aR(t.orderBy),n)))}),YR=a(function(e,t,r,n){return f(pN,F([XS(Ck),YS(Ck),UN(30),aN(5)]),F([f(XN,t.orderBy,r),d(zR,e,t,r,n)]))}),WR=n(function(e,t,r){return $(t,mr)?Ek:f(Wi,So,d(YR,e,r.tradeTable,F([po,NN,BN,kN,RN,AN]),t))}),JR=function(e){return f(Wf,function(e){return Gm(e.parameters)},yS(e))},QR={$:"NoneFound"},XR={$:"AllFetched"},ZR={$:"FetchingTrades"},e$={$:"QueryingNumTrades"},t$=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return e$;if(t.a){var r=t.a;return L(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?ZR:XR}return QR},r$=n(function(e,t,r){var n=_v(f(Pa,function(e){return f(IN,wN(r),JR(e))},t)),a=n,i=function(e){return f(mk,F([Wk(24),Gk,JI(ZN),eN,UN(20)]),Vf(e))},o=f(Zd,Qa(QR),f(Pa,t$,t))?F([i("No trades found.")]):f(Pa,i,AC(f(Pa,function(e){switch(t$(e).$){case"QueryingNumTrades":return ci(HA(e.factory)+"Querying Factory...");case"NoneFound":return fi;case"FetchingTrades":return ci(HA(e.factory)+"Fetching Trades");default:return fi}},t)));return f(pN,F([aN(10)]),F([function(){return o.b?f(pN,F([aN(5)]),o):Ek}(),l(WR,e,a,r)]))}),n$=n(function(e,t,r){return f(pN,F([Mk(5),Ik($k),XS(Ck),YS(Ck),f(xk,0,20)]),F([TN(r),l(r$,e,t,r)]))}),a$=function(e){return{$:"ShowCurrencyDropdown",a:e}},i$={$:"AbortCreate"},o$=function(e){return{$:"AppCmd",a:e}},u$=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),s$=function(e){return f(Pa,function(e){return F([f(mk,F([JI(Qk)]),Vf("Caution! ")),Vf(e)])},AC(F([$(f(Gg,e.autoreleaseInterval,bl(12e5)),Ca)?ci(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."}()):fi,$(f(Gg,e.autoabortInterval,bl(36e5)),Ca)?ci(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.'}()):fi])))},c$=l(qI,0,0,1),f$=function(e){return f(mk,F([SN({bottom:5,left:5,right:5,top:0}),jk(e),Mk(30),Ik(d(bN,1,1,1,.4)),GR(1),jR(d(bN,0,0,0,.3)),Uk,Wk(14)]),f(mk,F([JI(d(bN,0,0,0,.7))]),Vf("x")))},l$=kn,d$=l$,h$=ZS,p$=r(function(e,t){return f(mk,F([xR(f(mk,F([Ik(e),h$(f(d$,"position","fixed")),h$(f(d$,"z-index","1000")),h$(f(d$,"top","0")),h$(f(d$,"left","0")),h$(f(d$,"width","100%")),h$(f(d$,"height","100%"))]),Ek)),XS(Ck),YS(Ck)]),t)}),g$={$:"Top"},v$=$N(g$),y$={$:"InFront"},m$=function(e){return f(LR,y$,e)},b$=r(function(e,t){return{$:"Max",a:e,b:t}}),C$=r(function(e,t){return f(b$,e,t)}),E$=n(function(e,t,r){return l(Da,p$,d(bN,0,0,.3,.6),f(mk,O(F([eN,LN,XS(f(C$,500,JS)),Ik($k),Mk(8),m$(f(mk,F([lN,v$]),f$(r)))]),e),t))}),S$=r(function(e,t){if("Nothing"===t.$)return Ek;var r=t.a;return f(mk,O(F([Mk(5),jR(l(qI,.9,0,0)),GR(1),Ik(l(qI,1,.4,.4)),UN(5),eN,LN,XS(f(C$,200,JS)),Wk(14)]),e),f(uN,mr,F([Vf(r)])))}),T$={$:"Above"},w$=function(e){return f(LR,T$,e)},I$=RT(26),A$=function(e){return{$:"MoveY",a:e}},B$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),k$=function(e){return f(B$,I$,A$(-e))},N$=r(function(e,t){return f(mk,F([Mk(4),f(xk,25,17),Wk(18),Gk,Ik(iR),w$(f(S$,F([k$(5)]),t))]),Vf(e))}),R$=a(function(e,t,r,n){return d(jI,e/255,t/255,r/255,n)}),$$=d(R$,1,31,52,.64),_$=RT(32),L$={$:"Active"},x$=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),P$=_n,D$={$:"NoAttribute"},U$=r(function(e,t){switch(t.$){case"NoAttribute":return D$;case"Describe":var r=t.a;return iN(r);case"AlignX":var n=t.a;return Xk(n);case"AlignY":var a=t.a;return $N(a);case"Width":var n=t.a;return QS(n);case"Height":var n=t.a;return zS(n);case"Class":var n=t.a,a=t.b;return f(Dk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(YI,i,o);case"Nearby":var u=t.a,s=t.b;return f(LR,u,f(Yi,e,s));case"Attr":var c=t.a;return ZS(f(P$,e,c));default:var l=t.a,d=t.b;return f(B$,l,d)}}),O$=function(e){return f(U$,Ag,e)},M$=r(function(e,t){var r=t.a,n=t.b,a=O$(e);switch(a.$){case"StyleClass":var i=a.b;return x(f(Na,i,r),n);case"TransformComponent":var o=(a.a,a.b);return x(r,f(LI,n,o));default:return x(r,n)}}),F$=function(e){var t=l($a,M$,x(mr,MI),e),r=t.a,n=t.b;return f(Na,SI(n),r)},V$=function(e){return f(YI,_$,f(x$,L$,F$(e)))},K$=RT(33),H$={$:"Hover"},j$=function(e){return f(YI,K$,f(x$,H$,F$(e)))},q$=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(mk,F([Mk(4),Uk,jk(n),f(xk,25,17),JI(t),Wk(18),Gk,Ik(a),V$(F([Ik(o)])),j$(F([Ik(i)]))]),Vf(r))}),G$=r(function(e,t){return d(q$,P(d(bN,1,0,0,1),d(bN,1,0,0,.8),d(bN,1,0,0,.6)),$k,e,t)}),z$=RT(12),Y$=f(Dk,z$,uT.textCenter),W$=function(e){return p$(d(bN,0,0,.3,.6))(f(pN,F([aN(10),eN,LN,Ik(d(bN,0,0,0,.5)),Mk(8),UN(20)]),f(Pa,function(e){return f(uN,F([eN,LN,Wk(20),Gk,JI($k),Y$]),F([e]))},e)))},J$=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+iA(t)}e.a;return"https://kovan.etherscan.io/tx/"+iA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+iA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+iA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+iA(t)}}),Q$={$:"Bottom"},X$=$N(Q$),Z$=KI(uT.underline),e_=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return x(Vf(MR(lb(a))),f(G$,"Yes, I definitely want to open this trade.",l(u$,r,n,a)))}return x(Vf("??"),f(N$,"(loading exact fees...)",fi))}(),i=a.a,o=a.b;return l(E$,mr,f(pN,F([aN(20),UN(20),eN,YS(Ck),Y$]),F([f(mk,F([Wk(26),Gk,eN,LN]),Vf("Just to Confirm...")),f(pN,F([aN(20),eN,LN]),f(Pa,uN(F([eN,Wk(18),YN,JI($$)])),O(s$(n),O(F([F([Vf("You will deposit "),i,Vf(" "+sR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?F([F([Vf("This ususally requires two Metamask signatures. Your "+sR(r)+" will not be deposited until the final transaction has been mined.")])]):mr}())))),f(mk,F([X$,eN]),o)])),i$);case"ApproveNeedsSig":var u=e.a;return f(mk,F([jk(o$(d($d,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),W$(F([Vf("Waiting for user signature for the approve call."),Vf("(check Metamask!)"),Vf("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(mk,F([jk(o$(d($d,"txChainModal clicked","misclick","ApproveMining",0)))]),W$(F([Vf("Mining the initial approve transaction..."),f(HI,F([Z$,JI(c$)]),{label:Vf("See the transaction on Etherscan"),url:f(J$,to(u),s)}),Vf("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(mk,F([jk(o$(d($d,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),W$(F([Vf("Waiting for user signature for the create call."),Vf("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(mk,F([jk(o$(d($d,"txChainModal clicked","misclick","CreateMining",0)))]),W$(F([Vf("Mining the final create call..."),f(HI,F([Z$,JI(c$)]),{label:Vf("See the transaction on Etherscan"),url:f(J$,r,s)}),Vf("You will be redirected when it's mined.")])))}}),t_=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Ek;var r=t.a;return f(e_,r,e)},r_=function(e){return{$:"TradeAmountChanged",a:e}},n_=HS("id"),a_=h$(n_("inputError")),i_=l(pk,109,127,138),o_=FN({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),u_=function(e){return f(qN,f(Na,YS(Tk(26)),e),o_)},s_=function(e){return f(yN,F([aN(4)]),F([u_(mr),f(mk,F([Wk(24),YN,JI(i_)]),Vf(sR(e)))]))},c_={$:"Left"},f_=Xk(c_),l_=function(e){return{$:"HiddenLabel",a:e}},d_=l_,h_=HS("type"),p_=function(e){return x(e,!0)},g_=function(e){return{$:"MayStopPropagation",a:e}},v_=r(function(e,t){return f(Vk,e,g_(t))}),y_=r(function(e,t){return l(xa,vh,t,e)}),m_=f(y_,F(["target","value"]),Yo),b_=function(e){return f(v_,"input",f(Mi,p_,f(Mi,e,m_)))},C_=RT(0),E_=r(function(e,t){return{$:"Transparency",a:e,b:t}}),S_=function(e){var t=function(e){return 1-e}(f(nc,1,f(ti,0,e)));return f(YI,C_,f(E_,"transparency-"+HT(t),t))},T_=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),w_=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(VI,hN,eT("label"),e,tT(F([r])))}var n=t.a,a=t.b,i=t.c,o=d(VI,nT,yk,a,tT(F([i])));switch(n.$){case"Above":return d(VI,hN,eT("label"),e,tT(F([o,r])));case"Below":return d(VI,hN,eT("label"),e,tT(F([r,o])));case"OnRight":return d(VI,vN,eT("label"),e,tT(F([r,o])));default:return d(VI,vN,eT("label"),e,tT(F([o,r])))}}),I_=lI,A_=f(Ua,ZS,I_("autocomplete")),B_=l(qI,136/255,138/255,133/255),k_=l(qI,186/255,189/255,182/255),N_=f(xk,12,12),R_=l(qI,1,1,1),$_=F([N_,Mk(3),jR(k_),Ik(R_),GR(1),aN(3),XS(Ck)]),__=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},L_=function(e){return f(Xd,__,e)?D$:KI("focusable")},x_=function(e){return{$:"Label",a:e}},P_=function(e){if("HiddenLabel"===e.$){var t=e.a;return iN(x_(t))}return D$},D_=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},U_=function(e){return"HiddenLabel"===e.$},O_=me,M_=r(function(e,t){return f(Nn,e,O_(t))}),F_=M_("spellcheck"),V_=f(Ua,ZS,F_),K_=J,H_=RT(47),j_=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(wi(K_(e))),o=(i-1)*t+f(pc,0,f(Bo,a,r))+f(pc,0,f(Bo,a,n));return f(YI,H_,l(EI,"textarea-height-"+Ri(i),"height",function(e){return"calc("+Ri(e)+"em + "+Ri(o)+"px) !important"}(i)))}),q_=HS("value"),G_=f(Ua,ZS,q_),z_={$:"LivePolite"},Y_=iN(z_),W_=function(e){return l(xa,r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"NoAttribute":return x(r,n);case"Class":e.a;return x(f(Na,e,r),n);case"Attr":e.a;return x(f(Na,e,r),n);case"StyleClass":e.b;return x(f(Na,e,r),n);case"Width":e.a;return f(VT,"width",n)?x(r,n):x(f(Na,e,r),f(iS,"width",n));case"Height":e.a;return f(VT,"height",n)?x(r,n):x(f(Na,e,r),f(iS,"height",n));case"Describe":e.a;return f(VT,"described",n)?x(r,n):x(f(Na,e,r),f(iS,"described",n));case"Nearby":e.a,e.b;return x(f(Na,e,r),n);case"AlignX":return f(VT,"align-x",n)?x(r,n):x(f(Na,e,r),f(iS,"align-x",n));case"AlignY":return f(VT,"align-y",n)?x(r,n):x(f(Na,e,r),f(iS,"align-y",n));default:return f(VT,"transform",n)?x(r,n):x(f(Na,e,r),f(iS,"transform",n))}}),x(mr,Dy),e).a},J_=r(function(e,t){return l(xa,r(function(e,r){return t(e)?f(Na,e,r):r}),mr,W_(e))}),Q_=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}},X_=f(Ua,zi,Xu),Z_=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=F([ZS(b_(n.onChange))]),o=O($_,t),u=f(J_,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(Wf,D_,o),c=f(J_,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(J_,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(J_,o,function(e){return"Nearby"===e.$})),p=f(Wf,f(Ua,Uu,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return P("input",O(F([G_(n.text),ZS(h_(a)),V_(e.spellchecked),KI(uT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return D$;var r=t.a;return A_(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(Na,e,t.adjustedAttributes),heightContent:ci(Q_(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(Na,e,t.adjustedAttributes),maybeBorder:ci(d(T_,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:ci(d(T_,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(Na,e,t.adjustedAttributes),maybeSpacing:ci(g)}):t;default:break e}default:break e}return U(t,{adjustedAttributes:f(Na,e,t.adjustedAttributes)})}),{adjustedAttributes:mr,heightContent:fi,maybeBorder:fi,maybePadding:fi,maybeSpacing:fi},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(pc,5,c);return P("textarea",O(F([V_(e.spellchecked),KI(uT.inputMultiline),f(pc,D$,f(Bo,A_,e.autofill)),function(){if("Nothing"===u.$)return D$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return SN({bottom:f(ti,0,n-(v/2|0)),left:a,right:r,top:f(ti,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?D$:s.a?d(j_,n.text,v,u,g):D$}()]),h),F([X_(uI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(VI,nT,yk,f(Na,XS(Ck),_v(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([m$(f(mk,f(Na,N_,O(s,O(F([JI(B_),KI(uT.noTextSelection+" "+uT.passPointerEvents),jR(d(bN,0,0,0,0)),Ik(d(bN,0,0,0,0)),YS(Ck),XS(Ck),S_(""===n.text?1:0)]),r))),a))])}()]))),tT(F([d(VI,nT,eT(v),_v(F([F([L_(t),P_(n.label)]),y,i])),tT(m))])));return l(w_,f(Na,f(Dk,Pk,uT.cursorText),f(Na,U_(n.label)?D$:aN(5),f(Na,Y_,u))),n.label,b)}),eL=Z_({autofill:fi,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),tL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(eL,F([XS(Ck),YS(Tk(40)),GR(0)]),{label:d_(r),onChange:i,placeholder:n,text:a});return f(yN,O(F([aN(5)]),e),AC(F([f(Bo,mk(F([f_])),o),ci(s),f(Bo,mk(F([lN])),u)])))}),rL={$:"Below"},nL=function(e){return f(LR,rL,e)},aL=function(e){return f(B$,I$,A$(e))},iL=n(function(e,t,r){return p(tL,F([XS(Tk(150)),YN,Wk(24),nL(f(S$,F([a_,aL(5)]),r))]),x(fi,ci(f(mk,F([jk(o$(d($d,"click","misclick","dai symbol in dai input",0)))]),s_(e)))),"dai input",fi,t,r_)}),oL=r(function(e,t){return f(YI,DI,h(qR,"b-"+Ri(e)+"-"+Ri(t),t,e,t,e))}),uL=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return $(r,t)&&$(n,a)?$(r,a)?GR(r):f(oL,n,r):f(YI,DI,h(qR,"b-"+Ri(r)+"-"+Ri(a)+"-"+Ri(t)+"-"+Ri(n),r,a,t,n))},sL=mk(F([jR(iR),uL({bottom:2,left:0,right:0,top:0})])),cL=r(function(e,t){return f(pN,F([aN(10)]),F([f(mk,F([Wk(17),Gk]),Vf(e)),t]))}),fL=r(function(e,t){return sL(f(cL,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(iL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),lL=function(e){return f(pc,IE,mg(e))},dL=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 "+MR(f(wl,r,100))+" "+sR(lL(e.wallet))+"."}return"There is a 1% fee."}();return f(yN,F([eN,f(xk,20,10),Ik(l(pk,10,33,108)),Mk(8),aN(5),jk(o$(d($d,"click","misclick","fee notify element",0)))]),F([f(mk,F([Wk(18),JI(l(pk,0,226,255)),Gk]),Vf(t)),f(mk,F([Wk(17),JI($k),YN]),Vf("We only collect this fee when trades resolve successfully."))]))},hL=function(e){return{$:"ChangeRole",a:e}},pL=d(R$,1,31,52,.13),gL=r(function(e,t){var r=F([Wk(24),YN,Uk]),n=function(){return"Buyer"===t.$?x(r,O(r,F([JI(pL)]))):x(O(r,F([JI(pL)])),r)}(),a=n.a,i=n.b;return f(yN,F([aN(20)]),F([f(mk,O(F([jk(hL(yl))]),i),Vf("Sell "+e)),f(mk,O(F([jk(hL(cb))]),a),Vf("Buy "+e))]))}),vL=r(function(e,t){return f(cL,"Trade Type",f(gL,sR(e),t.inputs.userRole))}),yL=RT(19),mL=function(e){return Xl(F([e.inset?"box-inset":"box-",WT(e.offset.a)+"px",WT(e.offset.b)+"px",WT(e.blur)+"px",WT(e.size)+"px",WI(e.color)]))},bL=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(YI,yL,l(EI,mL(t),"box-shadow",QT(t)))},CL=bL({blur:20,color:d(R$,0,0,0,.04),offset:x(0,3),size:0}),EL=f(Dk,tN,uT.spaceEvenly),SL=function(e){var t=mg(e.wallet);if("Just"===t.$){var r=t.a;return f(pN,F([XS(Ck),aN(20),Ik($k),Mk(5),UN(20),CL]),F([f(yN,F([XS(Ck),EL]),F([f(vL,r,e),f(fL,r,e)])),dL(e)]))}return b("Create.View",{start:{line:75,column:13},end:{line:75,column:23}})("")},TL=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),wL={$:"Web3Connect"},IL=function(e){return f(mk,F([eN]),function(){var t=x(wd(e),mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(G$,"Open Trade",f(TL,n,r))}t.b;return f(N$,"Unsupported Network",fi)}t.a;return f(G$,"Connect to Wallet",wL)}())},AL=function(e){return{$:"AutoabortIntervalChanged",a:e}},BL=function(e){return{$:"ChangePaymentMethodText",a:e}},kL=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),NL=kL,RL=function(e){return f(NL,F([JI(d(bN,0,0,0,.2))]),function(){return Vf("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")}())},$L={$:"TextArea"},_L=r(function(e,t){return l(Z_,{autofill:fi,spellchecked:t.spellcheck,type_:$L},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),LL=n(function(e,t,r){var n=f(mk,F([Wk(22),Gk]),Vf("Payment Method")),a=f(_L,F([XS(Ck),YS(Tk(150)),Ik(d(R$,155,203,255,.2)),GR(0)]),{label:d_("payment method"),onChange:BL,placeholder:""===r?ci(RL(t)):fi,spellcheck:!0,text:r});return f(pN,F([aN(20),SN({bottom:15,left:45,right:45,top:0}),XS(Ck),w$(f(S$,F([a_,aL(30),UN(10),Wk(20),XS(Tk(400))]),e))]),F([n,a]))}),xL=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."},PL=a(function(e,t,r,n){var a=l(fs,e,D("0"),Ri(n));return f(mk,F([Wk(22),JI(t)]),Vf(O(a,r)))}),DL=function(e){return Sd(e)<0?bl(0):e},UL=n(function(e,t,n){var a=r(function(e,r){return f(pN,F([aN(4)]),F([f(mk,F([UN(4),Uk,jk(n(f(Wm,t,e)))]),f(qN,F([YS(Tk(10))]),GN)),r,f(mk,F([UN(4),Uk,jk(n(function(e){return Sd(e)?e:bl(3e5)}(DL(f(dR,t,e)))))]),f(qN,F([YS(Tk(10))]),VN))]))}),i=RR(t);return f(yN,F([EL,aN(10)]),F([f(a,bl(864e5),d(PL,3,e," days",i.days)),f(a,bl(36e5),d(PL,2,e," hours",i.hours)),f(a,bl(3e5),d(PL,2,e," min",i.min))]))}),OL=o(function(e,t,r,n,a,i){var o=f(mk,F([Ik(d(R$,155,203,255,.2)),Mk(5),UN(15),w$(f(S$,F([a_]),a))]),l(UL,gR,n,i)),u=f(yN,F([aN(30)]),F([f(qN,F([YS(Tk(40)),jk(o$(d($d,"click","misclick","symbol for "+t,0)))]),e),f(mk,F([Wk(22),Gk]),Vf(t))])),s=f(uN,F([Wk(17),YN,JI($$)]),F([Vf(r)]));return f(pN,F([XS(Ck),Mk(10),Ik(l(pk,237,237,237)),aN(2)]),f(Pa,mk(F([Ik($k),f(xk,45,18),XS(Ck)])),F([u,f(yN,F([XS(Ck),aN(25),Ik($k)]),F([o,s]))])))}),ML=FN({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),FL=f(Dk,xN,uT.clipX),VL=f(Dk,xN,uT.clipY),KL=i(function(e,t,r,n,a){return f(pN,F([aN(15),Mk(8),FL,VL,Ik($k)]),F([p(OL,ML,"Payment Window",xL(a),r,n,AL),l(LL,t,a,e)]))}),HL=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},jL=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."},qL=FN({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),GL=n(function(e,t,r){return f(mk,F([Mk(8),FL,VL,Ik($k)]),p(OL,qL,"Burn/Release Window",jL(r),e,t,HL))}),zL=function(e){return{$:"AutorecallIntervalChanged",a:e}},YL=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."},WL=FN({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),JL=n(function(e,t,r){return f(mk,F([Mk(8),Ik($k),FL,VL]),p(OL,WL,"Open Window",YL(r),e,t,zL))}),QL=function(e){return f(pN,F([XS(Ck),aN(20)]),F([l(JL,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(KL,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(GL,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},XL=function(e){return f(pN,F([XS(f(C$,1e3,Ck)),eN,aN(20),SN({bottom:30,left:40,right:40,top:0}),jk(a$(!1)),m$(t_(e))]),F([SL(e),QL(e),IL(e.wallet)]))},ZL=os(pm(8226)),ex=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(Na,e,f(Na,t,r))}),o=l(xa,i,mr,a);return f(Na,n,o)}return mr}),tx=r(function(e,t){return l($a,Na,t,e)}),rx=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(tx,r,e),a=t-1,i=r;e=n,t=a,r=i}}),nx=r(function(e,t){var r=wi(t);return!r||$(r,e)?t:L(r,e)<0?_a(f(tx,f(qs,e%r,t),l(rx,mr,e/r|0,t))):f(qs,e,t)}),ax=a(function(e,t,r,n){for(;;){if(!r.b)return _a(n);var a=r.a,i=r.b,o=e(a);if(f(VT,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(iS,o,t),c=i,l=f(Na,a,n);e=u,t=s,r=c,n=l}}}),ix=function(e){return d(ax,Oa,Dy,e,mr)},ox=r(function(e,t){return f(mk,F([XS(Ck),m$(f(yN,F([aN(3),XS(DN(100)),XS(t),PN]),f(ex,f(mk,F([JI(d(bN,0,0,0,.1)),Wk(14)]),Vf(ZL)),f(Pa,f(Ua,mk(F([JI(d(bN,0,0,0,.2))])),Vf),f(nx,100,(e?_a:Oa)(ix(f(Pa,f(Ao,jo,Xa),Aa(SR)))))))))]),Vf(" "))}),ux=r(function(e,t){var r=t.url,n=t.label;return d(VI,nT,eT("a"),f(Na,ZS(jS(r)),f(Na,ZS(qS("noopener noreferrer")),f(Na,XS(JS),f(Na,YS(JS),f(Na,KI(uT.contentCenterX+" "+uT.contentCenterY),e))))),tT(F([n])))}),sx=KI(uT.italic),cx=function(){var e=f(Ua,mk(F([JI(l(qI,.8,.2,.2))])),Vf),t=f(Ua,mk(F([sN])),Vf);return f(pN,F([XS(Ck),YS(Ck),Ik($k),Mk(6),aN(50),bL({blur:20,color:d(R$,0,0,0,.1),offset:x(0,3),size:0}),Mk(10),UN(20)]),F([f(ox,!1,Ck),f(pN,F([eN,XS(f(C$,700,Ck)),aN(20)]),F([f(uN,F([Wk(70),sN,eN,Y$]),F([Vf("DAI"),e("Hard")])),f(yN,F([Wk(30),Gk,eN,Y$,sx]),F([Vf("The "),e("Global"),Vf(", "),e("Unkillable"),Vf(" Crypto Gateway")]))])),f(yN,F([Ik(ZN),aN(2),eN,v$,XS(Ck)]),F([f(mk,F([f(xk,40,10),Ik($k),XS(Ck),YS(Ck)]),f(pN,F([aN(60),lN]),F([f(mk,F([Wk(40),Gk,eN]),Vf("Want to learn more?")),f(ux,F([Mk(4),Uk,f(xk,25,17),Ik(c$),JI($k),sN,Wk(24),eN]),{label:f(uN,F([Y$]),F([Vf("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"})]))),f(mk,F([f(xk,40,10),Ik($k),XS(Ck),YS(Ck)]),f(pN,F([f_,aN(60)]),F([f(mk,F([Wk(40),Gk,eN]),Vf("Ready to try it out?")),f(pN,F([aN(10),XS(Tk(400)),eN]),F([f(uN,F([Wk(24),XS(Ck)]),F([Vf("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f(uN,F([Wk(24),XS(Ck)]),F([Vf("Then follow the links at the top of this page to browse "),t("Sell Offers"),Vf(", browse "),t("Buy Offers"),Vf(", or "),t("Create Your Own Offer"),Vf(".")]))]))])))])),f(mk,F([X$,XS(Ck)]),f(ox,!0,Ck))]))}(),fx=function(e){return{$:"ShowCurrencyDropdown",a:e}},lx=r(function(e,t){return Wf(t(e))}),dx=n(function(e,t,r){return $(t,mr)?Ek:f(Wi,av,d(YR,e,r.tradeTable,F([Qg,NN,BN,kN,RN,AN]),t))}),hx=n(function(e,t,r){var n=l(lx,e,r.filterFunc,_v(f(Pa,JR,t))),a=function(e){return f(mk,F([Wk(24),Gk,JI(ZN),eN,UN(20)]),Vf(e))},i=f(Zd,Qa(QR),f(Pa,t$,t))?F([a("No trades found.")]):f(Pa,a,AC(f(Pa,function(e){switch(t$(e).$){case"QueryingNumTrades":return ci(HA(e.factory)+"Querying Factory...");case"NoneFound":return fi;case"FetchingTrades":return ci(HA(e.factory)+"Fetching Trades");default:return fi}},t)));return f(pN,F([aN(10)]),F([function(){return i.b?f(pN,F([aN(5)]),i):Ek}(),l(dx,e,n,r)]))}),px=function(e){return h$(f(v_,"click",Vi(x(e,!0))))},gx=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(YI,Ok,l(EI,"br-"+Ri(t)+"-"+Ri(r)+Ri(n)+"-"+Ri(a),"border-radius",Ri(t)+"px "+Ri(r)+"px "+Ri(a)+"px "+Ri(n)+"px"))},vx=function(e){return f(Kk,"focus",Vi(e))},yx=f(Ua,ZS,vx),mx=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return mr;var e=o.a;return F([yx(e(!0)),px(e(!0))])}();return f(yN,O(e,F([YS(Tk(40)),bL({blur:20,color:d(R$,233,237,242,.05),offset:x(0,3),size:0})])),F([f(mk,F([Ik(iR),YS(Tk(40)),gx({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(mk,F([LN,f(xk,10,0)]),r)),f(eL,O(s,O(t,F([XS(Tk(100)),YS(Tk(40)),jR(iR),gx({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),uL({bottom:1,left:0,right:1,top:1})]))),{label:d_(n),onChange:u,placeholder:i,text:a})]))}),bx=function(e){return{$:"MaxDaiChanged",a:e}},Cx=function(e){return{$:"MinDaiChanged",a:e}},Ex=r(function(e,t){return f(pN,F([XS(Ck),aN(8)]),F([f(mk,F([Wk(17),YN]),Vf(e)),t]))}),Sx=RT(25),Tx=function(e){return{$:"MoveX",a:e}},wx=function(e){return f(B$,Sx,Tx(-e))},Ix={$:"OnLeft"},Ax=function(e){return f(LR,Ix,e)},Bx=n(function(e,t,r){var n=u_(F([LN])),a=f(yN,F([aN(8),LN,XS(Tk(60))]),F([n,f(mk,F([Wk(16),LN]),Vf("max"))])),i=f(yN,F([aN(8),LN,XS(Tk(60))]),F([n,f(mk,F([Wk(16),LN]),Vf("min"))]));return f(Ex,"Dai Range",f(pN,F([aN(5),XS(Tk(200))]),F([v(mx,F([Ax(f(S$,F([wx(5),XS(Tk(200))]),r.minDai))]),F([yx(fx(!1))]),i,"min Dai",e,fi,fi,Cx),v(mx,F([Ax(f(S$,F([wx(5),XS(Tk(200))]),r.maxDai))]),F([yx(fx(!1))]),a,"max Dai",t,fi,fi,bx)])))}),kx=r(function(e,t){return l(tS,n(function(t,r,n){return f(e,t,r)?l(ll,t,r,n):n}),Vh,t)}),Nx=function(e){return f(kx,r(function(t,r){return f(Rg,e,t)}),SR)},Rx=FN({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),$x=function(e){return f(qN,F([YS(Tk(26))]),f(pc,Rx,f(Bo,jo,f(Kh,e,SR))))},_x=X_,Lx=function(e){return{$:"AppendProperty",a:e}},xx=r(function(e,t){return Lx(e+":"+t)}),Px=r(function(e,t){return f(xx,e,t.value)}),Dx=Px("cursor"),Ux={$:"Compatible"},Ox={cursor:Ux,value:"default"},Mx=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Fx=function(e){return{$:"PseudoClassSelector",a:e}},Vx=function(e){return Mx(Fx(e))}("hover"),Kx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),Hx=Kx,jx=Hx,qx=jx("span"),Gx=r(function(e,t){return f(Nn,tt(e),nt(t))}),zx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),Yx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),Wx=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),Jx=r(function(e,t){return t<>>32-e}),Qx=function(e){var t=e.hash?e.seed^f(Wx,461845907,f(Jx,15,f(Wx,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(Wx,2246822507,r^r>>>16),a=f(Wx,3266489909,n^n>>>13);return(a^a>>>16)>>>0},Xx=r(function(e,t){return f(Wx,5,f(Jx,13,e^f(Wx,461845907,f(Jx,15,f(Wx,3432918353,t)))))+3864292196}),Zx=r(function(e,t){var r=t.hash|(255&mi(e))<";default:return""}},uD=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+"]"}},sD=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f($i,"",f(Na,t,f(Pa,uD,r)));case"UniversalSelectorSequence":var r=e.a;return iu(r)?"*":f($i,"",f(Pa,uD,r));default:var t=e.a,r=e.b;return f($i,"",f(Na,t,f(Pa,uD,r)))}},cD=function(e){var t=e.a,r=e.b;return f($i," ",F([oD(t),sD(r)]))},fD=function(e){var t=e.a,r=e.b,n=e.c,a=f(Na,sD(t),f(Pa,cD,r)),i=f($i,"",F([f(pc,"",f(Bo,iD,n))]));return f(Fs,f($i," ",f(Wf,f(Ua,Uu,fd),a)),i)},lD=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f($i,", ",f(Pa,fD,f(Na,r,n)));return f($i,"",F([i," {\n",e,aD(a),"\n",e,"}"]))}),dD=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(lD,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f($i,",\n",f(Pa,XP,r))+" {\n"+f($i,"\n\n",f(Pa,f(Ua,rD,lD(" ")),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"}},hD=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f($i,"\n\n",f(Wf,f(Ua,Uu,fd),F([WP(t),f($i,"\n",f(Pa,eD,r)),f($i,"\n",f(Pa,tD,n)),f($i,"\n\n",f(Pa,dD,a))])))},pD=function(e){return hD(YP(qP(e)))},gD=function(e){return f($i,"\n\n",f(Pa,pD,e))},vD=function(e){return{$:"Snippet",a:e}},yD=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),mD=function(e){return{$:"StyleBlockDeclaration",a:e}},bD=r(function(e,t){var r=l(mP,t,mr,fi);return vD(F([mD(l(yD,r,mr,e))]))}),CD=function(e){return iu(e)?"unstyled":f(is,D("_"),gs(f(eP,15739,gD(sS(tP(sS(f(bD,e,RP(mr)))))))))},ED=function(e){var t=CD(e),r=f(Gx,"className",jf(t));return l(zx,r,e,t)},SD=a(function(e,t,r,n){return f(e,f(Na,ED(t),r),n)}),TD=function(e){return{$:"Unstyled",a:e}},wD=function(e){return TD(ew(e))},ID=wD,AD=r(function(e,t){return f(wn,e,Ze(t))}),BD=function(e){return Sn(Ze(e))},kD=r(function(e,t){var r=e.b,n=e.c;return iu(r)?t:l(ll,n,r,t)}),ND=function(e){return e.a},RD=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 x(f(Na,x(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l($a,kD,i,s),p=l($a,$D,x(mr,h),c),g=p.a,v=p.b,o=l(BT,u,f(Pa,ND,s),_a(g));return x(f(Na,x(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l($a,kD,i,s),m=l($a,$D,x(mr,h),c),g=m.a,v=m.b,o=d(BD,y,u,f(Pa,ND,s),_a(g));return x(f(Na,x(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l($a,kD,i,s),b=l($a,RD,x(mr,h),c),g=b.a,v=b.b,o=l(AT,u,f(Pa,ND,s),_a(g));return x(f(Na,x(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l($a,kD,i,s),C=l($a,RD,x(mr,h),c),g=C.a,v=C.b,o=d(AD,y,u,f(Pa,ND,s),_a(g));return x(f(Na,x(r,o),a),v)}}),$D=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return x(f(Na,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l($a,kD,n,o),c=l($a,$D,x(mr,s),u),h=c.a,p=c.b,a=l(BT,i,f(Pa,ND,o),_a(h));return x(f(Na,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l($a,kD,n,o),v=l($a,$D,x(mr,s),u),h=v.a,p=v.b,a=d(BD,g,i,f(Pa,ND,o),_a(h));return x(f(Na,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l($a,kD,n,o),y=l($a,RD,x(mr,s),u),h=y.a,p=y.b,a=l(AT,i,f(Pa,ND,o),_a(h));return x(f(Na,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l($a,kD,n,o),m=l($a,RD,x(mr,s),u),h=m.a,p=m.b,a=d(AD,g,i,f(Pa,ND,o),_a(h));return x(f(Na,a,r),p)}}),_D=r(function(e,t){return h(ol,il,e,t,ul,ul)}),LD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(fd(a)){var o=e,u=i;e=o,t=u}else{var o=ci(x(a,n)),u=i;e=o,t=u}}}),xD=function(e){var t=f(LD,fi,e);if("Nothing"===t.$)return Vh;var r=t.a,n=r.a,a=r.b;return f(_D,n,a)},PD=function(e){return{$:"ClassSelector",a:e}},DD=function(e){var t=e.a,r=e.b;return f(bD,r,RP(F([PD(t)])))},UD=function(e){return gD(sS(tP(f(Pa,DD,Aa(e)))))},OD=function(e){return l(BT,"style",mr,sS(ew(UD(e))))},MD=n(function(e,t,r){var n=f(Pa,ND,t),a=xD(t),i=l($a,$D,x(mr,a),r),o=i.a,u=i.b,s=OD(u);return l(BT,e,n,f(Na,s,_a(o)))}),FD=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}}),VD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(FD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),KD=r(function(e,t){return x(f(VD,"_",t),OD(e))}),HD=n(function(e,t,r){var n=f(Pa,ND,t),a=xD(t),i=l($a,RD,x(mr,a),r),o=i.a,u=i.b,s=f(KD,u,o);return l(AT,e,n,f(Na,s,_a(o)))}),jD=a(function(e,t,r,n){var a=f(Pa,ND,r),i=xD(r),o=l($a,RD,x(mr,i),n),u=o.a,s=o.b,c=f(KD,s,u);return d(AD,e,t,a,f(Na,c,_a(u)))}),qD=a(function(e,t,r,n){var a=f(Pa,ND,r),i=xD(r),o=l($a,$D,x(mr,i),n),u=o.a,s=o.b,c=OD(s);return d(BD,e,t,a,f(Na,c,_a(u)))}),GD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(MD,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(qD,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(HD,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(jD,a,t,r,n)}},zD=GD,YD=function(e){return _x(zD(d(SD,qx,F([Vx(F([Dx(Ox)]))]),mr,F([ID(e)]))))},WD=Q,JD=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),QD=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),XD=function(e){return l(xa,r(function(e,t){var r=t.a,n=t.b;return x(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 ci(h(JD,n,a,i,o,u))}return fi}(),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 ci(l(QD,a,t,i))}return fi}())}),x(fi,fi),e)},ZD=r(function(e,t){var r=XD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(VI,vN,yk,f(Na,KI(uT.contentLeft+" "+uT.contentCenterY+" "+uT.wrapped),f(Na,XS(JS),f(Na,YS(JS),e))),tT(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 L(r,u/2|0)>-1&&L(a,s/2|0)>-1?ci(SN({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):fi}return fi}();if("Just"===c.$){var h=c.a;return d(VI,vN,yk,f(Na,KI(uT.contentLeft+" "+uT.contentCenterY+" "+uT.wrapped),f(Na,XS(JS),f(Na,YS(JS),O(e,F([h]))))),tT(t))}var p=-s/2,g=-u/2;return d(VI,nT,yk,e,tT(F([d(VI,vN,yk,f(Na,KI(uT.contentLeft+" "+uT.contentCenterY+" "+uT.wrapped),f(Na,ZS(f(d$,"margin",WT(p)+"px "+WT(g)+"px")),f(Na,ZS(f(d$,"width","calc(100% + "+Ri(u)+"px)")),f(Na,ZS(f(d$,"height","calc(100% + "+Ri(s)+"px)")),f(Na,f(YI,tN,l(rN,o,u,s)),mr))))),tT(t))])))}),eU=i(function(e,t,r,n,a){var i=f(eL,F([XS(Tk(80)),YS(Tk(40)),Wk(24),YN,jR(iR),px(r)]),{label:d_("currency type"),onChange:f(Ao,WD,n),placeholder:fi,text:t}),o=f(Kh,t,SR),u=function(){var r=x(e,o);if(r.a){if("Just"===r.b.$)return Ek;r.b;return f(ZD,F([XS(Tk(350)),jR(gR),GR(1),Ik($k),UN(10),eN]),f(Pa,function(e){var t=e.a,r=e.b,a=r.b;return f(yN,F([XS(Tk(80)),aN(9),f(xk,0,5),px(n(t)),j$(F([Ik(l(qI,.8,.8,1))]))]),F([f(qN,F([YS(Tk(26))]),a),f(mk,F([Wk(16),Gk]),YD(t))]))},Aa(Nx(t))))}return Ek}();return f(yN,F([aN(4),nL(u)]),F([f(mk,F([jk(a)]),$x(t)),i]))}),tU=function(e){var t=f(Kh,e,SR);if("Nothing"===t.$)return Vf("*");var r=t.a,n=r.b;return f(qN,F([YS(Tk(26))]),n)},rU=function(e){return{$:"AppCmd",a:e}},nU=function(e){return{$:"FiatTypeInputChanged",a:e}},aU=n(function(e,t,r){var n=rU(d($d,"click","misclick","currency flag",0)),a=tU(t);f(yN,F([aN(8),LN,XS(Tk(60))]),F([a,f(mk,F([Wk(16),LN]),Vf("max"))])),f(yN,F([aN(8),LN,XS(Tk(60))]),F([a,f(mk,F([Wk(16),LN]),Vf("min"))]));return f(mk,F([v$,XS(Tk(120))]),f(Ex,"Fiat Type",h(eU,e,t,fx(!0),nU,n)))}),iU={$:"AddSearchTerm"},oU=function(e){return{$:"PaymentMethodInputChanged",a:e}},uU=f(vh,"keyCode",kC),sU=function(e){return f(Kk,"keyup",f(Go,function(t){return 13===t?Vi(e):zo(Ri(t))},uU))},cU=function(e){return f(Ex,"Search Payment Methods",f(eL,F([v$,XS(Tk(250)),YS(Tk(40)),jR(iR),bL({blur:20,color:d(R$,233,237,242,.05),offset:x(0,3),size:0}),h$(sU(iU))]),{label:d_("payment methods search"),onChange:oU,placeholder:fi,text:e}))},fU=function(e){return{$:"RemoveTerm",a:e}},lU=function(e){return f(mk,F([UN(3),v$,Uk,jk(fU(e)),Wk(10),JI(Qk)]),Vf("x"))},dU=function(e){if(e.b){var t=e;return f(yN,F([XS(Ck),UN(10),aN(10)]),f(Pa,function(e){return f(yN,F([Ik(d(R$,16,7,234,.2)),Mk(5),UN(4),aN(3)]),F([Vf(e),lU(e)]))},t))}return Ek},hU=n(function(e,t,r){return f(pN,F([aN(10),XS(JS),eN]),F([f(yN,F([XS(JS),aN(10)]),F([f(mk,F([XS(JS),v$]),l(Bx,e.minDai,e.maxDai,t)),f(mk,F([XS(JS),v$]),l(aU,r,e.fiatType,t)),f(pN,F([XS(JS),v$,aN(5)]),F([cU(e.paymentMethod),dU(e.paymentMethodTerms)]))]))]))}),pU=n(function(e,t,r){return f(pN,F([Mk(5),Ik($k),XS(Ck),YS(Ck),jk(fx(!1))]),F([f(yN,F([XS(Ck),aN(10),UN(30)]),F([l(hU,r.inputs,r.errors,r.showCurrencyDropdown)])),l(hx,e,t,r)]))}),gU=function(e){return{$:"MessageInputChanged",a:e}},vU={$:"MessageSubmit"},yU=M_("disabled"),mU=function(e){return f(Rn,"tabIndex",Ri(e))},bU=function(e){return{$:"MayPreventDefault",a:e}},CU=r(function(e,t){return f(Vk,e,bU(t))}),EU=r(function(e,t){var r=function(r){return $(r,e)?Vi(t):zo("Not the enter key")},n=f(Go,r,f(vh,"key",Yo));return ZS(f(CU,"keyup",f(Mi,function(e){return x(e,!0)},n)))}),SU=function(e){return f(EU,"Enter",e)},TU={$:"Button"},wU=r(function(e,t){var r=t.onPress,n=t.label;return d(VI,nT,yk,f(Na,XS(JS),f(Na,YS(JS),f(Na,KI(uT.contentCenterX+" "+uT.contentCenterY+" "+uT.seButton+" "+uT.noTextSelection),f(Na,Uk,f(Na,L_(e),f(Na,iN(TU),f(Na,ZS(mU(0)),function(){if("Nothing"===r.$)return f(Na,ZS(yU(!0)),e);var t=r.a;return f(Na,jk(t),f(Na,SU(t),e))}()))))))),tT(F([n])))}),IU=function(e){return f(pN,F([XS(Ck),aN(10)]),F([f(_L,F([XS(Ck),YS(Tk(100))]),{label:d_("messageInput"),onChange:gU,placeholder:fi,spellcheck:!1,text:e.messageInput}),f(wU,F([eN,Wk(24)]),{label:Vf("Submit"),onPress:ci(vU)})]))},AU=f(Dk,xN,uT.scrollbarsY),BU=r(function(e,t){return f(mk,F([YS(Ck),XS(Ck)]),f(mk,O(F([h$(f(d$,"position","absolute")),h$(f(d$,"top","0")),h$(f(d$,"right","0")),h$(f(d$,"bottom","0")),h$(f(d$,"left","0")),AU]),e),t))}),kU=l(pk,200,205,210),NU=n(function(e,t,r){var n=F([lN,Ik(c$),JI($k),gx({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=F([f_,Ik(kU),JI(gR),gx({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(mk,O(F([UN(7)]),u),f(uN,mr,F([Vf(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 ci(P(l(qI,0,0,1),$k,"Initiator opened the trade"));case"Recalled":return ci(P(l(qI,0,0,1),$k,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Do,8,Hf(t))+"..";return ci(P(l(qI,1,0,1),$k,r+" committed to the trade"));case"Aborted":return ci(P(l(qI,1,0,0),$k,"Buyer aborted the trade"));case"Claimed":return ci(P(l(qI,0,1,0),$k,"Buyer marked the fiat transfer complete"));case"Released":return ci(P(l(qI,0,0,1),$k,"Seller released the "+sR(e)+" and closed the contract"));default:return ci(P(l(qI,0,0,1),$k,"Seller burned the "+sR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Ek;var d=c.a,h=d.a,p=d.b,g=d.c;return f(mk,F([Mk(3),GR(1),jR(l(qI,1,0,1)),eN,Ik(h)]),f(uN,F([JI(p)]),F([Vf(g)])))}),RU=n(function(e,t,r){if(r.b){var n=r;return f(BU,F([XS(Ck),YS(Ck),Mk(5),GR(1),jR(gR),UN(10)]),f(pN,F([XS(Ck),YS(Ck),aN(10)]),f(Pa,f(NU,e,t),n)))}return f(mk,F([XS(Ck),YS(Ck),Mk(5),GR(1),jR(gR),eN,JI(l(qI,.5,.5,.5)),sx]),Vf("no messages found."))}),$U=Er,_U=function(e){return f(pN,F([XS(Ck),YS(Ck),aN(10),GR(1),Mk(5),UN(20)]),F([l(RU,e.trade.factory,e.userRole,f($U,function(e){return e.blocknum},Ta(e.history))),IU(e)]))},LU=function(e){return f(mk,F([Ik($k),Mk(8),CL,XS(Ck),YS(Ck)]),_U(e))},xU={$:"ToggleChat"},PU=function(e){if(e.showChatHistory){var t=f(pc,Ek,f(Bo,LU,e.chatHistoryModel));return f(mk,F([YS(Ck),XS(Tk(500)),UN(20),lN]),l(E$,F([YS(Ck),XS(Ck)]),f(Wi,ZC,t),xU))}return Ek},DU=function(e){return"Buyer"===e.initiatorRole.$?yl:cb},UU=function(e){return AR(e)+" "+e.fiatType},OU={$:"AbortAction"},MU=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),FU=function(e){var t=x(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return Ek}if("LoadedTrade"!==t.b.$)return Ek;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=UU(n.terms.price),u=MR(lb(i)),s=MR(n.parameters.tradeAmount)+" "+sR(n.factory),c=function(){return"Buyer"===DU(n.parameters).$?x(f(mk,F([YN,JI(gR)]),Vf("buyer")),F([Vf("pay the seller "),f(mk,F([JI(c$)]),Vf(o)),Vf(" in exchange for the "),f(mk,F([JI(c$)]),Vf(s)),Vf(" held in this contract.")])):x(f(mk,F([YN,JI(gR)]),Vf("seller")),F([Vf("accept "),f(mk,F([JI(c$)]),Vf(o)),Vf(" from the buyer in exchange for the "),f(mk,F([JI(c$)]),Vf(s)),Vf(" held in this contract.")]))}(),d=c.a,h=c.b;return l(E$,mr,f(pN,F([aN(20),UN(20),eN,YS(Ck),Y$]),F([f(mk,F([Wk(26),Gk,eN,LN]),Vf("Just to Confirm...")),f(pN,F([aN(20),eN,LN]),f(Pa,uN(F([eN,Wk(18),YN,JI($$)])),O(F([O(F([Vf("You will deposit "),f(mk,F([JI(c$)]),Vf(u+" "+sR(n.factory))),Vf(", thereby becoming the "),d,Vf(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?F([F([Vf("(This ususally requires two Metamask signatures. Your "+sR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):mr}()))),f(mk,F([X$,eN]),f(G$,"Yes, I definitely want to commit to this trade.",l(MU,n,a,i)))])),OU);case"ApproveNeedsSig":return W$(F([Vf("Waiting for user signature for the approve call."),Vf("(check Metamask!)"),Vf("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return W$(F([Vf("Mining the initial approve transaction..."),f(HI,F([Z$,JI(c$)]),{label:Vf("See the transaction on Etherscan"),url:f(J$,n.factory,p)}),Vf("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return W$(F([Vf("Waiting for user signature for the final commit call."),Vf("(check Metamask!)"),Vf("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return W$(F([Vf("Mining the final commit transaction..."),f(HI,F([Z$,JI(c$)]),{label:Vf("See the transaction"),url:f(J$,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(E$,mr,f(pN,F([aN(20),UN(20),eN,YS(Ck),Y$]),F([f(mk,F([Wk(26),Gk,eN,LN]),Vf("Just to Confirm...")),f(pN,F([aN(20),eN,LN]),f(Pa,uN(F([eN,Wk(18),YN,JI($$)])),function(){switch(g.$){case"Poke":case"Recall":return mr;case"Claim":return F([F([Vf('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 '+sR(n.factory)+" rather than release it to you.")])]);case"Abort":return F([F([Vf("Aborting will incur a small penalty on both parties, and refund the rest of the "+sR(n.factory)+".")])]);case"Release":return F([F([Vf("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([Vf("This will destroy the "+sR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(mk,F([X$,eN]),function(e){return f(G$,e,mE(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 "+sR(n.factory)+".";default:return"I understand. Burn the "+sR(n.factory)+"."}}()))])),OU);case"ActionNeedsSig":var g=r.a;return W$(F([Vf("Waiting for user signature for the "+CE(g)+" call."),Vf("(check Metamask!)")]));default:var g=r.a,p=r.b;return Ek}},VU=yN(F([XS(Ck),Ik($k),Mk(5),UN(20),EL,CL])),KU=function(e){return f(yN,F([aN(8)]),F([f(qN,mr,o_),f(mk,F([Wk(24),YN]),Vf(MR(e)))]))},HU=r(function(e,t){var r=f(yg,Hm(e),f(Bo,function(e){return e.address},wd(t)));return f(cL,function(){var t=x(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"}(),KU(e.parameters.tradeAmount))}),jU=function(e){return f(yN,F([aN(5)]),F([$x(e.fiatType),f(mk,F([Wk(24),YN]),Vf(UU(e)))]))},qU=function(e){return f(cL,"For Fiat",jU(e.terms.price))},GU=function(e){return"Buyer"===e.$?"Buyer":"Seller"},zU=l(pk,250,165,22),YU=l(pk,255,0,0),WU=l(pk,0,255,0),JU=FN({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),QU=FN({description:"burned",src:"/DAIHard/static/img/burned.svg"}),XU=FN({description:"released",src:"/DAIHard/static/img/released.svg"}),ZU={$:"ToggleStatsModal"},eO=function(e){return f($U,Oa,e)},tO=n(function(e,t,n){var a=_v(f(Pa,function(e){return f(Wf,function(e){return $(f(WC,e,n),ci(t))},f(vS,function(e){if("LoadedTrade"===e.$){var t=e.a;return ci(t)}return fi},Ta(e.trades)))},e)),i=wi(a),o=l($a,r(function(e,t){switch(e.state.closedReason.$){case"Released":return U(t,{amountReleased:f(Kd,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return U(t,{amountBurned:f(Kd,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return U(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Bl,amountReleased:Bl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,bl,Nl(eO(f(vS,function(e){return function(e){return e?ci(e):fi}(Sd(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}}),rO=r(function(e,t){return d(q$,P(d(bN,0,0,1,1),d(bN,0,0,1,.8),d(bN,0,0,1,.6)),$k,e,t)}),nO=function(e){return{$:"ViewUserHistory",a:e}},aO=f(BB,0,mr),iO=f(Dk,qk,uT.textNormalWeight),oO=r(function(e,t){return ei(e/t)}),uO=n(function(e,t,r){for(;;){if(!r.b)return t+e;var n=r.a,a=r.b;if(L(n.start,t)<0)return t+n.offset;var i=e,o=t,u=a;e=i,t=o,r=u}}),sO=r(function(e,t){var r=e.a,n=e.b;return l(uO,r,f(oO,Sd(t),6e4),n)}),cO=r(function(e,t){return f(ds,24,f(oO,f(sO,e,t),60))}),fO=r(function(e,t){return f(ds,1e3,Sd(t))}),lO=r(function(e,t){return f(ds,60,f(sO,e,t))}),dO={$:"Apr"},hO={$:"Aug"},pO={$:"Dec"},gO={$:"Feb"},vO={$:"Jan"},yO={$:"Jul"},mO={$:"Jun"},bO={$:"Mar"},CO={$:"May"},EO={$:"Nov"},SO={$:"Oct"},TO={$:"Sep"},wO=function(e){var t=f(oO,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)}},IO=r(function(e,t){switch(wO(f(sO,e,t)).month){case 1:return vO;case 2:return gO;case 3:return bO;case 4:return dO;case 5:return CO;case 6:return mO;case 7:return yO;case 8:return hO;case 9:return TO;case 10:return SO;case 11:return EO;default:return pO}}),AO=r(function(e,t){return f(ds,60,f(oO,Sd(t),1e3))}),BO={$:"Fri"},kO={$:"Mon"},NO={$:"Sat"},RO={$:"Sun"},$O={$:"Thu"},_O={$:"Tue"},LO={$:"Wed"},xO=r(function(e,t){switch(f(ds,7,f(oO,f(sO,e,t),1440))){case 0:return $O;case 1:return BO;case 2:return NO;case 3:return RO;case 4:return kO;case 5:return _O;default:return LO}}),PO=n(function(e,t,r){return e.toAmPm(f(cO,t,r))}),DO=r(function(e,t){return wO(f(sO,e,t)).day}),UO=DO,OO=F([RO,kO,_O,LO,$O,BO,NO]),MO=r(function(e,t){return function(e){return e.a}(f(pc,x(0,RO),Nl(f(Wf,function(r){return $(r.b,f(xO,e,t))},f(ki,r(function(e,t){return x(e,t)}),OO)))))}),FO=function(e){return l($a,Ra,0,e)},VO=r(function(e,t){return wO(f(sO,e,t)).year}),KO=function(e){return!f(ds,4,e)&&(!!f(ds,100,e)||!f(ds,400,e))},HO=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return KO(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}}),jO=F([vO,gO,bO,dO,CO,mO,yO,hO,TO,SO,EO,pO]),qO=r(function(e,t){return f(pc,x(0,vO),Nl(f(Wf,function(r){r.a;return $(r.b,f(IO,e,t))},f(ki,r(function(e,t){return x(e,t)}),jO))))}),GO=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(qO,e,t))}),zO=r(function(e,t){var r=f(qs,f(GO,e,t)-1,jO);return FO(f(Pa,HO(f(VO,e,t)),r))+f(UO,e,t)}),YO=r(function(e,t){return f(GO,e,t)/4|0}),WO=r(function(e,t){var r=Ri(t),n=e-$o(r);return O(f($i,"",f(Pa,function(e){return"0"},f(Bi,1,n))),r)}),JO=function(e){return e?e<=12?e:e-12:12},QO=Vg(315576e5),XO=r(function(e,t){return bl(QO*f(VO,e,t))}),ZO=r(function(e,t){var r=f(XO,e,t),n=f(MO,e,r);return 1+((f(zO,e,t)+n)/7|0)}),eM=r(function(e,t){return Ri(f(VO,e,t))}),tM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ri(f(GO,t,r));case"MonthSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(GO,t,r));case"MonthFixed":return f(WO,2,f(GO,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(IO,t,r));case"MonthNameFull":return e.toMonthName(f(IO,t,r));case"QuarterNumber":return Ri(1+f(YO,t,r));case"QuarterSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(1+f(YO,t,r));case"DayOfMonthNumber":return Ri(f(UO,t,r));case"DayOfMonthSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(UO,t,r));case"DayOfMonthFixed":return f(WO,2,f(UO,t,r));case"DayOfYearNumber":return Ri(f(zO,t,r));case"DayOfYearSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(zO,t,r));case"DayOfYearFixed":return f(WO,3,f(zO,t,r));case"DayOfWeekNumber":return Ri(f(MO,t,r));case"DayOfWeekSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(MO,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(xO,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(xO,t,r));case"WeekOfYearNumber":return Ri(f(ZO,t,r));case"WeekOfYearSuffix":return function(t){return O(Ri(t),e.toOrdinalSuffix(t))}(f(ZO,t,r));case"WeekOfYearFixed":return f(WO,2,f(ZO,t,r));case"YearNumberLastTwo":return f(Fo,2,f(eM,t,r));case"YearNumber":return f(eM,t,r);case"AmPmUppercase":return WD(l(PO,e,t,r));case"AmPmLowercase":return Fl(l(PO,e,t,r));case"HourMilitaryNumber":return Ri(f(cO,t,r));case"HourMilitaryFixed":return f(WO,2,f(cO,t,r));case"HourNumber":return Ri(JO(f(cO,t,r)));case"HourFixed":return f(WO,2,JO(f(cO,t,r)));case"HourMilitaryFromOneNumber":return Ri(1+f(cO,t,r));case"HourMilitaryFromOneFixed":return f(WO,2,1+f(cO,t,r));case"MinuteNumber":return Ri(f(lO,t,r));case"MinuteFixed":return f(WO,2,f(lO,t,r));case"SecondNumber":return Ri(f(AO,t,r));case"SecondFixed":return f(WO,2,f(AO,t,r));case"MillisecondNumber":return Ri(f(fO,t,r));case"MillisecondFixed":return f(WO,3,f(fO,t,r));default:return n.a}}),rM=a(function(e,t,r,n){return f($i,"",f(Pa,l(tM,e,r,n),t))}),nM=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),aM=function(e){return e>11?"pm":"am"},iM=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"}},oM=function(e){switch(f(ds,100,e)){case 11:case 12:case 13:return"th";default:switch(f(ds,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},uM=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"}},sM=p(nM,iM,f(Ao,iM,Do(3)),uM,f(Ao,uM,Do(3)),aM,oM),cM=rM(sM),fM={$:"MonthNameFull"},lM=fM,dM=function(e){return{$:"Text",a:e}},hM=dM,pM={$:"YearNumber"},gM=pM,vM=n(function(e,t,n){var a=r(function(e,t){return f(pN,F([Wk(18),aN(6)]),F([f(mk,F([sN]),Vf(e)),f(mk,F([iO]),Vf(t))]))}),i=cM(F([lM,hM(", "),gM])),o=f(pN,F([aN(23),XS(Ck)]),O(f(Pa,function(e){var t=e.a,r=e.b;return f(a,t,r)},F([x("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,aO,t)}return"No Committed Trades yet!"}()),x("Release Outcomes",Ri(n.numReleases)+" trades / "+MR(n.amountReleased)+" "+sR(e)+" Released"),x("Abort Outcomes",Ri(n.numAborts)+" trades"),x("Burn Outcomes",Ri(n.numBurns)+" trades / "+MR(n.amountBurned)+" "+sR(e)+" Burned")])),F([f(mk,F([eN]),f(rO,"View User History",nO(n.asRole)))])));return f(pN,F([Mk(8),FL,VL,Ik(iR),aN(1),bL({blur:20,color:d(bN,0,0,0,.08),offset:x(0,0),size:0})]),F([f(mk,F([XS(Ck),Ik($k),UN(17)]),f(CN,18,t)),f(mk,F([XS(Ck),Ik($k),UN(17)]),o)]))}),yM=n(function(e,t,r){var n=l(tO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=GU(e.parameters.initiatorRole)+" Stats";return f(mk,r?F([nL(f(mk,F([aL(30),lN]),l(vM,e.factory,e.parameters.initiatorAddress,n)))]):mr,f(cL,a,f(yN,F([XS(Ck),aN(20),Uk,jk(ZU)]),f(Pa,yN(F([aN(5)])),F([F([f(qN,F([YS(Tk(28))]),XU),f(mk,F([Wk(24),YN,JI(WU)]),Vf(l(fs,2,D("0"),Ri(n.numReleases))))]),F([f(qN,F([YS(Tk(28))]),JU),f(mk,F([Wk(24),YN,JI(zU)]),Vf(l(fs,2,D("0"),Ri(n.numAborts))))]),F([f(qN,F([YS(Tk(28))]),QU),f(mk,F([Wk(24),YN,JI(YU)]),Vf(l(fs,2,D("0"),Ri(n.numBurns))))])])))))}),mM=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+Hf(t)}e.a;return"https://kovan.etherscan.io/address/"+Hf(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+Hf(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+Hf(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+Hf(t)}}),bM=n(function(e,t,r){return f(HI,e,{label:Vf(Hf(r)),url:f(mM,t,r)})}),CM=function(e){return f(cL,"Trade Status",f(pN,F([Wk(24),YN,aN(8)]),F([Vf(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(bM,F([Wk(12),JI(c$),Z$]),e.factory,e.creationInfo.address)])))},EM=i(function(e,t,r,n,a){return VU(F([CM(t),f(HU,t,r),qU(t),l(yM,t,n,a)]))}),SM=l(pk,9,32,107),TM=FN({description:"chat",src:"/DAIHard/static/img/chat.svg"}),wM=f(mk,F([Mk(4),Uk,jk(xU),UN(5),Ik(l(pk,22,0,255))]),f(qN,F([XS(Tk(42))]),TM)),IM=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},AM=function(e){return f(pN,F([Mk(12),Ik(iR),UN(15),aN(15)]),F([f(mk,F([Wk(24),Gk,sx]),Vf("Fiat Payment Method")),f(uN,F([Wk(18),YS(JS),Ik($k),bL({blur:5,color:d(bN,0,0,0,.2),offset:x(-3,3),size:0}),Mk(3),UN(5)]),F([f(pc,f(mk,F([JI(pL),sx]),Vf("No payment methods found.")),f(Bo,Vf,f(Bo,function(e){return e.info},Nl(e))))]))]))},BM={$:"Active"},kM=function(e){return{$:"ExpandPhase",a:e}},NM=F([Ik(SM),JI($k)]),RM=r(function(e,t){return{$:"Min",a:e,b:t}}),$M=r(function(e,t){return f(RM,e,t)}),_M=function(e){return F(e?[Mk(12),v$,YS(f($M,380,JS))]:[Mk(12),eN])},LM=F([Ik($k)]),xM=FN({description:"flame",src:"/DAIHard/static/img/flame.png"}),PM=r(function(e,t){return El(f(Gu,Sl(e),Sl(t)))}),DM=r(function(e,t){return d(q$,P(d(bN,1,.6,.2,1),d(bN,1,.6,.2,.8),d(bN,1,.6,.2,.6)),$k,e,t)}),UM=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),OM=function(e){return{$:"ContractActionClicked",a:e}},MM={$:"Web3Connect"},FM=n(function(e,t,r){var n=wd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(hR,e,t).$?Ek:f(yN,F([aN(8)]),function(){var e=P(t.state.phase,f(Hm,t,a.address),f(WC,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return F([f(Wi,mE,f(rO,"Remove and Refund this Trade",vE))])}break e}var r=(e.a,e.b,Sl(jm(t.parameters)));return F([f(G$,"Deposit and Commit to Trade",l(UM,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return F([f(Wi,OM,f(DM,"Abort Trade",tE)),f(Wi,OM,f(G$,"Confirm Payment",sE)),wM])}e.a,e.c.a;return F([wM])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return F([f(Wi,OM,f(G$,"Burn it All!",uE)),f(Wi,OM,f(rO,"Release Everything",yE)),wM])}e.a,e.c.a;return F([wM])}break e;default:break e}return mr}())}return f(G$,"Connect to Wallet",MM)}),VM={$:"Finished"},KM={$:"NotStarted"},HM=r(function(e,t){var r=x(eR(t),eR(e.state.phase)),n=r.a,a=r.b;return L(n,a)>0?KM:$(n,a)?BM:VM}),jM=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(Na,r,e),a=t-1,i=r;e=n,t=a,r=i}}),qM=r(function(e,t){return l(jM,mr,e,t)}),GM=a(function(e,t,r,n){var a=MR(f(Kd,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+sR(r.factory),i=MR(r.parameters.tradeAmount)+" "+sR(r.factory),o=f(yN,mr,f(qM,3,f(qN,F([YS(Tk(18))]),xM))),u=f(Ua,mk(F([JI(l(qI,1,0,0))])),Vf),s=$(e,r.state.phase),c=f(yg,WC(r),f(Bo,function(e){return e.address},wd(n))),d=s?$k:gR,h=uN(F([JI(d),Wk(18),Gk])),p=UU(r.terms.price),g=s?l(pk,0,226,255):l(pk,16,7,234),v=f(Ua,mk(F([JI(g)])),Vf),y=MR(r.parameters.buyerDeposit)+" "+sR(r.factory),m=r.parameters.abortPunishment,b=MR(m)+" "+sR(r.factory),C=MR(f(PM,r.parameters.buyerDeposit,m))+" "+sR(r.factory),E=MR(f(PM,r.parameters.tradeAmount,m))+" "+sR(r.factory),S=function(){var t=x(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return x("And Now, We Wait",function(){return"Buyer"===n.$?f(Pa,h,F([F([Vf("Your "),u("burnable deposit"),Vf(" of "),v(y),Vf(" is now held in this contract, and your offer to buy "),v(i),Vf(" for "),v(p),Vf(" is now listed in the marketplace.")]),F([Vf("If another user likes your offer, they can become the Seller by depositing the full "),v(i),Vf(" into this contract.")]),F([Vf("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),Vf(" to you.")])])):f(Pa,h,F([F([Vf("Your offer to sell the "),v(i),Vf(" held in this contract for "),v(p),Vf(" is now listed in the marketplace.")]),F([Vf("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),Vf(" of 1/3 of the trade amount "),v("("+y+")"),Vf(" into this contract.")]),F([Vf("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),Vf(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return x("Time to Pay Up",f(Pa,h,F([F([Vf("You must now pay the Seller "),v(p),Vf(" via the Fiat Payment Method, "),f(mk,F([Gk]),Vf("and then click ")),u("Confirm Payment"),Vf(" before the payment window runs out. Use the chat to coordinate.")]),F([Vf("If you abort the trade, or do not confirm payment before this time is up, "),v(b),Vf(" (1/4 of the "),u("burnable deposit"),Vf(") will be "),u("burned"),Vf(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Vf(" to the Seller, "),v(C),Vf(" to you).")]),F([Vf("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),Vf(" has been unmistakably transferred.")])])))}t.a,t.b.a;return x("Time to Get Paid",f(Pa,h,F([F([Vf("Work and communicate with the Buyer to receive "),v(p),Vf(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),F([Vf("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),Vf(" (1/4 of the "),u("burnable deposit"),Vf(") will be "),u("burned"),Vf(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Vf(" to you, "),v(C),Vf(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return x("Judgement",f(Pa,h,F([F([Vf("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),Vf(" will be released to you.")]),F([Vf("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),Vf(" In this case the "),v(a),Vf(" will be lost to both parties.")]),F([Vf("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return x("Judgement",f(Pa,h,F([F([Vf("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),F([Vf("So, have you recieved the "),v(p),Vf("? If so, you can click "),v("Release Everything"),Vf(".")]),F([Vf("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),Vf(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),F([Vf("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return x("Contract closed.",F([h(F([Vf("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return x("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(Pa,h,F([F([Vf("The Seller has deposited "),v(i),Vf(" into this contract, and offers to sell it for "),v(p),Vf(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),Vf(" into this contract by clicking "),u("Deposit and Commit to Trade"),Vf(".")]),F([Vf("If the trade is successful, the combined "+sR(r.factory)+" balance "),v("("+a+")"),Vf(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,Vf(" for both parties (see Payment Window for more on this).")]),F([Vf("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),Vf(" within the payment window.")])])):f(Pa,h,F([F([Vf("The Buyer is offering to buy "),v(i),Vf(" for "),v(p),Vf(", and has deposited "),v(y),Vf(" into this contract as a "),u("burnable deposit"),Vf(". To become the Seller, deposit "),v(i),Vf(" into this contract by clicking "),u("Deposit and Commit to Trade"),Vf(".")]),F([Vf("When you receive the "),v(p),Vf(" from the Buyer, the combined "+sR(r.factory)+" balance "),v("("+a+")"),Vf(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,Vf(" for both parties (see Payment Window for more on this).")]),F([Vf("Don't commit unless you can receive "),v(p),Vf(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return x("Making the Payment",f(Pa,h,F([F([Vf("During this phase, the Buyer is expected to transfer "),v(p),Vf(" to the Seller, as described in Fiat Payment Method, "),f(mk,F([Gk]),Vf("and ")),u("Confirm the Payment "),Vf(" before the payment window runs out. This would move the trade to the final phase.")]),F([Vf("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),Vf(" (1/4 of the "),u("burnable deposit"),Vf(" amount) will be "),u("burned"),Vf(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Vf(" to the Seller, "),v(C),Vf(" to the Buyer).")])])));case"Judgment":t.a,t.b;return x("Judgement",f(Pa,h,F([F([Vf("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),F([Vf("If the Seller can verify he has received the "),v(p),Vf(", he will probably release the total balance of "),v(i),Vf(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),Vf(".")]),F([Vf("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),Vf(" will be automaticall released.")])])));default:t.a,t.b;return x("Contract closed.",mr)}}(),T=S.a,w=S.b;return f(pN,F([XS(Ck),YS(Ck),UN(20),aN(30)]),F([f(yN,F([XS(Ck)]),F([f(mk,F([Wk(24),Gk,JI(g),f_]),Vf(T))])),f(pN,F([XS(Ck),LN,aN(13)]),w),f(mk,F([lN]),function(){switch(f(HM,r,e).$){case"Active":return l(FM,t,r,n);case"NotStarted":return f(mk,F([Wk(20),Gk,sx,JI(ZN)]),Vf("Phase not yet started."));default:return f(mk,F([Wk(20),Gk,sx]),Vf("Phase no longer active."))}}())]))}),zM=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},YM=FN({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),WM=FN({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),JM={$:"None"},QM=JM,XM=FN({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),ZM=function(e){switch(e.$){case"Open":return XM;case"Committed":return YM;case"Judgment":return WM;default:return QM}},eF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),tF=a(function(e,t,r,n){return d(eF,e,t,r,n)}),rF=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(tF,e.red,e.green,e.blue,e.alpha)}(rF(e))},aF=function(e){return{$:"Circle",a:e}},iF=aF,oF=d(eF,0,0,0,1),uF={$:"Flat"},sF={$:"Sharp"},cF=function(e){return{$:"Uniform",a:e}},fF=cF,lF={cap:uF,dashPattern:mr,dashPhase:0,fill:fF(oF),join:sF,thickness:2},dF=n(function(e,t,r){return U(lF,{dashPattern:e,fill:r,thickness:t})}),hF=dF(mr),pF={$:"Transparent"},gF=pF,vF=f(hF,0,gF),yF=r(function(e,t){return{$:"Shape",a:e,b:t}}),mF=function(e){return{basic:e,handlers:mr,name:fi,opacity:1,rotation:0,scale:x(1,1),shift:x(0,0)}},bF=function(e){return f(Ua,mF,yF(e))},CF=function(e){return bF(x(e,vF))},EF=function(e){return x(-e.a,-e.b)},SF=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return U(t,{shift:x(a.a+r,a.b+n)})}),TF=r(function(e,t){return f(SF,EF(e(t)),t)}),wF=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return x(f(Na,r,a),f(Na,n,i))});return l(xa,t,x(mr,mr),e)},IF=r(function(e,t){return{$:"Path",a:e,b:t}}),AF=Nr,BF=Rr,kF=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=BF(n),i=AF(n);return x(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 x(o*t,u*r)},c=t,l=c.a,d=c.b;return f(Ua,f(Ua,function(e){var t=e.a,r=e.b;return x(t+l,r+d)},s),a)},NF=function(e){return Pa(function(t){var r=t.a,n=t.b,a=e/2;return x(r<0?r-a:r+a,n<0?n-a:n+a)})},RF=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(NF,e,F([x(-i,-a),x(i,-a),x(i,a),x(-i,a)]))}),$F=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return F([x(-a,-r),x(n,-r),x(n,t),x(-a,t)])},_F=function(e){var t=LF(e.basic),r=wF(f(Pa,kF(e),t)),n=r.a,a=r.b;return{toBottom:-f(pc,0,Gw(a)),toLeft:-f(pc,0,Gw(n)),toRight:f(pc,0,qw(n)),toTop:f(pc,0,qw(a))}},LF=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(RF,r,x(a,a));case"Ellipse":var i=e.a,r=i.b.thickness,o=e.b,u=o.a,s=o.b;return f(RF,r,x(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(RF,r,x(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(NF,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(IF,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(NF,$(C,uF)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(RF,0,E);case"Group":var S=e.a;return f(NF,0,_v(f(Pa,f(Ao,_F,$F),S)));default:var T=e.b;return f(NF,0,$F(_F(T)))}},xF=function(e){var t=_F(e);return t.toTop+t.toBottom},PF=function(e){var t=_F(e);return x(-t.toLeft,t.toTop)},DF=function(e){var t=_F(e);return t.toLeft+t.toRight},UF=Sn("http://www.w3.org/2000/svg"),OF=UF("svg"),MF=Rn("height"),FF=Rn("version"),VF=Rn("width"),KF=UF("circle"),HF=UF("ellipse"),jF=UF("foreignObject"),qF=UF("g"),GF=UF("image"),zF=UF("polygon"),YF=UF("polyline"),WF=UF("rect"),JF=ew,QF=UF("text"),XF=Rn("id"),ZF=Rn("points"),eV=Rn("r"),tV=Rn("rx"),rV=Rn("ry"),nV=function(e){return l($n,"http://www.w3.org/1999/xlink","xlink:href",rt(e))},aV=function(e){return{$:"Group",a:e}},iV=Rn("dominant-baseline"),oV=Rn("fill"),uV=Rn("fill-opacity"),sV=Rn("font-family"),cV=Rn("font-size"),fV=Rn("font-style"),lV=Rn("font-variant"),dV=Rn("font-weight"),hV=Rn("opacity"),pV=Rn("stroke"),gV=Rn("stroke-dasharray"),vV=Rn("stroke-dashoffset"),yV=Rn("stroke-linecap"),mV=Rn("stroke-linejoin"),bV=Rn("stroke-opacity"),CV=Rn("stroke-width"),EV=Rn("text-anchor"),SV=Rn("text-decoration"),TV=Rn("transform"),wV=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},IV=function(e){return f($i," ",f(Pa,function(e){var t=e.a,r=e.b;return f($i,",",F([Ri(t),Ri(r)]))},e))},AV=n(function(e,t,r){return d(eF,e,t,r,1)}),BV=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Vg(1e4*e)/100};return Xl(F(["rgba(",WT(i(t)),"%,",WT(i(r)),"%,",WT(i(n)),"%,",WT(function(e){return Vg(1e3*e)/1e3}(a)),")"]))},kV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},NV=function(e){var t=kV(e),r=t.red,n=t.green,a=t.blue;return BV(l(AV,r,n,a))},RV=function(e){if("Uniform"===e.$){var t=e.a;return NV(t)}return"none"},$V=function(e){var t=kV(e),r=t.alpha;return WT(r)},_V=function(e){if("Uniform"===e.$){var t=e.a;return $V(t)}return"0"},LV=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},xV=kr,PV=function(e){var t=WT(e.scale.b),r=WT(e.scale.a),n=WT(-e.rotation/2/xV*360),a=WT(-e.shift.b),i=WT(e.shift.a);return Xl(F(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},DV=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return F([pV(RV(r.fill)),bV(_V(r.fill)),CV(WT(r.thickness)),yV(wV(r.cap)),mV(LV(r.join)),oV("none"),hV(WT(e.opacity)),TV(PV(e)),vV(Ri(r.dashPhase)),gV(IV(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return F([oV(RV(a)),uV(_V(a)),pV(RV(r.fill)),bV(_V(r.fill)),CV(WT(r.thickness)),yV(wV(r.cap)),mV(LV(r.join)),hV(WT(e.opacity)),TV(PV(e)),vV(Ri(r.dashPhase)),gV(IV(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return F([oV(RV(cF(o.color))),sV(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),cV(Ri(o.size)),dV(function(){switch(o.weight.$){case"Thin":return"200";case"Light":return"300";case"Regular":return"normal";case"Medium":return"500";case"SemiBold":return"600";case"Bold":return"bold";default:return"800"}}()),fV(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),lV(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),SV(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),EV("middle"),iV("middle"),TV(PV(e))]);default:return F([TV(PV(e))])}},UV=Rn("x"),OV=Rn("y"),MV=r(function(e,t){return F([VF(WT(e)),MF(WT(t)),UV(WT(-e/2)),OV(WT(-t/2))])}),FV=function(e){return f($i," ",f(Pa,function(e){var t=e.a,r=e.b;return f($i,",",F([WT(t),WT(-r)]))},e))},VV=Kk,KV=r(function(e,t){return f(e,t.a,t.b)}),HV=function(e){return f(Pa,KV(VV),e)},jV=function(e){e:for(;;){var t=f(pc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(YF,O(F([XF(t),ZF(FV(i))]),O(DV(e),HV(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(zF,O(F([XF(t),ZF(FV(i))]),O(DV(e),HV(e.handlers))),mr);case"Circle":var c=s.a;return f(KF,O(F([XF(t),eV(WT(c))]),O(DV(e),HV(e.handlers))),mr);case"Ellipse":var d=s.a,h=s.b;return f(HF,O(F([XF(t),tV(WT(d)),rV(WT(h))]),O(DV(e),HV(e.handlers))),mr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(WF,O(F([XF(t),tV(WT(c)),rV(WT(c))]),O(f(MV,p,g),O(DV(e),HV(e.handlers)))),mr);default:var a=s.a,v=U(e,{basic:f(IF,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(QF,O(F([XF(t)]),O(DV(e),HV(e.handlers))),F([JF(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(GF,O(F([XF(t),nV(C)]),O(f(MV,p,g),O(DV(e),HV(e.handlers)))),mr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(jF,O(F([XF(t)]),O(f(MV,p,g),O(DV(e),HV(e.handlers)))),F([S]));case"Group":var T=n.a;return f(qF,f(Na,XF(t),O(DV(e),HV(e.handlers))),l($a,r(function(e,t){return f(Na,jV(e),t)}),mr,T));default:var w=n.a,I=n.b,v=U(e,{basic:aV(F([w,I]))});e=v;continue e}}},qV=r(function(e,t){var r=e.a,n=e.b,a=WT(r),i=WT(n);return f(ET,mr,F([f(OF,F([VF(a),MF(i),FF("1.1")]),F([jV(t)]))]))}),GV=function(e){return f(qV,x(DF(e),xF(e)),f(TF,PF,e))},zV=r(function(e,t){var r=ZM(e),n=function(){switch(t.$){case"NotStarted":return l(pk,10,33,108);case"Active":return l(pk,0,100,170);default:return l(pk,1,129,104)}}(),a=_x(GV(f(CF,fF(nF(n)),iF(50))));return f(mk,F([eN,m$(f(qN,F([eN,LN,YS(Tk(60))]),r))]),a)}),YV=function(e){var t=F([sx,Gk,Wk(20)]);switch(e.$){case"Active":return f(mk,O(t,F([JI(Qk)])),Vf("Active"));case"NotStarted":return f(mk,O(t,F([JI(ZN)])),Vf("Not Started"));default:return f(mk,t,Vf("Finished"))}},WV=n(function(e,t,r){var n=f(HM,t,e),a=function(){return"Active"===n.$?l(pk,0,226,255):gR}(),i=f(mk,F([JI(a),Wk(20),Gk,eN]),Vf(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 Ek;switch(n.$){case"NotStarted":return d($R,F([eN]),F([Wk(22),YN]),x(gR,iR),f(lR,e,t));case"Active":var a=f(hR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(OR,F([eN]),F([Wk(22),YN]),x($k,iR),i)}return f(pN,F([eN,aN(10)]),F([f(mk,F([eN]),Vf(zM(e))),f(rO,"Poke",mE(gE))]));default:return f(mk,F([YS(Tk(1))]),Ek)}}();return f(pN,F([UN(20),aN(10),YS(Ck)]),F([f(mk,F([v$,eN]),i),f(mk,F([YS(Ck),eN]),f(mk,F([LN]),f(zV,e,n))),f(pN,F([aN(10),X$,eN]),F([f(mk,F([eN]),YV(n)),o]))]))}),JV=o(function(e,t,r,n,a,i){var o=f(HM,r,t),u=f(mk,F([UN(10),XS(Ck),YS(Ck)]),d(GM,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return bl(0)}}(),c=l(WV,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(dR,f(Wm,r.state.phaseStartTime,s),i);default:bl(0)}}(),f(mk,F([YS(Ck),XS(Tk(1)),Ik(function(){return"Active"===o.$?l(qI,0,0,1):iR}())]),Ek)),p=a?f(yN,O(_M(e),O($(o,BM)?NM:LM,F([XS(Ck)]))),F([c,h,u])):f(yN,O(_M(e),O($(o,BM)?NM:LM,F([Uk,jk(kM(t))]))),F([c]));return!e&&$(o,BM)?f(pN,F([XS(Ck),aN(20),SN({bottom:20,left:0,right:0,top:0})]),F([p,AM(r.terms.paymentMethods)])):p}),QV=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(yN,F([eN,Mk(12),UN(30),aN(10),Ik(SM),Wk(24),Gk,JI($k)]),F([Vf("Trade "+IM(t.state.closedReason)),wM])):e?f(pN,F([XS(Ck),aN(10)]),F([f(yN,F([XS(Ck),YS(JS),aN(20)]),F([p(JV,e,qg,t,n,$(r,qg),a),p(JV,e,$b,t,n,$(r,$b),a),p(JV,e,_b,t,n,$(r,_b),a)])),AM(t.terms.paymentMethods)])):f(pN,F([XS(Ck),YS(JS),aN(20)]),F([p(JV,e,qg,t,n,$(r,qg),a),p(JV,e,$b,t,n,$(r,$b),a),p(JV,e,_b,t,n,$(r,_b),a)]))}),XV=a(function(e,t,r,n){var a=e>1300;return x(function(){var e=n.trade;switch(e.$){case"LoadedTrade":var i=e.a;return f(pN,F([XS(Ck),YS(Ck),aN(40)]),F([h(EM,t,i,n.wallet,r,n.showStatsModal),f(mk,F([XS(Ck),f(xk,40,0),aN(40)]),h(QV,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(mk,F([eN,LN,Wk(30)]),Vf("Loading trade info..."));default:return f(mk,F([eN,LN,Wk(30)]),Vf("Invalid trade"))}}(),F([PU(n),FU(n)]))}),ZV=n(function(e,t,r){var n=r.a,a=r.b;return x(e(n),t(a))}),eK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return x(cx,mr);case"CreateModel":var n=r.a;return x(f(Wi,ly,XL(n)),mr);case"TradeModel":var a=r.a;return l(ZV,Wi(py),Pa(Wi(py)),d(XV,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return x(f(Wi,VS,l(pU,t.time,t.tradeCaches,i)),mr);default:var o=r.a;return x(f(Wi,US,l(n$,t.time,t.tradeCaches,o)),mr)}}(),n=r.a,a=r.b;return x(f(mk,F([XS(Ck),YS(Ck),Mk(10)]),n),a)}),tK=function(e){return{$:"DismissNotice",a:e}},rK=function(e){return f(B$,Sx,Tx(e))},nK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(qI,1,1,1):l(qI,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(pk,100,200,255);case"Caution":return l(pk,255,188,0);case"Error":return l(pk,255,70,70);default:return l(pk,200,200,200)}}(),o=f(mk,F([lN,v$,k$(5),rK(5)]),f$(tK(t)));return f(mk,F([Ik(i),Mk(10),UN(8),XS(Ck),GR(1),jR(d(bN,0,0,0,.15)),CL]),f(pN,F([aN(4),XS(Ck)]),f(ki,r(function(e,t){return f(uN,F([XS(Ck),JI(a)]),e?t:f(Na,o,t))}),n.mainParagraphs)))},aK=function(e){return $(e,mr)?mr:F([f(pN,F([wx(20),k$(20),aN(10),lN,X$,XS(Tk(300)),Wk(15)]),f(Pa,nK,f(Wf,function(e){return $(e.b.align,Of)},f(ki,r(function(e,t){return x(e,t)}),e)))),f(pN,F([rK(20),aL(100),aN(10),f_,v$,XS(Tk(300)),Wk(15)]),f(Pa,nK,f(Wf,function(e){return $(e.b.align,QA)},f(ki,r(function(e,t){return x(e,t)}),e))))])},iK=r(function(e,t){var r=f(eK,e,t),n=r.a,a=r.b;return x(f(pN,F([xR(Ak),m$(mN(t)),XS(Ck),YS(Ck),UN(30)]),F([f(mk,F([YS(Tk(50))]),Ek),n])),O(a,aK(t.userNotices)))}),oK=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),uK=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),sK={$:"AllowHover"},cK={$:"Layout"},fK={backgroundColor:fi,borderColor:fi,shadow:ci({blur:3,color:d(jI,155/255,203/255,1,1),offset:x(0,0),size:3})},lK=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?U(t,{hover:ci(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?U(t,{focus:ci(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?U(t,{mode:ci(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?fK:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?sK:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?cK:t.a}()}}(l(xa,t,{focus:fi,hover:fi,mode:fi},e))},dK=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(nT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),nT);case"Text":var a=t.a;return sI(a);default:return sI("")}}),hK=n(function(e,t,r){var n=lK(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?oK(n):uK(n)}();return f(dK,a,d(VI,nT,yk,t,tT(F([r]))))}),pK=RT(5),gK=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),vK={$:"SansSerif"},yK=function(e){return{$:"Typeface",a:e}},mK=W,bK=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($i,"-",mK(Fl(t)));case"ImportFont":var t=e.a;e.b;return f($i,"-",mK(Fl(t)));default:var t=e.a.name;return f($i,"-",mK(Fl(t)))}}())}),CK=function(){var e=F([yK("Open Sans"),yK("Helvetica"),yK("Verdana"),vK]);return F([f(YI,wk,l(zI,"bg-color-"+WI(d(jI,1,1,1,0)),"background-color",d(jI,1,1,1,0))),f(YI,GI,l(zI,"font-color-"+WI(d(jI,0,0,0,1)),"color",d(jI,0,0,0,1))),f(YI,zk,Yk(20)),f(YI,pK,f(gK,l($a,bK,"font-",e),e))])}(),EK=n(function(e,t,r){var n=e.options;return l(hK,n,f(Na,KI(f($i," ",F([uT.root,uT.any,uT.single]))),O(CK,t)),r)}),SK=EK({options:mr}),TK=function(e){return f(YI,pK,f(gK,l($a,bK,"ff-",e),e))},wK=vK,IK=yK,AK=function(e){return{body:F([function(){var t=f(iK,e.screenWidth,e),r=t.a,n=t.b,a=O(F([XS(Ck),YS(Ck),TK(F([IK("Soleil"),wK]))]),f(Pa,m$,n));return f(SK,a,r)}()]),title:"DAIHard"}},BK=jt,kK=BK({init:gB,onUrlChange:hk,onUrlRequest:dk,subscriptions:lk,update:MA,view:AK});!function(t){e.Elm?We("Elm",e.Elm,t):e.Elm=t}({App:{init:kK(f(Go,function(e){return f(Go,function(t){return f(Go,function(r){return Vi({height:r,networkId:t,width:e})},f(vh,"height",kC))},f(vh,"networkId",kC))},f(vh,"width",kC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/src/Create/View.elm b/src/Create/View.elm index 82cdc3f..e9d3eeb 100644 --- a/src/Create/View.elm +++ b/src/Create/View.elm @@ -51,28 +51,28 @@ root model = mainInputElement : Model -> Element Msg mainInputElement model = - case Wallet.factory model.wallet of - Just factory -> - Element.column - [ Element.width Element.fill - , Element.spacing 20 - , Element.Background.color EH.white - , Element.Border.rounded 5 - , Element.padding 20 - , EH.subtleShadow - ] - [ Element.row - [ Element.width Element.fill - , Element.spaceEvenly - ] - [ tradeTypeElement factory model - , daiElement factory model - ] - , feeNotifyElement model - ] - - Nothing -> - Debug.todo "" + let + factory = + Wallet.factoryWithDefault model.wallet + in + Element.column + [ Element.width Element.fill + , Element.spacing 20 + , Element.Background.color EH.white + , Element.Border.rounded 5 + , Element.padding 20 + , EH.subtleShadow + ] + [ Element.row + [ Element.width Element.fill + , Element.spaceEvenly + ] + [ tradeTypeElement factory model + , daiElement factory model + , fiatElement model + ] + , feeNotifyElement model + ] tradeTypeElement : FactoryType -> Model -> Element Msg diff --git a/src/TradeTable/View.elm b/src/TradeTable/View.elm index e8a065a..4424dbb 100644 --- a/src/TradeTable/View.elm +++ b/src/TradeTable/View.elm @@ -158,7 +158,8 @@ viewTradeRow time colTypes trade = [ Element.width Element.fill , Element.spacing 1 , Element.Background.color EH.lightGray - , Element.width <| Element.fillPortion 7 + , Element.pointer + , Element.Events.onClick (TradeClicked trade.factory trade.id) ] [ Element.row [ Element.width <| Element.fillPortion 6 From 7bc29d3ff80c7d754af9e79f141e5c6dfe5cf16c Mon Sep 17 00:00:00 2001 From: oglog Date: Sat, 10 Aug 2019 16:04:31 +0200 Subject: [PATCH 03/19] Comment out unused JS --- assets/static/networkChangeNotifier.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/assets/static/networkChangeNotifier.js b/assets/static/networkChangeNotifier.js index 22a9d76..b444162 100644 --- a/assets/static/networkChangeNotifier.js +++ b/assets/static/networkChangeNotifier.js @@ -11,20 +11,20 @@ var commonModule = (function () { pub.startWatching = function (_notifyPort, _web3) { notifyPort = _notifyPort; web3 = _web3; - setInterval(checkNetworkId, 100); + // setInterval(checkNetworkId, 100); } - var checkNetworkId = function () { - web3.version.getNetwork(function (e, networkId) { - if (e) { - console.log("error with web3.version.getNetwork: ", e); - } - else if (networkId != lastNetworkId) { - notifyPort.send(parseInt(networkId)); - lastNetworkId = networkId; - } - }); - } + // var checkNetworkId = function () { + // web3.version.getNetwork(function (e, networkId) { + // if (e) { + // console.log("error with web3.version.getNetwork: ", e); + // } + // else if (networkId != lastNetworkId) { + // notifyPort.send(parseInt(networkId)); + // lastNetworkId = networkId; + // } + // }); + // } return pub; })(); From 28fa4d5079bd596f38e448b95d9dbfd111d8a878 Mon Sep 17 00:00:00 2001 From: oglog Date: Sat, 10 Aug 2019 16:06:41 +0200 Subject: [PATCH 04/19] TradeCache updates phases (and sometimes states) --- src/Contracts/Types.elm | 15 ++++- src/Contracts/Wrappers.elm | 9 ++- src/Marketplace/State.elm | 1 - src/Marketplace/Types.elm | 5 -- src/TradeCache/State.elm | 133 ++++++++++++++++++++++++++++++++++++- src/TradeCache/Types.elm | 2 + 6 files changed, 156 insertions(+), 9 deletions(-) diff --git a/src/Contracts/Types.elm b/src/Contracts/Types.elm index 2c18be0..5102ac9 100644 --- a/src/Contracts/Types.elm +++ b/src/Contracts/Types.elm @@ -1,4 +1,4 @@ -module Contracts.Types exposing (ClosedReason(..), CreateParameters, DAIHardEvent(..), FullTradeInfo, PartialTradeInfo, Phase(..), PhaseStartInfo, State, Terms, TimeoutInfo(..), Trade(..), TradeCreationInfo, TradeParameters, UserParameters, bigIntToPhase, buildCreateParameters, calculateFullInitialDeposit, decodeParameters, decodePhaseStartInfo, decodeState, decodeTerms, defaultAbortPunishment, defaultBuyerDeposit, encodeTerms, eventDecoder, getBuyerOrSeller, getCurrentPhaseTimeoutInfo, getDevFee, getInitiatorOrResponder, getPhaseInterval, getPokeText, getResponderRole, initiatorOrResponderToBuyerOrSeller, partialTradeInfo, phaseIcon, phaseToInt, phaseToString, responderDeposit, tradeAddress, tradeFactory, tradeHasDefaultParameters, txReceiptToCreatedTradeSellId, updateCreationInfo, updateParameters, updatePhaseStartInfo, updateState, updateTerms) +module Contracts.Types exposing (ClosedReason(..), CreateParameters, DAIHardEvent(..), FullTradeInfo, PartialTradeInfo, Phase(..), PhaseStartInfo, State, Terms, TimeoutInfo(..), Trade(..), TradeCreationInfo, TradeParameters, UserParameters, bigIntToPhase, buildCreateParameters, calculateFullInitialDeposit, decodeParameters, decodePhaseStartInfo, decodeState, decodeTerms, defaultAbortPunishment, defaultBuyerDeposit, encodeTerms, eventDecoder, getBuyerOrSeller, getCreationInfo, getCurrentPhaseTimeoutInfo, getDevFee, getInitiatorOrResponder, getPhaseInterval, getPokeText, getResponderRole, initiatorOrResponderToBuyerOrSeller, partialTradeInfo, phaseIcon, phaseToInt, phaseToString, responderDeposit, tradeAddress, tradeFactory, tradeHasDefaultParameters, txReceiptToCreatedTradeSellId, updateCreationInfo, updateParameters, updatePhaseStartInfo, updateState, updateTerms) import Abi.Decode import BigInt exposing (BigInt) @@ -157,6 +157,19 @@ type alias PhaseStartInfo = } +getCreationInfo : Trade -> Maybe TradeCreationInfo +getCreationInfo trade = + case trade of + LoadedTrade fTrade -> + Just fTrade.creationInfo + + PartiallyLoadedTrade pTrade -> + pTrade.creationInfo + + Invalid -> + Nothing + + tradeFactory : Trade -> Maybe FactoryType tradeFactory trade = case trade of diff --git a/src/Contracts/Wrappers.elm b/src/Contracts/Wrappers.elm index ee0263a..32b4e21 100644 --- a/src/Contracts/Wrappers.elm +++ b/src/Contracts/Wrappers.elm @@ -1,4 +1,4 @@ -module Contracts.Wrappers exposing (getAllowanceCmd, getCreationInfoFromIdCmd, getInitiatedEventDataSentryCmd, getNumTradesCmd, getParametersAndStateCmd, getParametersCmd, getParametersStateAndPhaseInfoCmd, getStateCmd, openTrade) +module Contracts.Wrappers exposing (getAllowanceCmd, getCreationInfoFromIdCmd, getInitiatedEventDataSentryCmd, getNumTradesCmd, getParametersAndStateCmd, getParametersCmd, getParametersStateAndPhaseInfoCmd, getPhaseCmd, getStateCmd, openTrade) import BigInt exposing (BigInt) import CommonTypes exposing (..) @@ -118,6 +118,13 @@ getStateCmd factoryType ttAddress msgConstructor = |> Task.attempt msgConstructor +getPhaseCmd : FactoryType -> Address -> (Result Http.Error (Maybe Phase) -> msg) -> Cmd msg +getPhaseCmd factoryType ttAddress msgConstructor = + Eth.call (EthHelpers.httpProviderForFactory factoryType) (DHT.phase ttAddress) + |> Task.map bigIntToPhase + |> Task.attempt msgConstructor + + getPhaseStartInfoCmd : FactoryType -> Address -> (Result Http.Error (Maybe PhaseStartInfo) -> msg) -> Cmd msg getPhaseStartInfoCmd factoryType ttAddress msgConstructor = Eth.call (EthHelpers.httpProviderForFactory factoryType) (DHT.getPhaseStartInfo ttAddress) diff --git a/src/Marketplace/State.elm b/src/Marketplace/State.elm index 01adb3a..e9c72fc 100644 --- a/src/Marketplace/State.elm +++ b/src/Marketplace/State.elm @@ -342,5 +342,4 @@ updateWalletState wallet model = subscriptions : Model -> Sub Msg subscriptions model = - -- Time.every 5000 Refresh Sub.none diff --git a/src/Marketplace/Types.elm b/src/Marketplace/Types.elm index a377327..fdbcf95 100644 --- a/src/Marketplace/Types.elm +++ b/src/Marketplace/Types.elm @@ -49,11 +49,6 @@ type Msg | NoOp - ---| StateFetched Int (Result Http.Error (Maybe CTypes.State)) ---| Refresh Time.Posix - - type alias UpdateResult = { model : Model , cmd : Cmd Msg diff --git a/src/TradeCache/State.elm b/src/TradeCache/State.elm index 079627a..15b48cc 100644 --- a/src/TradeCache/State.elm +++ b/src/TradeCache/State.elm @@ -120,6 +120,91 @@ update msg prevModel = (Contracts.Wrappers.getNumTradesCmd prevModel.factory NumTradesFetchedAgain) [] + UpdateTradePhases -> + let + updatePhasesCmd = + loadedTrades prevModel + |> List.map + (\trade -> + case trade.state.phase of + CTypes.Closed -> + Nothing + + _ -> + Just <| + Contracts.Wrappers.getPhaseCmd + trade.factory + trade.creationInfo.address + (PhaseFetched trade.factory trade.id) + ) + |> Maybe.Extra.values + |> Cmd.batch + in + UpdateResult + prevModel + updatePhasesCmd + [] + + PhaseFetched factory id fetchResult -> + case fetchResult of + Ok (Just newPhase) -> + let + intermediateUpdateResult = + prevModel + |> updateTradePhase id newPhase + + ( cmd, appCmds ) = + case ( newPhase, Array.get id prevModel.trades ) of + ( CTypes.Committed, Just trade ) -> + case CTypes.getCreationInfo trade of + Just creationInfo -> + -- state has changed; update + ( Contracts.Wrappers.getStateCmd + factory + creationInfo.address + (StateFetched id) + , [] + ) + + Nothing -> + ( Cmd.none + , [ AppCmd.UserNotice <| + UN.unexpectedError "Phase fetched for a trade that has no creationInfo" trade + ] + ) + + ( _, Nothing ) -> + ( Cmd.none + , [ AppCmd.UserNotice <| + UN.unexpectedError "Phase fetched for a trade, but then ran into an out-of-range error" Nothing + ] + ) + + _ -> + ( Cmd.none + , [] + ) + in + UpdateResult + intermediateUpdateResult.tradeCache + (Cmd.batch + [ intermediateUpdateResult.cmd + , cmd + ] + ) + (List.append + intermediateUpdateResult.appCmds + appCmds + ) + + badFetchResult -> + UpdateResult + prevModel + Cmd.none + [ AppCmd.UserNotice <| + UN.fromBadFetchResultMaybe "phase" fetchResult + ] + NumTradesFetchedAgain fetchResult -> case ( fetchResult, prevModel.dataFetchState.total ) of ( Ok bigInt, Just oldNumTrades ) -> @@ -444,6 +529,49 @@ updateTradeParameters id parameters tradeCache = ] +updateTradePhase : Int -> CTypes.Phase -> TradeCache -> UpdateResult +updateTradePhase id newPhase tradeCache = + case Array.get id tradeCache.trades of + Just (CTypes.LoadedTrade trade) -> + let + oldState = + trade.state + + newTradeArray = + Array.set + id + (CTypes.LoadedTrade <| + { trade + | state = + { oldState | phase = newPhase } + } + ) + tradeCache.trades + in + UpdateResult + ({ tradeCache | trades = newTradeArray } + |> updateStatus + ) + Cmd.none + [] + + Just _ -> + UpdateResult + tradeCache + Cmd.none + [ AppCmd.UserNotice <| + UN.unexpectedError "updateTradePhase is trying to update a partially loaded trade" ( id, tradeCache.trades ) + ] + + Nothing -> + UpdateResult + tradeCache + Cmd.none + [ AppCmd.UserNotice <| + UN.unexpectedError "updateTradePhase ran into an out-of-range error" ( id, tradeCache.trades ) + ] + + updateTradeState : Int -> CTypes.State -> TradeCache -> UpdateResult updateTradeState id state tradeCache = case Array.get id tradeCache.trades of @@ -533,4 +661,7 @@ updateTradeTerms id terms tradeCache = subscriptions : TradeCache -> Sub Msg subscriptions tradeCache = - Time.every 5000 (\_ -> CheckForNewTrades) + Sub.batch + [ Time.every 5000 (\_ -> CheckForNewTrades) + , Time.every 3000 (\_ -> UpdateTradePhases) + ] diff --git a/src/TradeCache/Types.elm b/src/TradeCache/Types.elm index 886866a..e62f6b6 100644 --- a/src/TradeCache/Types.elm +++ b/src/TradeCache/Types.elm @@ -41,6 +41,8 @@ type LoadingStatus type Msg = InitialNumTradesFetched (Result Http.Error BigInt) | CheckForNewTrades + | UpdateTradePhases + | PhaseFetched FactoryType Int (Result Http.Error (Maybe CTypes.Phase)) | NumTradesFetchedAgain (Result Http.Error BigInt) | CreationInfoFetched Int (Result Http.Error DHF.CreatedTrade) | ParametersFetched Int (Result Http.Error (Result String CTypes.TradeParameters)) From b0ced91ead669a91141c2e6ff6b28563d290cd22 Mon Sep 17 00:00:00 2001 From: oglog Date: Sat, 10 Aug 2019 16:07:12 +0200 Subject: [PATCH 05/19] Fixed Phase sorting --- src/TradeTable/View.elm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TradeTable/View.elm b/src/TradeTable/View.elm index 4424dbb..b75b6ed 100644 --- a/src/TradeTable/View.elm +++ b/src/TradeTable/View.elm @@ -321,10 +321,10 @@ sortByFunc ( sortCol, ordering ) = Phase -> \a b -> if a.state.phase == b.state.phase then - sortByFunc ( Expires, Descending ) a b + sortByFunc ( Expires, Ascending ) a b else - compare (CTypes.phaseToInt a.state.phase) (CTypes.phaseToInt b.state.phase) + flip compare (CTypes.phaseToInt a.state.phase) (CTypes.phaseToInt b.state.phase) Expires -> \a b -> TimeHelpers.compare a.derived.phaseEndTime b.derived.phaseEndTime From 7f6d58c1e097ef1b6ed98e494f2d25fab589caf5 Mon Sep 17 00:00:00 2001 From: oglog Date: Sat, 10 Aug 2019 16:07:27 +0200 Subject: [PATCH 06/19] Includ latest build --- docs/404.html | 2 +- docs/index.html | 2 +- docs/static/js/main-0e6b8607c1efa2e15682.js | 7 +++++++ docs/static/js/main-6db0b05de0e6b3762895.js | 7 ------- 4 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 docs/static/js/main-0e6b8607c1efa2e15682.js delete mode 100644 docs/static/js/main-6db0b05de0e6b3762895.js diff --git a/docs/404.html b/docs/404.html index 7dd114d..6c68036 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 7dd114d..6c68036 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-0e6b8607c1efa2e15682.js b/docs/static/js/main-0e6b8607c1efa2e15682.js new file mode 100644 index 0000000..28dddb3 --- /dev/null +++ b/docs/static/js/main-0e6b8607c1efa2e15682.js @@ -0,0 +1,7 @@ +!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/DAIHard/",t(t.s=43)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t,n,a,i){function o(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(l.isArrayBuffer(e)||l.isArrayBufferView(e))if(void 0!==i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(i=Date.now(),s(e)):(a.push(e),1===a.length&&u.setAttribute("a",o=!o))}}l.nextTick=l.setImmediate}(),l.isNodejs=void 0!==t&&t.versions&&t.versions.node,l.globalScope=function(){return l.isNodejs?a:"undefined"==typeof self?window:self}(),l.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},l.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},l.isArrayBufferView=function(e){return e&&l.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},l.ByteBuffer=u,l.ByteStringBuffer=u;l.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},l.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},l.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},l.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},l.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},l.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},l.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(l.encodeUtf8(e))},l.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},l.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},l.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},l.ByteStringBuffer.prototype.putInt=function(e,t){o(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},l.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},l.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},l.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},l.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},l.ByteStringBuffer.prototype.copy=function(){var e=l.createBuffer(this.data);return e.read=this.read,e},l.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},l.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},l.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},l.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},l.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},l.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},l.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},l.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},l.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},l.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},l.DataBuffer.prototype.putInt=function(e,t){o(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},l.DataBuffer.prototype.putSignedInt=function(e,t){return o(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},l.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},l.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},l.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},l.DataBuffer.prototype.copy=function(){return new l.DataBuffer(this)},l.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},l.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},l.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},l.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},l.xorBytes=function(e,t,r){for(var n="",a="",i="",o=0,u=0;r>0;--r,++o)a=e.charCodeAt(o)^t.charCodeAt(o),u>=10&&(n+=i,i="",u=0),i+=String.fromCharCode(a),++u;return n+=i},l.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";l.encode64=function(e,t){for(var r,n,a,i="",o="",u=0;u>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,a,i="",o=0;o>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==a&&(i+=String.fromCharCode((3&n)<<6|a)));return i},l.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},l.decodeUtf8=function(e){return decodeURIComponent(escape(e))},l.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:f.encode,decode:f.decode}},l.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},l.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var a,i,o,u,s=0,c=r;s>4,64!==o&&(n[c++]=(15&i)<<4|o>>2,64!==u&&(n[c++]=(3&o)<<6|u));return t?c-r:n.subarray(0,c)},l.binary.base58.encode=function(e,t){return l.binary.baseN.encode(e,p,t)},l.binary.base58.decode=function(e,t){return l.binary.baseN.decode(e,p,t)},l.text={utf8:{},utf16:{}},l.text.utf8.encode=function(e,t,r){e=l.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i0?(a=r[n].substring(0,o),i=r[n].substring(o+1)):(a=r[n],i=null),a in t||(t[a]=[]),a in Object.prototype||null===i||t[a].push(unescape(i))}return t};return void 0===e?(null===S&&(S="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=S):t=r(e),t},l.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var a=t.split("/");return a.length>0&&""===a[0]&&a.shift(),{pathString:t,queryString:r,path:a,query:""===r?{}:l.getQueryVariables(r)}},l.makeRequest=function(e){var t=l.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},l.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},l.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,a=t.length;n0&&i.push(r),o=n.lastIndex;var u=t[0][1];switch(u){case"s":case"o":a");break;case"%":i.push("%");break;default:i.push("<%"+u+"?>")}}return i.push(e.substring(o)),i.join("")},l.formatNumber=function(e,t,r,n){var a=e,i=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,u=void 0===n?".":n,s=a<0?"-":"",c=parseInt(a=Math.abs(+a||0).toFixed(i),10)+"",f=c.length>3?c.length%3:0;return s+(f?c.substr(0,f)+u:"")+c.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+u)+(i?o+Math.abs(a-c).toFixed(i).slice(2):"")},l.formatSize=function(e){return e=e>=1073741824?l.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?l.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?l.formatNumber(e/1024,0)+" KiB":l.formatNumber(e,0)+" bytes"},l.bytesFromIP=function(e){return-1!==e.indexOf(".")?l.bytesFromIPv4(e):-1!==e.indexOf(":")?l.bytesFromIPv6(e):null},l.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=l.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(i)}if(r.length>0){var s=r[n];s.end-s.start>0&&(t.splice(s.start,s.end-s.start+1,""),0===s.start&&t.unshift(""),7===s.end&&t.push(""))}return t.join(":")},l.estimateCores=function(e,t){function r(e,o,u){if(0===o){var s=Math.floor(e.reduce(function(e,t){return e+t},0)/e.length);return l.cores=Math.max(1,s),URL.revokeObjectURL(i),t(null,l.cores)}n(u,function(t,n){e.push(a(u,n)),r(e,o-1,u)})}function n(e,t){for(var r=[],n=[],a=0;au.st&&a.sta.st&&u.st0)return l.cores=navigator.hardwareConcurrency,t(null,l.cores);if("undefined"==typeof Worker)return l.cores=1,t(null,l.cores);if("undefined"==typeof Blob)return l.cores=2,t(null,l.cores);var i=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}function a(e,t,r,i){var s;n(e,t,2);var c=e.getByte();t--;var f=192&c,l=31&c;s=e.length();var d=u(e,t);if(t-=s-e.length(),void 0!==d&&d>t){if(i.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=e.length(),h.remaining=t,h.requested=d,h}d=t}var p,g,v=32==(32&c);if(v)if(p=[],void 0===d)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}s=e.length(),p.push(a(e,t,r+1,i)),t-=s-e.length()}else for(;d>0;)s=e.length(),p.push(a(e,d,r+1,i)),t-=s-e.length(),d-=s-e.length();if(void 0===p&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&(g=e.bytes(d)),void 0===p&&i.decodeBitStrings&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&d>1){var y=e.read,m=t,b=0;if(l===o.Type.BITSTRING&&(n(e,t,1),b=e.getByte(),t--),0===b)try{s=e.length();var C={verbose:i.verbose,strict:!0,decodeBitStrings:!0},E=a(e,t,r+1,C),S=s-e.length();t-=S,l==o.Type.BITSTRING&&S++;var T=E.tagClass;S!==d||T!==o.Class.UNIVERSAL&&T!==o.Class.CONTEXT_SPECIFIC||(p=[E])}catch(e){}void 0===p&&(e.read=y,t=m)}if(void 0===p){if(void 0===d){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=t}if(l===o.Type.BMPSTRING)for(p="";d>0;d-=2)n(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(d)}var w=void 0===g?null:{bitStringContents:g};return o.create(f,l,v,p,w)}var i=r(0);r(1),r(6);var o=e.exports=i.asn1=i.asn1||{};o.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},o.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},o.create=function(e,t,r,n,a){if(i.util.isArray(n)){for(var u=[],s=0;s1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?n.putBytes(e.value.substr(1)):n.putBytes(e.value);if(t.putByte(r),n.length()<=127)t.putByte(127&n.length());else{var s=n.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);t.putByte(128|c.length);for(var u=c.length-1;u>=0;--u)t.putByte(c.charCodeAt(u))}return t.putBuffer(n),t},o.oidToDer=function(e){var t=e.split("."),r=i.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var n,a,o,u,s=2;s>>=7,n||(u|=128),a.push(u),n=!1}while(o>0);for(var c=a.length-1;c>=0;--c)r.putByte(a[c])}return r},o.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)r=e.getByte(),n<<=7,128&r?n+=127&r:(t+="."+(n+r),n=0);return t},o.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),u=0;if(e.length>11){var s=e.charAt(10),c=10;"+"!==s&&"-"!==s&&(u=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,0),c&&("+"===(s=e.charAt(c))||"-"===s)){var f=parseInt(e.substr(c+1,2),10),l=parseInt(e.substr(c+4,2),10),d=60*f+l;d*=6e4,"+"===s?t.setTime(+t-d):t.setTime(+t+d)}return t},o.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),u=parseInt(e.substr(12,2),10),s=0,c=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var l=e.length-5,d=e.charAt(l);if("+"===d||"-"===d){c=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10),c*=6e4,"+"===d&&(c*=-1),f=!0}return"."===e.charAt(14)&&(s=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,s),t.setTime(+t+c)):(t.setFullYear(r,n,a),t.setHours(i,o,u,s)),t},o.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},o.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},o.validate=function(e,t,r,n){var a=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(a=!0,t.value&&i.util.isArray(t.value))for(var u=0,s=0;a&&s0&&(n+="\n");for(var a="",u=0;u1?n+="0x"+i.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?n+=" (1 unused bit shown)":d>1&&(n+=" ("+d+" unused bits shown)")}}else e.type===o.Type.OCTETSTRING?(s.test(e.value)||(n+="("+e.value+") "),n+="0x"+i.util.bytesToHex(e.value)):e.type===o.Type.UTF8?n+=i.util.decodeUtf8(e.value):e.type===o.Type.PRINTABLESTRING||e.type===o.Type.IA5String?n+=e.value:s.test(e.value)?n+="0x"+i.util.bytesToHex(e.value):0===e.value.length?n+="[null]":n+=e.value}return n}},function(e,t,r){var n=r(0);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){function n(e,t){var r=function(){return new s.aes.Algorithm(e,t)};s.cipher.registerAlgorithm(e,r)}function a(){p=!0,l=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;c=new Array(256),f=new Array(256),d=new Array(4),h=new Array(4);for(var t=0;t<4;++t)d[t]=new Array(256),h[t]=new Array(256);for(var r,n,a,i,o,u,s,g=0,v=0,t=0;t<256;++t){i=v^v<<1^v<<2^v<<3^v<<4,i=i>>8^255&i^99,c[g]=i,f[i]=g,o=e[i],r=e[g],n=e[r],a=e[n],u=o<<24^i<<16^i<<8^i^o,s=(r^n^a)<<24^(g^a)<<16^(g^n^a)<<8^g^r^a;for(var y=0;y<4;++y)d[y][g]=u,h[y][i]=s,u=u<<24|u>>>8,s=s<<24|s>>>8;0===g?g=v=1:(g=r^e[e[e[r^a]]],v^=e[e[v]])}}function i(e,t){for(var r,n=e.slice(0),a=1,i=n.length,o=i+6+1,u=g*o,s=i;s>>16&255]<<24^c[r>>>8&255]<<16^c[255&r]<<8^c[r>>>24]^l[a]<<24,a++):i>6&&s%i==4&&(r=c[r>>>24]<<24^c[r>>>16&255]<<16^c[r>>>8&255]<<8^c[255&r]),n[s]=n[s-i]^r;if(t){var f,d=h[0],p=h[1],v=h[2],y=h[3],m=n.slice(0);u=n.length;for(var s=0,b=u-g;s>>24]]^p[c[f>>>16&255]]^v[c[f>>>8&255]]^y[c[255&f]];n=m}return n}function o(e,t,r,n){var a,i,o,u,s,l=e.length/4-1;n?(a=h[0],i=h[1],o=h[2],u=h[3],s=f):(a=d[0],i=d[1],o=d[2],u=d[3],s=c);var p,g,v,y,m,b,C;p=t[0]^e[0],g=t[n?3:1]^e[1],v=t[2]^e[2],y=t[n?1:3]^e[3];for(var E=3,S=1;S>>24]^i[g>>>16&255]^o[v>>>8&255]^u[255&y]^e[++E],b=a[g>>>24]^i[v>>>16&255]^o[y>>>8&255]^u[255&p]^e[++E],C=a[v>>>24]^i[y>>>16&255]^o[p>>>8&255]^u[255&g]^e[++E],y=a[y>>>24]^i[p>>>16&255]^o[g>>>8&255]^u[255&v]^e[++E],p=m,g=b,v=C;r[0]=s[p>>>24]<<24^s[g>>>16&255]<<16^s[v>>>8&255]<<8^s[255&y]^e[++E],r[n?3:1]=s[g>>>24]<<24^s[v>>>16&255]<<16^s[y>>>8&255]<<8^s[255&p]^e[++E],r[2]=s[v>>>24]<<24^s[y>>>16&255]<<16^s[p>>>8&255]<<8^s[255&g]^e[++E],r[n?1:3]=s[y>>>24]<<24^s[p>>>16&255]<<16^s[g>>>8&255]<<8^s[255&v]^e[++E]}function u(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="AES-"+r;t=e.decrypt?s.cipher.createDecipher(n,e.key):s.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof s.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var s=r(0);r(15),r(23),r(1),e.exports=s.aes=s.aes||{},s.aes.startEncrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!1,mode:n});return a.start(t),a},s.aes.createEncryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!1,mode:t})},s.aes.startDecrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!0,mode:n});return a.start(t),a},s.aes.createDecryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!0,mode:t})},s.aes.Algorithm=function(e,t){p||a();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return o(r._w,e,t,!1)},decrypt:function(e,t){return o(r._w,e,t,!0)}}}),r._init=!1},s.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(s.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=s.util.createBuffer();for(var n=0;n>>=2;for(var n=0;n65&&-1!==o){var u=t[o];","===u?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+u+t.substr(o+1),i=a-o-1,o=-1,++a}else" "!==t[a]&&"\t"!==t[a]&&","!==t[a]||(o=a);return t}function a(e){return e.replace(/^\s+/,"")}var i=r(0);r(1);var o=e.exports=i.pem=i.pem||{};o.encode=function(e,t){t=t||{};var r,a="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=n(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=n(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=n(r)),e.headers)for(var o=0;ot.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),a=n.util.createBuffer(),c=o.length();for(var s=0;s=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,s=e.h4,f=0;f<16;++f)n=r.getInt32(),t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<20;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<32;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<40;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<60;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i&o|u&(i^o),n=(a<<5|a>>>27)+c+s+2400959708+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<80;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+3395469782+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,e.h4=e.h4+s|0,l-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=o,o.create=function(){s||n();var e=null,t=i.util.createBuffer(),r=new Array(80),o={algorithm:"sha1",blockLength:64,digestLength:20,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};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},o};var u=null,s=!1},function(e,t,r){"use strict";(function(e){function n(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),i.alloc(+e)}function v(e,t){if(i.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(n)return j(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return _(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return $(this,t,r);case"base64":return B(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,a){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:C(e,t,r,n,a);if("number"==typeof t)return t&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):C(e,[t],r,n,a);throw new TypeError("val must be string, number or Buffer")}function C(e,t,r,n,a){function i(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,u=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,u/=2,s/=2,r/=2}var c;if(a){var f=-1;for(c=r;cu&&(r=u-s),c=r;c>=0;c--){for(var l=!0,d=0;da&&(n=a):n=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(a+u<=r){var s,c,f,l;switch(u){case 1:i<128&&(o=i);break;case 2:s=e[a+1],128==(192&s)&&(l=(31&i)<<6|63&s)>127&&(o=l);break;case 3:s=e[a+1],c=e[a+2],128==(192&s)&&128==(192&c)&&(l=(15&i)<<12|(63&s)<<6|63&c)>2047&&(l<55296||l>57343)&&(o=l);break;case 4:s=e[a+1],c=e[a+2],f=e[a+3],128==(192&s)&&128==(192&c)&&128==(192&f)&&(l=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&f)>65535&&l<1114112&&(o=l)}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),a+=u}return N(n)}function N(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var a="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,a,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function D(e,t,r,n){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-r,2);a>>8*(n?a:1-a)}function U(e,t,r,n){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-r,4);a>>8*(n?a:3-a)&255}function O(e,t,r,n,a,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,a){return a||O(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,a){return a||O(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(e,t,r,n,52,8),r+8}function V(e){if(e=K(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function K(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function j(e,t){t=t||1/0;for(var r,n=e.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(e){for(var t=[],r=0;r>8,a=r%256,i.push(a),i.push(n);return i}function z(e){return J.toByteArray(V(e))}function Y(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function W(e){return e!==e}/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(Jh,o,function(e){return si(Qh(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Zh,e,L(r,ip({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Zh,e,L(r,ap({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=Pg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?Tg(o):Sg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return Pg(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(wg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Ag,Ig,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(Io,xa(Us),f(Io,ms,Ds))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(qd,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(qd,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(np)}),i.addEventListener("timeout",function(){a(op)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Qh(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(tp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Ag,Ig,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Ag,Ig,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Ag,Ig,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=function(e){return{orderBy:e}},fo=co,lo={$:"Ascending"},ho={$:"Phase"},po=Oe,go=po(yr),vo=r(function(e,t){return L({agentAddress:t,tradeTable:fo(L(ho,lo)),wallet:e},go)}),yo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),mo={$:"None"},bo=mo,Co=function(e){return d(yo,e,go,bo,yr)},Eo=function(e){return{$:"TradeTableMsg",a:e}},So=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),To=r(function(e,t){return f(So,e,t)}),wo=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Io=n(function(e,t,r){return t(e(r))}),Ao=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),Bo=r(function(e,t){if("None"===t.$)return mo;var r=t.a,n=t.b,a=l(wo,f(Ao,Da(e),r.onSign),f(Ao,Da(e),r.onBroadcast),f(Ao,function(t){var r=t.a,n=t.b;return L(f(Io,r,e),f(Ao,function(t){return{confirmations:t.confirmations,toMsg:f(Io,t.toMsg,e)}},n))},r.onMined));return f(So,a,n)}),ko=function(e){return{$:"AbiDecoder",a:e}},No=r(function(e,t){return{$:"Tape",a:e,b:t}}),Ro=z,$o=Fr,_o=r(function(e,t){return e<1?t:l($o,e,Ro(t),t)}),Lo=_o(64),xo=n(function(e,t,r){return L(f(No,e,Lo(t)),r)}),Po=r(function(e,t){return e<1?"":l($o,0,e,t)}),Do=Po(64),Uo=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),Oo=function(e){return-e},Mo=r(function(e,t){return e<1?"":l($o,-e,Ro(t),t)}),Fo=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(Po,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(Mo,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return ko(function(t){var r=t.a,n=t.b;return f(Uo,f(xo,r,n),e(Do(n)))})}(),Vo=Hr,Ko=function(e){return f(Vo,"0x",e)||f(Vo,"0X",e)?f(_o,2,e):e},Ho=function(e){return e.b},jo=r(function(e,t){var r=e.a;return f(Uo,Ho,r(function(e){return f(No,e,e)}(Ko(t))))}),qo=Xr,Go=ae,zo=Wr,Yo=function(e){return f(qo,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return Go(a)},zo)},Wo=f(Io,jo,Yo),Jo=function(e){return{$:"Magnitude",a:e}},Qo=function(e){return{$:"Pos",a:e}},Xo=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Zo=function(e){return{$:"MagnitudeNotNormalised",a:e}},eu=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 si(n)}return ci}},tu=function(e){var t=eu(e);return"Nothing"!==t.$&&t.a<0},ru=function(e){return{$:"Neg",a:e}},nu={$:"Zer"},au=function(e){return!e.b},iu=r(function(e,t){var r=t.a;if(au(r))return nu;switch(e.$){case"Zero":return nu;case"Positive":return Qo(t);default:return ru(t)}}),ou=r(function(e,t){return f(Xo,e,Zo(t))}),uu=function(e){return f(La,r(function(t,r){return e(t)&&au(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),su=Ir,cu=-1+f(su,10,7),fu=cu+1,lu=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),du=function(e){return e<0?f(lu,Na(-1),du(e+fu)):L(e/fu|0,e%fu)},hu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=du(r+e),i=a.a,o=a.b;return f(ka,o,f(hu,i,n))}{if(!(_(e,fu)>0))return M([e]);var u=M([e]);e=0,t=u}}}),pu=function(e){var t=e.a;return Jo(uu(f(hu,0,t)))},gu=xa(Oo),vu={$:"Negative"},yu={$:"Positive"},mu={$:"Zero"},bu=function(e){switch(e.$){case"Positive":return vu;case"Negative":return yu;default:return mu}},Cu=function(e){for(;;){var t=e.a,r=e.b,n=pu(r),a=n.a;if(!tu(a))return f(iu,t,Jo(a));e=f(ou,bu(t),gu(a))}},Eu=pr,Su=function(e){switch(f(Eu,e,0).$){case"LT":return vu;case"GT":return yu;default:return mu}},Tu=function(e){return e<0?-e:e},wu=function(e){return Cu(f(Xo,Su(e),Zo(M([Tu(e)]))))},Iu=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(su,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},Au=function(e){switch(e.$){case"Zer":return nu;case"Neg":var t=e.a;return Qo(t);default:return e}},Bu=function(e){return{$:"MagnitudePair",a:e}},ku=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(ka,L(a,u),f(ku,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(ku,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(ku,yr,s))}return yr}),Nu=r(function(e,t){var r=e.a,n=t.a;return Bu(f(ku,r,n))}),Ru=function(e){switch(e.$){case"Zer":return f(ou,mu,yr);case"Neg":var t=e.a.a;return f(ou,yu,gu(t));default:var t=e.a.a;return f(ou,yu,t)}},$u=r(function(e,t){var r=Ru(t),n=r.b,a=Ru(e),i=a.b,o=f(Nu,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Cu(f(Xo,yu,Zo(s)))}),_u=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(R(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 Ta}return a.b.b?ba:f(Eu,e,t)}}),Lu=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},xu=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(_u,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Lu(d(_u,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),Pu=r(function(e,t){return R(f(xu,e,t),Ta)}),Du=K,Uu=r(function(e,t){return!f(Pu,e,t)}),Ou=function(e){switch(e.$){case"Zer":return Jo(yr);case"Pos":default:var t=e.a;return t}},Mu=r(function(e,t){var r=e.a;return pu(Zo(f(xa,ti(t),r)))}),Fu=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(Mu,Jo(n),a),u=f(Fu,Jo(i),Jo(n)),s=u.a,c=f($u,f(iu,yu,o),f(iu,yu,Jo(f(ka,0,s))));return Ou(c)}var a=r.a;return f(Mu,Jo(n),a)}return Jo(yr)}),Vu=function(e){switch(e.$){case"Zer":return mu;case"Pos":return yu;default:return vu}},Ku=r(function(e,t){return R(e,mu)||R(t,mu)?mu:R(e,t)?yu:vu}),Hu=r(function(e,t){return f(iu,f(Ku,Vu(e),Vu(t)),f(Fu,Ou(e),Ou(t)))}),ju=function(e){switch(e.$){case"Zer":return nu;case"Pos":var t=e.a;return ru(t);default:var t=e.a;return Qo(t)}},qu=r(function(e,t){return f($u,e,ju(t))}),Gu=wu(0),zu=a(function(e,t,r,n){if(e){var a=wu(e),i=f(Hu,f(Hu,a,n),t),o=f(Uu,i,r)?L(f(Hu,a,t),f(qu,r,i)):L(Gu,r),u=o.a,s=o.b,c=d(zu,e/2|0,t,s,n),l=c.a,h=c.b;return L(f($u,u,l),h)}return L(Gu,r)}),Yu=Fa(f(Va,2,cu)),Wu=n(function(e,t,r){return d(zu,f(su,2,Yu),e,t,r)}),Ju=wu(1),Qu=r(function(e,t){return e}),Xu=n(function(e,t,r){return l(Ra,Qu(e),t,f(Ai,1,r))}),Zu=function(e){return l(Xu,Hu(wu(fu)),Ju,e)},es=n(function(e,t,r){if(e){var n=l(Wu,Zu(e),t,r),a=n.a,i=n.b,o=l(es,e-1,i,r),u=o.a,s=o.b;return L(f($u,a,u),s)}return l(Wu,Zu(e),t,r)}),ts=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},rs=r(function(e,t){if(R(t,Gu))return ci;var r=Ti(ts(e))-Ti(ts(t))+1,n=l(es,f(ei,0,r),Au(e),Au(t)),a=n.a,i=n.b;return si(L(f(iu,f(Ku,Vu(e),Vu(t)),Ou(a)),f(iu,Vu(e),Ou(i))))}),ns=f(Hu,wu(2),wu(2147483648)),as=xr,is=function(e){return f(as,e,"")},os=Pn,us=n(function(e,t,r){return e<=0?r:l(us,e>>1,U(t,t),1&e?U(r,t):r)}),ss=r(function(e,t){return l(us,e,t,"")}),cs=n(function(e,t,r){return U(f(ss,e-Ro(r),is(t)),r)}),fs=te,ls=Ar,ds=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},hs=r(function(e,t){for(;;){if(t<16)return f(ka,ds(t),e);var r=f(ka,ds(f(ls,16,t)),e),n=t/16|0;e=r,t=n}}),ps=function(e){return fs(e<0?f(ka,P("-"),f(hs,yr,-e)):f(hs,yr,e))},gs=function(e){var t=f(rs,e,ns);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=ps(Iu(a));return R(n,wu(0))?i:U(gs(n),l(cs,8,P("0"),i))},vs=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,Jo(yr))?"0":gs(Qo(t));default:var t=e.a;return"-"+vs(f(Hu,wu(-1),e))}},ys=function(e){return l(cs,64,P("0"),e)},ms=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=ys(ps(a)),c=function(e){return U(e,n)}(ys(ps(u)));return x(a+32+(Ro(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},bs=Dr,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))))}),Es=n(function(e,t,n){return l(bs,r(function(t,r){return l(Cs,e,yi(t),r)}),t,n)}),Ss=function(e){return $a(l(Es,ka,yr,e))},Ts=function(e){return f(Ri,"",f(xa,f(Io,ps,f(cs,2,P("0"))),Ss(e)))},ws=function(e){return 64-f(ls,64,e)},Is=function(e){return U(e,f(ss,ws(Ro(e)),"0"))},As=function(e){return L(si(Ro(e)/2|0),Is(e))},Bs=function(e){return L(ci,ys(e))},ks=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Ns=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"}},Rs=Ur,$s=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(as,P("1"),r),!0);case"1":return L(f(as,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(as,P("0"),r),!1);case"1":return L(f(as,P("1"),r),!0);default:break e}return L(r,!0)});return l(Rs,t,L("",!1),e).a},_s=function(e){return l(Rs,ka,yr,e)},Ls=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(_o,e,t),i=f(ka,l($o,0,e,t),r);e=n,t=a,r=i}}),xs=r(function(e,t){return e&&""!==t?l(Ls,e,t,yr):M([t])}),Ps=function(e){var t=function(){var t=_s(vs(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(Io,$s,f(cs,256,P("1"))))}var r=t;return L(r,f(cs,256,P("0")))}(),r=t.a,n=t.b;return fs(f(xa,ks,f(xs,4,n(f(Ri,"",f(xa,Ns,r))))))},Ds=function(e){return{$:"Hex",a:e}},Us=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Bs(t);case"UintE":var r=e.a;return Bs(vs(r));case"IntE":var n=e.a;return Bs(Ps(n));case"BoolE":return Bs(e.a?"1":"0");case"DBytesE":var a=e.a.a;return As(a);case"BytesE":var a=e.a.a;return Bs(Ko(a));case"StringE":var i=e.a;return As(Ts(i));case"ListE":var o=e.a;return function(e){var t=e.a;return As(t)}(Xt()(o));default:var i=e.a;return Bs(Ko(i))}};try{var Os=Xt();Xt=function(){return Os}}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 Ms=Pr,Fs=function(e){return 1===Ro(e)?f(Ms,"0",e):e},Vs=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(ka,n,r);e=i,t=o,r=u}}}),Ks=r(function(e,t){return $a(l(Vs,e,t,yr))}),Hs=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(Ks,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(Hs,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),js=r(function(e,t){return l(Hs,0,e,t)}),qs=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),Gs=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 Pt(e.a)}},zs={$:"LE"},Ys=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,zs));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,zs));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,zs));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,zs));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,zs));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,zs));case"Seq":var i=e.b;return l(Ws,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),Ws=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Ys,n,t,r);e=i,t=o,r=u}}),Js=Dt,Qs=r(function(e,t){return{$:"Seq",a:e,b:t}}),Xs=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+Gs(r),i=n;e=a,t=i}}),Zs=function(e){return f(Qs,f(Xs,0,e),e)},ec=function(e){return{$:"U8",a:e}},tc=ec,rc=r(function(e,t){return _(e,t)<0?e:t}),nc=hr,ac=function(e){return{$:"Bytes",a:e}},ic=ac,oc=function(e){return Js(Zs(f(xa,ic,$a(e))))},uc=Pt,sc=r(function(e,t){var r=e.a;return f(zn,r,t)}),cc=function(e){return{$:"Decoder",a:e}},fc=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}}),lc=r(function(e,t){return cc(f(fc,e,t))}),dc=cc(Yn),hc=r(function(e,t){if("Just"===t.$){return t.a}return e}),pc=function(e){return{$:"Done",a:e}},gc=function(e){return{$:"Loop",a:e}},vc=r(function(e,t){var n=t.a;return cc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),yc=function(e){return cc(r(function(t,r){return L(r,e)}))},mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?yc(pc($a(n))):f(vc,function(e){return gc(L(r-1,f(ka,e,n)))},e)}),bc=function(e){return f(hc,yr,f(sc,f(lc,L(uc(e),yr),mc(dc)),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))}),Ec=r(function(e,t){return l(Cc,os,e,t)}),Sc=f(Ai,0,4),Tc=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}}),wc=xt,Ic=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),Ac=function(e){return f(Ic,f(Io,wc,os(4294967295)),e)},Bc=r(function(e,t){return 5*t+e}),kc=4294967295>>>32-Ha,Nc=ar,Rc=n(function(e,t,r){for(;;){var n=kc&t>>>e,a=f(Nc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Nc,kc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),$c=function(e){return e>>>5<<5},_c=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,$c(r))>-1?f(Nc,kc&e,i):l(Rc,n,e,a))}),Lc=r(function(e,t){var r=f(_c,e,t);if("Just"===r.$){return r.a}return L(0,0)}),xc=n(function(e,t,r){var n=f(Bc,e,t);return f(Lc,n,r)}),Pc=ir,Dc=a(function(e,t,r,n){var a=kc&t>>>e,i=f(Nc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Dc,e-Ha,t,r,o);return l(Pc,a,za(u),n)}var s=i.a,c=l(Pc,kc&t,r,s);return l(Pc,a,Ga(c),n)}),Uc=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,$c(n))>-1?d(Ma,n,a,i,l(Pc,kc&e,t,o)):d(Ma,n,a,d(Dc,a,e,t,i),o)}),Oc=n(function(e,t,r){return l(Uc,e,t,r)}),Mc=a(function(e,t,r,n){var a=f(Bc,e,t);return l(Oc,a,r,n)}),Fc=Dn,Vc=r(function(e,t){return l(Cc,Fc,e,t)}),Kc=function(e){var t=l(La,r(function(t,n){var a={d0:l(xc,0,t,e.state),d1:l(xc,1,t,e.state),d2:l(xc,2,t,e.state),d3:l(xc,3,t,e.state),d4:l(xc,4,t,e.state)},i=r(function(e,r){return d(Mc,e,t,f(Vc,f(Tc,e,a),f(Ec,Ac(f(Tc,f(ls,5,e+1),a)),f(Tc,f(ls,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Sc);return D(e,{state:t})},Hc=L(0,0),jc=function(e){return{current:Hc,lfsrstate:1,state:e,x:1,y:0}},qc=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},Gc=L(1,0),zc=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),Yc=r(function(e,t){if(e){var n=f(zc,1,t);return l(Cc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),Wc=r(function(e,t){var r=f(ls,32,e/32|0),n=f(zc,r,t),a=f(ls,32,e);return f(Yc,a,n)}),Jc=n(function(e,t,r){var n=f(_c,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(Uc,e,t(a),r)}),Qc=n(function(e,t,r){return l(Jc,e,Vc(t),r)}),Xc=a(function(e,t,r,n){var a=f(Bc,e,t);return l(Qc,a,r,n)}),Zc=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),sf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(rc,n,r),i=f(xa,function(e){return f(uf,e,g)},f(Ai,0,a)),o=of(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(js,i.outputLen,l(v,g,yr,i.outputLen))},df=function(e){return{$:"KS",a:e}},hf=function(e){var t=e.a;return df({config:t,inputLength:0,partial:yr,state:f(ui,25,Qu(Hc))})},pf=function(e){return cc(Wn(e))},gf=Js(Zs(yr)),vf=r(function(e,t){var n=t.a;return cc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),yf=r(function(e,t){return f(vf,function(e){return pf(t)},pf(e))}),mf=r(function(e,t){return f(hc,gf,f(sc,f(yf,e,uc(t)-e),t))}),bf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=uc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+uc(e)}),0,i),a)>-1))return df(D(n,{inputLength:uc(e)+n.inputLength,partial:i}));var o=oc(i),u=f(hc,gf,f(sc,pf(a),o)),s=bc(u),c=f(ff,s,n.state),d=of(c),h=f(mf,a,o),p=gf,g=df(D(n,{inputLength:uc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Cf=r(function(e,t){return lf(f(bf,Js(Zs(f(xa,tc,t))),hf(e)))}),Ef=Cf(qs),Sf=function(e){return Ds(f(Ri,"",f(xa,f(Io,ps,Fs),f(js,4,Ef(f(xa,yi,_s(e)))))))},Tf=function(e){return f(Vo,"0x",e)||f(Vo,"0X",e)?e:"0x"+e},wf=function(e){var t=e.a;return Tf(t)},If=r(function(e,t){var r=ms(f(xa,Us,t)),n=function(e){return U(e,r)}(Ko(wf(Sf(e))));return Ds(n)}),Af=function(e){return{data:si(f(If,"poke()",yr)),decoder:Wo(Fo),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Bf=r(function(e,t){return{$:"Trade",a:e,b:t}}),kf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Nf={$:"Descending"},Rf=function(e){return"Ascending"===e.$?Nf:lo},$f=function(e){return d(kf,e,go,bo,yr)},_f=r(function(e,t){return L(t.a,e(t.b))}),Lf=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(kf,t,go,bo,M([da(f(Bf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(_f,Rf,t.orderBy):L(a,lo);return $f(D(t,{orderBy:i}));default:return $f(t)}}),xf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},Pf=yn,Df=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=xf(Af(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(To,a,n);return d(yo,t,go,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(yo,t,go,bo,M([da(f(Bf,o,u))]));case"TradeTableMsg":var s=e.a,c=f(Lf,s,t.tradeTable);return d(yo,D(t,{tradeTable:c.model}),f(Pf,Eo,c.cmd),f(Bo,Eo,c.chainCmd),f(xa,Ji(Eo),c.appCmds));default:return Co(t)}}),Uf={$:"BottomRight"},Of={$:"ShouldBeImpossible"},Mf=lr,Ff=function(e){return qi(e)},Vf=r(function(e,t){f(Mf,e,t);return{align:Uf,label:"unexpectedError",mainParagraphs:M([M([Ff(e)])]),noticeType:Of}}),Kf=function(e){var t=e.a;return Tf(t)},Hf=ye,jf=f(Io,Kf,Hf),qf=f(Io,vs,f(Io,Tf,Hf)),Gf=f(Io,wf,Hf),zf=f(Io,ps,f(Io,Tf,Hf)),Yf=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),Wf=un,Jf=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},Qf=function(e){return Jf(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(hc,Wf,r))},f(Yf,function(e){e.a;return!R(e.b,ci)},e)))},Xf=function(e){return Qf(M([L("to",f(Ao,jf,e.to)),L("from",f(Ao,jf,e.from)),L("gas",f(Ao,zf,e.gas)),L("gasPrice",f(Ao,qf,e.gasPrice)),L("value",f(Ao,qf,e.value)),L("data",f(Ao,Gf,e.data)),L("nonce",f(Ao,zf,e.nonce))]))},Zf=function(e){return{$:"TxSentry",a:e}},el=ye,tl=r(function(e,t){return Jf(M([L("ref",el(e)),L("txParams",t)]))}),rl=function(e){return{$:"Signing",a:e}},nl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:rl(e)}}),al={$:"Black"},il=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),ol={$:"RBEmpty_elm_builtin"},ul={$:"Red"},sl=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(il,ul,t,r,h(il,al,c,f,l,d),h(il,al,i,o,u,s))}return h(il,e,i,o,h(il,ul,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(il,ul,c,f,h(il,al,g,v,y,m),h(il,al,t,r,d,a))}return h(il,e,t,r,n,a)}),cl=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(il,ul,e,t,ol,ol);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Eu,e,a).$){case"LT":return h(sl,n,a,i,l(cl,e,t,o),u);case"EQ":return h(il,n,a,t,o,u);default:return h(sl,n,a,i,o,l(cl,e,t,u))}}),fl=n(function(e,t,r){var n=l(cl,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(il,al,a,i,o,u)}return n}),ll=n(function(e,t,r){var n=e.a,a=Xf(r),i=l(fl,n.ref,f(nl,r,t),n.txs);return L(Zf(D(n,{ref:n.ref+1,txs:i})),f(Pf,n.tagger,n.outPort(f(tl,n.ref,a))))}),dl=ll,hl=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,go,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(dl,n,i,o))}return x(ci,go,M([f(Vf,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),pl=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),gl=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),vl={$:"Seller"},yl=function(e){return{$:"Posix",a:e}},ml=yl,bl={autoabortInterval:ml(0),autorecallInterval:ml(0),autoreleaseInterval:ml(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:vl},Cl=function(e){return{$:"TokenValue",a:e}},El=function(e){return e.a},Sl=r(function(e,t){return f(hc,Gu,f(Ao,Qa,f(rs,e,t)))}),Tl=r(function(e,t){return Cl(f(Sl,El(e),wu(t)))}),wl=function(e){return f(Tl,e,12)},Il=function(e){return f(Tl,e,3)},Al=Cl(wu(0)),Bl=r(function(e,t){var r=Al;return{abortPunishment:wl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Il(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),kl=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Nl=qr,Rl=function(e){var t=kl(f(Nl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Ro(e)-1-r;return L(U(f(Po,r,e),f(_o,r+1,e)),n)},$l=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 yr}}),_l=function(e){var t=e.a,r=f($l,Ja(0),t);return Jo(r.b?t:yr)},Ll=Z,xl=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}}}),Pl=n(function(e,t,r){var n=f(xl,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(js,e,r),l(Pl,e,t,n)):yr}),Dl=r(function(e,t){return l(Pl,e,e,t)}),Ul=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Ao,ka(a),r)});return f(La,t,si(yr))}(Ua),Ol=function(e){return f(Ao,f(Da,_l,Jo),Ul(f(xa,f(Io,$a,f(Io,fs,Ll)),f(Dl,7,$a(e)))))},Ml=Q,Fl=function(e){var t=_s(Ml(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Ao,iu(vu),Ol(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Ao,iu(yu),Ol(r))}return ci;default:var r=t;return f(Ao,iu(yu),Ol(r))}},Vl=function(e){var t=function(e){return!f(ls,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(hc,0,kl(r)))}},Kl=function(e){return f(Hu,e,e)},Hl=wu(2),jl=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Ju;case"Neg":return nu;default:if(R(r,Ju))return f(Hu,e,t);if(Vl(r)){var n=e,a=Kl(t),i=f(Sl,r,Hl);e=n,t=a,r=i;continue e}var n=f(Hu,t,e),a=Kl(t),i=f(Sl,f(qu,r,Ju),Hl);e=n,t=a,r=i;continue e}}),ql=r(function(e,t){return l(jl,Ju,e,t)}),Gl=function(e){if(""===e)return ci;var t=Rl(e),r=t.a,n=t.b,a=Fl(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(Hu,o,f(ql,wu(10),wu(i)));return si(u)},zl=function(e){return f(Ao,Cl,Gl(e))},Yl=jr,Wl=function(e){for(;;){if(f(Yl,".",e))return l($o,0,-1,e);{if(!f(Yl,"0",e))return""===e?"0":e;e=l($o,0,-1,e)}}},Jl=f(Da,f(cs,7,P("0")),Ni),Ql=function(e){return f(Ri,"",e)},Xl=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Ql(f(ka,Ni(n),f(xa,Jl,a)))}return"0"},Zl=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Xl(t);default:var t=e.a;return"-"+Xl(t)}},ed=r(function(e,t){return e<1?t:l($o,0,-e,t)}),td=function(e){var t=l(cs,18,P("0"),Zl(e)),r=f(ed,18,t)+"."+f(Mo,18,t);return function(e){return""===e?"0":e}(Wl(r))},rd=r(function(e,t){var r=td(t),n=kl(f(Nl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Po,a+1+e,r):f(Po,a,r)}),nd=r(function(e,t){if("Nothing"===e.$)return td(El(t));var r=e.a;return f(rd,r,El(t))}),ad=ee,id=function(e){var t=ad(f(nd,ci,e));if("Just"===t.$){return t.a}f(Mf,"Error converting tokenValue to float: string -> float failed",e);return 0},od=function(e){if(""===e)return fi("You must specify a trade amount.");var t=zl(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return id(r)<1?fi("Trade amount can't be less than 1."):li(r)},ud=function(e){if(""===e)return fi("You must specify a fiat price.");var t=Fl(e);if("Nothing"===t.$){var r=ad(e);return fi("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 li(n)},sd=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),cd=function(e){return""===e},fd=function(e){return cd(e)?ci:si(e)},ld=function(e){return f(sd,"You must specify a fiat type.",fd(e))},dd=function(e){return""===e?fi("Must specify a payment method."):li(e)},hd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),pd=g(hd,ci,ci,ci,ci,ci,ci,ci),gd=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},vd=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),yd={$:"Custom"},md=r(function(e,t){return{info:t,type_:e}}),bd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Cd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),Ed=function(e){return e.a},Sd=function(e){return p(bd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(md,yd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Cd,function(e){return D(pd,{daiAmount:si(e)})},od(e.daiAmount)),f(Cd,function(e){return D(pd,{fiatAmount:si(e)})},ud(e.fiatAmount)),f(Cd,function(e){return D(pd,{fiatType:si(e)})},ld(e.fiatType)),f(Cd,function(e){return D(pd,{paymentMethod:si(e)})},dd(e.paymentMethod)),gd(d(vd,function(e){return Ed(e)>0?li(e):fi(D(pd,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return Ed(e)>0?li(e):fi(D(pd,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return Ed(e)>0?li(e):fi(D(pd,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Td=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},wd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Id=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Ad=function(e){var t=Sd(e.inputs),r=function(){return R(e.errors,pd)?pd:"Ok"===t.$?pd:t.a}();return D(e,{createParameters:l(wd,Bl,Td(e.wallet),Id(t)),errors:r})},Bd=r(function(e,t){return Ad(D(t,{inputs:e}))}),kd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Nd=function(e){return d(kd,f(Bd,bl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:pd,inputs:bl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),go,bo,yr)},Rd=a(function(e,t,r,n){return la(d(pl,e,t,r,n))}),$d=function(e){return{$:"Address",a:e}},_d=f(Io,Ko,f(Io,Ml,$d)),Ld=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return _d("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return _d("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return _d("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return _d("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return _d("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},xd=function(e){return _d("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},Pd=function(e){return{$:"AddressE",a:e}},Dd=Pd,Ud=function(e){return{$:"UintE",a:e}},Od=Ud,Md=n(function(e,t,r){return{data:si(f(If,"approve(address,uint256)",M([Dd(t),Od(r)]))),decoder:Wo(Fo),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Fd=function(e){return f(Tl,e,200)},Vd=r(function(e,t){return Cl(f($u,El(e),El(t)))}),Kd=function(e){var t=f(Tl,e.tradeAmount,200);return f(Vd,e.pokeReward,f(Vd,Fd(e.tradeAmount),f(Vd,t,function(){return"Buyer"===e.initiatorRole.$?Il(e.tradeAmount):e.tradeAmount}())))},Hd=Mi(ya),jd=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),qd=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),Gd=Xn,zd=Qn,Yd=function(e){return f(zd,{caseInsensitive:!1,multiline:!1},e)},Wd=Jn,Jd=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Qd=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}}),Xd=r(function(e,t){return!f(Qd,f(Da,Du,e),t)}),Zd=Xd(Ua),eh=q,th=r(function(e,t){if("Ok"===t.$){return t.a}return e}),rh=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),nh=f(La,rh(ka),li(yr)),ah=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},ih=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(su,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(su,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(su,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(su,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(su,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(su,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(su,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(su,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(su,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(su,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(su,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(su,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(su,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(su,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(su,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(is(s)+" is not a valid hexadecimal character.")}}}),oh=function(e){if(cd(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(Vo,"-",e)){var t=f(hc,yr,ah(_s(e)));return f(Uo,Oo,l(ih,Ti(t)-1,t,0))}return l(ih,Ro(e)-1,_s(e),0)}();return f(Cd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},uh=function(e){var t=_s(e);return function(e){return L(t,e)}(f(th,yr,nh(f(xa,oh,f(_i,"",f(Ri,"",f(xa,f(Io,ps,Fs),f(js,20,Ef(f(xa,f(Io,eh,yi),t))))))))))},sh=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=uh(Ko(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!Jd(e)&&Zd(o)},ch=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9a-f]{40}$"))),fh=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9A-F]{40}$"))),lh=function(e){return'"'+e+'"'},dh=function(e){var t=Ko(e),r=f(Po,24,t),n=f(Mo,40,e);return 64===Ro(t)&&f(ki,Ja(P("0")),r)?fh(n)||ch(n)?li($d(n)):sh(n)?li($d(n)):fi("Given address "+lh(e)+" failed the EIP-55 checksum test."):40!==Ro(t)?fi("Given address "+lh(e)+" is not the correct length."):Jd(t)?fh(t)||ch(t)?li($d(t)):sh(t)?li($d(t)):fi("Given address "+lh(e)+" failed the EIP-55 checksum test."):fi("Given address "+lh(e)+" contains invalid hex characters.")},hh=ko(function(e){var t=e.a,r=e.b;return f(Uo,f(xo,t,r),dh(Do(r)))}),ph=r(function(e,t){var r=t.a;return ko(function(t){var n=t.a,a=t.b;return r(f(No,n,f(_o,64*e,a)))})}),gh=Jr,vh=r(function(e,t){return f(gh,"data",Wo(f(ph,e,t)))}),yh=Qr,mh=r(function(e,t){return f(gh,"topics",f(yh,e,Wo(t)))}),bh=function(e){return f(Ao,f(Io,$a,f(Ra,r(function(e,t){return f($u,wu(e),f(Hu,t,ns))}),Gu)),Ul(f(xa,f(Io,$a,f(Io,fs,f(Io,oh,Id))),f(Dl,8,$a(e)))))},Ch=function(e){var t=_s(Ml(e));e:for(;;){if(!t.b)return ci;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(Ao,Hu(wu(-1)),bh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Ao,Hu(wu(-1)),bh(a))}return ci;case"+":if(t.b.b){var a=t.b;return bh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return bh(a)}t.b;return ci}break e;default:break e}}var a=t;return bh(a)},Eh=ko(function(e){var t=e.a,r=e.b;return f(Uo,f(xo,t,r),f(sd,"Error Decoding Uint into BigInt",Ch(Tf(Do(r)))))}),Sh=f(Hd,f(mh,1,hh),f(Hd,f(vh,1,hh),f(Hd,f(vh,0,Eh),Fi(jd)))),Th=nn,wh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Ih=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(Th,e,Jf(M([L("data",Hf(t.data)),L("topics",f(wh,Gf,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Ah=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Bh=r(function(e,t){return f(Uo,function(e){return e.id},f(Ah,function(e){return f(Cd,Di,f(Ih,Sh,e).returnData)},f(sd,"No log found from that factoryAddress in that txReceipt",kl(f(Yf,function(t){return R(f(Io,Kf,Ml)(t.address),f(Io,Kf,Ml)(Ld(e)))},t.logs)))))}),kh=n(function(e,t,r){return{data:si(f(If,"allowance(address,address)",M([Dd(t),Dd(r)]))),decoder:Wo(Eh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Nh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Rh=function(e){switch(e.$){case"BlockNum":var t=e.a;return Hf(Tf(ps(t)));case"EarliestBlock":return Hf("earliest");case"LatestBlock":return Hf("latest");default:return Hf("pending")}},$h=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return Qf(M([L("to",f(Ao,jf,t)),L("from",f(Ao,jf,r)),L("gas",f(Ao,zf,n)),L("gasPrice",f(Ao,qf,a)),L("value",f(Ao,qf,i)),L("data",f(Ao,Gf,o))]))},_h=function(e){return{$:"BadBody",a:e}},Lh=function(e){return{$:"BadStatus",a:e}},xh=function(e){return{$:"BadUrl",a:e}},Ph={$:"NetworkError"},Dh={$:"Timeout"},Uh=rn,Oh=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(xh(r));case"Timeout_":return fi(Dh);case"NetworkError_":return fi(Ph);case"BadStatus_":var n=t.a,a=t.b;return fi(Lh(n.statusCode));default:var n=t.a,a=t.b,i=f(Uh,f(gh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(_h(Di(u)))}}),Mh=n(function(e,t,r){return Jf(M([L("id",el(e)),L("jsonrpc",Hf("2.0")),L("method",Hf(t)),L("params",f(wh,Ua,r))]))}),Fh=ol,Vh=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Eu,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),Kh=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},Hh=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(il,ul,p,g,h(il,al,r,n,h(il,ul,i,o,u,s),v),h(il,al,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(il,al,r,n,h(il,ul,i,o,u,s),h(il,ul,f,l,d,m))}return e},jh=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(il,ul,i,o,h(il,al,s,c,f,l),h(il,al,r,n,d,h(il,ul,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(il,al,r,n,h(il,ul,i,o,C,d),h(il,ul,g,v,y,m))}return e},qh=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(il,r,u,s,c,h(il,ul,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 jh(t)}break e}o.a,o.d;return jh(t)}break e}return t}),Gh=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(il,t,r,n,Gh(a),u)}var s=Hh(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(sl,c,f,l,Gh(d),p)}return ol}return h(il,t,r,n,Gh(a),u)}return ol},zh=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return ol;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(il,r,n,a,f(zh,e,i),o)}var s=Hh(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(sl,c,l,d,f(zh,e,p),v)}return ol}return h(il,r,n,a,f(zh,e,i),o)}return f(Yh,e,g(qh,e,t,r,n,a,i,o))}),Yh=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(R(e,n)){var u=Kh(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(sl,r,s,c,i,Gh(o))}return ol}return h(sl,r,n,a,i,f(zh,e,o))}return ol}),Wh=r(function(e,t){var r=f(zh,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(il,al,n,a,i,o)}return r}),Jh=n(function(e,t,r){var n=t(f(Vh,e,r));if("Just"===n.$){var a=n.a;return l(fl,e,a,r)}return f(Wh,e,r)}),Qh=function(e){return"Just"===e.$},Xh=gn,Zh=vn,ep=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),tp=function(e){return{$:"BadUrl_",a:e}},rp=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),np={$:"NetworkError_"},ap=function(e){return{$:"Receiving",a:e}},ip=function(e){return{$:"Sending",a:e}},op={$:"Timeout_"},up=function(e){return f(ta,"application/json",f(xi,0,e))},sp=n(function(e,t,r){return up(l(Mh,e,t,r))}),cp=f(ea,"",Ua),fp=Te,lp=Se,dp=function(e){if("Ok"===e.$){var t=e.a;return lp(t)}var r=e.a;return fp(r)},hp=function(e){return l(Zn,gr,dp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},pp=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return hp({body:l(sp,1,r,n),headers:yr,method:"POST",resolver:cp(Oh(a)),timeout:ci,url:t})},gp=n(function(e,t,r){return pp({decoder:t.decoder,method:"eth_call",params:M([$h(t),Rh(r)]),url:e})}),vp={$:"LatestBlock"},yp=r(function(e,t){return l(gp,e,t,vp)}),mp=function(e){return{$:"Perform",a:e}},bp=sn,Cp=lp(gr),Ep=r(function(e,t){return f(bp,function(t){return lp(e(t))},t)}),Sp=n(function(e,t,r){return f(bp,function(t){return f(bp,function(r){return lp(f(e,t,r))},r)},t)}),Tp=function(e){return l(La,Sp(ka),lp(yr),e)},wp=r(function(e,t){var r=t.a;return Be(f(bp,Xh(e),r))}),Ip=n(function(e,t,r){return f(Ep,function(e){return gr},Tp(f(xa,wp(e),t)))}),Ap=n(function(e,t,r){return lp(gr)}),Bp=r(function(e,t){var r=t.a;return mp(f(Ep,e,r))});pn.Task=Pe(Cp,Ip,Ap,Bp);var kp=Ue("Task"),Np=cn,Rp=r(function(e,t){return kp(mp(f(Np,f(Da,f(Da,lp,e),fi),f(bp,f(Da,f(Da,lp,e),li),t))))}),$p=a(function(e,t,r,n){return f(Rp,n,f(yp,Nh(eo(e)),l(kh,xd(e),t,r)))}),_p=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return _d("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return _d("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return _d("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return _d("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return _d("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Lp=function(e){return{$:"BoolE",a:e}},xp=Lp,Pp=function(e){return{$:"StringE",a:e}},Dp=Pp,Up=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:si(f(If,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([Dd(t),Dd(r),xp(n),Od(a),Od(i),Od(o),Od(u),Od(s),Od(c),Od(l),Od(d),Dp(h),Dp(p)]))),decoder:Wo(hh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},Op=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:si(f(If,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([Dd(t),Dd(r),xp(n),Od(a),Od(i),Od(o),Od(u),Od(s),Od(c),Od(l),Od(d),Dp(h),Dp(p)]))),decoder:Wo(hh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},Mp=r(function(e,t){return{paymentMethods:t,price:e}}),Fp=function(e){return Hf(Zl(e))},Vp=function(e){return f(wh,Ua,M([Hf(e.fiatType),Fp(e.amount)]))},Kp=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},Hp=function(e){return Jf(M([L("type",Hf(Kp(e.type_))),L("info",Hf(e.info))]))},jp=function(e){var t=Vp(e.price),r=f(wh,Hp,e.paymentMethods);return f(xi,0,Jf(M([L("paymentmethods",r),L("price",t)])))},qp=r(function(e,t){return D(t,{value:si(e)})}),Gp=function(e){return wu(Ed(e))},zp=function(e){return f(Sl,Gp(e),wu(1e3))},Yp=r(function(e,t){var r=function(){return"Token"===e.$?Up:Op}();return function(){return"Native"===e.$?qp(El(Kd(t))):Ua}()(r(Ld(e))(t.initiatorAddress)(_p(e))(R(t.initiatorRole,vl))(El(t.tradeAmount))(El(Il(t.tradeAmount)))(El(wl(t.tradeAmount)))(El(t.pokeReward))(zp(t.autorecallInterval))(zp(t.autoabortInterval))(zp(t.autoreleaseInterval))(El(Fd(t.tradeAmount)))(jp(f(Mp,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Wp=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),Jp=function(e){return{$:"CreateNeedsSig",a:e}},Qp=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Xp=r(function(e,t){var r=xf(f(Yp,e,t)),n={onBroadcast:ci,onMined:si(L(Wp(e),ci)),onSign:si(Qp(e))};return L(si(Jp(e)),f(To,n,r))}),Zp=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),eg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),tg=function(e){return{$:"ApproveNeedsSig",a:e}},rg=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),ng=r(function(e,t){return{$:"Confirm",a:e,b:t}}),ag=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),ig={$:"NoOp"},og=function(e){return{appCmds:yr,chainCmd:bo,cmd:go,model:e}},ug=function(e){return Ll(Zl(e))},sg={$:"Error"},cg=r(function(e,t){f(Mf,e+" fetch error",t);return{align:Uf,label:"web3FetchError",mainParagraphs:M([M([Ff('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:sg}}),fg=r(function(e,t){return{align:Uf,label:"web3MiningError",mainParagraphs:M([M([Ff('Error mining "'+e+'" transaction: '+t)])]),noticeType:sg}}),lg={$:"Caution"},dg=r(function(e,t){return{align:Uf,label:"web3SigError",mainParagraphs:M([M([Ff('Error signing "'+e+'" transaction: '+t)])]),noticeType:lg}}),hg={$:"KovanDai"},pg=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(hg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},gg=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},vg=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),yg=function(e){return f(vg,pg,gg(e))},mg=r(function(e,t){return 1-e(1-t)}),bg=function(e){return f(su,e,5)},Cg=mg(bg),Eg={easing:Cg,offset:12,speed:200},Sg=function(e){return{$:"External",a:e}},Tg=function(e){return{$:"Internal",a:e}},wg=function(e){return{$:"NotFound",a:e}},Ig=function(e){for(;;){e=e.a}},Ag=r(function(e,t){return kp(mp(f(Ep,e,t)))}),Bg={$:"Http"},kg={$:"Https"},Ng=Kr,Rg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),$g=i(function(e,t,r,n,a){if(cd(a)||f(Ng,"@",a))return ci;var i=f(Nl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=Ll(f(_o,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Rg,e,f(Po,o,a),s,t,r,n))}return si(p(Rg,e,a,ci,t,r,n))}),_g=a(function(e,t,r,n){if(cd(n))return ci;var a=f(Nl,"/",n);if(a.b){var i=a.a;return h($g,e,f(_o,i,n),t,r,f(Po,i,n))}return h($g,e,"/",t,r,n)}),Lg=n(function(e,t,r){if(cd(r))return ci;var n=f(Nl,"?",r);if(n.b){var a=n.a;return d(_g,e,si(f(_o,a+1,r)),t,f(Po,a,r))}return d(_g,e,ci,t,r)}),xg=r(function(e,t){if(cd(t))return ci;var r=f(Nl,"#",t);if(r.b){var n=r.a;return l(Lg,e,si(f(_o,n+1,t)),f(Po,n,t))}return l(Lg,e,ci,t)}),Pg=function(e){return f(Vo,"http://",e)?f(xg,Bg,f(_o,7,e)):f(Vo,"https://",e)?f(xg,kg,f(_o,8,e)):ci},Dg=Wt,Ug=Gt(zt),Og=sa,Mg=r(function(e,t){return L(e,t)}),Fg=_r,Vg=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=Tu(r-n),o=f(ei,1,Fg(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),Kg=r(function(e,t){var n=r(function(t,r){return Tp(f(xa,Og(0),d(Vg,e.speed,e.easing,t,r-e.offset)))});return f(bp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(Sp,Mg,Ug,Dg(t)))}),Hg=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Td(t.wallet),yg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d($p,a,n.address,Ld(eo(a)),Zp(a));return d(kd,t,i,bo,yr)}return og(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(kd,D(t,{inputs:D(u,{userRole:o})}),go,bo,M([function(){return"Buyer"===o.$?d(Rd,"create offer type changed","input","sell dai",0):d(Rd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return og(f(Bd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return og(f(Bd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return og(f(Bd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return og(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return og(f(Bd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return og(f(Bd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return og(f(Bd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return og(f(Bd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(kd,(g?Bd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),go,bo,g?M([d(Rd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=Sd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Bl,n,m);return og(D(t,{depositAmount:si(El(Kd(b))),txChainStatus:si(f(ng,v,b))}))}var C=y.a;return d(kd,D(t,{errors:C}),f(Rp,Qu(ig),function(){return f(Kg,D(Eg,{offset:60}),"inputError")}()),bo,yr);case"AbortCreate":return d(kd,D(t,{txChainStatus:ci}),go,bo,M([d(Rd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Xp,v,b);var e=v.a,r=function(){var t=xf(l(Md,xd(e),Ld(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(rg,e,b))};return f(To,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(xu,a,E),ba)?L(si(tg(e)),r):f(Xp,v,b)}return L(si(tg(e)),r)}(),T=S.a,w=S.b;return d(kd,D(t,{txChainStatus:T}),go,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return og(D(t,{txChainStatus:si(l(eg,a,b,A))}))}var B=I.a;return d(kd,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(xu,N,P),ba))return og($);var U=f(Xp,eo(a),b),T=U.a,w=U.b;return d(kd,D($,{txChainStatus:T}),go,w,yr)}return og($)}var O=k.a;return d(kd,t,go,bo,M([pa(f(cg,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return og(D(t,{txChainStatus:si(f(ag,v,A))}))}var B=I.a;return d(kd,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(kd,t,go,bo,M([pa(f(fg,"create",B))]))}var F=e.a,V=e.b.a,K=f(vg,ug,Id(f(Bh,F,V)));if("Just"===K.$){var H=K.a;return d(kd,t,go,bo,M([da(f(Bf,F,H))]))}return d(kd,t,go,bo,M([pa(f(Vf,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(kd,t,go,bo,M([ga]));case"NoOp":return og(t);default:var j=e.a;return d(kd,t,go,bo,M([j]))}}),jg={$:"Open"},qg=r(function(e,t){return f(Eu,Ed(e),Ed(t))}),Gg=r(function(e,t){return R(t.state.phase,jg)&&R(f(qg,t.derived.phaseEndTime,e),Ta)}),zg={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Yg=r(function(e,t){return{maxDai:t,minDai:e}}),Wg=f(Yg,ci,ci),Jg={$:"Expires"},Qg=function(e){return L({errors:Wg,filterFunc:Gg,inputs:zg,showCurrencyDropdown:!1,tradeTable:fo(L(Jg,lo)),wallet:e},go)},Xg=r(function(e,t){return D(t,{paymentMethod:e})}),Zg=r(function(e,t){return D(t,{paymentMethodTerms:e})}),ev=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return D(e,{inputs:f(Zg,r,f(Xg,"",e.inputs))})},tv=r(function(e,t){var r=f(Yf,nc(e),t.inputs.paymentMethodTerms);return D(t,{inputs:f(Zg,r,t.inputs)})}),rv=function(e){return D(e,{filterFunc:Gg,inputs:zg})},nv=function(e){return{$:"TradeTableMsg",a:e}},av=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),iv=function(e){return d(av,e,go,bo,yr)},ov=r(function(e,t){return D(t,{fiatType:e})}),uv=r(function(e,t){return D(t,{maxDai:e})}),sv=r(function(e,t){return D(t,{minDai:e})}),cv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return iv(D(t,{inputs:f(sv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return iv(D(t,{inputs:f(uv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return iv(D(t,{inputs:f(ov,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return iv(D(t,{inputs:(n?ov(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return iv(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return iv(D(t,{inputs:f(Xg,r,t.inputs)}));case"AddSearchTerm":return iv(ev(t));case"RemoveTerm":var a=e.a;return iv(f(tv,a,t));case"ResetSearch":return iv(rv(t));case"TradeTableMsg":var i=e.a,o=f(Lf,i,t.tradeTable);return d(av,D(t,{tradeTable:o.model}),f(Pf,nv,o.cmd),f(Bo,nv,o.chainCmd),f(xa,Ji(nv),o.appCmds));case"NoOp":return iv(t);default:var u=e.a;return d(av,t,go,bo,M([u]))}}),fv=a(function(e,t,r,n){return e(Jf(M([L("title",Hf(t)),L("body",function(){if("Nothing"===r.$)return Wf;var e=r.a;return Hf(e)}()),L("image",function(){if("Nothing"===n.$)return Wf;var e=n.a;return Hf(e)}())])))}),lv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},dv=function(e){return e.a+"="+e.b},hv=function(e){return e.b?"?"+f(Ri,"&",f(xa,dv,e)):""},pv=r(function(e,t){return"/"+(f(Ri,"/",e)+hv(t))}),gv=function(e){switch(e.$){case"Home":return f(pv,M(["DAIHard"]),yr);case"Create":return f(pv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(pv,M(["DAIHard","trade",lv(t),Ni(r)]),yr);case"Marketplace":return f(pv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(pv,M(["DAIHard","history",Kf(n)]),yr);default:return f(pv,yr,yr)}},vv={$:"NotFound"},yv=function(e){return{$:"AgentHistory",a:e}},mv={$:"Create"},bv={$:"Home"},Cv={$:"Marketplace"},Ev=function(e){return{$:"Parser",a:e}},Sv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Tv=r(function(e,t){return Ev(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Sv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),wv=f(Tv,"ADDRESS",f(Io,dh,Id)),Iv={$:"Eth"},Av={$:"Kovan"},Bv=f(Tv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Iv));case"keth":return si(Zi(Av));case"dai":return si(eo(Xi));case"kdai":return si(eo(hg));case"xdai":return si(Zi(to));default:return ci}}),kv=f(Tv,"NUMBER",Ll),Nv=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Sv,r,n,a,i,e(o))}),Rv=r(function(e,t){var r=t.a;return Ev(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,Nv(u),r(h(Sv,n,a,i,o,e)))})}),$v=function(e){return l(La,oo,yr,e)},_v=r(function(e,t){return $v(f(xa,e,t))}),Lv=function(e){return Ev(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 R(u,e)?M([h(Sv,f(ka,u,r),s,a,i,o)]):yr}return yr})},xv=r(function(e,t){var r=e.a,n=t.a;return Ev(function(e){return f(_v,n,r(e))})}),Pv=Ev(function(e){return M([e])}),Dv=f(xv,Lv("DAIHard"),function(e){return Ev(function(t){return f(_v,function(e){return(0,e.a)(t)},e)})}(M([f(Rv,bv,Pv),f(Rv,mv,Lv("create")),f(Rv,Bf,f(xv,Lv("trade"),f(xv,Bv,kv))),f(Rv,Cv,Lv("marketplace")),f(Rv,yv,f(xv,Lv("history"),wv)),f(Rv,function(e){return yv(e)},f(xv,Lv("history"),wv))]))),Uv=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 si(t.value)}return si(t.value)}return ci}},Ov=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,Ov(r))}return yr}return yr},Mv=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return Ov(r)}var r=t;return Ov(r)},Fv=Qt,Vv=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),Kv=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=Fv(n);if("Nothing"===o.$)return t;var u=o.a,s=Fv(i);if("Nothing"===s.$)return t;var c=s.a;return l(Jh,u,Vv(c),t)}return t}),Hv=function(e){if("Nothing"===e.$)return Fh;var t=e.a;return l(La,Kv,Fh,f(_i,"&",t))},jv=r(function(e,t){var r=e.a;return Uv(r(h(Sv,yr,Mv(t.path),Hv(t.query),t.fragment,Ua)))}),qv=function(e){return f(hc,vv,f(jv,Dv,e))},Gv=aa,zv=r(function(e,t){return f(Gv,e,gv(t))}),Yv=je("connectToWeb3",function(e){return Wf}),Wv=function(e){return Jf(M([L("event",Hf(e.event)),L("category",Hf(e.category)),L("label",Hf(e.label)),L("value",el(e.value))]))},Jv=r(function(e,t){return Jf(M([L("address",Hf(Kf(e))),L("signSeedMsg",Hf(t))]))}),Qv=je("gTagOut",Ua),Xv=je("genPrivkey",Ua),Zv=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),ey=n(function(e,t,r){return f(vg,_c(t),f(Ao,function(e){return e.trades},f(Zv,function(t){return R(t.factory,e)},r)))}),ty=je("notifyPort",Ua),ry=je("requestNotifyPermissionPort",function(e){return Wf}),ny=r(function(e,t){return D(t,{wallet:e})}),ay=r(function(e,t){return L(f(Bd,t.inputs,D(t,{wallet:e})),function(){var t=L(Td(e),yg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d($p,n,r.address,Ld(eo(n)),Zp(n))}return go}())}),iy=r(function(e,t){return D(t,{wallet:e})}),oy=function(e){return{$:"AllowanceFetched",a:e}},uy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Td(e),yg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(yg(e),si(i.factory))?d($p,a,n.address,i.creationInfo.address,oy):go}return go}())}),sy=function(e){return{$:"AgentHistoryModel",a:e}},cy=function(e){return{$:"CreateModel",a:e}},fy=function(e){return{$:"CreateMsg",a:e}},ly=function(e){return{$:"MarketplaceModel",a:e}},dy=function(e){return{$:"TradeModel",a:e}},hy=function(e){return{$:"TradeMsg",a:e}},py=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,go);case"CreateModel":var r=t.a,n=f(ay,e,r),a=n.a,i=n.b;return L(cy(a),f(Pf,fy,i));case"TradeModel":var o=t.a,u=f(uy,e,o),s=u.a,c=u.b;return L(dy(s),f(Pf,hy,c));case"MarketplaceModel":var l=t.a;return L(ly(f(iy,e,l)),go);default:var d=t.a;return L(sy(f(ny,e,d)),go)}}),gy=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),vy=function(e){return{$:"PartiallyLoadedTrade",a:e}},yy=r(function(e,t){return vy(g(gy,e,t,ci,ci,ci,ci,ci))}),my=function(e){return{$:"CurrentBlockFetched",a:e}},by=Yo(f(Io,Ko,oh)),Cy=function(e){return pp({decoder:by,method:"eth_blockNumber",params:yr,url:e})},Ey=function(e){return f(Rp,my,Cy(e))},Sy=r(function(e,t){return{address_:e,blocknum:t}}),Ty=function(e){return ko(function(t){return li(L(t,e))})},wy=n(function(e,t,r){var n=t.a,a=r.a;return ko(function(t){return f(Ah,function(t){var r=t.a,n=t.b;return f(Uo,_f(e(n)),a(r))},n(t))})}),Iy=r(function(e,t){return l(wy,r(function(e,t){return e(t)}),t,e)}),Ay=Wo(f(Iy,Eh,f(Iy,hh,Ty(Sy)))),By=r(function(e,t){return{data:si(f(If,"createdTrades(uint256)",M([Od(t)]))),decoder:Ay,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ky=n(function(e,t,r){return f(Rp,r,f(yp,Nh(e),f(By,Ld(e),t)))}),Ny=function(e){return{$:"CreationInfoFetched",a:e}},Ry=r(function(e,t){return l(ky,e,wu(t),Ny)}),$y=function(e){return{$:"EventSentryMsg",a:e}},_y=function(e){return{$:"BlockNumber",a:e}},Ly=function(e){return{$:"EventSentry",a:e}},xy=function(e){return{$:"Set_elm_builtin",a:e}},Py=xy(Fh),Dy=r(function(e,t){return L(Ly({blockNumber:ci,errors:yr,nodePath:t,pending:Py,ref:1,requests:Fh,tagger:e,watching:Py}),f(Rp,f(Io,_y,e),Cy(t)))}),Uy=function(e){return f(Dy,$y,Nh(e))},Oy=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),My=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},Fy=My(f(Oy,ci,ci)),Vy=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:jg,secureCommInfo:Fy,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),Ky=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Hy=n(function(e,t,r){var n=f(Ry,t,r),a=Uy(t),i=a.a,o=a.b;return d(Ky,l(Vy,f(yy,t,r),i,e),po(M([n,o,Ey(Nh(t))])),bo,M([ha]))}),jy=function(e){return{$:"LoadedTrade",a:e}},qy=r(function(e,t){var r=Uy(t.factory),n=r.a,a=r.b;return d(Ky,l(Vy,jy(t),n,e),po(M([a,Ey(Nh(t.factory))])),bo,M([ha]))}),Gy=function(e){return{data:si(f(If,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},zy=function(e){return{data:si(f(If,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yy=function(e){return{data:si(f(If,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Wy=r(function(e,t){return{data:si(f(If,"initiatorStatement(string)",M([Dp(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Jy=function(e){return{data:si(f(If,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Qy=function(e){return{data:si(f(If,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Xy=r(function(e,t){return{data:si(f(If,"responderStatement(string)",M([Dp(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Zy=r(function(e,t){return{amount:t,fiatType:e}}),em=f(qo,function(e){var t=Fl(e);if("Just"===t.$){var r=t.a;return Fi(r)}return Go("Can't convert that to a BigInt")},zo),tm=l(Mi,Zy,f(yh,0,zo),f(yh,1,em)),rm={$:"Bank"},nm={$:"Cash"},am=function(e){switch(e){case"cash":return si(nm);case"bank":return si(rm);case"custom":return si(yd);default:return ci}},im=f(qo,function(e){var t=am(e);if("Just"===t.$){var r=t.a;return Fi(r)}return Go("")},zo),om=l(Mi,md,f(gh,"type",im),f(gh,"info",zo)),um=oe,sm=function(e){var t=l(Mi,Mp,f(gh,"price",tm),f(gh,"paymentmethods",um(om)));return f(Uh,t,e)},cm=r(function(e,t){return{commPubkey:t,responder:e}}),fm=r(function(e,t){var n=r(function(t,r){return l($o,t,t+2*r,e)}),a=f(Io,oh,Uo(ti(2)));return f(Ah,function(t){return f(Uo,function(e){return f(n,t+64,e)},oh(l($o,t,t+64,e)))},a(t))}),lm=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),dm=n(function(e,t,r){var n=l(Ra,lm(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),hm=j,pm=function(e){return is(hm(e))},gm=function(e){return l(dm,r(function(e,t){return U(t,pm(e))}),"",e)},vm=ko(function(e){var t=e.a,r=e.b;return f(Uo,f(xo,t,r),f(Ah,gm,f(Ah,f(Io,xa(oh),nh),f(Uo,Yf(f(Io,cd,Du)),f(Uo,xs(2),f(fm,t,Do(r)))))))}),ym=f(Hd,f(vh,1,vm),f(Hd,f(vh,0,hh),Fi(cm))),mm=r(function(e,t){return{commPubkey:t,terms:e}}),bm=f(Hd,f(vh,1,vm),f(Hd,f(vh,0,vm),Fi(mm))),Cm=function(e){return{statement:e}},Em=f(Hd,f(vh,0,vm),Fi(Cm)),Sm=function(e){return{statement:e}},Tm=f(Hd,f(vh,0,vm),Fi(Sm)),wm={$:"AbortedEvent"},Im={$:"BurnedEvent"},Am={$:"ClaimedEvent"},Bm=function(e){return{$:"CommittedEvent",a:e}},km=function(e){return{$:"InitiatedEvent",a:e}},Nm=function(e){return{$:"InitiatorStatementLogEvent",a:e}},Rm={$:"PokeEvent"},$m={$:"RecalledEvent"},_m={$:"ReleasedEvent"},Lm=function(e){return{$:"ResponderStatementLogEvent",a:e}},xm=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9a-fA-F]+$"))),Pm=function(e){return xm(e)?li(Ds(Ko(e))):fi("Something in here is not very hexy: "+lh(e))},Dm=Yo(Pm),Um=f(gh,"topics",f(yh,0,Dm)),Om=function(e){return Ds(f(Ri,"",f(xa,f(Io,ps,Fs),Ef(f(xa,yi,_s(e))))))},Mm=f(qo,function(e){return R(e,Om("Initiated(string,string)"))?f(Oi,km,bm):R(e,Om("Committed(address,string)"))?f(Oi,Bm,ym):R(e,Om("Recalled()"))?Fi($m):R(e,Om("Claimed()"))?Fi(Am):R(e,Om("Aborted()"))?Fi(wm):R(e,Om("Released()"))?Fi(_m):R(e,Om("Burned()"))?Fi(Im):R(e,Om("InitiatorStatementLog(string)"))?f(Oi,Nm,Em):R(e,Om("ResponderStatementLog(string)"))?f(Oi,Lm,Tm):R(e,Om("Poke()"))?Fi(Rm):Go("Unrecognized topic hash")},Um),Fm={$:"Initiator"},Vm={$:"Responder"},Km=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(Fm):f(vg,function(e){return R(t,e)?si(Vm):ci},e.state.responder)}),Hm=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},jm=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},qm=function(e){return R(e.buyerDeposit,Il(e.tradeAmount))&&R(e.abortPunishment,wl(e.tradeAmount))},Gm={$:"Invalid"},zm=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Ym=r(function(e,t){return ml(Ed(t)+Ed(e))}),Wm=function(e){var t=ad(Zl(e.amount));if("Just"===t.$){return t.a}f(Mf,"Error converting FiatValue to float--string -> float failed!",e);return 0},Jm=r(function(e,t){return(t-e)/e}),Qm=r(function(e,t){var r=Wm(t),n=id(e);return"USD"===t.fiatType?si(f(Jm,n,r)):ci}),Xm=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 ml(0)}}();return{margin:f(Qm,e.tradeAmount,r.price),phaseEndTime:f(Ym,t.phaseStartTime,n)}}),Zm=function(e){var t=x(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 jy(v(zm,e.factory,e.id,n,a,o,u,s,l(Xm,a,o,u)))}return vy(e)},eb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(Mf,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Gm}}),tb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(Mf,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Gm}}),rb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(Mf,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Gm}}),nb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return jy(D(n,{state:e}));default:return Gm}}),ab=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(Mf,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Gm}}),ib=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}}),ob=Wo(f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Fo,f(Iy,hh,Ty(ib))))))))))),ub=function(e){return{data:si(f(If,"getParameters()",yr)),decoder:ob,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},sb={$:"Buyer"},cb=function(e){return f(Ao,function(e){return ml(1e3*e)},Ll(Zl(e)))},fb=function(e){return Cl(e)},lb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),db=function(e){var t=f(sd,"error converting BigInt to Time.Posix",cb(e.autoabortInterval)),r=f(sd,"error converting BigInt to Time.Posix",cb(e.autoreleaseInterval)),a=f(sd,"error converting BigInt to Time.Posix",cb(e.autorecallInterval));return d(lb,n(function(t,r,n){return{abortPunishment:fb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:fb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?vl:sb,pokeReward:fb(e.pokeReward),tradeAmount:fb(e.tradeAmount)}}),a,t,r)},hb=n(function(e,t,r){return f(Rp,r,f(Ep,db,f(yp,Nh(e),ub(t))))}),pb=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}}}}}}}}}}},gb=Wo(f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,Ty(pb)))))))))))),vb=function(e){return{data:si(f(If,"getPhaseStartInfo()",yr)),decoder:gb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},yb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),mb=function(e){return h(yb,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}}),cb(e.v6),cb(e.v7),cb(e.v8),cb(e.v9))},bb=n(function(e,t,r){return f(Rp,r,f(Ep,mb,f(yp,Nh(e),vb(t))))}),Cb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Eb=Wo(f(Iy,Eh,f(Iy,hh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,Ty(Cb))))))),Sb=function(e){return{data:si(f(If,"getState()",yr)),decoder:Eb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Tb={$:"Aborted"},wb={$:"Burned"},Ib={$:"NotClosed"},Ab={$:"Recalled"},Bb={$:"Released"},kb=function(e){switch(f(hc,99,Ll(Zl(e)))){case 0:return si(Ib);case 1:return si(Ab);case 2:return si(Tb);case 3:return si(Bb);case 4:return si(wb);default:return ci}},Nb={$:"Closed"},Rb={$:"Committed"},$b={$:"Judgment"},_b=function(e){switch(f(hc,99,Ll(Zl(e)))){case 1:return si(jg);case 2:return si(Rb);case 3:return si($b);case 4:return si(Nb);default:return ci}},Lb=function(e){return R(e,_d("0x0000000000000000000000000000000000000000"))?ci:si(e)},xb=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),Pb=function(e){var t=cb(e.phaseStartTimestamp),r=_b(e.phase),a=kb(e.closedReason);return d(xb,n(function(t,r,n){return{balance:fb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:Lb(e.responder)}}),r,t,a)},Db=n(function(e,t,r){return f(Rp,r,f(Ep,Pb,f(yp,Nh(e),Sb(t))))}),Ub=i(function(e,t,r,n,a){return po(M([l(hb,e,t,r),l(Db,e,t,n),l(bb,e,t,a)]))}),Ob=function(e){var t=ug(e);if("Just"===t.$){return t.a}f(Mf,"Warning! BigInt to Int conversion failed!",Zl(e));return 0},Mb=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),Fb=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),Vb=function(e){return e.b?l(Fb,e,yr,0):qa},Kb=tn,Hb=function(e){var t=h(Kb,Mb,f(gh,"encapsulation",zo),f(gh,"iv",zo),f(gh,"tag",zo),f(gh,"encrypted",zo)),r=um(t),n=f(Th,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(_c,0,e),f(_c,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(Vb(i))},jb=function(e){var t=function(e){var t=Ro(e);return t>1114111?fi("string is too long"):li(f(as,hm(t),e))};return f(Uo,Ri(""),nh(f(xa,t,e)))},qb=function(e){var t=e.a,r=e.b;return jb(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},Gb=r(function(e,t){return Jf(M([L("message",Hf(e)),L("pubkeyHexStrings",f(wh,Hf,M([t.initiatorPubkey,t.responderPubkey])))]))}),zb=function(e){return{$:"LoadedCommInfo",a:e}},Yb=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),Wb=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 zb(f(Yb,r,n))}return My(e)},Jb=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return Wb(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return zb(D(n,{initiatorPubkey:e}))}),Qb=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return Wb(D(r,{responderPubkey:si(e)}))}var n=t.a;return zb(D(n,{responderPubkey:e}))}),Xb=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return sb}r.a,r.b;return vl}if("Buyer"===r.b.$){r.a,r.b;return vl}r.a,r.b;return sb}),Zb=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(xl,a,n),o=fs(f(js,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),eC=function(e){var t=Vb(f(Zb,_s(e),yr));return l(wd,Mg,h(yb,Mb,f(_c,0,t),f(_c,1,t),f(_c,2,t),f(_c,3,t)),h(yb,Mb,f(_c,4,t),f(_c,5,t),f(_c,6,t),f(_c,7,t)))},tC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),rC={$:"Aborted"},nC={$:"Burned"},aC={$:"Claimed"},iC=function(e){return{$:"Committed",a:e}},oC=function(e){return{$:"Encrypted",a:e}},uC={$:"FailedDecode"},sC={$:"Initiated"},cC={$:"Recalled"},fC={$:"Released"},lC=function(e){return{$:"StateChange",a:e}},dC=function(e){return{$:"Statement",a:e}},hC=fr,pC=cr,gC=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(hC,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(pC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),vC=or,yC=y,mC=a(function(e,t,r,n){var a=kc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(vC,Ga(r),n);var i=za(d(mC,e-Ha,t,r,ja));return f(vC,i,n)}var o=f(Nc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(mC,e-Ha,t,r,u));return l(Pc,a,i,n)}var i=za(d(mC,e-Ha,t,r,yC(o)));return l(Pc,a,i,n)}),bC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(mC,c,r,e,yC(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(mC,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),CC=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(hC,32,r,e),o=f(bC,i,t);if(a<0){var u=l(pC,a,n,e);return f(bC,u,o)}return o}),EC=ur,SC=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(EC,i,t,r)}return f(ka,e,t)});return{nodeList:l(EC,i,yr,n),nodeListSize:t/32|0,tail:a}},TC=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(EC,o,t,r)}var n=e.a;return f(CC,n,t)});return f(CC,i,l(EC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(EC,o,t,r)}var n=e.a;return f(gC,n,t)});return f(ai,!0,f(gC,i,l(EC,o,SC(e),a)))}),wC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),IC=f(La,wC,yr),AC=n(function(e,t,r){var n=Xb(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(lC(sC));case"CommittedEvent":var r=t.a;return si(lC(iC(r.responder)));case"RecalledEvent":return si(lC(cC));case"ClaimedEvent":return si(lC(aC));case"AbortedEvent":return si(lC(rC));case"ReleasedEvent":return si(lC(fC));case"BurnedEvent":return si(lC(nC));case"InitiatorStatementLogEvent":var r=t.a;return si(dC({blocknum:e,message:function(){var e=eC(r.statement);if("Just"===e.$){var t=e.a;return oC(t)}return uC}(),who:n(Fm)}));case"ResponderStatementLogEvent":var r=t.a;return si(dC({blocknum:e,message:function(){var e=eC(r.statement);if("Just"===e.$){var t=e.a;return oC(t)}return uC}(),who:n(Vm)}));default:return ci}}(),i=f(Ao,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(TC,r.history,Vb(IC(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Ao,tC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),IC(M([s])))}),BC=Gr,kC=function(e){var t=l(Mi,Mg,f(gh,"id",BC),f(gh,"message",zo));return f(Cd,Di,f(Th,t,e))},NC=function(e){return{$:"Decrypted",a:e}},RC=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),$C=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(AC,n,a,t),o=i.a,u=i.b,s=i.c;return d(RC,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(RC,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(RC,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=kC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(_c,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:NC(y)}),T=D(b,{eventInfo:dC(S)}),w=l(Uc,v,T,t.history);return d(RC,D(t,{history:w}),!1,ci,yr)}return d(RC,t,!1,ci,M([pa(f(Vf,"got a decryption result, but for an event that is not a message!",b))]))}return d(RC,t,!1,ci,M([pa(f(Vf,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(RC,t,!1,ci,M([pa(f(Vf,"Error decoding decryption result",I))]))}}),_C=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),LC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),xC=function(e){return{onBroadcast:ci,onMined:si(L(_C(e),ci)),onSign:si(LC(e))}},PC=je("encryptToPubkeys",Ua),DC=n(function(e,t,r){return{data:si(f(If,"commit(address,string)",M([Dd(t),Dp(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),UC=n(function(e,t,r){return{data:si(f(If,"commit(address,string)",M([Dd(t),Dp(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),OC=function(e){return{$:"CommitMined",a:e}},MC={$:"CommitNeedsSig"},FC=function(e){return{$:"CommitSigned",a:e}},VC=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?UC:DC}(),a=xf(function(){return"Token"===e.factory.$?Ua:qp(El(Hm(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(MC),f(To,{onBroadcast:ci,onMined:si(L(OC,ci)),onSign:si(FC)},a))}),KC=r(function(e,t){return Jf(M([L("id",el(e)),L("encapsulation",Hf(t.encapsulatedKey)),L("iv",Hf(t.iv)),L("tag",Hf(t.tag)),L("encrypted",Hf(t.message))]))}),HC=je("decryptMessage",Ua),jC=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},qC=r(function(e,t){return po(f(xa,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 HC(f(KC,r,s))}return go}return go},jC(e.history)))}),GC=function(e){if("Just"===e.$){return e.a}return ci},zC=function(e){var t=GC(l(wd,Km,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Ao,function(e){return e.address},Td(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(qC,n,a)}return go},YC=r(function(e,t){return f(Ao,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return vl}r.a,r.b;return sb}if("Seller"===r.b.$){r.a,r.b;return sb}r.a,r.b;return vl},f(Km,e,t))}),WC=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(AC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),JC=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),QC=i(function(e,t,r,n,a){return f(WC,n,p(JC,e,r,t,qa,a,""))}),XC=function(e){return{$:"ChatHistoryMsg",a:e}},ZC=a(function(e,t,r,n){var a=x(t,Td(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(YC,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(XC),n))}(h(QC,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),eE={$:"Abort"},tE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),rE=function(e){return{$:"ActionNeedsSig",a:e}},nE=function(e){return{$:"ApproveMining",a:e}},aE={$:"ApproveNeedsSig"},iE=function(e){return{$:"ApproveSigned",a:e}},oE={$:"Burn"},uE={$:"Claim"},sE=function(e){return{$:"CommitMining",a:e}},cE=function(e){return{$:"ConfirmingAction",a:e}},fE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),lE=function(e){return{$:"EventLogFetched",a:e}},dE=function(e){return{$:"ParametersFetched",a:e}},hE=function(e){return{$:"PhaseInfoFetched",a:e}},pE={$:"Poke"},gE={$:"Recall"},vE={$:"Release"},yE=function(e){return{$:"StartContractAction",a:e}},mE=function(e){return{$:"StateFetched",a:e}},bE=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"}},CE=function(e){return d(Ky,e,go,bo,yr)},EE={align:Uf,label:"cantFindTradeWillRetry",mainParagraphs:M([M([Ff("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:sg},SE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(cg,e,r)}if("Nothing"===t.a.$){t.a;return f(Vf,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(Vf,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),TE={align:Uf,label:"tradeParametersNotDefault",mainParagraphs:M([M([Ff("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:sg},wE=eo(Xi),IE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),AE=n(function(e,t,r){return l(Jh,e,Ao(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),BE=r(function(e,t){var r=t.a;return xy(f(Wh,e,r))}),kE=n(function(e,t,r){var n=e.a,a=f(Vh,t,n.requests);if("Nothing"===a.$)return L(Ly(n),go);var i=a.a,o=L(i.watchOnce,kl(r));if("Nothing"===o.b.$){o.b;return L(Ly(D(n,{requests:l(AE,t,r,n.requests)})),go)}if(o.a){var u=o.b.a;return L(Ly(D(n,{requests:l(AE,t,r,n.requests),watching:f(BE,t,n.watching)})),f(Ag,i.tagger,lp(u)))}return L(Ly(D(n,{requests:l(AE,t,r,n.requests)})),po(f(xa,function(e){return f(Ag,i.tagger,lp(e))},r)))}),NE=_e,RE=r(function(e,t){return f(Rp,f(Io,_y,t),f(bp,function(t){return Cy(e)},NE(2e3)))}),$E=ue,_E=ce,LE=Yr,xE=n(function(e,t,r){var n=function(e){return _E(M([e,$E(r)]))};return f(qo,function(a){var i=f(Th,e,a);if("Ok"===i.$){var o=i.a,u=f(Th,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return Go(Di(c))}return Fi(r)},LE)}),PE=a(function(e,t,r,n){return f(Hd,l(xE,f(gh,e,LE),t,r),n)}),DE=n(function(e,t,r){return f(Hd,f(gh,e,t),r)}),UE=Yo(dh),OE=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),ME=function(e){return{$:"BlockHash",a:e}},FE=function(e){return OE(e)?li(ME(Ko(e))):fi("Given blockHash "+lh(e)+" is not valid.")},VE=Yo(FE),KE=function(e){return{$:"TxHash",a:e}},HE=function(e){return OE(e)?li(KE(Ko(e))):fi("Given txHash "+lh(e)+" is not valid.")},jE=Yo(HE),qE=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}}),GE=zr,zE=l(DE,"blockNumber",by,l(DE,"blockHash",VE,l(DE,"transactionHash",jE,l(DE,"transactionIndex",by,l(DE,"logIndex",by,d(PE,"removed",GE,!1,l(DE,"topics",um(Dm),l(DE,"data",zo,l(DE,"address",UE,Fi(qE)))))))))),YE=function(e){return f(wh,function(e){if("Just"===e.$){var t=e.a;return Hf(wf(t))}return Wf},e)},WE=function(e){return Jf(M([L("fromBlock",Rh(e.fromBlock)),L("toBlock",Rh(e.toBlock)),L("address",jf(e.address)),L("topics",YE(e.topics))]))},JE=r(function(e,t){return pp({decoder:um(zE),method:"eth_getLogs",params:M([WE(t)]),url:e})}),QE=function(e){return{$:"BlockNum",a:e}},XE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(bp,function(r){return f(Ep,vi(r),f(JE,e,D(t,{fromBlock:QE(n),toBlock:QE(a)})))},f(JE,e,t)):f(JE,e,t)}),ZE=n(function(e,t,r){var n=r.a,a=r.b;return f(JE,e,D(t,{fromBlock:QE(n),toBlock:QE(a)}))}),eS=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(eS,e,t,i)),c=o;e=u,t=s,r=c}}),tS=r(function(e,t){return l(eS,fl,t,e)}),rS=r(function(e,t){var r=e.a,n=t.a;return xy(f(tS,r,n))}),nS=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 po(f(xa,function(t){return f(Rp,f(Io,IE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},IC(f(xa,function(e){return f(Vh,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(Ly(D(r,{blockNumber:si(a)})),po(M([f(RE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,ZE)]))):L(t,f(RE,r.nodePath,r.tagger))}return L(Ly(D(r,{blockNumber:si(a),pending:Py,watching:f(rS,r.watching,r.pending)})),po(M([f(RE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,XE),l(i,L(a,a),r.watching,ZE)])))}var s=e.a.a;return L(Ly(D(r,{errors:f(ka,s,r.errors)})),f(RE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(kE,t,c,d)}var s=e.b.a;return L(Ly(D(r,{errors:f(ka,s,r.errors)})),go)}),aS=r(function(e,t){var r=t.a;return xy(l(fl,e,gr,r))}),iS=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(fl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(Ly(D(o,{watching:f(aS,a.ref,o.watching)})),f(Rp,f(Io,IE(a.ref),a.tagger),e),a.ref)}(l(XE,a.nodePath,n,L(s,s)))}return x(Ly(D(o,{pending:f(aS,a.ref,o.pending)})),go,a.ref)}),oS=iS(!1),uS=function(e){return M([e])},sS=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(Ry,r.factory,r.id):go}}(),function(){var e=x(Td(t.wallet),yg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(yg(t.wallet),si(a.factory))?d($p,n,r.address,a.creationInfo.address,oy):go}return go}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(ZC,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?zC(t):go,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(Ky,u,po(M([l(Db,p.factory,p.creationInfo.address,mE),s,r])),bo,o)}return CE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return CE(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(xu,m,El(Hm(C.parameters))),ba))return CE(u);var S=l(VC,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(Ky,D(u,{txChainStatus:T}),go,w,yr)}return CE(u)}var y=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:Ob(I.blocknum)},B=l(oS,lE,t.eventSentry,{address:A.address,fromBlock:QE(A.blocknum),toBlock:vp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(eb,A,t.trade)}),$=f(hc,wE,jm(u.trade)),_=po(M([N,h(Ub,$,A.address,dE,mE,hE)]));return d(Ky,u,_,bo,yr)}if("BadBody"===g.a.$){g.a.a;return d(Ky,t,go,bo,M([pa(EE)]))}var y=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(nb,P,t.trade)});return d(Ky,u,zC(u),bo,yr)}return d(Ky,t,go,bo,M([pa(f(SE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(qm(F)){var u=D(t,{trade:f(tb,F,t.trade)});return d(Ky,u,zC(u),bo,yr)}return d(Ky,t,go,bo,M([pa(TE)]))}var V=g.a.a;return d(Ky,t,go,bo,M([pa(f(Vf,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(rb,H,t.trade)});return d(Ky,u,zC(u),bo,yr)}return d(Ky,t,go,bo,M([pa(f(SE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Ih,Mm,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(Ky,t,go,bo,M([pa(f(Vf,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(Jb,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(Qb,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=sm(e.terms);if("Ok"===r.$){var n=r.a;return L(f(ab,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(Vf,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(XC),n))}(l(AC,q.blockNumber,Y,r))}return d(ZC,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?zC(u):go;return d(Ky,u,_,bo,f(oo,f(xa,pa,IC(M([X]))),o));case"ExpandPhase":var te=e.a;return CE(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return CE(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return CE(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(Ky,t,go,bo,M([da(yv(C.parameters.initiatorAddress))]))}return d(Ky,t,go,bo,M([pa(f(Vf,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return CE(D(t,{txChainStatus:si(f(fE,E,ie))}));case"AbortAction":return CE(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(VC,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=xf(l(Md,xd(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(iE)};return f(To,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(xu,i,El(Hm(C.parameters))),ba)?L(si(aE),n):l(VC,C,E.address,E.commPubkey)}return L(si(aE),n)}(),T=oe.a,w=oe.b;return d(Ky,D(t,{txChainStatus:T}),go,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,pE)||R(ue,gE)){var se=yE(ue),ce=t;e=se,t=ce;continue e}return CE(D(t,{txChainStatus:si(cE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,bo,M([pa(f(Vf,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=xf(Jy(n.creationInfo.address));return x(si(rE(gE)),f(To,xC(gE),a),yr);case"Claim":var a=xf(Yy(n.creationInfo.address));return x(si(rE(uE)),f(To,xC(uE),a),yr);case"Abort":var a=xf(Gy(n.creationInfo.address));return x(si(rE(eE)),f(To,xC(eE),a),yr);case"Release":var a=xf(Qy(n.creationInfo.address));return x(si(rE(vE)),f(To,xC(vE),a),yr);case"Burn":var a=xf(zy(n.creationInfo.address));return x(si(rE(oE)),f(To,xC(oE),a),yr);default:var a=xf(Af(n.creationInfo.address));return x(si(rE(pE)),f(To,xC(pE),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(Ky,D(t,{txChainStatus:T}),go,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return CE(D(t,{txChainStatus:si(nE(he))}))}var V=de.a;return d(Ky,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return CE(D(t,{txChainStatus:si(sE(he))}))}var V=de.a;return d(Ky,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"commit",V))]));case"CommitMined":return CE(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return CE(D(t,{txChainStatus:si(f(tE,ue,he))}))}var V=de.a;return d(Ky,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,bE(ue),V))]));case"ActionMined":var ue=e.a;return CE(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(nS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(Ky,D(t,{eventSentry:ve}),_,bo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f($C,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?zC(t):go,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(PC(f(Gb,r,a)),ci)}return L(go,si(f(Vf,"Trying to encrypt, but commInfo is not loaded",n)))}return L(go,ci)}(),Te=Se.a,we=Se.b;return d(Ky,Ee,po(M([s,Te])),bo,U(f(Qi,XC,Ce.appCmds),f(hc,yr,f(Ao,uS,f(Ao,pa,we)))))}return d(Ky,t,go,bo,M([pa(f(Vf,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Ah,qb,Hb(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Km,p,E.address);if("Nothing"===Ne.$)return d(Ky,t,go,bo,M([pa(f(Vf,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return xf("Initiator"===Re.$?f(Wy,p.creationInfo.address,ke):f(Xy,p.creationInfo.address,ke))}();return d(Ky,t,go,f(To,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(Ky,t,go,bo,M([pa(f(Vf,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(Ky,t,go,bo,M([pa(f(Vf,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return CE(t)}var V=e.a.a;return d(Ky,t,go,bo,M([pa(f(fg,"message",V))]));default:return d(Ky,t,go,bo,M([ga]))}}),cS=r(function(e,t){return{address:e,blocknum:t}}),fS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},lS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(iS,!0,e,t,r))}),dS=n(function(e,t,r){var n=function(e){return r(f(Ih,bm,e).returnData)},a={address:t.address,fromBlock:QE(t.blocknum),toBlock:QE(t.blocknum),topics:M([si(Om("Initiated(string,string)"))])};return l(lS,n,e,a)}),hS=function(e){return{data:si(f(If,"numTrades()",yr)),decoder:Wo(Eh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},pS=r(function(e,t){return f(Rp,t,f(yp,Nh(e),hS(Ld(e))))}),gS=function(e){return{data:si(f(If,"phase()",yr)),decoder:Wo(Eh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},vS=n(function(e,t,r){return f(Rp,r,f(Ep,_b,f(yp,Nh(e),gS(t))))}),yS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),mS=r(function(e,t){return l(La,yS(e),yr,t)}),bS=function(e){return f(mS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},CS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},ES=function(e){return f(CS,Ja(Gm),Sa(e.trades))},SS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:ES(e),loaded:Ti(bS(e))})})},TS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),wS=r(function(e,t){var r=f(_c,e,t.trades);if("Just"===r.$){var n=(r.a,l(Uc,e,Gm,t.trades));return l(TS,SS(D(t,{trades:n})),go,yr)}return l(TS,t,go,M([pa(f(Vf,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),IS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(eb,t,a),o=l(Uc,e,i,r.trades);return L(SS(D(r,{trades:o})),yr)}return L(r,M([f(Vf,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),AS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tb,t,a),o=l(Uc,e,i,r.trades);return l(TS,SS(D(r,{trades:o})),go,yr)}return l(TS,r,go,M([pa(f(Vf,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),BS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(Uc,e,jy(D(a,{state:D(i,{phase:t})})),r.trades);return l(TS,SS(D(r,{trades:o})),go,yr)}return l(TS,r,go,M([pa(f(Vf,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(TS,r,go,M([pa(f(Vf,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),kS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(rb,t,a),o=l(Uc,e,i,r.trades);return l(TS,SS(D(r,{trades:o})),go,yr)}return l(TS,r,go,M([pa(f(Vf,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),NS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(nb,t,a),o=l(Uc,e,i,r.trades);return l(TS,SS(D(r,{trades:o})),go,yr)}return l(TS,r,go,M([pa(f(Vf,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),RS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(ab,t,a),o=l(Uc,e,i,r.trades);return l(TS,SS(D(r,{trades:o})),go,yr)}return l(TS,r,go,M([pa(f(Vf,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),$S=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),_S=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),LS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),xS=function(e){return{$:"NumTradesFetchedAgain",a:e}},PS=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),DS=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),US=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),OS=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),MS=function(e){return l(TS,e,go,yr)},FS=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=Ob(n),i=Vb(f(xa,yy(t.factory),f(Ai,0,a-1))),o=po(f(xa,function(e){return l(ky,t.factory,wu(e),$S(e))},f(Ai,0,a-1)));return l(TS,D(t,{dataFetchState:l(_S,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(TS,t,go,M([pa(f(cg,"Factory numTrades",u))]));case"CheckForNewTrades":return l(TS,t,f(pS,t.factory,xS),yr);case"UpdateTradePhases":var s=po(IC(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(vS,e.factory,e.creationInfo.address,f(DS,e.factory,e.id)))},bS(t))));return l(TS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(BS,d,p,t),v=function(){var e=L(p,f(_c,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=fS(r);if("Just"===n.$){var a=n.a;return L(l(Db,c,a.address,OS(d)),yr)}return L(go,M([pa(f(Vf,"Phase fetched for a trade that has no creationInfo",r))]))}return L(go,yr)}e.b;return L(go,M([pa(f(Vf,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(TS,g.tradeCache,po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(TS,t,go,M([pa(f(SE,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=Ob(n);if(_(C,E)<0){var S=t.dataFetchState,o=po(f(xa,function(e){return l(ky,t.factory,wu(e),$S(e))},f(Ai,C,E-1))),T=Vb(f(xa,yy(t.factory),f(Ai,C,E-1)));return l(TS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(TC,t.trades,T)}),o,yr)}return MS(t)}b.b;return l(TS,t,go,M([pa(f(Vf,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(TS,t,go,M([pa(f(cg,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(cS,w.address_,Ob(w.blocknum)),A=l(dS,t.eventSentry,I,LS(d)),B=A.a,k=A.b,y=po(M([h(Ub,t.factory,I.address,PS(d),OS(d),US(d)),k])),N=l(IS,d,I,t),R=N.a,$=N.b;return l(TS,SS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(TS,t,go,M([pa(f(cg,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(TS,t,go,M([pa(f(cg,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(AS,d,P,t)}var U=r.a.a;return l(TS,t,go,M([pa(f(Vf,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(NS,d,O,t)}return l(TS,t,go,M([pa(f(SE,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(kS,d,F,t)}return l(TS,t,go,M([pa(f(SE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=sm(V.terms);if("Ok"===K.$){var H=K.a;return l(RS,d,H,t)}var j=K.a;return f(wS,d,t)}var j=r.a;return l(TS,t,go,M([pa(f(Vf,"Error decoding initiated event",j))]));default:var q=e.a,G=f(nS,q,t.eventSentry),z=G.a,y=G.b;return l(TS,D(t,{eventSentry:z}),y,yr)}}),VS=function(e){return{$:"AgentHistoryMsg",a:e}},KS=function(e){return{$:"AppCmd",a:e}},HS={$:"BetaLandingPage"},jS={$:"ConnectToWeb3"},qS=function(e){return{$:"MarketplaceMsg",a:e}},GS=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),zS=r(function(e,t){return f(kn,e,Hf(t))}),YS=function(e){return f(zS,"href",tt(e))},WS=Nn("rel"),JS=zS("target"),QS=function(e){return{$:"Height",a:e}},XS=QS,ZS={$:"Content"},eT=ZS,tT=function(e){return{$:"Width",a:e}},rT=tT,nT=function(e){return{$:"Attr",a:e}},aT=function(e){return{$:"NodeName",a:e}},iT=function(e){return{$:"Unkeyed",a:e}},oT={$:"AsEl"},uT=oT,sT=r(function(e,t){return{$:"Field",a:e,b:t}}),cT=f(sT,0,0),fT={$:"NoNearbyChildren"},lT={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=lT.any+" "+lT.column,hT=lT.any+" "+lT.grid,pT=lT.any+" "+lT.page,gT=lT.any+" "+lT.paragraph,vT=lT.any+" "+lT.row,yT=lT.any+" "+lT.single,mT=function(e){switch(e.$){case"AsRow":return vT;case"AsColumn":return dT;case"AsEl":return yT;case"AsGrid":return hT;case"AsParagraph":return gT;default:return pT}},bT=function(e){return{$:"Keyed",a:e}},CT={$:"NoStyleSheet"},ET=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),ST=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),TT={$:"AsParagraph"},wT=TT,IT=Sn("div"),AT=Sn("p"),BT=Sn("s"),kT=Sn("u"),NT=zS("className"),RT=function(e){return wn(Xe(e))},$T=function(e){return Sn(Xe(e))},_T=function(e){return{$:"Flag",a:e}},LT=function(e){return{$:"Second",a:e}},xT=function(e){return e>31?LT(1< .ctr > ."+lT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",Pw="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+rw(lT.any)+rw(lT.row)+" > "+rw(lT.any)+" { flex-basis: auto !important; } "+rw(lT.any)+rw(lT.row)+" > "+rw(lT.any)+rw(lT.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"+xw,Dw=function(e){return{$:"Intermediate",a:e}},Uw=r(function(e,t){return Dw({closing:t,others:yr,props:yr,selector:e})}),Ow=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,Dw({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(Ow,f(Uw,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(Ow,f(Uw,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(Ow,f(Uw,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(Ow,f(Uw,n.selector,""),v),t.others)})}});return Dw(l(La,a,n,t))}),Mw=U(Pw,function(e){var t=function(e){return Ql(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Ql(f(xa,a,t.others)))};return Ql(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(Ow,f(Uw,r,""),n),t)}),yr,e)))}(U($w,Lw))),Fw=l($T,"style",yr,M([aw(Mw)])),Vw=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+'"'}},Kw=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}},Hw=function(e){if("FontWith"===e.$){var t=e.a;return f(Qd,Kw,t.variants)}return!1},jw=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),qw=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),Gw=n(function(e,t,r){var n=r.a,a=r.b;return M([f(qw,"."+e+"."+t+", ."+e+" ."+t,n),f(qw,"."+e+"."+t+"> ."+lT.text+", ."+e+" ."+t+" > ."+lT.text,a)])}),zw=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(Gw,i,lT.sizeByCapital,a),l(Gw,i,lT.fullSize,n)))}),Yw=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(qw,"."+r+"."+lT.sizeByCapital+", ."+r+" ."+lT.sizeByCapital,M([L("line-height","1")])),f(qw,"."+r+"."+lT.sizeByCapital+"> ."+lT.text+", ."+r+" ."+lT.sizeByCapital+" > ."+lT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),Ww=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},Jw=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,rc,t,r))}return ci},Qw=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),Xw=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(hc,e.descender,Jw(t)),n=f(hc,e.baseline,Jw(f(Yf,function(e){return!R(e,r)},t))),a=f(hc,e.capital,Ww(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(Qw,i,a-n,o),full:l(Qw,u,a-r,s)}},Zw=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",ZT(e.height)),L("vertical-align",ZT(e.vertical)+"em"),L("font-size",ZT(e.size)+"em")]))},eI=function(e){return l(Ra,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 si(L(Zw(function(e){return e.full}(Xw(a))),Zw(function(e){return e.capital}(Xw(a)))))}return t}return t}),ci,e)},tI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(mS,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=eI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,Yw(t),n));var i=a.a;return f(Ri,"",f(xa,f(zw,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},rI=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+'" '+Ni(r)}},nI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,rI,t.variants)))}return ci},aI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},iI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+ZT(r)+"px, "+ZT(n)+"px, "+ZT(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("+ZT(o)+"px, "+ZT(u)+"px, "+ZT(s)+"px)",b="scale3d("+ZT(f)+", "+ZT(l)+", "+ZT(d)+")",C="rotate3d("+ZT(p)+", "+ZT(g)+", "+ZT(v)+", "+ZT(y)+"rad)";return si(m+" "+b+" "+C)}},oI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,jw(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,jw(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,jw(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,jw(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+lT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+lT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+lT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,jw(!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,M([f(QT,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(rc,1,1-c));return l(a,t,"."+u,M([f(QT,"opacity",ZT(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(QT,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(mS,nI,p)),v=M([f(QT,"font-family",f(Ri,", ",f(xa,Vw,p))),f(QT,"font-feature-settings",g),f(QT,"font-variant",f(Qd,Hw,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(QT,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(QT,s,ew(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+lT.row,A="."+(lT.wrapped+I),B="."+lT.alignRight,k="."+lT.paragraph,N="."+lT.page,R="."+lT.alignLeft,$=ZT(S/2)+"px",_=ZT(E/2)+"px",x="."+lT.column,y="."+C,P="."+lT.any;return Ql(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(QT,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(QT,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(QT,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(QT,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(QT,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(QT,"margin-left",w)])),l(a,t,U(y,k),M([f(QT,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(QT,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(QT,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(QT,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(QT,"content","''"),f(QT,"display","block"),f(QT,"height","0"),f(QT,"width","0"),f(QT,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(QT,"content","''"),f(QT,"display","block"),f(QT,"height","0"),f(QT,"width","0"),f(QT,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(QT,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(QT,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,GT,F.rows))+"-cols-"+f(Ri,"-",f(xa,GT,F.columns))+"-space-x-"+GT(F.spacing.a)+"-space-y-"+GT(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=iI(ne),y=YT(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,M([f(QT,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=aI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(tI(s),c)}),uI=r(function(e,t){return l($T,"style",yr,M([aw(f(oI,e,t))]))}),sI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",Fw),f(ka,L("dynamic-stylesheet",f(uI,t,l(Ra,JT,L(Py,M([nw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(uI,t,l(Ra,JT,L(Py,M([nw(t.focus)])),r).b)),n)}),cI=a(function(e,t,r,n){return e?f(ka,Fw,f(ka,f(uI,t,l(Ra,JT,L(Py,M([nw(t.focus)])),r).b),n)):f(ka,f(uI,t,l(Ra,JT,L(Py,M([nw(t.focus)])),r).b),n)}),fI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(RT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(sI,!1,e,t,r);default:var e=i.a,t=i.b;return d(sI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return IT;case"p":return AT;default:return $T(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(cI,!1,e,t,n);default:var e=i.a,t=i.b;return d(cI,!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($T,e,n,M([f(u,r,M([NT(lT.any+" "+lT.single)]))]))}}();switch(o.$){case"AsRow":return f(VT,HT,e)&&!f(VT,KT,e)?s:f(VT,DT,e)?f(kT,M([NT(f(Ri," ",M([lT.any,lT.single,lT.container,lT.contentCenterY,lT.alignContainerRight])))]),M([s])):f(VT,UT,e)?f(BT,M([NT(f(Ri," ",M([lT.any,lT.single,lT.container,lT.contentCenterY,lT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(VT,FT,e)&&!f(VT,MT,e)?s:f(VT,OT,e)?f(BT,M([NT(f(Ri," ",M([lT.any,lT.single,lT.container,lT.alignContainerCenterY])))]),M([s])):f(VT,PT,e)?f(kT,M([NT(f(Ri," ",M([lT.any,lT.single,lT.container,lT.alignContainerBottom])))]),M([s])):s;default:return s}}),lI=aw,dI=function(e){return f(IT,M([NT(f(Ri," ",M([lT.any,lT.text,lT.widthContent,lT.heightContent])))]),M([lI(e)]))},hI=function(e){return l($T,"div",M([NT(f(Ri," ",M([lT.any,lT.text,lT.widthFill,lT.heightFill])))]),M([aw(e)]))},pI=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 R(e,wT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,wT),L(f(ka,L(n,f(s.html,CT,e)),i),au(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,uT)?hI(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 R(e,wT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,wT),L(f(ka,f(o.html,CT,e),n),au(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,uT)?hI(u):dI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=au(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(fI,n.has,n.node,n.attributes,bT(l(ST,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(fI,n.has,n.node,n.attributes,bT(l(ST,"nearby-element-pls",s,n.children)),CT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=au(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(fI,n.has,n.node,n.attributes,iT(f(ET,m,n.children))),styles:g})}return Gi(h(fI,n.has,n.node,n.attributes,iT(f(ET,m,n.children)),CT))}),gI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),vI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(sT,a|r,n)}var i=e.a;return f(sT,r,i|n)}),yI=xT(7),mI=xT(36),bI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(sT,r|a,n|i)}),CI=xT(6),EI=xT(38),SI=xT(30),TI=xT(29),wI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),II=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),AI=function(e){return{$:"Transform",a:e}},BI=function(e){return{$:"ChildrenBehind",a:e}},kI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),NI=function(e){return{$:"ChildrenInFront",a:e}},RI=r(function(e,t){return f(IT,M([NT(function(){switch(e.$){case"Above":return f(Ri," ",M([lT.nearby,lT.single,lT.above]));case"Below":return f(Ri," ",M([lT.nearby,lT.single,lT.below]));case"OnRight":return f(Ri," ",M([lT.nearby,lT.single,lT.onRight]));case"OnLeft":return f(Ri," ",M([lT.nearby,lT.single,lT.onLeft]));case"InFront":return f(Ri," ",M([lT.nearby,lT.single,lT.inFront]));default:return f(Ri," ",M([lT.nearby,lT.single,lT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return aw("");case"Text":var e=t.a;return dI(e);case"Unstyled":return(0,t.a)(uT);default:return f(t.a.html,CT,uT)}}()]))}),$I=n(function(e,t,r){var n=f(RI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?BI(M([n])):NI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?BI(f(ka,n,a)):f(kI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(kI,M([n]),i):NI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(kI,f(ka,n,a),i):f(kI,a,f(ka,n,i))}}),_I=r(function(e,t){switch(t.$){case"Generic":return aT(e);case"NodeName":var r=t.a;return f(wI,r,e);default:var n=t.a,a=t.b;return f(wI,n,a)}}),LI=function(e){switch(e.$){case"Left":return lT.alignedHorizontally+" "+lT.alignLeft;case"Right":return lT.alignedHorizontally+" "+lT.alignRight;default:return lT.alignedHorizontally+" "+lT.alignCenterX}},xI=function(e){switch(e.$){case"Top":return lT.alignedVertically+" "+lT.alignTop;case"Bottom":return lT.alignedVertically+" "+lT.alignBottom;default:return lT.alignedVertically+" "+lT.alignCenterY}},PI=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),DI=function(e){return{$:"Moved",a:e}},UI=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return DI(x(r,0,0));case"MoveY":var n=t.a;return DI(x(0,n,0));case"MoveZ":var a=t.a;return DI(x(0,0,a));case"MoveXYZ":var i=t.a;return DI(i);case"Rotate":var i=t.a,o=t.b;return d(PI,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(PI,x(0,0,0),i,x(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 DI(x(s,n,a));case"MoveY":var c=t.a;return DI(x(r,c,a));case"MoveZ":var f=t.a;return DI(x(r,n,f));case"MoveXYZ":var i=t.a;return DI(i);case"Rotate":var i=t.a,o=t.b;return d(PI,u,x(1,1,1),i,o);default:var l=t.a;return d(PI,u,l,x(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(PI,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(PI,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(PI,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(PI,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(PI,u,h,v,y);default:var m=t.a;return d(PI,u,m,p,o)}}}),OI=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(cT,n,M([l(II,n,"height",r+"px")]));case"Content":return x(f(vI,mI,cT),lT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(vI,FT,cT),lT.heightFill,yr):x(f(vI,FT,cT),lT.heightFillPortion+" height-fill-"+Ni(a),M([l(II,lT.any+"."+lT.row+" > "+rw("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(II,u,"min-height",Ni(i)+"px"),c=OI(o),d=c.a,h=c.b,p=c.c;return x(f(vI,MT,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(II,u,"max-height",Ni(g)+"px"),v=OI(o),d=v.a,h=v.b,p=v.c;return x(f(vI,MT,d),u+" "+h,f(ka,s,p))}},MI=function(e){switch(e.$){case"Px":var t=e.a;return x(cT,lT.widthExact+" width-px-"+Ni(t),M([l(II,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(vI,EI,cT),lT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(vI,HT,cT),lT.widthFill,yr):x(f(vI,HT,cT),lT.widthFillPortion+" width-fill-"+Ni(r),M([l(II,lT.any+"."+lT.row+" > "+rw("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(II,i,"min-width",Ni(n)+"px"),u=MI(a),s=u.a,c=u.b,d=u.c;return x(f(vI,KT,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(II,i,"max-width",Ni(h)+"px"),p=MI(a),s=p.a,c=p.b,d=p.c;return x(f(vI,KT,s),i+" "+c,f(ka,o,d))}},FI=xT(27),VI=r(function(e,t){if(R(e,FI)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),KI=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=YT(n);if("Nothing"===s.$)return{attributes:f(ka,NT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,NT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,AI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(VT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(vI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(VT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(VI,S,I)){var p=WT(I)+" "+e,g=t,v=f(vI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=WT(I)+" "+e,g=t,v=f(vI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(vI,S,r),y=f(UI,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(VT,CI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=lT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(vI,CI,r),y=n,m=f(ka,l(II,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+lT.widthContent,g=t,v=f(vI,EI,f(vI,CI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+lT.widthFill,g=t,v=f(vI,HT,f(vI,CI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+lT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(vI,HT,f(vI,CI,r)),y=n,m=f(ka,l(II,lT.any+"."+lT.row+" > "+rw("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=MI(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(bI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(VT,yI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(vI,yI,r),y=n,m=f(ka,l(II,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=lT.heightContent+" "+e,g=t,v=f(vI,mI,f(vI,yI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=lT.heightFill+" "+e,g=t,v=f(vI,FT,f(vI,yI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+lT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(vI,FT,f(vI,yI,r)),y=n,m=f(ka,l(II,lT.any+"."+lT.column+" > "+rw("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=OI(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(bI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(_I,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(_I,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(_I,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(_I,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(_I,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(_I,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(_I,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return aT("p");case"NodeName":var e=t.a;return aT(e);default:var r=t.a,n=t.b;return f(wI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(gI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(gI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(gI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(gI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l($I,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(VT,SI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=LI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(vI,UT,e);case"Right":return f(vI,DT,e);default:return e}}(f(vI,SI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(VT,TI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=xI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(vI,OT,e);case"Bottom":return f(vI,PT,e);default:return e}}(f(vI,TI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),HI={$:"Untransformed"},jI=HI,qI=a(function(e,t,r,n){return l(pI,e,n,v(KI,mT(e),t,cT,jI,yr,yr,fT,$a(r)))}),GI=function(e){return nT(NT(e))},zI=r(function(e,t){var r=t.url,n=t.label;return d(qI,uT,aT("a"),f(ka,nT(YS(r)),f(ka,nT(WS("noopener noreferrer")),f(ka,nT(JS("_blank")),f(ka,rT(eT),f(ka,XS(eT),f(ka,GI(lT.contentCenterX+" "+lT.contentCenterY),e)))))),iT(M([n])))}),YI=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),WI=n(function(e,t,r){return d(YI,e,t,r,1)}),JI=xT(14),QI=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),XI=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),ZI=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return zT(t)+"-"+zT(r)+"-"+zT(n)+"-"+zT(a)},eA=function(e){return f(XI,JI,l(QI,"fc-"+ZI(e),"color",e))},tA={align:Uf,label:"cantConnectNoWeb3",mainParagraphs:M([M([Ff("You need a web3 provider (such as "),f(zI,M([eA(l(WI,0,0,1))]),{label:Ff("Metamask"),url:"https://metamask.io/"}),Ff(") to Connect.")]),M([Ff("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:lg},rA={align:Uf,label:"invalidUrl",mainParagraphs:M([M([Ff("I don't understand that URL...")]),M([Ff("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:sg},nA=function(e){return{$:"Active",a:e}},aA=Yo(f(Io,Tf,f(Io,Ch,sd("Error decoding hex to BigInt")))),iA=function(){return Yo(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),oA=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}}}}}}}}}}}},uA=function(e){return _E(M([f(Oi,si,e),Fi(ci)]))},sA=f(Hd,uA(f(gh,"status",iA)),f(Hd,uA(f(gh,"root",zo)),l(DE,"logsBloom",zo,l(DE,"logs",um(zE),f(Hd,uA(f(gh,"contractAddress",UE)),l(DE,"cumulativeGasUsed",aA,l(DE,"gasUsed",aA,l(DE,"blockNumber",by,l(DE,"blockHash",VE,l(DE,"transactionIndex",by,l(DE,"transactionHash",jE,Fi(oA)))))))))))),cA=function(e){var t=e.a;return Tf(t)},fA=f(Io,cA,Hf),lA=r(function(e,t){return pp({decoder:sA,method:"eth_getTransactionReceipt",params:M([fA(t)]),url:e})}),dA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),hA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),pA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),gA=r(function(e,t){return f(Ao,function(e){return e.toMsg},f(vg,function(e){return e.b},f(vg,function(e){return e.onMinedTagger},f(Vh,t,e))))}),vA=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(f){return{blockHash:r,blockNumber:n,from:i,gas:c,gasPrice:s,hash:e,input:f,nonce:t,to:o,transactionIndex:a,value:u}}}}}}}}}}}},yA=function(e){return _E(M([$E(ci),f(Oi,si,e)]))},mA=l(DE,"input",zo,l(DE,"gas",by,l(DE,"gasPrice",aA,l(DE,"value",aA,l(DE,"to",yA(UE),l(DE,"from",UE,l(DE,"transactionIndex",by,l(DE,"blockNumber",yA(by),l(DE,"blockHash",function(e){return f(qo,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},Ko(t))?Fi(ci):f(Oi,si,e)},zo)}(VE),l(DE,"nonce",by,l(DE,"hash",jE,Fi(vA)))))))))))),bA=r(function(e,t){return pp({decoder:mA,method:"eth_getTransactionByHash",params:M([fA(t)]),url:e})}),CA=r(function(e,t){return{attempts:e,sleep:t}}),EA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Np,function(e){return a>0?f(bp,function(e){return f(EA,f(CA,a,n),t)},NE(1e3*n)):fp(e)},t)}),SA=r(function(e,t){return f(bp,function(r){return f(EA,{attempts:30,sleep:1},f(bA,e,t))},NE(250))}),TA=r(function(e,t){return f(EA,{attempts:60,sleep:5},f(lA,e,t))}),wA=function(e){return{$:"Mined",a:e}},IA=function(e){return Ao(function(t){return D(t,{status:wA(e)})})},AA=function(e){return{$:"Sent",a:e}},BA=function(e){return Ao(function(t){return D(t,{status:AA(e)})})},kA=function(e){return{$:"Signed",a:e}},NA=function(e){return Ao(function(t){return D(t,{status:kA(e)})})},RA=function(e){return"Nothing"!==e.$},$A=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Zf(r),go);case"TxSigned":var n=e.a,a=e.b,i=f(Vh,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(Ag,t,lp(a))}return go}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return go;if("Just"===t.b.$){var r=t.b.a;return f(Ag,r,lp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Ag,a,lp(fi(e)))}t.a,t.b,t.c;return go};if("Ok"===a.$){var c=a.a,d=RA(o.onBroadcastTagger)||RA(o.onMinedTagger)?f(Pf,r.tagger,f(Rp,pA(n),f(SA,r.nodePath,c))):go;return L(Zf(D(r,{txs:l(Jh,n,NA(c),r.txs)})),po(M([u,d])))}var h=a.a;return L(Zf(r),po(M([u,s(h)])))}return L(Zf(r),go);case"TxSent":var n=e.a,p=e.b,g=f(Vh,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Pf,r.tagger,f(Rp,hA(n),f(TA,r.nodePath,v.hash))):go}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Ag,t,lp(li(v)))}return go}();return L(Zf(D(r,{txs:l(Jh,n,BA(v),r.txs)})),po(M([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(Ag,t,lp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Ag,n,lp(fi("Error with TxSent stuff")))}e.a,e.b;return go}();return L(Zf(r),s)}return L(Zf(r),go);case"TxMined":var n=e.a,m=e.b,b=f(Vh,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Ag,a,lp(li(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 po(M([f(Pf,r.tagger,f(Rp,f(dA,n,s),Cy(r.nodePath))),f(Ag,a,lp(li(C))),f(Ag,u.toMsg,lp(s))]))}return go}();return L(Zf(D(r,{txs:l(Jh,n,IA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Ag,r,lp(fi("TxReceipt decoding failure")))}return go}();return L(Zf(r),S)}return L(Zf(r),go);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(gA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Zf(r),f(Ag,B,f(Np,function(e){return lp(D(I,{doneWatching:!0,reOrg:!0}))},f(bp,function(e){return lp(D(I,{doneWatching:!0}))},f(lA,r.nodePath,T.txHash)))))}return L(Zf(r),go)}if(R(w,T.lastCheckedBlock))return L(Zf(r),f(Pf,r.tagger,f(Rp,f(dA,n,T),f(bp,function(e){return Cy(r.nodePath)},NE(2e3)))));var k=f(gA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Zf(r),po(M([f(Pf,r.tagger,f(Rp,f(dA,n,I),f(bp,function(e){return Cy(r.nodePath)},NE(2e3)))),f(Ag,B,lp(I))])))}return L(Zf(r),go)}var n=e.a,h=e.c.a;return L(Zf(r),go);default:var h=e.a;return L(Zf(r),go)}}),_A=Jt,LA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),xA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),PA=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(xA,"#",e.fragment,l(xA,"?",e.query,U(f(LA,e.port_,U(t,e.host)),e.path)))},DA=r(function(e,t){return e<0?ci:kl(f(xl,e,t))}),UA=r(function(e,t){if(e<0)return t;var r=ah(f(xl,e,t)),n=f(js,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),OA=n(function(e,t,r){if(e<0)return r;var n=f(xl,e,r),a=f(js,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),MA=r(function(e,t){return f(OA,e,Qu(t))}),FA=r(function(e,t){gv(t);switch(t.$){case"Home":return L(D(e,{submodel:HS}),go);case"Create":var r=Nd(e.wallet),n=f(hl,e.txSentry,f(Bo,fy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(KA,U(f(Qi,fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:cy(r.model),txSentry:a}),po(M([f(Pf,fy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(ey,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(qy,e.wallet,r)}return l(Hy,e.wallet,u,s)}(),c=f(hl,e.txSentry,f(Bo,hy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(KA,U(f(Qi,hy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:dy(r.model),txSentry:a}),po(M([f(Pf,hy,r.cmd),i]))));case"Marketplace":var d=Qg(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:ly(h)}),po(M([f(Pf,qS,p)])));case"AgentHistory":var g=t.a,v=f(vo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:sy(y)}),po(M([f(Pf,VS,m)])));default:return L(f(uo,rA,e),go)}}),VA=r(function(e,t){var r=t.a,n=t.b,a=f(HA,KS(e),r),i=a.a,o=a.b;return L(i,po(M([n,o])))}),KA=r(function(e,t){var r=t.a,n=t.b;return l(Ra,VA,L(r,n),e)}),HA=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(HA,jS,t);case"GotoRoute":var n=r.a;return L(t,f(zv,t.key,n));case"GTag":var a=r.a;return L(t,Qv(Wv(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),Qv(Wv(d(pl,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(fv,ty,o,u,s));default:return L(t,ry(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(UA,c,t.userNotices)}),go);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(Gv,t.key,PA(e))}var r=h.a;return _A(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(jA,g,t);case"GotoRoute":var v=e.a;return L(t,po(M([Qv(Wv(d(pl,"GotoRoute","navigation",gv(v),0))),f(zv,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),go);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,tA,t),go):L(t,Yv(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return go;var t=e.a;return Xv(f(Jv,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Th,zo,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=nA(l(gl,I,w,S)),B=f(py,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(Vf,"Unexpected wallet state encounted when setting commPubkey!",ci),t),go)}T.a;return L(f(uo,f(Vf,"User pubkey set, but I can no longer find the user address!",ci),t),go)}var N=E.a;return L(l(Pa,uo,f(Vf,"error decoding commPubkey from JS",N),t),go);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(Hg,R,_),P=f(hl,t.txSentry,f(Bo,fy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(KA,U(f(Qi,fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:cy(x.model),txSentry:O}),po(M([f(Pf,fy,x.cmd),F]))))}return L(t,go);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(sS,K,j),q=f(hl,t.txSentry,f(Bo,hy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(KA,U(f(Qi,hy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:dy(x.model),txSentry:O}),po(M([f(Pf,hy,x.cmd),F]))))}return L(t,go);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(cv,G,Y);return f(KA,f(Qi,qS,x.appCmds),L(D(t,{submodel:ly(x.model)}),f(Pf,qS,x.cmd)))}return L(t,go);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(Df,W,Q),X=f(hl,t.txSentry,f(Bo,VS,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(KA,U(f(Qi,VS,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:sy(x.model),txSentry:O}),po(M([f(Pf,VS,x.cmd),F]))))}return L(t,go);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(lu,si,f($A,Z,r))}return L(ci,go)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(DA,re,t.tradeCaches);if("Nothing"===ae.$)return f(VA,pa(f(Vf,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,go));var ie=ae.a,x=f(FS,ne,ie);return L(D(t,{tradeCaches:l(MA,re,x.tradeCache,t.tradeCaches)}),f(Pf,GS(re),x.cmd));case"NoOp":return L(t,go);default:var N=e.a;f(Mf,"test",N);return L(t,go)}}),jA=r(function(e,t){return f(FA,t,qv(e))}),qA=Ge("txIn",LE),GA=je("txOut",Ua),zA=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},YA=function(e){return{$:"EventSentryMsg",a:e}},WA=function(e){var t=f(Dy,YA,Nh(e)),r=t.a,n=t.b;return x({dataFetchState:l(_S,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Rd,"tradeCache init","processing",zA(e),0)]))},JA=function(e){return{$:"InitialNumTradesFetched",a:e}},QA=function(e){return f(pS,e.factory,JA)},XA=function(e){var t=WA(e),r=t.a,n=t.b,a=t.c;return x(r,po(M([n,QA(r)])),a)},ZA=function(e){return{$:"TxSentryMsg",a:e}},eB={align:Uf,label:"noWeb3Provider",mainParagraphs:M([M([Ff("No web3 provider detected. Is "),f(zI,M([eA(l(WI,0,0,1))]),{label:Ff("Metamask"),url:"https://metamask.io/"}),Ff(" or some other web3 provider installed and unlocked?")])]),noticeType:lg},tB={$:"TopLeft"},rB={align:tB,label:"screenToSmall",mainParagraphs:M([M([Ff("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:lg},nB={align:Uf,label:"wrongWeb3Network",mainParagraphs:M([M([Ff("Your wallet is set to an incorrect network.")]),M([Ff("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:sg},aB={$:"NoneDetected"},iB=function(e){return{$:"OnlyNetwork",a:e}},oB=function(e){return f(Ao,Nh,yg(e))},uB={$:"ETCMain"},sB={$:"ETCTest"},cB={$:"Expanse"},fB={$:"Kovan"},lB={$:"Mainnet"},dB=function(e){return{$:"Private",a:e}},hB={$:"Rinkeby"},pB={$:"Ropsten"},gB={$:"RskMain"},vB={$:"RskTest"},yB=function(e){switch(e){case 1:return lB;case 2:return cB;case 3:return pB;case 4:return hB;case 30:return gB;case 31:return vB;case 42:return fB;case 41:return uB;case 62:return sB;default:return dB(e)}},mB=n(function(e,t,r){var n=e.a,a=e.b;return Zf({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Fh})}),bB=n(function(e,t,n){var a=e.networkId?iB(yB(e.networkId)):aB,i=f(Ao,function(e){return l(mB,L(GA,qA),ZA,e)},oB(a)),o=e.width<1024?si(rB):ci,u=f(xa,XA,ro),s=function(){return R(a,aB)?si(eB):"Nothing"===yg(a).$?si(nB):ci}(),c=IC(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=$v(f(Bi,r(function(e,t){return f(Qi,GS(e),t)}),g)),y=po(f(Bi,r(function(e,t){return f(Pf,GS(e),t)}),p)),m=f(KA,v,f(jA,t,{key:n,screenWidth:e.width,submodel:HS,time:ml(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),po(M([y,C])))}),CB=Oe,EB=CB(yr),SB=function(e){return EB},TB=function(e){return{$:"Refresh",a:e}},wB=r(function(e,t){return{$:"Every",a:e,b:t}}),IB=r(function(e,t){return{processes:t,taggers:e}}),AB=lp(f(IB,Fh,Fh)),BB=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(eS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),kB=Ne,NB=r(function(e,t){var r=e.a,n=e.b,a=f(Vh,r,t);if("Nothing"===a.$)return l(fl,r,M([n]),t);var i=a.a;return l(fl,r,f(ka,n,i),t)}),RB=Be,$B=r(function(e,t){return{$:"Zone",a:e,b:t}}),_B=ca,LB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=RB(f(_B,n,f(Zh,e,n)));return f(bp,function(t){return l(LB,e,a,l(fl,n,t,r))},i)}return lp(r)}),xB=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 x(n,a,f(bp,function(e){return i},kB(t)))}),u=l(Ra,NB,Fh,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(fl,e,r,i),o)}),d=p(BB,s,c,o,u,i,x(yr,Fh,lp(gr))),h=d.a,g=d.b,v=d.c;return f(bp,function(e){return lp(f(IB,u,e))},f(bp,function(t){return l(LB,e,h,g)},v))}),PB=function(e){return we(function(t){t(Se(e(Date.now())))})}(ml),DB=n(function(e,t,r){var n=f(Vh,t,r.taggers);if("Nothing"===n.$)return lp(r);var a=n.a,i=function(t){return Tp(f(xa,function(r){return f(Xh,e,r(t))},a))};return f(bp,function(e){return lp(r)},f(bp,i,PB))}),UB=r(function(e,t){var r=t.a,n=t.b;return f(wB,r,f(Da,e,n))});pn.Time=Pe(AB,xB,DB,0,UB);var OB=Ue("Time"),MB=r(function(e,t){return OB(f(wB,e,t))}),FB=function(e){return f(MB,2e3,TB)},VB=function(e){return EB},KB=function(e){return{$:"DecryptionFinished",a:e}},HB=Ge("decryptionFinished",LE),jB=Ge("encryptionFinished",LE),qB=function(e){return{$:"EncryptionFinished",a:e}},GB=function(e){return{$:"Refresh",a:e}},zB=function(e){return CB(M([f(MB,3e3,GB),jB(qB),HB(function(e){return XC(KB(e))})]))},YB=yn,WB=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return EB;case"CreateModel":t.a;return f(YB,fy,FB());case"TradeModel":t.a;return f(YB,hy,zB());case"MarketplaceModel":t.a;return f(YB,qS,VB());default:t.a;return f(YB,VS,SB())}},JB=Ge("userPubkeyResult",LE),QB=Ge("walletSentryPort",LE),XB={$:"CheckForNewTrades"},ZB={$:"UpdateTradePhases"},ek=function(e){return CB(M([f(MB,5e3,function(e){return XB}),f(MB,3e3,function(e){return ZB})]))},tk=function(e){return{$:"Tick",a:e}},rk=function(e){return{$:"UserPubkeySet",a:e}},nk=function(e){return{$:"WalletStatus",a:e}},ak=function(e){return f(Vf,"Error decoding JS walletSentry: "+e,ci)},ik=function(e){return{$:"ErrorDecoding",a:e}},ok=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),uk=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(gh,"ref",BC),f(gh,"txHash",uA(jE))),sk=function(e){var t=f(Th,uk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(ok,r.ref,li(a))}return f(ok,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return ik("Error decoding tx data")},ck=function(e){var t=e.a;return f(YB,t.tagger,t.inPort(sk))},fk=f(Oi,yB,BC),lk=Yo(f(Io,Ll,f(Io,sd("Failure decoding stringy int"),Uo(yB)))),dk=_E(M([lk,fk])),hk=r(function(e,t){return{account:e,networkId:t}}),pk=l(Mi,hk,f(gh,"account",uA(UE)),f(gh,"networkId",dk)),gk=n(function(e,t,r){var n=f(Th,pk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),vk=function(e){var t=f(Io,ak,f(Io,pa,KS));return CB(U(M([f(MB,1e3,tk),QB(f(gk,t,nk)),f(hc,EB,f(Ao,ck,e.txSentry)),JB(rk),CB(f(Bi,r(function(e,t){return f(YB,GS(e),t)}),f(xa,ek,e.tradeCaches)))]),M([WB(e)])))},yk=function(e){return{$:"LinkClicked",a:e}},mk=function(e){return{$:"UrlChanged",a:e}},bk=n(function(e,t,r){return d(YI,e/255,t/255,r/255,1)}),Ck=l(bk,10,33,108),Ek={$:"Generic"},Sk=Ek,Tk=r(function(e,t){return d(qI,uT,Sk,f(ka,rT(eT),f(ka,XS(eT),e)),iT(M([t])))}),wk=function(e){return{$:"Fill",a:e}},Ik=wk(1),Ak=Hi,Bk=function(e){return{$:"Px",a:e}},kk=Bk,Nk=xT(8),Rk=function(e){return f(XI,Nk,l(QI,"bg-"+ZI(e),"background-color",e))},$k=f(Tk,M([rT(Ik),XS(kk(150)),Rk(Ck)]),Ak),_k=function(e){return{$:"GotoRoute",a:e}},Lk={$:"Active"},xk={$:"Important"},Pk={$:"Normal"},Dk=l(WI,1,1,1),Uk=xT(2),Ok=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),Mk=r(function(e,t){return R(e,t)?f(XI,Uk,h(Ok,"p-"+Ni(e),e,e,e,e)):f(XI,Uk,h(Ok,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Fk=xT(21),Vk=r(function(e,t){return{$:"Class",a:e,b:t}}),Kk=f(Vk,Fk,lT.cursorPointer),Hk=xT(17),jk=function(e){return f(XI,Hk,l(II,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},qk=function(e){return{$:"Normal",a:e}},Gk=An,zk=r(function(e,t){return f(Gk,e,qk(t))}),Yk=function(e){return f(zk,"click",Fi(e))},Wk=f(Da,nT,Yk),Jk=xT(13),Qk=f(Vk,Jk,lT.textSemiBold),Xk=xT(4),Zk=function(e){return{$:"FontSize",a:e}},eN=function(e){return f(XI,Xk,Zk(e))},tN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([jk(4),Rk(l(WI,0,0,1))]);default:return M([jk(4),Rk(l(WI,.9,0,0))])}}();return f(Tk,U(M([f(Mk,23,12),eN(22),Qk,eA(Dk),Kk,Wk(t)]),n),Ff(e))}),rN=l(bk,244,0,103),nN=function(e){return{$:"AlignX",a:e}},aN={$:"CenterX"},iN=nN(aN),oN=xT(3),uN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),sN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),cN=function(e){return f(XI,oN,l(uN,f(sN,e,e),e,e))},fN=function(e){return{$:"Describe",a:e}},lN={$:"Paragraph"},dN=r(function(e,t){return d(qI,wT,Sk,f(ka,fN(lN),f(ka,rT(Ik),f(ka,cN(5),e))),iT(t))}),hN=f(Vk,Jk,lT.bold),pN=f(Tk,M([eN(29),eA(Dk),hN,iN,Kk,Wk(_k(bv))]),f(dN,yr,M([Ff("DAI"),f(Tk,M([eA(rN)]),Ff("Hard"))]))),gN={$:"Right"},vN=nN(gN),yN={$:"AsColumn"},mN=yN,bN=r(function(e,t){return d(qI,mN,Sk,f(ka,GI(lT.contentTop+" "+lT.contentLeft),f(ka,XS(eT),f(ka,rT(eT),e))),iT(t))}),CN={$:"AsRow"},EN=CN,SN=r(function(e,t){return d(qI,EN,Sk,f(ka,GI(lT.contentLeft+" "+lT.contentCenterY),f(ka,rT(eT),f(ka,XS(eT),e))),iT(t))}),TN=function(e){return f(SN,M([rT(Ik),cN(30),f(Mk,30,17)]),M([l(tN,"Browse Offers",_k(Cv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Lk}return Pk}()),l(tN,"Create a New Offer",_k(mv),function(){return"CreateModel"===e.submodel.$?Lk:Pk}()),function(){var t=Td(e.wallet);if("Just"===t.$){var r=t.a;return l(tN,"My Trades",_k(yv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Lk:Pk}return Pk}())}return l(tN,"Connect to Wallet",jS,xk)}(),f(bN,M([vN,cN(0),f(Mk,8,0)]),M([pN]))]))},wN=YI,IN=r(function(e,t){return f(Tk,M([jk(4),Rk(d(wN,0,0,1,.1)),eA(l(bk,16,7,234)),eN(e),Qk,f(Mk,15,13)]),Ff(Kf(t)))}),AN=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),BN=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(XI,Uk,h(Ok,"p-"+Ni(t),t,t,t,t)):f(XI,Uk,h(Ok,d(AN,t,r,n,a),t,r,n,a))},kN=function(e){return function(){var t=Td(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?f(Tk,M([f(Mk,30,10),eN(24),Qk]),Ff("Your Trades")):f(SN,M([cN(10),BN({bottom:30,left:30,right:30,top:10})]),M([f(Tk,M([eN(24),Qk]),Ff("Trade History for User")),f(IN,18,e.agentAddress)]))},NN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},RN=function(e){return Yf(e)},$N={$:"BurnWindow"},_N={$:"FiatPrice"},LN={$:"Margin"},xN={$:"Offer"},PN={$:"PaymentWindow"},DN=function(e){return{$:"AlignY",a:e}},UN={$:"CenterY"},ON=DN(UN),MN=xT(20),FN=f(Vk,MN,lT.clip),VN=wk,KN=function(e){return f(XI,Uk,h(Ok,"p-"+Ni(e),e,e,e,e))},HN=r(function(e,t){return f(Tk,M([rT(VN(e)),XS(kk(60)),FN,Rk(Dk)]),f(Tk,M([KN(12),ON,rT(Ik)]),t))}),jN=function(e){switch(e.$){case"Phase":return 1;case"Expires":return 2;case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},qN=function(e){return{$:"JustImage",a:e}},GN=qN({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),zN=zS("alt"),YN=function(e){return f(zS,"src",rt(e))},WN=r(function(e,t){var r=t.src,n=t.description,a=f(Yf,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(qI,uT,Sk,f(ka,GI(lT.imageContainer),e),iT(M([d(qI,uT,aT("img"),U(M([nT(YN(r)),nT(zN(n))]),a),iT(yr))])))}),JN=r(function(e,t){if("None"===t.$)return Ak;var r=t.a;return f(WN,e,r)}),QN=qN({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),XN=function(e){return{$:"ChangeSort",a:e}},ZN=f(Vk,Jk,lT.textMedium),eR=function(e){return f(Tk,M([ZN,eN(17)]),Ff(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},tR=r(function(e,t){return f(SN,M([cN(5),Kk,Wk(XN(e))]),M([eR(e),function(){if("Just"===t.$){var e=t.a;return f(Tk,M([ON]),f(JN,M([rT(kk(8))]),function(){return"Ascending"===e.$?QN:GN}()))}return Ak}()]))}),rR=r(function(e,t){return f(HN,jN(t),f(tR,t,e))}),nR=r(function(e,t){return f(SN,M([rT(Ik)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(rR,r,t)},t))}),aR=l(bk,150,150,150),iR=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},oR=r(function(e,t){return f(xu,e.amount,t.amount)}),uR=r(function(e,t){return f(xu,El(e),El(t))}),sR=n(function(e,t,r){return f(e,r,t)}),cR=function(e){var t=e.a;return(R(e.b,lo)?sR:Ua)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(cR,L(Jg,lo),e,t):l(sR,Eu,iR(e.state.phase),iR(t.state.phase))});case"Expires":return r(function(e,t){return f(qg,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(uR,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(oR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(hc,ma,l(wd,r(function(e,t){return f(Eu,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(qg,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(qg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},fR=l(bk,233,237,242),lR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),dR=function(e){return f(Tk,M([rT(Ik),XS(Ik),FN]),f(dN,M([eN(12)]),M([Ff(e.info)])))},hR=function(e){return f(hc,Ak,f(Ao,dR,kl(e)))},pR=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"}},gR=function(e){return{$:"TimeLeft",a:e}},vR=function(e){return{$:"TimeUp",a:e}},yR=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 ml(0)}}),mR=r(function(e,t){return ml(Ed(e)-Ed(t))}),bR=r(function(e,t){var r=f(yR,t.state.phase,t),n=f(mR,e,t.state.phaseStartTime),a=f(mR,r,n);return Ed(a)>0?gR(L(a,r)):vR(r)}),CR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},ER=l(WI,0,0,0),SR=l(bk,51,183,2),TR=function(e){var t=Tu(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Ro(n));return n+(function(){if(a){return f(Po,a+1,f(_o,1,ZT(r)))}return""}()+"%")},wR=r(function(e,t){return qN({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"}()})}),IR=n(function(e,t,r){return f(JN,f(ka,XS(kk(34)),e),f(wR,t,r))}),AR=r(function(e,t){var r=TR(t);if("0%"===r)return f(Tk,M([eN(16)]),Ff("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?SR:rN;return f(SN,M([cN(4)]),M([l(IR,yr,a,si(i)),f(Tk,M([eA(o),eN(16)]),Ff(n))]))}),BR=qN,kR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(fl,r,n,t)}),Fh,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,BR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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","₫")]))),NR=function(e){return f(hc,"",f(Ao,Qa,f(Vh,e,kR)))},RR=function(e){return Ro(e)<=3?e:RR(f(ed,3,e))+","+f(Mo,3,e)},$R=function(e){return RR(Zl(e))},_R=function(e){return U(NR(e.fiatType),$R(e.amount))},LR=function(e){var t=function(){var t=f(Vh,e.fiatType,kR);if("Nothing"===t.$)return Ak;var r=t.a,n=(r.a,r.b);return f(JN,M([XS(kk(26))]),n)}();return f(SN,M([cN(4)]),M([t,f(Tk,M([eA(d(wN,0,0,0,.5)),ZN,rT(kk(50))]),Ff(e.fiatType)),Ff(_R(e))]))},xR=function(e){return Ed(e)<0},PR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),DR=function(e){var t=zp(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(PR,Ob(t),Ob(r),Ob(n),Ob(a))}(f(hc,L(wu(0),wu(0)),f(rs,n,wu(60))))}(f(hc,L(wu(0),wu(0)),f(rs,r,wu(3600))))}(f(hc,L(wu(0),wu(0)),f(rs,t,wu(86400))))},UR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!xR(a)){var u=r(function(e,t){return U(l(cs,2,P("0"),Ni(e)),t)}),s=Ed(a)>0?i:o,c=DR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(SN,U(M([cN(5)]),e),M([f(Tk,U(M([eA(h)]),t),Ff(f(u,c.days,"d"))),f(Tk,U(M([eA(d)]),t),Ff(f(u,c.hours,"h"))),f(Tk,U(M([eA(s)]),t),Ff(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=ml(0);e=p,t=g,n=v,a=y}}),OR={$:"Behind"},MR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),FR=function(e){return f(MR,OR,e)},VR=r(function(e,t){var r=Fg(200*e),n=200-r,a=f(Tk,M([rT(VN(n))]),Ak),i=M([XS(kk(3)),jk(20)]),o=f(Tk,U(i,M([rT(VN(r)),Rk(t)])),Ak),u=f(Tk,U(i,M([rT(Ik),Rk(fR)])),Ak);return f(SN,M([rT(Ik),FR(u)]),M([o,a]))}),KR=l(WI,1,1,0),HR=r(function(e,t){return Ed(e)/Ed(t)}),jR=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(HR,o,u),c=(f(Tk,M([iN]),d(UR,yr,yr,L(a,i),o)),s<.1?rN:s<.2?KR:SR);return f(bN,U(M([cN(5)]),e),M([d(UR,M([iN]),t,L(a,i),o),f(VR,1-s,c)]))}),qR=function(e){var t=td(El(e)),r=f(Nl,".",t);if(!r.b)return t;if(r.b.b){Mf("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Po,3,t);case 1:return f(Po,4,f(hc,t,f(Ao,ZT,f(Ao,function(e){return e/100},f(Ao,Ka,f(Ao,Fg,f(Ao,ti(100),ad(t))))))));default:var n=r.a;return f(hc,f(Po,n,t),f(Ao,Ni,f(Ao,Fg,ad(t))))}},GR=n(function(e,t,r){return f(HN,jN(t),function(){switch(t.$){case"Phase":return Ff(CR(r.state.phase));case"Expires":if("Open"===r.state.phase.$){var n=f(bR,e,r);if("TimeLeft"===n.$){var a=n.a,i=f(HR,a.a,a.b)<.05?rN:ER;return d(jR,M([rT(Ik)]),M([eN(16)]),L(i,fR),a)}var o=n.a;return d(jR,M([rT(Ik)]),M([eN(16)]),L(rN,fR),L(ml(0),o))}return Ak;case"Offer":return f(SN,M([cN(5)]),M([Ff(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(qR(r.parameters.tradeAmount)+" ")+pR(r.factory))]));case"FiatPrice":return LR(r.terms.price);case"Margin":var u=R(r.parameters.initiatorRole,sb);return f(hc,Ak,f(Ao,AR(u),r.derived.margin));case"PaymentWindow":var s=function(){return"Seller"===r.parameters.initiatorRole.$?rN:SR}(),c=_(Ed(r.parameters.autoabortInterval),216e5)<0?s:ER;return d(UR,yr,yr,L(c,fR),r.parameters.autoabortInterval);default:var s=function(){return"Seller"===r.parameters.initiatorRole.$?SR:rN}(),c=_(Ed(r.parameters.autoabortInterval),216e5)<0?s:ER;return d(UR,yr,yr,L(c,fR),r.parameters.autoreleaseInterval)}}())}),zR=n(function(e,t,r){return f(bN,M([rT(Ik),cN(1),Rk(fR),Kk,Wk(f(lR,r.factory,r.id))]),M([f(SN,M([rT(VN(6)),cN(1)]),f(xa,function(t){return l(GR,e,t,r)},t)),f(HN,1,hR(r.terms.paymentMethods))]))}),YR=Er,WR=xT(28),JR=function(e){return f(XI,WR,l(QI,"bc-"+ZI(e),"border-color",e))},QR=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),XR=function(e){return f(XI,FI,h(QR,"b-"+Ni(e),e,e,e,e))},ZR=a(function(e,t,r,n){return f(bN,M([rT(Ik),XR(2),jk(8),JR(aR),cN(2),Rk(aR),FN]),f(xa,f(zR,e,r),f(YR,cR(t.orderBy),n)))}),e$=a(function(e,t,r,n){return f(bN,M([rT(Ik),XS(Ik),KN(30),cN(5)]),M([f(nR,t.orderBy,r),d(ZR,e,t,r,n)]))}),t$=n(function(e,t,r){return R(t,yr)?Ak:f(Yi,Eo,d(e$,e,r.tradeTable,M([ho,xN,_N,LN,PN,$N]),t))}),r$=function(e){return f(Yf,function(e){return qm(e.parameters)},bS(e))},n$={$:"NoneFound"},a$={$:"AllFetched"},i$={$:"FetchingTrades"},o$={$:"QueryingNumTrades"},u$=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return o$;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?i$:a$}return n$},s$=n(function(e,t,r){var n=$v(f(xa,function(e){return f(RN,NN(r),r$(e))},t)),a=n,i=function(e){return f(Tk,M([eN(24),Qk,eA(aR),iN,KN(20)]),Ff(e))},o=f(Xd,Ja(n$),f(xa,u$,t))?M([i("No trades found.")]):f(xa,i,IC(f(xa,function(e){switch(u$(e).$){case"QueryingNumTrades":return si(zA(e.factory)+"Querying Factory...");case"NoneFound":return ci;case"FetchingTrades":return si(zA(e.factory)+"Fetching Trades");default:return ci}},t)));return f(bN,M([cN(10)]),M([function(){return o.b?f(bN,M([cN(5)]),o):Ak}(),l(t$,e,a,r)]))}),c$=n(function(e,t,r){return f(bN,M([jk(5),Rk(Dk),rT(Ik),XS(Ik),f(Mk,0,20)]),M([kN(r),l(s$,e,t,r)]))}),f$=function(e){return{$:"ShowCurrencyDropdown",a:e}},l$={$:"AbortCreate"},d$=function(e){return{$:"AppCmd",a:e}},h$=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),p$=function(e){return f(xa,function(e){return M([f(Tk,M([eA(rN)]),Ff("Caution! ")),Ff(e)])},IC(M([R(f(qg,e.autoreleaseInterval,ml(12e5)),ba)?si(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."}()):ci,R(f(qg,e.autoabortInterval,ml(36e5)),ba)?si(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.'}()):ci])))},g$=l(WI,0,0,1),v$=function(e){return f(Tk,M([BN({bottom:5,left:5,right:5,top:0}),Wk(e),jk(30),Rk(d(wN,1,1,1,.4)),XR(1),JR(d(wN,0,0,0,.3)),Kk,eN(14)]),f(Tk,M([eA(d(wN,0,0,0,.7))]),Ff("x")))},y$=Bn,m$=y$,b$=nT,C$=r(function(e,t){return f(Tk,M([FR(f(Tk,M([Rk(e),b$(f(m$,"position","fixed")),b$(f(m$,"z-index","1000")),b$(f(m$,"top","0")),b$(f(m$,"left","0")),b$(f(m$,"width","100%")),b$(f(m$,"height","100%"))]),Ak)),rT(Ik),XS(Ik)]),t)}),E$={$:"Top"},S$=DN(E$),T$={$:"InFront"},w$=function(e){return f(MR,T$,e)},I$=r(function(e,t){return{$:"Max",a:e,b:t}}),A$=r(function(e,t){return f(I$,e,t)}),B$=n(function(e,t,r){return l(Pa,C$,d(wN,0,0,.3,.6),f(Tk,U(M([iN,ON,rT(f(A$,500,eT)),Rk(Dk),jk(8),w$(f(Tk,M([vN,S$]),v$(r)))]),e),t))}),k$=r(function(e,t){if("Nothing"===t.$)return Ak;var r=t.a;return f(Tk,U(M([jk(5),JR(l(WI,.9,0,0)),XR(1),Rk(l(WI,1,.4,.4)),KN(5),iN,ON,rT(f(A$,200,eT)),eN(14)]),e),f(dN,yr,M([Ff(r)])))}),N$={$:"Above"},R$=function(e){return f(MR,N$,e)},$$=xT(26),_$=function(e){return{$:"MoveY",a:e}},L$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),x$=function(e){return f(L$,$$,_$(-e))},P$=r(function(e,t){return f(Tk,M([jk(4),f(Mk,25,17),eN(18),Qk,Rk(fR),R$(f(k$,M([x$(5)]),t))]),Ff(e))}),D$=a(function(e,t,r,n){return d(YI,e/255,t/255,r/255,n)}),U$=d(D$,1,31,52,.64),O$=xT(32),M$={$:"Active"},F$=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),V$=$n,K$={$:"NoAttribute"},H$=r(function(e,t){switch(t.$){case"NoAttribute":return K$;case"Describe":var r=t.a;return fN(r);case"AlignX":var n=t.a;return nN(n);case"AlignY":var a=t.a;return DN(a);case"Width":var n=t.a;return tT(n);case"Height":var n=t.a;return QS(n);case"Class":var n=t.a,a=t.b;return f(Vk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(XI,i,o);case"Nearby":var u=t.a,s=t.b;return f(MR,u,f(zi,e,s));case"Attr":var c=t.a;return nT(f(V$,e,c));default:var l=t.a,d=t.b;return f(L$,l,d)}}),j$=function(e){return f(H$,Ig,e)},q$=r(function(e,t){var r=t.a,n=t.b,a=j$(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(UI,n,o));default:return L(r,n)}}),G$=function(e){var t=l(Ra,q$,L(yr,HI),e),r=t.a,n=t.b;return f(ka,AI(n),r)},z$=function(e){return f(XI,O$,f(F$,M$,G$(e)))},Y$=xT(33),W$={$:"Hover"},J$=function(e){return f(XI,Y$,f(F$,W$,G$(e)))},Q$=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Tk,M([jk(4),Kk,Wk(n),f(Mk,25,17),eA(t),eN(18),Qk,Rk(a),z$(M([Rk(o)])),J$(M([Rk(i)]))]),Ff(r))}),X$=r(function(e,t){return d(Q$,x(d(wN,1,0,0,1),d(wN,1,0,0,.8),d(wN,1,0,0,.6)),Dk,e,t)}),Z$=xT(12),e_=f(Vk,Z$,lT.textCenter),t_=function(e){return C$(d(wN,0,0,.3,.6))(f(bN,M([cN(10),iN,ON,Rk(d(wN,0,0,0,.5)),jk(8),KN(20)]),f(xa,function(e){return f(dN,M([iN,ON,eN(20),Qk,eA(Dk),e_]),M([e]))},e)))},r_=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+cA(t)}e.a;return"https://kovan.etherscan.io/tx/"+cA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+cA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+cA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+cA(t)}}),n_={$:"Bottom"},a_=DN(n_),i_=GI(lT.underline),o_=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(Ff(qR(fb(a))),f(X$,"Yes, I definitely want to open this trade.",l(h$,r,n,a)))}return L(Ff("??"),f(P$,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(B$,yr,f(bN,M([cN(20),KN(20),iN,XS(Ik),e_]),M([f(Tk,M([eN(26),Qk,iN,ON]),Ff("Just to Confirm...")),f(bN,M([cN(20),iN,ON]),f(xa,dN(M([iN,eN(18),ZN,eA(U$)])),U(p$(n),U(M([M([Ff("You will deposit "),i,Ff(" "+pR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([Ff("This ususally requires two Metamask signatures. Your "+pR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Tk,M([a_,iN]),o)])),l$);case"ApproveNeedsSig":var u=e.a;return f(Tk,M([Wk(d$(d(Rd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),t_(M([Ff("Waiting for user signature for the approve call."),Ff("(check Metamask!)"),Ff("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Tk,M([Wk(d$(d(Rd,"txChainModal clicked","misclick","ApproveMining",0)))]),t_(M([Ff("Mining the initial approve transaction..."),f(zI,M([i_,eA(g$)]),{label:Ff("See the transaction on Etherscan"),url:f(r_,eo(u),s)}),Ff("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Tk,M([Wk(d$(d(Rd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),t_(M([Ff("Waiting for user signature for the create call."),Ff("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Tk,M([Wk(d$(d(Rd,"txChainModal clicked","misclick","CreateMining",0)))]),t_(M([Ff("Mining the final create call..."),f(zI,M([i_,eA(g$)]),{label:Ff("See the transaction on Etherscan"),url:f(r_,r,s)}),Ff("You will be redirected when it's mined.")])))}}),u_=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Ak;var r=t.a;return f(o_,r,e)},s_=function(e){return{$:"TradeAmountChanged",a:e}},c_=zS("id"),f_=b$(c_("inputError")),l_=l(bk,109,127,138),d_=qN({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),h_=function(e){return f(JN,f(ka,XS(kk(26)),e),d_)},p_=function(e){return f(SN,M([cN(4)]),M([h_(yr),f(Tk,M([eN(24),ZN,eA(l_)]),Ff(pR(e)))]))},g_={$:"Left"},v_=nN(g_),y_=function(e){return{$:"HiddenLabel",a:e}},m_=y_,b_=zS("type"),C_=function(e){return L(e,!0)},E_=function(e){return{$:"MayStopPropagation",a:e}},S_=r(function(e,t){return f(Gk,e,E_(t))}),T_=r(function(e,t){return l(La,gh,t,e)}),w_=f(T_,M(["target","value"]),zo),I_=function(e){return f(S_,"input",f(Oi,C_,f(Oi,e,w_)))},A_=xT(0),B_=r(function(e,t){return{$:"Transparency",a:e,b:t}}),k_=function(e){var t=function(e){return 1-e}(f(rc,1,f(ei,0,e)));return f(XI,A_,f(B_,"transparency-"+zT(t),t))},N_=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),R_=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(qI,mN,aT("label"),e,iT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(qI,uT,Sk,a,iT(M([i])));switch(n.$){case"Above":return d(qI,mN,aT("label"),e,iT(M([o,r])));case"Below":return d(qI,mN,aT("label"),e,iT(M([r,o])));case"OnRight":return d(qI,EN,aT("label"),e,iT(M([r,o])));default:return d(qI,EN,aT("label"),e,iT(M([o,r])))}}),$_=gI,__=f(Da,nT,$_("autocomplete")),L_=l(WI,136/255,138/255,133/255),x_=l(WI,186/255,189/255,182/255),P_=f(Mk,12,12),D_=l(WI,1,1,1),U_=M([P_,jk(3),JR(x_),Rk(D_),XR(1),cN(3),rT(Ik)]),O_=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},M_=function(e){return f(Qd,O_,e)?K$:GI("focusable")},F_=function(e){return{$:"Label",a:e}},V_=function(e){if("HiddenLabel"===e.$){var t=e.a;return fN(F_(t))}return K$},K_=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},H_=function(e){return"HiddenLabel"===e.$},j_=ye,q_=r(function(e,t){return f(kn,e,j_(t))}),G_=q_("spellcheck"),z_=f(Da,nT,G_),Y_=W,W_=xT(47),J_=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(Y_(e))),o=(i-1)*t+f(hc,0,f(Ao,a,r))+f(hc,0,f(Ao,a,n));return f(XI,W_,l(II,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),Q_=zS("value"),X_=f(Da,nT,Q_),Z_={$:"LivePolite"},eL=fN(Z_),tL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(qT,"width",n)?L(r,n):L(f(ka,e,r),f(aS,"width",n));case"Height":e.a;return f(qT,"height",n)?L(r,n):L(f(ka,e,r),f(aS,"height",n));case"Describe":e.a;return f(qT,"described",n)?L(r,n):L(f(ka,e,r),f(aS,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(qT,"align-x",n)?L(r,n):L(f(ka,e,r),f(aS,"align-x",n));case"AlignY":return f(qT,"align-y",n)?L(r,n):L(f(ka,e,r),f(aS,"align-y",n));default:return f(qT,"transform",n)?L(r,n):L(f(ka,e,r),f(aS,"transform",n))}}),L(yr,Py),e).a},rL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,tL(e))}),nL=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}},aL=f(Da,Gi,Qu),iL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([nT(I_(n.onChange))]),o=U(U_,t),u=f(rL,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(Yf,K_,o),c=f(rL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(rL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(rL,o,function(e){return"Nearby"===e.$})),p=f(Yf,f(Da,Du,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([X_(n.text),nT(b_(a)),z_(e.spellchecked),GI(lT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return K$;var r=t.a;return __(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(nL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(N_,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(N_,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(hc,5,c);return x("textarea",U(M([z_(e.spellchecked),GI(lT.inputMultiline),f(hc,K$,f(Ao,__,e.autofill)),function(){if("Nothing"===u.$)return K$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return BN({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?K$:s.a?d(J_,n.text,v,u,g):K$}()]),h),M([aL(lI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(qI,uT,Sk,f(ka,rT(Ik),$v(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([w$(f(Tk,f(ka,P_,U(s,U(M([eA(L_),GI(lT.noTextSelection+" "+lT.passPointerEvents),JR(d(wN,0,0,0,0)),Rk(d(wN,0,0,0,0)),XS(Ik),rT(Ik),k_(""===n.text?1:0)]),r))),a))])}()]))),iT(M([d(qI,uT,aT(v),$v(M([M([M_(t),V_(n.label)]),y,i])),iT(m))])));return l(R_,f(ka,f(Vk,Fk,lT.cursorText),f(ka,H_(n.label)?K$:cN(5),f(ka,eL,u))),n.label,b)}),oL=iL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),uL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(oL,M([rT(Ik),XS(kk(40)),XR(0)]),{label:m_(r),onChange:i,placeholder:n,text:a});return f(SN,U(M([cN(5)]),e),IC(M([f(Ao,Tk(M([v_])),o),si(s),f(Ao,Tk(M([vN])),u)])))}),sL={$:"Below"},cL=function(e){return f(MR,sL,e)},fL=function(e){return f(L$,$$,_$(e))},lL=n(function(e,t,r){return p(uL,M([rT(kk(150)),ZN,eN(24),cL(f(k$,M([f_,fL(5)]),r))]),L(ci,si(f(Tk,M([Wk(d$(d(Rd,"click","misclick","dai symbol in dai input",0)))]),p_(e)))),"dai input",ci,t,s_)}),dL=r(function(e,t){return f(XI,FI,h(QR,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),hL=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?XR(r):f(dL,n,r):f(XI,FI,h(QR,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},pL=Tk(M([JR(fR),hL({bottom:2,left:0,right:0,top:0})])),gL=r(function(e,t){return f(bN,M([cN(10)]),M([f(Tk,M([eN(17),Qk]),Ff(e)),t]))}),vL=r(function(e,t){return pL(f(gL,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(lL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),yL=function(e){return f(hc,wE,yg(e))},mL=function(e){var t=function(){var t=zl(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+qR(f(Tl,r,100))+" "+pR(yL(e.wallet))+"."}return"There is a 1% fee."}();return f(SN,M([iN,f(Mk,20,10),Rk(l(bk,10,33,108)),jk(8),cN(5),Wk(d$(d(Rd,"click","misclick","fee notify element",0)))]),M([f(Tk,M([eN(18),eA(l(bk,0,226,255)),Qk]),Ff(t)),f(Tk,M([eN(17),eA(Dk),ZN]),Ff("We only collect this fee when trades resolve successfully."))]))},bL=function(e){return{$:"FiatAmountChanged",a:e}},CL=function(e){return{$:"FiatTypeChanged",a:e}},EL=r(function(e,t){return l(eS,n(function(t,r,n){return f(e,t,r)?l(fl,t,r,n):n}),Fh,t)}),SL=function(e){return f(EL,r(function(t,r){return f(Ng,e,t)}),kR)},TL=qN({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),wL=function(e){return f(JN,M([XS(kk(26))]),f(hc,TL,f(Ao,Ho,f(Vh,e,kR))))},IL=function(e){return b$(f(S_,"click",Fi(L(e,!0))))},AL=aL,BL=function(e){return{$:"AppendProperty",a:e}},kL=r(function(e,t){return BL(e+":"+t)}),NL=r(function(e,t){return f(kL,e,t.value)}),RL=NL("cursor"),$L={$:"Compatible"},_L={cursor:$L,value:"default"},LL=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),xL=function(e){return{$:"PseudoClassSelector",a:e}},PL=function(e){return LL(xL(e))}("hover"),DL=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),UL=DL,OL=UL,ML=OL("span"),FL=r(function(e,t){return f(kn,et(e),rt(t))}),VL=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),KL=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),HL=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),jL=r(function(e,t){return t<>>32-e}),qL=function(e){var t=e.hash?e.seed^f(HL,461845907,f(jL,15,f(HL,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(HL,2246822507,r^r>>>16),a=f(HL,3266489909,n^n>>>13);return(a^a>>>16)>>>0},GL=r(function(e,t){return f(HL,5,f(jL,13,e^f(HL,461845907,f(jL,15,f(HL,3432918353,t)))))+3864292196}),zL=r(function(e,t){var r=t.hash|(255&yi(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(Ri,"",f(ka,t,f(xa,tP,r)));case"UniversalSelectorSequence":var r=e.a;return au(r)?"*":f(Ri,"",f(xa,tP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,tP,r)))}},nP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([eP(t),rP(r)]))},aP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,rP(t),f(xa,nP,r)),i=f(Ri,"",M([f(hc,"",f(Ao,Zx,n))]));return f(Ms,f(Ri," ",f(Yf,f(Da,Du,cd),a)),i)},iP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,aP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,Xx(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(Ri,",\n",f(xa,Gx,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,Jx,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(Ri,"\n\n",f(Yf,f(Da,Du,cd),M([Hx(t),f(Ri,"\n",f(xa,Yx,r)),f(Ri,"\n",f(xa,Wx,n)),f(Ri,"\n\n",f(xa,oP,a))])))},sP=function(e){return uP(Kx(Mx(e)))},cP=function(e){return f(Ri,"\n\n",f(xa,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(dx,t,yr,ci);return fP(M([dP(l(lP,r,yr,e))]))}),pP=function(e){return au(e)?"unstyled":f(as,P("_"),ps(f(YL,15739,cP(uS(WL(uS(f(hP,e,wx(yr)))))))))},gP=function(e){var t=pP(e),r=f(FL,"className",Hf(t));return l(VL,r,e,t)},vP=a(function(e,t,r,n){return f(e,f(ka,gP(t),r),n)}),yP=function(e){return{$:"Unstyled",a:e}},mP=function(e){return yP(aw(e))},bP=mP,CP=r(function(e,t){return f(Tn,e,Xe(t))}),EP=function(e){return En(Xe(e))},SP=r(function(e,t){var r=e.b,n=e.c;return au(r)?t:l(fl,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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,SP,i,s),p=l(Ra,IP,L(yr,h),c),g=p.a,v=p.b,o=l($T,u,f(xa,TP,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,SP,i,s),m=l(Ra,IP,L(yr,h),c),g=m.a,v=m.b,o=d(EP,y,u,f(xa,TP,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,SP,i,s),b=l(Ra,wP,L(yr,h),c),g=b.a,v=b.b,o=l(RT,u,f(xa,TP,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,SP,i,s),C=l(Ra,wP,L(yr,h),c),g=C.a,v=C.b,o=d(CP,y,u,f(xa,TP,s),$a(g));return L(f(ka,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(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,SP,n,o),c=l(Ra,IP,L(yr,s),u),h=c.a,p=c.b,a=l($T,i,f(xa,TP,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,SP,n,o),v=l(Ra,IP,L(yr,s),u),h=v.a,p=v.b,a=d(EP,g,i,f(xa,TP,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,SP,n,o),y=l(Ra,wP,L(yr,s),u),h=y.a,p=y.b,a=l(RT,i,f(xa,TP,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,SP,n,o),m=l(Ra,wP,L(yr,s),u),h=m.a,p=m.b,a=d(CP,g,i,f(xa,TP,o),$a(h));return L(f(ka,a,r),p)}}),AP=r(function(e,t){return h(il,al,e,t,ol,ol)}),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(cd(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),kP=function(e){var t=f(BP,ci,e);if("Nothing"===t.$)return Fh;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,wx(M([NP(t)])))},$P=function(e){return cP(uS(WL(f(xa,RP,Ia(e)))))},_P=function(e){return l($T,"style",yr,uS(aw($P(e))))},LP=n(function(e,t,r){var n=f(xa,TP,t),a=kP(t),i=l(Ra,IP,L(yr,a),r),o=i.a,u=i.b,s=_P(u);return l($T,e,n,f(ka,s,$a(o)))}),xP=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(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(xP,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),_P(e))}),UP=n(function(e,t,r){var n=f(xa,TP,t),a=kP(t),i=l(Ra,wP,L(yr,a),r),o=i.a,u=i.b,s=f(DP,u,o);return l(RT,e,n,f(ka,s,$a(o)))}),OP=a(function(e,t,r,n){var a=f(xa,TP,r),i=kP(r),o=l(Ra,wP,L(yr,i),n),u=o.a,s=o.b,c=f(DP,s,u);return d(CP,e,t,a,f(ka,c,$a(u)))}),MP=a(function(e,t,r,n){var a=f(xa,TP,r),i=kP(r),o=l(Ra,IP,L(yr,i),n),u=o.a,s=o.b,c=_P(s);return d(EP,e,t,a,f(ka,c,$a(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(LP,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 AL(VP(d(vP,ML,M([PL(M([RL(_L)]))]),yr,M([bP(e)]))))},HP=J,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(La,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 si(h(jP,n,a,i,o,u))}return ci}(),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 si(l(qP,a,t,i))}return ci}())}),L(ci,ci),e)},zP=r(function(e,t){var r=GP(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(qI,EN,Sk,f(ka,GI(lT.contentLeft+" "+lT.contentCenterY+" "+lT.wrapped),f(ka,rT(eT),f(ka,XS(eT),e))),iT(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?si(BN({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(qI,EN,Sk,f(ka,GI(lT.contentLeft+" "+lT.contentCenterY+" "+lT.wrapped),f(ka,rT(eT),f(ka,XS(eT),U(e,M([h]))))),iT(t))}var p=-s/2,g=-u/2;return d(qI,uT,Sk,e,iT(M([d(qI,EN,Sk,f(ka,GI(lT.contentLeft+" "+lT.contentCenterY+" "+lT.wrapped),f(ka,nT(f(m$,"margin",ZT(p)+"px "+ZT(g)+"px")),f(ka,nT(f(m$,"width","calc(100% + "+Ni(u)+"px)")),f(ka,nT(f(m$,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(XI,oN,l(uN,o,u,s)),yr))))),iT(t))])))}),YP=i(function(e,t,r,n,a){var i=f(oL,M([rT(kk(80)),XS(kk(40)),eN(24),ZN,JR(fR),IL(r)]),{label:m_("currency type"),onChange:f(Io,HP,n),placeholder:ci,text:t}),o=f(Vh,t,kR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return Ak;r.b;return f(zP,M([rT(kk(350)),JR(ER),XR(1),Rk(Dk),KN(10),iN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(SN,M([rT(kk(80)),cN(9),f(Mk,0,5),IL(n(t)),J$(M([Rk(l(WI,.8,.8,1))]))]),M([f(JN,M([XS(kk(26))]),a),f(Tk,M([eN(16),Qk]),KP(t))]))},Ia(SL(t))))}return Ak}();return f(SN,M([cN(4),cL(u)]),M([f(Tk,M([Wk(a)]),wL(t)),i]))}),WP=i(function(e,t,r,n,a){var i=d$(d(Rd,"click","misclick","currency flag",0)),o=f(Tk,M([Wk(d$(d(Rd,"click","misclick","currency symbol",0)))]),Ff(NR(e))),u=f(Tk,M([cL(f(k$,M([f_,fL(5)]),a))]),h(YP,r,e,f$(!0),CL,i));return p(uL,M([rT(kk(250)),ZN,eN(24),cL(f(k$,M([f_,fL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,bL)}),JP=function(e){return pL(f(gL,"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=d(D$,1,31,52,.13),ZP=r(function(e,t){var r=M([eN(24),ZN,Kk]),n=function(){return"Buyer"===t.$?L(r,U(r,M([eA(XP)]))):L(U(r,M([eA(XP)])),r)}(),a=n.a,i=n.b;return f(SN,M([cN(20)]),M([f(Tk,U(M([Wk(QP(vl))]),i),Ff("Sell "+e)),f(Tk,U(M([Wk(QP(sb))]),a),Ff("Buy "+e))]))}),eD=r(function(e,t){return f(gL,"Trade Type",f(ZP,pR(e),t.inputs.userRole))}),tD=xT(19),rD=function(e){return Ql(M([e.inset?"box-inset":"box-",ZT(e.offset.a)+"px",ZT(e.offset.b)+"px",ZT(e.blur)+"px",ZT(e.size)+"px",ZI(e.color)]))},nD=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(XI,tD,l(II,rD(t),"box-shadow",tw(t)))},aD=nD({blur:20,color:d(D$,0,0,0,.04),offset:L(0,3),size:0}),iD=f(Vk,oN,lT.spaceEvenly),oD=function(e){var t=yL(e.wallet);return f(bN,M([rT(Ik),cN(20),Rk(Dk),jk(5),KN(20),aD]),M([f(SN,M([rT(Ik),iD]),M([f(eD,t,e),f(vL,t,e),JP(e)])),mL(e)]))},uD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),sD={$:"Web3Connect"},cD=function(e){return f(Tk,M([iN]),function(){var t=L(Td(e),yg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(X$,"Open Trade",f(uD,n,r))}t.b;return f(P$,"Unsupported Network",ci)}t.a;return f(X$,"Connect to Wallet",sD)}())},fD=function(e){return{$:"AutoabortIntervalChanged",a:e}},lD=function(e){return{$:"ChangePaymentMethodText",a:e}},dD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),hD=dD,pD=function(e){return f(hD,M([eA(d(wN,0,0,0,.2))]),function(){return Ff("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")}())},gD={$:"TextArea"},vD=r(function(e,t){return l(iL,{autofill:ci,spellchecked:t.spellcheck,type_:gD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),yD=n(function(e,t,r){var n=f(Tk,M([eN(22),Qk]),Ff("Payment Method")),a=f(vD,M([rT(Ik),XS(kk(150)),Rk(d(D$,155,203,255,.2)),XR(0)]),{label:m_("payment method"),onChange:lD,placeholder:""===r?si(pD(t)):ci,spellcheck:!0,text:r});return f(bN,M([cN(20),BN({bottom:15,left:45,right:45,top:0}),rT(Ik),R$(f(k$,M([f_,fL(30),KN(10),eN(20),rT(kk(400))]),e))]),M([n,a]))}),mD=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."},bD=a(function(e,t,r,n){var a=l(cs,e,P("0"),Ni(n));return f(Tk,M([eN(22),eA(t)]),Ff(U(a,r)))}),CD=function(e){return Ed(e)<0?ml(0):e},ED=n(function(e,t,n){var a=r(function(e,r){return f(bN,M([cN(4)]),M([f(Tk,M([KN(4),Kk,Wk(n(f(Ym,t,e)))]),f(JN,M([XS(kk(10))]),QN)),r,f(Tk,M([KN(4),Kk,Wk(n(function(e){return Ed(e)?e:ml(3e5)}(CD(f(mR,t,e)))))]),f(JN,M([XS(kk(10))]),GN))]))}),i=DR(t);return f(SN,M([iD,cN(10)]),M([f(a,ml(864e5),d(bD,3,e," days",i.days)),f(a,ml(36e5),d(bD,2,e," hours",i.hours)),f(a,ml(3e5),d(bD,2,e," min",i.min))]))}),SD=o(function(e,t,r,n,a,i){var o=f(Tk,M([Rk(d(D$,155,203,255,.2)),jk(5),KN(15),R$(f(k$,M([f_]),a))]),l(ED,ER,n,i)),u=f(SN,M([cN(30)]),M([f(JN,M([XS(kk(40)),Wk(d$(d(Rd,"click","misclick","symbol for "+t,0)))]),e),f(Tk,M([eN(22),Qk]),Ff(t))])),s=f(dN,M([eN(17),ZN,eA(U$)]),M([Ff(r)]));return f(bN,M([rT(Ik),jk(10),Rk(l(bk,237,237,237)),cN(2)]),f(xa,Tk(M([Rk(Dk),f(Mk,45,18),rT(Ik)])),M([u,f(SN,M([rT(Ik),cN(25),Rk(Dk)]),M([o,s]))])))}),TD=qN({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),wD=f(Vk,MN,lT.clipX),ID=f(Vk,MN,lT.clipY),AD=i(function(e,t,r,n,a){return f(bN,M([cN(15),jk(8),wD,ID,Rk(Dk)]),M([p(SD,TD,"Payment Window",mD(a),r,n,fD),l(yD,t,a,e)]))}),BD=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},kD=function(e){return"Buyer"===e.$?"Once you confirm payment, the Seller has this time window to decide whether to release the funds to you or burn everything. If he doesn't decide before the time is up, funds are released to you by default.":"Once the Buyer confirms payment, you have this long to decide whether to release the funds to the Buyer or, in the case of an attempted scam, burn everything. If you don't decide before the time is up, funds are released to the Buyer by default."},ND=qN({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),RD=n(function(e,t,r){return f(Tk,M([jk(8),wD,ID,Rk(Dk)]),p(SD,ND,"Burn/Release Window",kD(r),e,t,BD))}),$D=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=qN({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),xD=n(function(e,t,r){return f(Tk,M([jk(8),Rk(Dk),wD,ID]),p(SD,LD,"Open Window",_D(r),e,t,$D))}),PD=function(e){return f(bN,M([rT(Ik),cN(20)]),M([l(xD,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(AD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(RD,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},DD=function(e){return f(bN,M([rT(f(A$,1e3,Ik)),iN,cN(20),BN({bottom:30,left:40,right:40,top:0}),Wk(f$(!1)),w$(u_(e))]),M([oD(e),PD(e),cD(e.wallet)]))},UD=is(hm(8226)),OD=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),MD=r(function(e,t){return l(Ra,ka,t,e)}),FD=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(MD,r,e),a=t-1,i=r;e=n,t=a,r=i}}),VD=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(MD,f(js,e%r,t),l(FD,yr,e/r|0,t))):f(js,e,t)}),KD=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(qT,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(aS,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),HD=function(e){return d(KD,Ua,Py,e,yr)},jD=r(function(e,t){return f(Tk,M([rT(Ik),w$(f(SN,M([cN(3),rT(VN(100)),rT(t),FN]),f(OD,f(Tk,M([eA(d(wN,0,0,0,.1)),eN(14)]),Ff(UD)),f(xa,f(Da,Tk(M([eA(d(wN,0,0,0,.2))])),Ff),f(VD,100,(e?$a:Ua)(HD(f(xa,f(Io,Ho,Qa),Ia(kR)))))))))]),Ff(" "))}),qD=r(function(e,t){var r=t.url,n=t.label;return d(qI,uT,aT("a"),f(ka,nT(YS(r)),f(ka,nT(WS("noopener noreferrer")),f(ka,rT(eT),f(ka,XS(eT),f(ka,GI(lT.contentCenterX+" "+lT.contentCenterY),e))))),iT(M([n])))}),GD=GI(lT.italic),zD=function(){var e=f(Da,Tk(M([eA(l(WI,.8,.2,.2))])),Ff),t=f(Da,Tk(M([hN])),Ff);return f(bN,M([rT(Ik),XS(Ik),Rk(Dk),jk(6),cN(50),nD({blur:20,color:d(D$,0,0,0,.1),offset:L(0,3),size:0}),jk(10),KN(20)]),M([f(jD,!1,Ik),f(bN,M([iN,rT(f(A$,700,Ik)),cN(20)]),M([f(dN,M([eN(70),hN,iN,e_]),M([Ff("DAI"),e("Hard")])),f(SN,M([eN(30),Qk,iN,e_,GD]),M([Ff("The "),e("Global"),Ff(", "),e("Unkillable"),Ff(" Crypto Gateway")]))])),f(SN,M([Rk(aR),cN(2),iN,S$,rT(Ik)]),M([f(Tk,M([f(Mk,40,10),Rk(Dk),rT(Ik),XS(Ik)]),f(bN,M([cN(60),vN]),M([f(Tk,M([eN(40),Qk,iN]),Ff("Want to learn more?")),f(qD,M([jk(4),Kk,f(Mk,25,17),Rk(g$),eA(Dk),hN,eN(24),iN]),{label:f(dN,M([e_]),M([Ff("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"})]))),f(Tk,M([f(Mk,40,10),Rk(Dk),rT(Ik),XS(Ik)]),f(bN,M([v_,cN(60)]),M([f(Tk,M([eN(40),Qk,iN]),Ff("Ready to try it out?")),f(bN,M([cN(10),rT(kk(400)),iN]),M([f(dN,M([eN(24),rT(Ik)]),M([Ff("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f(dN,M([eN(24),rT(Ik)]),M([Ff("Then follow the links at the top of this page to browse "),t("Sell Offers"),Ff(", browse "),t("Buy Offers"),Ff(", or "),t("Create Your Own Offer"),Ff(".")]))]))])))])),f(Tk,M([a_,rT(Ik)]),f(jD,!0,Ik))]))}(),YD=function(e){return{$:"ShowCurrencyDropdown",a:e}},WD=r(function(e,t){return Yf(t(e))}),JD=n(function(e,t,r){return R(t,yr)?Ak:f(Yi,nv,d(e$,e,r.tradeTable,M([Jg,xN,_N,LN,PN,$N]),t))}),QD=n(function(e,t,r){var n=l(WD,e,r.filterFunc,$v(f(xa,r$,t))),a=function(e){return f(Tk,M([eN(24),Qk,eA(aR),iN,KN(20)]),Ff(e))},i=f(Xd,Ja(n$),f(xa,u$,t))?M([a("No trades found.")]):f(xa,a,IC(f(xa,function(e){switch(u$(e).$){case"QueryingNumTrades":return si(zA(e.factory)+"Querying Factory...");case"NoneFound":return ci;case"FetchingTrades":return si(zA(e.factory)+"Fetching Trades");default:return ci}},t)));return f(bN,M([cN(10)]),M([function(){return i.b?f(bN,M([cN(5)]),i):Ak}(),l(JD,e,n,r)]))}),XD=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(XI,Hk,l(II,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},ZD=function(e){return f(zk,"focus",Fi(e))},eU=f(Da,nT,ZD),tU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([eU(e(!0)),IL(e(!0))])}();return f(SN,U(e,M([XS(kk(40)),nD({blur:20,color:d(D$,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Tk,M([Rk(fR),XS(kk(40)),XD({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Tk,M([ON,f(Mk,10,0)]),r)),f(oL,U(s,U(t,M([rT(kk(100)),XS(kk(40)),JR(fR),XD({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),hL({bottom:1,left:0,right:1,top:1})]))),{label:m_(n),onChange:u,placeholder:i,text:a})]))}),rU=function(e){return{$:"MaxDaiChanged",a:e}},nU=function(e){return{$:"MinDaiChanged",a:e}},aU=r(function(e,t){return f(bN,M([rT(Ik),cN(8)]),M([f(Tk,M([eN(17),ZN]),Ff(e)),t]))}),iU=xT(25),oU=function(e){return{$:"MoveX",a:e}},uU=function(e){return f(L$,iU,oU(-e))},sU={$:"OnLeft"},cU=function(e){return f(MR,sU,e)},fU=n(function(e,t,r){var n=h_(M([ON])),a=f(SN,M([cN(8),ON,rT(kk(60))]),M([n,f(Tk,M([eN(16),ON]),Ff("max"))])),i=f(SN,M([cN(8),ON,rT(kk(60))]),M([n,f(Tk,M([eN(16),ON]),Ff("min"))]));return f(aU,"Dai Range",f(bN,M([cN(5),rT(kk(200))]),M([v(tU,M([cU(f(k$,M([uU(5),rT(kk(200))]),r.minDai))]),M([eU(YD(!1))]),i,"min Dai",e,ci,ci,nU),v(tU,M([cU(f(k$,M([uU(5),rT(kk(200))]),r.maxDai))]),M([eU(YD(!1))]),a,"max Dai",t,ci,ci,rU)])))}),lU=function(e){var t=f(Vh,e,kR);if("Nothing"===t.$)return Ff("*");var r=t.a,n=r.b;return f(JN,M([XS(kk(26))]),n)},dU=function(e){return{$:"AppCmd",a:e}},hU=function(e){return{$:"FiatTypeInputChanged",a:e}},pU=n(function(e,t,r){var n=dU(d(Rd,"click","misclick","currency flag",0)),a=lU(t);f(SN,M([cN(8),ON,rT(kk(60))]),M([a,f(Tk,M([eN(16),ON]),Ff("max"))])),f(SN,M([cN(8),ON,rT(kk(60))]),M([a,f(Tk,M([eN(16),ON]),Ff("min"))]));return f(Tk,M([S$,rT(kk(120))]),f(aU,"Fiat Type",h(YP,e,t,YD(!0),hU,n)))}),gU={$:"AddSearchTerm"},vU=function(e){return{$:"PaymentMethodInputChanged",a:e}},yU=f(gh,"keyCode",BC),mU=function(e){return f(zk,"keyup",f(qo,function(t){return 13===t?Fi(e):Go(Ni(t))},yU))},bU=function(e){return f(aU,"Search Payment Methods",f(oL,M([S$,rT(kk(250)),XS(kk(40)),JR(fR),nD({blur:20,color:d(D$,233,237,242,.05),offset:L(0,3),size:0}),b$(mU(gU))]),{label:m_("payment methods search"),onChange:vU,placeholder:ci,text:e}))},CU=function(e){return{$:"RemoveTerm",a:e}},EU=function(e){return f(Tk,M([KN(3),S$,Kk,Wk(CU(e)),eN(10),eA(rN)]),Ff("x"))},SU=function(e){if(e.b){var t=e;return f(SN,M([rT(Ik),KN(10),cN(10)]),f(xa,function(e){return f(SN,M([Rk(d(D$,16,7,234,.2)),jk(5),KN(4),cN(3)]),M([Ff(e),EU(e)]))},t))}return Ak},TU=n(function(e,t,r){return f(bN,M([cN(10),rT(eT),iN]),M([f(SN,M([rT(eT),cN(10)]),M([f(Tk,M([rT(eT),S$]),l(fU,e.minDai,e.maxDai,t)),f(Tk,M([rT(eT),S$]),l(pU,r,e.fiatType,t)),f(bN,M([rT(eT),S$,cN(5)]),M([bU(e.paymentMethod),SU(e.paymentMethodTerms)]))]))]))}),wU=n(function(e,t,r){return f(bN,M([jk(5),Rk(Dk),rT(Ik),XS(Ik),Wk(YD(!1))]),M([f(SN,M([rT(Ik),cN(10),KN(30)]),M([l(TU,r.inputs,r.errors,r.showCurrencyDropdown)])),l(QD,e,t,r)]))}),IU=function(e){return{$:"MessageInputChanged",a:e}},AU={$:"MessageSubmit"},BU=q_("disabled"),kU=function(e){return f(Nn,"tabIndex",Ni(e))},NU=function(e){return{$:"MayPreventDefault",a:e}},RU=r(function(e,t){return f(Gk,e,NU(t))}),$U=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):Go("Not the enter key")},n=f(qo,r,f(gh,"key",zo));return nT(f(RU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),_U=function(e){return f($U,"Enter",e)},LU={$:"Button"},xU=r(function(e,t){var r=t.onPress,n=t.label;return d(qI,uT,Sk,f(ka,rT(eT),f(ka,XS(eT),f(ka,GI(lT.contentCenterX+" "+lT.contentCenterY+" "+lT.seButton+" "+lT.noTextSelection),f(ka,Kk,f(ka,M_(e),f(ka,fN(LU),f(ka,nT(kU(0)),function(){if("Nothing"===r.$)return f(ka,nT(BU(!0)),e);var t=r.a;return f(ka,Wk(t),f(ka,_U(t),e))}()))))))),iT(M([n])))}),PU=function(e){return f(bN,M([rT(Ik),cN(10)]),M([f(vD,M([rT(Ik),XS(kk(100))]),{label:m_("messageInput"),onChange:IU,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(xU,M([iN,eN(24)]),{label:Ff("Submit"),onPress:si(AU)})]))},DU=f(Vk,MN,lT.scrollbarsY),UU=r(function(e,t){return f(Tk,M([XS(Ik),rT(Ik)]),f(Tk,U(M([b$(f(m$,"position","absolute")),b$(f(m$,"top","0")),b$(f(m$,"right","0")),b$(f(m$,"bottom","0")),b$(f(m$,"left","0")),DU]),e),t))}),OU=l(bk,200,205,210),MU=n(function(e,t,r){var n=M([vN,Rk(g$),eA(Dk),XD({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([v_,Rk(OU),eA(ER),XD({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Tk,U(M([KN(7)]),u),f(dN,yr,M([Ff(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(WI,0,0,1),Dk,"Initiator opened the trade"));case"Recalled":return si(x(l(WI,0,0,1),Dk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Po,8,Kf(t))+"..";return si(x(l(WI,1,0,1),Dk,r+" committed to the trade"));case"Aborted":return si(x(l(WI,1,0,0),Dk,"Buyer aborted the trade"));case"Claimed":return si(x(l(WI,0,1,0),Dk,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(WI,0,0,1),Dk,"Seller released the "+pR(e)+" and closed the contract"));default:return si(x(l(WI,0,0,1),Dk,"Seller burned the "+pR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Ak;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Tk,M([jk(3),XR(1),JR(l(WI,1,0,1)),iN,Rk(h)]),f(dN,M([eA(p)]),M([Ff(g)])))}),FU=n(function(e,t,r){if(r.b){var n=r;return f(UU,M([rT(Ik),XS(Ik),jk(5),XR(1),JR(ER),KN(10)]),f(bN,M([rT(Ik),XS(Ik),cN(10)]),f(xa,f(MU,e,t),n)))}return f(Tk,M([rT(Ik),XS(Ik),jk(5),XR(1),JR(ER),iN,eA(l(WI,.5,.5,.5)),GD]),Ff("no messages found."))}),VU=Cr,KU=function(e){return f(bN,M([rT(Ik),XS(Ik),cN(10),XR(1),jk(5),KN(20)]),M([l(FU,e.trade.factory,e.userRole,f(VU,function(e){return e.blocknum},Sa(e.history))),PU(e)]))},HU=function(e){return f(Tk,M([Rk(Dk),jk(8),aD,rT(Ik),XS(Ik)]),KU(e))},jU={$:"ToggleChat"},qU=function(e){if(e.showChatHistory){var t=f(hc,Ak,f(Ao,HU,e.chatHistoryModel));return f(Tk,M([XS(Ik),rT(kk(500)),KN(20),vN]),l(B$,M([XS(Ik),rT(Ik)]),f(Yi,XC,t),jU))}return Ak},GU=function(e){return"Buyer"===e.initiatorRole.$?vl:sb},zU=function(e){return _R(e)+" "+e.fiatType},YU={$:"AbortAction"},WU=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),JU=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return Ak}if("LoadedTrade"!==t.b.$)return Ak;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=zU(n.terms.price),u=qR(fb(i)),s=qR(n.parameters.tradeAmount)+" "+pR(n.factory),c=function(){return"Buyer"===GU(n.parameters).$?L(f(Tk,M([ZN,eA(ER)]),Ff("buyer")),M([Ff("pay the seller "),f(Tk,M([eA(g$)]),Ff(o)),Ff(" in exchange for the "),f(Tk,M([eA(g$)]),Ff(s)),Ff(" held in this contract.")])):L(f(Tk,M([ZN,eA(ER)]),Ff("seller")),M([Ff("accept "),f(Tk,M([eA(g$)]),Ff(o)),Ff(" from the buyer in exchange for the "),f(Tk,M([eA(g$)]),Ff(s)),Ff(" held in this contract.")]))}(),d=c.a,h=c.b;return l(B$,yr,f(bN,M([cN(20),KN(20),iN,XS(Ik),e_]),M([f(Tk,M([eN(26),Qk,iN,ON]),Ff("Just to Confirm...")),f(bN,M([cN(20),iN,ON]),f(xa,dN(M([iN,eN(18),ZN,eA(U$)])),U(M([U(M([Ff("You will deposit "),f(Tk,M([eA(g$)]),Ff(u+" "+pR(n.factory))),Ff(", thereby becoming the "),d,Ff(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([Ff("(This ususally requires two Metamask signatures. Your "+pR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Tk,M([a_,iN]),f(X$,"Yes, I definitely want to commit to this trade.",l(WU,n,a,i)))])),YU);case"ApproveNeedsSig":return t_(M([Ff("Waiting for user signature for the approve call."),Ff("(check Metamask!)"),Ff("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return t_(M([Ff("Mining the initial approve transaction..."),f(zI,M([i_,eA(g$)]),{label:Ff("See the transaction on Etherscan"),url:f(r_,n.factory,p)}),Ff("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return t_(M([Ff("Waiting for user signature for the final commit call."),Ff("(check Metamask!)"),Ff("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return t_(M([Ff("Mining the final commit transaction..."),f(zI,M([i_,eA(g$)]),{label:Ff("See the transaction"),url:f(r_,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(B$,yr,f(bN,M([cN(20),KN(20),iN,XS(Ik),e_]),M([f(Tk,M([eN(26),Qk,iN,ON]),Ff("Just to Confirm...")),f(bN,M([cN(20),iN,ON]),f(xa,dN(M([iN,eN(18),ZN,eA(U$)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([Ff('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 '+pR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([Ff("Aborting will incur a small penalty on both parties, and refund the rest of the "+pR(n.factory)+".")])]);case"Release":return M([M([Ff("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([Ff("This will destroy the "+pR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Tk,M([a_,iN]),function(e){return f(X$,e,yE(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 "+pR(n.factory)+".";default:return"I understand. Burn the "+pR(n.factory)+"."}}()))])),YU);case"ActionNeedsSig":var g=r.a;return t_(M([Ff("Waiting for user signature for the "+bE(g)+" call."),Ff("(check Metamask!)")]));default:var g=r.a,p=r.b;return Ak}},QU=SN(M([rT(Ik),Rk(Dk),jk(5),KN(20),iD,aD])),XU=function(e){return f(SN,M([cN(8)]),M([f(JN,yr,d_),f(Tk,M([eN(24),ZN]),Ff(qR(e)))]))},ZU=r(function(e,t){var r=f(vg,Km(e),f(Ao,function(e){return e.address},Td(t)));return f(gL,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"}(),XU(e.parameters.tradeAmount))}),eO=function(e){return f(SN,M([cN(5)]),M([wL(e.fiatType),f(Tk,M([eN(24),ZN]),Ff(zU(e)))]))},tO=function(e){return f(gL,"For Fiat",eO(e.terms.price))},rO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},nO=l(bk,250,165,22),aO=l(bk,255,0,0),iO=l(bk,0,255,0),oO=qN({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),uO=qN({description:"burned",src:"/DAIHard/static/img/burned.svg"}),sO=qN({description:"released",src:"/DAIHard/static/img/released.svg"}),cO={$:"ToggleStatsModal"},fO=function(e){return f(VU,Ua,e)},lO=n(function(e,t,n){var a=$v(f(xa,function(e){return f(Yf,function(e){return R(f(YC,e,n),si(t))},f(mS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(Vd,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(Vd,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Al,amountReleased:Al,numAborts:0,numBurns:0,numReleases:0},a),u=f(Ao,ml,kl(fO(f(mS,function(e){return function(e){return e?si(e):ci}(Ed(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}}),dO=r(function(e,t){return d(Q$,x(d(wN,0,0,1,1),d(wN,0,0,1,.8),d(wN,0,0,1,.6)),Dk,e,t)}),hO=function(e){return{$:"ViewUserHistory",a:e}},pO=f($B,0,yr),gO=f(Vk,Jk,lT.textNormalWeight),vO=r(function(e,t){return Za(e/t)}),yO=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}}),mO=r(function(e,t){var r=e.a,n=e.b;return l(yO,r,f(vO,Ed(t),6e4),n)}),bO=r(function(e,t){return f(ls,24,f(vO,f(mO,e,t),60))}),CO=r(function(e,t){return f(ls,1e3,Ed(t))}),EO=r(function(e,t){return f(ls,60,f(mO,e,t))}),SO={$:"Apr"},TO={$:"Aug"},wO={$:"Dec"},IO={$:"Feb"},AO={$:"Jan"},BO={$:"Jul"},kO={$:"Jun"},NO={$:"Mar"},RO={$:"May"},$O={$:"Nov"},_O={$:"Oct"},LO={$:"Sep"},xO=function(e){var t=f(vO,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)}},PO=r(function(e,t){switch(xO(f(mO,e,t)).month){case 1:return AO;case 2:return IO;case 3:return NO;case 4:return SO;case 5:return RO;case 6:return kO;case 7:return BO;case 8:return TO;case 9:return LO;case 10:return _O;case 11:return $O;default:return wO}}),DO=r(function(e,t){return f(ls,60,f(vO,Ed(t),1e3))}),UO={$:"Fri"},OO={$:"Mon"},MO={$:"Sat"},FO={$:"Sun"},VO={$:"Thu"},KO={$:"Tue"},HO={$:"Wed"},jO=r(function(e,t){switch(f(ls,7,f(vO,f(mO,e,t),1440))){case 0:return VO;case 1:return UO;case 2:return MO;case 3:return FO;case 4:return OO;case 5:return KO;default:return HO}}),qO=n(function(e,t,r){return e.toAmPm(f(bO,t,r))}),GO=r(function(e,t){return xO(f(mO,e,t)).day}),zO=GO,YO=M([FO,OO,KO,HO,VO,UO,MO]),WO=r(function(e,t){return function(e){return e.a}(f(hc,L(0,FO),kl(f(Yf,function(r){return R(r.b,f(jO,e,t))},f(Bi,r(function(e,t){return L(e,t)}),YO)))))}),JO=function(e){return l(Ra,Na,0,e)},QO=r(function(e,t){return xO(f(mO,e,t)).year}),XO=function(e){return!f(ls,4,e)&&(!!f(ls,100,e)||!f(ls,400,e))},ZO=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return XO(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}}),eM=M([AO,IO,NO,SO,RO,kO,BO,TO,LO,_O,$O,wO]),tM=r(function(e,t){return f(hc,L(0,AO),kl(f(Yf,function(r){r.a;return R(r.b,f(PO,e,t))},f(Bi,r(function(e,t){return L(e,t)}),eM))))}),rM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(tM,e,t))}),nM=r(function(e,t){var r=f(js,f(rM,e,t)-1,eM);return JO(f(xa,ZO(f(QO,e,t)),r))+f(zO,e,t)}),aM=r(function(e,t){return f(rM,e,t)/4|0}),iM=r(function(e,t){var r=Ni(t),n=e-Ro(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),oM=function(e){return e?e<=12?e:e-12:12},uM=Fg(315576e5),sM=r(function(e,t){return ml(uM*f(QO,e,t))}),cM=r(function(e,t){var r=f(sM,e,t),n=f(WO,e,r);return 1+((f(nM,e,t)+n)/7|0)}),fM=r(function(e,t){return Ni(f(QO,e,t))}),lM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(rM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(rM,t,r));case"MonthFixed":return f(iM,2,f(rM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(PO,t,r));case"MonthNameFull":return e.toMonthName(f(PO,t,r));case"QuarterNumber":return Ni(1+f(aM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(aM,t,r));case"DayOfMonthNumber":return Ni(f(zO,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(zO,t,r));case"DayOfMonthFixed":return f(iM,2,f(zO,t,r));case"DayOfYearNumber":return Ni(f(nM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(nM,t,r));case"DayOfYearFixed":return f(iM,3,f(nM,t,r));case"DayOfWeekNumber":return Ni(f(WO,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(WO,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(jO,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(jO,t,r));case"WeekOfYearNumber":return Ni(f(cM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(cM,t,r));case"WeekOfYearFixed":return f(iM,2,f(cM,t,r));case"YearNumberLastTwo":return f(Mo,2,f(fM,t,r));case"YearNumber":return f(fM,t,r);case"AmPmUppercase":return HP(l(qO,e,t,r));case"AmPmLowercase":return Ml(l(qO,e,t,r));case"HourMilitaryNumber":return Ni(f(bO,t,r));case"HourMilitaryFixed":return f(iM,2,f(bO,t,r));case"HourNumber":return Ni(oM(f(bO,t,r)));case"HourFixed":return f(iM,2,oM(f(bO,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(bO,t,r));case"HourMilitaryFromOneFixed":return f(iM,2,1+f(bO,t,r));case"MinuteNumber":return Ni(f(EO,t,r));case"MinuteFixed":return f(iM,2,f(EO,t,r));case"SecondNumber":return Ni(f(DO,t,r));case"SecondFixed":return f(iM,2,f(DO,t,r));case"MillisecondNumber":return Ni(f(CO,t,r));case"MillisecondFixed":return f(iM,3,f(CO,t,r));default:return n.a}}),dM=a(function(e,t,r,n){return f(Ri,"",f(xa,l(lM,e,r,n),t))}),hM=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),pM=function(e){return e>11?"pm":"am"},gM=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"}},vM=function(e){switch(f(ls,100,e)){case 11:case 12:case 13:return"th";default:switch(f(ls,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},yM=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"}},mM=p(hM,gM,f(Io,gM,Po(3)),yM,f(Io,yM,Po(3)),pM,vM),bM=dM(mM),CM={$:"MonthNameFull"},EM=CM,SM=function(e){return{$:"Text",a:e}},TM=SM,wM={$:"YearNumber"},IM=wM,AM=n(function(e,t,n){var a=r(function(e,t){return f(bN,M([eN(18),cN(6)]),M([f(Tk,M([hN]),Ff(e)),f(Tk,M([gO]),Ff(t))]))}),i=bM(M([EM,TM(", "),IM])),o=f(bN,M([cN(23),rT(Ik)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,pO,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+qR(n.amountReleased)+" "+pR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+qR(n.amountBurned)+" "+pR(e)+" Burned")])),M([f(Tk,M([iN]),f(dO,"View User History",hO(n.asRole)))])));return f(bN,M([jk(8),wD,ID,Rk(fR),cN(1),nD({blur:20,color:d(wN,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Tk,M([rT(Ik),Rk(Dk),KN(17)]),f(IN,18,t)),f(Tk,M([rT(Ik),Rk(Dk),KN(17)]),o)]))}),BM=n(function(e,t,r){var n=l(lO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=rO(e.parameters.initiatorRole)+" Stats";return f(Tk,r?M([cL(f(Tk,M([fL(30),vN]),l(AM,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(gL,a,f(SN,M([rT(Ik),cN(20),Kk,Wk(cO)]),f(xa,SN(M([cN(5)])),M([M([f(JN,M([XS(kk(28))]),sO),f(Tk,M([eN(24),ZN,eA(iO)]),Ff(l(cs,2,P("0"),Ni(n.numReleases))))]),M([f(JN,M([XS(kk(28))]),oO),f(Tk,M([eN(24),ZN,eA(nO)]),Ff(l(cs,2,P("0"),Ni(n.numAborts))))]),M([f(JN,M([XS(kk(28))]),uO),f(Tk,M([eN(24),ZN,eA(aO)]),Ff(l(cs,2,P("0"),Ni(n.numBurns))))])])))))}),kM=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+Kf(t)}e.a;return"https://kovan.etherscan.io/address/"+Kf(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+Kf(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+Kf(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+Kf(t)}}),NM=n(function(e,t,r){return f(zI,e,{label:Ff(Kf(r)),url:f(kM,t,r)})}),RM=function(e){return f(gL,"Trade Status",f(bN,M([eN(24),ZN,cN(8)]),M([Ff(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(NM,M([eN(12),eA(g$),i_]),e.factory,e.creationInfo.address)])))},$M=i(function(e,t,r,n,a){return QU(M([RM(t),f(ZU,t,r),tO(t),l(BM,t,n,a)]))}),_M=l(bk,9,32,107),LM=qN({description:"chat",src:"/DAIHard/static/img/chat.svg"}),xM=f(Tk,M([jk(4),Kk,Wk(jU),KN(5),Rk(l(bk,22,0,255))]),f(JN,M([rT(kk(42))]),LM)),PM=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},DM=function(e){return f(bN,M([jk(12),Rk(fR),KN(15),cN(15)]),M([f(Tk,M([eN(24),Qk,GD]),Ff("Fiat Payment Method")),f(dN,M([eN(18),XS(eT),Rk(Dk),nD({blur:5,color:d(wN,0,0,0,.2),offset:L(-3,3),size:0}),jk(3),KN(5)]),M([f(hc,f(Tk,M([eA(XP),GD]),Ff("No payment methods found.")),f(Ao,Ff,f(Ao,function(e){return e.info},kl(e))))]))]))},UM={$:"Active"},OM=function(e){return{$:"ExpandPhase",a:e}},MM=M([Rk(_M),eA(Dk)]),FM=r(function(e,t){return{$:"Min",a:e,b:t}}),VM=r(function(e,t){return f(FM,e,t)}),KM=function(e){return M(e?[jk(12),S$,XS(f(VM,380,eT))]:[jk(12),iN])},HM=M([Rk(Dk)]),jM=qN({description:"flame",src:"/DAIHard/static/img/flame.png"}),qM=r(function(e,t){return Cl(f(qu,El(e),El(t)))}),GM=r(function(e,t){return d(Q$,x(d(wN,1,.6,.2,1),d(wN,1,.6,.2,.8),d(wN,1,.6,.2,.6)),Dk,e,t)}),zM=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),YM=function(e){return{$:"ContractActionClicked",a:e}},WM={$:"Web3Connect"},JM=n(function(e,t,r){var n=Td(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(bR,e,t).$?Ak:f(SN,M([cN(8)]),function(){var e=x(t.state.phase,f(Km,t,a.address),f(YC,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,yE,f(dO,"Remove and Refund this Trade",gE))])}break e}var r=(e.a,e.b,El(Hm(t.parameters)));return M([f(X$,"Deposit and Commit to Trade",l(zM,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,YM,f(GM,"Abort Trade",eE)),f(Yi,YM,f(X$,"Confirm Payment",uE)),xM])}e.a,e.c.a;return M([xM])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,YM,f(X$,"Burn it All!",oE)),f(Yi,YM,f(dO,"Release Everything",vE)),xM])}e.a,e.c.a;return M([xM])}break e;default:break e}return yr}())}return f(X$,"Connect to Wallet",WM)}),QM={$:"Finished"},XM={$:"NotStarted"},ZM=r(function(e,t){var r=L(iR(t),iR(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?XM:R(n,a)?UM:QM}),eF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),tF=r(function(e,t){return l(eF,yr,e,t)}),rF=a(function(e,t,r,n){var a=qR(f(Vd,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+pR(r.factory),i=qR(r.parameters.tradeAmount)+" "+pR(r.factory),o=f(SN,yr,f(tF,3,f(JN,M([XS(kk(18))]),jM))),u=f(Da,Tk(M([eA(l(WI,1,0,0))])),Ff),s=R(e,r.state.phase),c=f(vg,YC(r),f(Ao,function(e){return e.address},Td(n))),d=s?Dk:ER,h=dN(M([eA(d),eN(18),Qk])),p=zU(r.terms.price),g=s?l(bk,0,226,255):l(bk,16,7,234),v=f(Da,Tk(M([eA(g)])),Ff),y=qR(r.parameters.buyerDeposit)+" "+pR(r.factory),m=r.parameters.abortPunishment,b=qR(m)+" "+pR(r.factory),C=qR(f(qM,r.parameters.buyerDeposit,m))+" "+pR(r.factory),E=qR(f(qM,r.parameters.tradeAmount,m))+" "+pR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([Ff("Your "),u("burnable deposit"),Ff(" of "),v(y),Ff(" is now held in this contract, and your offer to buy "),v(i),Ff(" for "),v(p),Ff(" is now listed in the marketplace.")]),M([Ff("If another user likes your offer, they can become the Seller by depositing the full "),v(i),Ff(" into this contract.")]),M([Ff("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),Ff(" to you.")])])):f(xa,h,M([M([Ff("Your offer to sell the "),v(i),Ff(" held in this contract for "),v(p),Ff(" is now listed in the marketplace.")]),M([Ff("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),Ff(" of 1/3 of the trade amount "),v("("+y+")"),Ff(" into this contract.")]),M([Ff("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),Ff(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([Ff("You must now pay the Seller "),v(p),Ff(" via the Fiat Payment Method, "),f(Tk,M([Qk]),Ff("and then click ")),u("Confirm Payment"),Ff(" before the payment window runs out. Use the chat to coordinate.")]),M([Ff("If you abort the trade, or do not confirm payment before this time is up, "),v(b),Ff(" (1/4 of the "),u("burnable deposit"),Ff(") will be "),u("burned"),Ff(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Ff(" to the Seller, "),v(C),Ff(" to you).")]),M([Ff("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),Ff(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([Ff("Work and communicate with the Buyer to receive "),v(p),Ff(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([Ff("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),Ff(" (1/4 of the "),u("burnable deposit"),Ff(") will be "),u("burned"),Ff(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Ff(" to you, "),v(C),Ff(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([Ff("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),Ff(" will be released to you.")]),M([Ff("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),Ff(" In this case the "),v(a),Ff(" will be lost to both parties.")]),M([Ff("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([Ff("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([Ff("So, have you recieved the "),v(p),Ff("? If so, you can click "),v("Release Everything"),Ff(".")]),M([Ff("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),Ff(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([Ff("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([Ff("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([Ff("The Seller has deposited "),v(i),Ff(" into this contract, and offers to sell it for "),v(p),Ff(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),Ff(" into this contract by clicking "),u("Deposit and Commit to Trade"),Ff(".")]),M([Ff("If the trade is successful, the combined "+pR(r.factory)+" balance "),v("("+a+")"),Ff(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,Ff(" for both parties (see Payment Window for more on this).")]),M([Ff("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),Ff(" within the payment window.")])])):f(xa,h,M([M([Ff("The Buyer is offering to buy "),v(i),Ff(" for "),v(p),Ff(", and has deposited "),v(y),Ff(" into this contract as a "),u("burnable deposit"),Ff(". To become the Seller, deposit "),v(i),Ff(" into this contract by clicking "),u("Deposit and Commit to Trade"),Ff(".")]),M([Ff("When you receive the "),v(p),Ff(" from the Buyer, the combined "+pR(r.factory)+" balance "),v("("+a+")"),Ff(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,Ff(" for both parties (see Payment Window for more on this).")]),M([Ff("Don't commit unless you can receive "),v(p),Ff(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([Ff("During this phase, the Buyer is expected to transfer "),v(p),Ff(" to the Seller, as described in Fiat Payment Method, "),f(Tk,M([Qk]),Ff("and ")),u("Confirm the Payment "),Ff(" before the payment window runs out. This would move the trade to the final phase.")]),M([Ff("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),Ff(" (1/4 of the "),u("burnable deposit"),Ff(" amount) will be "),u("burned"),Ff(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Ff(" to the Seller, "),v(C),Ff(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([Ff("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([Ff("If the Seller can verify he has received the "),v(p),Ff(", he will probably release the total balance of "),v(i),Ff(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),Ff(".")]),M([Ff("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),Ff(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(bN,M([rT(Ik),XS(Ik),KN(20),cN(30)]),M([f(SN,M([rT(Ik)]),M([f(Tk,M([eN(24),Qk,eA(g),v_]),Ff(T))])),f(bN,M([rT(Ik),ON,cN(13)]),w),f(Tk,M([vN]),function(){switch(f(ZM,r,e).$){case"Active":return l(JM,t,r,n);case"NotStarted":return f(Tk,M([eN(20),Qk,GD,eA(aR)]),Ff("Phase not yet started."));default:return f(Tk,M([eN(20),Qk,GD]),Ff("Phase no longer active."))}}())]))}),nF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},aF=qN({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),iF=qN({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),oF={$:"None"},uF=oF,sF=qN({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),cF=function(e){switch(e.$){case"Open":return sF;case"Committed":return aF;case"Judgment":return iF;default:return uF}},fF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),lF=a(function(e,t,r,n){return d(fF,e,t,r,n)}),dF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},hF=function(e){return function(e){return d(lF,e.red,e.green,e.blue,e.alpha)}(dF(e))},pF=function(e){return{$:"Circle",a:e}},gF=pF,vF=d(fF,0,0,0,1),yF={$:"Flat"},mF={$:"Sharp"},bF=function(e){return{$:"Uniform",a:e}},CF=bF,EF={cap:yF,dashPattern:yr,dashPhase:0,fill:CF(vF),join:mF,thickness:2},SF=n(function(e,t,r){return D(EF,{dashPattern:e,fill:r,thickness:t})}),TF=SF(yr),wF={$:"Transparent"},IF=wF,AF=f(TF,0,IF),BF=r(function(e,t){return{$:"Shape",a:e,b:t}}),kF=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},NF=function(e){return f(Da,kF,BF(e))},RF=function(e){return NF(L(e,AF))},$F=function(e){return L(-e.a,-e.b)},_F=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),LF=r(function(e,t){return f(_F,$F(e(t)),t)}),xF=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},PF=r(function(e,t){return{$:"Path",a:e,b:t}}),DF=kr,UF=Nr,OF=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=UF(n),i=DF(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},MF=function(e){return xa(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)})},FF=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(MF,e,M([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),VF=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},KF=function(e){var t=HF(e.basic),r=xF(f(xa,OF(e),t)),n=r.a,a=r.b;return{toBottom:-f(hc,0,Jw(a)),toLeft:-f(hc,0,Jw(n)),toRight:f(hc,0,Ww(n)),toTop:f(hc,0,Ww(a))}},HF=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(FF,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(FF,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(FF,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(MF,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(PF,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(MF,R(C,yF)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(FF,0,E);case"Group":var S=e.a;return f(MF,0,$v(f(xa,f(Io,KF,VF),S)));default:var T=e.b;return f(MF,0,VF(KF(T)))}},jF=function(e){var t=KF(e);return t.toTop+t.toBottom},qF=function(e){var t=KF(e);return L(-t.toLeft,t.toTop)},GF=function(e){var t=KF(e);return t.toLeft+t.toRight},zF=En("http://www.w3.org/2000/svg"),YF=zF("svg"),WF=Nn("height"),JF=Nn("version"),QF=Nn("width"),XF=zF("circle"),ZF=zF("ellipse"),eV=zF("foreignObject"),tV=zF("g"),rV=zF("image"),nV=zF("polygon"),aV=zF("polyline"),iV=zF("rect"),oV=aw,uV=zF("text"),sV=Nn("id"),cV=Nn("points"),fV=Nn("r"),lV=Nn("rx"),dV=Nn("ry"),hV=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},pV=function(e){return{$:"Group",a:e}},gV=Nn("dominant-baseline"),vV=Nn("fill"),yV=Nn("fill-opacity"),mV=Nn("font-family"),bV=Nn("font-size"),CV=Nn("font-style"),EV=Nn("font-variant"),SV=Nn("font-weight"),TV=Nn("opacity"),wV=Nn("stroke"),IV=Nn("stroke-dasharray"),AV=Nn("stroke-dashoffset"),BV=Nn("stroke-linecap"),kV=Nn("stroke-linejoin"),NV=Nn("stroke-opacity"),RV=Nn("stroke-width"),$V=Nn("text-anchor"),_V=Nn("text-decoration"),LV=Nn("transform"),xV=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},PV=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},DV=n(function(e,t,r){return d(fF,e,t,r,1)}),UV=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Fg(1e4*e)/100};return Ql(M(["rgba(",ZT(i(t)),"%,",ZT(i(r)),"%,",ZT(i(n)),"%,",ZT(function(e){return Fg(1e3*e)/1e3}(a)),")"]))},OV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},MV=function(e){var t=OV(e),r=t.red,n=t.green,a=t.blue;return UV(l(DV,r,n,a))},FV=function(e){if("Uniform"===e.$){var t=e.a;return MV(t)}return"none"},VV=function(e){var t=OV(e),r=t.alpha;return ZT(r)},KV=function(e){if("Uniform"===e.$){var t=e.a;return VV(t)}return"0"},HV=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},jV=Br,qV=function(e){var t=ZT(e.scale.b),r=ZT(e.scale.a),n=ZT(-e.rotation/2/jV*360),a=ZT(-e.shift.b),i=ZT(e.shift.a);return Ql(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},GV=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([wV(FV(r.fill)),NV(KV(r.fill)),RV(ZT(r.thickness)),BV(xV(r.cap)),kV(HV(r.join)),vV("none"),TV(ZT(e.opacity)),LV(qV(e)),AV(Ni(r.dashPhase)),IV(PV(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([vV(FV(a)),yV(KV(a)),wV(FV(r.fill)),NV(KV(r.fill)),RV(ZT(r.thickness)),BV(xV(r.cap)),kV(HV(r.join)),TV(ZT(e.opacity)),LV(qV(e)),AV(Ni(r.dashPhase)),IV(PV(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([vV(FV(bF(o.color))),mV(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),bV(Ni(o.size)),SV(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"}}()),CV(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),EV(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),_V(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),$V("middle"),gV("middle"),LV(qV(e))]);default:return M([LV(qV(e))])}},zV=Nn("x"),YV=Nn("y"),WV=r(function(e,t){return M([QF(ZT(e)),WF(ZT(t)),zV(ZT(-e/2)),YV(ZT(-t/2))])}),JV=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([ZT(t),ZT(-r)]))},e))},QV=zk,XV=r(function(e,t){return f(e,t.a,t.b)}),ZV=function(e){return f(xa,XV(QV),e)},eK=function(e){e:for(;;){var t=f(hc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(aV,U(M([sV(t),cV(JV(i))]),U(GV(e),ZV(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(nV,U(M([sV(t),cV(JV(i))]),U(GV(e),ZV(e.handlers))),yr);case"Circle":var c=s.a;return f(XF,U(M([sV(t),fV(ZT(c))]),U(GV(e),ZV(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(ZF,U(M([sV(t),lV(ZT(d)),dV(ZT(h))]),U(GV(e),ZV(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(iV,U(M([sV(t),lV(ZT(c)),dV(ZT(c))]),U(f(WV,p,g),U(GV(e),ZV(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(PF,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(uV,U(M([sV(t)]),U(GV(e),ZV(e.handlers))),M([oV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(rV,U(M([sV(t),hV(C)]),U(f(WV,p,g),U(GV(e),ZV(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(eV,U(M([sV(t)]),U(f(WV,p,g),U(GV(e),ZV(e.handlers)))),M([S]));case"Group":var T=n.a;return f(tV,f(ka,sV(t),U(GV(e),ZV(e.handlers))),l(Ra,r(function(e,t){return f(ka,eK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:pV(M([w,I]))});e=v;continue e}}},tK=r(function(e,t){var r=e.a,n=e.b,a=ZT(r),i=ZT(n);return f(IT,yr,M([f(YF,M([QF(a),WF(i),JF("1.1")]),M([eK(t)]))]))}),rK=function(e){return f(tK,L(GF(e),jF(e)),f(LF,qF,e))},nK=r(function(e,t){var r=cF(e),n=function(){switch(t.$){case"NotStarted":return l(bk,10,33,108);case"Active":return l(bk,0,100,170);default:return l(bk,1,129,104)}}(),a=AL(rK(f(RF,CF(hF(n)),gF(50))));return f(Tk,M([iN,w$(f(JN,M([iN,ON,XS(kk(60))]),r))]),a)}),aK=function(e){var t=M([GD,Qk,eN(20)]);switch(e.$){case"Active":return f(Tk,U(t,M([eA(rN)])),Ff("Active"));case"NotStarted":return f(Tk,U(t,M([eA(aR)])),Ff("Not Started"));default:return f(Tk,t,Ff("Finished"))}},iK=n(function(e,t,r){var n=f(ZM,t,e),a=function(){return"Active"===n.$?l(bk,0,226,255):ER}(),i=f(Tk,M([eA(a),eN(20),Qk,iN]),Ff(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 Ak;switch(n.$){case"NotStarted":return d(UR,M([iN]),M([eN(22),ZN]),L(ER,fR),f(yR,e,t));case"Active":var a=f(bR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(jR,M([iN]),M([eN(22),ZN]),L(Dk,fR),i)}return f(bN,M([iN,cN(10)]),M([f(Tk,M([iN]),Ff(nF(e))),f(dO,"Poke",yE(pE))]));default:return f(Tk,M([XS(kk(1))]),Ak)}}();return f(bN,M([KN(20),cN(10),XS(Ik)]),M([f(Tk,M([S$,iN]),i),f(Tk,M([XS(Ik),iN]),f(Tk,M([ON]),f(nK,e,n))),f(bN,M([cN(10),a_,iN]),M([f(Tk,M([iN]),aK(n)),o]))]))}),oK=o(function(e,t,r,n,a,i){var o=f(ZM,r,t),u=f(Tk,M([KN(10),rT(Ik),XS(Ik)]),d(rF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return ml(0)}}(),c=l(iK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(mR,f(Ym,r.state.phaseStartTime,s),i);default:ml(0)}}(),f(Tk,M([XS(Ik),rT(kk(1)),Rk(function(){return"Active"===o.$?l(WI,0,0,1):fR}())]),Ak)),p=a?f(SN,U(KM(e),U(R(o,UM)?MM:HM,M([rT(Ik)]))),M([c,h,u])):f(SN,U(KM(e),U(R(o,UM)?MM:HM,M([Kk,Wk(OM(t))]))),M([c]));return!e&&R(o,UM)?f(bN,M([rT(Ik),cN(20),BN({bottom:20,left:0,right:0,top:0})]),M([p,DM(r.terms.paymentMethods)])):p}),uK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(SN,M([iN,jk(12),KN(30),cN(10),Rk(_M),eN(24),Qk,eA(Dk)]),M([Ff("Trade "+PM(t.state.closedReason)),xM])):e?f(bN,M([rT(Ik),cN(10)]),M([f(SN,M([rT(Ik),XS(eT),cN(20)]),M([p(oK,e,jg,t,n,R(r,jg),a),p(oK,e,Rb,t,n,R(r,Rb),a),p(oK,e,$b,t,n,R(r,$b),a)])),DM(t.terms.paymentMethods)])):f(bN,M([rT(Ik),XS(eT),cN(20)]),M([p(oK,e,jg,t,n,R(r,jg),a),p(oK,e,Rb,t,n,R(r,Rb),a),p(oK,e,$b,t,n,R(r,$b),a)]))}),sK=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(bN,M([rT(Ik),XS(Ik),cN(40)]),M([h($M,t,i,n.wallet,r,n.showStatsModal),f(Tk,M([rT(Ik),f(Mk,40,0),cN(40)]),h(uK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Tk,M([iN,ON,eN(30)]),Ff("Loading trade info..."));default:return f(Tk,M([iN,ON,eN(30)]),Ff("Invalid trade"))}}(),M([qU(n),JU(n)]))}),cK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),fK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(zD,yr);case"CreateModel":var n=r.a;return L(f(Yi,fy,DD(n)),yr);case"TradeModel":var a=r.a;return l(cK,Yi(hy),xa(Yi(hy)),d(sK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,qS,l(wU,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,VS,l(c$,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Tk,M([rT(Ik),XS(Ik),jk(10)]),n),a)}),lK=function(e){return{$:"DismissNotice",a:e}},dK=function(e){return f(L$,iU,oU(e))},hK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(WI,1,1,1):l(WI,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(bk,100,200,255);case"Caution":return l(bk,255,188,0);case"Error":return l(bk,255,70,70);default:return l(bk,200,200,200)}}(),o=f(Tk,M([vN,S$,x$(5),dK(5)]),v$(lK(t)));return f(Tk,M([Rk(i),jk(10),KN(8),rT(Ik),XR(1),JR(d(wN,0,0,0,.15)),aD]),f(bN,M([cN(4),rT(Ik)]),f(Bi,r(function(e,t){return f(dN,M([rT(Ik),eA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},pK=function(e){return R(e,yr)?yr:M([f(bN,M([uU(20),x$(20),cN(10),vN,a_,rT(kk(300)),eN(15)]),f(xa,hK,f(Yf,function(e){return R(e.b.align,Uf)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(bN,M([dK(20),fL(100),cN(10),v_,S$,rT(kk(300)),eN(15)]),f(xa,hK,f(Yf,function(e){return R(e.b.align,tB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},gK=r(function(e,t){var r=f(fK,e,t),n=r.a,a=r.b;return L(f(bN,M([FR($k),w$(TN(t)),rT(Ik),XS(Ik),KN(30)]),M([f(Tk,M([XS(kk(50))]),Ak),n])),U(a,pK(t.userNotices)))}),vK=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),yK=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),mK={$:"AllowHover"},bK={$:"Layout"},CK={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(YI,155/255,203/255,1,1),offset:L(0,0),size:3})},EK=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?CK:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?mK:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?bK:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},SK=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(uT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),uT);case"Text":var a=t.a;return dI(a);default:return dI("")}}),TK=n(function(e,t,r){var n=EK(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?vK(n):yK(n)}();return f(SK,a,d(qI,uT,Sk,t,iT(M([r]))))}),wK=xT(5),IK=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),AK={$:"SansSerif"},BK=function(e){return{$:"Typeface",a:e}},kK=Y,NK=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",kK(Ml(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",kK(Ml(t)));default:var t=e.a.name;return f(Ri,"-",kK(Ml(t)))}}())}),RK=function(){var e=M([BK("Open Sans"),BK("Helvetica"),BK("Verdana"),AK]);return M([f(XI,Nk,l(QI,"bg-color-"+ZI(d(YI,1,1,1,0)),"background-color",d(YI,1,1,1,0))),f(XI,JI,l(QI,"font-color-"+ZI(d(YI,0,0,0,1)),"color",d(YI,0,0,0,1))),f(XI,Xk,Zk(20)),f(XI,wK,f(IK,l(Ra,NK,"font-",e),e))])}(),$K=n(function(e,t,r){var n=e.options;return l(TK,n,f(ka,GI(f(Ri," ",M([lT.root,lT.any,lT.single]))),U(RK,t)),r)}),_K=$K({options:yr}),LK=function(e){return f(XI,wK,f(IK,l(Ra,NK,"ff-",e),e))},xK=AK,PK=BK,DK=function(e){return{body:M([function(){var t=f(gK,e.screenWidth,e),r=t.a,n=t.b,a=U(M([rT(Ik),XS(Ik),LK(M([PK("Soleil"),xK]))]),f(xa,w$,n));return f(_K,a,r)}()]),title:"DAIHard"}},UK=Ht,OK=UK({init:bB,onUrlChange:mk,onUrlRequest:yk,subscriptions:vk,update:HA,view:DK});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:OK(f(qo,function(e){return f(qo,function(t){return f(qo,function(r){return Fi({height:r,networkId:t,width:e})},f(gh,"height",BC))},f(gh,"networkId",BC))},f(gh,"width",BC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/docs/static/js/main-6db0b05de0e6b3762895.js b/docs/static/js/main-6db0b05de0e6b3762895.js deleted file mode 100644 index 15f14f7..0000000 --- a/docs/static/js/main-6db0b05de0e6b3762895.js +++ /dev/null @@ -1,7 +0,0 @@ -!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/DAIHard/",t(t.s=43)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t,n,a,i){function o(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(l.isArrayBuffer(e)||l.isArrayBufferView(e))if(void 0!==i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(i=Date.now(),s(e)):(a.push(e),1===a.length&&u.setAttribute("a",o=!o))}}l.nextTick=l.setImmediate}(),l.isNodejs=void 0!==t&&t.versions&&t.versions.node,l.globalScope=function(){return l.isNodejs?a:"undefined"==typeof self?window:self}(),l.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},l.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},l.isArrayBufferView=function(e){return e&&l.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},l.ByteBuffer=u,l.ByteStringBuffer=u;l.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},l.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},l.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},l.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},l.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},l.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},l.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(l.encodeUtf8(e))},l.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},l.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},l.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},l.ByteStringBuffer.prototype.putInt=function(e,t){o(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},l.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},l.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},l.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},l.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},l.ByteStringBuffer.prototype.copy=function(){var e=l.createBuffer(this.data);return e.read=this.read,e},l.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},l.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},l.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},l.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},l.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},l.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},l.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},l.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},l.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},l.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},l.DataBuffer.prototype.putInt=function(e,t){o(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},l.DataBuffer.prototype.putSignedInt=function(e,t){return o(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},l.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},l.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},l.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},l.DataBuffer.prototype.copy=function(){return new l.DataBuffer(this)},l.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},l.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},l.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},l.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},l.xorBytes=function(e,t,r){for(var n="",a="",i="",o=0,u=0;r>0;--r,++o)a=e.charCodeAt(o)^t.charCodeAt(o),u>=10&&(n+=i,i="",u=0),i+=String.fromCharCode(a),++u;return n+=i},l.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";l.encode64=function(e,t){for(var r,n,a,i="",o="",u=0;u>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,a,i="",o=0;o>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==a&&(i+=String.fromCharCode((3&n)<<6|a)));return i},l.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},l.decodeUtf8=function(e){return decodeURIComponent(escape(e))},l.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:f.encode,decode:f.decode}},l.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},l.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i>2),i+=d.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=d.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":d.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},l.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var a,i,o,u,s=0,c=r;s>4,64!==o&&(n[c++]=(15&i)<<4|o>>2,64!==u&&(n[c++]=(3&o)<<6|u));return t?c-r:n.subarray(0,c)},l.binary.base58.encode=function(e,t){return l.binary.baseN.encode(e,p,t)},l.binary.base58.decode=function(e,t){return l.binary.baseN.decode(e,p,t)},l.text={utf8:{},utf16:{}},l.text.utf8.encode=function(e,t,r){e=l.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,i=0;i0?(a=r[n].substring(0,o),i=r[n].substring(o+1)):(a=r[n],i=null),a in t||(t[a]=[]),a in Object.prototype||null===i||t[a].push(unescape(i))}return t};return void 0===e?(null===S&&(S="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=S):t=r(e),t},l.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var a=t.split("/");return a.length>0&&""===a[0]&&a.shift(),{pathString:t,queryString:r,path:a,query:""===r?{}:l.getQueryVariables(r)}},l.makeRequest=function(e){var t=l.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},l.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},l.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,a=t.length;n0&&i.push(r),o=n.lastIndex;var u=t[0][1];switch(u){case"s":case"o":a");break;case"%":i.push("%");break;default:i.push("<%"+u+"?>")}}return i.push(e.substring(o)),i.join("")},l.formatNumber=function(e,t,r,n){var a=e,i=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,u=void 0===n?".":n,s=a<0?"-":"",c=parseInt(a=Math.abs(+a||0).toFixed(i),10)+"",f=c.length>3?c.length%3:0;return s+(f?c.substr(0,f)+u:"")+c.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+u)+(i?o+Math.abs(a-c).toFixed(i).slice(2):"")},l.formatSize=function(e){return e=e>=1073741824?l.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?l.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?l.formatNumber(e/1024,0)+" KiB":l.formatNumber(e,0)+" bytes"},l.bytesFromIP=function(e){return-1!==e.indexOf(".")?l.bytesFromIPv4(e):-1!==e.indexOf(":")?l.bytesFromIPv6(e):null},l.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=l.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(i)}if(r.length>0){var s=r[n];s.end-s.start>0&&(t.splice(s.start,s.end-s.start+1,""),0===s.start&&t.unshift(""),7===s.end&&t.push(""))}return t.join(":")},l.estimateCores=function(e,t){function r(e,o,u){if(0===o){var s=Math.floor(e.reduce(function(e,t){return e+t},0)/e.length);return l.cores=Math.max(1,s),URL.revokeObjectURL(i),t(null,l.cores)}n(u,function(t,n){e.push(a(u,n)),r(e,o-1,u)})}function n(e,t){for(var r=[],n=[],a=0;au.st&&a.sta.st&&u.st0)return l.cores=navigator.hardwareConcurrency,t(null,l.cores);if("undefined"==typeof Worker)return l.cores=1,t(null,l.cores);if("undefined"==typeof Blob)return l.cores=2,t(null,l.cores);var i=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}function a(e,t,r,i){var s;n(e,t,2);var c=e.getByte();t--;var f=192&c,l=31&c;s=e.length();var d=u(e,t);if(t-=s-e.length(),void 0!==d&&d>t){if(i.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=e.length(),h.remaining=t,h.requested=d,h}d=t}var p,g,v=32==(32&c);if(v)if(p=[],void 0===d)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}s=e.length(),p.push(a(e,t,r+1,i)),t-=s-e.length()}else for(;d>0;)s=e.length(),p.push(a(e,d,r+1,i)),t-=s-e.length(),d-=s-e.length();if(void 0===p&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&(g=e.bytes(d)),void 0===p&&i.decodeBitStrings&&f===o.Class.UNIVERSAL&&l===o.Type.BITSTRING&&d>1){var y=e.read,m=t,b=0;if(l===o.Type.BITSTRING&&(n(e,t,1),b=e.getByte(),t--),0===b)try{s=e.length();var C={verbose:i.verbose,strict:!0,decodeBitStrings:!0},E=a(e,t,r+1,C),S=s-e.length();t-=S,l==o.Type.BITSTRING&&S++;var T=E.tagClass;S!==d||T!==o.Class.UNIVERSAL&&T!==o.Class.CONTEXT_SPECIFIC||(p=[E])}catch(e){}void 0===p&&(e.read=y,t=m)}if(void 0===p){if(void 0===d){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=t}if(l===o.Type.BMPSTRING)for(p="";d>0;d-=2)n(e,t,2),p+=String.fromCharCode(e.getInt16()),t-=2;else p=e.getBytes(d)}var w=void 0===g?null:{bitStringContents:g};return o.create(f,l,v,p,w)}var i=r(0);r(1),r(6);var o=e.exports=i.asn1=i.asn1||{};o.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},o.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},o.create=function(e,t,r,n,a){if(i.util.isArray(n)){for(var u=[],s=0;s1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?n.putBytes(e.value.substr(1)):n.putBytes(e.value);if(t.putByte(r),n.length()<=127)t.putByte(127&n.length());else{var s=n.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);t.putByte(128|c.length);for(var u=c.length-1;u>=0;--u)t.putByte(c.charCodeAt(u))}return t.putBuffer(n),t},o.oidToDer=function(e){var t=e.split("."),r=i.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var n,a,o,u,s=2;s>>=7,n||(u|=128),a.push(u),n=!1}while(o>0);for(var c=a.length-1;c>=0;--c)r.putByte(a[c])}return r},o.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)r=e.getByte(),n<<=7,128&r?n+=127&r:(t+="."+(n+r),n=0);return t},o.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),u=0;if(e.length>11){var s=e.charAt(10),c=10;"+"!==s&&"-"!==s&&(u=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,0),c&&("+"===(s=e.charAt(c))||"-"===s)){var f=parseInt(e.substr(c+1,2),10),l=parseInt(e.substr(c+4,2),10),d=60*f+l;d*=6e4,"+"===s?t.setTime(+t-d):t.setTime(+t+d)}return t},o.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),u=parseInt(e.substr(12,2),10),s=0,c=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var l=e.length-5,d=e.charAt(l);if("+"===d||"-"===d){c=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10),c*=6e4,"+"===d&&(c*=-1),f=!0}return"."===e.charAt(14)&&(s=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,a),t.setUTCHours(i,o,u,s),t.setTime(+t+c)):(t.setFullYear(r,n,a),t.setHours(i,o,u,s)),t},o.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},o.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},o.validate=function(e,t,r,n){var a=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(a=!0,t.value&&i.util.isArray(t.value))for(var u=0,s=0;a&&s0&&(n+="\n");for(var a="",u=0;u1?n+="0x"+i.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?n+=" (1 unused bit shown)":d>1&&(n+=" ("+d+" unused bits shown)")}}else e.type===o.Type.OCTETSTRING?(s.test(e.value)||(n+="("+e.value+") "),n+="0x"+i.util.bytesToHex(e.value)):e.type===o.Type.UTF8?n+=i.util.decodeUtf8(e.value):e.type===o.Type.PRINTABLESTRING||e.type===o.Type.IA5String?n+=e.value:s.test(e.value)?n+="0x"+i.util.bytesToHex(e.value):0===e.value.length?n+="[null]":n+=e.value}return n}},function(e,t,r){var n=r(0);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){function n(e,t){var r=function(){return new s.aes.Algorithm(e,t)};s.cipher.registerAlgorithm(e,r)}function a(){p=!0,l=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;c=new Array(256),f=new Array(256),d=new Array(4),h=new Array(4);for(var t=0;t<4;++t)d[t]=new Array(256),h[t]=new Array(256);for(var r,n,a,i,o,u,s,g=0,v=0,t=0;t<256;++t){i=v^v<<1^v<<2^v<<3^v<<4,i=i>>8^255&i^99,c[g]=i,f[i]=g,o=e[i],r=e[g],n=e[r],a=e[n],u=o<<24^i<<16^i<<8^i^o,s=(r^n^a)<<24^(g^a)<<16^(g^n^a)<<8^g^r^a;for(var y=0;y<4;++y)d[y][g]=u,h[y][i]=s,u=u<<24|u>>>8,s=s<<24|s>>>8;0===g?g=v=1:(g=r^e[e[e[r^a]]],v^=e[e[v]])}}function i(e,t){for(var r,n=e.slice(0),a=1,i=n.length,o=i+6+1,u=g*o,s=i;s>>16&255]<<24^c[r>>>8&255]<<16^c[255&r]<<8^c[r>>>24]^l[a]<<24,a++):i>6&&s%i==4&&(r=c[r>>>24]<<24^c[r>>>16&255]<<16^c[r>>>8&255]<<8^c[255&r]),n[s]=n[s-i]^r;if(t){var f,d=h[0],p=h[1],v=h[2],y=h[3],m=n.slice(0);u=n.length;for(var s=0,b=u-g;s>>24]]^p[c[f>>>16&255]]^v[c[f>>>8&255]]^y[c[255&f]];n=m}return n}function o(e,t,r,n){var a,i,o,u,s,l=e.length/4-1;n?(a=h[0],i=h[1],o=h[2],u=h[3],s=f):(a=d[0],i=d[1],o=d[2],u=d[3],s=c);var p,g,v,y,m,b,C;p=t[0]^e[0],g=t[n?3:1]^e[1],v=t[2]^e[2],y=t[n?1:3]^e[3];for(var E=3,S=1;S>>24]^i[g>>>16&255]^o[v>>>8&255]^u[255&y]^e[++E],b=a[g>>>24]^i[v>>>16&255]^o[y>>>8&255]^u[255&p]^e[++E],C=a[v>>>24]^i[y>>>16&255]^o[p>>>8&255]^u[255&g]^e[++E],y=a[y>>>24]^i[p>>>16&255]^o[g>>>8&255]^u[255&v]^e[++E],p=m,g=b,v=C;r[0]=s[p>>>24]<<24^s[g>>>16&255]<<16^s[v>>>8&255]<<8^s[255&y]^e[++E],r[n?3:1]=s[g>>>24]<<24^s[v>>>16&255]<<16^s[y>>>8&255]<<8^s[255&p]^e[++E],r[2]=s[v>>>24]<<24^s[y>>>16&255]<<16^s[p>>>8&255]<<8^s[255&g]^e[++E],r[n?1:3]=s[y>>>24]<<24^s[p>>>16&255]<<16^s[g>>>8&255]<<8^s[255&v]^e[++E]}function u(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="AES-"+r;t=e.decrypt?s.cipher.createDecipher(n,e.key):s.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof s.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var s=r(0);r(15),r(23),r(1),e.exports=s.aes=s.aes||{},s.aes.startEncrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!1,mode:n});return a.start(t),a},s.aes.createEncryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!1,mode:t})},s.aes.startDecrypting=function(e,t,r,n){var a=u({key:e,output:r,decrypt:!0,mode:n});return a.start(t),a},s.aes.createDecryptionCipher=function(e,t){return u({key:e,output:null,decrypt:!0,mode:t})},s.aes.Algorithm=function(e,t){p||a();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return o(r._w,e,t,!1)},decrypt:function(e,t){return o(r._w,e,t,!0)}}}),r._init=!1},s.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(s.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=s.util.createBuffer();for(var n=0;n>>=2;for(var n=0;n65&&-1!==o){var u=t[o];","===u?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+u+t.substr(o+1),i=a-o-1,o=-1,++a}else" "!==t[a]&&"\t"!==t[a]&&","!==t[a]||(o=a);return t}function a(e){return e.replace(/^\s+/,"")}var i=r(0);r(1);var o=e.exports=i.pem=i.pem||{};o.encode=function(e,t){t=t||{};var r,a="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=n(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=n(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=n(r)),e.headers)for(var o=0;ot.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),a=n.util.createBuffer(),c=o.length();for(var s=0;s=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,s=e.h4,f=0;f<16;++f)n=r.getInt32(),t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<20;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=u^i&(o^u),n=(a<<5|a>>>27)+c+s+1518500249+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<32;++f)n=t[f-3]^t[f-8]^t[f-14]^t[f-16],n=n<<1|n>>>31,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<40;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+1859775393+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<60;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i&o|u&(i^o),n=(a<<5|a>>>27)+c+s+2400959708+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;for(;f<80;++f)n=t[f-6]^t[f-16]^t[f-28]^t[f-32],n=n<<2|n>>>30,t[f]=n,c=i^o^u,n=(a<<5|a>>>27)+c+s+3395469782+n,s=u,u=o,o=(i<<30|i>>>2)>>>0,i=a,a=n;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,e.h4=e.h4+s|0,l-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=o,o.create=function(){s||n();var e=null,t=i.util.createBuffer(),r=new Array(80),o={algorithm:"sha1",blockLength:64,digestLength:20,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};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},o};var u=null,s=!1},function(e,t,r){"use strict";(function(e){function n(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),i.alloc(+e)}function v(e,t){if(i.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(n)return j(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return _(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return $(this,t,r);case"base64":return B(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,a){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:C(e,t,r,n,a);if("number"==typeof t)return t&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):C(e,[t],r,n,a);throw new TypeError("val must be string, number or Buffer")}function C(e,t,r,n,a){function i(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,u=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,u/=2,s/=2,r/=2}var c;if(a){var f=-1;for(c=r;cu&&(r=u-s),c=r;c>=0;c--){for(var l=!0,d=0;da&&(n=a):n=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(a+u<=r){var s,c,f,l;switch(u){case 1:i<128&&(o=i);break;case 2:s=e[a+1],128==(192&s)&&(l=(31&i)<<6|63&s)>127&&(o=l);break;case 3:s=e[a+1],c=e[a+2],128==(192&s)&&128==(192&c)&&(l=(15&i)<<12|(63&s)<<6|63&c)>2047&&(l<55296||l>57343)&&(o=l);break;case 4:s=e[a+1],c=e[a+2],f=e[a+3],128==(192&s)&&128==(192&c)&&128==(192&f)&&(l=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&f)>65535&&l<1114112&&(o=l)}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),a+=u}return N(n)}function N(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var a="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,a,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function D(e,t,r,n){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-r,2);a>>8*(n?a:1-a)}function U(e,t,r,n){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-r,4);a>>8*(n?a:3-a)&255}function O(e,t,r,n,a,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,a){return a||O(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,a){return a||O(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(e,t,r,n,52,8),r+8}function V(e){if(e=K(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function K(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function j(e,t){t=t||1/0;for(var r,n=e.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(e){for(var t=[],r=0;r>8,a=r%256,i.push(a),i.push(n);return i}function z(e){return J.toByteArray(V(e))}function Y(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function W(e){return e!==e}/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r,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 S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(Jh,o,function(e){return si(Qh(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Zh,e,L(r,ip({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Zh,e,L(r,ap({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=Pg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?Tg(o):Sg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return Pg(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(wg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Ag,Ig,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(Io,xa(Us),f(Io,ms,Ds))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(qd,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(qd,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(np)}),i.addEventListener("timeout",function(){a(op)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Qh(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(tp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Ag,Ig,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Ag,Ig,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Ag,Ig,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=function(e){return{orderBy:e}},fo=co,lo={$:"Ascending"},ho={$:"Phase"},po=Oe,go=po(yr),vo=r(function(e,t){return L({agentAddress:t,tradeTable:fo(L(ho,lo)),wallet:e},go)}),yo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),mo={$:"None"},bo=mo,Co=function(e){return d(yo,e,go,bo,yr)},Eo=function(e){return{$:"TradeTableMsg",a:e}},So=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),To=r(function(e,t){return f(So,e,t)}),wo=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Io=n(function(e,t,r){return t(e(r))}),Ao=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),Bo=r(function(e,t){if("None"===t.$)return mo;var r=t.a,n=t.b,a=l(wo,f(Ao,Da(e),r.onSign),f(Ao,Da(e),r.onBroadcast),f(Ao,function(t){var r=t.a,n=t.b;return L(f(Io,r,e),f(Ao,function(t){return{confirmations:t.confirmations,toMsg:f(Io,t.toMsg,e)}},n))},r.onMined));return f(So,a,n)}),ko=function(e){return{$:"AbiDecoder",a:e}},No=r(function(e,t){return{$:"Tape",a:e,b:t}}),Ro=z,$o=Fr,_o=r(function(e,t){return e<1?t:l($o,e,Ro(t),t)}),Lo=_o(64),xo=n(function(e,t,r){return L(f(No,e,Lo(t)),r)}),Po=r(function(e,t){return e<1?"":l($o,0,e,t)}),Do=Po(64),Uo=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),Oo=function(e){return-e},Mo=r(function(e,t){return e<1?"":l($o,-e,Ro(t),t)}),Fo=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(Po,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(Mo,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return ko(function(t){var r=t.a,n=t.b;return f(Uo,f(xo,r,n),e(Do(n)))})}(),Vo=Hr,Ko=function(e){return f(Vo,"0x",e)||f(Vo,"0X",e)?f(_o,2,e):e},Ho=function(e){return e.b},jo=r(function(e,t){var r=e.a;return f(Uo,Ho,r(function(e){return f(No,e,e)}(Ko(t))))}),qo=Xr,Go=ae,zo=Wr,Yo=function(e){return f(qo,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return Go(a)},zo)},Wo=f(Io,jo,Yo),Jo=function(e){return{$:"Magnitude",a:e}},Qo=function(e){return{$:"Pos",a:e}},Xo=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Zo=function(e){return{$:"MagnitudeNotNormalised",a:e}},eu=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 si(n)}return ci}},tu=function(e){var t=eu(e);return"Nothing"!==t.$&&t.a<0},ru=function(e){return{$:"Neg",a:e}},nu={$:"Zer"},au=function(e){return!e.b},iu=r(function(e,t){var r=t.a;if(au(r))return nu;switch(e.$){case"Zero":return nu;case"Positive":return Qo(t);default:return ru(t)}}),ou=r(function(e,t){return f(Xo,e,Zo(t))}),uu=function(e){return f(La,r(function(t,r){return e(t)&&au(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),su=Ir,cu=-1+f(su,10,7),fu=cu+1,lu=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),du=function(e){return e<0?f(lu,Na(-1),du(e+fu)):L(e/fu|0,e%fu)},hu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=du(r+e),i=a.a,o=a.b;return f(ka,o,f(hu,i,n))}{if(!(_(e,fu)>0))return M([e]);var u=M([e]);e=0,t=u}}}),pu=function(e){var t=e.a;return Jo(uu(f(hu,0,t)))},gu=xa(Oo),vu={$:"Negative"},yu={$:"Positive"},mu={$:"Zero"},bu=function(e){switch(e.$){case"Positive":return vu;case"Negative":return yu;default:return mu}},Cu=function(e){for(;;){var t=e.a,r=e.b,n=pu(r),a=n.a;if(!tu(a))return f(iu,t,Jo(a));e=f(ou,bu(t),gu(a))}},Eu=pr,Su=function(e){switch(f(Eu,e,0).$){case"LT":return vu;case"GT":return yu;default:return mu}},Tu=function(e){return e<0?-e:e},wu=function(e){return Cu(f(Xo,Su(e),Zo(M([Tu(e)]))))},Iu=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(su,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},Au=function(e){switch(e.$){case"Zer":return nu;case"Neg":var t=e.a;return Qo(t);default:return e}},Bu=function(e){return{$:"MagnitudePair",a:e}},ku=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(ka,L(a,u),f(ku,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(ku,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(ku,yr,s))}return yr}),Nu=r(function(e,t){var r=e.a,n=t.a;return Bu(f(ku,r,n))}),Ru=function(e){switch(e.$){case"Zer":return f(ou,mu,yr);case"Neg":var t=e.a.a;return f(ou,yu,gu(t));default:var t=e.a.a;return f(ou,yu,t)}},$u=r(function(e,t){var r=Ru(t),n=r.b,a=Ru(e),i=a.b,o=f(Nu,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Cu(f(Xo,yu,Zo(s)))}),_u=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(R(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 Ta}return a.b.b?ba:f(Eu,e,t)}}),Lu=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},xu=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(_u,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Lu(d(_u,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),Pu=r(function(e,t){return R(f(xu,e,t),Ta)}),Du=K,Uu=r(function(e,t){return!f(Pu,e,t)}),Ou=function(e){switch(e.$){case"Zer":return Jo(yr);case"Pos":default:var t=e.a;return t}},Mu=r(function(e,t){var r=e.a;return pu(Zo(f(xa,ti(t),r)))}),Fu=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(Mu,Jo(n),a),u=f(Fu,Jo(i),Jo(n)),s=u.a,c=f($u,f(iu,yu,o),f(iu,yu,Jo(f(ka,0,s))));return Ou(c)}var a=r.a;return f(Mu,Jo(n),a)}return Jo(yr)}),Vu=function(e){switch(e.$){case"Zer":return mu;case"Pos":return yu;default:return vu}},Ku=r(function(e,t){return R(e,mu)||R(t,mu)?mu:R(e,t)?yu:vu}),Hu=r(function(e,t){return f(iu,f(Ku,Vu(e),Vu(t)),f(Fu,Ou(e),Ou(t)))}),ju=function(e){switch(e.$){case"Zer":return nu;case"Pos":var t=e.a;return ru(t);default:var t=e.a;return Qo(t)}},qu=r(function(e,t){return f($u,e,ju(t))}),Gu=wu(0),zu=a(function(e,t,r,n){if(e){var a=wu(e),i=f(Hu,f(Hu,a,n),t),o=f(Uu,i,r)?L(f(Hu,a,t),f(qu,r,i)):L(Gu,r),u=o.a,s=o.b,c=d(zu,e/2|0,t,s,n),l=c.a,h=c.b;return L(f($u,u,l),h)}return L(Gu,r)}),Yu=Fa(f(Va,2,cu)),Wu=n(function(e,t,r){return d(zu,f(su,2,Yu),e,t,r)}),Ju=wu(1),Qu=r(function(e,t){return e}),Xu=n(function(e,t,r){return l(Ra,Qu(e),t,f(Ai,1,r))}),Zu=function(e){return l(Xu,Hu(wu(fu)),Ju,e)},es=n(function(e,t,r){if(e){var n=l(Wu,Zu(e),t,r),a=n.a,i=n.b,o=l(es,e-1,i,r),u=o.a,s=o.b;return L(f($u,a,u),s)}return l(Wu,Zu(e),t,r)}),ts=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},rs=r(function(e,t){if(R(t,Gu))return ci;var r=Ti(ts(e))-Ti(ts(t))+1,n=l(es,f(ei,0,r),Au(e),Au(t)),a=n.a,i=n.b;return si(L(f(iu,f(Ku,Vu(e),Vu(t)),Ou(a)),f(iu,Vu(e),Ou(i))))}),ns=f(Hu,wu(2),wu(2147483648)),as=xr,is=function(e){return f(as,e,"")},os=Pn,us=n(function(e,t,r){return e<=0?r:l(us,e>>1,U(t,t),1&e?U(r,t):r)}),ss=r(function(e,t){return l(us,e,t,"")}),cs=n(function(e,t,r){return U(f(ss,e-Ro(r),is(t)),r)}),fs=te,ls=Ar,ds=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},hs=r(function(e,t){for(;;){if(t<16)return f(ka,ds(t),e);var r=f(ka,ds(f(ls,16,t)),e),n=t/16|0;e=r,t=n}}),ps=function(e){return fs(e<0?f(ka,P("-"),f(hs,yr,-e)):f(hs,yr,e))},gs=function(e){var t=f(rs,e,ns);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=ps(Iu(a));return R(n,wu(0))?i:U(gs(n),l(cs,8,P("0"),i))},vs=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,Jo(yr))?"0":gs(Qo(t));default:var t=e.a;return"-"+vs(f(Hu,wu(-1),e))}},ys=function(e){return l(cs,64,P("0"),e)},ms=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=ys(ps(a)),c=function(e){return U(e,n)}(ys(ps(u)));return x(a+32+(Ro(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},bs=Dr,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))))}),Es=n(function(e,t,n){return l(bs,r(function(t,r){return l(Cs,e,yi(t),r)}),t,n)}),Ss=function(e){return $a(l(Es,ka,yr,e))},Ts=function(e){return f(Ri,"",f(xa,f(Io,ps,f(cs,2,P("0"))),Ss(e)))},ws=function(e){return 64-f(ls,64,e)},Is=function(e){return U(e,f(ss,ws(Ro(e)),"0"))},As=function(e){return L(si(Ro(e)/2|0),Is(e))},Bs=function(e){return L(ci,ys(e))},ks=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Ns=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"}},Rs=Ur,$s=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(as,P("1"),r),!0);case"1":return L(f(as,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(as,P("0"),r),!1);case"1":return L(f(as,P("1"),r),!0);default:break e}return L(r,!0)});return l(Rs,t,L("",!1),e).a},_s=function(e){return l(Rs,ka,yr,e)},Ls=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(_o,e,t),i=f(ka,l($o,0,e,t),r);e=n,t=a,r=i}}),xs=r(function(e,t){return e&&""!==t?l(Ls,e,t,yr):M([t])}),Ps=function(e){var t=function(){var t=_s(vs(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(Io,$s,f(cs,256,P("1"))))}var r=t;return L(r,f(cs,256,P("0")))}(),r=t.a,n=t.b;return fs(f(xa,ks,f(xs,4,n(f(Ri,"",f(xa,Ns,r))))))},Ds=function(e){return{$:"Hex",a:e}},Us=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Bs(t);case"UintE":var r=e.a;return Bs(vs(r));case"IntE":var n=e.a;return Bs(Ps(n));case"BoolE":return Bs(e.a?"1":"0");case"DBytesE":var a=e.a.a;return As(a);case"BytesE":var a=e.a.a;return Bs(Ko(a));case"StringE":var i=e.a;return As(Ts(i));case"ListE":var o=e.a;return function(e){var t=e.a;return As(t)}(Xt()(o));default:var i=e.a;return Bs(Ko(i))}};try{var Os=Xt();Xt=function(){return Os}}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 Ms=Pr,Fs=function(e){return 1===Ro(e)?f(Ms,"0",e):e},Vs=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(ka,n,r);e=i,t=o,r=u}}}),Ks=r(function(e,t){return $a(l(Vs,e,t,yr))}),Hs=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(Ks,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(Hs,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),js=r(function(e,t){return l(Hs,0,e,t)}),qs=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),Gs=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 Pt(e.a)}},zs={$:"LE"},Ys=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,zs));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,zs));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,zs));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,zs));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,zs));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,zs));case"Seq":var i=e.b;return l(Ws,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),Ws=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Ys,n,t,r);e=i,t=o,r=u}}),Js=Dt,Qs=r(function(e,t){return{$:"Seq",a:e,b:t}}),Xs=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+Gs(r),i=n;e=a,t=i}}),Zs=function(e){return f(Qs,f(Xs,0,e),e)},ec=function(e){return{$:"U8",a:e}},tc=ec,rc=r(function(e,t){return _(e,t)<0?e:t}),nc=hr,ac=function(e){return{$:"Bytes",a:e}},ic=ac,oc=function(e){return Js(Zs(f(xa,ic,$a(e))))},uc=Pt,sc=r(function(e,t){var r=e.a;return f(zn,r,t)}),cc=function(e){return{$:"Decoder",a:e}},fc=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}}),lc=r(function(e,t){return cc(f(fc,e,t))}),dc=cc(Yn),hc=r(function(e,t){if("Just"===t.$){return t.a}return e}),pc=function(e){return{$:"Done",a:e}},gc=function(e){return{$:"Loop",a:e}},vc=r(function(e,t){var n=t.a;return cc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),yc=function(e){return cc(r(function(t,r){return L(r,e)}))},mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?yc(pc($a(n))):f(vc,function(e){return gc(L(r-1,f(ka,e,n)))},e)}),bc=function(e){return f(hc,yr,f(sc,f(lc,L(uc(e),yr),mc(dc)),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))}),Ec=r(function(e,t){return l(Cc,os,e,t)}),Sc=f(Ai,0,4),Tc=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}}),wc=xt,Ic=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),Ac=function(e){return f(Ic,f(Io,wc,os(4294967295)),e)},Bc=r(function(e,t){return 5*t+e}),kc=4294967295>>>32-Ha,Nc=ar,Rc=n(function(e,t,r){for(;;){var n=kc&t>>>e,a=f(Nc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Nc,kc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),$c=function(e){return e>>>5<<5},_c=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,$c(r))>-1?f(Nc,kc&e,i):l(Rc,n,e,a))}),Lc=r(function(e,t){var r=f(_c,e,t);if("Just"===r.$){return r.a}return L(0,0)}),xc=n(function(e,t,r){var n=f(Bc,e,t);return f(Lc,n,r)}),Pc=ir,Dc=a(function(e,t,r,n){var a=kc&t>>>e,i=f(Nc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Dc,e-Ha,t,r,o);return l(Pc,a,za(u),n)}var s=i.a,c=l(Pc,kc&t,r,s);return l(Pc,a,Ga(c),n)}),Uc=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,$c(n))>-1?d(Ma,n,a,i,l(Pc,kc&e,t,o)):d(Ma,n,a,d(Dc,a,e,t,i),o)}),Oc=n(function(e,t,r){return l(Uc,e,t,r)}),Mc=a(function(e,t,r,n){var a=f(Bc,e,t);return l(Oc,a,r,n)}),Fc=Dn,Vc=r(function(e,t){return l(Cc,Fc,e,t)}),Kc=function(e){var t=l(La,r(function(t,n){var a={d0:l(xc,0,t,e.state),d1:l(xc,1,t,e.state),d2:l(xc,2,t,e.state),d3:l(xc,3,t,e.state),d4:l(xc,4,t,e.state)},i=r(function(e,r){return d(Mc,e,t,f(Vc,f(Tc,e,a),f(Ec,Ac(f(Tc,f(ls,5,e+1),a)),f(Tc,f(ls,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Sc);return D(e,{state:t})},Hc=L(0,0),jc=function(e){return{current:Hc,lfsrstate:1,state:e,x:1,y:0}},qc=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},Gc=L(1,0),zc=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),Yc=r(function(e,t){if(e){var n=f(zc,1,t);return l(Cc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),Wc=r(function(e,t){var r=f(ls,32,e/32|0),n=f(zc,r,t),a=f(ls,32,e);return f(Yc,a,n)}),Jc=n(function(e,t,r){var n=f(_c,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(Uc,e,t(a),r)}),Qc=n(function(e,t,r){return l(Jc,e,Vc(t),r)}),Xc=a(function(e,t,r,n){var a=f(Bc,e,t);return l(Qc,a,r,n)}),Zc=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),sf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(rc,n,r),i=f(xa,function(e){return f(uf,e,g)},f(Ai,0,a)),o=of(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(js,i.outputLen,l(v,g,yr,i.outputLen))},df=function(e){return{$:"KS",a:e}},hf=function(e){var t=e.a;return df({config:t,inputLength:0,partial:yr,state:f(ui,25,Qu(Hc))})},pf=function(e){return cc(Wn(e))},gf=Js(Zs(yr)),vf=r(function(e,t){var n=t.a;return cc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),yf=r(function(e,t){return f(vf,function(e){return pf(t)},pf(e))}),mf=r(function(e,t){return f(hc,gf,f(sc,f(yf,e,uc(t)-e),t))}),bf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=uc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+uc(e)}),0,i),a)>-1))return df(D(n,{inputLength:uc(e)+n.inputLength,partial:i}));var o=oc(i),u=f(hc,gf,f(sc,pf(a),o)),s=bc(u),c=f(ff,s,n.state),d=of(c),h=f(mf,a,o),p=gf,g=df(D(n,{inputLength:uc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Cf=r(function(e,t){return lf(f(bf,Js(Zs(f(xa,tc,t))),hf(e)))}),Ef=Cf(qs),Sf=function(e){return Ds(f(Ri,"",f(xa,f(Io,ps,Fs),f(js,4,Ef(f(xa,yi,_s(e)))))))},Tf=function(e){return f(Vo,"0x",e)||f(Vo,"0X",e)?e:"0x"+e},wf=function(e){var t=e.a;return Tf(t)},If=r(function(e,t){var r=ms(f(xa,Us,t)),n=function(e){return U(e,r)}(Ko(wf(Sf(e))));return Ds(n)}),Af=function(e){return{data:si(f(If,"poke()",yr)),decoder:Wo(Fo),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Bf=r(function(e,t){return{$:"Trade",a:e,b:t}}),kf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Nf={$:"Descending"},Rf=function(e){return"Ascending"===e.$?Nf:lo},$f=function(e){return d(kf,e,go,bo,yr)},_f=r(function(e,t){return L(t.a,e(t.b))}),Lf=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(kf,t,go,bo,M([da(f(Bf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(_f,Rf,t.orderBy):L(a,lo);return $f(D(t,{orderBy:i}));default:return $f(t)}}),xf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},Pf=yn,Df=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=xf(Af(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(To,a,n);return d(yo,t,go,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(yo,t,go,bo,M([da(f(Bf,o,u))]));case"TradeTableMsg":var s=e.a,c=f(Lf,s,t.tradeTable);return d(yo,D(t,{tradeTable:c.model}),f(Pf,Eo,c.cmd),f(Bo,Eo,c.chainCmd),f(xa,Ji(Eo),c.appCmds));default:return Co(t)}}),Uf={$:"BottomRight"},Of={$:"ShouldBeImpossible"},Mf=lr,Ff=function(e){return qi(e)},Vf=r(function(e,t){f(Mf,e,t);return{align:Uf,label:"unexpectedError",mainParagraphs:M([M([Ff(e)])]),noticeType:Of}}),Kf=function(e){var t=e.a;return Tf(t)},Hf=ye,jf=f(Io,Kf,Hf),qf=f(Io,vs,f(Io,Tf,Hf)),Gf=f(Io,wf,Hf),zf=f(Io,ps,f(Io,Tf,Hf)),Yf=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),Wf=un,Jf=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},Qf=function(e){return Jf(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(hc,Wf,r))},f(Yf,function(e){e.a;return!R(e.b,ci)},e)))},Xf=function(e){return Qf(M([L("to",f(Ao,jf,e.to)),L("from",f(Ao,jf,e.from)),L("gas",f(Ao,zf,e.gas)),L("gasPrice",f(Ao,qf,e.gasPrice)),L("value",f(Ao,qf,e.value)),L("data",f(Ao,Gf,e.data)),L("nonce",f(Ao,zf,e.nonce))]))},Zf=function(e){return{$:"TxSentry",a:e}},el=ye,tl=r(function(e,t){return Jf(M([L("ref",el(e)),L("txParams",t)]))}),rl=function(e){return{$:"Signing",a:e}},nl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:rl(e)}}),al={$:"Black"},il=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),ol={$:"RBEmpty_elm_builtin"},ul={$:"Red"},sl=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(il,ul,t,r,h(il,al,c,f,l,d),h(il,al,i,o,u,s))}return h(il,e,i,o,h(il,ul,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(il,ul,c,f,h(il,al,g,v,y,m),h(il,al,t,r,d,a))}return h(il,e,t,r,n,a)}),cl=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(il,ul,e,t,ol,ol);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Eu,e,a).$){case"LT":return h(sl,n,a,i,l(cl,e,t,o),u);case"EQ":return h(il,n,a,t,o,u);default:return h(sl,n,a,i,o,l(cl,e,t,u))}}),fl=n(function(e,t,r){var n=l(cl,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(il,al,a,i,o,u)}return n}),ll=n(function(e,t,r){var n=e.a,a=Xf(r),i=l(fl,n.ref,f(nl,r,t),n.txs);return L(Zf(D(n,{ref:n.ref+1,txs:i})),f(Pf,n.tagger,n.outPort(f(tl,n.ref,a))))}),dl=ll,hl=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,go,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(dl,n,i,o))}return x(ci,go,M([f(Vf,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),pl=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),gl=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),vl={$:"Seller"},yl=function(e){return{$:"Posix",a:e}},ml=yl,bl={autoabortInterval:ml(0),autorecallInterval:ml(0),autoreleaseInterval:ml(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:vl},Cl=function(e){return{$:"TokenValue",a:e}},El=function(e){return e.a},Sl=r(function(e,t){return f(hc,Gu,f(Ao,Qa,f(rs,e,t)))}),Tl=r(function(e,t){return Cl(f(Sl,El(e),wu(t)))}),wl=function(e){return f(Tl,e,12)},Il=function(e){return f(Tl,e,3)},Al=Cl(wu(0)),Bl=r(function(e,t){var r=Al;return{abortPunishment:wl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Il(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),kl=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Nl=qr,Rl=function(e){var t=kl(f(Nl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Ro(e)-1-r;return L(U(f(Po,r,e),f(_o,r+1,e)),n)},$l=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 yr}}),_l=function(e){var t=e.a,r=f($l,Ja(0),t);return Jo(r.b?t:yr)},Ll=Z,xl=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}}}),Pl=n(function(e,t,r){var n=f(xl,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(js,e,r),l(Pl,e,t,n)):yr}),Dl=r(function(e,t){return l(Pl,e,e,t)}),Ul=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Ao,ka(a),r)});return f(La,t,si(yr))}(Ua),Ol=function(e){return f(Ao,f(Da,_l,Jo),Ul(f(xa,f(Io,$a,f(Io,fs,Ll)),f(Dl,7,$a(e)))))},Ml=Q,Fl=function(e){var t=_s(Ml(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Ao,iu(vu),Ol(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Ao,iu(yu),Ol(r))}return ci;default:var r=t;return f(Ao,iu(yu),Ol(r))}},Vl=function(e){var t=function(e){return!f(ls,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(hc,0,kl(r)))}},Kl=function(e){return f(Hu,e,e)},Hl=wu(2),jl=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Ju;case"Neg":return nu;default:if(R(r,Ju))return f(Hu,e,t);if(Vl(r)){var n=e,a=Kl(t),i=f(Sl,r,Hl);e=n,t=a,r=i;continue e}var n=f(Hu,t,e),a=Kl(t),i=f(Sl,f(qu,r,Ju),Hl);e=n,t=a,r=i;continue e}}),ql=r(function(e,t){return l(jl,Ju,e,t)}),Gl=function(e){if(""===e)return ci;var t=Rl(e),r=t.a,n=t.b,a=Fl(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(Hu,o,f(ql,wu(10),wu(i)));return si(u)},zl=function(e){return f(Ao,Cl,Gl(e))},Yl=jr,Wl=function(e){for(;;){if(f(Yl,".",e))return l($o,0,-1,e);{if(!f(Yl,"0",e))return""===e?"0":e;e=l($o,0,-1,e)}}},Jl=f(Da,f(cs,7,P("0")),Ni),Ql=function(e){return f(Ri,"",e)},Xl=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Ql(f(ka,Ni(n),f(xa,Jl,a)))}return"0"},Zl=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Xl(t);default:var t=e.a;return"-"+Xl(t)}},ed=r(function(e,t){return e<1?t:l($o,0,-e,t)}),td=function(e){var t=l(cs,18,P("0"),Zl(e)),r=f(ed,18,t)+"."+f(Mo,18,t);return function(e){return""===e?"0":e}(Wl(r))},rd=r(function(e,t){var r=td(t),n=kl(f(Nl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Po,a+1+e,r):f(Po,a,r)}),nd=r(function(e,t){if("Nothing"===e.$)return td(El(t));var r=e.a;return f(rd,r,El(t))}),ad=ee,id=function(e){var t=ad(f(nd,ci,e));if("Just"===t.$){return t.a}f(Mf,"Error converting tokenValue to float: string -> float failed",e);return 0},od=function(e){if(""===e)return fi("You must specify a trade amount.");var t=zl(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return id(r)<1?fi("Trade amount can't be less than 1."):li(r)},ud=function(e){if(""===e)return fi("You must specify a fiat price.");var t=Fl(e);if("Nothing"===t.$){var r=ad(e);return fi("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 li(n)},sd=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),cd=function(e){return""===e},fd=function(e){return cd(e)?ci:si(e)},ld=function(e){return f(sd,"You must specify a fiat type.",fd(e))},dd=function(e){return""===e?fi("Must specify a payment method."):li(e)},hd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),pd=g(hd,ci,ci,ci,ci,ci,ci,ci),gd=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},vd=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),yd={$:"Custom"},md=r(function(e,t){return{info:t,type_:e}}),bd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Cd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),Ed=function(e){return e.a},Sd=function(e){return p(bd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(md,yd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Cd,function(e){return D(pd,{daiAmount:si(e)})},od(e.daiAmount)),f(Cd,function(e){return D(pd,{fiatAmount:si(e)})},ud(e.fiatAmount)),f(Cd,function(e){return D(pd,{fiatType:si(e)})},ld(e.fiatType)),f(Cd,function(e){return D(pd,{paymentMethod:si(e)})},dd(e.paymentMethod)),gd(d(vd,function(e){return Ed(e)>0?li(e):fi(D(pd,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return Ed(e)>0?li(e):fi(D(pd,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return Ed(e)>0?li(e):fi(D(pd,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Td=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},wd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Id=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Ad=function(e){var t=Sd(e.inputs),r=function(){return R(e.errors,pd)?pd:"Ok"===t.$?pd:t.a}();return D(e,{createParameters:l(wd,Bl,Td(e.wallet),Id(t)),errors:r})},Bd=r(function(e,t){return Ad(D(t,{inputs:e}))}),kd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Nd=function(e){return d(kd,f(Bd,bl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:pd,inputs:bl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),go,bo,yr)},Rd=a(function(e,t,r,n){return la(d(pl,e,t,r,n))}),$d=function(e){return{$:"Address",a:e}},_d=f(Io,Ko,f(Io,Ml,$d)),Ld=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return _d("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return _d("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return _d("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return _d("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return _d("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},xd=function(e){return _d("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},Pd=function(e){return{$:"AddressE",a:e}},Dd=Pd,Ud=function(e){return{$:"UintE",a:e}},Od=Ud,Md=n(function(e,t,r){return{data:si(f(If,"approve(address,uint256)",M([Dd(t),Od(r)]))),decoder:Wo(Fo),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Fd=function(e){return f(Tl,e,200)},Vd=r(function(e,t){return Cl(f($u,El(e),El(t)))}),Kd=function(e){var t=f(Tl,e.tradeAmount,200);return f(Vd,e.pokeReward,f(Vd,Fd(e.tradeAmount),f(Vd,t,function(){return"Buyer"===e.initiatorRole.$?Il(e.tradeAmount):e.tradeAmount}())))},Hd=Mi(ya),jd=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),qd=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),Gd=Xn,zd=Qn,Yd=function(e){return f(zd,{caseInsensitive:!1,multiline:!1},e)},Wd=Jn,Jd=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Qd=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}}),Xd=r(function(e,t){return!f(Qd,f(Da,Du,e),t)}),Zd=Xd(Ua),eh=q,th=r(function(e,t){if("Ok"===t.$){return t.a}return e}),rh=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),nh=f(La,rh(ka),li(yr)),ah=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},ih=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(su,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(su,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(su,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(su,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(su,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(su,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(su,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(su,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(su,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(su,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(su,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(su,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(su,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(su,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(su,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(is(s)+" is not a valid hexadecimal character.")}}}),oh=function(e){if(cd(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(Vo,"-",e)){var t=f(hc,yr,ah(_s(e)));return f(Uo,Oo,l(ih,Ti(t)-1,t,0))}return l(ih,Ro(e)-1,_s(e),0)}();return f(Cd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},uh=function(e){var t=_s(e);return function(e){return L(t,e)}(f(th,yr,nh(f(xa,oh,f(_i,"",f(Ri,"",f(xa,f(Io,ps,Fs),f(js,20,Ef(f(xa,f(Io,eh,yi),t))))))))))},sh=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=uh(Ko(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!Jd(e)&&Zd(o)},ch=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9a-f]{40}$"))),fh=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9A-F]{40}$"))),lh=function(e){return'"'+e+'"'},dh=function(e){var t=Ko(e),r=f(Po,24,t),n=f(Mo,40,e);return 64===Ro(t)&&f(ki,Ja(P("0")),r)?fh(n)||ch(n)?li($d(n)):sh(n)?li($d(n)):fi("Given address "+lh(e)+" failed the EIP-55 checksum test."):40!==Ro(t)?fi("Given address "+lh(e)+" is not the correct length."):Jd(t)?fh(t)||ch(t)?li($d(t)):sh(t)?li($d(t)):fi("Given address "+lh(e)+" failed the EIP-55 checksum test."):fi("Given address "+lh(e)+" contains invalid hex characters.")},hh=ko(function(e){var t=e.a,r=e.b;return f(Uo,f(xo,t,r),dh(Do(r)))}),ph=r(function(e,t){var r=t.a;return ko(function(t){var n=t.a,a=t.b;return r(f(No,n,f(_o,64*e,a)))})}),gh=Jr,vh=r(function(e,t){return f(gh,"data",Wo(f(ph,e,t)))}),yh=Qr,mh=r(function(e,t){return f(gh,"topics",f(yh,e,Wo(t)))}),bh=function(e){return f(Ao,f(Io,$a,f(Ra,r(function(e,t){return f($u,wu(e),f(Hu,t,ns))}),Gu)),Ul(f(xa,f(Io,$a,f(Io,fs,f(Io,oh,Id))),f(Dl,8,$a(e)))))},Ch=function(e){var t=_s(Ml(e));e:for(;;){if(!t.b)return ci;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(Ao,Hu(wu(-1)),bh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Ao,Hu(wu(-1)),bh(a))}return ci;case"+":if(t.b.b){var a=t.b;return bh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return bh(a)}t.b;return ci}break e;default:break e}}var a=t;return bh(a)},Eh=ko(function(e){var t=e.a,r=e.b;return f(Uo,f(xo,t,r),f(sd,"Error Decoding Uint into BigInt",Ch(Tf(Do(r)))))}),Sh=f(Hd,f(mh,1,hh),f(Hd,f(vh,1,hh),f(Hd,f(vh,0,Eh),Fi(jd)))),Th=nn,wh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Ih=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(Th,e,Jf(M([L("data",Hf(t.data)),L("topics",f(wh,Gf,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Ah=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Bh=r(function(e,t){return f(Uo,function(e){return e.id},f(Ah,function(e){return f(Cd,Di,f(Ih,Sh,e).returnData)},f(sd,"No log found from that factoryAddress in that txReceipt",kl(f(Yf,function(t){return R(f(Io,Kf,Ml)(t.address),f(Io,Kf,Ml)(Ld(e)))},t.logs)))))}),kh=n(function(e,t,r){return{data:si(f(If,"allowance(address,address)",M([Dd(t),Dd(r)]))),decoder:Wo(Eh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Nh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Rh=function(e){switch(e.$){case"BlockNum":var t=e.a;return Hf(Tf(ps(t)));case"EarliestBlock":return Hf("earliest");case"LatestBlock":return Hf("latest");default:return Hf("pending")}},$h=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return Qf(M([L("to",f(Ao,jf,t)),L("from",f(Ao,jf,r)),L("gas",f(Ao,zf,n)),L("gasPrice",f(Ao,qf,a)),L("value",f(Ao,qf,i)),L("data",f(Ao,Gf,o))]))},_h=function(e){return{$:"BadBody",a:e}},Lh=function(e){return{$:"BadStatus",a:e}},xh=function(e){return{$:"BadUrl",a:e}},Ph={$:"NetworkError"},Dh={$:"Timeout"},Uh=rn,Oh=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(xh(r));case"Timeout_":return fi(Dh);case"NetworkError_":return fi(Ph);case"BadStatus_":var n=t.a,a=t.b;return fi(Lh(n.statusCode));default:var n=t.a,a=t.b,i=f(Uh,f(gh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(_h(Di(u)))}}),Mh=n(function(e,t,r){return Jf(M([L("id",el(e)),L("jsonrpc",Hf("2.0")),L("method",Hf(t)),L("params",f(wh,Ua,r))]))}),Fh=ol,Vh=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Eu,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),Kh=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},Hh=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(il,ul,p,g,h(il,al,r,n,h(il,ul,i,o,u,s),v),h(il,al,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(il,al,r,n,h(il,ul,i,o,u,s),h(il,ul,f,l,d,m))}return e},jh=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(il,ul,i,o,h(il,al,s,c,f,l),h(il,al,r,n,d,h(il,ul,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(il,al,r,n,h(il,ul,i,o,C,d),h(il,ul,g,v,y,m))}return e},qh=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(il,r,u,s,c,h(il,ul,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 jh(t)}break e}o.a,o.d;return jh(t)}break e}return t}),Gh=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(il,t,r,n,Gh(a),u)}var s=Hh(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(sl,c,f,l,Gh(d),p)}return ol}return h(il,t,r,n,Gh(a),u)}return ol},zh=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return ol;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(il,r,n,a,f(zh,e,i),o)}var s=Hh(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(sl,c,l,d,f(zh,e,p),v)}return ol}return h(il,r,n,a,f(zh,e,i),o)}return f(Yh,e,g(qh,e,t,r,n,a,i,o))}),Yh=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(R(e,n)){var u=Kh(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(sl,r,s,c,i,Gh(o))}return ol}return h(sl,r,n,a,i,f(zh,e,o))}return ol}),Wh=r(function(e,t){var r=f(zh,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(il,al,n,a,i,o)}return r}),Jh=n(function(e,t,r){var n=t(f(Vh,e,r));if("Just"===n.$){var a=n.a;return l(fl,e,a,r)}return f(Wh,e,r)}),Qh=function(e){return"Just"===e.$},Xh=gn,Zh=vn,ep=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),tp=function(e){return{$:"BadUrl_",a:e}},rp=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),np={$:"NetworkError_"},ap=function(e){return{$:"Receiving",a:e}},ip=function(e){return{$:"Sending",a:e}},op={$:"Timeout_"},up=function(e){return f(ta,"application/json",f(xi,0,e))},sp=n(function(e,t,r){return up(l(Mh,e,t,r))}),cp=f(ea,"",Ua),fp=Te,lp=Se,dp=function(e){if("Ok"===e.$){var t=e.a;return lp(t)}var r=e.a;return fp(r)},hp=function(e){return l(Zn,gr,dp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},pp=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return hp({body:l(sp,1,r,n),headers:yr,method:"POST",resolver:cp(Oh(a)),timeout:ci,url:t})},gp=n(function(e,t,r){return pp({decoder:t.decoder,method:"eth_call",params:M([$h(t),Rh(r)]),url:e})}),vp={$:"LatestBlock"},yp=r(function(e,t){return l(gp,e,t,vp)}),mp=function(e){return{$:"Perform",a:e}},bp=sn,Cp=lp(gr),Ep=r(function(e,t){return f(bp,function(t){return lp(e(t))},t)}),Sp=n(function(e,t,r){return f(bp,function(t){return f(bp,function(r){return lp(f(e,t,r))},r)},t)}),Tp=function(e){return l(La,Sp(ka),lp(yr),e)},wp=r(function(e,t){var r=t.a;return Be(f(bp,Xh(e),r))}),Ip=n(function(e,t,r){return f(Ep,function(e){return gr},Tp(f(xa,wp(e),t)))}),Ap=n(function(e,t,r){return lp(gr)}),Bp=r(function(e,t){var r=t.a;return mp(f(Ep,e,r))});pn.Task=Pe(Cp,Ip,Ap,Bp);var kp=Ue("Task"),Np=cn,Rp=r(function(e,t){return kp(mp(f(Np,f(Da,f(Da,lp,e),fi),f(bp,f(Da,f(Da,lp,e),li),t))))}),$p=a(function(e,t,r,n){return f(Rp,n,f(yp,Nh(eo(e)),l(kh,xd(e),t,r)))}),_p=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return _d("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return _d("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return _d("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return _d("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return _d("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Lp=function(e){return{$:"BoolE",a:e}},xp=Lp,Pp=function(e){return{$:"StringE",a:e}},Dp=Pp,Up=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:si(f(If,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([Dd(t),Dd(r),xp(n),Od(a),Od(i),Od(o),Od(u),Od(s),Od(c),Od(l),Od(d),Dp(h),Dp(p)]))),decoder:Wo(hh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},Op=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:si(f(If,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([Dd(t),Dd(r),xp(n),Od(a),Od(i),Od(o),Od(u),Od(s),Od(c),Od(l),Od(d),Dp(h),Dp(p)]))),decoder:Wo(hh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},Mp=r(function(e,t){return{paymentMethods:t,price:e}}),Fp=function(e){return Hf(Zl(e))},Vp=function(e){return f(wh,Ua,M([Hf(e.fiatType),Fp(e.amount)]))},Kp=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},Hp=function(e){return Jf(M([L("type",Hf(Kp(e.type_))),L("info",Hf(e.info))]))},jp=function(e){var t=Vp(e.price),r=f(wh,Hp,e.paymentMethods);return f(xi,0,Jf(M([L("paymentmethods",r),L("price",t)])))},qp=r(function(e,t){return D(t,{value:si(e)})}),Gp=function(e){return wu(Ed(e))},zp=function(e){return f(Sl,Gp(e),wu(1e3))},Yp=r(function(e,t){var r=function(){return"Token"===e.$?Up:Op}();return function(){return"Native"===e.$?qp(El(Kd(t))):Ua}()(r(Ld(e))(t.initiatorAddress)(_p(e))(R(t.initiatorRole,vl))(El(t.tradeAmount))(El(Il(t.tradeAmount)))(El(wl(t.tradeAmount)))(El(t.pokeReward))(zp(t.autorecallInterval))(zp(t.autoabortInterval))(zp(t.autoreleaseInterval))(El(Fd(t.tradeAmount)))(jp(f(Mp,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Wp=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),Jp=function(e){return{$:"CreateNeedsSig",a:e}},Qp=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Xp=r(function(e,t){var r=xf(f(Yp,e,t)),n={onBroadcast:ci,onMined:si(L(Wp(e),ci)),onSign:si(Qp(e))};return L(si(Jp(e)),f(To,n,r))}),Zp=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),eg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),tg=function(e){return{$:"ApproveNeedsSig",a:e}},rg=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),ng=r(function(e,t){return{$:"Confirm",a:e,b:t}}),ag=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),ig={$:"NoOp"},og=function(e){return{appCmds:yr,chainCmd:bo,cmd:go,model:e}},ug=function(e){return Ll(Zl(e))},sg={$:"Error"},cg=r(function(e,t){f(Mf,e+" fetch error",t);return{align:Uf,label:"web3FetchError",mainParagraphs:M([M([Ff('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:sg}}),fg=r(function(e,t){return{align:Uf,label:"web3MiningError",mainParagraphs:M([M([Ff('Error mining "'+e+'" transaction: '+t)])]),noticeType:sg}}),lg={$:"Caution"},dg=r(function(e,t){return{align:Uf,label:"web3SigError",mainParagraphs:M([M([Ff('Error signing "'+e+'" transaction: '+t)])]),noticeType:lg}}),hg={$:"KovanDai"},pg=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(hg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},gg=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},vg=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),yg=function(e){return f(vg,pg,gg(e))},mg=r(function(e,t){return 1-e(1-t)}),bg=function(e){return f(su,e,5)},Cg=mg(bg),Eg={easing:Cg,offset:12,speed:200},Sg=function(e){return{$:"External",a:e}},Tg=function(e){return{$:"Internal",a:e}},wg=function(e){return{$:"NotFound",a:e}},Ig=function(e){for(;;){e=e.a}},Ag=r(function(e,t){return kp(mp(f(Ep,e,t)))}),Bg={$:"Http"},kg={$:"Https"},Ng=Kr,Rg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),$g=i(function(e,t,r,n,a){if(cd(a)||f(Ng,"@",a))return ci;var i=f(Nl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=Ll(f(_o,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Rg,e,f(Po,o,a),s,t,r,n))}return si(p(Rg,e,a,ci,t,r,n))}),_g=a(function(e,t,r,n){if(cd(n))return ci;var a=f(Nl,"/",n);if(a.b){var i=a.a;return h($g,e,f(_o,i,n),t,r,f(Po,i,n))}return h($g,e,"/",t,r,n)}),Lg=n(function(e,t,r){if(cd(r))return ci;var n=f(Nl,"?",r);if(n.b){var a=n.a;return d(_g,e,si(f(_o,a+1,r)),t,f(Po,a,r))}return d(_g,e,ci,t,r)}),xg=r(function(e,t){if(cd(t))return ci;var r=f(Nl,"#",t);if(r.b){var n=r.a;return l(Lg,e,si(f(_o,n+1,t)),f(Po,n,t))}return l(Lg,e,ci,t)}),Pg=function(e){return f(Vo,"http://",e)?f(xg,Bg,f(_o,7,e)):f(Vo,"https://",e)?f(xg,kg,f(_o,8,e)):ci},Dg=Wt,Ug=Gt(zt),Og=sa,Mg=r(function(e,t){return L(e,t)}),Fg=_r,Vg=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=Tu(r-n),o=f(ei,1,Fg(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),Kg=r(function(e,t){var n=r(function(t,r){return Tp(f(xa,Og(0),d(Vg,e.speed,e.easing,t,r-e.offset)))});return f(bp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(Sp,Mg,Ug,Dg(t)))}),Hg=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Td(t.wallet),yg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d($p,a,n.address,Ld(eo(a)),Zp(a));return d(kd,t,i,bo,yr)}return og(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(kd,D(t,{inputs:D(u,{userRole:o})}),go,bo,M([function(){return"Buyer"===o.$?d(Rd,"create offer type changed","input","sell dai",0):d(Rd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return og(f(Bd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return og(f(Bd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return og(f(Bd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return og(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return og(f(Bd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return og(f(Bd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return og(f(Bd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return og(f(Bd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(kd,(g?Bd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),go,bo,g?M([d(Rd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=Sd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Bl,n,m);return og(D(t,{depositAmount:si(El(Kd(b))),txChainStatus:si(f(ng,v,b))}))}var C=y.a;return d(kd,D(t,{errors:C}),f(Rp,Qu(ig),function(){return f(Kg,D(Eg,{offset:60}),"inputError")}()),bo,yr);case"AbortCreate":return d(kd,D(t,{txChainStatus:ci}),go,bo,M([d(Rd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Xp,v,b);var e=v.a,r=function(){var t=xf(l(Md,xd(e),Ld(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(rg,e,b))};return f(To,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(xu,a,E),ba)?L(si(tg(e)),r):f(Xp,v,b)}return L(si(tg(e)),r)}(),T=S.a,w=S.b;return d(kd,D(t,{txChainStatus:T}),go,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return og(D(t,{txChainStatus:si(l(eg,a,b,A))}))}var B=I.a;return d(kd,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(xu,N,P),ba))return og($);var U=f(Xp,eo(a),b),T=U.a,w=U.b;return d(kd,D($,{txChainStatus:T}),go,w,yr)}return og($)}var O=k.a;return d(kd,t,go,bo,M([pa(f(cg,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return og(D(t,{txChainStatus:si(f(ag,v,A))}))}var B=I.a;return d(kd,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(kd,t,go,bo,M([pa(f(fg,"create",B))]))}var F=e.a,V=e.b.a,K=f(vg,ug,Id(f(Bh,F,V)));if("Just"===K.$){var H=K.a;return d(kd,t,go,bo,M([da(f(Bf,F,H))]))}return d(kd,t,go,bo,M([pa(f(Vf,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(kd,t,go,bo,M([ga]));case"NoOp":return og(t);default:var j=e.a;return d(kd,t,go,bo,M([j]))}}),jg={$:"Open"},qg=r(function(e,t){return f(Eu,Ed(e),Ed(t))}),Gg=r(function(e,t){return R(t.state.phase,jg)&&R(f(qg,t.derived.phaseEndTime,e),Ta)}),zg={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Yg=r(function(e,t){return{maxDai:t,minDai:e}}),Wg=f(Yg,ci,ci),Jg={$:"Expires"},Qg=function(e){return L({errors:Wg,filterFunc:Gg,inputs:zg,showCurrencyDropdown:!1,tradeTable:fo(L(Jg,lo)),wallet:e},go)},Xg=r(function(e,t){return D(t,{paymentMethod:e})}),Zg=r(function(e,t){return D(t,{paymentMethodTerms:e})}),ev=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return D(e,{inputs:f(Zg,r,f(Xg,"",e.inputs))})},tv=r(function(e,t){var r=f(Yf,nc(e),t.inputs.paymentMethodTerms);return D(t,{inputs:f(Zg,r,t.inputs)})}),rv=function(e){return D(e,{filterFunc:Gg,inputs:zg})},nv=function(e){return{$:"TradeTableMsg",a:e}},av=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),iv=function(e){return d(av,e,go,bo,yr)},ov=r(function(e,t){return D(t,{fiatType:e})}),uv=r(function(e,t){return D(t,{maxDai:e})}),sv=r(function(e,t){return D(t,{minDai:e})}),cv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return iv(D(t,{inputs:f(sv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return iv(D(t,{inputs:f(uv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return iv(D(t,{inputs:f(ov,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return iv(D(t,{inputs:(n?ov(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return iv(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return iv(D(t,{inputs:f(Xg,r,t.inputs)}));case"AddSearchTerm":return iv(ev(t));case"RemoveTerm":var a=e.a;return iv(f(tv,a,t));case"ResetSearch":return iv(rv(t));case"TradeTableMsg":var i=e.a,o=f(Lf,i,t.tradeTable);return d(av,D(t,{tradeTable:o.model}),f(Pf,nv,o.cmd),f(Bo,nv,o.chainCmd),f(xa,Ji(nv),o.appCmds));case"NoOp":return iv(t);default:var u=e.a;return d(av,t,go,bo,M([u]))}}),fv=a(function(e,t,r,n){return e(Jf(M([L("title",Hf(t)),L("body",function(){if("Nothing"===r.$)return Wf;var e=r.a;return Hf(e)}()),L("image",function(){if("Nothing"===n.$)return Wf;var e=n.a;return Hf(e)}())])))}),lv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},dv=function(e){return e.a+"="+e.b},hv=function(e){return e.b?"?"+f(Ri,"&",f(xa,dv,e)):""},pv=r(function(e,t){return"/"+(f(Ri,"/",e)+hv(t))}),gv=function(e){switch(e.$){case"Home":return f(pv,M(["DAIHard"]),yr);case"Create":return f(pv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(pv,M(["DAIHard","trade",lv(t),Ni(r)]),yr);case"Marketplace":return f(pv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(pv,M(["DAIHard","history",Kf(n)]),yr);default:return f(pv,yr,yr)}},vv={$:"NotFound"},yv=function(e){return{$:"AgentHistory",a:e}},mv={$:"Create"},bv={$:"Home"},Cv={$:"Marketplace"},Ev=function(e){return{$:"Parser",a:e}},Sv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Tv=r(function(e,t){return Ev(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Sv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),wv=f(Tv,"ADDRESS",f(Io,dh,Id)),Iv={$:"Eth"},Av={$:"Kovan"},Bv=f(Tv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Iv));case"keth":return si(Zi(Av));case"dai":return si(eo(Xi));case"kdai":return si(eo(hg));case"xdai":return si(Zi(to));default:return ci}}),kv=f(Tv,"NUMBER",Ll),Nv=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Sv,r,n,a,i,e(o))}),Rv=r(function(e,t){var r=t.a;return Ev(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,Nv(u),r(h(Sv,n,a,i,o,e)))})}),$v=function(e){return l(La,oo,yr,e)},_v=r(function(e,t){return $v(f(xa,e,t))}),Lv=function(e){return Ev(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 R(u,e)?M([h(Sv,f(ka,u,r),s,a,i,o)]):yr}return yr})},xv=r(function(e,t){var r=e.a,n=t.a;return Ev(function(e){return f(_v,n,r(e))})}),Pv=Ev(function(e){return M([e])}),Dv=f(xv,Lv("DAIHard"),function(e){return Ev(function(t){return f(_v,function(e){return(0,e.a)(t)},e)})}(M([f(Rv,bv,Pv),f(Rv,mv,Lv("create")),f(Rv,Bf,f(xv,Lv("trade"),f(xv,Bv,kv))),f(Rv,Cv,Lv("marketplace")),f(Rv,yv,f(xv,Lv("history"),wv)),f(Rv,function(e){return yv(e)},f(xv,Lv("history"),wv))]))),Uv=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 si(t.value)}return si(t.value)}return ci}},Ov=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,Ov(r))}return yr}return yr},Mv=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return Ov(r)}var r=t;return Ov(r)},Fv=Qt,Vv=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),Kv=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=Fv(n);if("Nothing"===o.$)return t;var u=o.a,s=Fv(i);if("Nothing"===s.$)return t;var c=s.a;return l(Jh,u,Vv(c),t)}return t}),Hv=function(e){if("Nothing"===e.$)return Fh;var t=e.a;return l(La,Kv,Fh,f(_i,"&",t))},jv=r(function(e,t){var r=e.a;return Uv(r(h(Sv,yr,Mv(t.path),Hv(t.query),t.fragment,Ua)))}),qv=function(e){return f(hc,vv,f(jv,Dv,e))},Gv=aa,zv=r(function(e,t){return f(Gv,e,gv(t))}),Yv=je("connectToWeb3",function(e){return Wf}),Wv=function(e){return Jf(M([L("event",Hf(e.event)),L("category",Hf(e.category)),L("label",Hf(e.label)),L("value",el(e.value))]))},Jv=r(function(e,t){return Jf(M([L("address",Hf(Kf(e))),L("signSeedMsg",Hf(t))]))}),Qv=je("gTagOut",Ua),Xv=je("genPrivkey",Ua),Zv=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),ey=n(function(e,t,r){return f(vg,_c(t),f(Ao,function(e){return e.trades},f(Zv,function(t){return R(t.factory,e)},r)))}),ty=je("notifyPort",Ua),ry=je("requestNotifyPermissionPort",function(e){return Wf}),ny=r(function(e,t){return D(t,{wallet:e})}),ay=r(function(e,t){return L(f(Bd,t.inputs,D(t,{wallet:e})),function(){var t=L(Td(e),yg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d($p,n,r.address,Ld(eo(n)),Zp(n))}return go}())}),iy=r(function(e,t){return D(t,{wallet:e})}),oy=function(e){return{$:"AllowanceFetched",a:e}},uy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Td(e),yg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(yg(e),si(i.factory))?d($p,a,n.address,i.creationInfo.address,oy):go}return go}())}),sy=function(e){return{$:"AgentHistoryModel",a:e}},cy=function(e){return{$:"CreateModel",a:e}},fy=function(e){return{$:"CreateMsg",a:e}},ly=function(e){return{$:"MarketplaceModel",a:e}},dy=function(e){return{$:"TradeModel",a:e}},hy=function(e){return{$:"TradeMsg",a:e}},py=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,go);case"CreateModel":var r=t.a,n=f(ay,e,r),a=n.a,i=n.b;return L(cy(a),f(Pf,fy,i));case"TradeModel":var o=t.a,u=f(uy,e,o),s=u.a,c=u.b;return L(dy(s),f(Pf,hy,c));case"MarketplaceModel":var l=t.a;return L(ly(f(iy,e,l)),go);default:var d=t.a;return L(sy(f(ny,e,d)),go)}}),gy=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),vy=function(e){return{$:"PartiallyLoadedTrade",a:e}},yy=r(function(e,t){return vy(g(gy,e,t,ci,ci,ci,ci,ci))}),my=function(e){return{$:"CurrentBlockFetched",a:e}},by=Yo(f(Io,Ko,oh)),Cy=function(e){return pp({decoder:by,method:"eth_blockNumber",params:yr,url:e})},Ey=function(e){return f(Rp,my,Cy(e))},Sy=r(function(e,t){return{address_:e,blocknum:t}}),Ty=function(e){return ko(function(t){return li(L(t,e))})},wy=n(function(e,t,r){var n=t.a,a=r.a;return ko(function(t){return f(Ah,function(t){var r=t.a,n=t.b;return f(Uo,_f(e(n)),a(r))},n(t))})}),Iy=r(function(e,t){return l(wy,r(function(e,t){return e(t)}),t,e)}),Ay=Wo(f(Iy,Eh,f(Iy,hh,Ty(Sy)))),By=r(function(e,t){return{data:si(f(If,"createdTrades(uint256)",M([Od(t)]))),decoder:Ay,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ky=n(function(e,t,r){return f(Rp,r,f(yp,Nh(e),f(By,Ld(e),t)))}),Ny=function(e){return{$:"CreationInfoFetched",a:e}},Ry=r(function(e,t){return l(ky,e,wu(t),Ny)}),$y=function(e){return{$:"EventSentryMsg",a:e}},_y=function(e){return{$:"BlockNumber",a:e}},Ly=function(e){return{$:"EventSentry",a:e}},xy=function(e){return{$:"Set_elm_builtin",a:e}},Py=xy(Fh),Dy=r(function(e,t){return L(Ly({blockNumber:ci,errors:yr,nodePath:t,pending:Py,ref:1,requests:Fh,tagger:e,watching:Py}),f(Rp,f(Io,_y,e),Cy(t)))}),Uy=function(e){return f(Dy,$y,Nh(e))},Oy=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),My=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},Fy=My(f(Oy,ci,ci)),Vy=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:jg,secureCommInfo:Fy,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),Ky=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Hy=n(function(e,t,r){var n=f(Ry,t,r),a=Uy(t),i=a.a,o=a.b;return d(Ky,l(Vy,f(yy,t,r),i,e),po(M([n,o,Ey(Nh(t))])),bo,M([ha]))}),jy=function(e){return{$:"LoadedTrade",a:e}},qy=r(function(e,t){var r=Uy(t.factory),n=r.a,a=r.b;return d(Ky,l(Vy,jy(t),n,e),po(M([a,Ey(Nh(t.factory))])),bo,M([ha]))}),Gy=function(e){return{data:si(f(If,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},zy=function(e){return{data:si(f(If,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yy=function(e){return{data:si(f(If,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Wy=r(function(e,t){return{data:si(f(If,"initiatorStatement(string)",M([Dp(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Jy=function(e){return{data:si(f(If,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Qy=function(e){return{data:si(f(If,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Xy=r(function(e,t){return{data:si(f(If,"responderStatement(string)",M([Dp(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Zy=r(function(e,t){return{amount:t,fiatType:e}}),em=f(qo,function(e){var t=Fl(e);if("Just"===t.$){var r=t.a;return Fi(r)}return Go("Can't convert that to a BigInt")},zo),tm=l(Mi,Zy,f(yh,0,zo),f(yh,1,em)),rm={$:"Bank"},nm={$:"Cash"},am=function(e){switch(e){case"cash":return si(nm);case"bank":return si(rm);case"custom":return si(yd);default:return ci}},im=f(qo,function(e){var t=am(e);if("Just"===t.$){var r=t.a;return Fi(r)}return Go("")},zo),om=l(Mi,md,f(gh,"type",im),f(gh,"info",zo)),um=oe,sm=function(e){var t=l(Mi,Mp,f(gh,"price",tm),f(gh,"paymentmethods",um(om)));return f(Uh,t,e)},cm=r(function(e,t){return{commPubkey:t,responder:e}}),fm=r(function(e,t){var n=r(function(t,r){return l($o,t,t+2*r,e)}),a=f(Io,oh,Uo(ti(2)));return f(Ah,function(t){return f(Uo,function(e){return f(n,t+64,e)},oh(l($o,t,t+64,e)))},a(t))}),lm=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),dm=n(function(e,t,r){var n=l(Ra,lm(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),hm=j,pm=function(e){return is(hm(e))},gm=function(e){return l(dm,r(function(e,t){return U(t,pm(e))}),"",e)},vm=ko(function(e){var t=e.a,r=e.b;return f(Uo,f(xo,t,r),f(Ah,gm,f(Ah,f(Io,xa(oh),nh),f(Uo,Yf(f(Io,cd,Du)),f(Uo,xs(2),f(fm,t,Do(r)))))))}),ym=f(Hd,f(vh,1,vm),f(Hd,f(vh,0,hh),Fi(cm))),mm=r(function(e,t){return{commPubkey:t,terms:e}}),bm=f(Hd,f(vh,1,vm),f(Hd,f(vh,0,vm),Fi(mm))),Cm=function(e){return{statement:e}},Em=f(Hd,f(vh,0,vm),Fi(Cm)),Sm=function(e){return{statement:e}},Tm=f(Hd,f(vh,0,vm),Fi(Sm)),wm={$:"AbortedEvent"},Im={$:"BurnedEvent"},Am={$:"ClaimedEvent"},Bm=function(e){return{$:"CommittedEvent",a:e}},km=function(e){return{$:"InitiatedEvent",a:e}},Nm=function(e){return{$:"InitiatorStatementLogEvent",a:e}},Rm={$:"PokeEvent"},$m={$:"RecalledEvent"},_m={$:"ReleasedEvent"},Lm=function(e){return{$:"ResponderStatementLogEvent",a:e}},xm=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9a-fA-F]+$"))),Pm=function(e){return xm(e)?li(Ds(Ko(e))):fi("Something in here is not very hexy: "+lh(e))},Dm=Yo(Pm),Um=f(gh,"topics",f(yh,0,Dm)),Om=function(e){return Ds(f(Ri,"",f(xa,f(Io,ps,Fs),Ef(f(xa,yi,_s(e))))))},Mm=f(qo,function(e){return R(e,Om("Initiated(string,string)"))?f(Oi,km,bm):R(e,Om("Committed(address,string)"))?f(Oi,Bm,ym):R(e,Om("Recalled()"))?Fi($m):R(e,Om("Claimed()"))?Fi(Am):R(e,Om("Aborted()"))?Fi(wm):R(e,Om("Released()"))?Fi(_m):R(e,Om("Burned()"))?Fi(Im):R(e,Om("InitiatorStatementLog(string)"))?f(Oi,Nm,Em):R(e,Om("ResponderStatementLog(string)"))?f(Oi,Lm,Tm):R(e,Om("Poke()"))?Fi(Rm):Go("Unrecognized topic hash")},Um),Fm={$:"Initiator"},Vm={$:"Responder"},Km=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(Fm):f(vg,function(e){return R(t,e)?si(Vm):ci},e.state.responder)}),Hm=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},jm=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},qm=function(e){return R(e.buyerDeposit,Il(e.tradeAmount))&&R(e.abortPunishment,wl(e.tradeAmount))},Gm={$:"Invalid"},zm=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Ym=r(function(e,t){return ml(Ed(t)+Ed(e))}),Wm=function(e){var t=ad(Zl(e.amount));if("Just"===t.$){return t.a}f(Mf,"Error converting FiatValue to float--string -> float failed!",e);return 0},Jm=r(function(e,t){return(t-e)/e}),Qm=r(function(e,t){var r=Wm(t),n=id(e);return"USD"===t.fiatType?si(f(Jm,n,r)):ci}),Xm=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 ml(0)}}();return{margin:f(Qm,e.tradeAmount,r.price),phaseEndTime:f(Ym,t.phaseStartTime,n)}}),Zm=function(e){var t=x(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 jy(v(zm,e.factory,e.id,n,a,o,u,s,l(Xm,a,o,u)))}return vy(e)},eb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(Mf,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Gm}}),tb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(Mf,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Gm}}),rb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(Mf,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Gm}}),nb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return jy(D(n,{state:e}));default:return Gm}}),ab=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(Mf,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Gm}}),ib=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}}),ob=Wo(f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Fo,f(Iy,hh,Ty(ib))))))))))),ub=function(e){return{data:si(f(If,"getParameters()",yr)),decoder:ob,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},sb={$:"Buyer"},cb=function(e){return f(Ao,function(e){return ml(1e3*e)},Ll(Zl(e)))},fb=function(e){return Cl(e)},lb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),db=function(e){var t=f(sd,"error converting BigInt to Time.Posix",cb(e.autoabortInterval)),r=f(sd,"error converting BigInt to Time.Posix",cb(e.autoreleaseInterval)),a=f(sd,"error converting BigInt to Time.Posix",cb(e.autorecallInterval));return d(lb,n(function(t,r,n){return{abortPunishment:fb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:fb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?vl:sb,pokeReward:fb(e.pokeReward),tradeAmount:fb(e.tradeAmount)}}),a,t,r)},hb=n(function(e,t,r){return f(Rp,r,f(Ep,db,f(yp,Nh(e),ub(t))))}),pb=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}}}}}}}}}}},gb=Wo(f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,Ty(pb)))))))))))),vb=function(e){return{data:si(f(If,"getPhaseStartInfo()",yr)),decoder:gb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},yb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),mb=function(e){return h(yb,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}}),cb(e.v6),cb(e.v7),cb(e.v8),cb(e.v9))},bb=n(function(e,t,r){return f(Rp,r,f(Ep,mb,f(yp,Nh(e),vb(t))))}),Cb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Eb=Wo(f(Iy,Eh,f(Iy,hh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,Ty(Cb))))))),Sb=function(e){return{data:si(f(If,"getState()",yr)),decoder:Eb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Tb={$:"Aborted"},wb={$:"Burned"},Ib={$:"NotClosed"},Ab={$:"Recalled"},Bb={$:"Released"},kb=function(e){switch(f(hc,99,Ll(Zl(e)))){case 0:return si(Ib);case 1:return si(Ab);case 2:return si(Tb);case 3:return si(Bb);case 4:return si(wb);default:return ci}},Nb={$:"Closed"},Rb={$:"Committed"},$b={$:"Judgment"},_b=function(e){switch(f(hc,99,Ll(Zl(e)))){case 1:return si(jg);case 2:return si(Rb);case 3:return si($b);case 4:return si(Nb);default:return ci}},Lb=function(e){return R(e,_d("0x0000000000000000000000000000000000000000"))?ci:si(e)},xb=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),Pb=function(e){var t=cb(e.phaseStartTimestamp),r=_b(e.phase),a=kb(e.closedReason);return d(xb,n(function(t,r,n){return{balance:fb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:Lb(e.responder)}}),r,t,a)},Db=n(function(e,t,r){return f(Rp,r,f(Ep,Pb,f(yp,Nh(e),Sb(t))))}),Ub=i(function(e,t,r,n,a){return po(M([l(hb,e,t,r),l(Db,e,t,n),l(bb,e,t,a)]))}),Ob=function(e){var t=ug(e);if("Just"===t.$){return t.a}f(Mf,"Warning! BigInt to Int conversion failed!",Zl(e));return 0},Mb=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),Fb=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),Vb=function(e){return e.b?l(Fb,e,yr,0):qa},Kb=tn,Hb=function(e){var t=h(Kb,Mb,f(gh,"encapsulation",zo),f(gh,"iv",zo),f(gh,"tag",zo),f(gh,"encrypted",zo)),r=um(t),n=f(Th,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(_c,0,e),f(_c,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(Vb(i))},jb=function(e){var t=function(e){var t=Ro(e);return t>1114111?fi("string is too long"):li(f(as,hm(t),e))};return f(Uo,Ri(""),nh(f(xa,t,e)))},qb=function(e){var t=e.a,r=e.b;return jb(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},Gb=r(function(e,t){return Jf(M([L("message",Hf(e)),L("pubkeyHexStrings",f(wh,Hf,M([t.initiatorPubkey,t.responderPubkey])))]))}),zb=function(e){return{$:"LoadedCommInfo",a:e}},Yb=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),Wb=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 zb(f(Yb,r,n))}return My(e)},Jb=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return Wb(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return zb(D(n,{initiatorPubkey:e}))}),Qb=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return Wb(D(r,{responderPubkey:si(e)}))}var n=t.a;return zb(D(n,{responderPubkey:e}))}),Xb=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return sb}r.a,r.b;return vl}if("Buyer"===r.b.$){r.a,r.b;return vl}r.a,r.b;return sb}),Zb=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(xl,a,n),o=fs(f(js,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),eC=function(e){var t=Vb(f(Zb,_s(e),yr));return l(wd,Mg,h(yb,Mb,f(_c,0,t),f(_c,1,t),f(_c,2,t),f(_c,3,t)),h(yb,Mb,f(_c,4,t),f(_c,5,t),f(_c,6,t),f(_c,7,t)))},tC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),rC={$:"Aborted"},nC={$:"Burned"},aC={$:"Claimed"},iC=function(e){return{$:"Committed",a:e}},oC=function(e){return{$:"Encrypted",a:e}},uC={$:"FailedDecode"},sC={$:"Initiated"},cC={$:"Recalled"},fC={$:"Released"},lC=function(e){return{$:"StateChange",a:e}},dC=function(e){return{$:"Statement",a:e}},hC=fr,pC=cr,gC=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(hC,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(pC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),vC=or,yC=y,mC=a(function(e,t,r,n){var a=kc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(vC,Ga(r),n);var i=za(d(mC,e-Ha,t,r,ja));return f(vC,i,n)}var o=f(Nc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(mC,e-Ha,t,r,u));return l(Pc,a,i,n)}var i=za(d(mC,e-Ha,t,r,yC(o)));return l(Pc,a,i,n)}),bC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(mC,c,r,e,yC(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(mC,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),CC=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(hC,32,r,e),o=f(bC,i,t);if(a<0){var u=l(pC,a,n,e);return f(bC,u,o)}return o}),EC=ur,SC=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(EC,i,t,r)}return f(ka,e,t)});return{nodeList:l(EC,i,yr,n),nodeListSize:t/32|0,tail:a}},TC=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(EC,o,t,r)}var n=e.a;return f(CC,n,t)});return f(CC,i,l(EC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(EC,o,t,r)}var n=e.a;return f(gC,n,t)});return f(ai,!0,f(gC,i,l(EC,o,SC(e),a)))}),wC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),IC=f(La,wC,yr),AC=n(function(e,t,r){var n=Xb(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(lC(sC));case"CommittedEvent":var r=t.a;return si(lC(iC(r.responder)));case"RecalledEvent":return si(lC(cC));case"ClaimedEvent":return si(lC(aC));case"AbortedEvent":return si(lC(rC));case"ReleasedEvent":return si(lC(fC));case"BurnedEvent":return si(lC(nC));case"InitiatorStatementLogEvent":var r=t.a;return si(dC({blocknum:e,message:function(){var e=eC(r.statement);if("Just"===e.$){var t=e.a;return oC(t)}return uC}(),who:n(Fm)}));case"ResponderStatementLogEvent":var r=t.a;return si(dC({blocknum:e,message:function(){var e=eC(r.statement);if("Just"===e.$){var t=e.a;return oC(t)}return uC}(),who:n(Vm)}));default:return ci}}(),i=f(Ao,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(TC,r.history,Vb(IC(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Ao,tC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),IC(M([s])))}),BC=Gr,kC=function(e){var t=l(Mi,Mg,f(gh,"id",BC),f(gh,"message",zo));return f(Cd,Di,f(Th,t,e))},NC=function(e){return{$:"Decrypted",a:e}},RC=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),$C=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(AC,n,a,t),o=i.a,u=i.b,s=i.c;return d(RC,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(RC,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(RC,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=kC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(_c,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:NC(y)}),T=D(b,{eventInfo:dC(S)}),w=l(Uc,v,T,t.history);return d(RC,D(t,{history:w}),!1,ci,yr)}return d(RC,t,!1,ci,M([pa(f(Vf,"got a decryption result, but for an event that is not a message!",b))]))}return d(RC,t,!1,ci,M([pa(f(Vf,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(RC,t,!1,ci,M([pa(f(Vf,"Error decoding decryption result",I))]))}}),_C=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),LC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),xC=function(e){return{onBroadcast:ci,onMined:si(L(_C(e),ci)),onSign:si(LC(e))}},PC=je("encryptToPubkeys",Ua),DC=n(function(e,t,r){return{data:si(f(If,"commit(address,string)",M([Dd(t),Dp(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),UC=n(function(e,t,r){return{data:si(f(If,"commit(address,string)",M([Dd(t),Dp(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),OC=function(e){return{$:"CommitMined",a:e}},MC={$:"CommitNeedsSig"},FC=function(e){return{$:"CommitSigned",a:e}},VC=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?UC:DC}(),a=xf(function(){return"Token"===e.factory.$?Ua:qp(El(Hm(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(MC),f(To,{onBroadcast:ci,onMined:si(L(OC,ci)),onSign:si(FC)},a))}),KC=r(function(e,t){return Jf(M([L("id",el(e)),L("encapsulation",Hf(t.encapsulatedKey)),L("iv",Hf(t.iv)),L("tag",Hf(t.tag)),L("encrypted",Hf(t.message))]))}),HC=je("decryptMessage",Ua),jC=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},qC=r(function(e,t){return po(f(xa,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 HC(f(KC,r,s))}return go}return go},jC(e.history)))}),GC=function(e){if("Just"===e.$){return e.a}return ci},zC=function(e){var t=GC(l(wd,Km,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Ao,function(e){return e.address},Td(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(qC,n,a)}return go},YC=r(function(e,t){return f(Ao,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return vl}r.a,r.b;return sb}if("Seller"===r.b.$){r.a,r.b;return sb}r.a,r.b;return vl},f(Km,e,t))}),WC=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(AC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),JC=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),QC=i(function(e,t,r,n,a){return f(WC,n,p(JC,e,r,t,qa,a,""))}),XC=function(e){return{$:"ChatHistoryMsg",a:e}},ZC=a(function(e,t,r,n){var a=x(t,Td(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(YC,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(XC),n))}(h(QC,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),eE={$:"Abort"},tE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),rE=function(e){return{$:"ActionNeedsSig",a:e}},nE=function(e){return{$:"ApproveMining",a:e}},aE={$:"ApproveNeedsSig"},iE=function(e){return{$:"ApproveSigned",a:e}},oE={$:"Burn"},uE={$:"Claim"},sE=function(e){return{$:"CommitMining",a:e}},cE=function(e){return{$:"ConfirmingAction",a:e}},fE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),lE=function(e){return{$:"EventLogFetched",a:e}},dE=function(e){return{$:"ParametersFetched",a:e}},hE=function(e){return{$:"PhaseInfoFetched",a:e}},pE={$:"Poke"},gE={$:"Recall"},vE={$:"Release"},yE=function(e){return{$:"StartContractAction",a:e}},mE=function(e){return{$:"StateFetched",a:e}},bE=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"}},CE=function(e){return d(Ky,e,go,bo,yr)},EE={align:Uf,label:"cantFindTradeWillRetry",mainParagraphs:M([M([Ff("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:sg},SE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(cg,e,r)}if("Nothing"===t.a.$){t.a;return f(Vf,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(Vf,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),TE={align:Uf,label:"tradeParametersNotDefault",mainParagraphs:M([M([Ff("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:sg},wE=eo(Xi),IE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),AE=n(function(e,t,r){return l(Jh,e,Ao(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),BE=r(function(e,t){var r=t.a;return xy(f(Wh,e,r))}),kE=n(function(e,t,r){var n=e.a,a=f(Vh,t,n.requests);if("Nothing"===a.$)return L(Ly(n),go);var i=a.a,o=L(i.watchOnce,kl(r));if("Nothing"===o.b.$){o.b;return L(Ly(D(n,{requests:l(AE,t,r,n.requests)})),go)}if(o.a){var u=o.b.a;return L(Ly(D(n,{requests:l(AE,t,r,n.requests),watching:f(BE,t,n.watching)})),f(Ag,i.tagger,lp(u)))}return L(Ly(D(n,{requests:l(AE,t,r,n.requests)})),po(f(xa,function(e){return f(Ag,i.tagger,lp(e))},r)))}),NE=_e,RE=r(function(e,t){return f(Rp,f(Io,_y,t),f(bp,function(t){return Cy(e)},NE(2e3)))}),$E=ue,_E=ce,LE=Yr,xE=n(function(e,t,r){var n=function(e){return _E(M([e,$E(r)]))};return f(qo,function(a){var i=f(Th,e,a);if("Ok"===i.$){var o=i.a,u=f(Th,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return Go(Di(c))}return Fi(r)},LE)}),PE=a(function(e,t,r,n){return f(Hd,l(xE,f(gh,e,LE),t,r),n)}),DE=n(function(e,t,r){return f(Hd,f(gh,e,t),r)}),UE=Yo(dh),OE=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),ME=function(e){return{$:"BlockHash",a:e}},FE=function(e){return OE(e)?li(ME(Ko(e))):fi("Given blockHash "+lh(e)+" is not valid.")},VE=Yo(FE),KE=function(e){return{$:"TxHash",a:e}},HE=function(e){return OE(e)?li(KE(Ko(e))):fi("Given txHash "+lh(e)+" is not valid.")},jE=Yo(HE),qE=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}}),GE=zr,zE=l(DE,"blockNumber",by,l(DE,"blockHash",VE,l(DE,"transactionHash",jE,l(DE,"transactionIndex",by,l(DE,"logIndex",by,d(PE,"removed",GE,!1,l(DE,"topics",um(Dm),l(DE,"data",zo,l(DE,"address",UE,Fi(qE)))))))))),YE=function(e){return f(wh,function(e){if("Just"===e.$){var t=e.a;return Hf(wf(t))}return Wf},e)},WE=function(e){return Jf(M([L("fromBlock",Rh(e.fromBlock)),L("toBlock",Rh(e.toBlock)),L("address",jf(e.address)),L("topics",YE(e.topics))]))},JE=r(function(e,t){return pp({decoder:um(zE),method:"eth_getLogs",params:M([WE(t)]),url:e})}),QE=function(e){return{$:"BlockNum",a:e}},XE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(bp,function(r){return f(Ep,vi(r),f(JE,e,D(t,{fromBlock:QE(n),toBlock:QE(a)})))},f(JE,e,t)):f(JE,e,t)}),ZE=n(function(e,t,r){var n=r.a,a=r.b;return f(JE,e,D(t,{fromBlock:QE(n),toBlock:QE(a)}))}),eS=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(eS,e,t,i)),c=o;e=u,t=s,r=c}}),tS=r(function(e,t){return l(eS,fl,t,e)}),rS=r(function(e,t){var r=e.a,n=t.a;return xy(f(tS,r,n))}),nS=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 po(f(xa,function(t){return f(Rp,f(Io,IE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},IC(f(xa,function(e){return f(Vh,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(Ly(D(r,{blockNumber:si(a)})),po(M([f(RE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,ZE)]))):L(t,f(RE,r.nodePath,r.tagger))}return L(Ly(D(r,{blockNumber:si(a),pending:Py,watching:f(rS,r.watching,r.pending)})),po(M([f(RE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,XE),l(i,L(a,a),r.watching,ZE)])))}var s=e.a.a;return L(Ly(D(r,{errors:f(ka,s,r.errors)})),f(RE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(kE,t,c,d)}var s=e.b.a;return L(Ly(D(r,{errors:f(ka,s,r.errors)})),go)}),aS=r(function(e,t){var r=t.a;return xy(l(fl,e,gr,r))}),iS=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(fl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(Ly(D(o,{watching:f(aS,a.ref,o.watching)})),f(Rp,f(Io,IE(a.ref),a.tagger),e),a.ref)}(l(XE,a.nodePath,n,L(s,s)))}return x(Ly(D(o,{pending:f(aS,a.ref,o.pending)})),go,a.ref)}),oS=iS(!1),uS=function(e){return M([e])},sS=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(Ry,r.factory,r.id):go}}(),function(){var e=x(Td(t.wallet),yg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(yg(t.wallet),si(a.factory))?d($p,n,r.address,a.creationInfo.address,oy):go}return go}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(ZC,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?zC(t):go,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(Ky,u,po(M([l(Db,p.factory,p.creationInfo.address,mE),s,r])),bo,o)}return CE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return CE(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(xu,m,El(Hm(C.parameters))),ba))return CE(u);var S=l(VC,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(Ky,D(u,{txChainStatus:T}),go,w,yr)}return CE(u)}var y=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:Ob(I.blocknum)},B=l(oS,lE,t.eventSentry,{address:A.address,fromBlock:QE(A.blocknum),toBlock:vp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(eb,A,t.trade)}),$=f(hc,wE,jm(u.trade)),_=po(M([N,h(Ub,$,A.address,dE,mE,hE)]));return d(Ky,u,_,bo,yr)}if("BadBody"===g.a.$){g.a.a;return d(Ky,t,go,bo,M([pa(EE)]))}var y=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(nb,P,t.trade)});return d(Ky,u,zC(u),bo,yr)}return d(Ky,t,go,bo,M([pa(f(SE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(qm(F)){var u=D(t,{trade:f(tb,F,t.trade)});return d(Ky,u,zC(u),bo,yr)}return d(Ky,t,go,bo,M([pa(TE)]))}var V=g.a.a;return d(Ky,t,go,bo,M([pa(f(Vf,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(rb,H,t.trade)});return d(Ky,u,zC(u),bo,yr)}return d(Ky,t,go,bo,M([pa(f(SE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Ih,Mm,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(Ky,t,go,bo,M([pa(f(Vf,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(Jb,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(Qb,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=sm(e.terms);if("Ok"===r.$){var n=r.a;return L(f(ab,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(Vf,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(XC),n))}(l(AC,q.blockNumber,Y,r))}return d(ZC,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?zC(u):go;return d(Ky,u,_,bo,f(oo,f(xa,pa,IC(M([X]))),o));case"ExpandPhase":var te=e.a;return CE(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return CE(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return CE(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(Ky,t,go,bo,M([da(yv(C.parameters.initiatorAddress))]))}return d(Ky,t,go,bo,M([pa(f(Vf,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return CE(D(t,{txChainStatus:si(f(fE,E,ie))}));case"AbortAction":return CE(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(VC,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=xf(l(Md,xd(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(iE)};return f(To,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(xu,i,El(Hm(C.parameters))),ba)?L(si(aE),n):l(VC,C,E.address,E.commPubkey)}return L(si(aE),n)}(),T=oe.a,w=oe.b;return d(Ky,D(t,{txChainStatus:T}),go,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,pE)||R(ue,gE)){var se=yE(ue),ce=t;e=se,t=ce;continue e}return CE(D(t,{txChainStatus:si(cE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,bo,M([pa(f(Vf,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=xf(Jy(n.creationInfo.address));return x(si(rE(gE)),f(To,xC(gE),a),yr);case"Claim":var a=xf(Yy(n.creationInfo.address));return x(si(rE(uE)),f(To,xC(uE),a),yr);case"Abort":var a=xf(Gy(n.creationInfo.address));return x(si(rE(eE)),f(To,xC(eE),a),yr);case"Release":var a=xf(Qy(n.creationInfo.address));return x(si(rE(vE)),f(To,xC(vE),a),yr);case"Burn":var a=xf(zy(n.creationInfo.address));return x(si(rE(oE)),f(To,xC(oE),a),yr);default:var a=xf(Af(n.creationInfo.address));return x(si(rE(pE)),f(To,xC(pE),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(Ky,D(t,{txChainStatus:T}),go,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return CE(D(t,{txChainStatus:si(nE(he))}))}var V=de.a;return d(Ky,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return CE(D(t,{txChainStatus:si(sE(he))}))}var V=de.a;return d(Ky,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"commit",V))]));case"CommitMined":return CE(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return CE(D(t,{txChainStatus:si(f(tE,ue,he))}))}var V=de.a;return d(Ky,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,bE(ue),V))]));case"ActionMined":var ue=e.a;return CE(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(nS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(Ky,D(t,{eventSentry:ve}),_,bo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f($C,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?zC(t):go,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(PC(f(Gb,r,a)),ci)}return L(go,si(f(Vf,"Trying to encrypt, but commInfo is not loaded",n)))}return L(go,ci)}(),Te=Se.a,we=Se.b;return d(Ky,Ee,po(M([s,Te])),bo,U(f(Qi,XC,Ce.appCmds),f(hc,yr,f(Ao,uS,f(Ao,pa,we)))))}return d(Ky,t,go,bo,M([pa(f(Vf,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Ah,qb,Hb(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Km,p,E.address);if("Nothing"===Ne.$)return d(Ky,t,go,bo,M([pa(f(Vf,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return xf("Initiator"===Re.$?f(Wy,p.creationInfo.address,ke):f(Xy,p.creationInfo.address,ke))}();return d(Ky,t,go,f(To,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(Ky,t,go,bo,M([pa(f(Vf,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(Ky,t,go,bo,M([pa(f(Vf,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return CE(t)}var V=e.a.a;return d(Ky,t,go,bo,M([pa(f(fg,"message",V))]));default:return d(Ky,t,go,bo,M([ga]))}}),cS=r(function(e,t){return{address:e,blocknum:t}}),fS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(iS,!0,e,t,r))}),lS=n(function(e,t,r){var n=function(e){return r(f(Ih,bm,e).returnData)},a={address:t.address,fromBlock:QE(t.blocknum),toBlock:QE(t.blocknum),topics:M([si(Om("Initiated(string,string)"))])};return l(fS,n,e,a)}),dS=function(e){return{data:si(f(If,"numTrades()",yr)),decoder:Wo(Eh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},hS=r(function(e,t){return f(Rp,t,f(yp,Nh(e),dS(Ld(e))))}),pS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),gS=r(function(e,t){return l(La,pS(e),yr,t)}),vS=function(e){return f(gS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},yS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},mS=function(e){return f(yS,Ja(Gm),Sa(e.trades))},bS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:mS(e),loaded:Ti(vS(e))})})},CS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),ES=r(function(e,t){var r=f(_c,e,t.trades);if("Just"===r.$){var n=(r.a,l(Uc,e,Gm,t.trades));return l(CS,bS(D(t,{trades:n})),go,yr)}return l(CS,t,go,M([pa(f(Vf,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),SS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(eb,t,a),o=l(Uc,e,i,r.trades);return L(bS(D(r,{trades:o})),yr)}return L(r,M([f(Vf,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),TS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tb,t,a),o=l(Uc,e,i,r.trades);return l(CS,bS(D(r,{trades:o})),go,yr)}return l(CS,r,go,M([pa(f(Vf,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),wS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(rb,t,a),o=l(Uc,e,i,r.trades);return l(CS,bS(D(r,{trades:o})),go,yr)}return l(CS,r,go,M([pa(f(Vf,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),IS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(nb,t,a),o=l(Uc,e,i,r.trades);return l(CS,bS(D(r,{trades:o})),go,yr)}return l(CS,r,go,M([pa(f(Vf,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),AS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(ab,t,a),o=l(Uc,e,i,r.trades);return l(CS,bS(D(r,{trades:o})),go,yr)}return l(CS,r,go,M([pa(f(Vf,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),BS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),kS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),NS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),RS=function(e){return{$:"NumTradesFetchedAgain",a:e}},$S=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),_S=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),LS=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),xS=function(e){return l(CS,e,go,yr)},PS=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=Ob(n),i=Vb(f(xa,yy(t.factory),f(Ai,0,a-1))),o=po(f(xa,function(e){return l(ky,t.factory,wu(e),BS(e))},f(Ai,0,a-1)));return l(CS,D(t,{dataFetchState:l(kS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(CS,t,go,M([pa(f(cg,"Factory numTrades",u))]));case"CheckForNewTrades":return l(CS,t,f(hS,t.factory,RS),yr);case"NumTradesFetchedAgain":var r=e.a,s=L(r,t.dataFetchState.total);if("Ok"===s.a.$){if("Just"===s.b.$){var n=s.a.a,c=s.b.a,d=Ob(n);if(_(c,d)<0){var p=t.dataFetchState,o=po(f(xa,function(e){return l(ky,t.factory,wu(e),BS(e))},f(Ai,c,d-1))),g=Vb(f(xa,yy(t.factory),f(Ai,c,d-1)));return l(CS,D(t,{dataFetchState:D(p,{total:si(d)}),trades:f(TC,t.trades,g)}),o,yr)}return xS(t)}s.b;return l(CS,t,go,M([pa(f(Vf,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=s.a.a;return l(CS,t,go,M([pa(f(cg,"Factory numTrades",u))]));case"CreationInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$){var y=r.a,m=f(cS,y.address_,Ob(y.blocknum)),b=l(lS,t.eventSentry,m,NS(v)),C=b.a,E=b.b,S=po(M([h(Ub,t.factory,m.address,$S(v),LS(v),_S(v)),E])),T=l(SS,v,m,t),w=T.a,I=T.b;return l(CS,bS(D(w,{eventSentry:C})),S,f(xa,pa,I))}var u=r.a;return l(CS,t,go,M([pa(f(cg,"creationInfo",u))]));case"ParametersFetched":var v=e.a,r=e.b;if("Err"===r.$){var A=r.a;return l(CS,t,go,M([pa(f(cg,"parameters",A))]))}if("Ok"===r.a.$){var B=r.a.a;return l(TS,v,B,t)}var k=r.a.a;return l(CS,t,go,M([pa(f(Vf,"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(IS,v,N,t)}return l(CS,t,go,M([pa(f(SE,"state",r))]));case"PhaseStartInfoFetched":var v=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var R=r.a.a;return l(wS,v,R,t)}return l(CS,t,go,M([pa(f(SE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var v=e.a,r=e.b;if("Ok"===r.$){var $=r.a,x=sm($.terms);if("Ok"===x.$){var P=x.a;return l(AS,v,P,t)}var U=x.a;return f(ES,v,t)}var U=r.a;return l(CS,t,go,M([pa(f(Vf,"Error decoding initiated event",U))]));default:var O=e.a,F=f(nS,O,t.eventSentry),V=F.a,S=F.b;return l(CS,D(t,{eventSentry:V}),S,yr)}}),DS=function(e){return{$:"AgentHistoryMsg",a:e}},US=function(e){return{$:"AppCmd",a:e}},OS={$:"BetaLandingPage"},MS={$:"ConnectToWeb3"},FS=function(e){return{$:"MarketplaceMsg",a:e}},VS=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),KS=r(function(e,t){return f(kn,e,Hf(t))}),HS=function(e){return f(KS,"href",tt(e))},jS=Nn("rel"),qS=KS("target"),GS=function(e){return{$:"Height",a:e}},zS=GS,YS={$:"Content"},WS=YS,JS=function(e){return{$:"Width",a:e}},QS=JS,XS=function(e){return{$:"Attr",a:e}},ZS=function(e){return{$:"NodeName",a:e}},eT=function(e){return{$:"Unkeyed",a:e}},tT={$:"AsEl"},rT=tT,nT=r(function(e,t){return{$:"Field",a:e,b:t}}),aT=f(nT,0,0),iT={$:"NoNearbyChildren"},oT={above:"a",active:"atv",alignBottom:"ab",alignCenterX:"cx",alignCenterY:"cy",alignContainerBottom:"acb",alignContainerCenterX:"accx",alignContainerCenterY:"accy",alignContainerRight:"acr",alignLeft:"al",alignRight:"ar",alignTop:"at",alignedHorizontally:"ah",alignedVertically:"av",any:"s",behind:"bh",below:"b",bold:"w7",borderDashed:"bd",borderDotted:"bdt",borderNone:"bn",borderSolid:"bs",capturePointerEvents:"cpe",clip:"cp",clipX:"cpx",clipY:"cpy",column:"c",container:"ctr",contentBottom:"cb",contentCenterX:"ccx",contentCenterY:"ccy",contentLeft:"cl",contentRight:"cr",contentTop:"ct",cursorPointer:"cptr",cursorText:"ctxt",focus:"fcs",fullSize:"fs",grid:"g",hasBehind:"hbh",heightContent:"hc",heightFill:"hf",heightFillPortion:"hfp",hover:"hv",imageContainer:"ic",inFront:"fr",inputMultiline:"iml",inputText:"it",italic:"i",nearby:"nb",noTextSelection:"notxt",onLeft:"ol",onRight:"or",opaque:"oq",overflowHidden:"oh",page:"pg",paragraph:"p",passPointerEvents:"ppe",root:"ui",row:"r",scrollbars:"sb",scrollbarsX:"sbx",scrollbarsY:"sby",seButton:"sbt",single:"e",sizeByCapital:"cap",spaceEvenly:"sev",strike:"sk",text:"t",textCenter:"tc",textExtraBold:"w8",textExtraLight:"w2",textHeavy:"w9",textJustify:"tj",textJustifyAll:"tja",textLeft:"tl",textLight:"w3",textMedium:"w5",textNormalWeight:"w4",textRight:"tr",textSemiBold:"w6",textThin:"w1",textUnitalicized:"tun",transition:"ts",transparent:"clr",underline:"u",widthContent:"wc",widthExact:"we",widthFill:"wf",widthFillPortion:"wfp",wrapped:"wrp"},uT=oT.any+" "+oT.column,sT=oT.any+" "+oT.grid,cT=oT.any+" "+oT.page,fT=oT.any+" "+oT.paragraph,lT=oT.any+" "+oT.row,dT=oT.any+" "+oT.single,hT=function(e){switch(e.$){case"AsRow":return lT;case"AsColumn":return uT;case"AsEl":return dT;case"AsGrid":return sT;case"AsParagraph":return fT;default:return cT}},pT=function(e){return{$:"Keyed",a:e}},gT={$:"NoStyleSheet"},vT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),yT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),mT={$:"AsParagraph"},bT=mT,CT=Sn("div"),ET=Sn("p"),ST=Sn("s"),TT=Sn("u"),wT=KS("className"),IT=function(e){return wn(Xe(e))},AT=function(e){return Sn(Xe(e))},BT=function(e){return{$:"Flag",a:e}},kT=function(e){return{$:"Second",a:e}},NT=function(e){return e>31?kT(1< .ctr > ."+oT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",Rw="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+QT(oT.any)+QT(oT.row)+" > "+QT(oT.any)+" { flex-basis: auto !important; } "+QT(oT.any)+QT(oT.row)+" > "+QT(oT.any)+QT(oT.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"+Nw,$w=function(e){return{$:"Intermediate",a:e}},_w=r(function(e,t){return $w({closing:t,others:yr,props:yr,selector:e})}),Lw=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,$w({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(Lw,f(_w,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(Lw,f(_w,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(Lw,f(_w,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(Lw,f(_w,n.selector,""),v),t.others)})}});return $w(l(La,a,n,t))}),xw=U(Rw,function(e){var t=function(e){return Ql(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Ql(f(xa,a,t.others)))};return Ql(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(Lw,f(_w,r,""),n),t)}),yr,e)))}(U(Aw,kw))),Pw=l(AT,"style",yr,M([ZT(xw)])),Dw=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+'"'}},Uw=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}},Ow=function(e){if("FontWith"===e.$){var t=e.a;return f(Qd,Uw,t.variants)}return!1},Mw=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),Fw=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),Vw=n(function(e,t,r){var n=r.a,a=r.b;return M([f(Fw,"."+e+"."+t+", ."+e+" ."+t,n),f(Fw,"."+e+"."+t+"> ."+oT.text+", ."+e+" ."+t+" > ."+oT.text,a)])}),Kw=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(Vw,i,oT.sizeByCapital,a),l(Vw,i,oT.fullSize,n)))}),Hw=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(Fw,"."+r+"."+oT.sizeByCapital+", ."+r+" ."+oT.sizeByCapital,M([L("line-height","1")])),f(Fw,"."+r+"."+oT.sizeByCapital+"> ."+oT.text+", ."+r+" ."+oT.sizeByCapital+" > ."+oT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),jw=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},qw=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,rc,t,r))}return ci},Gw=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),zw=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(hc,e.descender,qw(t)),n=f(hc,e.baseline,qw(f(Yf,function(e){return!R(e,r)},t))),a=f(hc,e.capital,jw(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(Gw,i,a-n,o),full:l(Gw,u,a-r,s)}},Yw=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",YT(e.height)),L("vertical-align",YT(e.vertical)+"em"),L("font-size",YT(e.size)+"em")]))},Ww=function(e){return l(Ra,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 si(L(Yw(function(e){return e.full}(zw(a))),Yw(function(e){return e.capital}(zw(a)))))}return t}return t}),ci,e)},Jw=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(gS,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=Ww(r);if("Nothing"===a.$)return f(Ri,"",f(xa,Hw(t),n));var i=a.a;return f(Ri,"",f(xa,f(Kw,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},Qw=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+'" '+Ni(r)}},Xw=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,Qw,t.variants)))}return ci},Zw=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},eI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+YT(r)+"px, "+YT(n)+"px, "+YT(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("+YT(o)+"px, "+YT(u)+"px, "+YT(s)+"px)",b="scale3d("+YT(f)+", "+YT(l)+", "+YT(d)+")",C="rotate3d("+YT(p)+", "+YT(g)+", "+YT(v)+", "+YT(y)+"rad)";return si(m+" "+b+" "+C)}},tI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,Mw(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,Mw(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,Mw(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,Mw(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+oT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+oT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+oT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,Mw(!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,M([f(GT,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(rc,1,1-c));return l(a,t,"."+u,M([f(GT,"opacity",YT(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(GT,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(gS,Xw,p)),v=M([f(GT,"font-family",f(Ri,", ",f(xa,Dw,p))),f(GT,"font-feature-settings",g),f(GT,"font-variant",f(Qd,Ow,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(GT,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(GT,s,WT(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+oT.row,A="."+(oT.wrapped+I),B="."+oT.alignRight,k="."+oT.paragraph,N="."+oT.page,R="."+oT.alignLeft,$=YT(S/2)+"px",_=YT(E/2)+"px",x="."+oT.column,y="."+C,P="."+oT.any;return Ql(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(GT,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(GT,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(GT,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(GT,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(GT,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(GT,"margin-left",w)])),l(a,t,U(y,k),M([f(GT,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(GT,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(GT,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(GT,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(GT,"content","''"),f(GT,"display","block"),f(GT,"height","0"),f(GT,"width","0"),f(GT,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(GT,"content","''"),f(GT,"display","block"),f(GT,"height","0"),f(GT,"width","0"),f(GT,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(GT,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(GT,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,VT,F.rows))+"-cols-"+f(Ri,"-",f(xa,VT,F.columns))+"-space-x-"+VT(F.spacing.a)+"-space-y-"+VT(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=eI(ne),y=HT(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,M([f(GT,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=Zw(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(Jw(s),c)}),rI=r(function(e,t){return l(AT,"style",yr,M([ZT(f(tI,e,t))]))}),nI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",Pw),f(ka,L("dynamic-stylesheet",f(rI,t,l(Ra,qT,L(Py,M([XT(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(rI,t,l(Ra,qT,L(Py,M([XT(t.focus)])),r).b)),n)}),aI=a(function(e,t,r,n){return e?f(ka,Pw,f(ka,f(rI,t,l(Ra,qT,L(Py,M([XT(t.focus)])),r).b),n)):f(ka,f(rI,t,l(Ra,qT,L(Py,M([XT(t.focus)])),r).b),n)}),iI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(IT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(nI,!1,e,t,r);default:var e=i.a,t=i.b;return d(nI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return CT;case"p":return ET;default:return AT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(aI,!1,e,t,n);default:var e=i.a,t=i.b;return d(aI,!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(AT,e,n,M([f(u,r,M([wT(oT.any+" "+oT.single)]))]))}}();switch(o.$){case"AsRow":return f(DT,OT,e)&&!f(DT,UT,e)?s:f(DT,$T,e)?f(TT,M([wT(f(Ri," ",M([oT.any,oT.single,oT.container,oT.contentCenterY,oT.alignContainerRight])))]),M([s])):f(DT,_T,e)?f(ST,M([wT(f(Ri," ",M([oT.any,oT.single,oT.container,oT.contentCenterY,oT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(DT,PT,e)&&!f(DT,xT,e)?s:f(DT,LT,e)?f(ST,M([wT(f(Ri," ",M([oT.any,oT.single,oT.container,oT.alignContainerCenterY])))]),M([s])):f(DT,RT,e)?f(TT,M([wT(f(Ri," ",M([oT.any,oT.single,oT.container,oT.alignContainerBottom])))]),M([s])):s;default:return s}}),oI=ZT,uI=function(e){return f(CT,M([wT(f(Ri," ",M([oT.any,oT.text,oT.widthContent,oT.heightContent])))]),M([oI(e)]))},sI=function(e){return l(AT,"div",M([wT(f(Ri," ",M([oT.any,oT.text,oT.widthFill,oT.heightFill])))]),M([ZT(e)]))},cI=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 R(e,bT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,bT),L(f(ka,L(n,f(s.html,gT,e)),i),au(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,rT)?sI(c):uI(c)),i),o);default:return L(i,o)}}),i=r(function(t,r){var n=r.a,a=r.b;switch(t.$){case"Unstyled":var i=t.a;return R(e,bT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,bT),L(f(ka,f(o.html,gT,e),n),au(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,rT)?sI(u):uI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=au(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(iI,n.has,n.node,n.attributes,pT(l(yT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(iI,n.has,n.node,n.attributes,pT(l(yT,"nearby-element-pls",s,n.children)),gT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=au(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(iI,n.has,n.node,n.attributes,eT(f(vT,m,n.children))),styles:g})}return Gi(h(iI,n.has,n.node,n.attributes,eT(f(vT,m,n.children)),gT))}),fI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),lI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(nT,a|r,n)}var i=e.a;return f(nT,r,i|n)}),dI=NT(7),hI=NT(36),pI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(nT,r|a,n|i)}),gI=NT(6),vI=NT(38),yI=NT(30),mI=NT(29),bI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),CI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),EI=function(e){return{$:"Transform",a:e}},SI=function(e){return{$:"ChildrenBehind",a:e}},TI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),wI=function(e){return{$:"ChildrenInFront",a:e}},II=r(function(e,t){return f(CT,M([wT(function(){switch(e.$){case"Above":return f(Ri," ",M([oT.nearby,oT.single,oT.above]));case"Below":return f(Ri," ",M([oT.nearby,oT.single,oT.below]));case"OnRight":return f(Ri," ",M([oT.nearby,oT.single,oT.onRight]));case"OnLeft":return f(Ri," ",M([oT.nearby,oT.single,oT.onLeft]));case"InFront":return f(Ri," ",M([oT.nearby,oT.single,oT.inFront]));default:return f(Ri," ",M([oT.nearby,oT.single,oT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return ZT("");case"Text":var e=t.a;return uI(e);case"Unstyled":return(0,t.a)(rT);default:return f(t.a.html,gT,rT)}}()]))}),AI=n(function(e,t,r){var n=f(II,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?SI(M([n])):wI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?SI(f(ka,n,a)):f(TI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(TI,M([n]),i):wI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(TI,f(ka,n,a),i):f(TI,a,f(ka,n,i))}}),BI=r(function(e,t){switch(t.$){case"Generic":return ZS(e);case"NodeName":var r=t.a;return f(bI,r,e);default:var n=t.a,a=t.b;return f(bI,n,a)}}),kI=function(e){switch(e.$){case"Left":return oT.alignedHorizontally+" "+oT.alignLeft;case"Right":return oT.alignedHorizontally+" "+oT.alignRight;default:return oT.alignedHorizontally+" "+oT.alignCenterX}},NI=function(e){switch(e.$){case"Top":return oT.alignedVertically+" "+oT.alignTop;case"Bottom":return oT.alignedVertically+" "+oT.alignBottom;default:return oT.alignedVertically+" "+oT.alignCenterY}},RI=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),$I=function(e){return{$:"Moved",a:e}},_I=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return $I(x(r,0,0));case"MoveY":var n=t.a;return $I(x(0,n,0));case"MoveZ":var a=t.a;return $I(x(0,0,a));case"MoveXYZ":var i=t.a;return $I(i);case"Rotate":var i=t.a,o=t.b;return d(RI,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(RI,x(0,0,0),i,x(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 $I(x(s,n,a));case"MoveY":var c=t.a;return $I(x(r,c,a));case"MoveZ":var f=t.a;return $I(x(r,n,f));case"MoveXYZ":var i=t.a;return $I(i);case"Rotate":var i=t.a,o=t.b;return d(RI,u,x(1,1,1),i,o);default:var l=t.a;return d(RI,u,l,x(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(RI,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(RI,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(RI,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(RI,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(RI,u,h,v,y);default:var m=t.a;return d(RI,u,m,p,o)}}}),LI=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(aT,n,M([l(CI,n,"height",r+"px")]));case"Content":return x(f(lI,hI,aT),oT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(lI,PT,aT),oT.heightFill,yr):x(f(lI,PT,aT),oT.heightFillPortion+" height-fill-"+Ni(a),M([l(CI,oT.any+"."+oT.row+" > "+QT("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(CI,u,"min-height",Ni(i)+"px"),c=LI(o),d=c.a,h=c.b,p=c.c;return x(f(lI,xT,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(CI,u,"max-height",Ni(g)+"px"),v=LI(o),d=v.a,h=v.b,p=v.c;return x(f(lI,xT,d),u+" "+h,f(ka,s,p))}},xI=function(e){switch(e.$){case"Px":var t=e.a;return x(aT,oT.widthExact+" width-px-"+Ni(t),M([l(CI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(lI,vI,aT),oT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(lI,OT,aT),oT.widthFill,yr):x(f(lI,OT,aT),oT.widthFillPortion+" width-fill-"+Ni(r),M([l(CI,oT.any+"."+oT.row+" > "+QT("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(CI,i,"min-width",Ni(n)+"px"),u=xI(a),s=u.a,c=u.b,d=u.c;return x(f(lI,UT,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(CI,i,"max-width",Ni(h)+"px"),p=xI(a),s=p.a,c=p.b,d=p.c;return x(f(lI,UT,s),i+" "+c,f(ka,o,d))}},PI=NT(27),DI=r(function(e,t){if(R(e,PI)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),UI=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=HT(n);if("Nothing"===s.$)return{attributes:f(ka,wT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,wT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,EI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(DT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(lI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(DT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(DI,S,I)){var p=jT(I)+" "+e,g=t,v=f(lI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=jT(I)+" "+e,g=t,v=f(lI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(lI,S,r),y=f(_I,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(DT,gI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=oT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(lI,gI,r),y=n,m=f(ka,l(CI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+oT.widthContent,g=t,v=f(lI,vI,f(lI,gI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+oT.widthFill,g=t,v=f(lI,OT,f(lI,gI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+oT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(lI,OT,f(lI,gI,r)),y=n,m=f(ka,l(CI,oT.any+"."+oT.row+" > "+QT("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=xI(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(pI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(DT,dI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(lI,dI,r),y=n,m=f(ka,l(CI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=oT.heightContent+" "+e,g=t,v=f(lI,hI,f(lI,dI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=oT.heightFill+" "+e,g=t,v=f(lI,PT,f(lI,dI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+oT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(lI,PT,f(lI,dI,r)),y=n,m=f(ka,l(CI,oT.any+"."+oT.column+" > "+QT("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=LI(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(pI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(BI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(BI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(BI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(BI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(BI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(BI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(BI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return ZS("p");case"NodeName":var e=t.a;return ZS(e);default:var r=t.a,n=t.b;return f(bI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(fI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(fI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(fI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(fI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(AI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(DT,yI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=kI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(lI,_T,e);case"Right":return f(lI,$T,e);default:return e}}(f(lI,yI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(DT,mI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=NI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(lI,LT,e);case"Bottom":return f(lI,RT,e);default:return e}}(f(lI,mI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),OI={$:"Untransformed"},MI=OI,FI=a(function(e,t,r,n){return l(cI,e,n,v(UI,hT(e),t,aT,MI,yr,yr,iT,$a(r)))}),VI=function(e){return XS(wT(e))},KI=r(function(e,t){var r=t.url,n=t.label;return d(FI,rT,ZS("a"),f(ka,XS(HS(r)),f(ka,XS(jS("noopener noreferrer")),f(ka,XS(qS("_blank")),f(ka,QS(WS),f(ka,zS(WS),f(ka,VI(oT.contentCenterX+" "+oT.contentCenterY),e)))))),eT(M([n])))}),HI=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),jI=n(function(e,t,r){return d(HI,e,t,r,1)}),qI=NT(14),GI=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),zI=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),YI=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return KT(t)+"-"+KT(r)+"-"+KT(n)+"-"+KT(a)},WI=function(e){return f(zI,qI,l(GI,"fc-"+YI(e),"color",e))},JI={align:Uf,label:"cantConnectNoWeb3",mainParagraphs:M([M([Ff("You need a web3 provider (such as "),f(KI,M([WI(l(jI,0,0,1))]),{label:Ff("Metamask"),url:"https://metamask.io/"}),Ff(") to Connect.")]),M([Ff("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:lg},QI={align:Uf,label:"invalidUrl",mainParagraphs:M([M([Ff("I don't understand that URL...")]),M([Ff("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:sg},XI=function(e){return{$:"Active",a:e}},ZI=Yo(f(Io,Tf,f(Io,Ch,sd("Error decoding hex to BigInt")))),eA=function(){return Yo(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),tA=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}}}}}}}}}}}},rA=function(e){return _E(M([f(Oi,si,e),Fi(ci)]))},nA=f(Hd,rA(f(gh,"status",eA)),f(Hd,rA(f(gh,"root",zo)),l(DE,"logsBloom",zo,l(DE,"logs",um(zE),f(Hd,rA(f(gh,"contractAddress",UE)),l(DE,"cumulativeGasUsed",ZI,l(DE,"gasUsed",ZI,l(DE,"blockNumber",by,l(DE,"blockHash",VE,l(DE,"transactionIndex",by,l(DE,"transactionHash",jE,Fi(tA)))))))))))),aA=function(e){var t=e.a;return Tf(t)},iA=f(Io,aA,Hf),oA=r(function(e,t){return pp({decoder:nA,method:"eth_getTransactionReceipt",params:M([iA(t)]),url:e})}),uA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),sA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),cA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),fA=r(function(e,t){return f(Ao,function(e){return e.toMsg},f(vg,function(e){return e.b},f(vg,function(e){return e.onMinedTagger},f(Vh,t,e))))}),lA=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}}}}}}}}}}}},dA=function(e){return _E(M([$E(ci),f(Oi,si,e)]))},hA=l(DE,"input",zo,l(DE,"gas",by,l(DE,"gasPrice",ZI,l(DE,"value",ZI,l(DE,"to",dA(UE),l(DE,"from",UE,l(DE,"transactionIndex",by,l(DE,"blockNumber",dA(by),l(DE,"blockHash",function(e){return f(qo,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},Ko(t))?Fi(ci):f(Oi,si,e)},zo)}(VE),l(DE,"nonce",by,l(DE,"hash",jE,Fi(lA)))))))))))),pA=r(function(e,t){return pp({decoder:hA,method:"eth_getTransactionByHash",params:M([iA(t)]),url:e})}),gA=r(function(e,t){return{attempts:e,sleep:t}}),vA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Np,function(e){return a>0?f(bp,function(e){return f(vA,f(gA,a,n),t)},NE(1e3*n)):fp(e)},t)}),yA=r(function(e,t){return f(bp,function(r){return f(vA,{attempts:30,sleep:1},f(pA,e,t))},NE(250))}),mA=r(function(e,t){return f(vA,{attempts:60,sleep:5},f(oA,e,t))}),bA=function(e){return{$:"Mined",a:e}},CA=function(e){return Ao(function(t){return D(t,{status:bA(e)})})},EA=function(e){return{$:"Sent",a:e}},SA=function(e){return Ao(function(t){return D(t,{status:EA(e)})})},TA=function(e){return{$:"Signed",a:e}},wA=function(e){return Ao(function(t){return D(t,{status:TA(e)})})},IA=function(e){return"Nothing"!==e.$},AA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Zf(r),go);case"TxSigned":var n=e.a,a=e.b,i=f(Vh,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(Ag,t,lp(a))}return go}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return go;if("Just"===t.b.$){var r=t.b.a;return f(Ag,r,lp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Ag,a,lp(fi(e)))}t.a,t.b,t.c;return go};if("Ok"===a.$){var c=a.a,d=IA(o.onBroadcastTagger)||IA(o.onMinedTagger)?f(Pf,r.tagger,f(Rp,cA(n),f(yA,r.nodePath,c))):go;return L(Zf(D(r,{txs:l(Jh,n,wA(c),r.txs)})),po(M([u,d])))}var h=a.a;return L(Zf(r),po(M([u,s(h)])))}return L(Zf(r),go);case"TxSent":var n=e.a,p=e.b,g=f(Vh,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Pf,r.tagger,f(Rp,sA(n),f(mA,r.nodePath,v.hash))):go}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Ag,t,lp(li(v)))}return go}();return L(Zf(D(r,{txs:l(Jh,n,SA(v),r.txs)})),po(M([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(Ag,t,lp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Ag,n,lp(fi("Error with TxSent stuff")))}e.a,e.b;return go}();return L(Zf(r),s)}return L(Zf(r),go);case"TxMined":var n=e.a,m=e.b,b=f(Vh,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Ag,a,lp(li(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 po(M([f(Pf,r.tagger,f(Rp,f(uA,n,s),Cy(r.nodePath))),f(Ag,a,lp(li(C))),f(Ag,u.toMsg,lp(s))]))}return go}();return L(Zf(D(r,{txs:l(Jh,n,CA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Ag,r,lp(fi("TxReceipt decoding failure")))}return go}();return L(Zf(r),S)}return L(Zf(r),go);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(fA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Zf(r),f(Ag,B,f(Np,function(e){return lp(D(I,{doneWatching:!0,reOrg:!0}))},f(bp,function(e){return lp(D(I,{doneWatching:!0}))},f(oA,r.nodePath,T.txHash)))))}return L(Zf(r),go)}if(R(w,T.lastCheckedBlock))return L(Zf(r),f(Pf,r.tagger,f(Rp,f(uA,n,T),f(bp,function(e){return Cy(r.nodePath)},NE(2e3)))));var k=f(fA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Zf(r),po(M([f(Pf,r.tagger,f(Rp,f(uA,n,I),f(bp,function(e){return Cy(r.nodePath)},NE(2e3)))),f(Ag,B,lp(I))])))}return L(Zf(r),go)}var n=e.a,h=e.c.a;return L(Zf(r),go);default:var h=e.a;return L(Zf(r),go)}}),BA=Jt,kA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),NA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),RA=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(NA,"#",e.fragment,l(NA,"?",e.query,U(f(kA,e.port_,U(t,e.host)),e.path)))},$A=r(function(e,t){return e<0?ci:kl(f(xl,e,t))}),_A=r(function(e,t){if(e<0)return t;var r=ah(f(xl,e,t)),n=f(js,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),LA=n(function(e,t,r){if(e<0)return r;var n=f(xl,e,r),a=f(js,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),xA=r(function(e,t){return f(LA,e,Qu(t))}),PA=r(function(e,t){gv(t);switch(t.$){case"Home":return L(D(e,{submodel:OS}),go);case"Create":var r=Nd(e.wallet),n=f(hl,e.txSentry,f(Bo,fy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(UA,U(f(Qi,fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:cy(r.model),txSentry:a}),po(M([f(Pf,fy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(ey,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(qy,e.wallet,r)}return l(Hy,e.wallet,u,s)}(),c=f(hl,e.txSentry,f(Bo,hy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(UA,U(f(Qi,hy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:dy(r.model),txSentry:a}),po(M([f(Pf,hy,r.cmd),i]))));case"Marketplace":var d=Qg(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:ly(h)}),po(M([f(Pf,FS,p)])));case"AgentHistory":var g=t.a,v=f(vo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:sy(y)}),po(M([f(Pf,DS,m)])));default:return L(f(uo,QI,e),go)}}),DA=r(function(e,t){var r=t.a,n=t.b,a=f(OA,US(e),r),i=a.a,o=a.b;return L(i,po(M([n,o])))}),UA=r(function(e,t){var r=t.a,n=t.b;return l(Ra,DA,L(r,n),e)}),OA=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(OA,MS,t);case"GotoRoute":var n=r.a;return L(t,f(zv,t.key,n));case"GTag":var a=r.a;return L(t,Qv(Wv(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),Qv(Wv(d(pl,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(fv,ty,o,u,s));default:return L(t,ry(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(_A,c,t.userNotices)}),go);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(Gv,t.key,RA(e))}var r=h.a;return BA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(MA,g,t);case"GotoRoute":var v=e.a;return L(t,po(M([Qv(Wv(d(pl,"GotoRoute","navigation",gv(v),0))),f(zv,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),go);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,JI,t),go):L(t,Yv(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return go;var t=e.a;return Xv(f(Jv,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Th,zo,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=XI(l(gl,I,w,S)),B=f(py,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(Vf,"Unexpected wallet state encounted when setting commPubkey!",ci),t),go)}T.a;return L(f(uo,f(Vf,"User pubkey set, but I can no longer find the user address!",ci),t),go)}var N=E.a;return L(l(Pa,uo,f(Vf,"error decoding commPubkey from JS",N),t),go);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(Hg,R,_),P=f(hl,t.txSentry,f(Bo,fy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(UA,U(f(Qi,fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:cy(x.model),txSentry:O}),po(M([f(Pf,fy,x.cmd),F]))))}return L(t,go);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(sS,K,j),q=f(hl,t.txSentry,f(Bo,hy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(UA,U(f(Qi,hy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:dy(x.model),txSentry:O}),po(M([f(Pf,hy,x.cmd),F]))))}return L(t,go);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(cv,G,Y);return f(UA,f(Qi,FS,x.appCmds),L(D(t,{submodel:ly(x.model)}),f(Pf,FS,x.cmd)))}return L(t,go);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(Df,W,Q),X=f(hl,t.txSentry,f(Bo,DS,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(UA,U(f(Qi,DS,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:sy(x.model),txSentry:O}),po(M([f(Pf,DS,x.cmd),F]))))}return L(t,go);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(lu,si,f(AA,Z,r))}return L(ci,go)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f($A,re,t.tradeCaches);if("Nothing"===ae.$)return f(DA,pa(f(Vf,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,go));var ie=ae.a,x=f(PS,ne,ie);return L(D(t,{tradeCaches:l(xA,re,x.tradeCache,t.tradeCaches)}),f(Pf,VS(re),x.cmd));case"NoOp":return L(t,go);default:var N=e.a;f(Mf,"test",N);return L(t,go)}}),MA=r(function(e,t){return f(PA,t,qv(e))}),FA=Ge("txIn",LE),VA=je("txOut",Ua),KA=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},HA=function(e){return{$:"EventSentryMsg",a:e}},jA=function(e){var t=f(Dy,HA,Nh(e)),r=t.a,n=t.b;return x({dataFetchState:l(kS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Rd,"tradeCache init","processing",KA(e),0)]))},qA=function(e){return{$:"InitialNumTradesFetched",a:e}},GA=function(e){return f(hS,e.factory,qA)},zA=function(e){var t=jA(e),r=t.a,n=t.b,a=t.c;return x(r,po(M([n,GA(r)])),a)},YA=function(e){return{$:"TxSentryMsg",a:e}},WA={align:Uf,label:"noWeb3Provider",mainParagraphs:M([M([Ff("No web3 provider detected. Is "),f(KI,M([WI(l(jI,0,0,1))]),{label:Ff("Metamask"),url:"https://metamask.io/"}),Ff(" or some other web3 provider installed and unlocked?")])]),noticeType:lg},JA={$:"TopLeft"},QA={align:JA,label:"screenToSmall",mainParagraphs:M([M([Ff("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:lg},XA={align:Uf,label:"wrongWeb3Network",mainParagraphs:M([M([Ff("Your wallet is set to an incorrect network.")]),M([Ff("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:sg},ZA={$:"NoneDetected"},eB=function(e){return{$:"OnlyNetwork",a:e}},tB=function(e){return f(Ao,Nh,yg(e))},rB={$:"ETCMain"},nB={$:"ETCTest"},aB={$:"Expanse"},iB={$:"Kovan"},oB={$:"Mainnet"},uB=function(e){return{$:"Private",a:e}},sB={$:"Rinkeby"},cB={$:"Ropsten"},fB={$:"RskMain"},lB={$:"RskTest"},dB=function(e){switch(e){case 1:return oB;case 2:return aB;case 3:return cB;case 4:return sB;case 30:return fB;case 31:return lB;case 42:return iB;case 41:return rB;case 62:return nB;default:return uB(e)}},hB=n(function(e,t,r){var n=e.a,a=e.b;return Zf({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Fh})}),pB=n(function(e,t,n){var a=e.networkId?eB(dB(e.networkId)):ZA,i=f(Ao,function(e){return l(hB,L(VA,FA),YA,e)},tB(a)),o=e.width<1024?si(QA):ci,u=f(xa,zA,ro),s=function(){return R(a,ZA)?si(WA):"Nothing"===yg(a).$?si(XA):ci}(),c=IC(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=$v(f(Bi,r(function(e,t){return f(Qi,VS(e),t)}),g)),y=po(f(Bi,r(function(e,t){return f(Pf,VS(e),t)}),p)),m=f(UA,v,f(MA,t,{key:n,screenWidth:e.width,submodel:OS,time:ml(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),po(M([y,C])))}),gB=Oe,vB=gB(yr),yB=function(e){return vB},mB=function(e){return{$:"Refresh",a:e}},bB=r(function(e,t){return{$:"Every",a:e,b:t}}),CB=r(function(e,t){return{processes:t,taggers:e}}),EB=lp(f(CB,Fh,Fh)),SB=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(eS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),TB=Ne,wB=r(function(e,t){var r=e.a,n=e.b,a=f(Vh,r,t);if("Nothing"===a.$)return l(fl,r,M([n]),t);var i=a.a;return l(fl,r,f(ka,n,i),t)}),IB=Be,AB=r(function(e,t){return{$:"Zone",a:e,b:t}}),BB=ca,kB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=IB(f(BB,n,f(Zh,e,n)));return f(bp,function(t){return l(kB,e,a,l(fl,n,t,r))},i)}return lp(r)}),NB=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 x(n,a,f(bp,function(e){return i},TB(t)))}),u=l(Ra,wB,Fh,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(fl,e,r,i),o)}),d=p(SB,s,c,o,u,i,x(yr,Fh,lp(gr))),h=d.a,g=d.b,v=d.c;return f(bp,function(e){return lp(f(CB,u,e))},f(bp,function(t){return l(kB,e,h,g)},v))}),RB=function(e){return we(function(t){t(Se(e(Date.now())))})}(ml),$B=n(function(e,t,r){var n=f(Vh,t,r.taggers);if("Nothing"===n.$)return lp(r);var a=n.a,i=function(t){return Tp(f(xa,function(r){return f(Xh,e,r(t))},a))};return f(bp,function(e){return lp(r)},f(bp,i,RB))}),_B=r(function(e,t){var r=t.a,n=t.b;return f(bB,r,f(Da,e,n))});pn.Time=Pe(EB,NB,$B,0,_B);var LB=Ue("Time"),xB=r(function(e,t){return LB(f(bB,e,t))}),PB=function(e){return f(xB,2e3,mB)},DB=function(e){return vB},UB=function(e){return{$:"DecryptionFinished",a:e}},OB=Ge("decryptionFinished",LE),MB=Ge("encryptionFinished",LE),FB=function(e){return{$:"EncryptionFinished",a:e}},VB=function(e){return{$:"Refresh",a:e}},KB=function(e){return gB(M([f(xB,3e3,VB),MB(FB),OB(function(e){return XC(UB(e))})]))},HB=yn,jB=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return vB;case"CreateModel":t.a;return f(HB,fy,PB());case"TradeModel":t.a;return f(HB,hy,KB());case"MarketplaceModel":t.a;return f(HB,FS,DB());default:t.a;return f(HB,DS,yB())}},qB=Ge("userPubkeyResult",LE),GB=Ge("walletSentryPort",LE),zB={$:"CheckForNewTrades"},YB=function(e){return f(xB,5e3,function(e){return zB})},WB=function(e){return{$:"Tick",a:e}},JB=function(e){return{$:"UserPubkeySet",a:e}},QB=function(e){return{$:"WalletStatus",a:e}},XB=function(e){return f(Vf,"Error decoding JS walletSentry: "+e,ci)},ZB=function(e){return{$:"ErrorDecoding",a:e}},ek=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),tk=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(gh,"ref",BC),f(gh,"txHash",rA(jE))),rk=function(e){var t=f(Th,tk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(ek,r.ref,li(a))}return f(ek,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return ZB("Error decoding tx data")},nk=function(e){var t=e.a;return f(HB,t.tagger,t.inPort(rk))},ak=f(Oi,dB,BC),ik=Yo(f(Io,Ll,f(Io,sd("Failure decoding stringy int"),Uo(dB)))),ok=_E(M([ik,ak])),uk=r(function(e,t){return{account:e,networkId:t}}),sk=l(Mi,uk,f(gh,"account",rA(UE)),f(gh,"networkId",ok)),ck=n(function(e,t,r){var n=f(Th,sk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),fk=function(e){var t=f(Io,XB,f(Io,pa,US));return gB(U(M([f(xB,1e3,WB),GB(f(ck,t,QB)),f(hc,vB,f(Ao,nk,e.txSentry)),qB(JB),gB(f(Bi,r(function(e,t){return f(HB,VS(e),t)}),f(xa,YB,e.tradeCaches)))]),M([jB(e)])))},lk=function(e){return{$:"LinkClicked",a:e}},dk=function(e){return{$:"UrlChanged",a:e}},hk=n(function(e,t,r){return d(HI,e/255,t/255,r/255,1)}),pk=l(hk,10,33,108),gk={$:"Generic"},vk=gk,yk=r(function(e,t){return d(FI,rT,vk,f(ka,QS(WS),f(ka,zS(WS),e)),eT(M([t])))}),mk=function(e){return{$:"Fill",a:e}},bk=mk(1),Ck=Hi,Ek=function(e){return{$:"Px",a:e}},Sk=Ek,Tk=NT(8),wk=function(e){return f(zI,Tk,l(GI,"bg-"+YI(e),"background-color",e))},Ik=f(yk,M([QS(bk),zS(Sk(150)),wk(pk)]),Ck),Ak=function(e){return{$:"GotoRoute",a:e}},Bk={$:"Active"},kk={$:"Important"},Nk={$:"Normal"},Rk=l(jI,1,1,1),$k=NT(2),_k=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),Lk=r(function(e,t){return R(e,t)?f(zI,$k,h(_k,"p-"+Ni(e),e,e,e,e)):f(zI,$k,h(_k,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),xk=NT(21),Pk=r(function(e,t){return{$:"Class",a:e,b:t}}),Dk=f(Pk,xk,oT.cursorPointer),Uk=NT(17),Ok=function(e){return f(zI,Uk,l(CI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},Mk=function(e){return{$:"Normal",a:e}},Fk=An,Vk=r(function(e,t){return f(Fk,e,Mk(t))}),Kk=function(e){return f(Vk,"click",Fi(e))},Hk=f(Da,XS,Kk),jk=NT(13),qk=f(Pk,jk,oT.textSemiBold),Gk=NT(4),zk=function(e){return{$:"FontSize",a:e}},Yk=function(e){return f(zI,Gk,zk(e))},Wk=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([Ok(4),wk(l(jI,0,0,1))]);default:return M([Ok(4),wk(l(jI,.9,0,0))])}}();return f(yk,U(M([f(Lk,23,12),Yk(22),qk,WI(Rk),Dk,Hk(t)]),n),Ff(e))}),Jk=l(hk,244,0,103),Qk=function(e){return{$:"AlignX",a:e}},Xk={$:"CenterX"},Zk=Qk(Xk),eN=NT(3),tN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),rN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),nN=function(e){return f(zI,eN,l(tN,f(rN,e,e),e,e))},aN=function(e){return{$:"Describe",a:e}},iN={$:"Paragraph"},oN=r(function(e,t){return d(FI,bT,vk,f(ka,aN(iN),f(ka,QS(bk),f(ka,nN(5),e))),eT(t))}),uN=f(Pk,jk,oT.bold),sN=f(yk,M([Yk(29),WI(Rk),uN,Zk,Dk,Hk(Ak(bv))]),f(oN,yr,M([Ff("DAI"),f(yk,M([WI(Jk)]),Ff("Hard"))]))),cN={$:"Right"},fN=Qk(cN),lN={$:"AsColumn"},dN=lN,hN=r(function(e,t){return d(FI,dN,vk,f(ka,VI(oT.contentTop+" "+oT.contentLeft),f(ka,zS(WS),f(ka,QS(WS),e))),eT(t))}),pN={$:"AsRow"},gN=pN,vN=r(function(e,t){return d(FI,gN,vk,f(ka,VI(oT.contentLeft+" "+oT.contentCenterY),f(ka,QS(WS),f(ka,zS(WS),e))),eT(t))}),yN=function(e){return f(vN,M([QS(bk),nN(30),f(Lk,30,17)]),M([l(Wk,"Browse Offers",Ak(Cv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Bk}return Nk}()),l(Wk,"Create a New Offer",Ak(mv),function(){return"CreateModel"===e.submodel.$?Bk:Nk}()),function(){var t=Td(e.wallet);if("Just"===t.$){var r=t.a;return l(Wk,"My Trades",Ak(yv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Bk:Nk}return Nk}())}return l(Wk,"Connect to Wallet",MS,kk)}(),f(hN,M([fN,nN(0),f(Lk,8,0)]),M([sN]))]))},mN=HI,bN=r(function(e,t){return f(yk,M([Ok(4),wk(d(mN,0,0,1,.1)),WI(l(hk,16,7,234)),Yk(e),qk,f(Lk,15,13)]),Ff(Kf(t)))}),CN=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),EN=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(zI,$k,h(_k,"p-"+Ni(t),t,t,t,t)):f(zI,$k,h(_k,d(CN,t,r,n,a),t,r,n,a))},SN=function(e){return function(){var t=Td(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?f(yk,M([f(Lk,30,10),Yk(24),qk]),Ff("Your Trades")):f(vN,M([nN(10),EN({bottom:30,left:30,right:30,top:10})]),M([f(yk,M([Yk(24),qk]),Ff("Trade History for User")),f(bN,18,e.agentAddress)]))},TN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},wN=function(e){return Yf(e)},IN={$:"BurnWindow"},AN={$:"FiatPrice"},BN={$:"Margin"},kN={$:"Offer"},NN={$:"PaymentWindow"},RN=function(e){return{$:"AlignY",a:e}},$N={$:"CenterY"},_N=RN($N),LN=NT(20),xN=f(Pk,LN,oT.clip),PN=mk,DN=function(e){return f(zI,$k,h(_k,"p-"+Ni(e),e,e,e,e))},UN=r(function(e,t){return f(yk,M([QS(PN(e)),zS(Sk(60)),xN,wk(Rk)]),f(yk,M([DN(12),_N,QS(bk)]),t))}),ON=function(e){switch(e.$){case"Phase":return 1;case"Expires":return 2;case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},MN=function(e){return{$:"JustImage",a:e}},FN=MN({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),VN=KS("alt"),KN=function(e){return f(KS,"src",rt(e))},HN=r(function(e,t){var r=t.src,n=t.description,a=f(Yf,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(FI,rT,vk,f(ka,VI(oT.imageContainer),e),eT(M([d(FI,rT,ZS("img"),U(M([XS(KN(r)),XS(VN(n))]),a),eT(yr))])))}),jN=r(function(e,t){if("None"===t.$)return Ck;var r=t.a;return f(HN,e,r)}),qN=MN({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),GN=function(e){return{$:"ChangeSort",a:e}},zN=f(Pk,jk,oT.textMedium),YN=function(e){return f(yk,M([zN,Yk(17)]),Ff(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},WN=r(function(e,t){return f(vN,M([nN(5),Dk,Hk(GN(e))]),M([YN(e),function(){if("Just"===t.$){var e=t.a;return f(yk,M([_N]),f(jN,M([QS(Sk(8))]),function(){return"Ascending"===e.$?qN:FN}()))}return Ck}()]))}),JN=r(function(e,t){return f(UN,ON(t),f(WN,t,e))}),QN=r(function(e,t){return f(vN,M([QS(bk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(JN,r,t)},t))}),XN=l(hk,150,150,150),ZN=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},eR=r(function(e,t){return f(xu,e.amount,t.amount)}),tR=r(function(e,t){return f(xu,El(e),El(t))}),rR=n(function(e,t,r){return f(e,r,t)}),nR=function(e){var t=e.a;return(R(e.b,lo)?rR:Ua)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(nR,L(Jg,Nf),e,t):f(Eu,ZN(e.state.phase),ZN(t.state.phase))});case"Expires":return r(function(e,t){return f(qg,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(tR,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(eR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(hc,ma,l(wd,r(function(e,t){return f(Eu,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(qg,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(qg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},aR=l(hk,233,237,242),iR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),oR=function(e){return f(yk,M([QS(bk),zS(bk),xN]),f(oN,M([Yk(12)]),M([Ff(e.info)])))},uR=function(e){return f(hc,Ck,f(Ao,oR,kl(e)))},sR=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"}},cR=function(e){return{$:"TimeLeft",a:e}},fR=function(e){return{$:"TimeUp",a:e}},lR=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 ml(0)}}),dR=r(function(e,t){return ml(Ed(e)-Ed(t))}),hR=r(function(e,t){var r=f(lR,t.state.phase,t),n=f(dR,e,t.state.phaseStartTime),a=f(dR,r,n);return Ed(a)>0?cR(L(a,r)):fR(r)}),pR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},gR=l(jI,0,0,0),vR=l(hk,51,183,2),yR=function(e){var t=Tu(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Ro(n));return n+(function(){if(a){return f(Po,a+1,f(_o,1,YT(r)))}return""}()+"%")},mR=r(function(e,t){return MN({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"}()})}),bR=n(function(e,t,r){return f(jN,f(ka,zS(Sk(34)),e),f(mR,t,r))}),CR=r(function(e,t){var r=yR(t);if("0%"===r)return f(yk,M([Yk(16)]),Ff("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?vR:Jk;return f(vN,M([nN(4)]),M([l(bR,yr,a,si(i)),f(yk,M([WI(o),Yk(16)]),Ff(n))]))}),ER=MN,SR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(fl,r,n,t)}),Fh,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,ER({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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","₫")]))),TR=function(e){return f(hc,"",f(Ao,Qa,f(Vh,e,SR)))},wR=function(e){return Ro(e)<=3?e:wR(f(ed,3,e))+","+f(Mo,3,e)},IR=function(e){return wR(Zl(e))},AR=function(e){return U(TR(e.fiatType),IR(e.amount))},BR=function(e){var t=function(){var t=f(Vh,e.fiatType,SR);if("Nothing"===t.$)return Ck;var r=t.a,n=(r.a,r.b);return f(jN,M([zS(Sk(26))]),n)}();return f(vN,M([nN(4)]),M([t,f(yk,M([WI(d(mN,0,0,0,.5)),zN,QS(Sk(50))]),Ff(e.fiatType)),Ff(AR(e))]))},kR=function(e){return Ed(e)<0},NR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),RR=function(e){var t=zp(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(NR,Ob(t),Ob(r),Ob(n),Ob(a))}(f(hc,L(wu(0),wu(0)),f(rs,n,wu(60))))}(f(hc,L(wu(0),wu(0)),f(rs,r,wu(3600))))}(f(hc,L(wu(0),wu(0)),f(rs,t,wu(86400))))},$R=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!kR(a)){var u=r(function(e,t){return U(l(cs,2,P("0"),Ni(e)),t)}),s=Ed(a)>0?i:o,c=RR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(vN,U(M([nN(5)]),e),M([f(yk,U(M([WI(h)]),t),Ff(f(u,c.days,"d"))),f(yk,U(M([WI(d)]),t),Ff(f(u,c.hours,"h"))),f(yk,U(M([WI(s)]),t),Ff(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=ml(0);e=p,t=g,n=v,a=y}}),_R={$:"Behind"},LR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),xR=function(e){return f(LR,_R,e)},PR=r(function(e,t){var r=Fg(200*e),n=200-r,a=f(yk,M([QS(PN(n))]),Ck),i=M([zS(Sk(3)),Ok(20)]),o=f(yk,U(i,M([QS(PN(r)),wk(t)])),Ck),u=f(yk,U(i,M([QS(bk),wk(aR)])),Ck);return f(vN,M([QS(bk),xR(u)]),M([o,a]))}),DR=l(jI,1,1,0),UR=r(function(e,t){return Ed(e)/Ed(t)}),OR=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(UR,o,u),c=(f(yk,M([Zk]),d($R,yr,yr,L(a,i),o)),s<.1?Jk:s<.2?DR:vR);return f(hN,U(M([nN(5)]),e),M([d($R,M([Zk]),t,L(a,i),o),f(PR,1-s,c)]))}),MR=function(e){var t=td(El(e)),r=f(Nl,".",t);if(!r.b)return t;if(r.b.b){Mf("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Po,3,t);case 1:return f(Po,4,f(hc,t,f(Ao,YT,f(Ao,function(e){return e/100},f(Ao,Ka,f(Ao,Fg,f(Ao,ti(100),ad(t))))))));default:var n=r.a;return f(hc,f(Po,n,t),f(Ao,Ni,f(Ao,Fg,ad(t))))}},FR=n(function(e,t,r){return f(UN,ON(t),function(){switch(t.$){case"Phase":return Ff(pR(r.state.phase));case"Expires":if("Open"===r.state.phase.$){var n=f(hR,e,r);if("TimeLeft"===n.$){var a=n.a,i=f(UR,a.a,a.b)<.05?Jk:gR;return d(OR,M([QS(bk)]),M([Yk(16)]),L(i,aR),a)}var o=n.a;return d(OR,M([QS(bk)]),M([Yk(16)]),L(Jk,aR),L(ml(0),o))}return Ck;case"Offer":return f(vN,M([nN(5)]),M([Ff(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(MR(r.parameters.tradeAmount)+" ")+sR(r.factory))]));case"FiatPrice":return BR(r.terms.price);case"Margin":var u=R(r.parameters.initiatorRole,sb);return f(hc,Ck,f(Ao,CR(u),r.derived.margin));case"PaymentWindow":var s=function(){return"Seller"===r.parameters.initiatorRole.$?Jk:vR}(),c=_(Ed(r.parameters.autoabortInterval),216e5)<0?s:gR;return d($R,yr,yr,L(c,aR),r.parameters.autoabortInterval);default:var s=function(){return"Seller"===r.parameters.initiatorRole.$?vR:Jk}(),c=_(Ed(r.parameters.autoabortInterval),216e5)<0?s:gR;return d($R,yr,yr,L(c,aR),r.parameters.autoreleaseInterval)}}())}),VR=n(function(e,t,r){return f(hN,M([QS(bk),nN(1),wk(aR),Dk,Hk(f(iR,r.factory,r.id))]),M([f(vN,M([QS(PN(6)),nN(1)]),f(xa,function(t){return l(FR,e,t,r)},t)),f(UN,1,uR(r.terms.paymentMethods))]))}),KR=Er,HR=NT(28),jR=function(e){return f(zI,HR,l(GI,"bc-"+YI(e),"border-color",e))},qR=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),GR=function(e){return f(zI,PI,h(qR,"b-"+Ni(e),e,e,e,e))},zR=a(function(e,t,r,n){return f(hN,M([QS(bk),GR(2),Ok(8),jR(XN),nN(2),wk(XN),xN]),f(xa,f(VR,e,r),f(KR,nR(t.orderBy),n)))}),YR=a(function(e,t,r,n){return f(hN,M([QS(bk),zS(bk),DN(30),nN(5)]),M([f(QN,t.orderBy,r),d(zR,e,t,r,n)]))}),WR=n(function(e,t,r){return R(t,yr)?Ck:f(Yi,Eo,d(YR,e,r.tradeTable,M([ho,kN,AN,BN,NN,IN]),t))}),JR=function(e){return f(Yf,function(e){return qm(e.parameters)},vS(e))},QR={$:"NoneFound"},XR={$:"AllFetched"},ZR={$:"FetchingTrades"},e$={$:"QueryingNumTrades"},t$=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return e$;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?ZR:XR}return QR},r$=n(function(e,t,r){var n=$v(f(xa,function(e){return f(wN,TN(r),JR(e))},t)),a=n,i=function(e){return f(yk,M([Yk(24),qk,WI(XN),Zk,DN(20)]),Ff(e))},o=f(Xd,Ja(QR),f(xa,t$,t))?M([i("No trades found.")]):f(xa,i,IC(f(xa,function(e){switch(t$(e).$){case"QueryingNumTrades":return si(KA(e.factory)+"Querying Factory...");case"NoneFound":return ci;case"FetchingTrades":return si(KA(e.factory)+"Fetching Trades");default:return ci}},t)));return f(hN,M([nN(10)]),M([function(){return o.b?f(hN,M([nN(5)]),o):Ck}(),l(WR,e,a,r)]))}),n$=n(function(e,t,r){return f(hN,M([Ok(5),wk(Rk),QS(bk),zS(bk),f(Lk,0,20)]),M([SN(r),l(r$,e,t,r)]))}),a$=function(e){return{$:"ShowCurrencyDropdown",a:e}},i$={$:"AbortCreate"},o$=function(e){return{$:"AppCmd",a:e}},u$=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),s$=function(e){return f(xa,function(e){return M([f(yk,M([WI(Jk)]),Ff("Caution! ")),Ff(e)])},IC(M([R(f(qg,e.autoreleaseInterval,ml(12e5)),ba)?si(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."}()):ci,R(f(qg,e.autoabortInterval,ml(36e5)),ba)?si(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.'}()):ci])))},c$=l(jI,0,0,1),f$=function(e){return f(yk,M([EN({bottom:5,left:5,right:5,top:0}),Hk(e),Ok(30),wk(d(mN,1,1,1,.4)),GR(1),jR(d(mN,0,0,0,.3)),Dk,Yk(14)]),f(yk,M([WI(d(mN,0,0,0,.7))]),Ff("x")))},l$=Bn,d$=l$,h$=XS,p$=r(function(e,t){return f(yk,M([xR(f(yk,M([wk(e),h$(f(d$,"position","fixed")),h$(f(d$,"z-index","1000")),h$(f(d$,"top","0")),h$(f(d$,"left","0")),h$(f(d$,"width","100%")),h$(f(d$,"height","100%"))]),Ck)),QS(bk),zS(bk)]),t)}),g$={$:"Top"},v$=RN(g$),y$={$:"InFront"},m$=function(e){return f(LR,y$,e)},b$=r(function(e,t){return{$:"Max",a:e,b:t}}),C$=r(function(e,t){return f(b$,e,t)}),E$=n(function(e,t,r){return l(Pa,p$,d(mN,0,0,.3,.6),f(yk,U(M([Zk,_N,QS(f(C$,500,WS)),wk(Rk),Ok(8),m$(f(yk,M([fN,v$]),f$(r)))]),e),t))}),S$=r(function(e,t){if("Nothing"===t.$)return Ck;var r=t.a;return f(yk,U(M([Ok(5),jR(l(jI,.9,0,0)),GR(1),wk(l(jI,1,.4,.4)),DN(5),Zk,_N,QS(f(C$,200,WS)),Yk(14)]),e),f(oN,yr,M([Ff(r)])))}),T$={$:"Above"},w$=function(e){return f(LR,T$,e)},I$=NT(26),A$=function(e){return{$:"MoveY",a:e}},B$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),k$=function(e){return f(B$,I$,A$(-e))},N$=r(function(e,t){return f(yk,M([Ok(4),f(Lk,25,17),Yk(18),qk,wk(aR),w$(f(S$,M([k$(5)]),t))]),Ff(e))}),R$=a(function(e,t,r,n){return d(HI,e/255,t/255,r/255,n)}),$$=d(R$,1,31,52,.64),_$=NT(32),L$={$:"Active"},x$=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),P$=$n,D$={$:"NoAttribute"},U$=r(function(e,t){switch(t.$){case"NoAttribute":return D$;case"Describe":var r=t.a;return aN(r);case"AlignX":var n=t.a;return Qk(n);case"AlignY":var a=t.a;return RN(a);case"Width":var n=t.a;return JS(n);case"Height":var n=t.a;return GS(n);case"Class":var n=t.a,a=t.b;return f(Pk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(zI,i,o);case"Nearby":var u=t.a,s=t.b;return f(LR,u,f(zi,e,s));case"Attr":var c=t.a;return XS(f(P$,e,c));default:var l=t.a,d=t.b;return f(B$,l,d)}}),O$=function(e){return f(U$,Ig,e)},M$=r(function(e,t){var r=t.a,n=t.b,a=O$(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(_I,n,o));default:return L(r,n)}}),F$=function(e){var t=l(Ra,M$,L(yr,OI),e),r=t.a,n=t.b;return f(ka,EI(n),r)},V$=function(e){return f(zI,_$,f(x$,L$,F$(e)))},K$=NT(33),H$={$:"Hover"},j$=function(e){return f(zI,K$,f(x$,H$,F$(e)))},q$=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(yk,M([Ok(4),Dk,Hk(n),f(Lk,25,17),WI(t),Yk(18),qk,wk(a),V$(M([wk(o)])),j$(M([wk(i)]))]),Ff(r))}),G$=r(function(e,t){return d(q$,x(d(mN,1,0,0,1),d(mN,1,0,0,.8),d(mN,1,0,0,.6)),Rk,e,t)}),z$=NT(12),Y$=f(Pk,z$,oT.textCenter),W$=function(e){return p$(d(mN,0,0,.3,.6))(f(hN,M([nN(10),Zk,_N,wk(d(mN,0,0,0,.5)),Ok(8),DN(20)]),f(xa,function(e){return f(oN,M([Zk,_N,Yk(20),qk,WI(Rk),Y$]),M([e]))},e)))},J$=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+aA(t)}e.a;return"https://kovan.etherscan.io/tx/"+aA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+aA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+aA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+aA(t)}}),Q$={$:"Bottom"},X$=RN(Q$),Z$=VI(oT.underline),e_=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(Ff(MR(fb(a))),f(G$,"Yes, I definitely want to open this trade.",l(u$,r,n,a)))}return L(Ff("??"),f(N$,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(E$,yr,f(hN,M([nN(20),DN(20),Zk,zS(bk),Y$]),M([f(yk,M([Yk(26),qk,Zk,_N]),Ff("Just to Confirm...")),f(hN,M([nN(20),Zk,_N]),f(xa,oN(M([Zk,Yk(18),zN,WI($$)])),U(s$(n),U(M([M([Ff("You will deposit "),i,Ff(" "+sR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([Ff("This ususally requires two Metamask signatures. Your "+sR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(yk,M([X$,Zk]),o)])),i$);case"ApproveNeedsSig":var u=e.a;return f(yk,M([Hk(o$(d(Rd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),W$(M([Ff("Waiting for user signature for the approve call."),Ff("(check Metamask!)"),Ff("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(yk,M([Hk(o$(d(Rd,"txChainModal clicked","misclick","ApproveMining",0)))]),W$(M([Ff("Mining the initial approve transaction..."),f(KI,M([Z$,WI(c$)]),{label:Ff("See the transaction on Etherscan"),url:f(J$,eo(u),s)}),Ff("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(yk,M([Hk(o$(d(Rd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),W$(M([Ff("Waiting for user signature for the create call."),Ff("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(yk,M([Hk(o$(d(Rd,"txChainModal clicked","misclick","CreateMining",0)))]),W$(M([Ff("Mining the final create call..."),f(KI,M([Z$,WI(c$)]),{label:Ff("See the transaction on Etherscan"),url:f(J$,r,s)}),Ff("You will be redirected when it's mined.")])))}}),t_=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Ck;var r=t.a;return f(e_,r,e)},r_=function(e){return{$:"TradeAmountChanged",a:e}},n_=KS("id"),a_=h$(n_("inputError")),i_=l(hk,109,127,138),o_=MN({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),u_=function(e){return f(jN,f(ka,zS(Sk(26)),e),o_)},s_=function(e){return f(vN,M([nN(4)]),M([u_(yr),f(yk,M([Yk(24),zN,WI(i_)]),Ff(sR(e)))]))},c_={$:"Left"},f_=Qk(c_),l_=function(e){return{$:"HiddenLabel",a:e}},d_=l_,h_=KS("type"),p_=function(e){return L(e,!0)},g_=function(e){return{$:"MayStopPropagation",a:e}},v_=r(function(e,t){return f(Fk,e,g_(t))}),y_=r(function(e,t){return l(La,gh,t,e)}),m_=f(y_,M(["target","value"]),zo),b_=function(e){return f(v_,"input",f(Oi,p_,f(Oi,e,m_)))},C_=NT(0),E_=r(function(e,t){return{$:"Transparency",a:e,b:t}}),S_=function(e){var t=function(e){return 1-e}(f(rc,1,f(ei,0,e)));return f(zI,C_,f(E_,"transparency-"+KT(t),t))},T_=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),w_=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(FI,dN,ZS("label"),e,eT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(FI,rT,vk,a,eT(M([i])));switch(n.$){case"Above":return d(FI,dN,ZS("label"),e,eT(M([o,r])));case"Below":return d(FI,dN,ZS("label"),e,eT(M([r,o])));case"OnRight":return d(FI,gN,ZS("label"),e,eT(M([r,o])));default:return d(FI,gN,ZS("label"),e,eT(M([o,r])))}}),I_=fI,A_=f(Da,XS,I_("autocomplete")),B_=l(jI,136/255,138/255,133/255),k_=l(jI,186/255,189/255,182/255),N_=f(Lk,12,12),R_=l(jI,1,1,1),$_=M([N_,Ok(3),jR(k_),wk(R_),GR(1),nN(3),QS(bk)]),__=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},L_=function(e){return f(Qd,__,e)?D$:VI("focusable")},x_=function(e){return{$:"Label",a:e}},P_=function(e){if("HiddenLabel"===e.$){var t=e.a;return aN(x_(t))}return D$},D_=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},U_=function(e){return"HiddenLabel"===e.$},O_=ye,M_=r(function(e,t){return f(kn,e,O_(t))}),F_=M_("spellcheck"),V_=f(Da,XS,F_),K_=W,H_=NT(47),j_=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(K_(e))),o=(i-1)*t+f(hc,0,f(Ao,a,r))+f(hc,0,f(Ao,a,n));return f(zI,H_,l(CI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),q_=KS("value"),G_=f(Da,XS,q_),z_={$:"LivePolite"},Y_=aN(z_),W_=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(FT,"width",n)?L(r,n):L(f(ka,e,r),f(aS,"width",n));case"Height":e.a;return f(FT,"height",n)?L(r,n):L(f(ka,e,r),f(aS,"height",n));case"Describe":e.a;return f(FT,"described",n)?L(r,n):L(f(ka,e,r),f(aS,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(FT,"align-x",n)?L(r,n):L(f(ka,e,r),f(aS,"align-x",n));case"AlignY":return f(FT,"align-y",n)?L(r,n):L(f(ka,e,r),f(aS,"align-y",n));default:return f(FT,"transform",n)?L(r,n):L(f(ka,e,r),f(aS,"transform",n))}}),L(yr,Py),e).a},J_=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,W_(e))}),Q_=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}},X_=f(Da,Gi,Qu),Z_=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([XS(b_(n.onChange))]),o=U($_,t),u=f(J_,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(Yf,D_,o),c=f(J_,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(J_,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(J_,o,function(e){return"Nearby"===e.$})),p=f(Yf,f(Da,Du,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([G_(n.text),XS(h_(a)),V_(e.spellchecked),VI(oT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return D$;var r=t.a;return A_(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(Q_(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(T_,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(T_,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(hc,5,c);return x("textarea",U(M([V_(e.spellchecked),VI(oT.inputMultiline),f(hc,D$,f(Ao,A_,e.autofill)),function(){if("Nothing"===u.$)return D$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return EN({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?D$:s.a?d(j_,n.text,v,u,g):D$}()]),h),M([X_(oI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(FI,rT,vk,f(ka,QS(bk),$v(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([m$(f(yk,f(ka,N_,U(s,U(M([WI(B_),VI(oT.noTextSelection+" "+oT.passPointerEvents),jR(d(mN,0,0,0,0)),wk(d(mN,0,0,0,0)),zS(bk),QS(bk),S_(""===n.text?1:0)]),r))),a))])}()]))),eT(M([d(FI,rT,ZS(v),$v(M([M([L_(t),P_(n.label)]),y,i])),eT(m))])));return l(w_,f(ka,f(Pk,xk,oT.cursorText),f(ka,U_(n.label)?D$:nN(5),f(ka,Y_,u))),n.label,b)}),eL=Z_({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),tL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(eL,M([QS(bk),zS(Sk(40)),GR(0)]),{label:d_(r),onChange:i,placeholder:n,text:a});return f(vN,U(M([nN(5)]),e),IC(M([f(Ao,yk(M([f_])),o),si(s),f(Ao,yk(M([fN])),u)])))}),rL={$:"Below"},nL=function(e){return f(LR,rL,e)},aL=function(e){return f(B$,I$,A$(e))},iL=n(function(e,t,r){return p(tL,M([QS(Sk(150)),zN,Yk(24),nL(f(S$,M([a_,aL(5)]),r))]),L(ci,si(f(yk,M([Hk(o$(d(Rd,"click","misclick","dai symbol in dai input",0)))]),s_(e)))),"dai input",ci,t,r_)}),oL=r(function(e,t){return f(zI,PI,h(qR,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),uL=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?GR(r):f(oL,n,r):f(zI,PI,h(qR,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},sL=yk(M([jR(aR),uL({bottom:2,left:0,right:0,top:0})])),cL=r(function(e,t){return f(hN,M([nN(10)]),M([f(yk,M([Yk(17),qk]),Ff(e)),t]))}),fL=r(function(e,t){return sL(f(cL,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(iL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),lL=function(e){return f(hc,wE,yg(e))},dL=function(e){var t=function(){var t=zl(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+MR(f(Tl,r,100))+" "+sR(lL(e.wallet))+"."}return"There is a 1% fee."}();return f(vN,M([Zk,f(Lk,20,10),wk(l(hk,10,33,108)),Ok(8),nN(5),Hk(o$(d(Rd,"click","misclick","fee notify element",0)))]),M([f(yk,M([Yk(18),WI(l(hk,0,226,255)),qk]),Ff(t)),f(yk,M([Yk(17),WI(Rk),zN]),Ff("We only collect this fee when trades resolve successfully."))]))},hL=function(e){return{$:"FiatAmountChanged",a:e}},pL=function(e){return{$:"FiatTypeChanged",a:e}},gL=r(function(e,t){return l(eS,n(function(t,r,n){return f(e,t,r)?l(fl,t,r,n):n}),Fh,t)}),vL=function(e){return f(gL,r(function(t,r){return f(Ng,e,t)}),SR)},yL=MN({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),mL=function(e){return f(jN,M([zS(Sk(26))]),f(hc,yL,f(Ao,Ho,f(Vh,e,SR))))},bL=function(e){return h$(f(v_,"click",Fi(L(e,!0))))},CL=X_,EL=function(e){return{$:"AppendProperty",a:e}},SL=r(function(e,t){return EL(e+":"+t)}),TL=r(function(e,t){return f(SL,e,t.value)}),wL=TL("cursor"),IL={$:"Compatible"},AL={cursor:IL,value:"default"},BL=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),kL=function(e){return{$:"PseudoClassSelector",a:e}},NL=function(e){return BL(kL(e))}("hover"),RL=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),$L=RL,_L=$L,LL=_L("span"),xL=r(function(e,t){return f(kn,et(e),rt(t))}),PL=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),DL=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),UL=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),OL=r(function(e,t){return t<>>32-e}),ML=function(e){var t=e.hash?e.seed^f(UL,461845907,f(OL,15,f(UL,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(UL,2246822507,r^r>>>16),a=f(UL,3266489909,n^n>>>13);return(a^a>>>16)>>>0},FL=r(function(e,t){return f(UL,5,f(OL,13,e^f(UL,461845907,f(OL,15,f(UL,3432918353,t)))))+3864292196}),VL=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},Wx=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+"]"}},Jx=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,Wx,r)));case"UniversalSelectorSequence":var r=e.a;return au(r)?"*":f(Ri,"",f(xa,Wx,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,Wx,r)))}},Qx=function(e){var t=e.a,r=e.b;return f(Ri," ",M([Yx(t),Jx(r)]))},Xx=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,Jx(t),f(xa,Qx,r)),i=f(Ri,"",M([f(hc,"",f(Ao,zx,n))]));return f(Ms,f(Ri," ",f(Yf,f(Da,Du,cd),a)),i)},Zx=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,Xx,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,Gx(a),"\n",e,"}"]))}),eP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(Zx,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,Fx,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,jx,Zx(" ")),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"}},tP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(Yf,f(Da,Du,cd),M([Ux(t),f(Ri,"\n",f(xa,Kx,r)),f(Ri,"\n",f(xa,Hx,n)),f(Ri,"\n\n",f(xa,eP,a))])))},rP=function(e){return tP(Dx(Lx(e)))},nP=function(e){return f(Ri,"\n\n",f(xa,rP,e))},aP=function(e){return{$:"Snippet",a:e}},iP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),oP=function(e){return{$:"StyleBlockDeclaration",a:e}},uP=r(function(e,t){var r=l(ox,t,yr,ci);return aP(M([oP(l(iP,r,yr,e))]))}),sP=function(e){return au(e)?"unstyled":f(as,P("_"),ps(f(KL,15739,nP(uS(HL(uS(f(uP,e,mx(yr)))))))))},cP=function(e){var t=sP(e),r=f(xL,"className",Hf(t));return l(PL,r,e,t)},fP=a(function(e,t,r,n){return f(e,f(ka,cP(t),r),n)}),lP=function(e){return{$:"Unstyled",a:e}},dP=function(e){return lP(ZT(e))},hP=dP,pP=r(function(e,t){return f(Tn,e,Xe(t))}),gP=function(e){return En(Xe(e))},vP=r(function(e,t){var r=e.b,n=e.c;return au(r)?t:l(fl,n,r,t)}),yP=function(e){return e.a},mP=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,vP,i,s),p=l(Ra,bP,L(yr,h),c),g=p.a,v=p.b,o=l(AT,u,f(xa,yP,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,vP,i,s),m=l(Ra,bP,L(yr,h),c),g=m.a,v=m.b,o=d(gP,y,u,f(xa,yP,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,vP,i,s),b=l(Ra,mP,L(yr,h),c),g=b.a,v=b.b,o=l(IT,u,f(xa,yP,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,vP,i,s),C=l(Ra,mP,L(yr,h),c),g=C.a,v=C.b,o=d(pP,y,u,f(xa,yP,s),$a(g));return L(f(ka,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(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,vP,n,o),c=l(Ra,bP,L(yr,s),u),h=c.a,p=c.b,a=l(AT,i,f(xa,yP,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,vP,n,o),v=l(Ra,bP,L(yr,s),u),h=v.a,p=v.b,a=d(gP,g,i,f(xa,yP,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,vP,n,o),y=l(Ra,mP,L(yr,s),u),h=y.a,p=y.b,a=l(IT,i,f(xa,yP,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,vP,n,o),m=l(Ra,mP,L(yr,s),u),h=m.a,p=m.b,a=d(pP,g,i,f(xa,yP,o),$a(h));return L(f(ka,a,r),p)}}),CP=r(function(e,t){return h(il,al,e,t,ol,ol)}),EP=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(cd(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),SP=function(e){var t=f(EP,ci,e);if("Nothing"===t.$)return Fh;var r=t.a,n=r.a,a=r.b;return f(CP,n,a)},TP=function(e){return{$:"ClassSelector",a:e}},wP=function(e){var t=e.a,r=e.b;return f(uP,r,mx(M([TP(t)])))},IP=function(e){return nP(uS(HL(f(xa,wP,Ia(e)))))},AP=function(e){return l(AT,"style",yr,uS(ZT(IP(e))))},BP=n(function(e,t,r){var n=f(xa,yP,t),a=SP(t),i=l(Ra,bP,L(yr,a),r),o=i.a,u=i.b,s=AP(u);return l(AT,e,n,f(ka,s,$a(o)))}),kP=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),NP=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(kP,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),RP=r(function(e,t){return L(f(NP,"_",t),AP(e))}),$P=n(function(e,t,r){var n=f(xa,yP,t),a=SP(t),i=l(Ra,mP,L(yr,a),r),o=i.a,u=i.b,s=f(RP,u,o);return l(IT,e,n,f(ka,s,$a(o)))}),_P=a(function(e,t,r,n){var a=f(xa,yP,r),i=SP(r),o=l(Ra,mP,L(yr,i),n),u=o.a,s=o.b,c=f(RP,s,u);return d(pP,e,t,a,f(ka,c,$a(u)))}),LP=a(function(e,t,r,n){var a=f(xa,yP,r),i=SP(r),o=l(Ra,bP,L(yr,i),n),u=o.a,s=o.b,c=AP(s);return d(gP,e,t,a,f(ka,c,$a(u)))}),xP=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(BP,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(LP,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l($P,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(_P,a,t,r,n)}},PP=xP,DP=function(e){return CL(PP(d(fP,LL,M([NL(M([wL(AL)]))]),yr,M([hP(e)]))))},UP=J,OP=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),MP=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),FP=function(e){return l(La,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 si(h(OP,n,a,i,o,u))}return ci}(),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 si(l(MP,a,t,i))}return ci}())}),L(ci,ci),e)},VP=r(function(e,t){var r=FP(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(FI,gN,vk,f(ka,VI(oT.contentLeft+" "+oT.contentCenterY+" "+oT.wrapped),f(ka,QS(WS),f(ka,zS(WS),e))),eT(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?si(EN({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(FI,gN,vk,f(ka,VI(oT.contentLeft+" "+oT.contentCenterY+" "+oT.wrapped),f(ka,QS(WS),f(ka,zS(WS),U(e,M([h]))))),eT(t))}var p=-s/2,g=-u/2;return d(FI,rT,vk,e,eT(M([d(FI,gN,vk,f(ka,VI(oT.contentLeft+" "+oT.contentCenterY+" "+oT.wrapped),f(ka,XS(f(d$,"margin",YT(p)+"px "+YT(g)+"px")),f(ka,XS(f(d$,"width","calc(100% + "+Ni(u)+"px)")),f(ka,XS(f(d$,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(zI,eN,l(tN,o,u,s)),yr))))),eT(t))])))}),KP=i(function(e,t,r,n,a){var i=f(eL,M([QS(Sk(80)),zS(Sk(40)),Yk(24),zN,jR(aR),bL(r)]),{label:d_("currency type"),onChange:f(Io,UP,n),placeholder:ci,text:t}),o=f(Vh,t,SR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return Ck;r.b;return f(VP,M([QS(Sk(350)),jR(gR),GR(1),wk(Rk),DN(10),Zk]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(vN,M([QS(Sk(80)),nN(9),f(Lk,0,5),bL(n(t)),j$(M([wk(l(jI,.8,.8,1))]))]),M([f(jN,M([zS(Sk(26))]),a),f(yk,M([Yk(16),qk]),DP(t))]))},Ia(vL(t))))}return Ck}();return f(vN,M([nN(4),nL(u)]),M([f(yk,M([Hk(a)]),mL(t)),i]))}),HP=i(function(e,t,r,n,a){var i=o$(d(Rd,"click","misclick","currency flag",0)),o=f(yk,M([Hk(o$(d(Rd,"click","misclick","currency symbol",0)))]),Ff(TR(e))),u=f(yk,M([nL(f(S$,M([a_,aL(5)]),a))]),h(KP,r,e,a$(!0),pL,i));return p(tL,M([QS(Sk(250)),zN,Yk(24),nL(f(S$,M([a_,aL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,hL)}),jP=function(e){return sL(f(cL,"For fiat",h(HP,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},qP=function(e){return{$:"ChangeRole",a:e}},GP=d(R$,1,31,52,.13),zP=r(function(e,t){var r=M([Yk(24),zN,Dk]),n=function(){return"Buyer"===t.$?L(r,U(r,M([WI(GP)]))):L(U(r,M([WI(GP)])),r)}(),a=n.a,i=n.b;return f(vN,M([nN(20)]),M([f(yk,U(M([Hk(qP(vl))]),i),Ff("Sell "+e)),f(yk,U(M([Hk(qP(sb))]),a),Ff("Buy "+e))]))}),YP=r(function(e,t){return f(cL,"Trade Type",f(zP,sR(e),t.inputs.userRole))}),WP=NT(19),JP=function(e){return Ql(M([e.inset?"box-inset":"box-",YT(e.offset.a)+"px",YT(e.offset.b)+"px",YT(e.blur)+"px",YT(e.size)+"px",YI(e.color)]))},QP=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(zI,WP,l(CI,JP(t),"box-shadow",JT(t)))},XP=QP({blur:20,color:d(R$,0,0,0,.04),offset:L(0,3),size:0}),ZP=f(Pk,eN,oT.spaceEvenly),eD=function(e){var t=lL(e.wallet);return f(hN,M([QS(bk),nN(20),wk(Rk),Ok(5),DN(20),XP]),M([f(vN,M([QS(bk),ZP]),M([f(YP,t,e),f(fL,t,e),jP(e)])),dL(e)]))},tD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),rD={$:"Web3Connect"},nD=function(e){return f(yk,M([Zk]),function(){var t=L(Td(e),yg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(G$,"Open Trade",f(tD,n,r))}t.b;return f(N$,"Unsupported Network",ci)}t.a;return f(G$,"Connect to Wallet",rD)}())},aD=function(e){return{$:"AutoabortIntervalChanged",a:e}},iD=function(e){return{$:"ChangePaymentMethodText",a:e}},oD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),uD=oD,sD=function(e){return f(uD,M([WI(d(mN,0,0,0,.2))]),function(){return Ff("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")}())},cD={$:"TextArea"},fD=r(function(e,t){return l(Z_,{autofill:ci,spellchecked:t.spellcheck,type_:cD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),lD=n(function(e,t,r){var n=f(yk,M([Yk(22),qk]),Ff("Payment Method")),a=f(fD,M([QS(bk),zS(Sk(150)),wk(d(R$,155,203,255,.2)),GR(0)]),{label:d_("payment method"),onChange:iD,placeholder:""===r?si(sD(t)):ci,spellcheck:!0,text:r});return f(hN,M([nN(20),EN({bottom:15,left:45,right:45,top:0}),QS(bk),w$(f(S$,M([a_,aL(30),DN(10),Yk(20),QS(Sk(400))]),e))]),M([n,a]))}),dD=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."},hD=a(function(e,t,r,n){var a=l(cs,e,P("0"),Ni(n));return f(yk,M([Yk(22),WI(t)]),Ff(U(a,r)))}),pD=function(e){return Ed(e)<0?ml(0):e},gD=n(function(e,t,n){var a=r(function(e,r){return f(hN,M([nN(4)]),M([f(yk,M([DN(4),Dk,Hk(n(f(Ym,t,e)))]),f(jN,M([zS(Sk(10))]),qN)),r,f(yk,M([DN(4),Dk,Hk(n(function(e){return Ed(e)?e:ml(3e5)}(pD(f(dR,t,e)))))]),f(jN,M([zS(Sk(10))]),FN))]))}),i=RR(t);return f(vN,M([ZP,nN(10)]),M([f(a,ml(864e5),d(hD,3,e," days",i.days)),f(a,ml(36e5),d(hD,2,e," hours",i.hours)),f(a,ml(3e5),d(hD,2,e," min",i.min))]))}),vD=o(function(e,t,r,n,a,i){var o=f(yk,M([wk(d(R$,155,203,255,.2)),Ok(5),DN(15),w$(f(S$,M([a_]),a))]),l(gD,gR,n,i)),u=f(vN,M([nN(30)]),M([f(jN,M([zS(Sk(40)),Hk(o$(d(Rd,"click","misclick","symbol for "+t,0)))]),e),f(yk,M([Yk(22),qk]),Ff(t))])),s=f(oN,M([Yk(17),zN,WI($$)]),M([Ff(r)]));return f(hN,M([QS(bk),Ok(10),wk(l(hk,237,237,237)),nN(2)]),f(xa,yk(M([wk(Rk),f(Lk,45,18),QS(bk)])),M([u,f(vN,M([QS(bk),nN(25),wk(Rk)]),M([o,s]))])))}),yD=MN({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),mD=f(Pk,LN,oT.clipX),bD=f(Pk,LN,oT.clipY),CD=i(function(e,t,r,n,a){return f(hN,M([nN(15),Ok(8),mD,bD,wk(Rk)]),M([p(vD,yD,"Payment Window",dD(a),r,n,aD),l(lD,t,a,e)]))}),ED=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},SD=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."},TD=MN({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),wD=n(function(e,t,r){return f(yk,M([Ok(8),mD,bD,wk(Rk)]),p(vD,TD,"Burn/Release Window",SD(r),e,t,ED))}),ID=function(e){return{$:"AutorecallIntervalChanged",a:e}},AD=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."},BD=MN({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),kD=n(function(e,t,r){return f(yk,M([Ok(8),wk(Rk),mD,bD]),p(vD,BD,"Open Window",AD(r),e,t,ID))}),ND=function(e){return f(hN,M([QS(bk),nN(20)]),M([l(kD,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(CD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(wD,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},RD=function(e){return f(hN,M([QS(f(C$,1e3,bk)),Zk,nN(20),EN({bottom:30,left:40,right:40,top:0}),Hk(a$(!1)),m$(t_(e))]),M([eD(e),ND(e),nD(e.wallet)]))},$D=is(hm(8226)),_D=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),LD=r(function(e,t){return l(Ra,ka,t,e)}),xD=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(LD,r,e),a=t-1,i=r;e=n,t=a,r=i}}),PD=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(LD,f(js,e%r,t),l(xD,yr,e/r|0,t))):f(js,e,t)}),DD=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(FT,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(aS,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),UD=function(e){return d(DD,Ua,Py,e,yr)},OD=r(function(e,t){return f(yk,M([QS(bk),m$(f(vN,M([nN(3),QS(PN(100)),QS(t),xN]),f(_D,f(yk,M([WI(d(mN,0,0,0,.1)),Yk(14)]),Ff($D)),f(xa,f(Da,yk(M([WI(d(mN,0,0,0,.2))])),Ff),f(PD,100,(e?$a:Ua)(UD(f(xa,f(Io,Ho,Qa),Ia(SR)))))))))]),Ff(" "))}),MD=r(function(e,t){var r=t.url,n=t.label;return d(FI,rT,ZS("a"),f(ka,XS(HS(r)),f(ka,XS(jS("noopener noreferrer")),f(ka,QS(WS),f(ka,zS(WS),f(ka,VI(oT.contentCenterX+" "+oT.contentCenterY),e))))),eT(M([n])))}),FD=VI(oT.italic),VD=function(){var e=f(Da,yk(M([WI(l(jI,.8,.2,.2))])),Ff),t=f(Da,yk(M([uN])),Ff);return f(hN,M([QS(bk),zS(bk),wk(Rk),Ok(6),nN(50),QP({blur:20,color:d(R$,0,0,0,.1),offset:L(0,3),size:0}),Ok(10),DN(20)]),M([f(OD,!1,bk),f(hN,M([Zk,QS(f(C$,700,bk)),nN(20)]),M([f(oN,M([Yk(70),uN,Zk,Y$]),M([Ff("DAI"),e("Hard")])),f(vN,M([Yk(30),qk,Zk,Y$,FD]),M([Ff("The "),e("Global"),Ff(", "),e("Unkillable"),Ff(" Crypto Gateway")]))])),f(vN,M([wk(XN),nN(2),Zk,v$,QS(bk)]),M([f(yk,M([f(Lk,40,10),wk(Rk),QS(bk),zS(bk)]),f(hN,M([nN(60),fN]),M([f(yk,M([Yk(40),qk,Zk]),Ff("Want to learn more?")),f(MD,M([Ok(4),Dk,f(Lk,25,17),wk(c$),WI(Rk),uN,Yk(24),Zk]),{label:f(oN,M([Y$]),M([Ff("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"})]))),f(yk,M([f(Lk,40,10),wk(Rk),QS(bk),zS(bk)]),f(hN,M([f_,nN(60)]),M([f(yk,M([Yk(40),qk,Zk]),Ff("Ready to try it out?")),f(hN,M([nN(10),QS(Sk(400)),Zk]),M([f(oN,M([Yk(24),QS(bk)]),M([Ff("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f(oN,M([Yk(24),QS(bk)]),M([Ff("Then follow the links at the top of this page to browse "),t("Sell Offers"),Ff(", browse "),t("Buy Offers"),Ff(", or "),t("Create Your Own Offer"),Ff(".")]))]))])))])),f(yk,M([X$,QS(bk)]),f(OD,!0,bk))]))}(),KD=function(e){return{$:"ShowCurrencyDropdown",a:e}},HD=r(function(e,t){return Yf(t(e))}),jD=n(function(e,t,r){return R(t,yr)?Ck:f(Yi,nv,d(YR,e,r.tradeTable,M([Jg,kN,AN,BN,NN,IN]),t))}),qD=n(function(e,t,r){var n=l(HD,e,r.filterFunc,$v(f(xa,JR,t))),a=function(e){return f(yk,M([Yk(24),qk,WI(XN),Zk,DN(20)]),Ff(e))},i=f(Xd,Ja(QR),f(xa,t$,t))?M([a("No trades found.")]):f(xa,a,IC(f(xa,function(e){switch(t$(e).$){case"QueryingNumTrades":return si(KA(e.factory)+"Querying Factory...");case"NoneFound":return ci;case"FetchingTrades":return si(KA(e.factory)+"Fetching Trades");default:return ci}},t)));return f(hN,M([nN(10)]),M([function(){return i.b?f(hN,M([nN(5)]),i):Ck}(),l(jD,e,n,r)]))}),GD=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(zI,Uk,l(CI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},zD=function(e){return f(Vk,"focus",Fi(e))},YD=f(Da,XS,zD),WD=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([YD(e(!0)),bL(e(!0))])}();return f(vN,U(e,M([zS(Sk(40)),QP({blur:20,color:d(R$,233,237,242,.05),offset:L(0,3),size:0})])),M([f(yk,M([wk(aR),zS(Sk(40)),GD({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(yk,M([_N,f(Lk,10,0)]),r)),f(eL,U(s,U(t,M([QS(Sk(100)),zS(Sk(40)),jR(aR),GD({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),uL({bottom:1,left:0,right:1,top:1})]))),{label:d_(n),onChange:u,placeholder:i,text:a})]))}),JD=function(e){return{$:"MaxDaiChanged",a:e}},QD=function(e){return{$:"MinDaiChanged",a:e}},XD=r(function(e,t){return f(hN,M([QS(bk),nN(8)]),M([f(yk,M([Yk(17),zN]),Ff(e)),t]))}),ZD=NT(25),eU=function(e){return{$:"MoveX",a:e}},tU=function(e){return f(B$,ZD,eU(-e))},rU={$:"OnLeft"},nU=function(e){return f(LR,rU,e)},aU=n(function(e,t,r){var n=u_(M([_N])),a=f(vN,M([nN(8),_N,QS(Sk(60))]),M([n,f(yk,M([Yk(16),_N]),Ff("max"))])),i=f(vN,M([nN(8),_N,QS(Sk(60))]),M([n,f(yk,M([Yk(16),_N]),Ff("min"))]));return f(XD,"Dai Range",f(hN,M([nN(5),QS(Sk(200))]),M([v(WD,M([nU(f(S$,M([tU(5),QS(Sk(200))]),r.minDai))]),M([YD(KD(!1))]),i,"min Dai",e,ci,ci,QD),v(WD,M([nU(f(S$,M([tU(5),QS(Sk(200))]),r.maxDai))]),M([YD(KD(!1))]),a,"max Dai",t,ci,ci,JD)])))}),iU=function(e){var t=f(Vh,e,SR);if("Nothing"===t.$)return Ff("*");var r=t.a,n=r.b;return f(jN,M([zS(Sk(26))]),n)},oU=function(e){return{$:"AppCmd",a:e}},uU=function(e){return{$:"FiatTypeInputChanged",a:e}},sU=n(function(e,t,r){var n=oU(d(Rd,"click","misclick","currency flag",0)),a=iU(t);f(vN,M([nN(8),_N,QS(Sk(60))]),M([a,f(yk,M([Yk(16),_N]),Ff("max"))])),f(vN,M([nN(8),_N,QS(Sk(60))]),M([a,f(yk,M([Yk(16),_N]),Ff("min"))]));return f(yk,M([v$,QS(Sk(120))]),f(XD,"Fiat Type",h(KP,e,t,KD(!0),uU,n)))}),cU={$:"AddSearchTerm"},fU=function(e){return{$:"PaymentMethodInputChanged",a:e}},lU=f(gh,"keyCode",BC),dU=function(e){return f(Vk,"keyup",f(qo,function(t){return 13===t?Fi(e):Go(Ni(t))},lU))},hU=function(e){return f(XD,"Search Payment Methods",f(eL,M([v$,QS(Sk(250)),zS(Sk(40)),jR(aR),QP({blur:20,color:d(R$,233,237,242,.05),offset:L(0,3),size:0}),h$(dU(cU))]),{label:d_("payment methods search"),onChange:fU,placeholder:ci,text:e}))},pU=function(e){return{$:"RemoveTerm",a:e}},gU=function(e){return f(yk,M([DN(3),v$,Dk,Hk(pU(e)),Yk(10),WI(Jk)]),Ff("x"))},vU=function(e){if(e.b){var t=e;return f(vN,M([QS(bk),DN(10),nN(10)]),f(xa,function(e){return f(vN,M([wk(d(R$,16,7,234,.2)),Ok(5),DN(4),nN(3)]),M([Ff(e),gU(e)]))},t))}return Ck},yU=n(function(e,t,r){return f(hN,M([nN(10),QS(WS),Zk]),M([f(vN,M([QS(WS),nN(10)]),M([f(yk,M([QS(WS),v$]),l(aU,e.minDai,e.maxDai,t)),f(yk,M([QS(WS),v$]),l(sU,r,e.fiatType,t)),f(hN,M([QS(WS),v$,nN(5)]),M([hU(e.paymentMethod),vU(e.paymentMethodTerms)]))]))]))}),mU=n(function(e,t,r){return f(hN,M([Ok(5),wk(Rk),QS(bk),zS(bk),Hk(KD(!1))]),M([f(vN,M([QS(bk),nN(10),DN(30)]),M([l(yU,r.inputs,r.errors,r.showCurrencyDropdown)])),l(qD,e,t,r)]))}),bU=function(e){return{$:"MessageInputChanged",a:e}},CU={$:"MessageSubmit"},EU=M_("disabled"),SU=function(e){return f(Nn,"tabIndex",Ni(e))},TU=function(e){return{$:"MayPreventDefault",a:e}},wU=r(function(e,t){return f(Fk,e,TU(t))}),IU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):Go("Not the enter key")},n=f(qo,r,f(gh,"key",zo));return XS(f(wU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),AU=function(e){return f(IU,"Enter",e)},BU={$:"Button"},kU=r(function(e,t){var r=t.onPress,n=t.label;return d(FI,rT,vk,f(ka,QS(WS),f(ka,zS(WS),f(ka,VI(oT.contentCenterX+" "+oT.contentCenterY+" "+oT.seButton+" "+oT.noTextSelection),f(ka,Dk,f(ka,L_(e),f(ka,aN(BU),f(ka,XS(SU(0)),function(){if("Nothing"===r.$)return f(ka,XS(EU(!0)),e);var t=r.a;return f(ka,Hk(t),f(ka,AU(t),e))}()))))))),eT(M([n])))}),NU=function(e){return f(hN,M([QS(bk),nN(10)]),M([f(fD,M([QS(bk),zS(Sk(100))]),{label:d_("messageInput"),onChange:bU,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(kU,M([Zk,Yk(24)]),{label:Ff("Submit"),onPress:si(CU)})]))},RU=f(Pk,LN,oT.scrollbarsY),$U=r(function(e,t){return f(yk,M([zS(bk),QS(bk)]),f(yk,U(M([h$(f(d$,"position","absolute")),h$(f(d$,"top","0")),h$(f(d$,"right","0")),h$(f(d$,"bottom","0")),h$(f(d$,"left","0")),RU]),e),t))}),_U=l(hk,200,205,210),LU=n(function(e,t,r){var n=M([fN,wk(c$),WI(Rk),GD({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([f_,wk(_U),WI(gR),GD({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(yk,U(M([DN(7)]),u),f(oN,yr,M([Ff(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(jI,0,0,1),Rk,"Initiator opened the trade"));case"Recalled":return si(x(l(jI,0,0,1),Rk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Po,8,Kf(t))+"..";return si(x(l(jI,1,0,1),Rk,r+" committed to the trade"));case"Aborted":return si(x(l(jI,1,0,0),Rk,"Buyer aborted the trade"));case"Claimed":return si(x(l(jI,0,1,0),Rk,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(jI,0,0,1),Rk,"Seller released the "+sR(e)+" and closed the contract"));default:return si(x(l(jI,0,0,1),Rk,"Seller burned the "+sR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Ck;var d=c.a,h=d.a,p=d.b,g=d.c;return f(yk,M([Ok(3),GR(1),jR(l(jI,1,0,1)),Zk,wk(h)]),f(oN,M([WI(p)]),M([Ff(g)])))}),xU=n(function(e,t,r){if(r.b){var n=r;return f($U,M([QS(bk),zS(bk),Ok(5),GR(1),jR(gR),DN(10)]),f(hN,M([QS(bk),zS(bk),nN(10)]),f(xa,f(LU,e,t),n)))}return f(yk,M([QS(bk),zS(bk),Ok(5),GR(1),jR(gR),Zk,WI(l(jI,.5,.5,.5)),FD]),Ff("no messages found."))}),PU=Cr,DU=function(e){return f(hN,M([QS(bk),zS(bk),nN(10),GR(1),Ok(5),DN(20)]),M([l(xU,e.trade.factory,e.userRole,f(PU,function(e){return e.blocknum},Sa(e.history))),NU(e)]))},UU=function(e){return f(yk,M([wk(Rk),Ok(8),XP,QS(bk),zS(bk)]),DU(e))},OU={$:"ToggleChat"},MU=function(e){if(e.showChatHistory){var t=f(hc,Ck,f(Ao,UU,e.chatHistoryModel));return f(yk,M([zS(bk),QS(Sk(500)),DN(20),fN]),l(E$,M([zS(bk),QS(bk)]),f(Yi,XC,t),OU))}return Ck},FU=function(e){return"Buyer"===e.initiatorRole.$?vl:sb},VU=function(e){return AR(e)+" "+e.fiatType},KU={$:"AbortAction"},HU=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),jU=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return Ck}if("LoadedTrade"!==t.b.$)return Ck;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=VU(n.terms.price),u=MR(fb(i)),s=MR(n.parameters.tradeAmount)+" "+sR(n.factory),c=function(){return"Buyer"===FU(n.parameters).$?L(f(yk,M([zN,WI(gR)]),Ff("buyer")),M([Ff("pay the seller "),f(yk,M([WI(c$)]),Ff(o)),Ff(" in exchange for the "),f(yk,M([WI(c$)]),Ff(s)),Ff(" held in this contract.")])):L(f(yk,M([zN,WI(gR)]),Ff("seller")),M([Ff("accept "),f(yk,M([WI(c$)]),Ff(o)),Ff(" from the buyer in exchange for the "),f(yk,M([WI(c$)]),Ff(s)),Ff(" held in this contract.")]))}(),d=c.a,h=c.b;return l(E$,yr,f(hN,M([nN(20),DN(20),Zk,zS(bk),Y$]),M([f(yk,M([Yk(26),qk,Zk,_N]),Ff("Just to Confirm...")),f(hN,M([nN(20),Zk,_N]),f(xa,oN(M([Zk,Yk(18),zN,WI($$)])),U(M([U(M([Ff("You will deposit "),f(yk,M([WI(c$)]),Ff(u+" "+sR(n.factory))),Ff(", thereby becoming the "),d,Ff(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([Ff("(This ususally requires two Metamask signatures. Your "+sR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(yk,M([X$,Zk]),f(G$,"Yes, I definitely want to commit to this trade.",l(HU,n,a,i)))])),KU);case"ApproveNeedsSig":return W$(M([Ff("Waiting for user signature for the approve call."),Ff("(check Metamask!)"),Ff("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return W$(M([Ff("Mining the initial approve transaction..."),f(KI,M([Z$,WI(c$)]),{label:Ff("See the transaction on Etherscan"),url:f(J$,n.factory,p)}),Ff("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return W$(M([Ff("Waiting for user signature for the final commit call."),Ff("(check Metamask!)"),Ff("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return W$(M([Ff("Mining the final commit transaction..."),f(KI,M([Z$,WI(c$)]),{label:Ff("See the transaction"),url:f(J$,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(E$,yr,f(hN,M([nN(20),DN(20),Zk,zS(bk),Y$]),M([f(yk,M([Yk(26),qk,Zk,_N]),Ff("Just to Confirm...")),f(hN,M([nN(20),Zk,_N]),f(xa,oN(M([Zk,Yk(18),zN,WI($$)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([Ff('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 '+sR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([Ff("Aborting will incur a small penalty on both parties, and refund the rest of the "+sR(n.factory)+".")])]);case"Release":return M([M([Ff("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([Ff("This will destroy the "+sR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(yk,M([X$,Zk]),function(e){return f(G$,e,yE(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 "+sR(n.factory)+".";default:return"I understand. Burn the "+sR(n.factory)+"."}}()))])),KU);case"ActionNeedsSig":var g=r.a;return W$(M([Ff("Waiting for user signature for the "+bE(g)+" call."),Ff("(check Metamask!)")]));default:var g=r.a,p=r.b;return Ck}},qU=vN(M([QS(bk),wk(Rk),Ok(5),DN(20),ZP,XP])),GU=function(e){return f(vN,M([nN(8)]),M([f(jN,yr,o_),f(yk,M([Yk(24),zN]),Ff(MR(e)))]))},zU=r(function(e,t){var r=f(vg,Km(e),f(Ao,function(e){return e.address},Td(t)));return f(cL,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"}(),GU(e.parameters.tradeAmount))}),YU=function(e){return f(vN,M([nN(5)]),M([mL(e.fiatType),f(yk,M([Yk(24),zN]),Ff(VU(e)))]))},WU=function(e){return f(cL,"For Fiat",YU(e.terms.price))},JU=function(e){return"Buyer"===e.$?"Buyer":"Seller"},QU=l(hk,250,165,22),XU=l(hk,255,0,0),ZU=l(hk,0,255,0),eO=MN({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),tO=MN({description:"burned",src:"/DAIHard/static/img/burned.svg"}),rO=MN({description:"released",src:"/DAIHard/static/img/released.svg"}),nO={$:"ToggleStatsModal"},aO=function(e){return f(PU,Ua,e)},iO=n(function(e,t,n){var a=$v(f(xa,function(e){return f(Yf,function(e){return R(f(YC,e,n),si(t))},f(gS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(Vd,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(Vd,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Al,amountReleased:Al,numAborts:0,numBurns:0,numReleases:0},a),u=f(Ao,ml,kl(aO(f(gS,function(e){return function(e){return e?si(e):ci}(Ed(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}}),oO=r(function(e,t){return d(q$,x(d(mN,0,0,1,1),d(mN,0,0,1,.8),d(mN,0,0,1,.6)),Rk,e,t)}),uO=function(e){return{$:"ViewUserHistory",a:e}},sO=f(AB,0,yr),cO=f(Pk,jk,oT.textNormalWeight),fO=r(function(e,t){return Za(e/t)}),lO=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}}),dO=r(function(e,t){var r=e.a,n=e.b;return l(lO,r,f(fO,Ed(t),6e4),n)}),hO=r(function(e,t){return f(ls,24,f(fO,f(dO,e,t),60))}),pO=r(function(e,t){return f(ls,1e3,Ed(t))}),gO=r(function(e,t){return f(ls,60,f(dO,e,t))}),vO={$:"Apr"},yO={$:"Aug"},mO={$:"Dec"},bO={$:"Feb"},CO={$:"Jan"},EO={$:"Jul"},SO={$:"Jun"},TO={$:"Mar"},wO={$:"May"},IO={$:"Nov"},AO={$:"Oct"},BO={$:"Sep"},kO=function(e){var t=f(fO,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)}},NO=r(function(e,t){switch(kO(f(dO,e,t)).month){case 1:return CO;case 2:return bO;case 3:return TO;case 4:return vO;case 5:return wO;case 6:return SO;case 7:return EO;case 8:return yO;case 9:return BO;case 10:return AO;case 11:return IO;default:return mO}}),RO=r(function(e,t){return f(ls,60,f(fO,Ed(t),1e3))}),$O={$:"Fri"},_O={$:"Mon"},LO={$:"Sat"},xO={$:"Sun"},PO={$:"Thu"},DO={$:"Tue"},UO={$:"Wed"},OO=r(function(e,t){switch(f(ls,7,f(fO,f(dO,e,t),1440))){case 0:return PO;case 1:return $O;case 2:return LO;case 3:return xO;case 4:return _O;case 5:return DO;default:return UO}}),MO=n(function(e,t,r){return e.toAmPm(f(hO,t,r))}),FO=r(function(e,t){return kO(f(dO,e,t)).day}),VO=FO,KO=M([xO,_O,DO,UO,PO,$O,LO]),HO=r(function(e,t){return function(e){return e.a}(f(hc,L(0,xO),kl(f(Yf,function(r){return R(r.b,f(OO,e,t))},f(Bi,r(function(e,t){return L(e,t)}),KO)))))}),jO=function(e){return l(Ra,Na,0,e)},qO=r(function(e,t){return kO(f(dO,e,t)).year}),GO=function(e){return!f(ls,4,e)&&(!!f(ls,100,e)||!f(ls,400,e))},zO=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return GO(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}}),YO=M([CO,bO,TO,vO,wO,SO,EO,yO,BO,AO,IO,mO]),WO=r(function(e,t){return f(hc,L(0,CO),kl(f(Yf,function(r){r.a;return R(r.b,f(NO,e,t))},f(Bi,r(function(e,t){return L(e,t)}),YO))))}),JO=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(WO,e,t))}),QO=r(function(e,t){var r=f(js,f(JO,e,t)-1,YO);return jO(f(xa,zO(f(qO,e,t)),r))+f(VO,e,t)}),XO=r(function(e,t){return f(JO,e,t)/4|0}),ZO=r(function(e,t){var r=Ni(t),n=e-Ro(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),eM=function(e){return e?e<=12?e:e-12:12},tM=Fg(315576e5),rM=r(function(e,t){return ml(tM*f(qO,e,t))}),nM=r(function(e,t){var r=f(rM,e,t),n=f(HO,e,r);return 1+((f(QO,e,t)+n)/7|0)}),aM=r(function(e,t){return Ni(f(qO,e,t))}),iM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(JO,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(JO,t,r));case"MonthFixed":return f(ZO,2,f(JO,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(NO,t,r));case"MonthNameFull":return e.toMonthName(f(NO,t,r));case"QuarterNumber":return Ni(1+f(XO,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(XO,t,r));case"DayOfMonthNumber":return Ni(f(VO,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(VO,t,r));case"DayOfMonthFixed":return f(ZO,2,f(VO,t,r));case"DayOfYearNumber":return Ni(f(QO,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(QO,t,r));case"DayOfYearFixed":return f(ZO,3,f(QO,t,r));case"DayOfWeekNumber":return Ni(f(HO,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(HO,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(OO,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(OO,t,r));case"WeekOfYearNumber":return Ni(f(nM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(nM,t,r));case"WeekOfYearFixed":return f(ZO,2,f(nM,t,r));case"YearNumberLastTwo":return f(Mo,2,f(aM,t,r));case"YearNumber":return f(aM,t,r);case"AmPmUppercase":return UP(l(MO,e,t,r));case"AmPmLowercase":return Ml(l(MO,e,t,r));case"HourMilitaryNumber":return Ni(f(hO,t,r));case"HourMilitaryFixed":return f(ZO,2,f(hO,t,r));case"HourNumber":return Ni(eM(f(hO,t,r)));case"HourFixed":return f(ZO,2,eM(f(hO,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(hO,t,r));case"HourMilitaryFromOneFixed":return f(ZO,2,1+f(hO,t,r));case"MinuteNumber":return Ni(f(gO,t,r));case"MinuteFixed":return f(ZO,2,f(gO,t,r));case"SecondNumber":return Ni(f(RO,t,r));case"SecondFixed":return f(ZO,2,f(RO,t,r));case"MillisecondNumber":return Ni(f(pO,t,r));case"MillisecondFixed":return f(ZO,3,f(pO,t,r));default:return n.a}}),oM=a(function(e,t,r,n){return f(Ri,"",f(xa,l(iM,e,r,n),t))}),uM=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),sM=function(e){return e>11?"pm":"am"},cM=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"}},fM=function(e){switch(f(ls,100,e)){case 11:case 12:case 13:return"th";default:switch(f(ls,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},lM=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"}},dM=p(uM,cM,f(Io,cM,Po(3)),lM,f(Io,lM,Po(3)),sM,fM),hM=oM(dM),pM={$:"MonthNameFull"},gM=pM,vM=function(e){return{$:"Text",a:e}},yM=vM,mM={$:"YearNumber"},bM=mM,CM=n(function(e,t,n){var a=r(function(e,t){return f(hN,M([Yk(18),nN(6)]),M([f(yk,M([uN]),Ff(e)),f(yk,M([cO]),Ff(t))]))}),i=hM(M([gM,yM(", "),bM])),o=f(hN,M([nN(23),QS(bk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,sO,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+MR(n.amountReleased)+" "+sR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+MR(n.amountBurned)+" "+sR(e)+" Burned")])),M([f(yk,M([Zk]),f(oO,"View User History",uO(n.asRole)))])));return f(hN,M([Ok(8),mD,bD,wk(aR),nN(1),QP({blur:20,color:d(mN,0,0,0,.08),offset:L(0,0),size:0})]),M([f(yk,M([QS(bk),wk(Rk),DN(17)]),f(bN,18,t)),f(yk,M([QS(bk),wk(Rk),DN(17)]),o)]))}),EM=n(function(e,t,r){var n=l(iO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=JU(e.parameters.initiatorRole)+" Stats";return f(yk,r?M([nL(f(yk,M([aL(30),fN]),l(CM,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(cL,a,f(vN,M([QS(bk),nN(20),Dk,Hk(nO)]),f(xa,vN(M([nN(5)])),M([M([f(jN,M([zS(Sk(28))]),rO),f(yk,M([Yk(24),zN,WI(ZU)]),Ff(l(cs,2,P("0"),Ni(n.numReleases))))]),M([f(jN,M([zS(Sk(28))]),eO),f(yk,M([Yk(24),zN,WI(QU)]),Ff(l(cs,2,P("0"),Ni(n.numAborts))))]),M([f(jN,M([zS(Sk(28))]),tO),f(yk,M([Yk(24),zN,WI(XU)]),Ff(l(cs,2,P("0"),Ni(n.numBurns))))])])))))}),SM=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+Kf(t)}e.a;return"https://kovan.etherscan.io/address/"+Kf(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+Kf(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+Kf(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+Kf(t)}}),TM=n(function(e,t,r){return f(KI,e,{label:Ff(Kf(r)),url:f(SM,t,r)})}),wM=function(e){return f(cL,"Trade Status",f(hN,M([Yk(24),zN,nN(8)]),M([Ff(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(TM,M([Yk(12),WI(c$),Z$]),e.factory,e.creationInfo.address)])))},IM=i(function(e,t,r,n,a){return qU(M([wM(t),f(zU,t,r),WU(t),l(EM,t,n,a)]))}),AM=l(hk,9,32,107),BM=MN({description:"chat",src:"/DAIHard/static/img/chat.svg"}),kM=f(yk,M([Ok(4),Dk,Hk(OU),DN(5),wk(l(hk,22,0,255))]),f(jN,M([QS(Sk(42))]),BM)),NM=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},RM=function(e){return f(hN,M([Ok(12),wk(aR),DN(15),nN(15)]),M([f(yk,M([Yk(24),qk,FD]),Ff("Fiat Payment Method")),f(oN,M([Yk(18),zS(WS),wk(Rk),QP({blur:5,color:d(mN,0,0,0,.2),offset:L(-3,3),size:0}),Ok(3),DN(5)]),M([f(hc,f(yk,M([WI(GP),FD]),Ff("No payment methods found.")),f(Ao,Ff,f(Ao,function(e){return e.info},kl(e))))]))]))},$M={$:"Active"},_M=function(e){return{$:"ExpandPhase",a:e}},LM=M([wk(AM),WI(Rk)]),xM=r(function(e,t){return{$:"Min",a:e,b:t}}),PM=r(function(e,t){return f(xM,e,t)}),DM=function(e){return M(e?[Ok(12),v$,zS(f(PM,380,WS))]:[Ok(12),Zk])},UM=M([wk(Rk)]),OM=MN({description:"flame",src:"/DAIHard/static/img/flame.png"}),MM=r(function(e,t){return Cl(f(qu,El(e),El(t)))}),FM=r(function(e,t){return d(q$,x(d(mN,1,.6,.2,1),d(mN,1,.6,.2,.8),d(mN,1,.6,.2,.6)),Rk,e,t)}),VM=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),KM=function(e){return{$:"ContractActionClicked",a:e}},HM={$:"Web3Connect"},jM=n(function(e,t,r){var n=Td(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(hR,e,t).$?Ck:f(vN,M([nN(8)]),function(){var e=x(t.state.phase,f(Km,t,a.address),f(YC,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,yE,f(oO,"Remove and Refund this Trade",gE))])}break e}var r=(e.a,e.b,El(Hm(t.parameters)));return M([f(G$,"Deposit and Commit to Trade",l(VM,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,KM,f(FM,"Abort Trade",eE)),f(Yi,KM,f(G$,"Confirm Payment",uE)),kM])}e.a,e.c.a;return M([kM])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,KM,f(G$,"Burn it All!",oE)),f(Yi,KM,f(oO,"Release Everything",vE)),kM])}e.a,e.c.a;return M([kM])}break e;default:break e}return yr}())}return f(G$,"Connect to Wallet",HM)}),qM={$:"Finished"},GM={$:"NotStarted"},zM=r(function(e,t){var r=L(ZN(t),ZN(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?GM:R(n,a)?$M:qM}),YM=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),WM=r(function(e,t){return l(YM,yr,e,t)}),JM=a(function(e,t,r,n){var a=MR(f(Vd,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+sR(r.factory),i=MR(r.parameters.tradeAmount)+" "+sR(r.factory),o=f(vN,yr,f(WM,3,f(jN,M([zS(Sk(18))]),OM))),u=f(Da,yk(M([WI(l(jI,1,0,0))])),Ff),s=R(e,r.state.phase),c=f(vg,YC(r),f(Ao,function(e){return e.address},Td(n))),d=s?Rk:gR,h=oN(M([WI(d),Yk(18),qk])),p=VU(r.terms.price),g=s?l(hk,0,226,255):l(hk,16,7,234),v=f(Da,yk(M([WI(g)])),Ff),y=MR(r.parameters.buyerDeposit)+" "+sR(r.factory),m=r.parameters.abortPunishment,b=MR(m)+" "+sR(r.factory),C=MR(f(MM,r.parameters.buyerDeposit,m))+" "+sR(r.factory),E=MR(f(MM,r.parameters.tradeAmount,m))+" "+sR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([Ff("Your "),u("burnable deposit"),Ff(" of "),v(y),Ff(" is now held in this contract, and your offer to buy "),v(i),Ff(" for "),v(p),Ff(" is now listed in the marketplace.")]),M([Ff("If another user likes your offer, they can become the Seller by depositing the full "),v(i),Ff(" into this contract.")]),M([Ff("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),Ff(" to you.")])])):f(xa,h,M([M([Ff("Your offer to sell the "),v(i),Ff(" held in this contract for "),v(p),Ff(" is now listed in the marketplace.")]),M([Ff("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),Ff(" of 1/3 of the trade amount "),v("("+y+")"),Ff(" into this contract.")]),M([Ff("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),Ff(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([Ff("You must now pay the Seller "),v(p),Ff(" via the Fiat Payment Method, "),f(yk,M([qk]),Ff("and then click ")),u("Confirm Payment"),Ff(" before the payment window runs out. Use the chat to coordinate.")]),M([Ff("If you abort the trade, or do not confirm payment before this time is up, "),v(b),Ff(" (1/4 of the "),u("burnable deposit"),Ff(") will be "),u("burned"),Ff(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Ff(" to the Seller, "),v(C),Ff(" to you).")]),M([Ff("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),Ff(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([Ff("Work and communicate with the Buyer to receive "),v(p),Ff(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([Ff("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),Ff(" (1/4 of the "),u("burnable deposit"),Ff(") will be "),u("burned"),Ff(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Ff(" to you, "),v(C),Ff(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([Ff("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),Ff(" will be released to you.")]),M([Ff("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),Ff(" In this case the "),v(a),Ff(" will be lost to both parties.")]),M([Ff("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([Ff("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([Ff("So, have you recieved the "),v(p),Ff("? If so, you can click "),v("Release Everything"),Ff(".")]),M([Ff("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),Ff(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([Ff("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([Ff("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([Ff("The Seller has deposited "),v(i),Ff(" into this contract, and offers to sell it for "),v(p),Ff(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),Ff(" into this contract by clicking "),u("Deposit and Commit to Trade"),Ff(".")]),M([Ff("If the trade is successful, the combined "+sR(r.factory)+" balance "),v("("+a+")"),Ff(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,Ff(" for both parties (see Payment Window for more on this).")]),M([Ff("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),Ff(" within the payment window.")])])):f(xa,h,M([M([Ff("The Buyer is offering to buy "),v(i),Ff(" for "),v(p),Ff(", and has deposited "),v(y),Ff(" into this contract as a "),u("burnable deposit"),Ff(". To become the Seller, deposit "),v(i),Ff(" into this contract by clicking "),u("Deposit and Commit to Trade"),Ff(".")]),M([Ff("When you receive the "),v(p),Ff(" from the Buyer, the combined "+sR(r.factory)+" balance "),v("("+a+")"),Ff(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,Ff(" for both parties (see Payment Window for more on this).")]),M([Ff("Don't commit unless you can receive "),v(p),Ff(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([Ff("During this phase, the Buyer is expected to transfer "),v(p),Ff(" to the Seller, as described in Fiat Payment Method, "),f(yk,M([qk]),Ff("and ")),u("Confirm the Payment "),Ff(" before the payment window runs out. This would move the trade to the final phase.")]),M([Ff("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),Ff(" (1/4 of the "),u("burnable deposit"),Ff(" amount) will be "),u("burned"),Ff(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Ff(" to the Seller, "),v(C),Ff(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([Ff("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([Ff("If the Seller can verify he has received the "),v(p),Ff(", he will probably release the total balance of "),v(i),Ff(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),Ff(".")]),M([Ff("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),Ff(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(hN,M([QS(bk),zS(bk),DN(20),nN(30)]),M([f(vN,M([QS(bk)]),M([f(yk,M([Yk(24),qk,WI(g),f_]),Ff(T))])),f(hN,M([QS(bk),_N,nN(13)]),w),f(yk,M([fN]),function(){switch(f(zM,r,e).$){case"Active":return l(jM,t,r,n);case"NotStarted":return f(yk,M([Yk(20),qk,FD,WI(XN)]),Ff("Phase not yet started."));default:return f(yk,M([Yk(20),qk,FD]),Ff("Phase no longer active."))}}())]))}),QM=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},XM=MN({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),ZM=MN({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),eF={$:"None"},tF=eF,rF=MN({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),nF=function(e){switch(e.$){case"Open":return rF;case"Committed":return XM;case"Judgment":return ZM;default:return tF}},aF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),iF=a(function(e,t,r,n){return d(aF,e,t,r,n)}),oF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},uF=function(e){return function(e){return d(iF,e.red,e.green,e.blue,e.alpha)}(oF(e))},sF=function(e){return{$:"Circle",a:e}},cF=sF,fF=d(aF,0,0,0,1),lF={$:"Flat"},dF={$:"Sharp"},hF=function(e){return{$:"Uniform",a:e}},pF=hF,gF={cap:lF,dashPattern:yr,dashPhase:0,fill:pF(fF),join:dF,thickness:2},vF=n(function(e,t,r){return D(gF,{dashPattern:e,fill:r,thickness:t})}),yF=vF(yr),mF={$:"Transparent"},bF=mF,CF=f(yF,0,bF),EF=r(function(e,t){return{$:"Shape",a:e,b:t}}),SF=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},TF=function(e){return f(Da,SF,EF(e))},wF=function(e){return TF(L(e,CF))},IF=function(e){return L(-e.a,-e.b)},AF=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),BF=r(function(e,t){return f(AF,IF(e(t)),t)}),kF=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},NF=r(function(e,t){return{$:"Path",a:e,b:t}}),RF=kr,$F=Nr,_F=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=$F(n),i=RF(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},LF=function(e){return xa(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)})},xF=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(LF,e,M([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),PF=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},DF=function(e){var t=UF(e.basic),r=kF(f(xa,_F(e),t)),n=r.a,a=r.b;return{toBottom:-f(hc,0,qw(a)),toLeft:-f(hc,0,qw(n)),toRight:f(hc,0,jw(n)),toTop:f(hc,0,jw(a))}},UF=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(xF,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(xF,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(xF,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(LF,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(NF,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(LF,R(C,lF)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(xF,0,E);case"Group":var S=e.a;return f(LF,0,$v(f(xa,f(Io,DF,PF),S)));default:var T=e.b;return f(LF,0,PF(DF(T)))}},OF=function(e){var t=DF(e);return t.toTop+t.toBottom},MF=function(e){var t=DF(e);return L(-t.toLeft,t.toTop)},FF=function(e){var t=DF(e);return t.toLeft+t.toRight},VF=En("http://www.w3.org/2000/svg"),KF=VF("svg"),HF=Nn("height"),jF=Nn("version"),qF=Nn("width"),GF=VF("circle"),zF=VF("ellipse"),YF=VF("foreignObject"),WF=VF("g"),JF=VF("image"),QF=VF("polygon"),XF=VF("polyline"),ZF=VF("rect"),eV=ZT,tV=VF("text"),rV=Nn("id"),nV=Nn("points"),aV=Nn("r"),iV=Nn("rx"),oV=Nn("ry"),uV=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},sV=function(e){return{$:"Group",a:e}},cV=Nn("dominant-baseline"),fV=Nn("fill"),lV=Nn("fill-opacity"),dV=Nn("font-family"),hV=Nn("font-size"),pV=Nn("font-style"),gV=Nn("font-variant"),vV=Nn("font-weight"),yV=Nn("opacity"),mV=Nn("stroke"),bV=Nn("stroke-dasharray"),CV=Nn("stroke-dashoffset"),EV=Nn("stroke-linecap"),SV=Nn("stroke-linejoin"),TV=Nn("stroke-opacity"),wV=Nn("stroke-width"),IV=Nn("text-anchor"),AV=Nn("text-decoration"),BV=Nn("transform"),kV=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},NV=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},RV=n(function(e,t,r){return d(aF,e,t,r,1)}),$V=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Fg(1e4*e)/100};return Ql(M(["rgba(",YT(i(t)),"%,",YT(i(r)),"%,",YT(i(n)),"%,",YT(function(e){return Fg(1e3*e)/1e3}(a)),")"]))},_V=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},LV=function(e){var t=_V(e),r=t.red,n=t.green,a=t.blue;return $V(l(RV,r,n,a))},xV=function(e){if("Uniform"===e.$){var t=e.a;return LV(t)}return"none"},PV=function(e){var t=_V(e),r=t.alpha;return YT(r)},DV=function(e){if("Uniform"===e.$){var t=e.a;return PV(t)}return"0"},UV=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},OV=Br,MV=function(e){var t=YT(e.scale.b),r=YT(e.scale.a),n=YT(-e.rotation/2/OV*360),a=YT(-e.shift.b),i=YT(e.shift.a);return Ql(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},FV=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([mV(xV(r.fill)),TV(DV(r.fill)),wV(YT(r.thickness)),EV(kV(r.cap)),SV(UV(r.join)),fV("none"),yV(YT(e.opacity)),BV(MV(e)),CV(Ni(r.dashPhase)),bV(NV(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([fV(xV(a)),lV(DV(a)),mV(xV(r.fill)),TV(DV(r.fill)),wV(YT(r.thickness)),EV(kV(r.cap)),SV(UV(r.join)),yV(YT(e.opacity)),BV(MV(e)),CV(Ni(r.dashPhase)),bV(NV(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([fV(xV(hF(o.color))),dV(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),hV(Ni(o.size)),vV(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"}}()),pV(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),gV(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),AV(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),IV("middle"),cV("middle"),BV(MV(e))]);default:return M([BV(MV(e))])}},VV=Nn("x"),KV=Nn("y"),HV=r(function(e,t){return M([qF(YT(e)),HF(YT(t)),VV(YT(-e/2)),KV(YT(-t/2))])}),jV=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([YT(t),YT(-r)]))},e))},qV=Vk,GV=r(function(e,t){return f(e,t.a,t.b)}),zV=function(e){return f(xa,GV(qV),e)},YV=function(e){e:for(;;){var t=f(hc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(XF,U(M([rV(t),nV(jV(i))]),U(FV(e),zV(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(QF,U(M([rV(t),nV(jV(i))]),U(FV(e),zV(e.handlers))),yr);case"Circle":var c=s.a;return f(GF,U(M([rV(t),aV(YT(c))]),U(FV(e),zV(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(zF,U(M([rV(t),iV(YT(d)),oV(YT(h))]),U(FV(e),zV(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(ZF,U(M([rV(t),iV(YT(c)),oV(YT(c))]),U(f(HV,p,g),U(FV(e),zV(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(NF,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(tV,U(M([rV(t)]),U(FV(e),zV(e.handlers))),M([eV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(JF,U(M([rV(t),uV(C)]),U(f(HV,p,g),U(FV(e),zV(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(YF,U(M([rV(t)]),U(f(HV,p,g),U(FV(e),zV(e.handlers)))),M([S]));case"Group":var T=n.a;return f(WF,f(ka,rV(t),U(FV(e),zV(e.handlers))),l(Ra,r(function(e,t){return f(ka,YV(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:sV(M([w,I]))});e=v;continue e}}},WV=r(function(e,t){var r=e.a,n=e.b,a=YT(r),i=YT(n);return f(CT,yr,M([f(KF,M([qF(a),HF(i),jF("1.1")]),M([YV(t)]))]))}),JV=function(e){return f(WV,L(FF(e),OF(e)),f(BF,MF,e))},QV=r(function(e,t){var r=nF(e),n=function(){switch(t.$){case"NotStarted":return l(hk,10,33,108);case"Active":return l(hk,0,100,170);default:return l(hk,1,129,104)}}(),a=CL(JV(f(wF,pF(uF(n)),cF(50))));return f(yk,M([Zk,m$(f(jN,M([Zk,_N,zS(Sk(60))]),r))]),a)}),XV=function(e){var t=M([FD,qk,Yk(20)]);switch(e.$){case"Active":return f(yk,U(t,M([WI(Jk)])),Ff("Active"));case"NotStarted":return f(yk,U(t,M([WI(XN)])),Ff("Not Started"));default:return f(yk,t,Ff("Finished"))}},ZV=n(function(e,t,r){var n=f(zM,t,e),a=function(){return"Active"===n.$?l(hk,0,226,255):gR}(),i=f(yk,M([WI(a),Yk(20),qk,Zk]),Ff(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 Ck;switch(n.$){case"NotStarted":return d($R,M([Zk]),M([Yk(22),zN]),L(gR,aR),f(lR,e,t));case"Active":var a=f(hR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(OR,M([Zk]),M([Yk(22),zN]),L(Rk,aR),i)}return f(hN,M([Zk,nN(10)]),M([f(yk,M([Zk]),Ff(QM(e))),f(oO,"Poke",yE(pE))]));default:return f(yk,M([zS(Sk(1))]),Ck)}}();return f(hN,M([DN(20),nN(10),zS(bk)]),M([f(yk,M([v$,Zk]),i),f(yk,M([zS(bk),Zk]),f(yk,M([_N]),f(QV,e,n))),f(hN,M([nN(10),X$,Zk]),M([f(yk,M([Zk]),XV(n)),o]))]))}),eK=o(function(e,t,r,n,a,i){var o=f(zM,r,t),u=f(yk,M([DN(10),QS(bk),zS(bk)]),d(JM,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return ml(0)}}(),c=l(ZV,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(dR,f(Ym,r.state.phaseStartTime,s),i);default:ml(0)}}(),f(yk,M([zS(bk),QS(Sk(1)),wk(function(){return"Active"===o.$?l(jI,0,0,1):aR}())]),Ck)),p=a?f(vN,U(DM(e),U(R(o,$M)?LM:UM,M([QS(bk)]))),M([c,h,u])):f(vN,U(DM(e),U(R(o,$M)?LM:UM,M([Dk,Hk(_M(t))]))),M([c]));return!e&&R(o,$M)?f(hN,M([QS(bk),nN(20),EN({bottom:20,left:0,right:0,top:0})]),M([p,RM(r.terms.paymentMethods)])):p}),tK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(vN,M([Zk,Ok(12),DN(30),nN(10),wk(AM),Yk(24),qk,WI(Rk)]),M([Ff("Trade "+NM(t.state.closedReason)),kM])):e?f(hN,M([QS(bk),nN(10)]),M([f(vN,M([QS(bk),zS(WS),nN(20)]),M([p(eK,e,jg,t,n,R(r,jg),a),p(eK,e,Rb,t,n,R(r,Rb),a),p(eK,e,$b,t,n,R(r,$b),a)])),RM(t.terms.paymentMethods)])):f(hN,M([QS(bk),zS(WS),nN(20)]),M([p(eK,e,jg,t,n,R(r,jg),a),p(eK,e,Rb,t,n,R(r,Rb),a),p(eK,e,$b,t,n,R(r,$b),a)]))}),rK=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(hN,M([QS(bk),zS(bk),nN(40)]),M([h(IM,t,i,n.wallet,r,n.showStatsModal),f(yk,M([QS(bk),f(Lk,40,0),nN(40)]),h(tK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(yk,M([Zk,_N,Yk(30)]),Ff("Loading trade info..."));default:return f(yk,M([Zk,_N,Yk(30)]),Ff("Invalid trade"))}}(),M([MU(n),jU(n)]))}),nK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),aK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(VD,yr);case"CreateModel":var n=r.a;return L(f(Yi,fy,RD(n)),yr);case"TradeModel":var a=r.a;return l(nK,Yi(hy),xa(Yi(hy)),d(rK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,FS,l(mU,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,DS,l(n$,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(yk,M([QS(bk),zS(bk),Ok(10)]),n),a)}),iK=function(e){return{$:"DismissNotice",a:e}},oK=function(e){return f(B$,ZD,eU(e))},uK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(jI,1,1,1):l(jI,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(hk,100,200,255);case"Caution":return l(hk,255,188,0);case"Error":return l(hk,255,70,70);default:return l(hk,200,200,200)}}(),o=f(yk,M([fN,v$,k$(5),oK(5)]),f$(iK(t)));return f(yk,M([wk(i),Ok(10),DN(8),QS(bk),GR(1),jR(d(mN,0,0,0,.15)),XP]),f(hN,M([nN(4),QS(bk)]),f(Bi,r(function(e,t){return f(oN,M([QS(bk),WI(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},sK=function(e){return R(e,yr)?yr:M([f(hN,M([tU(20),k$(20),nN(10),fN,X$,QS(Sk(300)),Yk(15)]),f(xa,uK,f(Yf,function(e){return R(e.b.align,Uf)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(hN,M([oK(20),aL(100),nN(10),f_,v$,QS(Sk(300)),Yk(15)]),f(xa,uK,f(Yf,function(e){return R(e.b.align,JA)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},cK=r(function(e,t){var r=f(aK,e,t),n=r.a,a=r.b;return L(f(hN,M([xR(Ik),m$(yN(t)),QS(bk),zS(bk),DN(30)]),M([f(yk,M([zS(Sk(50))]),Ck),n])),U(a,sK(t.userNotices)))}),fK=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),lK=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),dK={$:"AllowHover"},hK={$:"Layout"},pK={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(HI,155/255,203/255,1,1),offset:L(0,0),size:3})},gK=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?pK:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?dK:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?hK:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},vK=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(rT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),rT);case"Text":var a=t.a;return uI(a);default:return uI("")}}),yK=n(function(e,t,r){var n=gK(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?fK(n):lK(n)}();return f(vK,a,d(FI,rT,vk,t,eT(M([r]))))}),mK=NT(5),bK=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),CK={$:"SansSerif"},EK=function(e){return{$:"Typeface",a:e}},SK=Y,TK=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",SK(Ml(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",SK(Ml(t)));default:var t=e.a.name;return f(Ri,"-",SK(Ml(t)))}}())}),wK=function(){var e=M([EK("Open Sans"),EK("Helvetica"),EK("Verdana"),CK]);return M([f(zI,Tk,l(GI,"bg-color-"+YI(d(HI,1,1,1,0)),"background-color",d(HI,1,1,1,0))),f(zI,qI,l(GI,"font-color-"+YI(d(HI,0,0,0,1)),"color",d(HI,0,0,0,1))),f(zI,Gk,zk(20)),f(zI,mK,f(bK,l(Ra,TK,"font-",e),e))])}(),IK=n(function(e,t,r){var n=e.options;return l(yK,n,f(ka,VI(f(Ri," ",M([oT.root,oT.any,oT.single]))),U(wK,t)),r)}),AK=IK({options:yr}),BK=function(e){return f(zI,mK,f(bK,l(Ra,TK,"ff-",e),e))},kK=CK,NK=EK,RK=function(e){return{body:M([function(){var t=f(cK,e.screenWidth,e),r=t.a,n=t.b,a=U(M([QS(bk),zS(bk),BK(M([NK("Soleil"),kK]))]),f(xa,m$,n));return f(AK,a,r)}()]),title:"DAIHard"}},$K=Ht,_K=$K({init:pB,onUrlChange:dk,onUrlRequest:lk,subscriptions:fk,update:OA,view:RK});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:_K(f(qo,function(e){return f(qo,function(t){return f(qo,function(r){return Fi({height:r,networkId:t,width:e})},f(gh,"height",BC))},f(gh,"networkId",BC))},f(gh,"width",BC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file From 74372a5b4852932ac4461c6cc5bfa13821c32687 Mon Sep 17 00:00:00 2001 From: oglog Date: Mon, 12 Aug 2019 14:46:09 +0200 Subject: [PATCH 07/19] Filter options added back in --- docs/404.html | 2 +- docs/index.html | 2 +- ...e15682.js => main-4fee17038e82ec0befad.js} | 2 +- src/AgentHistory/State.elm | 5 + src/AgentHistory/View.elm | 17 ++-- src/Marketplace/State.elm | 4 + src/TradeTable/Filters/State.elm | 30 ++++++ src/TradeTable/Filters/Types.elm | 96 +++++++++++++++++++ src/TradeTable/Filters/View.elm | 43 +++++++++ src/TradeTable/State.elm | 11 ++- src/TradeTable/Types.elm | 3 + src/TradeTable/View.elm | 8 +- 12 files changed, 207 insertions(+), 16 deletions(-) rename docs/static/js/{main-0e6b8607c1efa2e15682.js => main-4fee17038e82ec0befad.js} (58%) create mode 100644 src/TradeTable/Filters/State.elm create mode 100644 src/TradeTable/Filters/Types.elm create mode 100644 src/TradeTable/Filters/View.elm diff --git a/docs/404.html b/docs/404.html index 6c68036..a954339 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 6c68036..a954339 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-0e6b8607c1efa2e15682.js b/docs/static/js/main-4fee17038e82ec0befad.js similarity index 58% rename from docs/static/js/main-0e6b8607c1efa2e15682.js rename to docs/static/js/main-4fee17038e82ec0befad.js index 28dddb3..4daa876 100644 --- a/docs/static/js/main-0e6b8607c1efa2e15682.js +++ b/docs/static/js/main-4fee17038e82ec0befad.js @@ -4,4 +4,4 @@ * @author Feross Aboukhadijeh * @license MIT */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(Jh,o,function(e){return si(Qh(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Zh,e,L(r,ip({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Zh,e,L(r,ap({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=Pg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?Tg(o):Sg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return Pg(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(wg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Ag,Ig,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(Io,xa(Us),f(Io,ms,Ds))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(qd,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(qd,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(np)}),i.addEventListener("timeout",function(){a(op)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Qh(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(tp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Ag,Ig,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Ag,Ig,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Ag,Ig,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=function(e){return{orderBy:e}},fo=co,lo={$:"Ascending"},ho={$:"Phase"},po=Oe,go=po(yr),vo=r(function(e,t){return L({agentAddress:t,tradeTable:fo(L(ho,lo)),wallet:e},go)}),yo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),mo={$:"None"},bo=mo,Co=function(e){return d(yo,e,go,bo,yr)},Eo=function(e){return{$:"TradeTableMsg",a:e}},So=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),To=r(function(e,t){return f(So,e,t)}),wo=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Io=n(function(e,t,r){return t(e(r))}),Ao=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),Bo=r(function(e,t){if("None"===t.$)return mo;var r=t.a,n=t.b,a=l(wo,f(Ao,Da(e),r.onSign),f(Ao,Da(e),r.onBroadcast),f(Ao,function(t){var r=t.a,n=t.b;return L(f(Io,r,e),f(Ao,function(t){return{confirmations:t.confirmations,toMsg:f(Io,t.toMsg,e)}},n))},r.onMined));return f(So,a,n)}),ko=function(e){return{$:"AbiDecoder",a:e}},No=r(function(e,t){return{$:"Tape",a:e,b:t}}),Ro=z,$o=Fr,_o=r(function(e,t){return e<1?t:l($o,e,Ro(t),t)}),Lo=_o(64),xo=n(function(e,t,r){return L(f(No,e,Lo(t)),r)}),Po=r(function(e,t){return e<1?"":l($o,0,e,t)}),Do=Po(64),Uo=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),Oo=function(e){return-e},Mo=r(function(e,t){return e<1?"":l($o,-e,Ro(t),t)}),Fo=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(Po,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(Mo,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return ko(function(t){var r=t.a,n=t.b;return f(Uo,f(xo,r,n),e(Do(n)))})}(),Vo=Hr,Ko=function(e){return f(Vo,"0x",e)||f(Vo,"0X",e)?f(_o,2,e):e},Ho=function(e){return e.b},jo=r(function(e,t){var r=e.a;return f(Uo,Ho,r(function(e){return f(No,e,e)}(Ko(t))))}),qo=Xr,Go=ae,zo=Wr,Yo=function(e){return f(qo,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return Go(a)},zo)},Wo=f(Io,jo,Yo),Jo=function(e){return{$:"Magnitude",a:e}},Qo=function(e){return{$:"Pos",a:e}},Xo=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Zo=function(e){return{$:"MagnitudeNotNormalised",a:e}},eu=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 si(n)}return ci}},tu=function(e){var t=eu(e);return"Nothing"!==t.$&&t.a<0},ru=function(e){return{$:"Neg",a:e}},nu={$:"Zer"},au=function(e){return!e.b},iu=r(function(e,t){var r=t.a;if(au(r))return nu;switch(e.$){case"Zero":return nu;case"Positive":return Qo(t);default:return ru(t)}}),ou=r(function(e,t){return f(Xo,e,Zo(t))}),uu=function(e){return f(La,r(function(t,r){return e(t)&&au(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),su=Ir,cu=-1+f(su,10,7),fu=cu+1,lu=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),du=function(e){return e<0?f(lu,Na(-1),du(e+fu)):L(e/fu|0,e%fu)},hu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=du(r+e),i=a.a,o=a.b;return f(ka,o,f(hu,i,n))}{if(!(_(e,fu)>0))return M([e]);var u=M([e]);e=0,t=u}}}),pu=function(e){var t=e.a;return Jo(uu(f(hu,0,t)))},gu=xa(Oo),vu={$:"Negative"},yu={$:"Positive"},mu={$:"Zero"},bu=function(e){switch(e.$){case"Positive":return vu;case"Negative":return yu;default:return mu}},Cu=function(e){for(;;){var t=e.a,r=e.b,n=pu(r),a=n.a;if(!tu(a))return f(iu,t,Jo(a));e=f(ou,bu(t),gu(a))}},Eu=pr,Su=function(e){switch(f(Eu,e,0).$){case"LT":return vu;case"GT":return yu;default:return mu}},Tu=function(e){return e<0?-e:e},wu=function(e){return Cu(f(Xo,Su(e),Zo(M([Tu(e)]))))},Iu=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(su,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},Au=function(e){switch(e.$){case"Zer":return nu;case"Neg":var t=e.a;return Qo(t);default:return e}},Bu=function(e){return{$:"MagnitudePair",a:e}},ku=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(ka,L(a,u),f(ku,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(ku,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(ku,yr,s))}return yr}),Nu=r(function(e,t){var r=e.a,n=t.a;return Bu(f(ku,r,n))}),Ru=function(e){switch(e.$){case"Zer":return f(ou,mu,yr);case"Neg":var t=e.a.a;return f(ou,yu,gu(t));default:var t=e.a.a;return f(ou,yu,t)}},$u=r(function(e,t){var r=Ru(t),n=r.b,a=Ru(e),i=a.b,o=f(Nu,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Cu(f(Xo,yu,Zo(s)))}),_u=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(R(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 Ta}return a.b.b?ba:f(Eu,e,t)}}),Lu=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},xu=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(_u,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Lu(d(_u,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),Pu=r(function(e,t){return R(f(xu,e,t),Ta)}),Du=K,Uu=r(function(e,t){return!f(Pu,e,t)}),Ou=function(e){switch(e.$){case"Zer":return Jo(yr);case"Pos":default:var t=e.a;return t}},Mu=r(function(e,t){var r=e.a;return pu(Zo(f(xa,ti(t),r)))}),Fu=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(Mu,Jo(n),a),u=f(Fu,Jo(i),Jo(n)),s=u.a,c=f($u,f(iu,yu,o),f(iu,yu,Jo(f(ka,0,s))));return Ou(c)}var a=r.a;return f(Mu,Jo(n),a)}return Jo(yr)}),Vu=function(e){switch(e.$){case"Zer":return mu;case"Pos":return yu;default:return vu}},Ku=r(function(e,t){return R(e,mu)||R(t,mu)?mu:R(e,t)?yu:vu}),Hu=r(function(e,t){return f(iu,f(Ku,Vu(e),Vu(t)),f(Fu,Ou(e),Ou(t)))}),ju=function(e){switch(e.$){case"Zer":return nu;case"Pos":var t=e.a;return ru(t);default:var t=e.a;return Qo(t)}},qu=r(function(e,t){return f($u,e,ju(t))}),Gu=wu(0),zu=a(function(e,t,r,n){if(e){var a=wu(e),i=f(Hu,f(Hu,a,n),t),o=f(Uu,i,r)?L(f(Hu,a,t),f(qu,r,i)):L(Gu,r),u=o.a,s=o.b,c=d(zu,e/2|0,t,s,n),l=c.a,h=c.b;return L(f($u,u,l),h)}return L(Gu,r)}),Yu=Fa(f(Va,2,cu)),Wu=n(function(e,t,r){return d(zu,f(su,2,Yu),e,t,r)}),Ju=wu(1),Qu=r(function(e,t){return e}),Xu=n(function(e,t,r){return l(Ra,Qu(e),t,f(Ai,1,r))}),Zu=function(e){return l(Xu,Hu(wu(fu)),Ju,e)},es=n(function(e,t,r){if(e){var n=l(Wu,Zu(e),t,r),a=n.a,i=n.b,o=l(es,e-1,i,r),u=o.a,s=o.b;return L(f($u,a,u),s)}return l(Wu,Zu(e),t,r)}),ts=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},rs=r(function(e,t){if(R(t,Gu))return ci;var r=Ti(ts(e))-Ti(ts(t))+1,n=l(es,f(ei,0,r),Au(e),Au(t)),a=n.a,i=n.b;return si(L(f(iu,f(Ku,Vu(e),Vu(t)),Ou(a)),f(iu,Vu(e),Ou(i))))}),ns=f(Hu,wu(2),wu(2147483648)),as=xr,is=function(e){return f(as,e,"")},os=Pn,us=n(function(e,t,r){return e<=0?r:l(us,e>>1,U(t,t),1&e?U(r,t):r)}),ss=r(function(e,t){return l(us,e,t,"")}),cs=n(function(e,t,r){return U(f(ss,e-Ro(r),is(t)),r)}),fs=te,ls=Ar,ds=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},hs=r(function(e,t){for(;;){if(t<16)return f(ka,ds(t),e);var r=f(ka,ds(f(ls,16,t)),e),n=t/16|0;e=r,t=n}}),ps=function(e){return fs(e<0?f(ka,P("-"),f(hs,yr,-e)):f(hs,yr,e))},gs=function(e){var t=f(rs,e,ns);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=ps(Iu(a));return R(n,wu(0))?i:U(gs(n),l(cs,8,P("0"),i))},vs=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,Jo(yr))?"0":gs(Qo(t));default:var t=e.a;return"-"+vs(f(Hu,wu(-1),e))}},ys=function(e){return l(cs,64,P("0"),e)},ms=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=ys(ps(a)),c=function(e){return U(e,n)}(ys(ps(u)));return x(a+32+(Ro(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},bs=Dr,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))))}),Es=n(function(e,t,n){return l(bs,r(function(t,r){return l(Cs,e,yi(t),r)}),t,n)}),Ss=function(e){return $a(l(Es,ka,yr,e))},Ts=function(e){return f(Ri,"",f(xa,f(Io,ps,f(cs,2,P("0"))),Ss(e)))},ws=function(e){return 64-f(ls,64,e)},Is=function(e){return U(e,f(ss,ws(Ro(e)),"0"))},As=function(e){return L(si(Ro(e)/2|0),Is(e))},Bs=function(e){return L(ci,ys(e))},ks=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Ns=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"}},Rs=Ur,$s=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(as,P("1"),r),!0);case"1":return L(f(as,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(as,P("0"),r),!1);case"1":return L(f(as,P("1"),r),!0);default:break e}return L(r,!0)});return l(Rs,t,L("",!1),e).a},_s=function(e){return l(Rs,ka,yr,e)},Ls=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(_o,e,t),i=f(ka,l($o,0,e,t),r);e=n,t=a,r=i}}),xs=r(function(e,t){return e&&""!==t?l(Ls,e,t,yr):M([t])}),Ps=function(e){var t=function(){var t=_s(vs(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(Io,$s,f(cs,256,P("1"))))}var r=t;return L(r,f(cs,256,P("0")))}(),r=t.a,n=t.b;return fs(f(xa,ks,f(xs,4,n(f(Ri,"",f(xa,Ns,r))))))},Ds=function(e){return{$:"Hex",a:e}},Us=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Bs(t);case"UintE":var r=e.a;return Bs(vs(r));case"IntE":var n=e.a;return Bs(Ps(n));case"BoolE":return Bs(e.a?"1":"0");case"DBytesE":var a=e.a.a;return As(a);case"BytesE":var a=e.a.a;return Bs(Ko(a));case"StringE":var i=e.a;return As(Ts(i));case"ListE":var o=e.a;return function(e){var t=e.a;return As(t)}(Xt()(o));default:var i=e.a;return Bs(Ko(i))}};try{var Os=Xt();Xt=function(){return Os}}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 Ms=Pr,Fs=function(e){return 1===Ro(e)?f(Ms,"0",e):e},Vs=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(ka,n,r);e=i,t=o,r=u}}}),Ks=r(function(e,t){return $a(l(Vs,e,t,yr))}),Hs=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(Ks,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(Hs,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),js=r(function(e,t){return l(Hs,0,e,t)}),qs=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),Gs=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 Pt(e.a)}},zs={$:"LE"},Ys=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,zs));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,zs));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,zs));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,zs));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,zs));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,zs));case"Seq":var i=e.b;return l(Ws,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),Ws=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(Ys,n,t,r);e=i,t=o,r=u}}),Js=Dt,Qs=r(function(e,t){return{$:"Seq",a:e,b:t}}),Xs=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+Gs(r),i=n;e=a,t=i}}),Zs=function(e){return f(Qs,f(Xs,0,e),e)},ec=function(e){return{$:"U8",a:e}},tc=ec,rc=r(function(e,t){return _(e,t)<0?e:t}),nc=hr,ac=function(e){return{$:"Bytes",a:e}},ic=ac,oc=function(e){return Js(Zs(f(xa,ic,$a(e))))},uc=Pt,sc=r(function(e,t){var r=e.a;return f(zn,r,t)}),cc=function(e){return{$:"Decoder",a:e}},fc=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}}),lc=r(function(e,t){return cc(f(fc,e,t))}),dc=cc(Yn),hc=r(function(e,t){if("Just"===t.$){return t.a}return e}),pc=function(e){return{$:"Done",a:e}},gc=function(e){return{$:"Loop",a:e}},vc=r(function(e,t){var n=t.a;return cc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),yc=function(e){return cc(r(function(t,r){return L(r,e)}))},mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?yc(pc($a(n))):f(vc,function(e){return gc(L(r-1,f(ka,e,n)))},e)}),bc=function(e){return f(hc,yr,f(sc,f(lc,L(uc(e),yr),mc(dc)),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))}),Ec=r(function(e,t){return l(Cc,os,e,t)}),Sc=f(Ai,0,4),Tc=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}}),wc=xt,Ic=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),Ac=function(e){return f(Ic,f(Io,wc,os(4294967295)),e)},Bc=r(function(e,t){return 5*t+e}),kc=4294967295>>>32-Ha,Nc=ar,Rc=n(function(e,t,r){for(;;){var n=kc&t>>>e,a=f(Nc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Nc,kc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),$c=function(e){return e>>>5<<5},_c=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,$c(r))>-1?f(Nc,kc&e,i):l(Rc,n,e,a))}),Lc=r(function(e,t){var r=f(_c,e,t);if("Just"===r.$){return r.a}return L(0,0)}),xc=n(function(e,t,r){var n=f(Bc,e,t);return f(Lc,n,r)}),Pc=ir,Dc=a(function(e,t,r,n){var a=kc&t>>>e,i=f(Nc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Dc,e-Ha,t,r,o);return l(Pc,a,za(u),n)}var s=i.a,c=l(Pc,kc&t,r,s);return l(Pc,a,Ga(c),n)}),Uc=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,$c(n))>-1?d(Ma,n,a,i,l(Pc,kc&e,t,o)):d(Ma,n,a,d(Dc,a,e,t,i),o)}),Oc=n(function(e,t,r){return l(Uc,e,t,r)}),Mc=a(function(e,t,r,n){var a=f(Bc,e,t);return l(Oc,a,r,n)}),Fc=Dn,Vc=r(function(e,t){return l(Cc,Fc,e,t)}),Kc=function(e){var t=l(La,r(function(t,n){var a={d0:l(xc,0,t,e.state),d1:l(xc,1,t,e.state),d2:l(xc,2,t,e.state),d3:l(xc,3,t,e.state),d4:l(xc,4,t,e.state)},i=r(function(e,r){return d(Mc,e,t,f(Vc,f(Tc,e,a),f(Ec,Ac(f(Tc,f(ls,5,e+1),a)),f(Tc,f(ls,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Sc);return D(e,{state:t})},Hc=L(0,0),jc=function(e){return{current:Hc,lfsrstate:1,state:e,x:1,y:0}},qc=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},Gc=L(1,0),zc=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),Yc=r(function(e,t){if(e){var n=f(zc,1,t);return l(Cc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),Wc=r(function(e,t){var r=f(ls,32,e/32|0),n=f(zc,r,t),a=f(ls,32,e);return f(Yc,a,n)}),Jc=n(function(e,t,r){var n=f(_c,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(Uc,e,t(a),r)}),Qc=n(function(e,t,r){return l(Jc,e,Vc(t),r)}),Xc=a(function(e,t,r,n){var a=f(Bc,e,t);return l(Qc,a,r,n)}),Zc=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),sf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(rc,n,r),i=f(xa,function(e){return f(uf,e,g)},f(Ai,0,a)),o=of(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(js,i.outputLen,l(v,g,yr,i.outputLen))},df=function(e){return{$:"KS",a:e}},hf=function(e){var t=e.a;return df({config:t,inputLength:0,partial:yr,state:f(ui,25,Qu(Hc))})},pf=function(e){return cc(Wn(e))},gf=Js(Zs(yr)),vf=r(function(e,t){var n=t.a;return cc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),yf=r(function(e,t){return f(vf,function(e){return pf(t)},pf(e))}),mf=r(function(e,t){return f(hc,gf,f(sc,f(yf,e,uc(t)-e),t))}),bf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=uc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+uc(e)}),0,i),a)>-1))return df(D(n,{inputLength:uc(e)+n.inputLength,partial:i}));var o=oc(i),u=f(hc,gf,f(sc,pf(a),o)),s=bc(u),c=f(ff,s,n.state),d=of(c),h=f(mf,a,o),p=gf,g=df(D(n,{inputLength:uc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Cf=r(function(e,t){return lf(f(bf,Js(Zs(f(xa,tc,t))),hf(e)))}),Ef=Cf(qs),Sf=function(e){return Ds(f(Ri,"",f(xa,f(Io,ps,Fs),f(js,4,Ef(f(xa,yi,_s(e)))))))},Tf=function(e){return f(Vo,"0x",e)||f(Vo,"0X",e)?e:"0x"+e},wf=function(e){var t=e.a;return Tf(t)},If=r(function(e,t){var r=ms(f(xa,Us,t)),n=function(e){return U(e,r)}(Ko(wf(Sf(e))));return Ds(n)}),Af=function(e){return{data:si(f(If,"poke()",yr)),decoder:Wo(Fo),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Bf=r(function(e,t){return{$:"Trade",a:e,b:t}}),kf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Nf={$:"Descending"},Rf=function(e){return"Ascending"===e.$?Nf:lo},$f=function(e){return d(kf,e,go,bo,yr)},_f=r(function(e,t){return L(t.a,e(t.b))}),Lf=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(kf,t,go,bo,M([da(f(Bf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(_f,Rf,t.orderBy):L(a,lo);return $f(D(t,{orderBy:i}));default:return $f(t)}}),xf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},Pf=yn,Df=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=xf(Af(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(To,a,n);return d(yo,t,go,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(yo,t,go,bo,M([da(f(Bf,o,u))]));case"TradeTableMsg":var s=e.a,c=f(Lf,s,t.tradeTable);return d(yo,D(t,{tradeTable:c.model}),f(Pf,Eo,c.cmd),f(Bo,Eo,c.chainCmd),f(xa,Ji(Eo),c.appCmds));default:return Co(t)}}),Uf={$:"BottomRight"},Of={$:"ShouldBeImpossible"},Mf=lr,Ff=function(e){return qi(e)},Vf=r(function(e,t){f(Mf,e,t);return{align:Uf,label:"unexpectedError",mainParagraphs:M([M([Ff(e)])]),noticeType:Of}}),Kf=function(e){var t=e.a;return Tf(t)},Hf=ye,jf=f(Io,Kf,Hf),qf=f(Io,vs,f(Io,Tf,Hf)),Gf=f(Io,wf,Hf),zf=f(Io,ps,f(Io,Tf,Hf)),Yf=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),Wf=un,Jf=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},Qf=function(e){return Jf(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(hc,Wf,r))},f(Yf,function(e){e.a;return!R(e.b,ci)},e)))},Xf=function(e){return Qf(M([L("to",f(Ao,jf,e.to)),L("from",f(Ao,jf,e.from)),L("gas",f(Ao,zf,e.gas)),L("gasPrice",f(Ao,qf,e.gasPrice)),L("value",f(Ao,qf,e.value)),L("data",f(Ao,Gf,e.data)),L("nonce",f(Ao,zf,e.nonce))]))},Zf=function(e){return{$:"TxSentry",a:e}},el=ye,tl=r(function(e,t){return Jf(M([L("ref",el(e)),L("txParams",t)]))}),rl=function(e){return{$:"Signing",a:e}},nl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:rl(e)}}),al={$:"Black"},il=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),ol={$:"RBEmpty_elm_builtin"},ul={$:"Red"},sl=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(il,ul,t,r,h(il,al,c,f,l,d),h(il,al,i,o,u,s))}return h(il,e,i,o,h(il,ul,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(il,ul,c,f,h(il,al,g,v,y,m),h(il,al,t,r,d,a))}return h(il,e,t,r,n,a)}),cl=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(il,ul,e,t,ol,ol);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Eu,e,a).$){case"LT":return h(sl,n,a,i,l(cl,e,t,o),u);case"EQ":return h(il,n,a,t,o,u);default:return h(sl,n,a,i,o,l(cl,e,t,u))}}),fl=n(function(e,t,r){var n=l(cl,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(il,al,a,i,o,u)}return n}),ll=n(function(e,t,r){var n=e.a,a=Xf(r),i=l(fl,n.ref,f(nl,r,t),n.txs);return L(Zf(D(n,{ref:n.ref+1,txs:i})),f(Pf,n.tagger,n.outPort(f(tl,n.ref,a))))}),dl=ll,hl=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,go,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(dl,n,i,o))}return x(ci,go,M([f(Vf,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),pl=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),gl=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),vl={$:"Seller"},yl=function(e){return{$:"Posix",a:e}},ml=yl,bl={autoabortInterval:ml(0),autorecallInterval:ml(0),autoreleaseInterval:ml(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:vl},Cl=function(e){return{$:"TokenValue",a:e}},El=function(e){return e.a},Sl=r(function(e,t){return f(hc,Gu,f(Ao,Qa,f(rs,e,t)))}),Tl=r(function(e,t){return Cl(f(Sl,El(e),wu(t)))}),wl=function(e){return f(Tl,e,12)},Il=function(e){return f(Tl,e,3)},Al=Cl(wu(0)),Bl=r(function(e,t){var r=Al;return{abortPunishment:wl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Il(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),kl=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Nl=qr,Rl=function(e){var t=kl(f(Nl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Ro(e)-1-r;return L(U(f(Po,r,e),f(_o,r+1,e)),n)},$l=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 yr}}),_l=function(e){var t=e.a,r=f($l,Ja(0),t);return Jo(r.b?t:yr)},Ll=Z,xl=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}}}),Pl=n(function(e,t,r){var n=f(xl,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(js,e,r),l(Pl,e,t,n)):yr}),Dl=r(function(e,t){return l(Pl,e,e,t)}),Ul=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Ao,ka(a),r)});return f(La,t,si(yr))}(Ua),Ol=function(e){return f(Ao,f(Da,_l,Jo),Ul(f(xa,f(Io,$a,f(Io,fs,Ll)),f(Dl,7,$a(e)))))},Ml=Q,Fl=function(e){var t=_s(Ml(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Ao,iu(vu),Ol(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Ao,iu(yu),Ol(r))}return ci;default:var r=t;return f(Ao,iu(yu),Ol(r))}},Vl=function(e){var t=function(e){return!f(ls,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(hc,0,kl(r)))}},Kl=function(e){return f(Hu,e,e)},Hl=wu(2),jl=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return Ju;case"Neg":return nu;default:if(R(r,Ju))return f(Hu,e,t);if(Vl(r)){var n=e,a=Kl(t),i=f(Sl,r,Hl);e=n,t=a,r=i;continue e}var n=f(Hu,t,e),a=Kl(t),i=f(Sl,f(qu,r,Ju),Hl);e=n,t=a,r=i;continue e}}),ql=r(function(e,t){return l(jl,Ju,e,t)}),Gl=function(e){if(""===e)return ci;var t=Rl(e),r=t.a,n=t.b,a=Fl(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(Hu,o,f(ql,wu(10),wu(i)));return si(u)},zl=function(e){return f(Ao,Cl,Gl(e))},Yl=jr,Wl=function(e){for(;;){if(f(Yl,".",e))return l($o,0,-1,e);{if(!f(Yl,"0",e))return""===e?"0":e;e=l($o,0,-1,e)}}},Jl=f(Da,f(cs,7,P("0")),Ni),Ql=function(e){return f(Ri,"",e)},Xl=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Ql(f(ka,Ni(n),f(xa,Jl,a)))}return"0"},Zl=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Xl(t);default:var t=e.a;return"-"+Xl(t)}},ed=r(function(e,t){return e<1?t:l($o,0,-e,t)}),td=function(e){var t=l(cs,18,P("0"),Zl(e)),r=f(ed,18,t)+"."+f(Mo,18,t);return function(e){return""===e?"0":e}(Wl(r))},rd=r(function(e,t){var r=td(t),n=kl(f(Nl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Po,a+1+e,r):f(Po,a,r)}),nd=r(function(e,t){if("Nothing"===e.$)return td(El(t));var r=e.a;return f(rd,r,El(t))}),ad=ee,id=function(e){var t=ad(f(nd,ci,e));if("Just"===t.$){return t.a}f(Mf,"Error converting tokenValue to float: string -> float failed",e);return 0},od=function(e){if(""===e)return fi("You must specify a trade amount.");var t=zl(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return id(r)<1?fi("Trade amount can't be less than 1."):li(r)},ud=function(e){if(""===e)return fi("You must specify a fiat price.");var t=Fl(e);if("Nothing"===t.$){var r=ad(e);return fi("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 li(n)},sd=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),cd=function(e){return""===e},fd=function(e){return cd(e)?ci:si(e)},ld=function(e){return f(sd,"You must specify a fiat type.",fd(e))},dd=function(e){return""===e?fi("Must specify a payment method."):li(e)},hd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),pd=g(hd,ci,ci,ci,ci,ci,ci,ci),gd=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},vd=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),yd={$:"Custom"},md=r(function(e,t){return{info:t,type_:e}}),bd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Cd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),Ed=function(e){return e.a},Sd=function(e){return p(bd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(md,yd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Cd,function(e){return D(pd,{daiAmount:si(e)})},od(e.daiAmount)),f(Cd,function(e){return D(pd,{fiatAmount:si(e)})},ud(e.fiatAmount)),f(Cd,function(e){return D(pd,{fiatType:si(e)})},ld(e.fiatType)),f(Cd,function(e){return D(pd,{paymentMethod:si(e)})},dd(e.paymentMethod)),gd(d(vd,function(e){return Ed(e)>0?li(e):fi(D(pd,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return Ed(e)>0?li(e):fi(D(pd,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return Ed(e)>0?li(e):fi(D(pd,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Td=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},wd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Id=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Ad=function(e){var t=Sd(e.inputs),r=function(){return R(e.errors,pd)?pd:"Ok"===t.$?pd:t.a}();return D(e,{createParameters:l(wd,Bl,Td(e.wallet),Id(t)),errors:r})},Bd=r(function(e,t){return Ad(D(t,{inputs:e}))}),kd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Nd=function(e){return d(kd,f(Bd,bl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:pd,inputs:bl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),go,bo,yr)},Rd=a(function(e,t,r,n){return la(d(pl,e,t,r,n))}),$d=function(e){return{$:"Address",a:e}},_d=f(Io,Ko,f(Io,Ml,$d)),Ld=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return _d("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return _d("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return _d("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return _d("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return _d("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},xd=function(e){return _d("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},Pd=function(e){return{$:"AddressE",a:e}},Dd=Pd,Ud=function(e){return{$:"UintE",a:e}},Od=Ud,Md=n(function(e,t,r){return{data:si(f(If,"approve(address,uint256)",M([Dd(t),Od(r)]))),decoder:Wo(Fo),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Fd=function(e){return f(Tl,e,200)},Vd=r(function(e,t){return Cl(f($u,El(e),El(t)))}),Kd=function(e){var t=f(Tl,e.tradeAmount,200);return f(Vd,e.pokeReward,f(Vd,Fd(e.tradeAmount),f(Vd,t,function(){return"Buyer"===e.initiatorRole.$?Il(e.tradeAmount):e.tradeAmount}())))},Hd=Mi(ya),jd=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),qd=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),Gd=Xn,zd=Qn,Yd=function(e){return f(zd,{caseInsensitive:!1,multiline:!1},e)},Wd=Jn,Jd=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Qd=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}}),Xd=r(function(e,t){return!f(Qd,f(Da,Du,e),t)}),Zd=Xd(Ua),eh=q,th=r(function(e,t){if("Ok"===t.$){return t.a}return e}),rh=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),nh=f(La,rh(ka),li(yr)),ah=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},ih=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(su,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(su,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(su,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(su,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(su,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(su,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(su,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(su,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(su,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(su,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(su,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(su,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(su,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(su,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(su,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(is(s)+" is not a valid hexadecimal character.")}}}),oh=function(e){if(cd(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(Vo,"-",e)){var t=f(hc,yr,ah(_s(e)));return f(Uo,Oo,l(ih,Ti(t)-1,t,0))}return l(ih,Ro(e)-1,_s(e),0)}();return f(Cd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},uh=function(e){var t=_s(e);return function(e){return L(t,e)}(f(th,yr,nh(f(xa,oh,f(_i,"",f(Ri,"",f(xa,f(Io,ps,Fs),f(js,20,Ef(f(xa,f(Io,eh,yi),t))))))))))},sh=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=uh(Ko(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!Jd(e)&&Zd(o)},ch=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9a-f]{40}$"))),fh=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9A-F]{40}$"))),lh=function(e){return'"'+e+'"'},dh=function(e){var t=Ko(e),r=f(Po,24,t),n=f(Mo,40,e);return 64===Ro(t)&&f(ki,Ja(P("0")),r)?fh(n)||ch(n)?li($d(n)):sh(n)?li($d(n)):fi("Given address "+lh(e)+" failed the EIP-55 checksum test."):40!==Ro(t)?fi("Given address "+lh(e)+" is not the correct length."):Jd(t)?fh(t)||ch(t)?li($d(t)):sh(t)?li($d(t)):fi("Given address "+lh(e)+" failed the EIP-55 checksum test."):fi("Given address "+lh(e)+" contains invalid hex characters.")},hh=ko(function(e){var t=e.a,r=e.b;return f(Uo,f(xo,t,r),dh(Do(r)))}),ph=r(function(e,t){var r=t.a;return ko(function(t){var n=t.a,a=t.b;return r(f(No,n,f(_o,64*e,a)))})}),gh=Jr,vh=r(function(e,t){return f(gh,"data",Wo(f(ph,e,t)))}),yh=Qr,mh=r(function(e,t){return f(gh,"topics",f(yh,e,Wo(t)))}),bh=function(e){return f(Ao,f(Io,$a,f(Ra,r(function(e,t){return f($u,wu(e),f(Hu,t,ns))}),Gu)),Ul(f(xa,f(Io,$a,f(Io,fs,f(Io,oh,Id))),f(Dl,8,$a(e)))))},Ch=function(e){var t=_s(Ml(e));e:for(;;){if(!t.b)return ci;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(Ao,Hu(wu(-1)),bh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Ao,Hu(wu(-1)),bh(a))}return ci;case"+":if(t.b.b){var a=t.b;return bh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return bh(a)}t.b;return ci}break e;default:break e}}var a=t;return bh(a)},Eh=ko(function(e){var t=e.a,r=e.b;return f(Uo,f(xo,t,r),f(sd,"Error Decoding Uint into BigInt",Ch(Tf(Do(r)))))}),Sh=f(Hd,f(mh,1,hh),f(Hd,f(vh,1,hh),f(Hd,f(vh,0,Eh),Fi(jd)))),Th=nn,wh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Ih=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(Th,e,Jf(M([L("data",Hf(t.data)),L("topics",f(wh,Gf,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Ah=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Bh=r(function(e,t){return f(Uo,function(e){return e.id},f(Ah,function(e){return f(Cd,Di,f(Ih,Sh,e).returnData)},f(sd,"No log found from that factoryAddress in that txReceipt",kl(f(Yf,function(t){return R(f(Io,Kf,Ml)(t.address),f(Io,Kf,Ml)(Ld(e)))},t.logs)))))}),kh=n(function(e,t,r){return{data:si(f(If,"allowance(address,address)",M([Dd(t),Dd(r)]))),decoder:Wo(Eh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Nh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Rh=function(e){switch(e.$){case"BlockNum":var t=e.a;return Hf(Tf(ps(t)));case"EarliestBlock":return Hf("earliest");case"LatestBlock":return Hf("latest");default:return Hf("pending")}},$h=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return Qf(M([L("to",f(Ao,jf,t)),L("from",f(Ao,jf,r)),L("gas",f(Ao,zf,n)),L("gasPrice",f(Ao,qf,a)),L("value",f(Ao,qf,i)),L("data",f(Ao,Gf,o))]))},_h=function(e){return{$:"BadBody",a:e}},Lh=function(e){return{$:"BadStatus",a:e}},xh=function(e){return{$:"BadUrl",a:e}},Ph={$:"NetworkError"},Dh={$:"Timeout"},Uh=rn,Oh=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(xh(r));case"Timeout_":return fi(Dh);case"NetworkError_":return fi(Ph);case"BadStatus_":var n=t.a,a=t.b;return fi(Lh(n.statusCode));default:var n=t.a,a=t.b,i=f(Uh,f(gh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(_h(Di(u)))}}),Mh=n(function(e,t,r){return Jf(M([L("id",el(e)),L("jsonrpc",Hf("2.0")),L("method",Hf(t)),L("params",f(wh,Ua,r))]))}),Fh=ol,Vh=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Eu,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),Kh=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},Hh=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(il,ul,p,g,h(il,al,r,n,h(il,ul,i,o,u,s),v),h(il,al,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(il,al,r,n,h(il,ul,i,o,u,s),h(il,ul,f,l,d,m))}return e},jh=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(il,ul,i,o,h(il,al,s,c,f,l),h(il,al,r,n,d,h(il,ul,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(il,al,r,n,h(il,ul,i,o,C,d),h(il,ul,g,v,y,m))}return e},qh=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(il,r,u,s,c,h(il,ul,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 jh(t)}break e}o.a,o.d;return jh(t)}break e}return t}),Gh=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(il,t,r,n,Gh(a),u)}var s=Hh(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(sl,c,f,l,Gh(d),p)}return ol}return h(il,t,r,n,Gh(a),u)}return ol},zh=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return ol;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(il,r,n,a,f(zh,e,i),o)}var s=Hh(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(sl,c,l,d,f(zh,e,p),v)}return ol}return h(il,r,n,a,f(zh,e,i),o)}return f(Yh,e,g(qh,e,t,r,n,a,i,o))}),Yh=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(R(e,n)){var u=Kh(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(sl,r,s,c,i,Gh(o))}return ol}return h(sl,r,n,a,i,f(zh,e,o))}return ol}),Wh=r(function(e,t){var r=f(zh,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(il,al,n,a,i,o)}return r}),Jh=n(function(e,t,r){var n=t(f(Vh,e,r));if("Just"===n.$){var a=n.a;return l(fl,e,a,r)}return f(Wh,e,r)}),Qh=function(e){return"Just"===e.$},Xh=gn,Zh=vn,ep=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),tp=function(e){return{$:"BadUrl_",a:e}},rp=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),np={$:"NetworkError_"},ap=function(e){return{$:"Receiving",a:e}},ip=function(e){return{$:"Sending",a:e}},op={$:"Timeout_"},up=function(e){return f(ta,"application/json",f(xi,0,e))},sp=n(function(e,t,r){return up(l(Mh,e,t,r))}),cp=f(ea,"",Ua),fp=Te,lp=Se,dp=function(e){if("Ok"===e.$){var t=e.a;return lp(t)}var r=e.a;return fp(r)},hp=function(e){return l(Zn,gr,dp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},pp=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return hp({body:l(sp,1,r,n),headers:yr,method:"POST",resolver:cp(Oh(a)),timeout:ci,url:t})},gp=n(function(e,t,r){return pp({decoder:t.decoder,method:"eth_call",params:M([$h(t),Rh(r)]),url:e})}),vp={$:"LatestBlock"},yp=r(function(e,t){return l(gp,e,t,vp)}),mp=function(e){return{$:"Perform",a:e}},bp=sn,Cp=lp(gr),Ep=r(function(e,t){return f(bp,function(t){return lp(e(t))},t)}),Sp=n(function(e,t,r){return f(bp,function(t){return f(bp,function(r){return lp(f(e,t,r))},r)},t)}),Tp=function(e){return l(La,Sp(ka),lp(yr),e)},wp=r(function(e,t){var r=t.a;return Be(f(bp,Xh(e),r))}),Ip=n(function(e,t,r){return f(Ep,function(e){return gr},Tp(f(xa,wp(e),t)))}),Ap=n(function(e,t,r){return lp(gr)}),Bp=r(function(e,t){var r=t.a;return mp(f(Ep,e,r))});pn.Task=Pe(Cp,Ip,Ap,Bp);var kp=Ue("Task"),Np=cn,Rp=r(function(e,t){return kp(mp(f(Np,f(Da,f(Da,lp,e),fi),f(bp,f(Da,f(Da,lp,e),li),t))))}),$p=a(function(e,t,r,n){return f(Rp,n,f(yp,Nh(eo(e)),l(kh,xd(e),t,r)))}),_p=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return _d("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return _d("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return _d("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return _d("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return _d("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Lp=function(e){return{$:"BoolE",a:e}},xp=Lp,Pp=function(e){return{$:"StringE",a:e}},Dp=Pp,Up=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:si(f(If,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([Dd(t),Dd(r),xp(n),Od(a),Od(i),Od(o),Od(u),Od(s),Od(c),Od(l),Od(d),Dp(h),Dp(p)]))),decoder:Wo(hh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},Op=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:si(f(If,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([Dd(t),Dd(r),xp(n),Od(a),Od(i),Od(o),Od(u),Od(s),Od(c),Od(l),Od(d),Dp(h),Dp(p)]))),decoder:Wo(hh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},Mp=r(function(e,t){return{paymentMethods:t,price:e}}),Fp=function(e){return Hf(Zl(e))},Vp=function(e){return f(wh,Ua,M([Hf(e.fiatType),Fp(e.amount)]))},Kp=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},Hp=function(e){return Jf(M([L("type",Hf(Kp(e.type_))),L("info",Hf(e.info))]))},jp=function(e){var t=Vp(e.price),r=f(wh,Hp,e.paymentMethods);return f(xi,0,Jf(M([L("paymentmethods",r),L("price",t)])))},qp=r(function(e,t){return D(t,{value:si(e)})}),Gp=function(e){return wu(Ed(e))},zp=function(e){return f(Sl,Gp(e),wu(1e3))},Yp=r(function(e,t){var r=function(){return"Token"===e.$?Up:Op}();return function(){return"Native"===e.$?qp(El(Kd(t))):Ua}()(r(Ld(e))(t.initiatorAddress)(_p(e))(R(t.initiatorRole,vl))(El(t.tradeAmount))(El(Il(t.tradeAmount)))(El(wl(t.tradeAmount)))(El(t.pokeReward))(zp(t.autorecallInterval))(zp(t.autoabortInterval))(zp(t.autoreleaseInterval))(El(Fd(t.tradeAmount)))(jp(f(Mp,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),Wp=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),Jp=function(e){return{$:"CreateNeedsSig",a:e}},Qp=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Xp=r(function(e,t){var r=xf(f(Yp,e,t)),n={onBroadcast:ci,onMined:si(L(Wp(e),ci)),onSign:si(Qp(e))};return L(si(Jp(e)),f(To,n,r))}),Zp=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),eg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),tg=function(e){return{$:"ApproveNeedsSig",a:e}},rg=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),ng=r(function(e,t){return{$:"Confirm",a:e,b:t}}),ag=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),ig={$:"NoOp"},og=function(e){return{appCmds:yr,chainCmd:bo,cmd:go,model:e}},ug=function(e){return Ll(Zl(e))},sg={$:"Error"},cg=r(function(e,t){f(Mf,e+" fetch error",t);return{align:Uf,label:"web3FetchError",mainParagraphs:M([M([Ff('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:sg}}),fg=r(function(e,t){return{align:Uf,label:"web3MiningError",mainParagraphs:M([M([Ff('Error mining "'+e+'" transaction: '+t)])]),noticeType:sg}}),lg={$:"Caution"},dg=r(function(e,t){return{align:Uf,label:"web3SigError",mainParagraphs:M([M([Ff('Error signing "'+e+'" transaction: '+t)])]),noticeType:lg}}),hg={$:"KovanDai"},pg=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(hg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},gg=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},vg=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),yg=function(e){return f(vg,pg,gg(e))},mg=r(function(e,t){return 1-e(1-t)}),bg=function(e){return f(su,e,5)},Cg=mg(bg),Eg={easing:Cg,offset:12,speed:200},Sg=function(e){return{$:"External",a:e}},Tg=function(e){return{$:"Internal",a:e}},wg=function(e){return{$:"NotFound",a:e}},Ig=function(e){for(;;){e=e.a}},Ag=r(function(e,t){return kp(mp(f(Ep,e,t)))}),Bg={$:"Http"},kg={$:"Https"},Ng=Kr,Rg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),$g=i(function(e,t,r,n,a){if(cd(a)||f(Ng,"@",a))return ci;var i=f(Nl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=Ll(f(_o,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Rg,e,f(Po,o,a),s,t,r,n))}return si(p(Rg,e,a,ci,t,r,n))}),_g=a(function(e,t,r,n){if(cd(n))return ci;var a=f(Nl,"/",n);if(a.b){var i=a.a;return h($g,e,f(_o,i,n),t,r,f(Po,i,n))}return h($g,e,"/",t,r,n)}),Lg=n(function(e,t,r){if(cd(r))return ci;var n=f(Nl,"?",r);if(n.b){var a=n.a;return d(_g,e,si(f(_o,a+1,r)),t,f(Po,a,r))}return d(_g,e,ci,t,r)}),xg=r(function(e,t){if(cd(t))return ci;var r=f(Nl,"#",t);if(r.b){var n=r.a;return l(Lg,e,si(f(_o,n+1,t)),f(Po,n,t))}return l(Lg,e,ci,t)}),Pg=function(e){return f(Vo,"http://",e)?f(xg,Bg,f(_o,7,e)):f(Vo,"https://",e)?f(xg,kg,f(_o,8,e)):ci},Dg=Wt,Ug=Gt(zt),Og=sa,Mg=r(function(e,t){return L(e,t)}),Fg=_r,Vg=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=Tu(r-n),o=f(ei,1,Fg(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),Kg=r(function(e,t){var n=r(function(t,r){return Tp(f(xa,Og(0),d(Vg,e.speed,e.easing,t,r-e.offset)))});return f(bp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(Sp,Mg,Ug,Dg(t)))}),Hg=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Td(t.wallet),yg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d($p,a,n.address,Ld(eo(a)),Zp(a));return d(kd,t,i,bo,yr)}return og(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(kd,D(t,{inputs:D(u,{userRole:o})}),go,bo,M([function(){return"Buyer"===o.$?d(Rd,"create offer type changed","input","sell dai",0):d(Rd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return og(f(Bd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return og(f(Bd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return og(f(Bd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return og(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return og(f(Bd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return og(f(Bd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return og(f(Bd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return og(f(Bd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(kd,(g?Bd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),go,bo,g?M([d(Rd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=Sd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Bl,n,m);return og(D(t,{depositAmount:si(El(Kd(b))),txChainStatus:si(f(ng,v,b))}))}var C=y.a;return d(kd,D(t,{errors:C}),f(Rp,Qu(ig),function(){return f(Kg,D(Eg,{offset:60}),"inputError")}()),bo,yr);case"AbortCreate":return d(kd,D(t,{txChainStatus:ci}),go,bo,M([d(Rd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Xp,v,b);var e=v.a,r=function(){var t=xf(l(Md,xd(e),Ld(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(rg,e,b))};return f(To,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(xu,a,E),ba)?L(si(tg(e)),r):f(Xp,v,b)}return L(si(tg(e)),r)}(),T=S.a,w=S.b;return d(kd,D(t,{txChainStatus:T}),go,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return og(D(t,{txChainStatus:si(l(eg,a,b,A))}))}var B=I.a;return d(kd,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(xu,N,P),ba))return og($);var U=f(Xp,eo(a),b),T=U.a,w=U.b;return d(kd,D($,{txChainStatus:T}),go,w,yr)}return og($)}var O=k.a;return d(kd,t,go,bo,M([pa(f(cg,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return og(D(t,{txChainStatus:si(f(ag,v,A))}))}var B=I.a;return d(kd,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(kd,t,go,bo,M([pa(f(fg,"create",B))]))}var F=e.a,V=e.b.a,K=f(vg,ug,Id(f(Bh,F,V)));if("Just"===K.$){var H=K.a;return d(kd,t,go,bo,M([da(f(Bf,F,H))]))}return d(kd,t,go,bo,M([pa(f(Vf,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(kd,t,go,bo,M([ga]));case"NoOp":return og(t);default:var j=e.a;return d(kd,t,go,bo,M([j]))}}),jg={$:"Open"},qg=r(function(e,t){return f(Eu,Ed(e),Ed(t))}),Gg=r(function(e,t){return R(t.state.phase,jg)&&R(f(qg,t.derived.phaseEndTime,e),Ta)}),zg={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Yg=r(function(e,t){return{maxDai:t,minDai:e}}),Wg=f(Yg,ci,ci),Jg={$:"Expires"},Qg=function(e){return L({errors:Wg,filterFunc:Gg,inputs:zg,showCurrencyDropdown:!1,tradeTable:fo(L(Jg,lo)),wallet:e},go)},Xg=r(function(e,t){return D(t,{paymentMethod:e})}),Zg=r(function(e,t){return D(t,{paymentMethodTerms:e})}),ev=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return D(e,{inputs:f(Zg,r,f(Xg,"",e.inputs))})},tv=r(function(e,t){var r=f(Yf,nc(e),t.inputs.paymentMethodTerms);return D(t,{inputs:f(Zg,r,t.inputs)})}),rv=function(e){return D(e,{filterFunc:Gg,inputs:zg})},nv=function(e){return{$:"TradeTableMsg",a:e}},av=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),iv=function(e){return d(av,e,go,bo,yr)},ov=r(function(e,t){return D(t,{fiatType:e})}),uv=r(function(e,t){return D(t,{maxDai:e})}),sv=r(function(e,t){return D(t,{minDai:e})}),cv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return iv(D(t,{inputs:f(sv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return iv(D(t,{inputs:f(uv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return iv(D(t,{inputs:f(ov,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return iv(D(t,{inputs:(n?ov(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return iv(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return iv(D(t,{inputs:f(Xg,r,t.inputs)}));case"AddSearchTerm":return iv(ev(t));case"RemoveTerm":var a=e.a;return iv(f(tv,a,t));case"ResetSearch":return iv(rv(t));case"TradeTableMsg":var i=e.a,o=f(Lf,i,t.tradeTable);return d(av,D(t,{tradeTable:o.model}),f(Pf,nv,o.cmd),f(Bo,nv,o.chainCmd),f(xa,Ji(nv),o.appCmds));case"NoOp":return iv(t);default:var u=e.a;return d(av,t,go,bo,M([u]))}}),fv=a(function(e,t,r,n){return e(Jf(M([L("title",Hf(t)),L("body",function(){if("Nothing"===r.$)return Wf;var e=r.a;return Hf(e)}()),L("image",function(){if("Nothing"===n.$)return Wf;var e=n.a;return Hf(e)}())])))}),lv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},dv=function(e){return e.a+"="+e.b},hv=function(e){return e.b?"?"+f(Ri,"&",f(xa,dv,e)):""},pv=r(function(e,t){return"/"+(f(Ri,"/",e)+hv(t))}),gv=function(e){switch(e.$){case"Home":return f(pv,M(["DAIHard"]),yr);case"Create":return f(pv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(pv,M(["DAIHard","trade",lv(t),Ni(r)]),yr);case"Marketplace":return f(pv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(pv,M(["DAIHard","history",Kf(n)]),yr);default:return f(pv,yr,yr)}},vv={$:"NotFound"},yv=function(e){return{$:"AgentHistory",a:e}},mv={$:"Create"},bv={$:"Home"},Cv={$:"Marketplace"},Ev=function(e){return{$:"Parser",a:e}},Sv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Tv=r(function(e,t){return Ev(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Sv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),wv=f(Tv,"ADDRESS",f(Io,dh,Id)),Iv={$:"Eth"},Av={$:"Kovan"},Bv=f(Tv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Iv));case"keth":return si(Zi(Av));case"dai":return si(eo(Xi));case"kdai":return si(eo(hg));case"xdai":return si(Zi(to));default:return ci}}),kv=f(Tv,"NUMBER",Ll),Nv=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Sv,r,n,a,i,e(o))}),Rv=r(function(e,t){var r=t.a;return Ev(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,Nv(u),r(h(Sv,n,a,i,o,e)))})}),$v=function(e){return l(La,oo,yr,e)},_v=r(function(e,t){return $v(f(xa,e,t))}),Lv=function(e){return Ev(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 R(u,e)?M([h(Sv,f(ka,u,r),s,a,i,o)]):yr}return yr})},xv=r(function(e,t){var r=e.a,n=t.a;return Ev(function(e){return f(_v,n,r(e))})}),Pv=Ev(function(e){return M([e])}),Dv=f(xv,Lv("DAIHard"),function(e){return Ev(function(t){return f(_v,function(e){return(0,e.a)(t)},e)})}(M([f(Rv,bv,Pv),f(Rv,mv,Lv("create")),f(Rv,Bf,f(xv,Lv("trade"),f(xv,Bv,kv))),f(Rv,Cv,Lv("marketplace")),f(Rv,yv,f(xv,Lv("history"),wv)),f(Rv,function(e){return yv(e)},f(xv,Lv("history"),wv))]))),Uv=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 si(t.value)}return si(t.value)}return ci}},Ov=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,Ov(r))}return yr}return yr},Mv=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return Ov(r)}var r=t;return Ov(r)},Fv=Qt,Vv=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),Kv=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=Fv(n);if("Nothing"===o.$)return t;var u=o.a,s=Fv(i);if("Nothing"===s.$)return t;var c=s.a;return l(Jh,u,Vv(c),t)}return t}),Hv=function(e){if("Nothing"===e.$)return Fh;var t=e.a;return l(La,Kv,Fh,f(_i,"&",t))},jv=r(function(e,t){var r=e.a;return Uv(r(h(Sv,yr,Mv(t.path),Hv(t.query),t.fragment,Ua)))}),qv=function(e){return f(hc,vv,f(jv,Dv,e))},Gv=aa,zv=r(function(e,t){return f(Gv,e,gv(t))}),Yv=je("connectToWeb3",function(e){return Wf}),Wv=function(e){return Jf(M([L("event",Hf(e.event)),L("category",Hf(e.category)),L("label",Hf(e.label)),L("value",el(e.value))]))},Jv=r(function(e,t){return Jf(M([L("address",Hf(Kf(e))),L("signSeedMsg",Hf(t))]))}),Qv=je("gTagOut",Ua),Xv=je("genPrivkey",Ua),Zv=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),ey=n(function(e,t,r){return f(vg,_c(t),f(Ao,function(e){return e.trades},f(Zv,function(t){return R(t.factory,e)},r)))}),ty=je("notifyPort",Ua),ry=je("requestNotifyPermissionPort",function(e){return Wf}),ny=r(function(e,t){return D(t,{wallet:e})}),ay=r(function(e,t){return L(f(Bd,t.inputs,D(t,{wallet:e})),function(){var t=L(Td(e),yg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d($p,n,r.address,Ld(eo(n)),Zp(n))}return go}())}),iy=r(function(e,t){return D(t,{wallet:e})}),oy=function(e){return{$:"AllowanceFetched",a:e}},uy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Td(e),yg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(yg(e),si(i.factory))?d($p,a,n.address,i.creationInfo.address,oy):go}return go}())}),sy=function(e){return{$:"AgentHistoryModel",a:e}},cy=function(e){return{$:"CreateModel",a:e}},fy=function(e){return{$:"CreateMsg",a:e}},ly=function(e){return{$:"MarketplaceModel",a:e}},dy=function(e){return{$:"TradeModel",a:e}},hy=function(e){return{$:"TradeMsg",a:e}},py=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,go);case"CreateModel":var r=t.a,n=f(ay,e,r),a=n.a,i=n.b;return L(cy(a),f(Pf,fy,i));case"TradeModel":var o=t.a,u=f(uy,e,o),s=u.a,c=u.b;return L(dy(s),f(Pf,hy,c));case"MarketplaceModel":var l=t.a;return L(ly(f(iy,e,l)),go);default:var d=t.a;return L(sy(f(ny,e,d)),go)}}),gy=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),vy=function(e){return{$:"PartiallyLoadedTrade",a:e}},yy=r(function(e,t){return vy(g(gy,e,t,ci,ci,ci,ci,ci))}),my=function(e){return{$:"CurrentBlockFetched",a:e}},by=Yo(f(Io,Ko,oh)),Cy=function(e){return pp({decoder:by,method:"eth_blockNumber",params:yr,url:e})},Ey=function(e){return f(Rp,my,Cy(e))},Sy=r(function(e,t){return{address_:e,blocknum:t}}),Ty=function(e){return ko(function(t){return li(L(t,e))})},wy=n(function(e,t,r){var n=t.a,a=r.a;return ko(function(t){return f(Ah,function(t){var r=t.a,n=t.b;return f(Uo,_f(e(n)),a(r))},n(t))})}),Iy=r(function(e,t){return l(wy,r(function(e,t){return e(t)}),t,e)}),Ay=Wo(f(Iy,Eh,f(Iy,hh,Ty(Sy)))),By=r(function(e,t){return{data:si(f(If,"createdTrades(uint256)",M([Od(t)]))),decoder:Ay,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ky=n(function(e,t,r){return f(Rp,r,f(yp,Nh(e),f(By,Ld(e),t)))}),Ny=function(e){return{$:"CreationInfoFetched",a:e}},Ry=r(function(e,t){return l(ky,e,wu(t),Ny)}),$y=function(e){return{$:"EventSentryMsg",a:e}},_y=function(e){return{$:"BlockNumber",a:e}},Ly=function(e){return{$:"EventSentry",a:e}},xy=function(e){return{$:"Set_elm_builtin",a:e}},Py=xy(Fh),Dy=r(function(e,t){return L(Ly({blockNumber:ci,errors:yr,nodePath:t,pending:Py,ref:1,requests:Fh,tagger:e,watching:Py}),f(Rp,f(Io,_y,e),Cy(t)))}),Uy=function(e){return f(Dy,$y,Nh(e))},Oy=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),My=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},Fy=My(f(Oy,ci,ci)),Vy=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:jg,secureCommInfo:Fy,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),Ky=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Hy=n(function(e,t,r){var n=f(Ry,t,r),a=Uy(t),i=a.a,o=a.b;return d(Ky,l(Vy,f(yy,t,r),i,e),po(M([n,o,Ey(Nh(t))])),bo,M([ha]))}),jy=function(e){return{$:"LoadedTrade",a:e}},qy=r(function(e,t){var r=Uy(t.factory),n=r.a,a=r.b;return d(Ky,l(Vy,jy(t),n,e),po(M([a,Ey(Nh(t.factory))])),bo,M([ha]))}),Gy=function(e){return{data:si(f(If,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},zy=function(e){return{data:si(f(If,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yy=function(e){return{data:si(f(If,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Wy=r(function(e,t){return{data:si(f(If,"initiatorStatement(string)",M([Dp(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Jy=function(e){return{data:si(f(If,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Qy=function(e){return{data:si(f(If,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Xy=r(function(e,t){return{data:si(f(If,"responderStatement(string)",M([Dp(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Zy=r(function(e,t){return{amount:t,fiatType:e}}),em=f(qo,function(e){var t=Fl(e);if("Just"===t.$){var r=t.a;return Fi(r)}return Go("Can't convert that to a BigInt")},zo),tm=l(Mi,Zy,f(yh,0,zo),f(yh,1,em)),rm={$:"Bank"},nm={$:"Cash"},am=function(e){switch(e){case"cash":return si(nm);case"bank":return si(rm);case"custom":return si(yd);default:return ci}},im=f(qo,function(e){var t=am(e);if("Just"===t.$){var r=t.a;return Fi(r)}return Go("")},zo),om=l(Mi,md,f(gh,"type",im),f(gh,"info",zo)),um=oe,sm=function(e){var t=l(Mi,Mp,f(gh,"price",tm),f(gh,"paymentmethods",um(om)));return f(Uh,t,e)},cm=r(function(e,t){return{commPubkey:t,responder:e}}),fm=r(function(e,t){var n=r(function(t,r){return l($o,t,t+2*r,e)}),a=f(Io,oh,Uo(ti(2)));return f(Ah,function(t){return f(Uo,function(e){return f(n,t+64,e)},oh(l($o,t,t+64,e)))},a(t))}),lm=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),dm=n(function(e,t,r){var n=l(Ra,lm(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),hm=j,pm=function(e){return is(hm(e))},gm=function(e){return l(dm,r(function(e,t){return U(t,pm(e))}),"",e)},vm=ko(function(e){var t=e.a,r=e.b;return f(Uo,f(xo,t,r),f(Ah,gm,f(Ah,f(Io,xa(oh),nh),f(Uo,Yf(f(Io,cd,Du)),f(Uo,xs(2),f(fm,t,Do(r)))))))}),ym=f(Hd,f(vh,1,vm),f(Hd,f(vh,0,hh),Fi(cm))),mm=r(function(e,t){return{commPubkey:t,terms:e}}),bm=f(Hd,f(vh,1,vm),f(Hd,f(vh,0,vm),Fi(mm))),Cm=function(e){return{statement:e}},Em=f(Hd,f(vh,0,vm),Fi(Cm)),Sm=function(e){return{statement:e}},Tm=f(Hd,f(vh,0,vm),Fi(Sm)),wm={$:"AbortedEvent"},Im={$:"BurnedEvent"},Am={$:"ClaimedEvent"},Bm=function(e){return{$:"CommittedEvent",a:e}},km=function(e){return{$:"InitiatedEvent",a:e}},Nm=function(e){return{$:"InitiatorStatementLogEvent",a:e}},Rm={$:"PokeEvent"},$m={$:"RecalledEvent"},_m={$:"ReleasedEvent"},Lm=function(e){return{$:"ResponderStatementLogEvent",a:e}},xm=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9a-fA-F]+$"))),Pm=function(e){return xm(e)?li(Ds(Ko(e))):fi("Something in here is not very hexy: "+lh(e))},Dm=Yo(Pm),Um=f(gh,"topics",f(yh,0,Dm)),Om=function(e){return Ds(f(Ri,"",f(xa,f(Io,ps,Fs),Ef(f(xa,yi,_s(e))))))},Mm=f(qo,function(e){return R(e,Om("Initiated(string,string)"))?f(Oi,km,bm):R(e,Om("Committed(address,string)"))?f(Oi,Bm,ym):R(e,Om("Recalled()"))?Fi($m):R(e,Om("Claimed()"))?Fi(Am):R(e,Om("Aborted()"))?Fi(wm):R(e,Om("Released()"))?Fi(_m):R(e,Om("Burned()"))?Fi(Im):R(e,Om("InitiatorStatementLog(string)"))?f(Oi,Nm,Em):R(e,Om("ResponderStatementLog(string)"))?f(Oi,Lm,Tm):R(e,Om("Poke()"))?Fi(Rm):Go("Unrecognized topic hash")},Um),Fm={$:"Initiator"},Vm={$:"Responder"},Km=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(Fm):f(vg,function(e){return R(t,e)?si(Vm):ci},e.state.responder)}),Hm=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},jm=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},qm=function(e){return R(e.buyerDeposit,Il(e.tradeAmount))&&R(e.abortPunishment,wl(e.tradeAmount))},Gm={$:"Invalid"},zm=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Ym=r(function(e,t){return ml(Ed(t)+Ed(e))}),Wm=function(e){var t=ad(Zl(e.amount));if("Just"===t.$){return t.a}f(Mf,"Error converting FiatValue to float--string -> float failed!",e);return 0},Jm=r(function(e,t){return(t-e)/e}),Qm=r(function(e,t){var r=Wm(t),n=id(e);return"USD"===t.fiatType?si(f(Jm,n,r)):ci}),Xm=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 ml(0)}}();return{margin:f(Qm,e.tradeAmount,r.price),phaseEndTime:f(Ym,t.phaseStartTime,n)}}),Zm=function(e){var t=x(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 jy(v(zm,e.factory,e.id,n,a,o,u,s,l(Xm,a,o,u)))}return vy(e)},eb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(Mf,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Gm}}),tb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(Mf,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Gm}}),rb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(Mf,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Gm}}),nb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return jy(D(n,{state:e}));default:return Gm}}),ab=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Zm(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(Mf,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Gm}}),ib=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}}),ob=Wo(f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Fo,f(Iy,hh,Ty(ib))))))))))),ub=function(e){return{data:si(f(If,"getParameters()",yr)),decoder:ob,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},sb={$:"Buyer"},cb=function(e){return f(Ao,function(e){return ml(1e3*e)},Ll(Zl(e)))},fb=function(e){return Cl(e)},lb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),db=function(e){var t=f(sd,"error converting BigInt to Time.Posix",cb(e.autoabortInterval)),r=f(sd,"error converting BigInt to Time.Posix",cb(e.autoreleaseInterval)),a=f(sd,"error converting BigInt to Time.Posix",cb(e.autorecallInterval));return d(lb,n(function(t,r,n){return{abortPunishment:fb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:fb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?vl:sb,pokeReward:fb(e.pokeReward),tradeAmount:fb(e.tradeAmount)}}),a,t,r)},hb=n(function(e,t,r){return f(Rp,r,f(Ep,db,f(yp,Nh(e),ub(t))))}),pb=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}}}}}}}}}}},gb=Wo(f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,Ty(pb)))))))))))),vb=function(e){return{data:si(f(If,"getPhaseStartInfo()",yr)),decoder:gb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},yb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),mb=function(e){return h(yb,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}}),cb(e.v6),cb(e.v7),cb(e.v8),cb(e.v9))},bb=n(function(e,t,r){return f(Rp,r,f(Ep,mb,f(yp,Nh(e),vb(t))))}),Cb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Eb=Wo(f(Iy,Eh,f(Iy,hh,f(Iy,Eh,f(Iy,Eh,f(Iy,Eh,Ty(Cb))))))),Sb=function(e){return{data:si(f(If,"getState()",yr)),decoder:Eb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Tb={$:"Aborted"},wb={$:"Burned"},Ib={$:"NotClosed"},Ab={$:"Recalled"},Bb={$:"Released"},kb=function(e){switch(f(hc,99,Ll(Zl(e)))){case 0:return si(Ib);case 1:return si(Ab);case 2:return si(Tb);case 3:return si(Bb);case 4:return si(wb);default:return ci}},Nb={$:"Closed"},Rb={$:"Committed"},$b={$:"Judgment"},_b=function(e){switch(f(hc,99,Ll(Zl(e)))){case 1:return si(jg);case 2:return si(Rb);case 3:return si($b);case 4:return si(Nb);default:return ci}},Lb=function(e){return R(e,_d("0x0000000000000000000000000000000000000000"))?ci:si(e)},xb=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),Pb=function(e){var t=cb(e.phaseStartTimestamp),r=_b(e.phase),a=kb(e.closedReason);return d(xb,n(function(t,r,n){return{balance:fb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:Lb(e.responder)}}),r,t,a)},Db=n(function(e,t,r){return f(Rp,r,f(Ep,Pb,f(yp,Nh(e),Sb(t))))}),Ub=i(function(e,t,r,n,a){return po(M([l(hb,e,t,r),l(Db,e,t,n),l(bb,e,t,a)]))}),Ob=function(e){var t=ug(e);if("Just"===t.$){return t.a}f(Mf,"Warning! BigInt to Int conversion failed!",Zl(e));return 0},Mb=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),Fb=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),Vb=function(e){return e.b?l(Fb,e,yr,0):qa},Kb=tn,Hb=function(e){var t=h(Kb,Mb,f(gh,"encapsulation",zo),f(gh,"iv",zo),f(gh,"tag",zo),f(gh,"encrypted",zo)),r=um(t),n=f(Th,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(_c,0,e),f(_c,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(Vb(i))},jb=function(e){var t=function(e){var t=Ro(e);return t>1114111?fi("string is too long"):li(f(as,hm(t),e))};return f(Uo,Ri(""),nh(f(xa,t,e)))},qb=function(e){var t=e.a,r=e.b;return jb(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},Gb=r(function(e,t){return Jf(M([L("message",Hf(e)),L("pubkeyHexStrings",f(wh,Hf,M([t.initiatorPubkey,t.responderPubkey])))]))}),zb=function(e){return{$:"LoadedCommInfo",a:e}},Yb=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),Wb=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 zb(f(Yb,r,n))}return My(e)},Jb=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return Wb(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return zb(D(n,{initiatorPubkey:e}))}),Qb=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return Wb(D(r,{responderPubkey:si(e)}))}var n=t.a;return zb(D(n,{responderPubkey:e}))}),Xb=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return sb}r.a,r.b;return vl}if("Buyer"===r.b.$){r.a,r.b;return vl}r.a,r.b;return sb}),Zb=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(xl,a,n),o=fs(f(js,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),eC=function(e){var t=Vb(f(Zb,_s(e),yr));return l(wd,Mg,h(yb,Mb,f(_c,0,t),f(_c,1,t),f(_c,2,t),f(_c,3,t)),h(yb,Mb,f(_c,4,t),f(_c,5,t),f(_c,6,t),f(_c,7,t)))},tC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),rC={$:"Aborted"},nC={$:"Burned"},aC={$:"Claimed"},iC=function(e){return{$:"Committed",a:e}},oC=function(e){return{$:"Encrypted",a:e}},uC={$:"FailedDecode"},sC={$:"Initiated"},cC={$:"Recalled"},fC={$:"Released"},lC=function(e){return{$:"StateChange",a:e}},dC=function(e){return{$:"Statement",a:e}},hC=fr,pC=cr,gC=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(hC,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(pC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),vC=or,yC=y,mC=a(function(e,t,r,n){var a=kc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(vC,Ga(r),n);var i=za(d(mC,e-Ha,t,r,ja));return f(vC,i,n)}var o=f(Nc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(mC,e-Ha,t,r,u));return l(Pc,a,i,n)}var i=za(d(mC,e-Ha,t,r,yC(o)));return l(Pc,a,i,n)}),bC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(mC,c,r,e,yC(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(mC,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),CC=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(hC,32,r,e),o=f(bC,i,t);if(a<0){var u=l(pC,a,n,e);return f(bC,u,o)}return o}),EC=ur,SC=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(EC,i,t,r)}return f(ka,e,t)});return{nodeList:l(EC,i,yr,n),nodeListSize:t/32|0,tail:a}},TC=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(EC,o,t,r)}var n=e.a;return f(CC,n,t)});return f(CC,i,l(EC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(EC,o,t,r)}var n=e.a;return f(gC,n,t)});return f(ai,!0,f(gC,i,l(EC,o,SC(e),a)))}),wC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),IC=f(La,wC,yr),AC=n(function(e,t,r){var n=Xb(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(lC(sC));case"CommittedEvent":var r=t.a;return si(lC(iC(r.responder)));case"RecalledEvent":return si(lC(cC));case"ClaimedEvent":return si(lC(aC));case"AbortedEvent":return si(lC(rC));case"ReleasedEvent":return si(lC(fC));case"BurnedEvent":return si(lC(nC));case"InitiatorStatementLogEvent":var r=t.a;return si(dC({blocknum:e,message:function(){var e=eC(r.statement);if("Just"===e.$){var t=e.a;return oC(t)}return uC}(),who:n(Fm)}));case"ResponderStatementLogEvent":var r=t.a;return si(dC({blocknum:e,message:function(){var e=eC(r.statement);if("Just"===e.$){var t=e.a;return oC(t)}return uC}(),who:n(Vm)}));default:return ci}}(),i=f(Ao,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(TC,r.history,Vb(IC(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Ao,tC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),IC(M([s])))}),BC=Gr,kC=function(e){var t=l(Mi,Mg,f(gh,"id",BC),f(gh,"message",zo));return f(Cd,Di,f(Th,t,e))},NC=function(e){return{$:"Decrypted",a:e}},RC=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),$C=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(AC,n,a,t),o=i.a,u=i.b,s=i.c;return d(RC,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(RC,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(RC,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=kC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(_c,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:NC(y)}),T=D(b,{eventInfo:dC(S)}),w=l(Uc,v,T,t.history);return d(RC,D(t,{history:w}),!1,ci,yr)}return d(RC,t,!1,ci,M([pa(f(Vf,"got a decryption result, but for an event that is not a message!",b))]))}return d(RC,t,!1,ci,M([pa(f(Vf,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(RC,t,!1,ci,M([pa(f(Vf,"Error decoding decryption result",I))]))}}),_C=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),LC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),xC=function(e){return{onBroadcast:ci,onMined:si(L(_C(e),ci)),onSign:si(LC(e))}},PC=je("encryptToPubkeys",Ua),DC=n(function(e,t,r){return{data:si(f(If,"commit(address,string)",M([Dd(t),Dp(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),UC=n(function(e,t,r){return{data:si(f(If,"commit(address,string)",M([Dd(t),Dp(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),OC=function(e){return{$:"CommitMined",a:e}},MC={$:"CommitNeedsSig"},FC=function(e){return{$:"CommitSigned",a:e}},VC=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?UC:DC}(),a=xf(function(){return"Token"===e.factory.$?Ua:qp(El(Hm(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(MC),f(To,{onBroadcast:ci,onMined:si(L(OC,ci)),onSign:si(FC)},a))}),KC=r(function(e,t){return Jf(M([L("id",el(e)),L("encapsulation",Hf(t.encapsulatedKey)),L("iv",Hf(t.iv)),L("tag",Hf(t.tag)),L("encrypted",Hf(t.message))]))}),HC=je("decryptMessage",Ua),jC=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},qC=r(function(e,t){return po(f(xa,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 HC(f(KC,r,s))}return go}return go},jC(e.history)))}),GC=function(e){if("Just"===e.$){return e.a}return ci},zC=function(e){var t=GC(l(wd,Km,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Ao,function(e){return e.address},Td(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(qC,n,a)}return go},YC=r(function(e,t){return f(Ao,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return vl}r.a,r.b;return sb}if("Seller"===r.b.$){r.a,r.b;return sb}r.a,r.b;return vl},f(Km,e,t))}),WC=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(AC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),JC=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),QC=i(function(e,t,r,n,a){return f(WC,n,p(JC,e,r,t,qa,a,""))}),XC=function(e){return{$:"ChatHistoryMsg",a:e}},ZC=a(function(e,t,r,n){var a=x(t,Td(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(YC,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(XC),n))}(h(QC,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),eE={$:"Abort"},tE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),rE=function(e){return{$:"ActionNeedsSig",a:e}},nE=function(e){return{$:"ApproveMining",a:e}},aE={$:"ApproveNeedsSig"},iE=function(e){return{$:"ApproveSigned",a:e}},oE={$:"Burn"},uE={$:"Claim"},sE=function(e){return{$:"CommitMining",a:e}},cE=function(e){return{$:"ConfirmingAction",a:e}},fE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),lE=function(e){return{$:"EventLogFetched",a:e}},dE=function(e){return{$:"ParametersFetched",a:e}},hE=function(e){return{$:"PhaseInfoFetched",a:e}},pE={$:"Poke"},gE={$:"Recall"},vE={$:"Release"},yE=function(e){return{$:"StartContractAction",a:e}},mE=function(e){return{$:"StateFetched",a:e}},bE=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"}},CE=function(e){return d(Ky,e,go,bo,yr)},EE={align:Uf,label:"cantFindTradeWillRetry",mainParagraphs:M([M([Ff("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:sg},SE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(cg,e,r)}if("Nothing"===t.a.$){t.a;return f(Vf,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(Vf,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),TE={align:Uf,label:"tradeParametersNotDefault",mainParagraphs:M([M([Ff("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:sg},wE=eo(Xi),IE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),AE=n(function(e,t,r){return l(Jh,e,Ao(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),BE=r(function(e,t){var r=t.a;return xy(f(Wh,e,r))}),kE=n(function(e,t,r){var n=e.a,a=f(Vh,t,n.requests);if("Nothing"===a.$)return L(Ly(n),go);var i=a.a,o=L(i.watchOnce,kl(r));if("Nothing"===o.b.$){o.b;return L(Ly(D(n,{requests:l(AE,t,r,n.requests)})),go)}if(o.a){var u=o.b.a;return L(Ly(D(n,{requests:l(AE,t,r,n.requests),watching:f(BE,t,n.watching)})),f(Ag,i.tagger,lp(u)))}return L(Ly(D(n,{requests:l(AE,t,r,n.requests)})),po(f(xa,function(e){return f(Ag,i.tagger,lp(e))},r)))}),NE=_e,RE=r(function(e,t){return f(Rp,f(Io,_y,t),f(bp,function(t){return Cy(e)},NE(2e3)))}),$E=ue,_E=ce,LE=Yr,xE=n(function(e,t,r){var n=function(e){return _E(M([e,$E(r)]))};return f(qo,function(a){var i=f(Th,e,a);if("Ok"===i.$){var o=i.a,u=f(Th,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return Go(Di(c))}return Fi(r)},LE)}),PE=a(function(e,t,r,n){return f(Hd,l(xE,f(gh,e,LE),t,r),n)}),DE=n(function(e,t,r){return f(Hd,f(gh,e,t),r)}),UE=Yo(dh),OE=Gd(f(hc,Wd,Yd("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),ME=function(e){return{$:"BlockHash",a:e}},FE=function(e){return OE(e)?li(ME(Ko(e))):fi("Given blockHash "+lh(e)+" is not valid.")},VE=Yo(FE),KE=function(e){return{$:"TxHash",a:e}},HE=function(e){return OE(e)?li(KE(Ko(e))):fi("Given txHash "+lh(e)+" is not valid.")},jE=Yo(HE),qE=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}}),GE=zr,zE=l(DE,"blockNumber",by,l(DE,"blockHash",VE,l(DE,"transactionHash",jE,l(DE,"transactionIndex",by,l(DE,"logIndex",by,d(PE,"removed",GE,!1,l(DE,"topics",um(Dm),l(DE,"data",zo,l(DE,"address",UE,Fi(qE)))))))))),YE=function(e){return f(wh,function(e){if("Just"===e.$){var t=e.a;return Hf(wf(t))}return Wf},e)},WE=function(e){return Jf(M([L("fromBlock",Rh(e.fromBlock)),L("toBlock",Rh(e.toBlock)),L("address",jf(e.address)),L("topics",YE(e.topics))]))},JE=r(function(e,t){return pp({decoder:um(zE),method:"eth_getLogs",params:M([WE(t)]),url:e})}),QE=function(e){return{$:"BlockNum",a:e}},XE=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(bp,function(r){return f(Ep,vi(r),f(JE,e,D(t,{fromBlock:QE(n),toBlock:QE(a)})))},f(JE,e,t)):f(JE,e,t)}),ZE=n(function(e,t,r){var n=r.a,a=r.b;return f(JE,e,D(t,{fromBlock:QE(n),toBlock:QE(a)}))}),eS=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(eS,e,t,i)),c=o;e=u,t=s,r=c}}),tS=r(function(e,t){return l(eS,fl,t,e)}),rS=r(function(e,t){var r=e.a,n=t.a;return xy(f(tS,r,n))}),nS=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 po(f(xa,function(t){return f(Rp,f(Io,IE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},IC(f(xa,function(e){return f(Vh,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(Ly(D(r,{blockNumber:si(a)})),po(M([f(RE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,ZE)]))):L(t,f(RE,r.nodePath,r.tagger))}return L(Ly(D(r,{blockNumber:si(a),pending:Py,watching:f(rS,r.watching,r.pending)})),po(M([f(RE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,XE),l(i,L(a,a),r.watching,ZE)])))}var s=e.a.a;return L(Ly(D(r,{errors:f(ka,s,r.errors)})),f(RE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(kE,t,c,d)}var s=e.b.a;return L(Ly(D(r,{errors:f(ka,s,r.errors)})),go)}),aS=r(function(e,t){var r=t.a;return xy(l(fl,e,gr,r))}),iS=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(fl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(Ly(D(o,{watching:f(aS,a.ref,o.watching)})),f(Rp,f(Io,IE(a.ref),a.tagger),e),a.ref)}(l(XE,a.nodePath,n,L(s,s)))}return x(Ly(D(o,{pending:f(aS,a.ref,o.pending)})),go,a.ref)}),oS=iS(!1),uS=function(e){return M([e])},sS=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(Ry,r.factory,r.id):go}}(),function(){var e=x(Td(t.wallet),yg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(yg(t.wallet),si(a.factory))?d($p,n,r.address,a.creationInfo.address,oy):go}return go}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(ZC,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?zC(t):go,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(Ky,u,po(M([l(Db,p.factory,p.creationInfo.address,mE),s,r])),bo,o)}return CE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return CE(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(xu,m,El(Hm(C.parameters))),ba))return CE(u);var S=l(VC,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(Ky,D(u,{txChainStatus:T}),go,w,yr)}return CE(u)}var y=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:Ob(I.blocknum)},B=l(oS,lE,t.eventSentry,{address:A.address,fromBlock:QE(A.blocknum),toBlock:vp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(eb,A,t.trade)}),$=f(hc,wE,jm(u.trade)),_=po(M([N,h(Ub,$,A.address,dE,mE,hE)]));return d(Ky,u,_,bo,yr)}if("BadBody"===g.a.$){g.a.a;return d(Ky,t,go,bo,M([pa(EE)]))}var y=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(nb,P,t.trade)});return d(Ky,u,zC(u),bo,yr)}return d(Ky,t,go,bo,M([pa(f(SE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(qm(F)){var u=D(t,{trade:f(tb,F,t.trade)});return d(Ky,u,zC(u),bo,yr)}return d(Ky,t,go,bo,M([pa(TE)]))}var V=g.a.a;return d(Ky,t,go,bo,M([pa(f(Vf,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(Ky,t,go,bo,M([pa(f(cg,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(rb,H,t.trade)});return d(Ky,u,zC(u),bo,yr)}return d(Ky,t,go,bo,M([pa(f(SE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Ih,Mm,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(Ky,t,go,bo,M([pa(f(Vf,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(Jb,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(Qb,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=sm(e.terms);if("Ok"===r.$){var n=r.a;return L(f(ab,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(Vf,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(XC),n))}(l(AC,q.blockNumber,Y,r))}return d(ZC,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?zC(u):go;return d(Ky,u,_,bo,f(oo,f(xa,pa,IC(M([X]))),o));case"ExpandPhase":var te=e.a;return CE(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return CE(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return CE(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(Ky,t,go,bo,M([da(yv(C.parameters.initiatorAddress))]))}return d(Ky,t,go,bo,M([pa(f(Vf,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return CE(D(t,{txChainStatus:si(f(fE,E,ie))}));case"AbortAction":return CE(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(VC,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=xf(l(Md,xd(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(iE)};return f(To,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(xu,i,El(Hm(C.parameters))),ba)?L(si(aE),n):l(VC,C,E.address,E.commPubkey)}return L(si(aE),n)}(),T=oe.a,w=oe.b;return d(Ky,D(t,{txChainStatus:T}),go,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,pE)||R(ue,gE)){var se=yE(ue),ce=t;e=se,t=ce;continue e}return CE(D(t,{txChainStatus:si(cE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,bo,M([pa(f(Vf,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=xf(Jy(n.creationInfo.address));return x(si(rE(gE)),f(To,xC(gE),a),yr);case"Claim":var a=xf(Yy(n.creationInfo.address));return x(si(rE(uE)),f(To,xC(uE),a),yr);case"Abort":var a=xf(Gy(n.creationInfo.address));return x(si(rE(eE)),f(To,xC(eE),a),yr);case"Release":var a=xf(Qy(n.creationInfo.address));return x(si(rE(vE)),f(To,xC(vE),a),yr);case"Burn":var a=xf(zy(n.creationInfo.address));return x(si(rE(oE)),f(To,xC(oE),a),yr);default:var a=xf(Af(n.creationInfo.address));return x(si(rE(pE)),f(To,xC(pE),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(Ky,D(t,{txChainStatus:T}),go,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return CE(D(t,{txChainStatus:si(nE(he))}))}var V=de.a;return d(Ky,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return CE(D(t,{txChainStatus:si(sE(he))}))}var V=de.a;return d(Ky,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,"commit",V))]));case"CommitMined":return CE(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return CE(D(t,{txChainStatus:si(f(tE,ue,he))}))}var V=de.a;return d(Ky,D(t,{txChainStatus:ci}),go,bo,M([pa(f(dg,bE(ue),V))]));case"ActionMined":var ue=e.a;return CE(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(nS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(Ky,D(t,{eventSentry:ve}),_,bo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f($C,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?zC(t):go,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(PC(f(Gb,r,a)),ci)}return L(go,si(f(Vf,"Trying to encrypt, but commInfo is not loaded",n)))}return L(go,ci)}(),Te=Se.a,we=Se.b;return d(Ky,Ee,po(M([s,Te])),bo,U(f(Qi,XC,Ce.appCmds),f(hc,yr,f(Ao,uS,f(Ao,pa,we)))))}return d(Ky,t,go,bo,M([pa(f(Vf,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Ah,qb,Hb(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Km,p,E.address);if("Nothing"===Ne.$)return d(Ky,t,go,bo,M([pa(f(Vf,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return xf("Initiator"===Re.$?f(Wy,p.creationInfo.address,ke):f(Xy,p.creationInfo.address,ke))}();return d(Ky,t,go,f(To,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(Ky,t,go,bo,M([pa(f(Vf,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(Ky,t,go,bo,M([pa(f(Vf,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return CE(t)}var V=e.a.a;return d(Ky,t,go,bo,M([pa(f(fg,"message",V))]));default:return d(Ky,t,go,bo,M([ga]))}}),cS=r(function(e,t){return{address:e,blocknum:t}}),fS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},lS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(iS,!0,e,t,r))}),dS=n(function(e,t,r){var n=function(e){return r(f(Ih,bm,e).returnData)},a={address:t.address,fromBlock:QE(t.blocknum),toBlock:QE(t.blocknum),topics:M([si(Om("Initiated(string,string)"))])};return l(lS,n,e,a)}),hS=function(e){return{data:si(f(If,"numTrades()",yr)),decoder:Wo(Eh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},pS=r(function(e,t){return f(Rp,t,f(yp,Nh(e),hS(Ld(e))))}),gS=function(e){return{data:si(f(If,"phase()",yr)),decoder:Wo(Eh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},vS=n(function(e,t,r){return f(Rp,r,f(Ep,_b,f(yp,Nh(e),gS(t))))}),yS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),mS=r(function(e,t){return l(La,yS(e),yr,t)}),bS=function(e){return f(mS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},CS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},ES=function(e){return f(CS,Ja(Gm),Sa(e.trades))},SS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:ES(e),loaded:Ti(bS(e))})})},TS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),wS=r(function(e,t){var r=f(_c,e,t.trades);if("Just"===r.$){var n=(r.a,l(Uc,e,Gm,t.trades));return l(TS,SS(D(t,{trades:n})),go,yr)}return l(TS,t,go,M([pa(f(Vf,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),IS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(eb,t,a),o=l(Uc,e,i,r.trades);return L(SS(D(r,{trades:o})),yr)}return L(r,M([f(Vf,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),AS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tb,t,a),o=l(Uc,e,i,r.trades);return l(TS,SS(D(r,{trades:o})),go,yr)}return l(TS,r,go,M([pa(f(Vf,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),BS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(Uc,e,jy(D(a,{state:D(i,{phase:t})})),r.trades);return l(TS,SS(D(r,{trades:o})),go,yr)}return l(TS,r,go,M([pa(f(Vf,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(TS,r,go,M([pa(f(Vf,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),kS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(rb,t,a),o=l(Uc,e,i,r.trades);return l(TS,SS(D(r,{trades:o})),go,yr)}return l(TS,r,go,M([pa(f(Vf,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),NS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(nb,t,a),o=l(Uc,e,i,r.trades);return l(TS,SS(D(r,{trades:o})),go,yr)}return l(TS,r,go,M([pa(f(Vf,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),RS=n(function(e,t,r){var n=f(_c,e,r.trades);if("Just"===n.$){var a=n.a,i=f(ab,t,a),o=l(Uc,e,i,r.trades);return l(TS,SS(D(r,{trades:o})),go,yr)}return l(TS,r,go,M([pa(f(Vf,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),$S=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),_S=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),LS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),xS=function(e){return{$:"NumTradesFetchedAgain",a:e}},PS=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),DS=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),US=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),OS=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),MS=function(e){return l(TS,e,go,yr)},FS=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=Ob(n),i=Vb(f(xa,yy(t.factory),f(Ai,0,a-1))),o=po(f(xa,function(e){return l(ky,t.factory,wu(e),$S(e))},f(Ai,0,a-1)));return l(TS,D(t,{dataFetchState:l(_S,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(TS,t,go,M([pa(f(cg,"Factory numTrades",u))]));case"CheckForNewTrades":return l(TS,t,f(pS,t.factory,xS),yr);case"UpdateTradePhases":var s=po(IC(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(vS,e.factory,e.creationInfo.address,f(DS,e.factory,e.id)))},bS(t))));return l(TS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(BS,d,p,t),v=function(){var e=L(p,f(_c,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=fS(r);if("Just"===n.$){var a=n.a;return L(l(Db,c,a.address,OS(d)),yr)}return L(go,M([pa(f(Vf,"Phase fetched for a trade that has no creationInfo",r))]))}return L(go,yr)}e.b;return L(go,M([pa(f(Vf,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(TS,g.tradeCache,po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(TS,t,go,M([pa(f(SE,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=Ob(n);if(_(C,E)<0){var S=t.dataFetchState,o=po(f(xa,function(e){return l(ky,t.factory,wu(e),$S(e))},f(Ai,C,E-1))),T=Vb(f(xa,yy(t.factory),f(Ai,C,E-1)));return l(TS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(TC,t.trades,T)}),o,yr)}return MS(t)}b.b;return l(TS,t,go,M([pa(f(Vf,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(TS,t,go,M([pa(f(cg,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(cS,w.address_,Ob(w.blocknum)),A=l(dS,t.eventSentry,I,LS(d)),B=A.a,k=A.b,y=po(M([h(Ub,t.factory,I.address,PS(d),OS(d),US(d)),k])),N=l(IS,d,I,t),R=N.a,$=N.b;return l(TS,SS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(TS,t,go,M([pa(f(cg,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(TS,t,go,M([pa(f(cg,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(AS,d,P,t)}var U=r.a.a;return l(TS,t,go,M([pa(f(Vf,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(NS,d,O,t)}return l(TS,t,go,M([pa(f(SE,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(kS,d,F,t)}return l(TS,t,go,M([pa(f(SE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=sm(V.terms);if("Ok"===K.$){var H=K.a;return l(RS,d,H,t)}var j=K.a;return f(wS,d,t)}var j=r.a;return l(TS,t,go,M([pa(f(Vf,"Error decoding initiated event",j))]));default:var q=e.a,G=f(nS,q,t.eventSentry),z=G.a,y=G.b;return l(TS,D(t,{eventSentry:z}),y,yr)}}),VS=function(e){return{$:"AgentHistoryMsg",a:e}},KS=function(e){return{$:"AppCmd",a:e}},HS={$:"BetaLandingPage"},jS={$:"ConnectToWeb3"},qS=function(e){return{$:"MarketplaceMsg",a:e}},GS=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),zS=r(function(e,t){return f(kn,e,Hf(t))}),YS=function(e){return f(zS,"href",tt(e))},WS=Nn("rel"),JS=zS("target"),QS=function(e){return{$:"Height",a:e}},XS=QS,ZS={$:"Content"},eT=ZS,tT=function(e){return{$:"Width",a:e}},rT=tT,nT=function(e){return{$:"Attr",a:e}},aT=function(e){return{$:"NodeName",a:e}},iT=function(e){return{$:"Unkeyed",a:e}},oT={$:"AsEl"},uT=oT,sT=r(function(e,t){return{$:"Field",a:e,b:t}}),cT=f(sT,0,0),fT={$:"NoNearbyChildren"},lT={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=lT.any+" "+lT.column,hT=lT.any+" "+lT.grid,pT=lT.any+" "+lT.page,gT=lT.any+" "+lT.paragraph,vT=lT.any+" "+lT.row,yT=lT.any+" "+lT.single,mT=function(e){switch(e.$){case"AsRow":return vT;case"AsColumn":return dT;case"AsEl":return yT;case"AsGrid":return hT;case"AsParagraph":return gT;default:return pT}},bT=function(e){return{$:"Keyed",a:e}},CT={$:"NoStyleSheet"},ET=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),ST=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),TT={$:"AsParagraph"},wT=TT,IT=Sn("div"),AT=Sn("p"),BT=Sn("s"),kT=Sn("u"),NT=zS("className"),RT=function(e){return wn(Xe(e))},$T=function(e){return Sn(Xe(e))},_T=function(e){return{$:"Flag",a:e}},LT=function(e){return{$:"Second",a:e}},xT=function(e){return e>31?LT(1< .ctr > ."+lT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",Pw="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+rw(lT.any)+rw(lT.row)+" > "+rw(lT.any)+" { flex-basis: auto !important; } "+rw(lT.any)+rw(lT.row)+" > "+rw(lT.any)+rw(lT.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"+xw,Dw=function(e){return{$:"Intermediate",a:e}},Uw=r(function(e,t){return Dw({closing:t,others:yr,props:yr,selector:e})}),Ow=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,Dw({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(Ow,f(Uw,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(Ow,f(Uw,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(Ow,f(Uw,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(Ow,f(Uw,n.selector,""),v),t.others)})}});return Dw(l(La,a,n,t))}),Mw=U(Pw,function(e){var t=function(e){return Ql(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Ql(f(xa,a,t.others)))};return Ql(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(Ow,f(Uw,r,""),n),t)}),yr,e)))}(U($w,Lw))),Fw=l($T,"style",yr,M([aw(Mw)])),Vw=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+'"'}},Kw=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}},Hw=function(e){if("FontWith"===e.$){var t=e.a;return f(Qd,Kw,t.variants)}return!1},jw=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),qw=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),Gw=n(function(e,t,r){var n=r.a,a=r.b;return M([f(qw,"."+e+"."+t+", ."+e+" ."+t,n),f(qw,"."+e+"."+t+"> ."+lT.text+", ."+e+" ."+t+" > ."+lT.text,a)])}),zw=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(Gw,i,lT.sizeByCapital,a),l(Gw,i,lT.fullSize,n)))}),Yw=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(qw,"."+r+"."+lT.sizeByCapital+", ."+r+" ."+lT.sizeByCapital,M([L("line-height","1")])),f(qw,"."+r+"."+lT.sizeByCapital+"> ."+lT.text+", ."+r+" ."+lT.sizeByCapital+" > ."+lT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),Ww=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},Jw=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,rc,t,r))}return ci},Qw=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),Xw=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(hc,e.descender,Jw(t)),n=f(hc,e.baseline,Jw(f(Yf,function(e){return!R(e,r)},t))),a=f(hc,e.capital,Ww(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(Qw,i,a-n,o),full:l(Qw,u,a-r,s)}},Zw=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",ZT(e.height)),L("vertical-align",ZT(e.vertical)+"em"),L("font-size",ZT(e.size)+"em")]))},eI=function(e){return l(Ra,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 si(L(Zw(function(e){return e.full}(Xw(a))),Zw(function(e){return e.capital}(Xw(a)))))}return t}return t}),ci,e)},tI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(mS,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=eI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,Yw(t),n));var i=a.a;return f(Ri,"",f(xa,f(zw,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},rI=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+'" '+Ni(r)}},nI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,rI,t.variants)))}return ci},aI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},iI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+ZT(r)+"px, "+ZT(n)+"px, "+ZT(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("+ZT(o)+"px, "+ZT(u)+"px, "+ZT(s)+"px)",b="scale3d("+ZT(f)+", "+ZT(l)+", "+ZT(d)+")",C="rotate3d("+ZT(p)+", "+ZT(g)+", "+ZT(v)+", "+ZT(y)+"rad)";return si(m+" "+b+" "+C)}},oI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,jw(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,jw(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,jw(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,jw(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+lT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+lT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+lT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,jw(!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,M([f(QT,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(rc,1,1-c));return l(a,t,"."+u,M([f(QT,"opacity",ZT(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(QT,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(mS,nI,p)),v=M([f(QT,"font-family",f(Ri,", ",f(xa,Vw,p))),f(QT,"font-feature-settings",g),f(QT,"font-variant",f(Qd,Hw,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(QT,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(QT,s,ew(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+lT.row,A="."+(lT.wrapped+I),B="."+lT.alignRight,k="."+lT.paragraph,N="."+lT.page,R="."+lT.alignLeft,$=ZT(S/2)+"px",_=ZT(E/2)+"px",x="."+lT.column,y="."+C,P="."+lT.any;return Ql(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(QT,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(QT,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(QT,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(QT,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(QT,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(QT,"margin-left",w)])),l(a,t,U(y,k),M([f(QT,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(QT,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(QT,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(QT,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(QT,"content","''"),f(QT,"display","block"),f(QT,"height","0"),f(QT,"width","0"),f(QT,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(QT,"content","''"),f(QT,"display","block"),f(QT,"height","0"),f(QT,"width","0"),f(QT,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(QT,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(QT,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,GT,F.rows))+"-cols-"+f(Ri,"-",f(xa,GT,F.columns))+"-space-x-"+GT(F.spacing.a)+"-space-y-"+GT(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=iI(ne),y=YT(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,M([f(QT,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=aI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(tI(s),c)}),uI=r(function(e,t){return l($T,"style",yr,M([aw(f(oI,e,t))]))}),sI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",Fw),f(ka,L("dynamic-stylesheet",f(uI,t,l(Ra,JT,L(Py,M([nw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(uI,t,l(Ra,JT,L(Py,M([nw(t.focus)])),r).b)),n)}),cI=a(function(e,t,r,n){return e?f(ka,Fw,f(ka,f(uI,t,l(Ra,JT,L(Py,M([nw(t.focus)])),r).b),n)):f(ka,f(uI,t,l(Ra,JT,L(Py,M([nw(t.focus)])),r).b),n)}),fI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(RT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(sI,!1,e,t,r);default:var e=i.a,t=i.b;return d(sI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return IT;case"p":return AT;default:return $T(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(cI,!1,e,t,n);default:var e=i.a,t=i.b;return d(cI,!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($T,e,n,M([f(u,r,M([NT(lT.any+" "+lT.single)]))]))}}();switch(o.$){case"AsRow":return f(VT,HT,e)&&!f(VT,KT,e)?s:f(VT,DT,e)?f(kT,M([NT(f(Ri," ",M([lT.any,lT.single,lT.container,lT.contentCenterY,lT.alignContainerRight])))]),M([s])):f(VT,UT,e)?f(BT,M([NT(f(Ri," ",M([lT.any,lT.single,lT.container,lT.contentCenterY,lT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(VT,FT,e)&&!f(VT,MT,e)?s:f(VT,OT,e)?f(BT,M([NT(f(Ri," ",M([lT.any,lT.single,lT.container,lT.alignContainerCenterY])))]),M([s])):f(VT,PT,e)?f(kT,M([NT(f(Ri," ",M([lT.any,lT.single,lT.container,lT.alignContainerBottom])))]),M([s])):s;default:return s}}),lI=aw,dI=function(e){return f(IT,M([NT(f(Ri," ",M([lT.any,lT.text,lT.widthContent,lT.heightContent])))]),M([lI(e)]))},hI=function(e){return l($T,"div",M([NT(f(Ri," ",M([lT.any,lT.text,lT.widthFill,lT.heightFill])))]),M([aw(e)]))},pI=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 R(e,wT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,wT),L(f(ka,L(n,f(s.html,CT,e)),i),au(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,uT)?hI(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 R(e,wT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,wT),L(f(ka,f(o.html,CT,e),n),au(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,uT)?hI(u):dI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=au(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(fI,n.has,n.node,n.attributes,bT(l(ST,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(fI,n.has,n.node,n.attributes,bT(l(ST,"nearby-element-pls",s,n.children)),CT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=au(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(fI,n.has,n.node,n.attributes,iT(f(ET,m,n.children))),styles:g})}return Gi(h(fI,n.has,n.node,n.attributes,iT(f(ET,m,n.children)),CT))}),gI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),vI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(sT,a|r,n)}var i=e.a;return f(sT,r,i|n)}),yI=xT(7),mI=xT(36),bI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(sT,r|a,n|i)}),CI=xT(6),EI=xT(38),SI=xT(30),TI=xT(29),wI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),II=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),AI=function(e){return{$:"Transform",a:e}},BI=function(e){return{$:"ChildrenBehind",a:e}},kI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),NI=function(e){return{$:"ChildrenInFront",a:e}},RI=r(function(e,t){return f(IT,M([NT(function(){switch(e.$){case"Above":return f(Ri," ",M([lT.nearby,lT.single,lT.above]));case"Below":return f(Ri," ",M([lT.nearby,lT.single,lT.below]));case"OnRight":return f(Ri," ",M([lT.nearby,lT.single,lT.onRight]));case"OnLeft":return f(Ri," ",M([lT.nearby,lT.single,lT.onLeft]));case"InFront":return f(Ri," ",M([lT.nearby,lT.single,lT.inFront]));default:return f(Ri," ",M([lT.nearby,lT.single,lT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return aw("");case"Text":var e=t.a;return dI(e);case"Unstyled":return(0,t.a)(uT);default:return f(t.a.html,CT,uT)}}()]))}),$I=n(function(e,t,r){var n=f(RI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?BI(M([n])):NI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?BI(f(ka,n,a)):f(kI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(kI,M([n]),i):NI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(kI,f(ka,n,a),i):f(kI,a,f(ka,n,i))}}),_I=r(function(e,t){switch(t.$){case"Generic":return aT(e);case"NodeName":var r=t.a;return f(wI,r,e);default:var n=t.a,a=t.b;return f(wI,n,a)}}),LI=function(e){switch(e.$){case"Left":return lT.alignedHorizontally+" "+lT.alignLeft;case"Right":return lT.alignedHorizontally+" "+lT.alignRight;default:return lT.alignedHorizontally+" "+lT.alignCenterX}},xI=function(e){switch(e.$){case"Top":return lT.alignedVertically+" "+lT.alignTop;case"Bottom":return lT.alignedVertically+" "+lT.alignBottom;default:return lT.alignedVertically+" "+lT.alignCenterY}},PI=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),DI=function(e){return{$:"Moved",a:e}},UI=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return DI(x(r,0,0));case"MoveY":var n=t.a;return DI(x(0,n,0));case"MoveZ":var a=t.a;return DI(x(0,0,a));case"MoveXYZ":var i=t.a;return DI(i);case"Rotate":var i=t.a,o=t.b;return d(PI,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(PI,x(0,0,0),i,x(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 DI(x(s,n,a));case"MoveY":var c=t.a;return DI(x(r,c,a));case"MoveZ":var f=t.a;return DI(x(r,n,f));case"MoveXYZ":var i=t.a;return DI(i);case"Rotate":var i=t.a,o=t.b;return d(PI,u,x(1,1,1),i,o);default:var l=t.a;return d(PI,u,l,x(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(PI,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(PI,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(PI,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(PI,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(PI,u,h,v,y);default:var m=t.a;return d(PI,u,m,p,o)}}}),OI=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(cT,n,M([l(II,n,"height",r+"px")]));case"Content":return x(f(vI,mI,cT),lT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(vI,FT,cT),lT.heightFill,yr):x(f(vI,FT,cT),lT.heightFillPortion+" height-fill-"+Ni(a),M([l(II,lT.any+"."+lT.row+" > "+rw("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(II,u,"min-height",Ni(i)+"px"),c=OI(o),d=c.a,h=c.b,p=c.c;return x(f(vI,MT,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(II,u,"max-height",Ni(g)+"px"),v=OI(o),d=v.a,h=v.b,p=v.c;return x(f(vI,MT,d),u+" "+h,f(ka,s,p))}},MI=function(e){switch(e.$){case"Px":var t=e.a;return x(cT,lT.widthExact+" width-px-"+Ni(t),M([l(II,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(vI,EI,cT),lT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(vI,HT,cT),lT.widthFill,yr):x(f(vI,HT,cT),lT.widthFillPortion+" width-fill-"+Ni(r),M([l(II,lT.any+"."+lT.row+" > "+rw("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(II,i,"min-width",Ni(n)+"px"),u=MI(a),s=u.a,c=u.b,d=u.c;return x(f(vI,KT,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(II,i,"max-width",Ni(h)+"px"),p=MI(a),s=p.a,c=p.b,d=p.c;return x(f(vI,KT,s),i+" "+c,f(ka,o,d))}},FI=xT(27),VI=r(function(e,t){if(R(e,FI)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),KI=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=YT(n);if("Nothing"===s.$)return{attributes:f(ka,NT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,NT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,AI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(VT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(vI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(VT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(VI,S,I)){var p=WT(I)+" "+e,g=t,v=f(vI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=WT(I)+" "+e,g=t,v=f(vI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(vI,S,r),y=f(UI,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(VT,CI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=lT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(vI,CI,r),y=n,m=f(ka,l(II,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+lT.widthContent,g=t,v=f(vI,EI,f(vI,CI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+lT.widthFill,g=t,v=f(vI,HT,f(vI,CI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+lT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(vI,HT,f(vI,CI,r)),y=n,m=f(ka,l(II,lT.any+"."+lT.row+" > "+rw("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=MI(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(bI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(VT,yI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(vI,yI,r),y=n,m=f(ka,l(II,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=lT.heightContent+" "+e,g=t,v=f(vI,mI,f(vI,yI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=lT.heightFill+" "+e,g=t,v=f(vI,FT,f(vI,yI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+lT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(vI,FT,f(vI,yI,r)),y=n,m=f(ka,l(II,lT.any+"."+lT.column+" > "+rw("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=OI(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(bI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(_I,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(_I,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(_I,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(_I,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(_I,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(_I,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(_I,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return aT("p");case"NodeName":var e=t.a;return aT(e);default:var r=t.a,n=t.b;return f(wI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(gI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(gI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(gI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(gI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l($I,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(VT,SI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=LI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(vI,UT,e);case"Right":return f(vI,DT,e);default:return e}}(f(vI,SI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(VT,TI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=xI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(vI,OT,e);case"Bottom":return f(vI,PT,e);default:return e}}(f(vI,TI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),HI={$:"Untransformed"},jI=HI,qI=a(function(e,t,r,n){return l(pI,e,n,v(KI,mT(e),t,cT,jI,yr,yr,fT,$a(r)))}),GI=function(e){return nT(NT(e))},zI=r(function(e,t){var r=t.url,n=t.label;return d(qI,uT,aT("a"),f(ka,nT(YS(r)),f(ka,nT(WS("noopener noreferrer")),f(ka,nT(JS("_blank")),f(ka,rT(eT),f(ka,XS(eT),f(ka,GI(lT.contentCenterX+" "+lT.contentCenterY),e)))))),iT(M([n])))}),YI=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),WI=n(function(e,t,r){return d(YI,e,t,r,1)}),JI=xT(14),QI=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),XI=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),ZI=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return zT(t)+"-"+zT(r)+"-"+zT(n)+"-"+zT(a)},eA=function(e){return f(XI,JI,l(QI,"fc-"+ZI(e),"color",e))},tA={align:Uf,label:"cantConnectNoWeb3",mainParagraphs:M([M([Ff("You need a web3 provider (such as "),f(zI,M([eA(l(WI,0,0,1))]),{label:Ff("Metamask"),url:"https://metamask.io/"}),Ff(") to Connect.")]),M([Ff("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:lg},rA={align:Uf,label:"invalidUrl",mainParagraphs:M([M([Ff("I don't understand that URL...")]),M([Ff("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:sg},nA=function(e){return{$:"Active",a:e}},aA=Yo(f(Io,Tf,f(Io,Ch,sd("Error decoding hex to BigInt")))),iA=function(){return Yo(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),oA=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}}}}}}}}}}}},uA=function(e){return _E(M([f(Oi,si,e),Fi(ci)]))},sA=f(Hd,uA(f(gh,"status",iA)),f(Hd,uA(f(gh,"root",zo)),l(DE,"logsBloom",zo,l(DE,"logs",um(zE),f(Hd,uA(f(gh,"contractAddress",UE)),l(DE,"cumulativeGasUsed",aA,l(DE,"gasUsed",aA,l(DE,"blockNumber",by,l(DE,"blockHash",VE,l(DE,"transactionIndex",by,l(DE,"transactionHash",jE,Fi(oA)))))))))))),cA=function(e){var t=e.a;return Tf(t)},fA=f(Io,cA,Hf),lA=r(function(e,t){return pp({decoder:sA,method:"eth_getTransactionReceipt",params:M([fA(t)]),url:e})}),dA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),hA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),pA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),gA=r(function(e,t){return f(Ao,function(e){return e.toMsg},f(vg,function(e){return e.b},f(vg,function(e){return e.onMinedTagger},f(Vh,t,e))))}),vA=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(f){return{blockHash:r,blockNumber:n,from:i,gas:c,gasPrice:s,hash:e,input:f,nonce:t,to:o,transactionIndex:a,value:u}}}}}}}}}}}},yA=function(e){return _E(M([$E(ci),f(Oi,si,e)]))},mA=l(DE,"input",zo,l(DE,"gas",by,l(DE,"gasPrice",aA,l(DE,"value",aA,l(DE,"to",yA(UE),l(DE,"from",UE,l(DE,"transactionIndex",by,l(DE,"blockNumber",yA(by),l(DE,"blockHash",function(e){return f(qo,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},Ko(t))?Fi(ci):f(Oi,si,e)},zo)}(VE),l(DE,"nonce",by,l(DE,"hash",jE,Fi(vA)))))))))))),bA=r(function(e,t){return pp({decoder:mA,method:"eth_getTransactionByHash",params:M([fA(t)]),url:e})}),CA=r(function(e,t){return{attempts:e,sleep:t}}),EA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Np,function(e){return a>0?f(bp,function(e){return f(EA,f(CA,a,n),t)},NE(1e3*n)):fp(e)},t)}),SA=r(function(e,t){return f(bp,function(r){return f(EA,{attempts:30,sleep:1},f(bA,e,t))},NE(250))}),TA=r(function(e,t){return f(EA,{attempts:60,sleep:5},f(lA,e,t))}),wA=function(e){return{$:"Mined",a:e}},IA=function(e){return Ao(function(t){return D(t,{status:wA(e)})})},AA=function(e){return{$:"Sent",a:e}},BA=function(e){return Ao(function(t){return D(t,{status:AA(e)})})},kA=function(e){return{$:"Signed",a:e}},NA=function(e){return Ao(function(t){return D(t,{status:kA(e)})})},RA=function(e){return"Nothing"!==e.$},$A=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Zf(r),go);case"TxSigned":var n=e.a,a=e.b,i=f(Vh,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(Ag,t,lp(a))}return go}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return go;if("Just"===t.b.$){var r=t.b.a;return f(Ag,r,lp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Ag,a,lp(fi(e)))}t.a,t.b,t.c;return go};if("Ok"===a.$){var c=a.a,d=RA(o.onBroadcastTagger)||RA(o.onMinedTagger)?f(Pf,r.tagger,f(Rp,pA(n),f(SA,r.nodePath,c))):go;return L(Zf(D(r,{txs:l(Jh,n,NA(c),r.txs)})),po(M([u,d])))}var h=a.a;return L(Zf(r),po(M([u,s(h)])))}return L(Zf(r),go);case"TxSent":var n=e.a,p=e.b,g=f(Vh,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(Pf,r.tagger,f(Rp,hA(n),f(TA,r.nodePath,v.hash))):go}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Ag,t,lp(li(v)))}return go}();return L(Zf(D(r,{txs:l(Jh,n,BA(v),r.txs)})),po(M([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(Ag,t,lp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Ag,n,lp(fi("Error with TxSent stuff")))}e.a,e.b;return go}();return L(Zf(r),s)}return L(Zf(r),go);case"TxMined":var n=e.a,m=e.b,b=f(Vh,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Ag,a,lp(li(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 po(M([f(Pf,r.tagger,f(Rp,f(dA,n,s),Cy(r.nodePath))),f(Ag,a,lp(li(C))),f(Ag,u.toMsg,lp(s))]))}return go}();return L(Zf(D(r,{txs:l(Jh,n,IA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Ag,r,lp(fi("TxReceipt decoding failure")))}return go}();return L(Zf(r),S)}return L(Zf(r),go);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(gA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Zf(r),f(Ag,B,f(Np,function(e){return lp(D(I,{doneWatching:!0,reOrg:!0}))},f(bp,function(e){return lp(D(I,{doneWatching:!0}))},f(lA,r.nodePath,T.txHash)))))}return L(Zf(r),go)}if(R(w,T.lastCheckedBlock))return L(Zf(r),f(Pf,r.tagger,f(Rp,f(dA,n,T),f(bp,function(e){return Cy(r.nodePath)},NE(2e3)))));var k=f(gA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Zf(r),po(M([f(Pf,r.tagger,f(Rp,f(dA,n,I),f(bp,function(e){return Cy(r.nodePath)},NE(2e3)))),f(Ag,B,lp(I))])))}return L(Zf(r),go)}var n=e.a,h=e.c.a;return L(Zf(r),go);default:var h=e.a;return L(Zf(r),go)}}),_A=Jt,LA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),xA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),PA=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(xA,"#",e.fragment,l(xA,"?",e.query,U(f(LA,e.port_,U(t,e.host)),e.path)))},DA=r(function(e,t){return e<0?ci:kl(f(xl,e,t))}),UA=r(function(e,t){if(e<0)return t;var r=ah(f(xl,e,t)),n=f(js,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),OA=n(function(e,t,r){if(e<0)return r;var n=f(xl,e,r),a=f(js,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),MA=r(function(e,t){return f(OA,e,Qu(t))}),FA=r(function(e,t){gv(t);switch(t.$){case"Home":return L(D(e,{submodel:HS}),go);case"Create":var r=Nd(e.wallet),n=f(hl,e.txSentry,f(Bo,fy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(KA,U(f(Qi,fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:cy(r.model),txSentry:a}),po(M([f(Pf,fy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(ey,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(qy,e.wallet,r)}return l(Hy,e.wallet,u,s)}(),c=f(hl,e.txSentry,f(Bo,hy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(KA,U(f(Qi,hy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:dy(r.model),txSentry:a}),po(M([f(Pf,hy,r.cmd),i]))));case"Marketplace":var d=Qg(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:ly(h)}),po(M([f(Pf,qS,p)])));case"AgentHistory":var g=t.a,v=f(vo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:sy(y)}),po(M([f(Pf,VS,m)])));default:return L(f(uo,rA,e),go)}}),VA=r(function(e,t){var r=t.a,n=t.b,a=f(HA,KS(e),r),i=a.a,o=a.b;return L(i,po(M([n,o])))}),KA=r(function(e,t){var r=t.a,n=t.b;return l(Ra,VA,L(r,n),e)}),HA=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(HA,jS,t);case"GotoRoute":var n=r.a;return L(t,f(zv,t.key,n));case"GTag":var a=r.a;return L(t,Qv(Wv(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),Qv(Wv(d(pl,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(fv,ty,o,u,s));default:return L(t,ry(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(UA,c,t.userNotices)}),go);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(Gv,t.key,PA(e))}var r=h.a;return _A(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(jA,g,t);case"GotoRoute":var v=e.a;return L(t,po(M([Qv(Wv(d(pl,"GotoRoute","navigation",gv(v),0))),f(zv,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),go);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,tA,t),go):L(t,Yv(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return go;var t=e.a;return Xv(f(Jv,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Th,zo,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=nA(l(gl,I,w,S)),B=f(py,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(Vf,"Unexpected wallet state encounted when setting commPubkey!",ci),t),go)}T.a;return L(f(uo,f(Vf,"User pubkey set, but I can no longer find the user address!",ci),t),go)}var N=E.a;return L(l(Pa,uo,f(Vf,"error decoding commPubkey from JS",N),t),go);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(Hg,R,_),P=f(hl,t.txSentry,f(Bo,fy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(KA,U(f(Qi,fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:cy(x.model),txSentry:O}),po(M([f(Pf,fy,x.cmd),F]))))}return L(t,go);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(sS,K,j),q=f(hl,t.txSentry,f(Bo,hy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(KA,U(f(Qi,hy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:dy(x.model),txSentry:O}),po(M([f(Pf,hy,x.cmd),F]))))}return L(t,go);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(cv,G,Y);return f(KA,f(Qi,qS,x.appCmds),L(D(t,{submodel:ly(x.model)}),f(Pf,qS,x.cmd)))}return L(t,go);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(Df,W,Q),X=f(hl,t.txSentry,f(Bo,VS,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(KA,U(f(Qi,VS,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:sy(x.model),txSentry:O}),po(M([f(Pf,VS,x.cmd),F]))))}return L(t,go);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(lu,si,f($A,Z,r))}return L(ci,go)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(DA,re,t.tradeCaches);if("Nothing"===ae.$)return f(VA,pa(f(Vf,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,go));var ie=ae.a,x=f(FS,ne,ie);return L(D(t,{tradeCaches:l(MA,re,x.tradeCache,t.tradeCaches)}),f(Pf,GS(re),x.cmd));case"NoOp":return L(t,go);default:var N=e.a;f(Mf,"test",N);return L(t,go)}}),jA=r(function(e,t){return f(FA,t,qv(e))}),qA=Ge("txIn",LE),GA=je("txOut",Ua),zA=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},YA=function(e){return{$:"EventSentryMsg",a:e}},WA=function(e){var t=f(Dy,YA,Nh(e)),r=t.a,n=t.b;return x({dataFetchState:l(_S,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Rd,"tradeCache init","processing",zA(e),0)]))},JA=function(e){return{$:"InitialNumTradesFetched",a:e}},QA=function(e){return f(pS,e.factory,JA)},XA=function(e){var t=WA(e),r=t.a,n=t.b,a=t.c;return x(r,po(M([n,QA(r)])),a)},ZA=function(e){return{$:"TxSentryMsg",a:e}},eB={align:Uf,label:"noWeb3Provider",mainParagraphs:M([M([Ff("No web3 provider detected. Is "),f(zI,M([eA(l(WI,0,0,1))]),{label:Ff("Metamask"),url:"https://metamask.io/"}),Ff(" or some other web3 provider installed and unlocked?")])]),noticeType:lg},tB={$:"TopLeft"},rB={align:tB,label:"screenToSmall",mainParagraphs:M([M([Ff("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:lg},nB={align:Uf,label:"wrongWeb3Network",mainParagraphs:M([M([Ff("Your wallet is set to an incorrect network.")]),M([Ff("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:sg},aB={$:"NoneDetected"},iB=function(e){return{$:"OnlyNetwork",a:e}},oB=function(e){return f(Ao,Nh,yg(e))},uB={$:"ETCMain"},sB={$:"ETCTest"},cB={$:"Expanse"},fB={$:"Kovan"},lB={$:"Mainnet"},dB=function(e){return{$:"Private",a:e}},hB={$:"Rinkeby"},pB={$:"Ropsten"},gB={$:"RskMain"},vB={$:"RskTest"},yB=function(e){switch(e){case 1:return lB;case 2:return cB;case 3:return pB;case 4:return hB;case 30:return gB;case 31:return vB;case 42:return fB;case 41:return uB;case 62:return sB;default:return dB(e)}},mB=n(function(e,t,r){var n=e.a,a=e.b;return Zf({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:Fh})}),bB=n(function(e,t,n){var a=e.networkId?iB(yB(e.networkId)):aB,i=f(Ao,function(e){return l(mB,L(GA,qA),ZA,e)},oB(a)),o=e.width<1024?si(rB):ci,u=f(xa,XA,ro),s=function(){return R(a,aB)?si(eB):"Nothing"===yg(a).$?si(nB):ci}(),c=IC(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=$v(f(Bi,r(function(e,t){return f(Qi,GS(e),t)}),g)),y=po(f(Bi,r(function(e,t){return f(Pf,GS(e),t)}),p)),m=f(KA,v,f(jA,t,{key:n,screenWidth:e.width,submodel:HS,time:ml(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),po(M([y,C])))}),CB=Oe,EB=CB(yr),SB=function(e){return EB},TB=function(e){return{$:"Refresh",a:e}},wB=r(function(e,t){return{$:"Every",a:e,b:t}}),IB=r(function(e,t){return{processes:t,taggers:e}}),AB=lp(f(IB,Fh,Fh)),BB=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(eS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),kB=Ne,NB=r(function(e,t){var r=e.a,n=e.b,a=f(Vh,r,t);if("Nothing"===a.$)return l(fl,r,M([n]),t);var i=a.a;return l(fl,r,f(ka,n,i),t)}),RB=Be,$B=r(function(e,t){return{$:"Zone",a:e,b:t}}),_B=ca,LB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=RB(f(_B,n,f(Zh,e,n)));return f(bp,function(t){return l(LB,e,a,l(fl,n,t,r))},i)}return lp(r)}),xB=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 x(n,a,f(bp,function(e){return i},kB(t)))}),u=l(Ra,NB,Fh,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(fl,e,r,i),o)}),d=p(BB,s,c,o,u,i,x(yr,Fh,lp(gr))),h=d.a,g=d.b,v=d.c;return f(bp,function(e){return lp(f(IB,u,e))},f(bp,function(t){return l(LB,e,h,g)},v))}),PB=function(e){return we(function(t){t(Se(e(Date.now())))})}(ml),DB=n(function(e,t,r){var n=f(Vh,t,r.taggers);if("Nothing"===n.$)return lp(r);var a=n.a,i=function(t){return Tp(f(xa,function(r){return f(Xh,e,r(t))},a))};return f(bp,function(e){return lp(r)},f(bp,i,PB))}),UB=r(function(e,t){var r=t.a,n=t.b;return f(wB,r,f(Da,e,n))});pn.Time=Pe(AB,xB,DB,0,UB);var OB=Ue("Time"),MB=r(function(e,t){return OB(f(wB,e,t))}),FB=function(e){return f(MB,2e3,TB)},VB=function(e){return EB},KB=function(e){return{$:"DecryptionFinished",a:e}},HB=Ge("decryptionFinished",LE),jB=Ge("encryptionFinished",LE),qB=function(e){return{$:"EncryptionFinished",a:e}},GB=function(e){return{$:"Refresh",a:e}},zB=function(e){return CB(M([f(MB,3e3,GB),jB(qB),HB(function(e){return XC(KB(e))})]))},YB=yn,WB=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return EB;case"CreateModel":t.a;return f(YB,fy,FB());case"TradeModel":t.a;return f(YB,hy,zB());case"MarketplaceModel":t.a;return f(YB,qS,VB());default:t.a;return f(YB,VS,SB())}},JB=Ge("userPubkeyResult",LE),QB=Ge("walletSentryPort",LE),XB={$:"CheckForNewTrades"},ZB={$:"UpdateTradePhases"},ek=function(e){return CB(M([f(MB,5e3,function(e){return XB}),f(MB,3e3,function(e){return ZB})]))},tk=function(e){return{$:"Tick",a:e}},rk=function(e){return{$:"UserPubkeySet",a:e}},nk=function(e){return{$:"WalletStatus",a:e}},ak=function(e){return f(Vf,"Error decoding JS walletSentry: "+e,ci)},ik=function(e){return{$:"ErrorDecoding",a:e}},ok=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),uk=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(gh,"ref",BC),f(gh,"txHash",uA(jE))),sk=function(e){var t=f(Th,uk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(ok,r.ref,li(a))}return f(ok,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return ik("Error decoding tx data")},ck=function(e){var t=e.a;return f(YB,t.tagger,t.inPort(sk))},fk=f(Oi,yB,BC),lk=Yo(f(Io,Ll,f(Io,sd("Failure decoding stringy int"),Uo(yB)))),dk=_E(M([lk,fk])),hk=r(function(e,t){return{account:e,networkId:t}}),pk=l(Mi,hk,f(gh,"account",uA(UE)),f(gh,"networkId",dk)),gk=n(function(e,t,r){var n=f(Th,pk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),vk=function(e){var t=f(Io,ak,f(Io,pa,KS));return CB(U(M([f(MB,1e3,tk),QB(f(gk,t,nk)),f(hc,EB,f(Ao,ck,e.txSentry)),JB(rk),CB(f(Bi,r(function(e,t){return f(YB,GS(e),t)}),f(xa,ek,e.tradeCaches)))]),M([WB(e)])))},yk=function(e){return{$:"LinkClicked",a:e}},mk=function(e){return{$:"UrlChanged",a:e}},bk=n(function(e,t,r){return d(YI,e/255,t/255,r/255,1)}),Ck=l(bk,10,33,108),Ek={$:"Generic"},Sk=Ek,Tk=r(function(e,t){return d(qI,uT,Sk,f(ka,rT(eT),f(ka,XS(eT),e)),iT(M([t])))}),wk=function(e){return{$:"Fill",a:e}},Ik=wk(1),Ak=Hi,Bk=function(e){return{$:"Px",a:e}},kk=Bk,Nk=xT(8),Rk=function(e){return f(XI,Nk,l(QI,"bg-"+ZI(e),"background-color",e))},$k=f(Tk,M([rT(Ik),XS(kk(150)),Rk(Ck)]),Ak),_k=function(e){return{$:"GotoRoute",a:e}},Lk={$:"Active"},xk={$:"Important"},Pk={$:"Normal"},Dk=l(WI,1,1,1),Uk=xT(2),Ok=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),Mk=r(function(e,t){return R(e,t)?f(XI,Uk,h(Ok,"p-"+Ni(e),e,e,e,e)):f(XI,Uk,h(Ok,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Fk=xT(21),Vk=r(function(e,t){return{$:"Class",a:e,b:t}}),Kk=f(Vk,Fk,lT.cursorPointer),Hk=xT(17),jk=function(e){return f(XI,Hk,l(II,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},qk=function(e){return{$:"Normal",a:e}},Gk=An,zk=r(function(e,t){return f(Gk,e,qk(t))}),Yk=function(e){return f(zk,"click",Fi(e))},Wk=f(Da,nT,Yk),Jk=xT(13),Qk=f(Vk,Jk,lT.textSemiBold),Xk=xT(4),Zk=function(e){return{$:"FontSize",a:e}},eN=function(e){return f(XI,Xk,Zk(e))},tN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([jk(4),Rk(l(WI,0,0,1))]);default:return M([jk(4),Rk(l(WI,.9,0,0))])}}();return f(Tk,U(M([f(Mk,23,12),eN(22),Qk,eA(Dk),Kk,Wk(t)]),n),Ff(e))}),rN=l(bk,244,0,103),nN=function(e){return{$:"AlignX",a:e}},aN={$:"CenterX"},iN=nN(aN),oN=xT(3),uN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),sN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),cN=function(e){return f(XI,oN,l(uN,f(sN,e,e),e,e))},fN=function(e){return{$:"Describe",a:e}},lN={$:"Paragraph"},dN=r(function(e,t){return d(qI,wT,Sk,f(ka,fN(lN),f(ka,rT(Ik),f(ka,cN(5),e))),iT(t))}),hN=f(Vk,Jk,lT.bold),pN=f(Tk,M([eN(29),eA(Dk),hN,iN,Kk,Wk(_k(bv))]),f(dN,yr,M([Ff("DAI"),f(Tk,M([eA(rN)]),Ff("Hard"))]))),gN={$:"Right"},vN=nN(gN),yN={$:"AsColumn"},mN=yN,bN=r(function(e,t){return d(qI,mN,Sk,f(ka,GI(lT.contentTop+" "+lT.contentLeft),f(ka,XS(eT),f(ka,rT(eT),e))),iT(t))}),CN={$:"AsRow"},EN=CN,SN=r(function(e,t){return d(qI,EN,Sk,f(ka,GI(lT.contentLeft+" "+lT.contentCenterY),f(ka,rT(eT),f(ka,XS(eT),e))),iT(t))}),TN=function(e){return f(SN,M([rT(Ik),cN(30),f(Mk,30,17)]),M([l(tN,"Browse Offers",_k(Cv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Lk}return Pk}()),l(tN,"Create a New Offer",_k(mv),function(){return"CreateModel"===e.submodel.$?Lk:Pk}()),function(){var t=Td(e.wallet);if("Just"===t.$){var r=t.a;return l(tN,"My Trades",_k(yv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Lk:Pk}return Pk}())}return l(tN,"Connect to Wallet",jS,xk)}(),f(bN,M([vN,cN(0),f(Mk,8,0)]),M([pN]))]))},wN=YI,IN=r(function(e,t){return f(Tk,M([jk(4),Rk(d(wN,0,0,1,.1)),eA(l(bk,16,7,234)),eN(e),Qk,f(Mk,15,13)]),Ff(Kf(t)))}),AN=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),BN=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(XI,Uk,h(Ok,"p-"+Ni(t),t,t,t,t)):f(XI,Uk,h(Ok,d(AN,t,r,n,a),t,r,n,a))},kN=function(e){return function(){var t=Td(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?f(Tk,M([f(Mk,30,10),eN(24),Qk]),Ff("Your Trades")):f(SN,M([cN(10),BN({bottom:30,left:30,right:30,top:10})]),M([f(Tk,M([eN(24),Qk]),Ff("Trade History for User")),f(IN,18,e.agentAddress)]))},NN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},RN=function(e){return Yf(e)},$N={$:"BurnWindow"},_N={$:"FiatPrice"},LN={$:"Margin"},xN={$:"Offer"},PN={$:"PaymentWindow"},DN=function(e){return{$:"AlignY",a:e}},UN={$:"CenterY"},ON=DN(UN),MN=xT(20),FN=f(Vk,MN,lT.clip),VN=wk,KN=function(e){return f(XI,Uk,h(Ok,"p-"+Ni(e),e,e,e,e))},HN=r(function(e,t){return f(Tk,M([rT(VN(e)),XS(kk(60)),FN,Rk(Dk)]),f(Tk,M([KN(12),ON,rT(Ik)]),t))}),jN=function(e){switch(e.$){case"Phase":return 1;case"Expires":return 2;case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},qN=function(e){return{$:"JustImage",a:e}},GN=qN({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),zN=zS("alt"),YN=function(e){return f(zS,"src",rt(e))},WN=r(function(e,t){var r=t.src,n=t.description,a=f(Yf,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(qI,uT,Sk,f(ka,GI(lT.imageContainer),e),iT(M([d(qI,uT,aT("img"),U(M([nT(YN(r)),nT(zN(n))]),a),iT(yr))])))}),JN=r(function(e,t){if("None"===t.$)return Ak;var r=t.a;return f(WN,e,r)}),QN=qN({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),XN=function(e){return{$:"ChangeSort",a:e}},ZN=f(Vk,Jk,lT.textMedium),eR=function(e){return f(Tk,M([ZN,eN(17)]),Ff(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},tR=r(function(e,t){return f(SN,M([cN(5),Kk,Wk(XN(e))]),M([eR(e),function(){if("Just"===t.$){var e=t.a;return f(Tk,M([ON]),f(JN,M([rT(kk(8))]),function(){return"Ascending"===e.$?QN:GN}()))}return Ak}()]))}),rR=r(function(e,t){return f(HN,jN(t),f(tR,t,e))}),nR=r(function(e,t){return f(SN,M([rT(Ik)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(rR,r,t)},t))}),aR=l(bk,150,150,150),iR=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},oR=r(function(e,t){return f(xu,e.amount,t.amount)}),uR=r(function(e,t){return f(xu,El(e),El(t))}),sR=n(function(e,t,r){return f(e,r,t)}),cR=function(e){var t=e.a;return(R(e.b,lo)?sR:Ua)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(cR,L(Jg,lo),e,t):l(sR,Eu,iR(e.state.phase),iR(t.state.phase))});case"Expires":return r(function(e,t){return f(qg,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(uR,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(oR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(hc,ma,l(wd,r(function(e,t){return f(Eu,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(qg,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(qg,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},fR=l(bk,233,237,242),lR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),dR=function(e){return f(Tk,M([rT(Ik),XS(Ik),FN]),f(dN,M([eN(12)]),M([Ff(e.info)])))},hR=function(e){return f(hc,Ak,f(Ao,dR,kl(e)))},pR=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"}},gR=function(e){return{$:"TimeLeft",a:e}},vR=function(e){return{$:"TimeUp",a:e}},yR=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 ml(0)}}),mR=r(function(e,t){return ml(Ed(e)-Ed(t))}),bR=r(function(e,t){var r=f(yR,t.state.phase,t),n=f(mR,e,t.state.phaseStartTime),a=f(mR,r,n);return Ed(a)>0?gR(L(a,r)):vR(r)}),CR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},ER=l(WI,0,0,0),SR=l(bk,51,183,2),TR=function(e){var t=Tu(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Ro(n));return n+(function(){if(a){return f(Po,a+1,f(_o,1,ZT(r)))}return""}()+"%")},wR=r(function(e,t){return qN({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"}()})}),IR=n(function(e,t,r){return f(JN,f(ka,XS(kk(34)),e),f(wR,t,r))}),AR=r(function(e,t){var r=TR(t);if("0%"===r)return f(Tk,M([eN(16)]),Ff("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?SR:rN;return f(SN,M([cN(4)]),M([l(IR,yr,a,si(i)),f(Tk,M([eA(o),eN(16)]),Ff(n))]))}),BR=qN,kR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(fl,r,n,t)}),Fh,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,BR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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","₫")]))),NR=function(e){return f(hc,"",f(Ao,Qa,f(Vh,e,kR)))},RR=function(e){return Ro(e)<=3?e:RR(f(ed,3,e))+","+f(Mo,3,e)},$R=function(e){return RR(Zl(e))},_R=function(e){return U(NR(e.fiatType),$R(e.amount))},LR=function(e){var t=function(){var t=f(Vh,e.fiatType,kR);if("Nothing"===t.$)return Ak;var r=t.a,n=(r.a,r.b);return f(JN,M([XS(kk(26))]),n)}();return f(SN,M([cN(4)]),M([t,f(Tk,M([eA(d(wN,0,0,0,.5)),ZN,rT(kk(50))]),Ff(e.fiatType)),Ff(_R(e))]))},xR=function(e){return Ed(e)<0},PR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),DR=function(e){var t=zp(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(PR,Ob(t),Ob(r),Ob(n),Ob(a))}(f(hc,L(wu(0),wu(0)),f(rs,n,wu(60))))}(f(hc,L(wu(0),wu(0)),f(rs,r,wu(3600))))}(f(hc,L(wu(0),wu(0)),f(rs,t,wu(86400))))},UR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!xR(a)){var u=r(function(e,t){return U(l(cs,2,P("0"),Ni(e)),t)}),s=Ed(a)>0?i:o,c=DR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(SN,U(M([cN(5)]),e),M([f(Tk,U(M([eA(h)]),t),Ff(f(u,c.days,"d"))),f(Tk,U(M([eA(d)]),t),Ff(f(u,c.hours,"h"))),f(Tk,U(M([eA(s)]),t),Ff(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=ml(0);e=p,t=g,n=v,a=y}}),OR={$:"Behind"},MR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),FR=function(e){return f(MR,OR,e)},VR=r(function(e,t){var r=Fg(200*e),n=200-r,a=f(Tk,M([rT(VN(n))]),Ak),i=M([XS(kk(3)),jk(20)]),o=f(Tk,U(i,M([rT(VN(r)),Rk(t)])),Ak),u=f(Tk,U(i,M([rT(Ik),Rk(fR)])),Ak);return f(SN,M([rT(Ik),FR(u)]),M([o,a]))}),KR=l(WI,1,1,0),HR=r(function(e,t){return Ed(e)/Ed(t)}),jR=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(HR,o,u),c=(f(Tk,M([iN]),d(UR,yr,yr,L(a,i),o)),s<.1?rN:s<.2?KR:SR);return f(bN,U(M([cN(5)]),e),M([d(UR,M([iN]),t,L(a,i),o),f(VR,1-s,c)]))}),qR=function(e){var t=td(El(e)),r=f(Nl,".",t);if(!r.b)return t;if(r.b.b){Mf("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Po,3,t);case 1:return f(Po,4,f(hc,t,f(Ao,ZT,f(Ao,function(e){return e/100},f(Ao,Ka,f(Ao,Fg,f(Ao,ti(100),ad(t))))))));default:var n=r.a;return f(hc,f(Po,n,t),f(Ao,Ni,f(Ao,Fg,ad(t))))}},GR=n(function(e,t,r){return f(HN,jN(t),function(){switch(t.$){case"Phase":return Ff(CR(r.state.phase));case"Expires":if("Open"===r.state.phase.$){var n=f(bR,e,r);if("TimeLeft"===n.$){var a=n.a,i=f(HR,a.a,a.b)<.05?rN:ER;return d(jR,M([rT(Ik)]),M([eN(16)]),L(i,fR),a)}var o=n.a;return d(jR,M([rT(Ik)]),M([eN(16)]),L(rN,fR),L(ml(0),o))}return Ak;case"Offer":return f(SN,M([cN(5)]),M([Ff(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(qR(r.parameters.tradeAmount)+" ")+pR(r.factory))]));case"FiatPrice":return LR(r.terms.price);case"Margin":var u=R(r.parameters.initiatorRole,sb);return f(hc,Ak,f(Ao,AR(u),r.derived.margin));case"PaymentWindow":var s=function(){return"Seller"===r.parameters.initiatorRole.$?rN:SR}(),c=_(Ed(r.parameters.autoabortInterval),216e5)<0?s:ER;return d(UR,yr,yr,L(c,fR),r.parameters.autoabortInterval);default:var s=function(){return"Seller"===r.parameters.initiatorRole.$?SR:rN}(),c=_(Ed(r.parameters.autoabortInterval),216e5)<0?s:ER;return d(UR,yr,yr,L(c,fR),r.parameters.autoreleaseInterval)}}())}),zR=n(function(e,t,r){return f(bN,M([rT(Ik),cN(1),Rk(fR),Kk,Wk(f(lR,r.factory,r.id))]),M([f(SN,M([rT(VN(6)),cN(1)]),f(xa,function(t){return l(GR,e,t,r)},t)),f(HN,1,hR(r.terms.paymentMethods))]))}),YR=Er,WR=xT(28),JR=function(e){return f(XI,WR,l(QI,"bc-"+ZI(e),"border-color",e))},QR=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),XR=function(e){return f(XI,FI,h(QR,"b-"+Ni(e),e,e,e,e))},ZR=a(function(e,t,r,n){return f(bN,M([rT(Ik),XR(2),jk(8),JR(aR),cN(2),Rk(aR),FN]),f(xa,f(zR,e,r),f(YR,cR(t.orderBy),n)))}),e$=a(function(e,t,r,n){return f(bN,M([rT(Ik),XS(Ik),KN(30),cN(5)]),M([f(nR,t.orderBy,r),d(ZR,e,t,r,n)]))}),t$=n(function(e,t,r){return R(t,yr)?Ak:f(Yi,Eo,d(e$,e,r.tradeTable,M([ho,xN,_N,LN,PN,$N]),t))}),r$=function(e){return f(Yf,function(e){return qm(e.parameters)},bS(e))},n$={$:"NoneFound"},a$={$:"AllFetched"},i$={$:"FetchingTrades"},o$={$:"QueryingNumTrades"},u$=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return o$;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?i$:a$}return n$},s$=n(function(e,t,r){var n=$v(f(xa,function(e){return f(RN,NN(r),r$(e))},t)),a=n,i=function(e){return f(Tk,M([eN(24),Qk,eA(aR),iN,KN(20)]),Ff(e))},o=f(Xd,Ja(n$),f(xa,u$,t))?M([i("No trades found.")]):f(xa,i,IC(f(xa,function(e){switch(u$(e).$){case"QueryingNumTrades":return si(zA(e.factory)+"Querying Factory...");case"NoneFound":return ci;case"FetchingTrades":return si(zA(e.factory)+"Fetching Trades");default:return ci}},t)));return f(bN,M([cN(10)]),M([function(){return o.b?f(bN,M([cN(5)]),o):Ak}(),l(t$,e,a,r)]))}),c$=n(function(e,t,r){return f(bN,M([jk(5),Rk(Dk),rT(Ik),XS(Ik),f(Mk,0,20)]),M([kN(r),l(s$,e,t,r)]))}),f$=function(e){return{$:"ShowCurrencyDropdown",a:e}},l$={$:"AbortCreate"},d$=function(e){return{$:"AppCmd",a:e}},h$=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),p$=function(e){return f(xa,function(e){return M([f(Tk,M([eA(rN)]),Ff("Caution! ")),Ff(e)])},IC(M([R(f(qg,e.autoreleaseInterval,ml(12e5)),ba)?si(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."}()):ci,R(f(qg,e.autoabortInterval,ml(36e5)),ba)?si(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.'}()):ci])))},g$=l(WI,0,0,1),v$=function(e){return f(Tk,M([BN({bottom:5,left:5,right:5,top:0}),Wk(e),jk(30),Rk(d(wN,1,1,1,.4)),XR(1),JR(d(wN,0,0,0,.3)),Kk,eN(14)]),f(Tk,M([eA(d(wN,0,0,0,.7))]),Ff("x")))},y$=Bn,m$=y$,b$=nT,C$=r(function(e,t){return f(Tk,M([FR(f(Tk,M([Rk(e),b$(f(m$,"position","fixed")),b$(f(m$,"z-index","1000")),b$(f(m$,"top","0")),b$(f(m$,"left","0")),b$(f(m$,"width","100%")),b$(f(m$,"height","100%"))]),Ak)),rT(Ik),XS(Ik)]),t)}),E$={$:"Top"},S$=DN(E$),T$={$:"InFront"},w$=function(e){return f(MR,T$,e)},I$=r(function(e,t){return{$:"Max",a:e,b:t}}),A$=r(function(e,t){return f(I$,e,t)}),B$=n(function(e,t,r){return l(Pa,C$,d(wN,0,0,.3,.6),f(Tk,U(M([iN,ON,rT(f(A$,500,eT)),Rk(Dk),jk(8),w$(f(Tk,M([vN,S$]),v$(r)))]),e),t))}),k$=r(function(e,t){if("Nothing"===t.$)return Ak;var r=t.a;return f(Tk,U(M([jk(5),JR(l(WI,.9,0,0)),XR(1),Rk(l(WI,1,.4,.4)),KN(5),iN,ON,rT(f(A$,200,eT)),eN(14)]),e),f(dN,yr,M([Ff(r)])))}),N$={$:"Above"},R$=function(e){return f(MR,N$,e)},$$=xT(26),_$=function(e){return{$:"MoveY",a:e}},L$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),x$=function(e){return f(L$,$$,_$(-e))},P$=r(function(e,t){return f(Tk,M([jk(4),f(Mk,25,17),eN(18),Qk,Rk(fR),R$(f(k$,M([x$(5)]),t))]),Ff(e))}),D$=a(function(e,t,r,n){return d(YI,e/255,t/255,r/255,n)}),U$=d(D$,1,31,52,.64),O$=xT(32),M$={$:"Active"},F$=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),V$=$n,K$={$:"NoAttribute"},H$=r(function(e,t){switch(t.$){case"NoAttribute":return K$;case"Describe":var r=t.a;return fN(r);case"AlignX":var n=t.a;return nN(n);case"AlignY":var a=t.a;return DN(a);case"Width":var n=t.a;return tT(n);case"Height":var n=t.a;return QS(n);case"Class":var n=t.a,a=t.b;return f(Vk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(XI,i,o);case"Nearby":var u=t.a,s=t.b;return f(MR,u,f(zi,e,s));case"Attr":var c=t.a;return nT(f(V$,e,c));default:var l=t.a,d=t.b;return f(L$,l,d)}}),j$=function(e){return f(H$,Ig,e)},q$=r(function(e,t){var r=t.a,n=t.b,a=j$(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(UI,n,o));default:return L(r,n)}}),G$=function(e){var t=l(Ra,q$,L(yr,HI),e),r=t.a,n=t.b;return f(ka,AI(n),r)},z$=function(e){return f(XI,O$,f(F$,M$,G$(e)))},Y$=xT(33),W$={$:"Hover"},J$=function(e){return f(XI,Y$,f(F$,W$,G$(e)))},Q$=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Tk,M([jk(4),Kk,Wk(n),f(Mk,25,17),eA(t),eN(18),Qk,Rk(a),z$(M([Rk(o)])),J$(M([Rk(i)]))]),Ff(r))}),X$=r(function(e,t){return d(Q$,x(d(wN,1,0,0,1),d(wN,1,0,0,.8),d(wN,1,0,0,.6)),Dk,e,t)}),Z$=xT(12),e_=f(Vk,Z$,lT.textCenter),t_=function(e){return C$(d(wN,0,0,.3,.6))(f(bN,M([cN(10),iN,ON,Rk(d(wN,0,0,0,.5)),jk(8),KN(20)]),f(xa,function(e){return f(dN,M([iN,ON,eN(20),Qk,eA(Dk),e_]),M([e]))},e)))},r_=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+cA(t)}e.a;return"https://kovan.etherscan.io/tx/"+cA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+cA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+cA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+cA(t)}}),n_={$:"Bottom"},a_=DN(n_),i_=GI(lT.underline),o_=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(Ff(qR(fb(a))),f(X$,"Yes, I definitely want to open this trade.",l(h$,r,n,a)))}return L(Ff("??"),f(P$,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(B$,yr,f(bN,M([cN(20),KN(20),iN,XS(Ik),e_]),M([f(Tk,M([eN(26),Qk,iN,ON]),Ff("Just to Confirm...")),f(bN,M([cN(20),iN,ON]),f(xa,dN(M([iN,eN(18),ZN,eA(U$)])),U(p$(n),U(M([M([Ff("You will deposit "),i,Ff(" "+pR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([Ff("This ususally requires two Metamask signatures. Your "+pR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Tk,M([a_,iN]),o)])),l$);case"ApproveNeedsSig":var u=e.a;return f(Tk,M([Wk(d$(d(Rd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),t_(M([Ff("Waiting for user signature for the approve call."),Ff("(check Metamask!)"),Ff("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Tk,M([Wk(d$(d(Rd,"txChainModal clicked","misclick","ApproveMining",0)))]),t_(M([Ff("Mining the initial approve transaction..."),f(zI,M([i_,eA(g$)]),{label:Ff("See the transaction on Etherscan"),url:f(r_,eo(u),s)}),Ff("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Tk,M([Wk(d$(d(Rd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),t_(M([Ff("Waiting for user signature for the create call."),Ff("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Tk,M([Wk(d$(d(Rd,"txChainModal clicked","misclick","CreateMining",0)))]),t_(M([Ff("Mining the final create call..."),f(zI,M([i_,eA(g$)]),{label:Ff("See the transaction on Etherscan"),url:f(r_,r,s)}),Ff("You will be redirected when it's mined.")])))}}),u_=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Ak;var r=t.a;return f(o_,r,e)},s_=function(e){return{$:"TradeAmountChanged",a:e}},c_=zS("id"),f_=b$(c_("inputError")),l_=l(bk,109,127,138),d_=qN({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),h_=function(e){return f(JN,f(ka,XS(kk(26)),e),d_)},p_=function(e){return f(SN,M([cN(4)]),M([h_(yr),f(Tk,M([eN(24),ZN,eA(l_)]),Ff(pR(e)))]))},g_={$:"Left"},v_=nN(g_),y_=function(e){return{$:"HiddenLabel",a:e}},m_=y_,b_=zS("type"),C_=function(e){return L(e,!0)},E_=function(e){return{$:"MayStopPropagation",a:e}},S_=r(function(e,t){return f(Gk,e,E_(t))}),T_=r(function(e,t){return l(La,gh,t,e)}),w_=f(T_,M(["target","value"]),zo),I_=function(e){return f(S_,"input",f(Oi,C_,f(Oi,e,w_)))},A_=xT(0),B_=r(function(e,t){return{$:"Transparency",a:e,b:t}}),k_=function(e){var t=function(e){return 1-e}(f(rc,1,f(ei,0,e)));return f(XI,A_,f(B_,"transparency-"+zT(t),t))},N_=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),R_=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(qI,mN,aT("label"),e,iT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(qI,uT,Sk,a,iT(M([i])));switch(n.$){case"Above":return d(qI,mN,aT("label"),e,iT(M([o,r])));case"Below":return d(qI,mN,aT("label"),e,iT(M([r,o])));case"OnRight":return d(qI,EN,aT("label"),e,iT(M([r,o])));default:return d(qI,EN,aT("label"),e,iT(M([o,r])))}}),$_=gI,__=f(Da,nT,$_("autocomplete")),L_=l(WI,136/255,138/255,133/255),x_=l(WI,186/255,189/255,182/255),P_=f(Mk,12,12),D_=l(WI,1,1,1),U_=M([P_,jk(3),JR(x_),Rk(D_),XR(1),cN(3),rT(Ik)]),O_=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},M_=function(e){return f(Qd,O_,e)?K$:GI("focusable")},F_=function(e){return{$:"Label",a:e}},V_=function(e){if("HiddenLabel"===e.$){var t=e.a;return fN(F_(t))}return K$},K_=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},H_=function(e){return"HiddenLabel"===e.$},j_=ye,q_=r(function(e,t){return f(kn,e,j_(t))}),G_=q_("spellcheck"),z_=f(Da,nT,G_),Y_=W,W_=xT(47),J_=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(Y_(e))),o=(i-1)*t+f(hc,0,f(Ao,a,r))+f(hc,0,f(Ao,a,n));return f(XI,W_,l(II,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),Q_=zS("value"),X_=f(Da,nT,Q_),Z_={$:"LivePolite"},eL=fN(Z_),tL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(qT,"width",n)?L(r,n):L(f(ka,e,r),f(aS,"width",n));case"Height":e.a;return f(qT,"height",n)?L(r,n):L(f(ka,e,r),f(aS,"height",n));case"Describe":e.a;return f(qT,"described",n)?L(r,n):L(f(ka,e,r),f(aS,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(qT,"align-x",n)?L(r,n):L(f(ka,e,r),f(aS,"align-x",n));case"AlignY":return f(qT,"align-y",n)?L(r,n):L(f(ka,e,r),f(aS,"align-y",n));default:return f(qT,"transform",n)?L(r,n):L(f(ka,e,r),f(aS,"transform",n))}}),L(yr,Py),e).a},rL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,tL(e))}),nL=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}},aL=f(Da,Gi,Qu),iL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([nT(I_(n.onChange))]),o=U(U_,t),u=f(rL,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(Yf,K_,o),c=f(rL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(rL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(rL,o,function(e){return"Nearby"===e.$})),p=f(Yf,f(Da,Du,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([X_(n.text),nT(b_(a)),z_(e.spellchecked),GI(lT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return K$;var r=t.a;return __(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(nL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(N_,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(N_,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(hc,5,c);return x("textarea",U(M([z_(e.spellchecked),GI(lT.inputMultiline),f(hc,K$,f(Ao,__,e.autofill)),function(){if("Nothing"===u.$)return K$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return BN({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?K$:s.a?d(J_,n.text,v,u,g):K$}()]),h),M([aL(lI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(qI,uT,Sk,f(ka,rT(Ik),$v(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([w$(f(Tk,f(ka,P_,U(s,U(M([eA(L_),GI(lT.noTextSelection+" "+lT.passPointerEvents),JR(d(wN,0,0,0,0)),Rk(d(wN,0,0,0,0)),XS(Ik),rT(Ik),k_(""===n.text?1:0)]),r))),a))])}()]))),iT(M([d(qI,uT,aT(v),$v(M([M([M_(t),V_(n.label)]),y,i])),iT(m))])));return l(R_,f(ka,f(Vk,Fk,lT.cursorText),f(ka,H_(n.label)?K$:cN(5),f(ka,eL,u))),n.label,b)}),oL=iL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),uL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(oL,M([rT(Ik),XS(kk(40)),XR(0)]),{label:m_(r),onChange:i,placeholder:n,text:a});return f(SN,U(M([cN(5)]),e),IC(M([f(Ao,Tk(M([v_])),o),si(s),f(Ao,Tk(M([vN])),u)])))}),sL={$:"Below"},cL=function(e){return f(MR,sL,e)},fL=function(e){return f(L$,$$,_$(e))},lL=n(function(e,t,r){return p(uL,M([rT(kk(150)),ZN,eN(24),cL(f(k$,M([f_,fL(5)]),r))]),L(ci,si(f(Tk,M([Wk(d$(d(Rd,"click","misclick","dai symbol in dai input",0)))]),p_(e)))),"dai input",ci,t,s_)}),dL=r(function(e,t){return f(XI,FI,h(QR,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),hL=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?XR(r):f(dL,n,r):f(XI,FI,h(QR,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},pL=Tk(M([JR(fR),hL({bottom:2,left:0,right:0,top:0})])),gL=r(function(e,t){return f(bN,M([cN(10)]),M([f(Tk,M([eN(17),Qk]),Ff(e)),t]))}),vL=r(function(e,t){return pL(f(gL,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(lL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),yL=function(e){return f(hc,wE,yg(e))},mL=function(e){var t=function(){var t=zl(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+qR(f(Tl,r,100))+" "+pR(yL(e.wallet))+"."}return"There is a 1% fee."}();return f(SN,M([iN,f(Mk,20,10),Rk(l(bk,10,33,108)),jk(8),cN(5),Wk(d$(d(Rd,"click","misclick","fee notify element",0)))]),M([f(Tk,M([eN(18),eA(l(bk,0,226,255)),Qk]),Ff(t)),f(Tk,M([eN(17),eA(Dk),ZN]),Ff("We only collect this fee when trades resolve successfully."))]))},bL=function(e){return{$:"FiatAmountChanged",a:e}},CL=function(e){return{$:"FiatTypeChanged",a:e}},EL=r(function(e,t){return l(eS,n(function(t,r,n){return f(e,t,r)?l(fl,t,r,n):n}),Fh,t)}),SL=function(e){return f(EL,r(function(t,r){return f(Ng,e,t)}),kR)},TL=qN({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),wL=function(e){return f(JN,M([XS(kk(26))]),f(hc,TL,f(Ao,Ho,f(Vh,e,kR))))},IL=function(e){return b$(f(S_,"click",Fi(L(e,!0))))},AL=aL,BL=function(e){return{$:"AppendProperty",a:e}},kL=r(function(e,t){return BL(e+":"+t)}),NL=r(function(e,t){return f(kL,e,t.value)}),RL=NL("cursor"),$L={$:"Compatible"},_L={cursor:$L,value:"default"},LL=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),xL=function(e){return{$:"PseudoClassSelector",a:e}},PL=function(e){return LL(xL(e))}("hover"),DL=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),UL=DL,OL=UL,ML=OL("span"),FL=r(function(e,t){return f(kn,et(e),rt(t))}),VL=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),KL=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),HL=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),jL=r(function(e,t){return t<>>32-e}),qL=function(e){var t=e.hash?e.seed^f(HL,461845907,f(jL,15,f(HL,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(HL,2246822507,r^r>>>16),a=f(HL,3266489909,n^n>>>13);return(a^a>>>16)>>>0},GL=r(function(e,t){return f(HL,5,f(jL,13,e^f(HL,461845907,f(jL,15,f(HL,3432918353,t)))))+3864292196}),zL=r(function(e,t){var r=t.hash|(255&yi(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(Ri,"",f(ka,t,f(xa,tP,r)));case"UniversalSelectorSequence":var r=e.a;return au(r)?"*":f(Ri,"",f(xa,tP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,tP,r)))}},nP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([eP(t),rP(r)]))},aP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,rP(t),f(xa,nP,r)),i=f(Ri,"",M([f(hc,"",f(Ao,Zx,n))]));return f(Ms,f(Ri," ",f(Yf,f(Da,Du,cd),a)),i)},iP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,aP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,Xx(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(Ri,",\n",f(xa,Gx,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,Jx,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(Ri,"\n\n",f(Yf,f(Da,Du,cd),M([Hx(t),f(Ri,"\n",f(xa,Yx,r)),f(Ri,"\n",f(xa,Wx,n)),f(Ri,"\n\n",f(xa,oP,a))])))},sP=function(e){return uP(Kx(Mx(e)))},cP=function(e){return f(Ri,"\n\n",f(xa,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(dx,t,yr,ci);return fP(M([dP(l(lP,r,yr,e))]))}),pP=function(e){return au(e)?"unstyled":f(as,P("_"),ps(f(YL,15739,cP(uS(WL(uS(f(hP,e,wx(yr)))))))))},gP=function(e){var t=pP(e),r=f(FL,"className",Hf(t));return l(VL,r,e,t)},vP=a(function(e,t,r,n){return f(e,f(ka,gP(t),r),n)}),yP=function(e){return{$:"Unstyled",a:e}},mP=function(e){return yP(aw(e))},bP=mP,CP=r(function(e,t){return f(Tn,e,Xe(t))}),EP=function(e){return En(Xe(e))},SP=r(function(e,t){var r=e.b,n=e.c;return au(r)?t:l(fl,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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,SP,i,s),p=l(Ra,IP,L(yr,h),c),g=p.a,v=p.b,o=l($T,u,f(xa,TP,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,SP,i,s),m=l(Ra,IP,L(yr,h),c),g=m.a,v=m.b,o=d(EP,y,u,f(xa,TP,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,SP,i,s),b=l(Ra,wP,L(yr,h),c),g=b.a,v=b.b,o=l(RT,u,f(xa,TP,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,SP,i,s),C=l(Ra,wP,L(yr,h),c),g=C.a,v=C.b,o=d(CP,y,u,f(xa,TP,s),$a(g));return L(f(ka,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(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,SP,n,o),c=l(Ra,IP,L(yr,s),u),h=c.a,p=c.b,a=l($T,i,f(xa,TP,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,SP,n,o),v=l(Ra,IP,L(yr,s),u),h=v.a,p=v.b,a=d(EP,g,i,f(xa,TP,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,SP,n,o),y=l(Ra,wP,L(yr,s),u),h=y.a,p=y.b,a=l(RT,i,f(xa,TP,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,SP,n,o),m=l(Ra,wP,L(yr,s),u),h=m.a,p=m.b,a=d(CP,g,i,f(xa,TP,o),$a(h));return L(f(ka,a,r),p)}}),AP=r(function(e,t){return h(il,al,e,t,ol,ol)}),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(cd(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),kP=function(e){var t=f(BP,ci,e);if("Nothing"===t.$)return Fh;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,wx(M([NP(t)])))},$P=function(e){return cP(uS(WL(f(xa,RP,Ia(e)))))},_P=function(e){return l($T,"style",yr,uS(aw($P(e))))},LP=n(function(e,t,r){var n=f(xa,TP,t),a=kP(t),i=l(Ra,IP,L(yr,a),r),o=i.a,u=i.b,s=_P(u);return l($T,e,n,f(ka,s,$a(o)))}),xP=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(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(xP,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),_P(e))}),UP=n(function(e,t,r){var n=f(xa,TP,t),a=kP(t),i=l(Ra,wP,L(yr,a),r),o=i.a,u=i.b,s=f(DP,u,o);return l(RT,e,n,f(ka,s,$a(o)))}),OP=a(function(e,t,r,n){var a=f(xa,TP,r),i=kP(r),o=l(Ra,wP,L(yr,i),n),u=o.a,s=o.b,c=f(DP,s,u);return d(CP,e,t,a,f(ka,c,$a(u)))}),MP=a(function(e,t,r,n){var a=f(xa,TP,r),i=kP(r),o=l(Ra,IP,L(yr,i),n),u=o.a,s=o.b,c=_P(s);return d(EP,e,t,a,f(ka,c,$a(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(LP,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 AL(VP(d(vP,ML,M([PL(M([RL(_L)]))]),yr,M([bP(e)]))))},HP=J,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(La,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 si(h(jP,n,a,i,o,u))}return ci}(),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 si(l(qP,a,t,i))}return ci}())}),L(ci,ci),e)},zP=r(function(e,t){var r=GP(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(qI,EN,Sk,f(ka,GI(lT.contentLeft+" "+lT.contentCenterY+" "+lT.wrapped),f(ka,rT(eT),f(ka,XS(eT),e))),iT(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?si(BN({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(qI,EN,Sk,f(ka,GI(lT.contentLeft+" "+lT.contentCenterY+" "+lT.wrapped),f(ka,rT(eT),f(ka,XS(eT),U(e,M([h]))))),iT(t))}var p=-s/2,g=-u/2;return d(qI,uT,Sk,e,iT(M([d(qI,EN,Sk,f(ka,GI(lT.contentLeft+" "+lT.contentCenterY+" "+lT.wrapped),f(ka,nT(f(m$,"margin",ZT(p)+"px "+ZT(g)+"px")),f(ka,nT(f(m$,"width","calc(100% + "+Ni(u)+"px)")),f(ka,nT(f(m$,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(XI,oN,l(uN,o,u,s)),yr))))),iT(t))])))}),YP=i(function(e,t,r,n,a){var i=f(oL,M([rT(kk(80)),XS(kk(40)),eN(24),ZN,JR(fR),IL(r)]),{label:m_("currency type"),onChange:f(Io,HP,n),placeholder:ci,text:t}),o=f(Vh,t,kR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return Ak;r.b;return f(zP,M([rT(kk(350)),JR(ER),XR(1),Rk(Dk),KN(10),iN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(SN,M([rT(kk(80)),cN(9),f(Mk,0,5),IL(n(t)),J$(M([Rk(l(WI,.8,.8,1))]))]),M([f(JN,M([XS(kk(26))]),a),f(Tk,M([eN(16),Qk]),KP(t))]))},Ia(SL(t))))}return Ak}();return f(SN,M([cN(4),cL(u)]),M([f(Tk,M([Wk(a)]),wL(t)),i]))}),WP=i(function(e,t,r,n,a){var i=d$(d(Rd,"click","misclick","currency flag",0)),o=f(Tk,M([Wk(d$(d(Rd,"click","misclick","currency symbol",0)))]),Ff(NR(e))),u=f(Tk,M([cL(f(k$,M([f_,fL(5)]),a))]),h(YP,r,e,f$(!0),CL,i));return p(uL,M([rT(kk(250)),ZN,eN(24),cL(f(k$,M([f_,fL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,bL)}),JP=function(e){return pL(f(gL,"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=d(D$,1,31,52,.13),ZP=r(function(e,t){var r=M([eN(24),ZN,Kk]),n=function(){return"Buyer"===t.$?L(r,U(r,M([eA(XP)]))):L(U(r,M([eA(XP)])),r)}(),a=n.a,i=n.b;return f(SN,M([cN(20)]),M([f(Tk,U(M([Wk(QP(vl))]),i),Ff("Sell "+e)),f(Tk,U(M([Wk(QP(sb))]),a),Ff("Buy "+e))]))}),eD=r(function(e,t){return f(gL,"Trade Type",f(ZP,pR(e),t.inputs.userRole))}),tD=xT(19),rD=function(e){return Ql(M([e.inset?"box-inset":"box-",ZT(e.offset.a)+"px",ZT(e.offset.b)+"px",ZT(e.blur)+"px",ZT(e.size)+"px",ZI(e.color)]))},nD=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(XI,tD,l(II,rD(t),"box-shadow",tw(t)))},aD=nD({blur:20,color:d(D$,0,0,0,.04),offset:L(0,3),size:0}),iD=f(Vk,oN,lT.spaceEvenly),oD=function(e){var t=yL(e.wallet);return f(bN,M([rT(Ik),cN(20),Rk(Dk),jk(5),KN(20),aD]),M([f(SN,M([rT(Ik),iD]),M([f(eD,t,e),f(vL,t,e),JP(e)])),mL(e)]))},uD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),sD={$:"Web3Connect"},cD=function(e){return f(Tk,M([iN]),function(){var t=L(Td(e),yg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(X$,"Open Trade",f(uD,n,r))}t.b;return f(P$,"Unsupported Network",ci)}t.a;return f(X$,"Connect to Wallet",sD)}())},fD=function(e){return{$:"AutoabortIntervalChanged",a:e}},lD=function(e){return{$:"ChangePaymentMethodText",a:e}},dD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),hD=dD,pD=function(e){return f(hD,M([eA(d(wN,0,0,0,.2))]),function(){return Ff("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")}())},gD={$:"TextArea"},vD=r(function(e,t){return l(iL,{autofill:ci,spellchecked:t.spellcheck,type_:gD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),yD=n(function(e,t,r){var n=f(Tk,M([eN(22),Qk]),Ff("Payment Method")),a=f(vD,M([rT(Ik),XS(kk(150)),Rk(d(D$,155,203,255,.2)),XR(0)]),{label:m_("payment method"),onChange:lD,placeholder:""===r?si(pD(t)):ci,spellcheck:!0,text:r});return f(bN,M([cN(20),BN({bottom:15,left:45,right:45,top:0}),rT(Ik),R$(f(k$,M([f_,fL(30),KN(10),eN(20),rT(kk(400))]),e))]),M([n,a]))}),mD=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."},bD=a(function(e,t,r,n){var a=l(cs,e,P("0"),Ni(n));return f(Tk,M([eN(22),eA(t)]),Ff(U(a,r)))}),CD=function(e){return Ed(e)<0?ml(0):e},ED=n(function(e,t,n){var a=r(function(e,r){return f(bN,M([cN(4)]),M([f(Tk,M([KN(4),Kk,Wk(n(f(Ym,t,e)))]),f(JN,M([XS(kk(10))]),QN)),r,f(Tk,M([KN(4),Kk,Wk(n(function(e){return Ed(e)?e:ml(3e5)}(CD(f(mR,t,e)))))]),f(JN,M([XS(kk(10))]),GN))]))}),i=DR(t);return f(SN,M([iD,cN(10)]),M([f(a,ml(864e5),d(bD,3,e," days",i.days)),f(a,ml(36e5),d(bD,2,e," hours",i.hours)),f(a,ml(3e5),d(bD,2,e," min",i.min))]))}),SD=o(function(e,t,r,n,a,i){var o=f(Tk,M([Rk(d(D$,155,203,255,.2)),jk(5),KN(15),R$(f(k$,M([f_]),a))]),l(ED,ER,n,i)),u=f(SN,M([cN(30)]),M([f(JN,M([XS(kk(40)),Wk(d$(d(Rd,"click","misclick","symbol for "+t,0)))]),e),f(Tk,M([eN(22),Qk]),Ff(t))])),s=f(dN,M([eN(17),ZN,eA(U$)]),M([Ff(r)]));return f(bN,M([rT(Ik),jk(10),Rk(l(bk,237,237,237)),cN(2)]),f(xa,Tk(M([Rk(Dk),f(Mk,45,18),rT(Ik)])),M([u,f(SN,M([rT(Ik),cN(25),Rk(Dk)]),M([o,s]))])))}),TD=qN({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),wD=f(Vk,MN,lT.clipX),ID=f(Vk,MN,lT.clipY),AD=i(function(e,t,r,n,a){return f(bN,M([cN(15),jk(8),wD,ID,Rk(Dk)]),M([p(SD,TD,"Payment Window",mD(a),r,n,fD),l(yD,t,a,e)]))}),BD=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},kD=function(e){return"Buyer"===e.$?"Once you confirm payment, the Seller has this time window to decide whether to release the funds to you or burn everything. If he doesn't decide before the time is up, funds are released to you by default.":"Once the Buyer confirms payment, you have this long to decide whether to release the funds to the Buyer or, in the case of an attempted scam, burn everything. If you don't decide before the time is up, funds are released to the Buyer by default."},ND=qN({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),RD=n(function(e,t,r){return f(Tk,M([jk(8),wD,ID,Rk(Dk)]),p(SD,ND,"Burn/Release Window",kD(r),e,t,BD))}),$D=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=qN({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),xD=n(function(e,t,r){return f(Tk,M([jk(8),Rk(Dk),wD,ID]),p(SD,LD,"Open Window",_D(r),e,t,$D))}),PD=function(e){return f(bN,M([rT(Ik),cN(20)]),M([l(xD,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(AD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(RD,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},DD=function(e){return f(bN,M([rT(f(A$,1e3,Ik)),iN,cN(20),BN({bottom:30,left:40,right:40,top:0}),Wk(f$(!1)),w$(u_(e))]),M([oD(e),PD(e),cD(e.wallet)]))},UD=is(hm(8226)),OD=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),MD=r(function(e,t){return l(Ra,ka,t,e)}),FD=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(MD,r,e),a=t-1,i=r;e=n,t=a,r=i}}),VD=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(MD,f(js,e%r,t),l(FD,yr,e/r|0,t))):f(js,e,t)}),KD=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(qT,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(aS,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),HD=function(e){return d(KD,Ua,Py,e,yr)},jD=r(function(e,t){return f(Tk,M([rT(Ik),w$(f(SN,M([cN(3),rT(VN(100)),rT(t),FN]),f(OD,f(Tk,M([eA(d(wN,0,0,0,.1)),eN(14)]),Ff(UD)),f(xa,f(Da,Tk(M([eA(d(wN,0,0,0,.2))])),Ff),f(VD,100,(e?$a:Ua)(HD(f(xa,f(Io,Ho,Qa),Ia(kR)))))))))]),Ff(" "))}),qD=r(function(e,t){var r=t.url,n=t.label;return d(qI,uT,aT("a"),f(ka,nT(YS(r)),f(ka,nT(WS("noopener noreferrer")),f(ka,rT(eT),f(ka,XS(eT),f(ka,GI(lT.contentCenterX+" "+lT.contentCenterY),e))))),iT(M([n])))}),GD=GI(lT.italic),zD=function(){var e=f(Da,Tk(M([eA(l(WI,.8,.2,.2))])),Ff),t=f(Da,Tk(M([hN])),Ff);return f(bN,M([rT(Ik),XS(Ik),Rk(Dk),jk(6),cN(50),nD({blur:20,color:d(D$,0,0,0,.1),offset:L(0,3),size:0}),jk(10),KN(20)]),M([f(jD,!1,Ik),f(bN,M([iN,rT(f(A$,700,Ik)),cN(20)]),M([f(dN,M([eN(70),hN,iN,e_]),M([Ff("DAI"),e("Hard")])),f(SN,M([eN(30),Qk,iN,e_,GD]),M([Ff("The "),e("Global"),Ff(", "),e("Unkillable"),Ff(" Crypto Gateway")]))])),f(SN,M([Rk(aR),cN(2),iN,S$,rT(Ik)]),M([f(Tk,M([f(Mk,40,10),Rk(Dk),rT(Ik),XS(Ik)]),f(bN,M([cN(60),vN]),M([f(Tk,M([eN(40),Qk,iN]),Ff("Want to learn more?")),f(qD,M([jk(4),Kk,f(Mk,25,17),Rk(g$),eA(Dk),hN,eN(24),iN]),{label:f(dN,M([e_]),M([Ff("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"})]))),f(Tk,M([f(Mk,40,10),Rk(Dk),rT(Ik),XS(Ik)]),f(bN,M([v_,cN(60)]),M([f(Tk,M([eN(40),Qk,iN]),Ff("Ready to try it out?")),f(bN,M([cN(10),rT(kk(400)),iN]),M([f(dN,M([eN(24),rT(Ik)]),M([Ff("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f(dN,M([eN(24),rT(Ik)]),M([Ff("Then follow the links at the top of this page to browse "),t("Sell Offers"),Ff(", browse "),t("Buy Offers"),Ff(", or "),t("Create Your Own Offer"),Ff(".")]))]))])))])),f(Tk,M([a_,rT(Ik)]),f(jD,!0,Ik))]))}(),YD=function(e){return{$:"ShowCurrencyDropdown",a:e}},WD=r(function(e,t){return Yf(t(e))}),JD=n(function(e,t,r){return R(t,yr)?Ak:f(Yi,nv,d(e$,e,r.tradeTable,M([Jg,xN,_N,LN,PN,$N]),t))}),QD=n(function(e,t,r){var n=l(WD,e,r.filterFunc,$v(f(xa,r$,t))),a=function(e){return f(Tk,M([eN(24),Qk,eA(aR),iN,KN(20)]),Ff(e))},i=f(Xd,Ja(n$),f(xa,u$,t))?M([a("No trades found.")]):f(xa,a,IC(f(xa,function(e){switch(u$(e).$){case"QueryingNumTrades":return si(zA(e.factory)+"Querying Factory...");case"NoneFound":return ci;case"FetchingTrades":return si(zA(e.factory)+"Fetching Trades");default:return ci}},t)));return f(bN,M([cN(10)]),M([function(){return i.b?f(bN,M([cN(5)]),i):Ak}(),l(JD,e,n,r)]))}),XD=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(XI,Hk,l(II,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},ZD=function(e){return f(zk,"focus",Fi(e))},eU=f(Da,nT,ZD),tU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([eU(e(!0)),IL(e(!0))])}();return f(SN,U(e,M([XS(kk(40)),nD({blur:20,color:d(D$,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Tk,M([Rk(fR),XS(kk(40)),XD({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Tk,M([ON,f(Mk,10,0)]),r)),f(oL,U(s,U(t,M([rT(kk(100)),XS(kk(40)),JR(fR),XD({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),hL({bottom:1,left:0,right:1,top:1})]))),{label:m_(n),onChange:u,placeholder:i,text:a})]))}),rU=function(e){return{$:"MaxDaiChanged",a:e}},nU=function(e){return{$:"MinDaiChanged",a:e}},aU=r(function(e,t){return f(bN,M([rT(Ik),cN(8)]),M([f(Tk,M([eN(17),ZN]),Ff(e)),t]))}),iU=xT(25),oU=function(e){return{$:"MoveX",a:e}},uU=function(e){return f(L$,iU,oU(-e))},sU={$:"OnLeft"},cU=function(e){return f(MR,sU,e)},fU=n(function(e,t,r){var n=h_(M([ON])),a=f(SN,M([cN(8),ON,rT(kk(60))]),M([n,f(Tk,M([eN(16),ON]),Ff("max"))])),i=f(SN,M([cN(8),ON,rT(kk(60))]),M([n,f(Tk,M([eN(16),ON]),Ff("min"))]));return f(aU,"Dai Range",f(bN,M([cN(5),rT(kk(200))]),M([v(tU,M([cU(f(k$,M([uU(5),rT(kk(200))]),r.minDai))]),M([eU(YD(!1))]),i,"min Dai",e,ci,ci,nU),v(tU,M([cU(f(k$,M([uU(5),rT(kk(200))]),r.maxDai))]),M([eU(YD(!1))]),a,"max Dai",t,ci,ci,rU)])))}),lU=function(e){var t=f(Vh,e,kR);if("Nothing"===t.$)return Ff("*");var r=t.a,n=r.b;return f(JN,M([XS(kk(26))]),n)},dU=function(e){return{$:"AppCmd",a:e}},hU=function(e){return{$:"FiatTypeInputChanged",a:e}},pU=n(function(e,t,r){var n=dU(d(Rd,"click","misclick","currency flag",0)),a=lU(t);f(SN,M([cN(8),ON,rT(kk(60))]),M([a,f(Tk,M([eN(16),ON]),Ff("max"))])),f(SN,M([cN(8),ON,rT(kk(60))]),M([a,f(Tk,M([eN(16),ON]),Ff("min"))]));return f(Tk,M([S$,rT(kk(120))]),f(aU,"Fiat Type",h(YP,e,t,YD(!0),hU,n)))}),gU={$:"AddSearchTerm"},vU=function(e){return{$:"PaymentMethodInputChanged",a:e}},yU=f(gh,"keyCode",BC),mU=function(e){return f(zk,"keyup",f(qo,function(t){return 13===t?Fi(e):Go(Ni(t))},yU))},bU=function(e){return f(aU,"Search Payment Methods",f(oL,M([S$,rT(kk(250)),XS(kk(40)),JR(fR),nD({blur:20,color:d(D$,233,237,242,.05),offset:L(0,3),size:0}),b$(mU(gU))]),{label:m_("payment methods search"),onChange:vU,placeholder:ci,text:e}))},CU=function(e){return{$:"RemoveTerm",a:e}},EU=function(e){return f(Tk,M([KN(3),S$,Kk,Wk(CU(e)),eN(10),eA(rN)]),Ff("x"))},SU=function(e){if(e.b){var t=e;return f(SN,M([rT(Ik),KN(10),cN(10)]),f(xa,function(e){return f(SN,M([Rk(d(D$,16,7,234,.2)),jk(5),KN(4),cN(3)]),M([Ff(e),EU(e)]))},t))}return Ak},TU=n(function(e,t,r){return f(bN,M([cN(10),rT(eT),iN]),M([f(SN,M([rT(eT),cN(10)]),M([f(Tk,M([rT(eT),S$]),l(fU,e.minDai,e.maxDai,t)),f(Tk,M([rT(eT),S$]),l(pU,r,e.fiatType,t)),f(bN,M([rT(eT),S$,cN(5)]),M([bU(e.paymentMethod),SU(e.paymentMethodTerms)]))]))]))}),wU=n(function(e,t,r){return f(bN,M([jk(5),Rk(Dk),rT(Ik),XS(Ik),Wk(YD(!1))]),M([f(SN,M([rT(Ik),cN(10),KN(30)]),M([l(TU,r.inputs,r.errors,r.showCurrencyDropdown)])),l(QD,e,t,r)]))}),IU=function(e){return{$:"MessageInputChanged",a:e}},AU={$:"MessageSubmit"},BU=q_("disabled"),kU=function(e){return f(Nn,"tabIndex",Ni(e))},NU=function(e){return{$:"MayPreventDefault",a:e}},RU=r(function(e,t){return f(Gk,e,NU(t))}),$U=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):Go("Not the enter key")},n=f(qo,r,f(gh,"key",zo));return nT(f(RU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),_U=function(e){return f($U,"Enter",e)},LU={$:"Button"},xU=r(function(e,t){var r=t.onPress,n=t.label;return d(qI,uT,Sk,f(ka,rT(eT),f(ka,XS(eT),f(ka,GI(lT.contentCenterX+" "+lT.contentCenterY+" "+lT.seButton+" "+lT.noTextSelection),f(ka,Kk,f(ka,M_(e),f(ka,fN(LU),f(ka,nT(kU(0)),function(){if("Nothing"===r.$)return f(ka,nT(BU(!0)),e);var t=r.a;return f(ka,Wk(t),f(ka,_U(t),e))}()))))))),iT(M([n])))}),PU=function(e){return f(bN,M([rT(Ik),cN(10)]),M([f(vD,M([rT(Ik),XS(kk(100))]),{label:m_("messageInput"),onChange:IU,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(xU,M([iN,eN(24)]),{label:Ff("Submit"),onPress:si(AU)})]))},DU=f(Vk,MN,lT.scrollbarsY),UU=r(function(e,t){return f(Tk,M([XS(Ik),rT(Ik)]),f(Tk,U(M([b$(f(m$,"position","absolute")),b$(f(m$,"top","0")),b$(f(m$,"right","0")),b$(f(m$,"bottom","0")),b$(f(m$,"left","0")),DU]),e),t))}),OU=l(bk,200,205,210),MU=n(function(e,t,r){var n=M([vN,Rk(g$),eA(Dk),XD({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([v_,Rk(OU),eA(ER),XD({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Tk,U(M([KN(7)]),u),f(dN,yr,M([Ff(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(WI,0,0,1),Dk,"Initiator opened the trade"));case"Recalled":return si(x(l(WI,0,0,1),Dk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Po,8,Kf(t))+"..";return si(x(l(WI,1,0,1),Dk,r+" committed to the trade"));case"Aborted":return si(x(l(WI,1,0,0),Dk,"Buyer aborted the trade"));case"Claimed":return si(x(l(WI,0,1,0),Dk,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(WI,0,0,1),Dk,"Seller released the "+pR(e)+" and closed the contract"));default:return si(x(l(WI,0,0,1),Dk,"Seller burned the "+pR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Ak;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Tk,M([jk(3),XR(1),JR(l(WI,1,0,1)),iN,Rk(h)]),f(dN,M([eA(p)]),M([Ff(g)])))}),FU=n(function(e,t,r){if(r.b){var n=r;return f(UU,M([rT(Ik),XS(Ik),jk(5),XR(1),JR(ER),KN(10)]),f(bN,M([rT(Ik),XS(Ik),cN(10)]),f(xa,f(MU,e,t),n)))}return f(Tk,M([rT(Ik),XS(Ik),jk(5),XR(1),JR(ER),iN,eA(l(WI,.5,.5,.5)),GD]),Ff("no messages found."))}),VU=Cr,KU=function(e){return f(bN,M([rT(Ik),XS(Ik),cN(10),XR(1),jk(5),KN(20)]),M([l(FU,e.trade.factory,e.userRole,f(VU,function(e){return e.blocknum},Sa(e.history))),PU(e)]))},HU=function(e){return f(Tk,M([Rk(Dk),jk(8),aD,rT(Ik),XS(Ik)]),KU(e))},jU={$:"ToggleChat"},qU=function(e){if(e.showChatHistory){var t=f(hc,Ak,f(Ao,HU,e.chatHistoryModel));return f(Tk,M([XS(Ik),rT(kk(500)),KN(20),vN]),l(B$,M([XS(Ik),rT(Ik)]),f(Yi,XC,t),jU))}return Ak},GU=function(e){return"Buyer"===e.initiatorRole.$?vl:sb},zU=function(e){return _R(e)+" "+e.fiatType},YU={$:"AbortAction"},WU=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),JU=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return Ak}if("LoadedTrade"!==t.b.$)return Ak;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=zU(n.terms.price),u=qR(fb(i)),s=qR(n.parameters.tradeAmount)+" "+pR(n.factory),c=function(){return"Buyer"===GU(n.parameters).$?L(f(Tk,M([ZN,eA(ER)]),Ff("buyer")),M([Ff("pay the seller "),f(Tk,M([eA(g$)]),Ff(o)),Ff(" in exchange for the "),f(Tk,M([eA(g$)]),Ff(s)),Ff(" held in this contract.")])):L(f(Tk,M([ZN,eA(ER)]),Ff("seller")),M([Ff("accept "),f(Tk,M([eA(g$)]),Ff(o)),Ff(" from the buyer in exchange for the "),f(Tk,M([eA(g$)]),Ff(s)),Ff(" held in this contract.")]))}(),d=c.a,h=c.b;return l(B$,yr,f(bN,M([cN(20),KN(20),iN,XS(Ik),e_]),M([f(Tk,M([eN(26),Qk,iN,ON]),Ff("Just to Confirm...")),f(bN,M([cN(20),iN,ON]),f(xa,dN(M([iN,eN(18),ZN,eA(U$)])),U(M([U(M([Ff("You will deposit "),f(Tk,M([eA(g$)]),Ff(u+" "+pR(n.factory))),Ff(", thereby becoming the "),d,Ff(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([Ff("(This ususally requires two Metamask signatures. Your "+pR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Tk,M([a_,iN]),f(X$,"Yes, I definitely want to commit to this trade.",l(WU,n,a,i)))])),YU);case"ApproveNeedsSig":return t_(M([Ff("Waiting for user signature for the approve call."),Ff("(check Metamask!)"),Ff("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return t_(M([Ff("Mining the initial approve transaction..."),f(zI,M([i_,eA(g$)]),{label:Ff("See the transaction on Etherscan"),url:f(r_,n.factory,p)}),Ff("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return t_(M([Ff("Waiting for user signature for the final commit call."),Ff("(check Metamask!)"),Ff("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return t_(M([Ff("Mining the final commit transaction..."),f(zI,M([i_,eA(g$)]),{label:Ff("See the transaction"),url:f(r_,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(B$,yr,f(bN,M([cN(20),KN(20),iN,XS(Ik),e_]),M([f(Tk,M([eN(26),Qk,iN,ON]),Ff("Just to Confirm...")),f(bN,M([cN(20),iN,ON]),f(xa,dN(M([iN,eN(18),ZN,eA(U$)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([Ff('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 '+pR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([Ff("Aborting will incur a small penalty on both parties, and refund the rest of the "+pR(n.factory)+".")])]);case"Release":return M([M([Ff("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([Ff("This will destroy the "+pR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Tk,M([a_,iN]),function(e){return f(X$,e,yE(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 "+pR(n.factory)+".";default:return"I understand. Burn the "+pR(n.factory)+"."}}()))])),YU);case"ActionNeedsSig":var g=r.a;return t_(M([Ff("Waiting for user signature for the "+bE(g)+" call."),Ff("(check Metamask!)")]));default:var g=r.a,p=r.b;return Ak}},QU=SN(M([rT(Ik),Rk(Dk),jk(5),KN(20),iD,aD])),XU=function(e){return f(SN,M([cN(8)]),M([f(JN,yr,d_),f(Tk,M([eN(24),ZN]),Ff(qR(e)))]))},ZU=r(function(e,t){var r=f(vg,Km(e),f(Ao,function(e){return e.address},Td(t)));return f(gL,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"}(),XU(e.parameters.tradeAmount))}),eO=function(e){return f(SN,M([cN(5)]),M([wL(e.fiatType),f(Tk,M([eN(24),ZN]),Ff(zU(e)))]))},tO=function(e){return f(gL,"For Fiat",eO(e.terms.price))},rO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},nO=l(bk,250,165,22),aO=l(bk,255,0,0),iO=l(bk,0,255,0),oO=qN({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),uO=qN({description:"burned",src:"/DAIHard/static/img/burned.svg"}),sO=qN({description:"released",src:"/DAIHard/static/img/released.svg"}),cO={$:"ToggleStatsModal"},fO=function(e){return f(VU,Ua,e)},lO=n(function(e,t,n){var a=$v(f(xa,function(e){return f(Yf,function(e){return R(f(YC,e,n),si(t))},f(mS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(Vd,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(Vd,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Al,amountReleased:Al,numAborts:0,numBurns:0,numReleases:0},a),u=f(Ao,ml,kl(fO(f(mS,function(e){return function(e){return e?si(e):ci}(Ed(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}}),dO=r(function(e,t){return d(Q$,x(d(wN,0,0,1,1),d(wN,0,0,1,.8),d(wN,0,0,1,.6)),Dk,e,t)}),hO=function(e){return{$:"ViewUserHistory",a:e}},pO=f($B,0,yr),gO=f(Vk,Jk,lT.textNormalWeight),vO=r(function(e,t){return Za(e/t)}),yO=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}}),mO=r(function(e,t){var r=e.a,n=e.b;return l(yO,r,f(vO,Ed(t),6e4),n)}),bO=r(function(e,t){return f(ls,24,f(vO,f(mO,e,t),60))}),CO=r(function(e,t){return f(ls,1e3,Ed(t))}),EO=r(function(e,t){return f(ls,60,f(mO,e,t))}),SO={$:"Apr"},TO={$:"Aug"},wO={$:"Dec"},IO={$:"Feb"},AO={$:"Jan"},BO={$:"Jul"},kO={$:"Jun"},NO={$:"Mar"},RO={$:"May"},$O={$:"Nov"},_O={$:"Oct"},LO={$:"Sep"},xO=function(e){var t=f(vO,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)}},PO=r(function(e,t){switch(xO(f(mO,e,t)).month){case 1:return AO;case 2:return IO;case 3:return NO;case 4:return SO;case 5:return RO;case 6:return kO;case 7:return BO;case 8:return TO;case 9:return LO;case 10:return _O;case 11:return $O;default:return wO}}),DO=r(function(e,t){return f(ls,60,f(vO,Ed(t),1e3))}),UO={$:"Fri"},OO={$:"Mon"},MO={$:"Sat"},FO={$:"Sun"},VO={$:"Thu"},KO={$:"Tue"},HO={$:"Wed"},jO=r(function(e,t){switch(f(ls,7,f(vO,f(mO,e,t),1440))){case 0:return VO;case 1:return UO;case 2:return MO;case 3:return FO;case 4:return OO;case 5:return KO;default:return HO}}),qO=n(function(e,t,r){return e.toAmPm(f(bO,t,r))}),GO=r(function(e,t){return xO(f(mO,e,t)).day}),zO=GO,YO=M([FO,OO,KO,HO,VO,UO,MO]),WO=r(function(e,t){return function(e){return e.a}(f(hc,L(0,FO),kl(f(Yf,function(r){return R(r.b,f(jO,e,t))},f(Bi,r(function(e,t){return L(e,t)}),YO)))))}),JO=function(e){return l(Ra,Na,0,e)},QO=r(function(e,t){return xO(f(mO,e,t)).year}),XO=function(e){return!f(ls,4,e)&&(!!f(ls,100,e)||!f(ls,400,e))},ZO=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return XO(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}}),eM=M([AO,IO,NO,SO,RO,kO,BO,TO,LO,_O,$O,wO]),tM=r(function(e,t){return f(hc,L(0,AO),kl(f(Yf,function(r){r.a;return R(r.b,f(PO,e,t))},f(Bi,r(function(e,t){return L(e,t)}),eM))))}),rM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(tM,e,t))}),nM=r(function(e,t){var r=f(js,f(rM,e,t)-1,eM);return JO(f(xa,ZO(f(QO,e,t)),r))+f(zO,e,t)}),aM=r(function(e,t){return f(rM,e,t)/4|0}),iM=r(function(e,t){var r=Ni(t),n=e-Ro(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),oM=function(e){return e?e<=12?e:e-12:12},uM=Fg(315576e5),sM=r(function(e,t){return ml(uM*f(QO,e,t))}),cM=r(function(e,t){var r=f(sM,e,t),n=f(WO,e,r);return 1+((f(nM,e,t)+n)/7|0)}),fM=r(function(e,t){return Ni(f(QO,e,t))}),lM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(rM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(rM,t,r));case"MonthFixed":return f(iM,2,f(rM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(PO,t,r));case"MonthNameFull":return e.toMonthName(f(PO,t,r));case"QuarterNumber":return Ni(1+f(aM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(aM,t,r));case"DayOfMonthNumber":return Ni(f(zO,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(zO,t,r));case"DayOfMonthFixed":return f(iM,2,f(zO,t,r));case"DayOfYearNumber":return Ni(f(nM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(nM,t,r));case"DayOfYearFixed":return f(iM,3,f(nM,t,r));case"DayOfWeekNumber":return Ni(f(WO,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(WO,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(jO,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(jO,t,r));case"WeekOfYearNumber":return Ni(f(cM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(cM,t,r));case"WeekOfYearFixed":return f(iM,2,f(cM,t,r));case"YearNumberLastTwo":return f(Mo,2,f(fM,t,r));case"YearNumber":return f(fM,t,r);case"AmPmUppercase":return HP(l(qO,e,t,r));case"AmPmLowercase":return Ml(l(qO,e,t,r));case"HourMilitaryNumber":return Ni(f(bO,t,r));case"HourMilitaryFixed":return f(iM,2,f(bO,t,r));case"HourNumber":return Ni(oM(f(bO,t,r)));case"HourFixed":return f(iM,2,oM(f(bO,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(bO,t,r));case"HourMilitaryFromOneFixed":return f(iM,2,1+f(bO,t,r));case"MinuteNumber":return Ni(f(EO,t,r));case"MinuteFixed":return f(iM,2,f(EO,t,r));case"SecondNumber":return Ni(f(DO,t,r));case"SecondFixed":return f(iM,2,f(DO,t,r));case"MillisecondNumber":return Ni(f(CO,t,r));case"MillisecondFixed":return f(iM,3,f(CO,t,r));default:return n.a}}),dM=a(function(e,t,r,n){return f(Ri,"",f(xa,l(lM,e,r,n),t))}),hM=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),pM=function(e){return e>11?"pm":"am"},gM=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"}},vM=function(e){switch(f(ls,100,e)){case 11:case 12:case 13:return"th";default:switch(f(ls,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},yM=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"}},mM=p(hM,gM,f(Io,gM,Po(3)),yM,f(Io,yM,Po(3)),pM,vM),bM=dM(mM),CM={$:"MonthNameFull"},EM=CM,SM=function(e){return{$:"Text",a:e}},TM=SM,wM={$:"YearNumber"},IM=wM,AM=n(function(e,t,n){var a=r(function(e,t){return f(bN,M([eN(18),cN(6)]),M([f(Tk,M([hN]),Ff(e)),f(Tk,M([gO]),Ff(t))]))}),i=bM(M([EM,TM(", "),IM])),o=f(bN,M([cN(23),rT(Ik)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,pO,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+qR(n.amountReleased)+" "+pR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+qR(n.amountBurned)+" "+pR(e)+" Burned")])),M([f(Tk,M([iN]),f(dO,"View User History",hO(n.asRole)))])));return f(bN,M([jk(8),wD,ID,Rk(fR),cN(1),nD({blur:20,color:d(wN,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Tk,M([rT(Ik),Rk(Dk),KN(17)]),f(IN,18,t)),f(Tk,M([rT(Ik),Rk(Dk),KN(17)]),o)]))}),BM=n(function(e,t,r){var n=l(lO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=rO(e.parameters.initiatorRole)+" Stats";return f(Tk,r?M([cL(f(Tk,M([fL(30),vN]),l(AM,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(gL,a,f(SN,M([rT(Ik),cN(20),Kk,Wk(cO)]),f(xa,SN(M([cN(5)])),M([M([f(JN,M([XS(kk(28))]),sO),f(Tk,M([eN(24),ZN,eA(iO)]),Ff(l(cs,2,P("0"),Ni(n.numReleases))))]),M([f(JN,M([XS(kk(28))]),oO),f(Tk,M([eN(24),ZN,eA(nO)]),Ff(l(cs,2,P("0"),Ni(n.numAborts))))]),M([f(JN,M([XS(kk(28))]),uO),f(Tk,M([eN(24),ZN,eA(aO)]),Ff(l(cs,2,P("0"),Ni(n.numBurns))))])])))))}),kM=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+Kf(t)}e.a;return"https://kovan.etherscan.io/address/"+Kf(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+Kf(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+Kf(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+Kf(t)}}),NM=n(function(e,t,r){return f(zI,e,{label:Ff(Kf(r)),url:f(kM,t,r)})}),RM=function(e){return f(gL,"Trade Status",f(bN,M([eN(24),ZN,cN(8)]),M([Ff(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(NM,M([eN(12),eA(g$),i_]),e.factory,e.creationInfo.address)])))},$M=i(function(e,t,r,n,a){return QU(M([RM(t),f(ZU,t,r),tO(t),l(BM,t,n,a)]))}),_M=l(bk,9,32,107),LM=qN({description:"chat",src:"/DAIHard/static/img/chat.svg"}),xM=f(Tk,M([jk(4),Kk,Wk(jU),KN(5),Rk(l(bk,22,0,255))]),f(JN,M([rT(kk(42))]),LM)),PM=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},DM=function(e){return f(bN,M([jk(12),Rk(fR),KN(15),cN(15)]),M([f(Tk,M([eN(24),Qk,GD]),Ff("Fiat Payment Method")),f(dN,M([eN(18),XS(eT),Rk(Dk),nD({blur:5,color:d(wN,0,0,0,.2),offset:L(-3,3),size:0}),jk(3),KN(5)]),M([f(hc,f(Tk,M([eA(XP),GD]),Ff("No payment methods found.")),f(Ao,Ff,f(Ao,function(e){return e.info},kl(e))))]))]))},UM={$:"Active"},OM=function(e){return{$:"ExpandPhase",a:e}},MM=M([Rk(_M),eA(Dk)]),FM=r(function(e,t){return{$:"Min",a:e,b:t}}),VM=r(function(e,t){return f(FM,e,t)}),KM=function(e){return M(e?[jk(12),S$,XS(f(VM,380,eT))]:[jk(12),iN])},HM=M([Rk(Dk)]),jM=qN({description:"flame",src:"/DAIHard/static/img/flame.png"}),qM=r(function(e,t){return Cl(f(qu,El(e),El(t)))}),GM=r(function(e,t){return d(Q$,x(d(wN,1,.6,.2,1),d(wN,1,.6,.2,.8),d(wN,1,.6,.2,.6)),Dk,e,t)}),zM=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),YM=function(e){return{$:"ContractActionClicked",a:e}},WM={$:"Web3Connect"},JM=n(function(e,t,r){var n=Td(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(bR,e,t).$?Ak:f(SN,M([cN(8)]),function(){var e=x(t.state.phase,f(Km,t,a.address),f(YC,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,yE,f(dO,"Remove and Refund this Trade",gE))])}break e}var r=(e.a,e.b,El(Hm(t.parameters)));return M([f(X$,"Deposit and Commit to Trade",l(zM,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,YM,f(GM,"Abort Trade",eE)),f(Yi,YM,f(X$,"Confirm Payment",uE)),xM])}e.a,e.c.a;return M([xM])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,YM,f(X$,"Burn it All!",oE)),f(Yi,YM,f(dO,"Release Everything",vE)),xM])}e.a,e.c.a;return M([xM])}break e;default:break e}return yr}())}return f(X$,"Connect to Wallet",WM)}),QM={$:"Finished"},XM={$:"NotStarted"},ZM=r(function(e,t){var r=L(iR(t),iR(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?XM:R(n,a)?UM:QM}),eF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),tF=r(function(e,t){return l(eF,yr,e,t)}),rF=a(function(e,t,r,n){var a=qR(f(Vd,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+pR(r.factory),i=qR(r.parameters.tradeAmount)+" "+pR(r.factory),o=f(SN,yr,f(tF,3,f(JN,M([XS(kk(18))]),jM))),u=f(Da,Tk(M([eA(l(WI,1,0,0))])),Ff),s=R(e,r.state.phase),c=f(vg,YC(r),f(Ao,function(e){return e.address},Td(n))),d=s?Dk:ER,h=dN(M([eA(d),eN(18),Qk])),p=zU(r.terms.price),g=s?l(bk,0,226,255):l(bk,16,7,234),v=f(Da,Tk(M([eA(g)])),Ff),y=qR(r.parameters.buyerDeposit)+" "+pR(r.factory),m=r.parameters.abortPunishment,b=qR(m)+" "+pR(r.factory),C=qR(f(qM,r.parameters.buyerDeposit,m))+" "+pR(r.factory),E=qR(f(qM,r.parameters.tradeAmount,m))+" "+pR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([Ff("Your "),u("burnable deposit"),Ff(" of "),v(y),Ff(" is now held in this contract, and your offer to buy "),v(i),Ff(" for "),v(p),Ff(" is now listed in the marketplace.")]),M([Ff("If another user likes your offer, they can become the Seller by depositing the full "),v(i),Ff(" into this contract.")]),M([Ff("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),Ff(" to you.")])])):f(xa,h,M([M([Ff("Your offer to sell the "),v(i),Ff(" held in this contract for "),v(p),Ff(" is now listed in the marketplace.")]),M([Ff("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),Ff(" of 1/3 of the trade amount "),v("("+y+")"),Ff(" into this contract.")]),M([Ff("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),Ff(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([Ff("You must now pay the Seller "),v(p),Ff(" via the Fiat Payment Method, "),f(Tk,M([Qk]),Ff("and then click ")),u("Confirm Payment"),Ff(" before the payment window runs out. Use the chat to coordinate.")]),M([Ff("If you abort the trade, or do not confirm payment before this time is up, "),v(b),Ff(" (1/4 of the "),u("burnable deposit"),Ff(") will be "),u("burned"),Ff(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Ff(" to the Seller, "),v(C),Ff(" to you).")]),M([Ff("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),Ff(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([Ff("Work and communicate with the Buyer to receive "),v(p),Ff(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([Ff("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),Ff(" (1/4 of the "),u("burnable deposit"),Ff(") will be "),u("burned"),Ff(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Ff(" to you, "),v(C),Ff(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([Ff("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),Ff(" will be released to you.")]),M([Ff("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),Ff(" In this case the "),v(a),Ff(" will be lost to both parties.")]),M([Ff("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([Ff("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([Ff("So, have you recieved the "),v(p),Ff("? If so, you can click "),v("Release Everything"),Ff(".")]),M([Ff("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),Ff(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([Ff("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([Ff("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([Ff("The Seller has deposited "),v(i),Ff(" into this contract, and offers to sell it for "),v(p),Ff(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),Ff(" into this contract by clicking "),u("Deposit and Commit to Trade"),Ff(".")]),M([Ff("If the trade is successful, the combined "+pR(r.factory)+" balance "),v("("+a+")"),Ff(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,Ff(" for both parties (see Payment Window for more on this).")]),M([Ff("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),Ff(" within the payment window.")])])):f(xa,h,M([M([Ff("The Buyer is offering to buy "),v(i),Ff(" for "),v(p),Ff(", and has deposited "),v(y),Ff(" into this contract as a "),u("burnable deposit"),Ff(". To become the Seller, deposit "),v(i),Ff(" into this contract by clicking "),u("Deposit and Commit to Trade"),Ff(".")]),M([Ff("When you receive the "),v(p),Ff(" from the Buyer, the combined "+pR(r.factory)+" balance "),v("("+a+")"),Ff(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,Ff(" for both parties (see Payment Window for more on this).")]),M([Ff("Don't commit unless you can receive "),v(p),Ff(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([Ff("During this phase, the Buyer is expected to transfer "),v(p),Ff(" to the Seller, as described in Fiat Payment Method, "),f(Tk,M([Qk]),Ff("and ")),u("Confirm the Payment "),Ff(" before the payment window runs out. This would move the trade to the final phase.")]),M([Ff("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),Ff(" (1/4 of the "),u("burnable deposit"),Ff(" amount) will be "),u("burned"),Ff(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),Ff(" to the Seller, "),v(C),Ff(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([Ff("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([Ff("If the Seller can verify he has received the "),v(p),Ff(", he will probably release the total balance of "),v(i),Ff(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),Ff(".")]),M([Ff("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),Ff(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(bN,M([rT(Ik),XS(Ik),KN(20),cN(30)]),M([f(SN,M([rT(Ik)]),M([f(Tk,M([eN(24),Qk,eA(g),v_]),Ff(T))])),f(bN,M([rT(Ik),ON,cN(13)]),w),f(Tk,M([vN]),function(){switch(f(ZM,r,e).$){case"Active":return l(JM,t,r,n);case"NotStarted":return f(Tk,M([eN(20),Qk,GD,eA(aR)]),Ff("Phase not yet started."));default:return f(Tk,M([eN(20),Qk,GD]),Ff("Phase no longer active."))}}())]))}),nF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},aF=qN({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),iF=qN({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),oF={$:"None"},uF=oF,sF=qN({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),cF=function(e){switch(e.$){case"Open":return sF;case"Committed":return aF;case"Judgment":return iF;default:return uF}},fF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),lF=a(function(e,t,r,n){return d(fF,e,t,r,n)}),dF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},hF=function(e){return function(e){return d(lF,e.red,e.green,e.blue,e.alpha)}(dF(e))},pF=function(e){return{$:"Circle",a:e}},gF=pF,vF=d(fF,0,0,0,1),yF={$:"Flat"},mF={$:"Sharp"},bF=function(e){return{$:"Uniform",a:e}},CF=bF,EF={cap:yF,dashPattern:yr,dashPhase:0,fill:CF(vF),join:mF,thickness:2},SF=n(function(e,t,r){return D(EF,{dashPattern:e,fill:r,thickness:t})}),TF=SF(yr),wF={$:"Transparent"},IF=wF,AF=f(TF,0,IF),BF=r(function(e,t){return{$:"Shape",a:e,b:t}}),kF=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},NF=function(e){return f(Da,kF,BF(e))},RF=function(e){return NF(L(e,AF))},$F=function(e){return L(-e.a,-e.b)},_F=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),LF=r(function(e,t){return f(_F,$F(e(t)),t)}),xF=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},PF=r(function(e,t){return{$:"Path",a:e,b:t}}),DF=kr,UF=Nr,OF=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=UF(n),i=DF(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},MF=function(e){return xa(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)})},FF=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(MF,e,M([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),VF=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},KF=function(e){var t=HF(e.basic),r=xF(f(xa,OF(e),t)),n=r.a,a=r.b;return{toBottom:-f(hc,0,Jw(a)),toLeft:-f(hc,0,Jw(n)),toRight:f(hc,0,Ww(n)),toTop:f(hc,0,Ww(a))}},HF=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(FF,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(FF,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(FF,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(MF,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(PF,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(MF,R(C,yF)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(FF,0,E);case"Group":var S=e.a;return f(MF,0,$v(f(xa,f(Io,KF,VF),S)));default:var T=e.b;return f(MF,0,VF(KF(T)))}},jF=function(e){var t=KF(e);return t.toTop+t.toBottom},qF=function(e){var t=KF(e);return L(-t.toLeft,t.toTop)},GF=function(e){var t=KF(e);return t.toLeft+t.toRight},zF=En("http://www.w3.org/2000/svg"),YF=zF("svg"),WF=Nn("height"),JF=Nn("version"),QF=Nn("width"),XF=zF("circle"),ZF=zF("ellipse"),eV=zF("foreignObject"),tV=zF("g"),rV=zF("image"),nV=zF("polygon"),aV=zF("polyline"),iV=zF("rect"),oV=aw,uV=zF("text"),sV=Nn("id"),cV=Nn("points"),fV=Nn("r"),lV=Nn("rx"),dV=Nn("ry"),hV=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},pV=function(e){return{$:"Group",a:e}},gV=Nn("dominant-baseline"),vV=Nn("fill"),yV=Nn("fill-opacity"),mV=Nn("font-family"),bV=Nn("font-size"),CV=Nn("font-style"),EV=Nn("font-variant"),SV=Nn("font-weight"),TV=Nn("opacity"),wV=Nn("stroke"),IV=Nn("stroke-dasharray"),AV=Nn("stroke-dashoffset"),BV=Nn("stroke-linecap"),kV=Nn("stroke-linejoin"),NV=Nn("stroke-opacity"),RV=Nn("stroke-width"),$V=Nn("text-anchor"),_V=Nn("text-decoration"),LV=Nn("transform"),xV=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},PV=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},DV=n(function(e,t,r){return d(fF,e,t,r,1)}),UV=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return Fg(1e4*e)/100};return Ql(M(["rgba(",ZT(i(t)),"%,",ZT(i(r)),"%,",ZT(i(n)),"%,",ZT(function(e){return Fg(1e3*e)/1e3}(a)),")"]))},OV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},MV=function(e){var t=OV(e),r=t.red,n=t.green,a=t.blue;return UV(l(DV,r,n,a))},FV=function(e){if("Uniform"===e.$){var t=e.a;return MV(t)}return"none"},VV=function(e){var t=OV(e),r=t.alpha;return ZT(r)},KV=function(e){if("Uniform"===e.$){var t=e.a;return VV(t)}return"0"},HV=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},jV=Br,qV=function(e){var t=ZT(e.scale.b),r=ZT(e.scale.a),n=ZT(-e.rotation/2/jV*360),a=ZT(-e.shift.b),i=ZT(e.shift.a);return Ql(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},GV=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([wV(FV(r.fill)),NV(KV(r.fill)),RV(ZT(r.thickness)),BV(xV(r.cap)),kV(HV(r.join)),vV("none"),TV(ZT(e.opacity)),LV(qV(e)),AV(Ni(r.dashPhase)),IV(PV(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([vV(FV(a)),yV(KV(a)),wV(FV(r.fill)),NV(KV(r.fill)),RV(ZT(r.thickness)),BV(xV(r.cap)),kV(HV(r.join)),TV(ZT(e.opacity)),LV(qV(e)),AV(Ni(r.dashPhase)),IV(PV(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([vV(FV(bF(o.color))),mV(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),bV(Ni(o.size)),SV(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"}}()),CV(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),EV(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),_V(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),$V("middle"),gV("middle"),LV(qV(e))]);default:return M([LV(qV(e))])}},zV=Nn("x"),YV=Nn("y"),WV=r(function(e,t){return M([QF(ZT(e)),WF(ZT(t)),zV(ZT(-e/2)),YV(ZT(-t/2))])}),JV=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([ZT(t),ZT(-r)]))},e))},QV=zk,XV=r(function(e,t){return f(e,t.a,t.b)}),ZV=function(e){return f(xa,XV(QV),e)},eK=function(e){e:for(;;){var t=f(hc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(aV,U(M([sV(t),cV(JV(i))]),U(GV(e),ZV(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(nV,U(M([sV(t),cV(JV(i))]),U(GV(e),ZV(e.handlers))),yr);case"Circle":var c=s.a;return f(XF,U(M([sV(t),fV(ZT(c))]),U(GV(e),ZV(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(ZF,U(M([sV(t),lV(ZT(d)),dV(ZT(h))]),U(GV(e),ZV(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(iV,U(M([sV(t),lV(ZT(c)),dV(ZT(c))]),U(f(WV,p,g),U(GV(e),ZV(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(PF,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(uV,U(M([sV(t)]),U(GV(e),ZV(e.handlers))),M([oV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(rV,U(M([sV(t),hV(C)]),U(f(WV,p,g),U(GV(e),ZV(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(eV,U(M([sV(t)]),U(f(WV,p,g),U(GV(e),ZV(e.handlers)))),M([S]));case"Group":var T=n.a;return f(tV,f(ka,sV(t),U(GV(e),ZV(e.handlers))),l(Ra,r(function(e,t){return f(ka,eK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:pV(M([w,I]))});e=v;continue e}}},tK=r(function(e,t){var r=e.a,n=e.b,a=ZT(r),i=ZT(n);return f(IT,yr,M([f(YF,M([QF(a),WF(i),JF("1.1")]),M([eK(t)]))]))}),rK=function(e){return f(tK,L(GF(e),jF(e)),f(LF,qF,e))},nK=r(function(e,t){var r=cF(e),n=function(){switch(t.$){case"NotStarted":return l(bk,10,33,108);case"Active":return l(bk,0,100,170);default:return l(bk,1,129,104)}}(),a=AL(rK(f(RF,CF(hF(n)),gF(50))));return f(Tk,M([iN,w$(f(JN,M([iN,ON,XS(kk(60))]),r))]),a)}),aK=function(e){var t=M([GD,Qk,eN(20)]);switch(e.$){case"Active":return f(Tk,U(t,M([eA(rN)])),Ff("Active"));case"NotStarted":return f(Tk,U(t,M([eA(aR)])),Ff("Not Started"));default:return f(Tk,t,Ff("Finished"))}},iK=n(function(e,t,r){var n=f(ZM,t,e),a=function(){return"Active"===n.$?l(bk,0,226,255):ER}(),i=f(Tk,M([eA(a),eN(20),Qk,iN]),Ff(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 Ak;switch(n.$){case"NotStarted":return d(UR,M([iN]),M([eN(22),ZN]),L(ER,fR),f(yR,e,t));case"Active":var a=f(bR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(jR,M([iN]),M([eN(22),ZN]),L(Dk,fR),i)}return f(bN,M([iN,cN(10)]),M([f(Tk,M([iN]),Ff(nF(e))),f(dO,"Poke",yE(pE))]));default:return f(Tk,M([XS(kk(1))]),Ak)}}();return f(bN,M([KN(20),cN(10),XS(Ik)]),M([f(Tk,M([S$,iN]),i),f(Tk,M([XS(Ik),iN]),f(Tk,M([ON]),f(nK,e,n))),f(bN,M([cN(10),a_,iN]),M([f(Tk,M([iN]),aK(n)),o]))]))}),oK=o(function(e,t,r,n,a,i){var o=f(ZM,r,t),u=f(Tk,M([KN(10),rT(Ik),XS(Ik)]),d(rF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return ml(0)}}(),c=l(iK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(mR,f(Ym,r.state.phaseStartTime,s),i);default:ml(0)}}(),f(Tk,M([XS(Ik),rT(kk(1)),Rk(function(){return"Active"===o.$?l(WI,0,0,1):fR}())]),Ak)),p=a?f(SN,U(KM(e),U(R(o,UM)?MM:HM,M([rT(Ik)]))),M([c,h,u])):f(SN,U(KM(e),U(R(o,UM)?MM:HM,M([Kk,Wk(OM(t))]))),M([c]));return!e&&R(o,UM)?f(bN,M([rT(Ik),cN(20),BN({bottom:20,left:0,right:0,top:0})]),M([p,DM(r.terms.paymentMethods)])):p}),uK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(SN,M([iN,jk(12),KN(30),cN(10),Rk(_M),eN(24),Qk,eA(Dk)]),M([Ff("Trade "+PM(t.state.closedReason)),xM])):e?f(bN,M([rT(Ik),cN(10)]),M([f(SN,M([rT(Ik),XS(eT),cN(20)]),M([p(oK,e,jg,t,n,R(r,jg),a),p(oK,e,Rb,t,n,R(r,Rb),a),p(oK,e,$b,t,n,R(r,$b),a)])),DM(t.terms.paymentMethods)])):f(bN,M([rT(Ik),XS(eT),cN(20)]),M([p(oK,e,jg,t,n,R(r,jg),a),p(oK,e,Rb,t,n,R(r,Rb),a),p(oK,e,$b,t,n,R(r,$b),a)]))}),sK=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(bN,M([rT(Ik),XS(Ik),cN(40)]),M([h($M,t,i,n.wallet,r,n.showStatsModal),f(Tk,M([rT(Ik),f(Mk,40,0),cN(40)]),h(uK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Tk,M([iN,ON,eN(30)]),Ff("Loading trade info..."));default:return f(Tk,M([iN,ON,eN(30)]),Ff("Invalid trade"))}}(),M([qU(n),JU(n)]))}),cK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),fK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(zD,yr);case"CreateModel":var n=r.a;return L(f(Yi,fy,DD(n)),yr);case"TradeModel":var a=r.a;return l(cK,Yi(hy),xa(Yi(hy)),d(sK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,qS,l(wU,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,VS,l(c$,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Tk,M([rT(Ik),XS(Ik),jk(10)]),n),a)}),lK=function(e){return{$:"DismissNotice",a:e}},dK=function(e){return f(L$,iU,oU(e))},hK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(WI,1,1,1):l(WI,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(bk,100,200,255);case"Caution":return l(bk,255,188,0);case"Error":return l(bk,255,70,70);default:return l(bk,200,200,200)}}(),o=f(Tk,M([vN,S$,x$(5),dK(5)]),v$(lK(t)));return f(Tk,M([Rk(i),jk(10),KN(8),rT(Ik),XR(1),JR(d(wN,0,0,0,.15)),aD]),f(bN,M([cN(4),rT(Ik)]),f(Bi,r(function(e,t){return f(dN,M([rT(Ik),eA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},pK=function(e){return R(e,yr)?yr:M([f(bN,M([uU(20),x$(20),cN(10),vN,a_,rT(kk(300)),eN(15)]),f(xa,hK,f(Yf,function(e){return R(e.b.align,Uf)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(bN,M([dK(20),fL(100),cN(10),v_,S$,rT(kk(300)),eN(15)]),f(xa,hK,f(Yf,function(e){return R(e.b.align,tB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},gK=r(function(e,t){var r=f(fK,e,t),n=r.a,a=r.b;return L(f(bN,M([FR($k),w$(TN(t)),rT(Ik),XS(Ik),KN(30)]),M([f(Tk,M([XS(kk(50))]),Ak),n])),U(a,pK(t.userNotices)))}),vK=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),yK=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),mK={$:"AllowHover"},bK={$:"Layout"},CK={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(YI,155/255,203/255,1,1),offset:L(0,0),size:3})},EK=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?CK:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?mK:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?bK:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},SK=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(uT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),uT);case"Text":var a=t.a;return dI(a);default:return dI("")}}),TK=n(function(e,t,r){var n=EK(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?vK(n):yK(n)}();return f(SK,a,d(qI,uT,Sk,t,iT(M([r]))))}),wK=xT(5),IK=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),AK={$:"SansSerif"},BK=function(e){return{$:"Typeface",a:e}},kK=Y,NK=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",kK(Ml(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",kK(Ml(t)));default:var t=e.a.name;return f(Ri,"-",kK(Ml(t)))}}())}),RK=function(){var e=M([BK("Open Sans"),BK("Helvetica"),BK("Verdana"),AK]);return M([f(XI,Nk,l(QI,"bg-color-"+ZI(d(YI,1,1,1,0)),"background-color",d(YI,1,1,1,0))),f(XI,JI,l(QI,"font-color-"+ZI(d(YI,0,0,0,1)),"color",d(YI,0,0,0,1))),f(XI,Xk,Zk(20)),f(XI,wK,f(IK,l(Ra,NK,"font-",e),e))])}(),$K=n(function(e,t,r){var n=e.options;return l(TK,n,f(ka,GI(f(Ri," ",M([lT.root,lT.any,lT.single]))),U(RK,t)),r)}),_K=$K({options:yr}),LK=function(e){return f(XI,wK,f(IK,l(Ra,NK,"ff-",e),e))},xK=AK,PK=BK,DK=function(e){return{body:M([function(){var t=f(gK,e.screenWidth,e),r=t.a,n=t.b,a=U(M([rT(Ik),XS(Ik),LK(M([PK("Soleil"),xK]))]),f(xa,w$,n));return f(_K,a,r)}()]),title:"DAIHard"}},UK=Ht,OK=UK({init:bB,onUrlChange:mk,onUrlRequest:yk,subscriptions:vk,update:HA,view:DK});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:OK(f(qo,function(e){return f(qo,function(t){return f(qo,function(r){return Fi({height:r,networkId:t,width:e})},f(gh,"height",BC))},f(gh,"networkId",BC))},f(gh,"width",BC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file +var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(pp,o,function(e){return si(gp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(yp,e,L(r,Tp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(yp,e,L(r,Sp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=Xg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?Fg(o):Mg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return Xg(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Vg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Hg,Kg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(Ko,xa(Zs),f(Ko,xs,Xs))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ch,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ch,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ep)}),i.addEventListener("timeout",function(){a(wp)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),gp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(bp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Hg,Kg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Hg,Kg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Hg,Kg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co={$:"Buyer"},fo={$:"Seller"},lo=r(function(e,t){return{label:e,options:t}}),ho=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),po=r(function(e,t){return f(lo,"Offer Type",M([l(ho,"Buying",e,function(e){return R(e.parameters.initiatorRole,co)}),l(ho,"Selling",t,function(e){return R(e.parameters.initiatorRole,fo)})]))}),go={$:"Closed"},vo={$:"Committed"},yo={$:"Judgment"},mo={$:"Open"},bo=a(function(e,t,r,n){return f(lo,"Phase",M([l(ho,"Open",e,function(e){return R(e.state.phase,mo)}),l(ho,"Committed",t,function(e){return R(e.state.phase,vo)}),l(ho,"Judgment",r,function(e){return R(e.state.phase,yo)}),l(ho,"Closed",n,function(e){return R(e.state.phase,go)})]))}),Co={$:"Initiator"},Eo={$:"Responder"},So=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),To=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(Co):f(So,function(e){return R(t,e)?si(Eo):ci},e.state.responder)}),wo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),Io=r(function(e,t){return f(wo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return co}if("Seller"===r.b.$){r.a,r.b;return co}r.a,r.b;return fo},f(To,e,t))}),Ao=n(function(e,t,r){return f(lo,"Role",M([l(ho,"Buyer",t,function(t){return R(f(Io,t,e),si(co))}),l(ho,"Seller",r,function(t){return R(f(Io,t,e),si(fo))})]))}),Bo=r(function(e,t){return{filtersModel:t,orderBy:e}}),ko=Bo,No={$:"Ascending"},Ro={$:"Phase"},$o=Oe,_o=$o(yr),Lo=r(function(e,t){return L({agentAddress:t,tradeTable:f(ko,L(Ro,No),M([d(bo,!0,!0,!0,!1),f(po,!0,!0),l(Ao,t,!0,!0)])),wallet:e},_o)}),xo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Po={$:"None"},Do=Po,Uo=function(e){return d(xo,e,_o,Do,yr)},Oo=function(e){return{$:"TradeTableMsg",a:e}},Mo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),Fo=r(function(e,t){return f(Mo,e,t)}),Vo=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Ko=n(function(e,t,r){return t(e(r))}),Ho=r(function(e,t){if("None"===t.$)return Po;var r=t.a,n=t.b,a=l(Vo,f(wo,Da(e),r.onSign),f(wo,Da(e),r.onBroadcast),f(wo,function(t){var r=t.a,n=t.b;return L(f(Ko,r,e),f(wo,function(t){return{confirmations:t.confirmations,toMsg:f(Ko,t.toMsg,e)}},n))},r.onMined));return f(Mo,a,n)}),jo=function(e){return{$:"AbiDecoder",a:e}},qo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Go=z,zo=Fr,Yo=r(function(e,t){return e<1?t:l(zo,e,Go(t),t)}),Wo=Yo(64),Jo=n(function(e,t,r){return L(f(qo,e,Wo(t)),r)}),Qo=r(function(e,t){return e<1?"":l(zo,0,e,t)}),Xo=Qo(64),Zo=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),eu=function(e){return-e},tu=r(function(e,t){return e<1?"":l(zo,-e,Go(t),t)}),ru=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(Qo,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(tu,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return jo(function(t){var r=t.a,n=t.b;return f(Zo,f(Jo,r,n),e(Xo(n)))})}(),nu=Hr,au=function(e){return f(nu,"0x",e)||f(nu,"0X",e)?f(Yo,2,e):e},iu=function(e){return e.b},ou=r(function(e,t){var r=e.a;return f(Zo,iu,r(function(e){return f(qo,e,e)}(au(t))))}),uu=Xr,su=ae,cu=Wr,fu=function(e){return f(uu,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return su(a)},cu)},lu=f(Ko,ou,fu),du=function(e){return{$:"Magnitude",a:e}},hu=function(e){return{$:"Pos",a:e}},pu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),gu=function(e){return{$:"MagnitudeNotNormalised",a:e}},vu=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 si(n)}return ci}},yu=function(e){var t=vu(e);return"Nothing"!==t.$&&t.a<0},mu=function(e){return{$:"Neg",a:e}},bu={$:"Zer"},Cu=function(e){return!e.b},Eu=r(function(e,t){var r=t.a;if(Cu(r))return bu;switch(e.$){case"Zero":return bu;case"Positive":return hu(t);default:return mu(t)}}),Su=r(function(e,t){return f(pu,e,gu(t))}),Tu=function(e){return f(La,r(function(t,r){return e(t)&&Cu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),wu=Ir,Iu=-1+f(wu,10,7),Au=Iu+1,Bu=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),ku=function(e){return e<0?f(Bu,Na(-1),ku(e+Au)):L(e/Au|0,e%Au)},Nu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=ku(r+e),i=a.a,o=a.b;return f(ka,o,f(Nu,i,n))}{if(!(_(e,Au)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Ru=function(e){var t=e.a;return du(Tu(f(Nu,0,t)))},$u=xa(eu),_u={$:"Negative"},Lu={$:"Positive"},xu={$:"Zero"},Pu=function(e){switch(e.$){case"Positive":return _u;case"Negative":return Lu;default:return xu}},Du=function(e){for(;;){var t=e.a,r=e.b,n=Ru(r),a=n.a;if(!yu(a))return f(Eu,t,du(a));e=f(Su,Pu(t),$u(a))}},Uu=pr,Ou=function(e){switch(f(Uu,e,0).$){case"LT":return _u;case"GT":return Lu;default:return xu}},Mu=function(e){return e<0?-e:e},Fu=function(e){return Du(f(pu,Ou(e),gu(M([Mu(e)]))))},Vu=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(wu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},Ku=function(e){switch(e.$){case"Zer":return bu;case"Neg":var t=e.a;return hu(t);default:return e}},Hu=function(e){return{$:"MagnitudePair",a:e}},ju=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(ka,L(a,u),f(ju,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(ju,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(ju,yr,s))}return yr}),qu=r(function(e,t){var r=e.a,n=t.a;return Hu(f(ju,r,n))}),Gu=function(e){switch(e.$){case"Zer":return f(Su,xu,yr);case"Neg":var t=e.a.a;return f(Su,Lu,$u(t));default:var t=e.a.a;return f(Su,Lu,t)}},zu=r(function(e,t){var r=Gu(t),n=r.b,a=Gu(e),i=a.b,o=f(qu,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Du(f(pu,Lu,gu(s)))}),Yu=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(R(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 Ta}return a.b.b?ba:f(Uu,e,t)}}),Wu=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},Ju=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(Yu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Wu(d(Yu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),Qu=r(function(e,t){return R(f(Ju,e,t),Ta)}),Xu=K,Zu=r(function(e,t){return!f(Qu,e,t)}),es=function(e){switch(e.$){case"Zer":return du(yr);case"Pos":default:var t=e.a;return t}},ts=r(function(e,t){var r=e.a;return Ru(gu(f(xa,ti(t),r)))}),rs=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(ts,du(n),a),u=f(rs,du(i),du(n)),s=u.a,c=f(zu,f(Eu,Lu,o),f(Eu,Lu,du(f(ka,0,s))));return es(c)}var a=r.a;return f(ts,du(n),a)}return du(yr)}),ns=function(e){switch(e.$){case"Zer":return xu;case"Pos":return Lu;default:return _u}},as=r(function(e,t){return R(e,xu)||R(t,xu)?xu:R(e,t)?Lu:_u}),is=r(function(e,t){return f(Eu,f(as,ns(e),ns(t)),f(rs,es(e),es(t)))}),os=function(e){switch(e.$){case"Zer":return bu;case"Pos":var t=e.a;return mu(t);default:var t=e.a;return hu(t)}},us=r(function(e,t){return f(zu,e,os(t))}),ss=Fu(0),cs=a(function(e,t,r,n){if(e){var a=Fu(e),i=f(is,f(is,a,n),t),o=f(Zu,i,r)?L(f(is,a,t),f(us,r,i)):L(ss,r),u=o.a,s=o.b,c=d(cs,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(zu,u,l),h)}return L(ss,r)}),fs=Fa(f(Va,2,Iu)),ls=n(function(e,t,r){return d(cs,f(wu,2,fs),e,t,r)}),ds=Fu(1),hs=r(function(e,t){return e}),ps=n(function(e,t,r){return l(Ra,hs(e),t,f(Ai,1,r))}),gs=function(e){return l(ps,is(Fu(Au)),ds,e)},vs=n(function(e,t,r){if(e){var n=l(ls,gs(e),t,r),a=n.a,i=n.b,o=l(vs,e-1,i,r),u=o.a,s=o.b;return L(f(zu,a,u),s)}return l(ls,gs(e),t,r)}),ys=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},ms=r(function(e,t){if(R(t,ss))return ci;var r=Ti(ys(e))-Ti(ys(t))+1,n=l(vs,f(ei,0,r),Ku(e),Ku(t)),a=n.a,i=n.b;return si(L(f(Eu,f(as,ns(e),ns(t)),es(a)),f(Eu,ns(e),es(i))))}),bs=f(is,Fu(2),Fu(2147483648)),Cs=xr,Es=function(e){return f(Cs,e,"")},Ss=Pn,Ts=n(function(e,t,r){return e<=0?r:l(Ts,e>>1,U(t,t),1&e?U(r,t):r)}),ws=r(function(e,t){return l(Ts,e,t,"")}),Is=n(function(e,t,r){return U(f(ws,e-Go(r),Es(t)),r)}),As=te,Bs=Ar,ks=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},Ns=r(function(e,t){for(;;){if(t<16)return f(ka,ks(t),e);var r=f(ka,ks(f(Bs,16,t)),e),n=t/16|0;e=r,t=n}}),Rs=function(e){return As(e<0?f(ka,P("-"),f(Ns,yr,-e)):f(Ns,yr,e))},$s=function(e){var t=f(ms,e,bs);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=Rs(Vu(a));return R(n,Fu(0))?i:U($s(n),l(Is,8,P("0"),i))},_s=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,du(yr))?"0":$s(hu(t));default:var t=e.a;return"-"+_s(f(is,Fu(-1),e))}},Ls=function(e){return l(Is,64,P("0"),e)},xs=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=Ls(Rs(a)),c=function(e){return U(e,n)}(Ls(Rs(u)));return x(a+32+(Go(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Ps=Dr,Ds=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))))}),Us=n(function(e,t,n){return l(Ps,r(function(t,r){return l(Ds,e,yi(t),r)}),t,n)}),Os=function(e){return $a(l(Us,ka,yr,e))},Ms=function(e){return f(Ri,"",f(xa,f(Ko,Rs,f(Is,2,P("0"))),Os(e)))},Fs=function(e){return 64-f(Bs,64,e)},Vs=function(e){return U(e,f(ws,Fs(Go(e)),"0"))},Ks=function(e){return L(si(Go(e)/2|0),Vs(e))},Hs=function(e){return L(ci,Ls(e))},js=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},qs=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"}},Gs=Ur,zs=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(Cs,P("1"),r),!0);case"1":return L(f(Cs,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Cs,P("0"),r),!1);case"1":return L(f(Cs,P("1"),r),!0);default:break e}return L(r,!0)});return l(Gs,t,L("",!1),e).a},Ys=function(e){return l(Gs,ka,yr,e)},Ws=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Yo,e,t),i=f(ka,l(zo,0,e,t),r);e=n,t=a,r=i}}),Js=r(function(e,t){return e&&""!==t?l(Ws,e,t,yr):M([t])}),Qs=function(e){var t=function(){var t=Ys(_s(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(Ko,zs,f(Is,256,P("1"))))}var r=t;return L(r,f(Is,256,P("0")))}(),r=t.a,n=t.b;return As(f(xa,js,f(Js,4,n(f(Ri,"",f(xa,qs,r))))))},Xs=function(e){return{$:"Hex",a:e}},Zs=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Hs(t);case"UintE":var r=e.a;return Hs(_s(r));case"IntE":var n=e.a;return Hs(Qs(n));case"BoolE":return Hs(e.a?"1":"0");case"DBytesE":var a=e.a.a;return Ks(a);case"BytesE":var a=e.a.a;return Hs(au(a));case"StringE":var i=e.a;return Ks(Ms(i));case"ListE":var o=e.a;return function(e){var t=e.a;return Ks(t)}(Xt()(o));default:var i=e.a;return Hs(au(i))}};try{var ec=Xt();Xt=function(){return ec}}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 tc=Pr,rc=function(e){return 1===Go(e)?f(tc,"0",e):e},nc=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(ka,n,r);e=i,t=o,r=u}}}),ac=r(function(e,t){return $a(l(nc,e,t,yr))}),ic=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(ac,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(ic,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),oc=r(function(e,t){return l(ic,0,e,t)}),uc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),sc=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 Pt(e.a)}},cc={$:"LE"},fc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,cc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,cc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,cc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,cc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,cc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,cc));case"Seq":var i=e.b;return l(lc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),lc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(fc,n,t,r);e=i,t=o,r=u}}),dc=Dt,hc=r(function(e,t){return{$:"Seq",a:e,b:t}}),pc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+sc(r),i=n;e=a,t=i}}),gc=function(e){return f(hc,f(pc,0,e),e)},vc=function(e){return{$:"U8",a:e}},yc=vc,mc=r(function(e,t){return _(e,t)<0?e:t}),bc=hr,Cc=function(e){return{$:"Bytes",a:e}},Ec=Cc,Sc=function(e){return dc(gc(f(xa,Ec,$a(e))))},Tc=Pt,wc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Ic=function(e){return{$:"Decoder",a:e}},Ac=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}}),Bc=r(function(e,t){return Ic(f(Ac,e,t))}),kc=Ic(Yn),Nc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Rc=function(e){return{$:"Done",a:e}},$c=function(e){return{$:"Loop",a:e}},_c=r(function(e,t){var n=t.a;return Ic(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),Lc=function(e){return Ic(r(function(t,r){return L(r,e)}))},xc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Lc(Rc($a(n))):f(_c,function(e){return $c(L(r-1,f(ka,e,n)))},e)}),Pc=function(e){return f(Nc,yr,f(wc,f(Bc,L(Tc(e),yr),xc(kc)),e))},Dc=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))}),Uc=r(function(e,t){return l(Dc,Ss,e,t)}),Oc=f(Ai,0,4),Mc=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}}),Fc=xt,Vc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),Kc=function(e){return f(Vc,f(Ko,Fc,Ss(4294967295)),e)},Hc=r(function(e,t){return 5*t+e}),jc=4294967295>>>32-Ha,qc=ar,Gc=n(function(e,t,r){for(;;){var n=jc&t>>>e,a=f(qc,n,r);if("SubTree"!==a.$){var i=a.a;return f(qc,jc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),zc=function(e){return e>>>5<<5},Yc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,zc(r))>-1?f(qc,jc&e,i):l(Gc,n,e,a))}),Wc=r(function(e,t){var r=f(Yc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),Jc=n(function(e,t,r){var n=f(Hc,e,t);return f(Wc,n,r)}),Qc=ir,Xc=a(function(e,t,r,n){var a=jc&t>>>e,i=f(qc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Xc,e-Ha,t,r,o);return l(Qc,a,za(u),n)}var s=i.a,c=l(Qc,jc&t,r,s);return l(Qc,a,Ga(c),n)}),Zc=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,zc(n))>-1?d(Ma,n,a,i,l(Qc,jc&e,t,o)):d(Ma,n,a,d(Xc,a,e,t,i),o)}),ef=n(function(e,t,r){return l(Zc,e,t,r)}),tf=a(function(e,t,r,n){var a=f(Hc,e,t);return l(ef,a,r,n)}),rf=Dn,nf=r(function(e,t){return l(Dc,rf,e,t)}),af=function(e){var t=l(La,r(function(t,n){var a={d0:l(Jc,0,t,e.state),d1:l(Jc,1,t,e.state),d2:l(Jc,2,t,e.state),d3:l(Jc,3,t,e.state),d4:l(Jc,4,t,e.state)},i=r(function(e,r){return d(tf,e,t,f(nf,f(Mc,e,a),f(Uc,Kc(f(Mc,f(Bs,5,e+1),a)),f(Mc,f(Bs,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Oc);return D(e,{state:t})},of=L(0,0),uf=function(e){return{current:of,lfsrstate:1,state:e,x:1,y:0}},sf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},cf=L(1,0),ff=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),lf=r(function(e,t){if(e){var n=f(ff,1,t);return l(Dc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),df=r(function(e,t){var r=f(Bs,32,e/32|0),n=f(ff,r,t),a=f(Bs,32,e);return f(lf,a,n)}),hf=n(function(e,t,r){var n=f(Yc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(Zc,e,t(a),r)}),pf=n(function(e,t,r){return l(hf,e,nf(t),r)}),gf=a(function(e,t,r,n){var a=f(Hc,e,t);return l(pf,a,r,n)}),vf=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),wf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(mc,n,r),i=f(xa,function(e){return f(Tf,e,g)},f(Ai,0,a)),o=Sf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(oc,i.outputLen,l(v,g,yr,i.outputLen))},kf=function(e){return{$:"KS",a:e}},Nf=function(e){var t=e.a;return kf({config:t,inputLength:0,partial:yr,state:f(ui,25,hs(of))})},Rf=function(e){return Ic(Wn(e))},$f=dc(gc(yr)),_f=r(function(e,t){var n=t.a;return Ic(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),Lf=r(function(e,t){return f(_f,function(e){return Rf(t)},Rf(e))}),xf=r(function(e,t){return f(Nc,$f,f(wc,f(Lf,e,Tc(t)-e),t))}),Pf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=Tc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+Tc(e)}),0,i),a)>-1))return kf(D(n,{inputLength:Tc(e)+n.inputLength,partial:i}));var o=Sc(i),u=f(Nc,$f,f(wc,Rf(a),o)),s=Pc(u),c=f(Af,s,n.state),d=Sf(c),h=f(xf,a,o),p=$f,g=kf(D(n,{inputLength:Tc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Df=r(function(e,t){return Bf(f(Pf,dc(gc(f(xa,yc,t))),Nf(e)))}),Uf=Df(uc),Of=function(e){return Xs(f(Ri,"",f(xa,f(Ko,Rs,rc),f(oc,4,Uf(f(xa,yi,Ys(e)))))))},Mf=function(e){return f(nu,"0x",e)||f(nu,"0X",e)?e:"0x"+e},Ff=function(e){var t=e.a;return Mf(t)},Vf=r(function(e,t){var r=xs(f(xa,Zs,t)),n=function(e){return U(e,r)}(au(Ff(Of(e))));return Xs(n)}),Kf=function(e){return{data:si(f(Vf,"poke()",yr)),decoder:lu(ru),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Hf=r(function(e,t){return{$:"Trade",a:e,b:t}}),jf=r(function(e,t){return D(t,{checked:e})}),qf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Gf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(qf,f(Ko,function(e){return e.label},Ja(r)),function(e){return D(e,{options:l(qf,f(Ko,function(e){return e.label},Ja(n)),jf(a),e.options)})},t)}),zf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Yf={$:"Descending"},Wf=function(e){return"Ascending"===e.$?Yf:No},Jf=function(e){return d(zf,e,_o,Do,yr)},Qf=r(function(e,t){return L(t.a,e(t.b))}),Xf=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(zf,t,_o,Do,M([da(f(Hf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(Qf,Wf,t.orderBy):L(a,No);return Jf(D(t,{orderBy:i}));case"FiltersMsg":var o=e.a;return Jf(D(t,{filtersModel:f(Gf,o,t.filtersModel)}));default:return Jf(t)}}),Zf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},el=yn,tl=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=Zf(Kf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(Fo,a,n);return d(xo,t,_o,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(xo,t,_o,Do,M([da(f(Hf,o,u))]));case"TradeTableMsg":var s=e.a,c=f(Xf,s,t.tradeTable);return d(xo,D(t,{tradeTable:c.model}),f(el,Oo,c.cmd),f(Ho,Oo,c.chainCmd),f(xa,Ji(Oo),c.appCmds));default:return Uo(t)}}),rl={$:"BottomRight"},nl={$:"ShouldBeImpossible"},al=lr,il=function(e){return qi(e)},ol=r(function(e,t){f(al,e,t);return{align:rl,label:"unexpectedError",mainParagraphs:M([M([il(e)])]),noticeType:nl}}),ul=function(e){var t=e.a;return Mf(t)},sl=ye,cl=f(Ko,ul,sl),fl=f(Ko,_s,f(Ko,Mf,sl)),ll=f(Ko,Ff,sl),dl=f(Ko,Rs,f(Ko,Mf,sl)),hl=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),pl=un,gl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},vl=function(e){return gl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(Nc,pl,r))},f(hl,function(e){e.a;return!R(e.b,ci)},e)))},yl=function(e){return vl(M([L("to",f(wo,cl,e.to)),L("from",f(wo,cl,e.from)),L("gas",f(wo,dl,e.gas)),L("gasPrice",f(wo,fl,e.gasPrice)),L("value",f(wo,fl,e.value)),L("data",f(wo,ll,e.data)),L("nonce",f(wo,dl,e.nonce))]))},ml=function(e){return{$:"TxSentry",a:e}},bl=ye,Cl=r(function(e,t){return gl(M([L("ref",bl(e)),L("txParams",t)]))}),El=function(e){return{$:"Signing",a:e}},Sl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:El(e)}}),Tl={$:"Black"},wl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Il={$:"RBEmpty_elm_builtin"},Al={$:"Red"},Bl=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(wl,Al,t,r,h(wl,Tl,c,f,l,d),h(wl,Tl,i,o,u,s))}return h(wl,e,i,o,h(wl,Al,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(wl,Al,c,f,h(wl,Tl,g,v,y,m),h(wl,Tl,t,r,d,a))}return h(wl,e,t,r,n,a)}),kl=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(wl,Al,e,t,Il,Il);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Uu,e,a).$){case"LT":return h(Bl,n,a,i,l(kl,e,t,o),u);case"EQ":return h(wl,n,a,t,o,u);default:return h(Bl,n,a,i,o,l(kl,e,t,u))}}),Nl=n(function(e,t,r){var n=l(kl,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(wl,Tl,a,i,o,u)}return n}),Rl=n(function(e,t,r){var n=e.a,a=yl(r),i=l(Nl,n.ref,f(Sl,r,t),n.txs);return L(ml(D(n,{ref:n.ref+1,txs:i})),f(el,n.tagger,n.outPort(f(Cl,n.ref,a))))}),$l=Rl,_l=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,_o,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l($l,n,i,o))}return x(ci,_o,M([f(ol,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ll=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),xl=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Pl=function(e){return{$:"Posix",a:e}},Dl=Pl,Ul={autoabortInterval:Dl(0),autorecallInterval:Dl(0),autoreleaseInterval:Dl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:fo},Ol=function(e){return{$:"TokenValue",a:e}},Ml=function(e){return e.a},Fl=r(function(e,t){return f(Nc,ss,f(wo,Qa,f(ms,e,t)))}),Vl=r(function(e,t){return Ol(f(Fl,Ml(e),Fu(t)))}),Kl=function(e){return f(Vl,e,12)},Hl=function(e){return f(Vl,e,3)},jl=Ol(Fu(0)),ql=r(function(e,t){var r=jl;return{abortPunishment:Kl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Hl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Gl=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},zl=qr,Yl=function(e){var t=Gl(f(zl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Go(e)-1-r;return L(U(f(Qo,r,e),f(Yo,r+1,e)),n)},Wl=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 yr}}),Jl=function(e){var t=e.a,r=f(Wl,Ja(0),t);return du(r.b?t:yr)},Ql=Z,Xl=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}}}),Zl=n(function(e,t,r){var n=f(Xl,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(oc,e,r),l(Zl,e,t,n)):yr}),ed=r(function(e,t){return l(Zl,e,e,t)}),td=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(wo,ka(a),r)});return f(La,t,si(yr))}(Ua),rd=function(e){return f(wo,f(Da,Jl,du),td(f(xa,f(Ko,$a,f(Ko,As,Ql)),f(ed,7,$a(e)))))},nd=Q,ad=function(e){var t=Ys(nd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(wo,Eu(_u),rd(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(wo,Eu(Lu),rd(r))}return ci;default:var r=t;return f(wo,Eu(Lu),rd(r))}},id=function(e){var t=function(e){return!f(Bs,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(Nc,0,Gl(r)))}},od=function(e){return f(is,e,e)},ud=Fu(2),sd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ds;case"Neg":return bu;default:if(R(r,ds))return f(is,e,t);if(id(r)){var n=e,a=od(t),i=f(Fl,r,ud);e=n,t=a,r=i;continue e}var n=f(is,t,e),a=od(t),i=f(Fl,f(us,r,ds),ud);e=n,t=a,r=i;continue e}}),cd=r(function(e,t){return l(sd,ds,e,t)}),fd=function(e){if(""===e)return ci;var t=Yl(e),r=t.a,n=t.b,a=ad(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(is,o,f(cd,Fu(10),Fu(i)));return si(u)},ld=function(e){return f(wo,Ol,fd(e))},dd=jr,hd=function(e){for(;;){if(f(dd,".",e))return l(zo,0,-1,e);{if(!f(dd,"0",e))return""===e?"0":e;e=l(zo,0,-1,e)}}},pd=f(Da,f(Is,7,P("0")),Ni),gd=function(e){return f(Ri,"",e)},vd=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return gd(f(ka,Ni(n),f(xa,pd,a)))}return"0"},yd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return vd(t);default:var t=e.a;return"-"+vd(t)}},md=r(function(e,t){return e<1?t:l(zo,0,-e,t)}),bd=function(e){var t=l(Is,18,P("0"),yd(e)),r=f(md,18,t)+"."+f(tu,18,t);return function(e){return""===e?"0":e}(hd(r))},Cd=r(function(e,t){var r=bd(t),n=Gl(f(zl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Qo,a+1+e,r):f(Qo,a,r)}),Ed=r(function(e,t){if("Nothing"===e.$)return bd(Ml(t));var r=e.a;return f(Cd,r,Ml(t))}),Sd=ee,Td=function(e){var t=Sd(f(Ed,ci,e));if("Just"===t.$){return t.a}f(al,"Error converting tokenValue to float: string -> float failed",e);return 0},wd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=ld(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return Td(r)<1?fi("Trade amount can't be less than 1."):li(r)},Id=function(e){if(""===e)return fi("You must specify a fiat price.");var t=ad(e);if("Nothing"===t.$){var r=Sd(e);return fi("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 li(n)},Ad=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),Bd=function(e){return""===e},kd=function(e){return Bd(e)?ci:si(e)},Nd=function(e){return f(Ad,"You must specify a fiat type.",kd(e))},Rd=function(e){return""===e?fi("Must specify a payment method."):li(e)},$d=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),_d=g($d,ci,ci,ci,ci,ci,ci,ci),Ld=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},xd=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Pd={$:"Custom"},Dd=r(function(e,t){return{info:t,type_:e}}),Ud=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Od=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),Md=function(e){return e.a},Fd=function(e){return p(Ud,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Dd,Pd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Od,function(e){return D(_d,{daiAmount:si(e)})},wd(e.daiAmount)),f(Od,function(e){return D(_d,{fiatAmount:si(e)})},Id(e.fiatAmount)),f(Od,function(e){return D(_d,{fiatType:si(e)})},Nd(e.fiatType)),f(Od,function(e){return D(_d,{paymentMethod:si(e)})},Rd(e.paymentMethod)),Ld(d(xd,function(e){return Md(e)>0?li(e):fi(D(_d,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return Md(e)>0?li(e):fi(D(_d,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return Md(e)>0?li(e):fi(D(_d,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Vd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},Kd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Hd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},jd=function(e){var t=Fd(e.inputs),r=function(){return R(e.errors,_d)?_d:"Ok"===t.$?_d:t.a}();return D(e,{createParameters:l(Kd,ql,Vd(e.wallet),Hd(t)),errors:r})},qd=r(function(e,t){return jd(D(t,{inputs:e}))}),Gd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),zd=function(e){return d(Gd,f(qd,Ul,{allowance:ci,createParameters:ci,depositAmount:ci,errors:_d,inputs:Ul,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),_o,Do,yr)},Yd=a(function(e,t,r,n){return la(d(Ll,e,t,r,n))}),Wd=function(e){return{$:"Address",a:e}},Jd=f(Ko,au,f(Ko,nd,Wd)),Qd=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Jd("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return Jd("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return Jd("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return Jd("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return Jd("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},Xd=function(e){return Jd("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},Zd=function(e){return{$:"AddressE",a:e}},eh=Zd,th=function(e){return{$:"UintE",a:e}},rh=th,nh=n(function(e,t,r){return{data:si(f(Vf,"approve(address,uint256)",M([eh(t),rh(r)]))),decoder:lu(ru),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ah=function(e){return f(Vl,e,200)},ih=r(function(e,t){return Ol(f(zu,Ml(e),Ml(t)))}),oh=function(e){var t=f(Vl,e.tradeAmount,200);return f(ih,e.pokeReward,f(ih,ah(e.tradeAmount),f(ih,t,function(){return"Buyer"===e.initiatorRole.$?Hl(e.tradeAmount):e.tradeAmount}())))},uh=Mi(ya),sh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ch=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),fh=Xn,lh=Qn,dh=function(e){return f(lh,{caseInsensitive:!1,multiline:!1},e)},hh=Jn,ph=fh(f(Nc,hh,dh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),gh=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}}),vh=r(function(e,t){return!f(gh,f(Da,Xu,e),t)}),yh=vh(Ua),mh=q,bh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ch=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Eh=f(La,Ch(ka),li(yr)),Sh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},Th=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(wu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(wu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(wu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(wu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(wu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(wu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(wu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(wu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(wu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(wu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(wu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(wu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(wu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(wu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(wu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(Es(s)+" is not a valid hexadecimal character.")}}}),wh=function(e){if(Bd(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(nu,"-",e)){var t=f(Nc,yr,Sh(Ys(e)));return f(Zo,eu,l(Th,Ti(t)-1,t,0))}return l(Th,Go(e)-1,Ys(e),0)}();return f(Od,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Ih=function(e){var t=Ys(e);return function(e){return L(t,e)}(f(bh,yr,Eh(f(xa,wh,f(_i,"",f(Ri,"",f(xa,f(Ko,Rs,rc),f(oc,20,Uf(f(xa,f(Ko,mh,yi),t))))))))))},Ah=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Ih(au(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!ph(e)&&yh(o)},Bh=fh(f(Nc,hh,dh("^((0[Xx]){1})?[0-9a-f]{40}$"))),kh=fh(f(Nc,hh,dh("^((0[Xx]){1})?[0-9A-F]{40}$"))),Nh=function(e){return'"'+e+'"'},Rh=function(e){var t=au(e),r=f(Qo,24,t),n=f(tu,40,e);return 64===Go(t)&&f(ki,Ja(P("0")),r)?kh(n)||Bh(n)?li(Wd(n)):Ah(n)?li(Wd(n)):fi("Given address "+Nh(e)+" failed the EIP-55 checksum test."):40!==Go(t)?fi("Given address "+Nh(e)+" is not the correct length."):ph(t)?kh(t)||Bh(t)?li(Wd(t)):Ah(t)?li(Wd(t)):fi("Given address "+Nh(e)+" failed the EIP-55 checksum test."):fi("Given address "+Nh(e)+" contains invalid hex characters.")},$h=jo(function(e){var t=e.a,r=e.b;return f(Zo,f(Jo,t,r),Rh(Xo(r)))}),_h=r(function(e,t){var r=t.a;return jo(function(t){var n=t.a,a=t.b;return r(f(qo,n,f(Yo,64*e,a)))})}),Lh=Jr,xh=r(function(e,t){return f(Lh,"data",lu(f(_h,e,t)))}),Ph=Qr,Dh=r(function(e,t){return f(Lh,"topics",f(Ph,e,lu(t)))}),Uh=function(e){return f(wo,f(Ko,$a,f(Ra,r(function(e,t){return f(zu,Fu(e),f(is,t,bs))}),ss)),td(f(xa,f(Ko,$a,f(Ko,As,f(Ko,wh,Hd))),f(ed,8,$a(e)))))},Oh=function(e){var t=Ys(nd(e));e:for(;;){if(!t.b)return ci;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(wo,is(Fu(-1)),Uh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(wo,is(Fu(-1)),Uh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Uh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Uh(a)}t.b;return ci}break e;default:break e}}var a=t;return Uh(a)},Mh=jo(function(e){var t=e.a,r=e.b;return f(Zo,f(Jo,t,r),f(Ad,"Error Decoding Uint into BigInt",Oh(Mf(Xo(r)))))}),Fh=f(uh,f(Dh,1,$h),f(uh,f(xh,1,$h),f(uh,f(xh,0,Mh),Fi(sh)))),Vh=nn,Kh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Hh=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(Vh,e,gl(M([L("data",sl(t.data)),L("topics",f(Kh,ll,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),jh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),qh=r(function(e,t){return f(Zo,function(e){return e.id},f(jh,function(e){return f(Od,Di,f(Hh,Fh,e).returnData)},f(Ad,"No log found from that factoryAddress in that txReceipt",Gl(f(hl,function(t){return R(f(Ko,ul,nd)(t.address),f(Ko,ul,nd)(Qd(e)))},t.logs)))))}),Gh=n(function(e,t,r){return{data:si(f(Vf,"allowance(address,address)",M([eh(t),eh(r)]))),decoder:lu(Mh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),zh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Yh=function(e){switch(e.$){case"BlockNum":var t=e.a;return sl(Mf(Rs(t)));case"EarliestBlock":return sl("earliest");case"LatestBlock":return sl("latest");default:return sl("pending")}},Wh=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return vl(M([L("to",f(wo,cl,t)),L("from",f(wo,cl,r)),L("gas",f(wo,dl,n)),L("gasPrice",f(wo,fl,a)),L("value",f(wo,fl,i)),L("data",f(wo,ll,o))]))},Jh=function(e){return{$:"BadBody",a:e}},Qh=function(e){return{$:"BadStatus",a:e}},Xh=function(e){return{$:"BadUrl",a:e}},Zh={$:"NetworkError"},ep={$:"Timeout"},tp=rn,rp=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(Xh(r));case"Timeout_":return fi(ep);case"NetworkError_":return fi(Zh);case"BadStatus_":var n=t.a,a=t.b;return fi(Qh(n.statusCode));default:var n=t.a,a=t.b,i=f(tp,f(Lh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(Jh(Di(u)))}}),np=n(function(e,t,r){return gl(M([L("id",bl(e)),L("jsonrpc",sl("2.0")),L("method",sl(t)),L("params",f(Kh,Ua,r))]))}),ap=Il,ip=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Uu,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),op=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},up=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(wl,Al,p,g,h(wl,Tl,r,n,h(wl,Al,i,o,u,s),v),h(wl,Tl,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(wl,Tl,r,n,h(wl,Al,i,o,u,s),h(wl,Al,f,l,d,m))}return e},sp=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(wl,Al,i,o,h(wl,Tl,s,c,f,l),h(wl,Tl,r,n,d,h(wl,Al,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(wl,Tl,r,n,h(wl,Al,i,o,C,d),h(wl,Al,g,v,y,m))}return e},cp=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(wl,r,u,s,c,h(wl,Al,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 sp(t)}break e}o.a,o.d;return sp(t)}break e}return t}),fp=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(wl,t,r,n,fp(a),u)}var s=up(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Bl,c,f,l,fp(d),p)}return Il}return h(wl,t,r,n,fp(a),u)}return Il},lp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Il;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(wl,r,n,a,f(lp,e,i),o)}var s=up(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Bl,c,l,d,f(lp,e,p),v)}return Il}return h(wl,r,n,a,f(lp,e,i),o)}return f(dp,e,g(cp,e,t,r,n,a,i,o))}),dp=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(R(e,n)){var u=op(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Bl,r,s,c,i,fp(o))}return Il}return h(Bl,r,n,a,i,f(lp,e,o))}return Il}),hp=r(function(e,t){var r=f(lp,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(wl,Tl,n,a,i,o)}return r}),pp=n(function(e,t,r){var n=t(f(ip,e,r));if("Just"===n.$){var a=n.a;return l(Nl,e,a,r)}return f(hp,e,r)}),gp=function(e){return"Just"===e.$},vp=gn,yp=vn,mp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),bp=function(e){return{$:"BadUrl_",a:e}},Cp=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ep={$:"NetworkError_"},Sp=function(e){return{$:"Receiving",a:e}},Tp=function(e){return{$:"Sending",a:e}},wp={$:"Timeout_"},Ip=function(e){return f(ta,"application/json",f(xi,0,e))},Ap=n(function(e,t,r){return Ip(l(np,e,t,r))}),Bp=f(ea,"",Ua),kp=Te,Np=Se,Rp=function(e){if("Ok"===e.$){var t=e.a;return Np(t)}var r=e.a;return kp(r)},$p=function(e){return l(Zn,gr,Rp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},_p=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return $p({body:l(Ap,1,r,n),headers:yr,method:"POST",resolver:Bp(rp(a)),timeout:ci,url:t})},Lp=n(function(e,t,r){return _p({decoder:t.decoder,method:"eth_call",params:M([Wh(t),Yh(r)]),url:e})}),xp={$:"LatestBlock"},Pp=r(function(e,t){return l(Lp,e,t,xp)}),Dp=function(e){return{$:"Perform",a:e}},Up=sn,Op=Np(gr),Mp=r(function(e,t){return f(Up,function(t){return Np(e(t))},t)}),Fp=n(function(e,t,r){return f(Up,function(t){return f(Up,function(r){return Np(f(e,t,r))},r)},t)}),Vp=function(e){return l(La,Fp(ka),Np(yr),e)},Kp=r(function(e,t){var r=t.a;return Be(f(Up,vp(e),r))}),Hp=n(function(e,t,r){return f(Mp,function(e){return gr},Vp(f(xa,Kp(e),t)))}),jp=n(function(e,t,r){return Np(gr)}),qp=r(function(e,t){var r=t.a;return Dp(f(Mp,e,r))});pn.Task=Pe(Op,Hp,jp,qp);var Gp=Ue("Task"),zp=cn,Yp=r(function(e,t){return Gp(Dp(f(zp,f(Da,f(Da,Np,e),fi),f(Up,f(Da,f(Da,Np,e),li),t))))}),Wp=a(function(e,t,r,n){return f(Yp,n,f(Pp,zh(eo(e)),l(Gh,Xd(e),t,r)))}),Jp=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Jd("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return Jd("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return Jd("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return Jd("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return Jd("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Qp=function(e){return{$:"BoolE",a:e}},Xp=Qp,Zp=function(e){return{$:"StringE",a:e}},eg=Zp,tg=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:si(f(Vf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([eh(t),eh(r),Xp(n),rh(a),rh(i),rh(o),rh(u),rh(s),rh(c),rh(l),rh(d),eg(h),eg(p)]))),decoder:lu($h),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},rg=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:si(f(Vf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([eh(t),eh(r),Xp(n),rh(a),rh(i),rh(o),rh(u),rh(s),rh(c),rh(l),rh(d),eg(h),eg(p)]))),decoder:lu($h),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ng=r(function(e,t){return{paymentMethods:t,price:e}}),ag=function(e){return sl(yd(e))},ig=function(e){return f(Kh,Ua,M([sl(e.fiatType),ag(e.amount)]))},og=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},ug=function(e){return gl(M([L("type",sl(og(e.type_))),L("info",sl(e.info))]))},sg=function(e){var t=ig(e.price),r=f(Kh,ug,e.paymentMethods);return f(xi,0,gl(M([L("paymentmethods",r),L("price",t)])))},cg=r(function(e,t){return D(t,{value:si(e)})}),fg=function(e){return Fu(Md(e))},lg=function(e){return f(Fl,fg(e),Fu(1e3))},dg=r(function(e,t){var r=function(){return"Token"===e.$?tg:rg}();return function(){return"Native"===e.$?cg(Ml(oh(t))):Ua}()(r(Qd(e))(t.initiatorAddress)(Jp(e))(R(t.initiatorRole,fo))(Ml(t.tradeAmount))(Ml(Hl(t.tradeAmount)))(Ml(Kl(t.tradeAmount)))(Ml(t.pokeReward))(lg(t.autorecallInterval))(lg(t.autoabortInterval))(lg(t.autoreleaseInterval))(Ml(ah(t.tradeAmount)))(sg(f(ng,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),hg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),pg=function(e){return{$:"CreateNeedsSig",a:e}},gg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),vg=r(function(e,t){var r=Zf(f(dg,e,t)),n={onBroadcast:ci,onMined:si(L(hg(e),ci)),onSign:si(gg(e))};return L(si(pg(e)),f(Fo,n,r))}),yg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),mg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),bg=function(e){return{$:"ApproveNeedsSig",a:e}},Cg=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Eg=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Sg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),Tg={$:"NoOp"},wg=function(e){return{appCmds:yr,chainCmd:Do,cmd:_o,model:e}},Ig=function(e){return Ql(yd(e))},Ag={$:"Error"},Bg=r(function(e,t){f(al,e+" fetch error",t);return{align:rl,label:"web3FetchError",mainParagraphs:M([M([il('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:Ag}}),kg=r(function(e,t){return{align:rl,label:"web3MiningError",mainParagraphs:M([M([il('Error mining "'+e+'" transaction: '+t)])]),noticeType:Ag}}),Ng={$:"Caution"},Rg=r(function(e,t){return{align:rl,label:"web3SigError",mainParagraphs:M([M([il('Error signing "'+e+'" transaction: '+t)])]),noticeType:Ng}}),$g={$:"KovanDai"},_g=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo($g));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Lg=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},xg=function(e){return f(So,_g,Lg(e))},Pg=r(function(e,t){return 1-e(1-t)}),Dg=function(e){return f(wu,e,5)},Ug=Pg(Dg),Og={easing:Ug,offset:12,speed:200},Mg=function(e){return{$:"External",a:e}},Fg=function(e){return{$:"Internal",a:e}},Vg=function(e){return{$:"NotFound",a:e}},Kg=function(e){for(;;){e=e.a}},Hg=r(function(e,t){return Gp(Dp(f(Mp,e,t)))}),jg={$:"Http"},qg={$:"Https"},Gg=Kr,zg=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(Bd(a)||f(Gg,"@",a))return ci;var i=f(zl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=Ql(f(Yo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(zg,e,f(Qo,o,a),s,t,r,n))}return si(p(zg,e,a,ci,t,r,n))}),Wg=a(function(e,t,r,n){if(Bd(n))return ci;var a=f(zl,"/",n);if(a.b){var i=a.a;return h(Yg,e,f(Yo,i,n),t,r,f(Qo,i,n))}return h(Yg,e,"/",t,r,n)}),Jg=n(function(e,t,r){if(Bd(r))return ci;var n=f(zl,"?",r);if(n.b){var a=n.a;return d(Wg,e,si(f(Yo,a+1,r)),t,f(Qo,a,r))}return d(Wg,e,ci,t,r)}),Qg=r(function(e,t){if(Bd(t))return ci;var r=f(zl,"#",t);if(r.b){var n=r.a;return l(Jg,e,si(f(Yo,n+1,t)),f(Qo,n,t))}return l(Jg,e,ci,t)}),Xg=function(e){return f(nu,"http://",e)?f(Qg,jg,f(Yo,7,e)):f(nu,"https://",e)?f(Qg,qg,f(Yo,8,e)):ci},Zg=Wt,ev=Gt(zt),tv=sa,rv=r(function(e,t){return L(e,t)}),nv=_r,av=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=Mu(r-n),o=f(ei,1,nv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),iv=r(function(e,t){var n=r(function(t,r){return Vp(f(xa,tv(0),d(av,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,rv,ev,Zg(t)))}),ov=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Vd(t.wallet),xg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(Wp,a,n.address,Qd(eo(a)),yg(a));return d(Gd,t,i,Do,yr)}return wg(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Gd,D(t,{inputs:D(u,{userRole:o})}),_o,Do,M([function(){return"Buyer"===o.$?d(Yd,"create offer type changed","input","sell dai",0):d(Yd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return wg(f(qd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return wg(f(qd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return wg(f(qd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return wg(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return wg(f(qd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return wg(f(qd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return wg(f(qd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return wg(f(qd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Gd,(g?qd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),_o,Do,g?M([d(Yd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=Fd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(ql,n,m);return wg(D(t,{depositAmount:si(Ml(oh(b))),txChainStatus:si(f(Eg,v,b))}))}var C=y.a;return d(Gd,D(t,{errors:C}),f(Yp,hs(Tg),function(){return f(iv,D(Og,{offset:60}),"inputError")}()),Do,yr);case"AbortCreate":return d(Gd,D(t,{txChainStatus:ci}),_o,Do,M([d(Yd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(vg,v,b);var e=v.a,r=function(){var t=Zf(l(nh,Xd(e),Qd(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Cg,e,b))};return f(Fo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(Ju,a,E),ba)?L(si(bg(e)),r):f(vg,v,b)}return L(si(bg(e)),r)}(),T=S.a,w=S.b;return d(Gd,D(t,{txChainStatus:T}),_o,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return wg(D(t,{txChainStatus:si(l(mg,a,b,A))}))}var B=I.a;return d(Gd,D(t,{txChainStatus:ci}),_o,Do,M([pa(f(Rg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(Ju,N,P),ba))return wg($);var U=f(vg,eo(a),b),T=U.a,w=U.b;return d(Gd,D($,{txChainStatus:T}),_o,w,yr)}return wg($)}var O=k.a;return d(Gd,t,_o,Do,M([pa(f(Bg,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return wg(D(t,{txChainStatus:si(f(Sg,v,A))}))}var B=I.a;return d(Gd,D(t,{txChainStatus:ci}),_o,Do,M([pa(f(Rg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Gd,t,_o,Do,M([pa(f(kg,"create",B))]))}var F=e.a,V=e.b.a,K=f(So,Ig,Hd(f(qh,F,V)));if("Just"===K.$){var H=K.a;return d(Gd,t,_o,Do,M([da(f(Hf,F,H))]))}return d(Gd,t,_o,Do,M([pa(f(ol,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Gd,t,_o,Do,M([ga]));case"NoOp":return wg(t);default:var j=e.a;return d(Gd,t,_o,Do,M([j]))}}),uv=r(function(e,t){return f(Uu,Md(e),Md(t))}),sv=r(function(e,t){return R(t.state.phase,mo)&&R(f(uv,t.derived.phaseEndTime,e),Ta)}),cv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},fv=r(function(e,t){return{maxDai:t,minDai:e}}),lv=f(fv,ci,ci),dv={$:"Expires"},hv=function(e){return L({errors:lv,filterFunc:sv,inputs:cv,showCurrencyDropdown:!1,tradeTable:f(ko,L(dv,No),M([f(po,!0,!0),d(bo,!0,!1,!1,!1)])),wallet:e},_o)},pv=r(function(e,t){return D(t,{paymentMethod:e})}),gv=r(function(e,t){return D(t,{paymentMethodTerms:e})}),vv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return D(e,{inputs:f(gv,r,f(pv,"",e.inputs))})},yv=r(function(e,t){var r=f(hl,bc(e),t.inputs.paymentMethodTerms);return D(t,{inputs:f(gv,r,t.inputs)})}),mv=function(e){return D(e,{filterFunc:sv,inputs:cv})},bv=function(e){return{$:"TradeTableMsg",a:e}},Cv=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Ev=function(e){return d(Cv,e,_o,Do,yr)},Sv=r(function(e,t){return D(t,{fiatType:e})}),Tv=r(function(e,t){return D(t,{maxDai:e})}),wv=r(function(e,t){return D(t,{minDai:e})}),Iv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return Ev(D(t,{inputs:f(wv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return Ev(D(t,{inputs:f(Tv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return Ev(D(t,{inputs:f(Sv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return Ev(D(t,{inputs:(n?Sv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return Ev(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return Ev(D(t,{inputs:f(pv,r,t.inputs)}));case"AddSearchTerm":return Ev(vv(t));case"RemoveTerm":var a=e.a;return Ev(f(yv,a,t));case"ResetSearch":return Ev(mv(t));case"TradeTableMsg":var i=e.a,o=f(Xf,i,t.tradeTable);return d(Cv,D(t,{tradeTable:o.model}),f(el,bv,o.cmd),f(Ho,bv,o.chainCmd),f(xa,Ji(bv),o.appCmds));case"NoOp":return Ev(t);default:var u=e.a;return d(Cv,t,_o,Do,M([u]))}}),Av=a(function(e,t,r,n){return e(gl(M([L("title",sl(t)),L("body",function(){if("Nothing"===r.$)return pl;var e=r.a;return sl(e)}()),L("image",function(){if("Nothing"===n.$)return pl;var e=n.a;return sl(e)}())])))}),Bv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},kv=function(e){return e.a+"="+e.b},Nv=function(e){return e.b?"?"+f(Ri,"&",f(xa,kv,e)):""},Rv=r(function(e,t){return"/"+(f(Ri,"/",e)+Nv(t))}),$v=function(e){switch(e.$){case"Home":return f(Rv,M(["DAIHard"]),yr);case"Create":return f(Rv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Rv,M(["DAIHard","trade",Bv(t),Ni(r)]),yr);case"Marketplace":return f(Rv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Rv,M(["DAIHard","history",ul(n)]),yr);default:return f(Rv,yr,yr)}},_v={$:"NotFound"},Lv=function(e){return{$:"AgentHistory",a:e}},xv={$:"Create"},Pv={$:"Home"},Dv={$:"Marketplace"},Uv=function(e){return{$:"Parser",a:e}},Ov=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Mv=r(function(e,t){return Uv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Ov,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Fv=f(Mv,"ADDRESS",f(Ko,Rh,Hd)),Vv={$:"Eth"},Kv={$:"Kovan"},Hv=f(Mv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Vv));case"keth":return si(Zi(Kv));case"dai":return si(eo(Xi));case"kdai":return si(eo($g));case"xdai":return si(Zi(to));default:return ci}}),jv=f(Mv,"NUMBER",Ql),qv=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Ov,r,n,a,i,e(o))}),Gv=r(function(e,t){var r=t.a;return Uv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,qv(u),r(h(Ov,n,a,i,o,e)))})}),zv=function(e){return l(La,oo,yr,e)},Yv=r(function(e,t){return zv(f(xa,e,t))}),Wv=function(e){return Uv(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 R(u,e)?M([h(Ov,f(ka,u,r),s,a,i,o)]):yr}return yr})},Jv=r(function(e,t){var r=e.a,n=t.a;return Uv(function(e){return f(Yv,n,r(e))})}),Qv=Uv(function(e){return M([e])}),Xv=f(Jv,Wv("DAIHard"),function(e){return Uv(function(t){return f(Yv,function(e){return(0,e.a)(t)},e)})}(M([f(Gv,Pv,Qv),f(Gv,xv,Wv("create")),f(Gv,Hf,f(Jv,Wv("trade"),f(Jv,Hv,jv))),f(Gv,Dv,Wv("marketplace")),f(Gv,Lv,f(Jv,Wv("history"),Fv)),f(Gv,function(e){return Lv(e)},f(Jv,Wv("history"),Fv))]))),Zv=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 si(t.value)}return si(t.value)}return ci}},ey=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ey(r))}return yr}return yr},ty=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ey(r)}var r=t;return ey(r)},ry=Qt,ny=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),ay=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=ry(n);if("Nothing"===o.$)return t;var u=o.a,s=ry(i);if("Nothing"===s.$)return t;var c=s.a;return l(pp,u,ny(c),t)}return t}),iy=function(e){if("Nothing"===e.$)return ap;var t=e.a;return l(La,ay,ap,f(_i,"&",t))},oy=r(function(e,t){var r=e.a;return Zv(r(h(Ov,yr,ty(t.path),iy(t.query),t.fragment,Ua)))}),uy=function(e){return f(Nc,_v,f(oy,Xv,e))},sy=aa,cy=r(function(e,t){return f(sy,e,$v(t))}),fy=je("connectToWeb3",function(e){return pl}),ly=function(e){return gl(M([L("event",sl(e.event)),L("category",sl(e.category)),L("label",sl(e.label)),L("value",bl(e.value))]))},dy=r(function(e,t){return gl(M([L("address",sl(ul(e))),L("signSeedMsg",sl(t))]))}),hy=je("gTagOut",Ua),py=je("genPrivkey",Ua),gy=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),vy=n(function(e,t,r){return f(So,Yc(t),f(wo,function(e){return e.trades},f(gy,function(t){return R(t.factory,e)},r)))}),yy=je("notifyPort",Ua),my=je("requestNotifyPermissionPort",function(e){return pl}),by=r(function(e,t){return D(t,{wallet:e})}),Cy=r(function(e,t){return L(f(qd,t.inputs,D(t,{wallet:e})),function(){var t=L(Vd(e),xg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(Wp,n,r.address,Qd(eo(n)),yg(n))}return _o}())}),Ey=r(function(e,t){return D(t,{wallet:e})}),Sy=function(e){return{$:"AllowanceFetched",a:e}},Ty=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Vd(e),xg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(xg(e),si(i.factory))?d(Wp,a,n.address,i.creationInfo.address,Sy):_o}return _o}())}),wy=function(e){return{$:"AgentHistoryModel",a:e}},Iy=function(e){return{$:"CreateModel",a:e}},Ay=function(e){return{$:"CreateMsg",a:e}},By=function(e){return{$:"MarketplaceModel",a:e}},ky=function(e){return{$:"TradeModel",a:e}},Ny=function(e){return{$:"TradeMsg",a:e}},Ry=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,_o);case"CreateModel":var r=t.a,n=f(Cy,e,r),a=n.a,i=n.b;return L(Iy(a),f(el,Ay,i));case"TradeModel":var o=t.a,u=f(Ty,e,o),s=u.a,c=u.b;return L(ky(s),f(el,Ny,c));case"MarketplaceModel":var l=t.a;return L(By(f(Ey,e,l)),_o);default:var d=t.a;return L(wy(f(by,e,d)),_o)}}),$y=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),_y=function(e){return{$:"PartiallyLoadedTrade",a:e}},Ly=r(function(e,t){return _y(g($y,e,t,ci,ci,ci,ci,ci))}),xy=function(e){return{$:"CurrentBlockFetched",a:e}},Py=fu(f(Ko,au,wh)),Dy=function(e){return _p({decoder:Py,method:"eth_blockNumber",params:yr,url:e})},Uy=function(e){return f(Yp,xy,Dy(e))},Oy=r(function(e,t){return{address_:e,blocknum:t}}),My=function(e){return jo(function(t){return li(L(t,e))})},Fy=n(function(e,t,r){var n=t.a,a=r.a;return jo(function(t){return f(jh,function(t){var r=t.a,n=t.b;return f(Zo,Qf(e(n)),a(r))},n(t))})}),Vy=r(function(e,t){return l(Fy,r(function(e,t){return e(t)}),t,e)}),Ky=lu(f(Vy,Mh,f(Vy,$h,My(Oy)))),Hy=r(function(e,t){return{data:si(f(Vf,"createdTrades(uint256)",M([rh(t)]))),decoder:Ky,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),jy=n(function(e,t,r){return f(Yp,r,f(Pp,zh(e),f(Hy,Qd(e),t)))}),qy=function(e){return{$:"CreationInfoFetched",a:e}},Gy=r(function(e,t){return l(jy,e,Fu(t),qy)}),zy=function(e){return{$:"EventSentryMsg",a:e}},Yy=function(e){return{$:"BlockNumber",a:e}},Wy=function(e){return{$:"EventSentry",a:e}},Jy=function(e){return{$:"Set_elm_builtin",a:e}},Qy=Jy(ap),Xy=r(function(e,t){return L(Wy({blockNumber:ci,errors:yr,nodePath:t,pending:Qy,ref:1,requests:ap,tagger:e,watching:Qy}),f(Yp,f(Ko,Yy,e),Dy(t)))}),Zy=function(e){return f(Xy,zy,zh(e))},em=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),tm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},rm=tm(f(em,ci,ci)),nm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:mo,secureCommInfo:rm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),am=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),im=n(function(e,t,r){var n=f(Gy,t,r),a=Zy(t),i=a.a,o=a.b;return d(am,l(nm,f(Ly,t,r),i,e),$o(M([n,o,Uy(zh(t))])),Do,M([ha]))}),om=function(e){return{$:"LoadedTrade",a:e}},um=r(function(e,t){var r=Zy(t.factory),n=r.a,a=r.b;return d(am,l(nm,om(t),n,e),$o(M([a,Uy(zh(t.factory))])),Do,M([ha]))}),sm=function(e){return{data:si(f(Vf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},cm=function(e){return{data:si(f(Vf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},fm=function(e){return{data:si(f(Vf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},lm=r(function(e,t){return{data:si(f(Vf,"initiatorStatement(string)",M([eg(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),dm=function(e){return{data:si(f(Vf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},hm=function(e){return{data:si(f(Vf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},pm=r(function(e,t){return{data:si(f(Vf,"responderStatement(string)",M([eg(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),gm=r(function(e,t){return{amount:t,fiatType:e}}),vm=f(uu,function(e){var t=ad(e);if("Just"===t.$){var r=t.a;return Fi(r)}return su("Can't convert that to a BigInt")},cu),ym=l(Mi,gm,f(Ph,0,cu),f(Ph,1,vm)),mm={$:"Bank"},bm={$:"Cash"},Cm=function(e){switch(e){case"cash":return si(bm);case"bank":return si(mm);case"custom":return si(Pd);default:return ci}},Em=f(uu,function(e){var t=Cm(e);if("Just"===t.$){var r=t.a;return Fi(r)}return su("")},cu),Sm=l(Mi,Dd,f(Lh,"type",Em),f(Lh,"info",cu)),Tm=oe,wm=function(e){var t=l(Mi,ng,f(Lh,"price",ym),f(Lh,"paymentmethods",Tm(Sm)));return f(tp,t,e)},Im=r(function(e,t){return{commPubkey:t,responder:e}}),Am=r(function(e,t){var n=r(function(t,r){return l(zo,t,t+2*r,e)}),a=f(Ko,wh,Zo(ti(2)));return f(jh,function(t){return f(Zo,function(e){return f(n,t+64,e)},wh(l(zo,t,t+64,e)))},a(t))}),Bm=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),km=n(function(e,t,r){var n=l(Ra,Bm(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),Nm=j,Rm=function(e){return Es(Nm(e))},$m=function(e){return l(km,r(function(e,t){return U(t,Rm(e))}),"",e)},_m=jo(function(e){var t=e.a,r=e.b;return f(Zo,f(Jo,t,r),f(jh,$m,f(jh,f(Ko,xa(wh),Eh),f(Zo,hl(f(Ko,Bd,Xu)),f(Zo,Js(2),f(Am,t,Xo(r)))))))}),Lm=f(uh,f(xh,1,_m),f(uh,f(xh,0,$h),Fi(Im))),xm=r(function(e,t){return{commPubkey:t,terms:e}}),Pm=f(uh,f(xh,1,_m),f(uh,f(xh,0,_m),Fi(xm))),Dm=function(e){return{statement:e}},Um=f(uh,f(xh,0,_m),Fi(Dm)),Om=function(e){return{statement:e}},Mm=f(uh,f(xh,0,_m),Fi(Om)),Fm={$:"AbortedEvent"},Vm={$:"BurnedEvent"},Km={$:"ClaimedEvent"},Hm=function(e){return{$:"CommittedEvent",a:e}},jm=function(e){return{$:"InitiatedEvent",a:e}},qm=function(e){return{$:"InitiatorStatementLogEvent",a:e}},Gm={$:"PokeEvent"},zm={$:"RecalledEvent"},Ym={$:"ReleasedEvent"},Wm=function(e){return{$:"ResponderStatementLogEvent",a:e}},Jm=fh(f(Nc,hh,dh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),Qm=function(e){return Jm(e)?li(Xs(au(e))):fi("Something in here is not very hexy: "+Nh(e))},Xm=fu(Qm),Zm=f(Lh,"topics",f(Ph,0,Xm)),eb=function(e){return Xs(f(Ri,"",f(xa,f(Ko,Rs,rc),Uf(f(xa,yi,Ys(e))))))},tb=f(uu,function(e){return R(e,eb("Initiated(string,string)"))?f(Oi,jm,Pm):R(e,eb("Committed(address,string)"))?f(Oi,Hm,Lm):R(e,eb("Recalled()"))?Fi(zm):R(e,eb("Claimed()"))?Fi(Km):R(e,eb("Aborted()"))?Fi(Fm):R(e,eb("Released()"))?Fi(Ym):R(e,eb("Burned()"))?Fi(Vm):R(e,eb("InitiatorStatementLog(string)"))?f(Oi,qm,Um):R(e,eb("ResponderStatementLog(string)"))?f(Oi,Wm,Mm):R(e,eb("Poke()"))?Fi(Gm):su("Unrecognized topic hash")},Zm),rb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},nb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},ab=function(e){return R(e.buyerDeposit,Hl(e.tradeAmount))&&R(e.abortPunishment,Kl(e.tradeAmount))},ib={$:"Invalid"},ob=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),ub=r(function(e,t){return Dl(Md(t)+Md(e))}),sb=function(e){var t=Sd(yd(e.amount));if("Just"===t.$){return t.a}f(al,"Error converting FiatValue to float--string -> float failed!",e);return 0},cb=r(function(e,t){return(t-e)/e}),fb=r(function(e,t){var r=sb(t),n=Td(e);return"USD"===t.fiatType?si(f(cb,n,r)):ci}),lb=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 Dl(0)}}();return{margin:f(fb,e.tradeAmount,r.price),phaseEndTime:f(ub,t.phaseStartTime,n)}}),db=function(e){var t=x(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 om(v(ob,e.factory,e.id,n,a,o,u,s,l(lb,a,o,u)))}return _y(e)},hb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return db(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(al,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return ib}}),pb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return db(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(al,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return ib}}),gb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return db(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(al,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return ib}}),vb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return db(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return om(D(n,{state:e}));default:return ib}}),yb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return db(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(al,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return ib}}),mb=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}}),bb=lu(f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,ru,f(Vy,$h,My(mb))))))))))),Cb=function(e){return{data:si(f(Vf,"getParameters()",yr)),decoder:bb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Eb=function(e){return f(wo,function(e){return Dl(1e3*e)},Ql(yd(e)))},Sb=function(e){return Ol(e)},Tb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),wb=function(e){var t=f(Ad,"error converting BigInt to Time.Posix",Eb(e.autoabortInterval)),r=f(Ad,"error converting BigInt to Time.Posix",Eb(e.autoreleaseInterval)),a=f(Ad,"error converting BigInt to Time.Posix",Eb(e.autorecallInterval));return d(Tb,n(function(t,r,n){return{abortPunishment:Sb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Sb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?fo:co,pokeReward:Sb(e.pokeReward),tradeAmount:Sb(e.tradeAmount)}}),a,t,r)},Ib=n(function(e,t,r){return f(Yp,r,f(Mp,wb,f(Pp,zh(e),Cb(t))))}),Ab=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}}}}}}}}}}},Bb=lu(f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,My(Ab)))))))))))),kb=function(e){return{data:si(f(Vf,"getPhaseStartInfo()",yr)),decoder:Bb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Nb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),Rb=function(e){return h(Nb,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}}),Eb(e.v6),Eb(e.v7),Eb(e.v8),Eb(e.v9))},$b=n(function(e,t,r){return f(Yp,r,f(Mp,Rb,f(Pp,zh(e),kb(t))))}),_b=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Lb=lu(f(Vy,Mh,f(Vy,$h,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,My(_b))))))),xb=function(e){return{data:si(f(Vf,"getState()",yr)),decoder:Lb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Pb={$:"Aborted"},Db={$:"Burned"},Ub={$:"NotClosed"},Ob={$:"Recalled"},Mb={$:"Released"},Fb=function(e){switch(f(Nc,99,Ql(yd(e)))){case 0:return si(Ub);case 1:return si(Ob);case 2:return si(Pb);case 3:return si(Mb);case 4:return si(Db);default:return ci}},Vb=function(e){switch(f(Nc,99,Ql(yd(e)))){case 1:return si(mo);case 2:return si(vo);case 3:return si(yo);case 4:return si(go);default:return ci}},Kb=function(e){return R(e,Jd("0x0000000000000000000000000000000000000000"))?ci:si(e)},Hb=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),jb=function(e){var t=Eb(e.phaseStartTimestamp),r=Vb(e.phase),a=Fb(e.closedReason);return d(Hb,n(function(t,r,n){return{balance:Sb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:Kb(e.responder)}}),r,t,a)},qb=n(function(e,t,r){return f(Yp,r,f(Mp,jb,f(Pp,zh(e),xb(t))))}),Gb=i(function(e,t,r,n,a){return $o(M([l(Ib,e,t,r),l(qb,e,t,n),l($b,e,t,a)]))}),zb=function(e){var t=Ig(e);if("Just"===t.$){return t.a}f(al,"Warning! BigInt to Int conversion failed!",yd(e));return 0},Yb=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),Wb=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),Jb=function(e){return e.b?l(Wb,e,yr,0):qa},Qb=tn,Xb=function(e){var t=h(Qb,Yb,f(Lh,"encapsulation",cu),f(Lh,"iv",cu),f(Lh,"tag",cu),f(Lh,"encrypted",cu)),r=Tm(t),n=f(Vh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Yc,0,e),f(Yc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(Jb(i))},Zb=function(e){var t=function(e){var t=Go(e);return t>1114111?fi("string is too long"):li(f(Cs,Nm(t),e))};return f(Zo,Ri(""),Eh(f(xa,t,e)))},eC=function(e){var t=e.a,r=e.b;return Zb(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},tC=r(function(e,t){return gl(M([L("message",sl(e)),L("pubkeyHexStrings",f(Kh,sl,M([t.initiatorPubkey,t.responderPubkey])))]))}),rC=function(e){return{$:"LoadedCommInfo",a:e}},nC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),aC=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 rC(f(nC,r,n))}return tm(e)},iC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return aC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return rC(D(n,{initiatorPubkey:e}))}),oC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return aC(D(r,{responderPubkey:si(e)}))}var n=t.a;return rC(D(n,{responderPubkey:e}))}),uC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return co}r.a,r.b;return fo}if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return co}),sC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(Xl,a,n),o=As(f(oc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),cC=function(e){var t=Jb(f(sC,Ys(e),yr));return l(Kd,rv,h(Nb,Yb,f(Yc,0,t),f(Yc,1,t),f(Yc,2,t),f(Yc,3,t)),h(Nb,Yb,f(Yc,4,t),f(Yc,5,t),f(Yc,6,t),f(Yc,7,t)))},fC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),lC={$:"Aborted"},dC={$:"Burned"},hC={$:"Claimed"},pC=function(e){return{$:"Committed",a:e}},gC=function(e){return{$:"Encrypted",a:e}},vC={$:"FailedDecode"},yC={$:"Initiated"},mC={$:"Recalled"},bC={$:"Released"},CC=function(e){return{$:"StateChange",a:e}},EC=function(e){return{$:"Statement",a:e}},SC=fr,TC=cr,wC=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(SC,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(TC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),IC=or,AC=y,BC=a(function(e,t,r,n){var a=jc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(IC,Ga(r),n);var i=za(d(BC,e-Ha,t,r,ja));return f(IC,i,n)}var o=f(qc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(BC,e-Ha,t,r,u));return l(Qc,a,i,n)}var i=za(d(BC,e-Ha,t,r,AC(o)));return l(Qc,a,i,n)}),kC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(BC,c,r,e,AC(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(BC,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),NC=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(SC,32,r,e),o=f(kC,i,t);if(a<0){var u=l(TC,a,n,e);return f(kC,u,o)}return o}),RC=ur,$C=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(RC,i,t,r)}return f(ka,e,t)});return{nodeList:l(RC,i,yr,n),nodeListSize:t/32|0,tail:a}},_C=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(RC,o,t,r)}var n=e.a;return f(NC,n,t)});return f(NC,i,l(RC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(RC,o,t,r)}var n=e.a;return f(wC,n,t)});return f(ai,!0,f(wC,i,l(RC,o,$C(e),a)))}),LC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),xC=f(La,LC,yr),PC=n(function(e,t,r){var n=uC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(CC(yC));case"CommittedEvent":var r=t.a;return si(CC(pC(r.responder)));case"RecalledEvent":return si(CC(mC));case"ClaimedEvent":return si(CC(hC));case"AbortedEvent":return si(CC(lC));case"ReleasedEvent":return si(CC(bC));case"BurnedEvent":return si(CC(dC));case"InitiatorStatementLogEvent":var r=t.a;return si(EC({blocknum:e,message:function(){var e=cC(r.statement);if("Just"===e.$){var t=e.a;return gC(t)}return vC}(),who:n(Co)}));case"ResponderStatementLogEvent":var r=t.a;return si(EC({blocknum:e,message:function(){var e=cC(r.statement);if("Just"===e.$){var t=e.a;return gC(t)}return vC}(),who:n(Eo)}));default:return ci}}(),i=f(wo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(_C,r.history,Jb(xC(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(wo,fC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),xC(M([s])))}),DC=Gr,UC=function(e){var t=l(Mi,rv,f(Lh,"id",DC),f(Lh,"message",cu));return f(Od,Di,f(Vh,t,e))},OC=function(e){return{$:"Decrypted",a:e}},MC=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),FC=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(PC,n,a,t),o=i.a,u=i.b,s=i.c;return d(MC,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(MC,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(MC,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=UC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Yc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:OC(y)}),T=D(b,{eventInfo:EC(S)}),w=l(Zc,v,T,t.history);return d(MC,D(t,{history:w}),!1,ci,yr)}return d(MC,t,!1,ci,M([pa(f(ol,"got a decryption result, but for an event that is not a message!",b))]))}return d(MC,t,!1,ci,M([pa(f(ol,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(MC,t,!1,ci,M([pa(f(ol,"Error decoding decryption result",I))]))}}),VC=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),KC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),HC=function(e){return{onBroadcast:ci,onMined:si(L(VC(e),ci)),onSign:si(KC(e))}},jC=je("encryptToPubkeys",Ua),qC=n(function(e,t,r){return{data:si(f(Vf,"commit(address,string)",M([eh(t),eg(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),GC=n(function(e,t,r){return{data:si(f(Vf,"commit(address,string)",M([eh(t),eg(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),zC=function(e){return{$:"CommitMined",a:e}},YC={$:"CommitNeedsSig"},WC=function(e){return{$:"CommitSigned",a:e}},JC=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?GC:qC}(),a=Zf(function(){return"Token"===e.factory.$?Ua:cg(Ml(rb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(YC),f(Fo,{onBroadcast:ci,onMined:si(L(zC,ci)),onSign:si(WC)},a))}),QC=r(function(e,t){return gl(M([L("id",bl(e)),L("encapsulation",sl(t.encapsulatedKey)),L("iv",sl(t.iv)),L("tag",sl(t.tag)),L("encrypted",sl(t.message))]))}),XC=je("decryptMessage",Ua),ZC=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},eE=r(function(e,t){return $o(f(xa,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 XC(f(QC,r,s))}return _o}return _o},ZC(e.history)))}),tE=function(e){if("Just"===e.$){return e.a}return ci},rE=function(e){var t=tE(l(Kd,To,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(wo,function(e){return e.address},Vd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(eE,n,a)}return _o},nE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(PC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),aE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),iE=i(function(e,t,r,n,a){return f(nE,n,p(aE,e,r,t,qa,a,""))}),oE=function(e){return{$:"ChatHistoryMsg",a:e}},uE=a(function(e,t,r,n){var a=x(t,Vd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(Io,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(oE),n))}(h(iE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),sE={$:"Abort"},cE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),fE=function(e){return{$:"ActionNeedsSig",a:e}},lE=function(e){return{$:"ApproveMining",a:e}},dE={$:"ApproveNeedsSig"},hE=function(e){return{$:"ApproveSigned",a:e}},pE={$:"Burn"},gE={$:"Claim"},vE=function(e){return{$:"CommitMining",a:e}},yE=function(e){return{$:"ConfirmingAction",a:e}},mE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),bE=function(e){return{$:"EventLogFetched",a:e}},CE=function(e){return{$:"ParametersFetched",a:e}},EE=function(e){return{$:"PhaseInfoFetched",a:e}},SE={$:"Poke"},TE={$:"Recall"},wE={$:"Release"},IE=function(e){return{$:"StartContractAction",a:e}},AE=function(e){return{$:"StateFetched",a:e}},BE=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"}},kE=function(e){return d(am,e,_o,Do,yr)},NE={align:rl,label:"cantFindTradeWillRetry",mainParagraphs:M([M([il("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:Ag},RE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(Bg,e,r)}if("Nothing"===t.a.$){t.a;return f(ol,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ol,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),$E={align:rl,label:"tradeParametersNotDefault",mainParagraphs:M([M([il("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:Ag},_E=eo(Xi),LE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),xE=n(function(e,t,r){return l(pp,e,wo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),PE=r(function(e,t){var r=t.a;return Jy(f(hp,e,r))}),DE=n(function(e,t,r){var n=e.a,a=f(ip,t,n.requests);if("Nothing"===a.$)return L(Wy(n),_o);var i=a.a,o=L(i.watchOnce,Gl(r));if("Nothing"===o.b.$){o.b;return L(Wy(D(n,{requests:l(xE,t,r,n.requests)})),_o)}if(o.a){var u=o.b.a;return L(Wy(D(n,{requests:l(xE,t,r,n.requests),watching:f(PE,t,n.watching)})),f(Hg,i.tagger,Np(u)))}return L(Wy(D(n,{requests:l(xE,t,r,n.requests)})),$o(f(xa,function(e){return f(Hg,i.tagger,Np(e))},r)))}),UE=_e,OE=r(function(e,t){return f(Yp,f(Ko,Yy,t),f(Up,function(t){return Dy(e)},UE(2e3)))}),ME=ue,FE=ce,VE=Yr,KE=n(function(e,t,r){var n=function(e){return FE(M([e,ME(r)]))};return f(uu,function(a){var i=f(Vh,e,a);if("Ok"===i.$){var o=i.a,u=f(Vh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return su(Di(c))}return Fi(r)},VE)}),HE=a(function(e,t,r,n){return f(uh,l(KE,f(Lh,e,VE),t,r),n)}),jE=n(function(e,t,r){return f(uh,f(Lh,e,t),r)}),qE=fu(Rh),GE=fh(f(Nc,hh,dh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),zE=function(e){return{$:"BlockHash",a:e}},YE=function(e){return GE(e)?li(zE(au(e))):fi("Given blockHash "+Nh(e)+" is not valid.")},WE=fu(YE),JE=function(e){return{$:"TxHash",a:e}},QE=function(e){return GE(e)?li(JE(au(e))):fi("Given txHash "+Nh(e)+" is not valid.")},XE=fu(QE),ZE=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}}),eS=zr,tS=l(jE,"blockNumber",Py,l(jE,"blockHash",WE,l(jE,"transactionHash",XE,l(jE,"transactionIndex",Py,l(jE,"logIndex",Py,d(HE,"removed",eS,!1,l(jE,"topics",Tm(Xm),l(jE,"data",cu,l(jE,"address",qE,Fi(ZE)))))))))),rS=function(e){return f(Kh,function(e){if("Just"===e.$){var t=e.a;return sl(Ff(t))}return pl},e)},nS=function(e){return gl(M([L("fromBlock",Yh(e.fromBlock)),L("toBlock",Yh(e.toBlock)),L("address",cl(e.address)),L("topics",rS(e.topics))]))},aS=r(function(e,t){return _p({decoder:Tm(tS),method:"eth_getLogs",params:M([nS(t)]),url:e})}),iS=function(e){return{$:"BlockNum",a:e}},oS=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Up,function(r){return f(Mp,vi(r),f(aS,e,D(t,{fromBlock:iS(n),toBlock:iS(a)})))},f(aS,e,t)):f(aS,e,t)}),uS=n(function(e,t,r){var n=r.a,a=r.b;return f(aS,e,D(t,{fromBlock:iS(n),toBlock:iS(a)}))}),sS=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(sS,e,t,i)),c=o;e=u,t=s,r=c}}),cS=r(function(e,t){return l(sS,Nl,t,e)}),fS=r(function(e,t){var r=e.a,n=t.a;return Jy(f(cS,r,n))}),lS=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 $o(f(xa,function(t){return f(Yp,f(Ko,LE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},xC(f(xa,function(e){return f(ip,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(Wy(D(r,{blockNumber:si(a)})),$o(M([f(OE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,uS)]))):L(t,f(OE,r.nodePath,r.tagger))}return L(Wy(D(r,{blockNumber:si(a),pending:Qy,watching:f(fS,r.watching,r.pending)})),$o(M([f(OE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,oS),l(i,L(a,a),r.watching,uS)])))}var s=e.a.a;return L(Wy(D(r,{errors:f(ka,s,r.errors)})),f(OE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(DE,t,c,d)}var s=e.b.a;return L(Wy(D(r,{errors:f(ka,s,r.errors)})),_o)}),dS=r(function(e,t){var r=t.a;return Jy(l(Nl,e,gr,r))}),hS=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(Nl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(Wy(D(o,{watching:f(dS,a.ref,o.watching)})),f(Yp,f(Ko,LE(a.ref),a.tagger),e),a.ref)}(l(oS,a.nodePath,n,L(s,s)))}return x(Wy(D(o,{pending:f(dS,a.ref,o.pending)})),_o,a.ref)}),pS=hS(!1),gS=function(e){return M([e])},vS=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(Gy,r.factory,r.id):_o}}(),function(){var e=x(Vd(t.wallet),xg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(xg(t.wallet),si(a.factory))?d(Wp,n,r.address,a.creationInfo.address,Sy):_o}return _o}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(uE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?rE(t):_o,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(am,u,$o(M([l(qb,p.factory,p.creationInfo.address,AE),s,r])),Do,o)}return kE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return kE(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(am,t,_o,Do,M([pa(f(Bg,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(Ju,m,Ml(rb(C.parameters))),ba))return kE(u);var S=l(JC,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(am,D(u,{txChainStatus:T}),_o,w,yr)}return kE(u)}var y=g.a;return d(am,t,_o,Do,M([pa(f(Bg,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:zb(I.blocknum)},B=l(pS,bE,t.eventSentry,{address:A.address,fromBlock:iS(A.blocknum),toBlock:xp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(hb,A,t.trade)}),$=f(Nc,_E,nb(u.trade)),_=$o(M([N,h(Gb,$,A.address,CE,AE,EE)]));return d(am,u,_,Do,yr)}if("BadBody"===g.a.$){g.a.a;return d(am,t,_o,Do,M([pa(NE)]))}var y=g.a;return d(am,t,_o,Do,M([pa(f(Bg,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(vb,P,t.trade)});return d(am,u,rE(u),Do,yr)}return d(am,t,_o,Do,M([pa(f(RE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(ab(F)){var u=D(t,{trade:f(pb,F,t.trade)});return d(am,u,rE(u),Do,yr)}return d(am,t,_o,Do,M([pa($E)]))}var V=g.a.a;return d(am,t,_o,Do,M([pa(f(ol,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(am,t,_o,Do,M([pa(f(Bg,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(gb,H,t.trade)});return d(am,u,rE(u),Do,yr)}return d(am,t,_o,Do,M([pa(f(RE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Hh,tb,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(am,t,_o,Do,M([pa(f(ol,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(iC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(oC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=wm(e.terms);if("Ok"===r.$){var n=r.a;return L(f(yb,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ol,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(oE),n))}(l(PC,q.blockNumber,Y,r))}return d(uE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?rE(u):_o;return d(am,u,_,Do,f(oo,f(xa,pa,xC(M([X]))),o));case"ExpandPhase":var te=e.a;return kE(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return kE(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return kE(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(am,t,_o,Do,M([da(Lv(C.parameters.initiatorAddress))]))}return d(am,t,_o,Do,M([pa(f(ol,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return kE(D(t,{txChainStatus:si(f(mE,E,ie))}));case"AbortAction":return kE(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(JC,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=Zf(l(nh,Xd(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(hE)};return f(Fo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(Ju,i,Ml(rb(C.parameters))),ba)?L(si(dE),n):l(JC,C,E.address,E.commPubkey)}return L(si(dE),n)}(),T=oe.a,w=oe.b;return d(am,D(t,{txChainStatus:T}),_o,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,SE)||R(ue,TE)){var se=IE(ue),ce=t;e=se,t=ce;continue e}return kE(D(t,{txChainStatus:si(yE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Do,M([pa(f(ol,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=Zf(dm(n.creationInfo.address));return x(si(fE(TE)),f(Fo,HC(TE),a),yr);case"Claim":var a=Zf(fm(n.creationInfo.address));return x(si(fE(gE)),f(Fo,HC(gE),a),yr);case"Abort":var a=Zf(sm(n.creationInfo.address));return x(si(fE(sE)),f(Fo,HC(sE),a),yr);case"Release":var a=Zf(hm(n.creationInfo.address));return x(si(fE(wE)),f(Fo,HC(wE),a),yr);case"Burn":var a=Zf(cm(n.creationInfo.address));return x(si(fE(pE)),f(Fo,HC(pE),a),yr);default:var a=Zf(Kf(n.creationInfo.address));return x(si(fE(SE)),f(Fo,HC(SE),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(am,D(t,{txChainStatus:T}),_o,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return kE(D(t,{txChainStatus:si(lE(he))}))}var V=de.a;return d(am,D(t,{txChainStatus:ci}),_o,Do,M([pa(f(Rg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return kE(D(t,{txChainStatus:si(vE(he))}))}var V=de.a;return d(am,D(t,{txChainStatus:ci}),_o,Do,M([pa(f(Rg,"commit",V))]));case"CommitMined":return kE(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return kE(D(t,{txChainStatus:si(f(cE,ue,he))}))}var V=de.a;return d(am,D(t,{txChainStatus:ci}),_o,Do,M([pa(f(Rg,BE(ue),V))]));case"ActionMined":var ue=e.a;return kE(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(lS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(am,D(t,{eventSentry:ve}),_,Do,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(FC,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?rE(t):_o,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(jC(f(tC,r,a)),ci)}return L(_o,si(f(ol,"Trying to encrypt, but commInfo is not loaded",n)))}return L(_o,ci)}(),Te=Se.a,we=Se.b;return d(am,Ee,$o(M([s,Te])),Do,U(f(Qi,oE,Ce.appCmds),f(Nc,yr,f(wo,gS,f(wo,pa,we)))))}return d(am,t,_o,Do,M([pa(f(ol,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(jh,eC,Xb(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(To,p,E.address);if("Nothing"===Ne.$)return d(am,t,_o,Do,M([pa(f(ol,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return Zf("Initiator"===Re.$?f(lm,p.creationInfo.address,ke):f(pm,p.creationInfo.address,ke))}();return d(am,t,_o,f(Fo,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(am,t,_o,Do,M([pa(f(ol,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(am,t,_o,Do,M([pa(f(ol,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return kE(t)}var V=e.a.a;return d(am,t,_o,Do,M([pa(f(kg,"message",V))]));default:return d(am,t,_o,Do,M([ga]))}}),yS=r(function(e,t){return{address:e,blocknum:t}}),mS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},bS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(hS,!0,e,t,r))}),CS=n(function(e,t,r){var n=function(e){return r(f(Hh,Pm,e).returnData)},a={address:t.address,fromBlock:iS(t.blocknum),toBlock:iS(t.blocknum),topics:M([si(eb("Initiated(string,string)"))])};return l(bS,n,e,a)}),ES=function(e){return{data:si(f(Vf,"numTrades()",yr)),decoder:lu(Mh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},SS=r(function(e,t){return f(Yp,t,f(Pp,zh(e),ES(Qd(e))))}),TS=function(e){return{data:si(f(Vf,"phase()",yr)),decoder:lu(Mh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},wS=n(function(e,t,r){return f(Yp,r,f(Mp,Vb,f(Pp,zh(e),TS(t))))}),IS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),AS=r(function(e,t){return l(La,IS(e),yr,t)}),BS=function(e){return f(AS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},kS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},NS=function(e){return f(kS,Ja(ib),Sa(e.trades))},RS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:NS(e),loaded:Ti(BS(e))})})},$S=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),_S=r(function(e,t){var r=f(Yc,e,t.trades);if("Just"===r.$){var n=(r.a,l(Zc,e,ib,t.trades));return l($S,RS(D(t,{trades:n})),_o,yr)}return l($S,t,_o,M([pa(f(ol,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),LS=n(function(e,t,r){var n=f(Yc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(hb,t,a),o=l(Zc,e,i,r.trades);return L(RS(D(r,{trades:o})),yr)}return L(r,M([f(ol,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),xS=n(function(e,t,r){var n=f(Yc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(pb,t,a),o=l(Zc,e,i,r.trades);return l($S,RS(D(r,{trades:o})),_o,yr)}return l($S,r,_o,M([pa(f(ol,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),PS=n(function(e,t,r){var n=f(Yc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(Zc,e,om(D(a,{state:D(i,{phase:t})})),r.trades);return l($S,RS(D(r,{trades:o})),_o,yr)}return l($S,r,_o,M([pa(f(ol,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l($S,r,_o,M([pa(f(ol,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),DS=n(function(e,t,r){var n=f(Yc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(gb,t,a),o=l(Zc,e,i,r.trades);return l($S,RS(D(r,{trades:o})),_o,yr)}return l($S,r,_o,M([pa(f(ol,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),US=n(function(e,t,r){var n=f(Yc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(vb,t,a),o=l(Zc,e,i,r.trades);return l($S,RS(D(r,{trades:o})),_o,yr)}return l($S,r,_o,M([pa(f(ol,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),OS=n(function(e,t,r){var n=f(Yc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(yb,t,a),o=l(Zc,e,i,r.trades);return l($S,RS(D(r,{trades:o})),_o,yr)}return l($S,r,_o,M([pa(f(ol,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),MS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),FS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),VS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),KS=function(e){return{$:"NumTradesFetchedAgain",a:e}},HS=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),jS=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),qS=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),GS=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),zS=function(e){return l($S,e,_o,yr)},YS=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=zb(n),i=Jb(f(xa,Ly(t.factory),f(Ai,0,a-1))),o=$o(f(xa,function(e){return l(jy,t.factory,Fu(e),MS(e))},f(Ai,0,a-1)));return l($S,D(t,{dataFetchState:l(FS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l($S,t,_o,M([pa(f(Bg,"Factory numTrades",u))]));case"CheckForNewTrades":return l($S,t,f(SS,t.factory,KS),yr);case"UpdateTradePhases":var s=$o(xC(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(wS,e.factory,e.creationInfo.address,f(jS,e.factory,e.id)))},BS(t))));return l($S,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(PS,d,p,t),v=function(){var e=L(p,f(Yc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=mS(r);if("Just"===n.$){var a=n.a;return L(l(qb,c,a.address,GS(d)),yr)}return L(_o,M([pa(f(ol,"Phase fetched for a trade that has no creationInfo",r))]))}return L(_o,yr)}e.b;return L(_o,M([pa(f(ol,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l($S,g.tradeCache,$o(M([g.cmd,y])),f(oo,g.appCmds,m))};return l($S,t,_o,M([pa(f(RE,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=zb(n);if(_(C,E)<0){var S=t.dataFetchState,o=$o(f(xa,function(e){return l(jy,t.factory,Fu(e),MS(e))},f(Ai,C,E-1))),T=Jb(f(xa,Ly(t.factory),f(Ai,C,E-1)));return l($S,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(_C,t.trades,T)}),o,yr)}return zS(t)}b.b;return l($S,t,_o,M([pa(f(ol,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l($S,t,_o,M([pa(f(Bg,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(yS,w.address_,zb(w.blocknum)),A=l(CS,t.eventSentry,I,VS(d)),B=A.a,k=A.b,y=$o(M([h(Gb,t.factory,I.address,HS(d),GS(d),qS(d)),k])),N=l(LS,d,I,t),R=N.a,$=N.b;return l($S,RS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l($S,t,_o,M([pa(f(Bg,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l($S,t,_o,M([pa(f(Bg,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(xS,d,P,t)}var U=r.a.a;return l($S,t,_o,M([pa(f(ol,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(US,d,O,t)}return l($S,t,_o,M([pa(f(RE,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(DS,d,F,t)}return l($S,t,_o,M([pa(f(RE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=wm(V.terms);if("Ok"===K.$){var H=K.a;return l(OS,d,H,t)}var j=K.a;return f(_S,d,t)}var j=r.a;return l($S,t,_o,M([pa(f(ol,"Error decoding initiated event",j))]));default:var q=e.a,G=f(lS,q,t.eventSentry),z=G.a,y=G.b;return l($S,D(t,{eventSentry:z}),y,yr)}}),WS=function(e){return{$:"AgentHistoryMsg",a:e}},JS=function(e){return{$:"AppCmd",a:e}},QS={$:"BetaLandingPage"},XS={$:"ConnectToWeb3"},ZS=function(e){return{$:"MarketplaceMsg",a:e}},eT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),tT=r(function(e,t){return f(kn,e,sl(t))}),rT=function(e){return f(tT,"href",tt(e))},nT=Nn("rel"),aT=tT("target"),iT=function(e){return{$:"Height",a:e}},oT=iT,uT={$:"Content"},sT=uT,cT=function(e){return{$:"Width",a:e}},fT=cT,lT=function(e){return{$:"Attr",a:e}},dT=function(e){return{$:"NodeName",a:e}},hT=function(e){return{$:"Unkeyed",a:e}},pT={$:"AsEl"},gT=pT,vT=r(function(e,t){return{$:"Field",a:e,b:t}}),yT=f(vT,0,0),mT={$:"NoNearbyChildren"},bT={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"},CT=bT.any+" "+bT.column,ET=bT.any+" "+bT.grid,ST=bT.any+" "+bT.page,TT=bT.any+" "+bT.paragraph,wT=bT.any+" "+bT.row,IT=bT.any+" "+bT.single,AT=function(e){switch(e.$){case"AsRow":return wT;case"AsColumn":return CT;case"AsEl":return IT;case"AsGrid":return ET;case"AsParagraph":return TT;default:return ST}},BT=function(e){return{$:"Keyed",a:e}},kT={$:"NoStyleSheet"},NT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),RT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),$T={$:"AsParagraph"},_T=$T,LT=Sn("div"),xT=Sn("p"),PT=Sn("s"),DT=Sn("u"),UT=tT("className"),OT=function(e){return wn(Xe(e))},MT=function(e){return Sn(Xe(e))},FT=function(e){return{$:"Flag",a:e}},VT=function(e){return{$:"Second",a:e}},KT=function(e){return e>31?VT(1< .ctr > ."+bT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",Hw="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+fw(bT.any)+fw(bT.row)+" > "+fw(bT.any)+" { flex-basis: auto !important; } "+fw(bT.any)+fw(bT.row)+" > "+fw(bT.any)+fw(bT.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"+Kw,jw=function(e){return{$:"Intermediate",a:e}},qw=r(function(e,t){return jw({closing:t,others:yr,props:yr,selector:e})}),Gw=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,jw({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(Gw,f(qw,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(Gw,f(qw,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(Gw,f(qw,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(Gw,f(qw,n.selector,""),v),t.others)})}});return jw(l(La,a,n,t))}),zw=U(Hw,function(e){var t=function(e){return gd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),gd(f(xa,a,t.others)))};return gd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(Gw,f(qw,r,""),n),t)}),yr,e)))}(U(Mw,Vw))),Yw=l(MT,"style",yr,M([dw(zw)])),Ww=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+'"'}},Jw=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}},Qw=function(e){if("FontWith"===e.$){var t=e.a;return f(gh,Jw,t.variants)}return!1},Xw=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),Zw=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),eI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(Zw,"."+e+"."+t+", ."+e+" ."+t,n),f(Zw,"."+e+"."+t+"> ."+bT.text+", ."+e+" ."+t+" > ."+bT.text,a)])}),tI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(eI,i,bT.sizeByCapital,a),l(eI,i,bT.fullSize,n)))}),rI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(Zw,"."+r+"."+bT.sizeByCapital+", ."+r+" ."+bT.sizeByCapital,M([L("line-height","1")])),f(Zw,"."+r+"."+bT.sizeByCapital+"> ."+bT.text+", ."+r+" ."+bT.sizeByCapital+" > ."+bT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),nI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},aI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,mc,t,r))}return ci},iI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),oI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(Nc,e.descender,aI(t)),n=f(Nc,e.baseline,aI(f(hl,function(e){return!R(e,r)},t))),a=f(Nc,e.capital,nI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(iI,i,a-n,o),full:l(iI,u,a-r,s)}},uI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",uw(e.height)),L("vertical-align",uw(e.vertical)+"em"),L("font-size",uw(e.size)+"em")]))},sI=function(e){return l(Ra,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 si(L(uI(function(e){return e.full}(oI(a))),uI(function(e){return e.capital}(oI(a)))))}return t}return t}),ci,e)},cI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(AS,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=sI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,rI(t),n));var i=a.a;return f(Ri,"",f(xa,f(tI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},fI=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+'" '+Ni(r)}},lI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,fI,t.variants)))}return ci},dI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},hI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+uw(r)+"px, "+uw(n)+"px, "+uw(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("+uw(o)+"px, "+uw(u)+"px, "+uw(s)+"px)",b="scale3d("+uw(f)+", "+uw(l)+", "+uw(d)+")",C="rotate3d("+uw(p)+", "+uw(g)+", "+uw(v)+", "+uw(y)+"rad)";return si(m+" "+b+" "+C)}},pI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,Xw(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,Xw(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,Xw(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,Xw(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+bT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+bT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+bT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,Xw(!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,M([f(iw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(mc,1,1-c));return l(a,t,"."+u,M([f(iw,"opacity",uw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(iw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(AS,lI,p)),v=M([f(iw,"font-family",f(Ri,", ",f(xa,Ww,p))),f(iw,"font-feature-settings",g),f(iw,"font-variant",f(gh,Qw,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(iw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(iw,s,sw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+bT.row,A="."+(bT.wrapped+I),B="."+bT.alignRight,k="."+bT.paragraph,N="."+bT.page,R="."+bT.alignLeft,$=uw(S/2)+"px",_=uw(E/2)+"px",x="."+bT.column,y="."+C,P="."+bT.any;return gd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(iw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(iw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(iw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(iw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(iw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(iw,"margin-left",w)])),l(a,t,U(y,k),M([f(iw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(iw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(iw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(iw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(iw,"content","''"),f(iw,"display","block"),f(iw,"height","0"),f(iw,"width","0"),f(iw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(iw,"content","''"),f(iw,"display","block"),f(iw,"height","0"),f(iw,"width","0"),f(iw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(iw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(iw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,ew,F.rows))+"-cols-"+f(Ri,"-",f(xa,ew,F.columns))+"-space-x-"+ew(F.spacing.a)+"-space-y-"+ew(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=hI(ne),y=rw(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,M([f(iw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=dI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(cI(s),c)}),gI=r(function(e,t){return l(MT,"style",yr,M([dw(f(pI,e,t))]))}),vI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",Yw),f(ka,L("dynamic-stylesheet",f(gI,t,l(Ra,aw,L(Qy,M([lw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(gI,t,l(Ra,aw,L(Qy,M([lw(t.focus)])),r).b)),n)}),yI=a(function(e,t,r,n){return e?f(ka,Yw,f(ka,f(gI,t,l(Ra,aw,L(Qy,M([lw(t.focus)])),r).b),n)):f(ka,f(gI,t,l(Ra,aw,L(Qy,M([lw(t.focus)])),r).b),n)}),mI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(OT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(vI,!1,e,t,r);default:var e=i.a,t=i.b;return d(vI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return LT;case"p":return xT;default:return MT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(yI,!1,e,t,n);default:var e=i.a,t=i.b;return d(yI,!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(MT,e,n,M([f(u,r,M([UT(bT.any+" "+bT.single)]))]))}}();switch(o.$){case"AsRow":return f(WT,QT,e)&&!f(WT,JT,e)?s:f(WT,jT,e)?f(DT,M([UT(f(Ri," ",M([bT.any,bT.single,bT.container,bT.contentCenterY,bT.alignContainerRight])))]),M([s])):f(WT,qT,e)?f(PT,M([UT(f(Ri," ",M([bT.any,bT.single,bT.container,bT.contentCenterY,bT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(WT,YT,e)&&!f(WT,zT,e)?s:f(WT,GT,e)?f(PT,M([UT(f(Ri," ",M([bT.any,bT.single,bT.container,bT.alignContainerCenterY])))]),M([s])):f(WT,HT,e)?f(DT,M([UT(f(Ri," ",M([bT.any,bT.single,bT.container,bT.alignContainerBottom])))]),M([s])):s;default:return s}}),bI=dw,CI=function(e){return f(LT,M([UT(f(Ri," ",M([bT.any,bT.text,bT.widthContent,bT.heightContent])))]),M([bI(e)]))},EI=function(e){return l(MT,"div",M([UT(f(Ri," ",M([bT.any,bT.text,bT.widthFill,bT.heightFill])))]),M([dw(e)]))},SI=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 R(e,_T),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,_T),L(f(ka,L(n,f(s.html,kT,e)),i),Cu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,gT)?EI(c):CI(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 R(e,_T),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,_T),L(f(ka,f(o.html,kT,e),n),Cu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,gT)?EI(u):CI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Cu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(mI,n.has,n.node,n.attributes,BT(l(RT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(mI,n.has,n.node,n.attributes,BT(l(RT,"nearby-element-pls",s,n.children)),kT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Cu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(mI,n.has,n.node,n.attributes,hT(f(NT,m,n.children))),styles:g})}return Gi(h(mI,n.has,n.node,n.attributes,hT(f(NT,m,n.children)),kT))}),TI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),wI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(vT,a|r,n)}var i=e.a;return f(vT,r,i|n)}),II=KT(7),AI=KT(36),BI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(vT,r|a,n|i)}),kI=KT(6),NI=KT(38),RI=KT(30),$I=KT(29),_I=r(function(e,t){return{$:"Embedded",a:e,b:t}}),LI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),xI=function(e){return{$:"Transform",a:e}},PI=function(e){return{$:"ChildrenBehind",a:e}},DI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),UI=function(e){return{$:"ChildrenInFront",a:e}},OI=r(function(e,t){return f(LT,M([UT(function(){switch(e.$){case"Above":return f(Ri," ",M([bT.nearby,bT.single,bT.above]));case"Below":return f(Ri," ",M([bT.nearby,bT.single,bT.below]));case"OnRight":return f(Ri," ",M([bT.nearby,bT.single,bT.onRight]));case"OnLeft":return f(Ri," ",M([bT.nearby,bT.single,bT.onLeft]));case"InFront":return f(Ri," ",M([bT.nearby,bT.single,bT.inFront]));default:return f(Ri," ",M([bT.nearby,bT.single,bT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return dw("");case"Text":var e=t.a;return CI(e);case"Unstyled":return(0,t.a)(gT);default:return f(t.a.html,kT,gT)}}()]))}),MI=n(function(e,t,r){var n=f(OI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?PI(M([n])):UI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?PI(f(ka,n,a)):f(DI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(DI,M([n]),i):UI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(DI,f(ka,n,a),i):f(DI,a,f(ka,n,i))}}),FI=r(function(e,t){switch(t.$){case"Generic":return dT(e);case"NodeName":var r=t.a;return f(_I,r,e);default:var n=t.a,a=t.b;return f(_I,n,a)}}),VI=function(e){switch(e.$){case"Left":return bT.alignedHorizontally+" "+bT.alignLeft;case"Right":return bT.alignedHorizontally+" "+bT.alignRight;default:return bT.alignedHorizontally+" "+bT.alignCenterX}},KI=function(e){switch(e.$){case"Top":return bT.alignedVertically+" "+bT.alignTop;case"Bottom":return bT.alignedVertically+" "+bT.alignBottom;default:return bT.alignedVertically+" "+bT.alignCenterY}},HI=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),jI=function(e){return{$:"Moved",a:e}},qI=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return jI(x(r,0,0));case"MoveY":var n=t.a;return jI(x(0,n,0));case"MoveZ":var a=t.a;return jI(x(0,0,a));case"MoveXYZ":var i=t.a;return jI(i);case"Rotate":var i=t.a,o=t.b;return d(HI,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(HI,x(0,0,0),i,x(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 jI(x(s,n,a));case"MoveY":var c=t.a;return jI(x(r,c,a));case"MoveZ":var f=t.a;return jI(x(r,n,f));case"MoveXYZ":var i=t.a;return jI(i);case"Rotate":var i=t.a,o=t.b;return d(HI,u,x(1,1,1),i,o);default:var l=t.a;return d(HI,u,l,x(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(HI,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(HI,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(HI,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(HI,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(HI,u,h,v,y);default:var m=t.a;return d(HI,u,m,p,o)}}}),GI=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(yT,n,M([l(LI,n,"height",r+"px")]));case"Content":return x(f(wI,AI,yT),bT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(wI,YT,yT),bT.heightFill,yr):x(f(wI,YT,yT),bT.heightFillPortion+" height-fill-"+Ni(a),M([l(LI,bT.any+"."+bT.row+" > "+fw("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(LI,u,"min-height",Ni(i)+"px"),c=GI(o),d=c.a,h=c.b,p=c.c;return x(f(wI,zT,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(LI,u,"max-height",Ni(g)+"px"),v=GI(o),d=v.a,h=v.b,p=v.c;return x(f(wI,zT,d),u+" "+h,f(ka,s,p))}},zI=function(e){switch(e.$){case"Px":var t=e.a;return x(yT,bT.widthExact+" width-px-"+Ni(t),M([l(LI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(wI,NI,yT),bT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(wI,QT,yT),bT.widthFill,yr):x(f(wI,QT,yT),bT.widthFillPortion+" width-fill-"+Ni(r),M([l(LI,bT.any+"."+bT.row+" > "+fw("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(LI,i,"min-width",Ni(n)+"px"),u=zI(a),s=u.a,c=u.b,d=u.c;return x(f(wI,JT,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(LI,i,"max-width",Ni(h)+"px"),p=zI(a),s=p.a,c=p.b,d=p.c;return x(f(wI,JT,s),i+" "+c,f(ka,o,d))}},YI=KT(27),WI=r(function(e,t){if(R(e,YI)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),JI=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=rw(n);if("Nothing"===s.$)return{attributes:f(ka,UT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,UT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,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,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(WT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(wI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(WT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(WI,S,I)){var p=nw(I)+" "+e,g=t,v=f(wI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=nw(I)+" "+e,g=t,v=f(wI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(wI,S,r),y=f(qI,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(WT,kI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=bT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(wI,kI,r),y=n,m=f(ka,l(LI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+bT.widthContent,g=t,v=f(wI,NI,f(wI,kI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+bT.widthFill,g=t,v=f(wI,QT,f(wI,kI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+bT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(wI,QT,f(wI,kI,r)),y=n,m=f(ka,l(LI,bT.any+"."+bT.row+" > "+fw("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=zI(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(BI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(WT,II,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(wI,II,r),y=n,m=f(ka,l(LI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=bT.heightContent+" "+e,g=t,v=f(wI,AI,f(wI,II,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=bT.heightFill+" "+e,g=t,v=f(wI,YT,f(wI,II,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+bT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(wI,YT,f(wI,II,r)),y=n,m=f(ka,l(LI,bT.any+"."+bT.column+" > "+fw("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=GI(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(BI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(FI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(FI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(FI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(FI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(FI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(FI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(FI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return dT("p");case"NodeName":var e=t.a;return dT(e);default:var r=t.a,n=t.b;return f(_I,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(TI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(TI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(TI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(TI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(MI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(WT,RI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=VI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(wI,qT,e);case"Right":return f(wI,jT,e);default:return e}}(f(wI,RI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(WT,$I,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=KI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(wI,GT,e);case"Bottom":return f(wI,HT,e);default:return e}}(f(wI,$I,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),QI={$:"Untransformed"},XI=QI,ZI=a(function(e,t,r,n){return l(SI,e,n,v(JI,AT(e),t,yT,XI,yr,yr,mT,$a(r)))}),eA=function(e){return lT(UT(e))},tA=r(function(e,t){var r=t.url,n=t.label;return d(ZI,gT,dT("a"),f(ka,lT(rT(r)),f(ka,lT(nT("noopener noreferrer")),f(ka,lT(aT("_blank")),f(ka,fT(sT),f(ka,oT(sT),f(ka,eA(bT.contentCenterX+" "+bT.contentCenterY),e)))))),hT(M([n])))}),rA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),nA=n(function(e,t,r){return d(rA,e,t,r,1)}),aA=KT(14),iA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),oA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),uA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return tw(t)+"-"+tw(r)+"-"+tw(n)+"-"+tw(a)},sA=function(e){return f(oA,aA,l(iA,"fc-"+uA(e),"color",e))},cA={align:rl,label:"cantConnectNoWeb3",mainParagraphs:M([M([il("You need a web3 provider (such as "),f(tA,M([sA(l(nA,0,0,1))]),{label:il("Metamask"),url:"https://metamask.io/"}),il(") to Connect.")]),M([il("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:Ng},fA={align:rl,label:"invalidUrl",mainParagraphs:M([M([il("I don't understand that URL...")]),M([il("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:Ag},lA=function(e){return{$:"Active",a:e}},dA=fu(f(Ko,Mf,f(Ko,Oh,Ad("Error decoding hex to BigInt")))),hA=function(){return fu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),pA=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}}}}}}}}}}}},gA=function(e){return FE(M([f(Oi,si,e),Fi(ci)]))},vA=f(uh,gA(f(Lh,"status",hA)),f(uh,gA(f(Lh,"root",cu)),l(jE,"logsBloom",cu,l(jE,"logs",Tm(tS),f(uh,gA(f(Lh,"contractAddress",qE)),l(jE,"cumulativeGasUsed",dA,l(jE,"gasUsed",dA,l(jE,"blockNumber",Py,l(jE,"blockHash",WE,l(jE,"transactionIndex",Py,l(jE,"transactionHash",XE,Fi(pA)))))))))))),yA=function(e){var t=e.a;return Mf(t)},mA=f(Ko,yA,sl),bA=r(function(e,t){return _p({decoder:vA,method:"eth_getTransactionReceipt",params:M([mA(t)]),url:e})}),CA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),EA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),SA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),TA=r(function(e,t){return f(wo,function(e){return e.toMsg},f(So,function(e){return e.b},f(So,function(e){return e.onMinedTagger},f(ip,t,e))))}),wA=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}}}}}}}}}}}},IA=function(e){return FE(M([ME(ci),f(Oi,si,e)]))},AA=l(jE,"input",cu,l(jE,"gas",Py,l(jE,"gasPrice",dA,l(jE,"value",dA,l(jE,"to",IA(qE),l(jE,"from",qE,l(jE,"transactionIndex",Py,l(jE,"blockNumber",IA(Py),l(jE,"blockHash",function(e){return f(uu,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},au(t))?Fi(ci):f(Oi,si,e)},cu)}(WE),l(jE,"nonce",Py,l(jE,"hash",XE,Fi(wA)))))))))))),BA=r(function(e,t){return _p({decoder:AA,method:"eth_getTransactionByHash",params:M([mA(t)]),url:e})}),kA=r(function(e,t){return{attempts:e,sleep:t}}),NA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(zp,function(e){return a>0?f(Up,function(e){return f(NA,f(kA,a,n),t)},UE(1e3*n)):kp(e)},t)}),RA=r(function(e,t){return f(Up,function(r){return f(NA,{attempts:30,sleep:1},f(BA,e,t))},UE(250))}),$A=r(function(e,t){return f(NA,{attempts:60,sleep:5},f(bA,e,t))}),_A=function(e){return{$:"Mined",a:e}},LA=function(e){return wo(function(t){return D(t,{status:_A(e)})})},xA=function(e){return{$:"Sent",a:e}},PA=function(e){return wo(function(t){return D(t,{status:xA(e)})})},DA=function(e){return{$:"Signed",a:e}},UA=function(e){return wo(function(t){return D(t,{status:DA(e)})})},OA=function(e){return"Nothing"!==e.$},MA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(ml(r),_o);case"TxSigned":var n=e.a,a=e.b,i=f(ip,n,r.txs);if("Just"===i.$){var o=i.a,u=function(){var e=o.onSignedTagger;if("Just"===e.$){var t=e.a;return f(Hg,t,Np(a))}return _o}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return _o;if("Just"===t.b.$){var r=t.b.a;return f(Hg,r,Np(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Hg,a,Np(fi(e)))}t.a,t.b,t.c;return _o};if("Ok"===a.$){var c=a.a,d=OA(o.onBroadcastTagger)||OA(o.onMinedTagger)?f(el,r.tagger,f(Yp,SA(n),f(RA,r.nodePath,c))):_o;return L(ml(D(r,{txs:l(pp,n,UA(c),r.txs)})),$o(M([u,d])))}var h=a.a;return L(ml(r),$o(M([u,s(h)])))}return L(ml(r),_o);case"TxSent":var n=e.a,p=e.b,g=f(ip,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(el,r.tagger,f(Yp,EA(n),f($A,r.nodePath,v.hash))):_o}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Hg,t,Np(li(v)))}return _o}();return L(ml(D(r,{txs:l(pp,n,PA(v),r.txs)})),$o(M([d,y])))}var h=p.a,s=function(){var e=L(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(Hg,t,Np(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Hg,n,Np(fi("Error with TxSent stuff")))}e.a,e.b;return _o}();return L(ml(r),s)}return L(ml(r),_o);case"TxMined":var n=e.a,m=e.b,b=f(ip,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Hg,a,Np(li(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 $o(M([f(el,r.tagger,f(Yp,f(CA,n,s),Dy(r.nodePath))),f(Hg,a,Np(li(C))),f(Hg,u.toMsg,Np(s))]))}return _o}();return L(ml(D(r,{txs:l(pp,n,LA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Hg,r,Np(fi("TxReceipt decoding failure")))}return _o}();return L(ml(r),S)}return L(ml(r),_o);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(TA,r.txs,n);if("Just"===A.$){var B=A.a;return L(ml(r),f(Hg,B,f(zp,function(e){return Np(D(I,{doneWatching:!0,reOrg:!0}))},f(Up,function(e){return Np(D(I,{doneWatching:!0}))},f(bA,r.nodePath,T.txHash)))))}return L(ml(r),_o)}if(R(w,T.lastCheckedBlock))return L(ml(r),f(el,r.tagger,f(Yp,f(CA,n,T),f(Up,function(e){return Dy(r.nodePath)},UE(2e3)))));var k=f(TA,r.txs,n);if("Just"===k.$){var B=k.a;return L(ml(r),$o(M([f(el,r.tagger,f(Yp,f(CA,n,I),f(Up,function(e){return Dy(r.nodePath)},UE(2e3)))),f(Hg,B,Np(I))])))}return L(ml(r),_o)}var n=e.a,h=e.c.a;return L(ml(r),_o);default:var h=e.a;return L(ml(r),_o)}}),FA=Jt,VA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),KA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),HA=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(KA,"#",e.fragment,l(KA,"?",e.query,U(f(VA,e.port_,U(t,e.host)),e.path)))},jA=r(function(e,t){return e<0?ci:Gl(f(Xl,e,t))}),qA=r(function(e,t){if(e<0)return t;var r=Sh(f(Xl,e,t)),n=f(oc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),GA=n(function(e,t,r){if(e<0)return r;var n=f(Xl,e,r),a=f(oc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),zA=r(function(e,t){return f(GA,e,hs(t))}),YA=r(function(e,t){$v(t);switch(t.$){case"Home":return L(D(e,{submodel:QS}),_o);case"Create":var r=zd(e.wallet),n=f(_l,e.txSentry,f(Ho,Ay,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(JA,U(f(Qi,Ay,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Iy(r.model),txSentry:a}),$o(M([f(el,Ay,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(vy,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(um,e.wallet,r)}return l(im,e.wallet,u,s)}(),c=f(_l,e.txSentry,f(Ho,Ny,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(JA,U(f(Qi,Ny,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:ky(r.model),txSentry:a}),$o(M([f(el,Ny,r.cmd),i]))));case"Marketplace":var d=hv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:By(h)}),$o(M([f(el,ZS,p)])));case"AgentHistory":var g=t.a,v=f(Lo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:wy(y)}),$o(M([f(el,WS,m)])));default:return L(f(uo,fA,e),_o)}}),WA=r(function(e,t){var r=t.a,n=t.b,a=f(QA,JS(e),r),i=a.a,o=a.b;return L(i,$o(M([n,o])))}),JA=r(function(e,t){var r=t.a,n=t.b;return l(Ra,WA,L(r,n),e)}),QA=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(QA,XS,t);case"GotoRoute":var n=r.a;return L(t,f(cy,t.key,n));case"GTag":var a=r.a;return L(t,hy(ly(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),hy(ly(d(Ll,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Av,yy,o,u,s));default:return L(t,my(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(qA,c,t.userNotices)}),_o);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(sy,t.key,HA(e))}var r=h.a;return FA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(XA,g,t);case"GotoRoute":var v=e.a;return L(t,$o(M([hy(ly(d(Ll,"GotoRoute","navigation",$v(v),0))),f(cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),_o);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,cA,t),_o):L(t,fy(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return _o;var t=e.a;return py(f(dy,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Vh,cu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=lA(l(xl,I,w,S)),B=f(Ry,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ol,"Unexpected wallet state encounted when setting commPubkey!",ci),t),_o)}T.a;return L(f(uo,f(ol,"User pubkey set, but I can no longer find the user address!",ci),t),_o)}var N=E.a;return L(l(Pa,uo,f(ol,"error decoding commPubkey from JS",N),t),_o);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(ov,R,_),P=f(_l,t.txSentry,f(Ho,Ay,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(JA,U(f(Qi,Ay,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Iy(x.model),txSentry:O}),$o(M([f(el,Ay,x.cmd),F]))))}return L(t,_o);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(vS,K,j),q=f(_l,t.txSentry,f(Ho,Ny,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(JA,U(f(Qi,Ny,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:ky(x.model),txSentry:O}),$o(M([f(el,Ny,x.cmd),F]))))}return L(t,_o);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Iv,G,Y);return f(JA,f(Qi,ZS,x.appCmds),L(D(t,{submodel:By(x.model)}),f(el,ZS,x.cmd)))}return L(t,_o);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(tl,W,Q),X=f(_l,t.txSentry,f(Ho,WS,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(JA,U(f(Qi,WS,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:wy(x.model),txSentry:O}),$o(M([f(el,WS,x.cmd),F]))))}return L(t,_o);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(Bu,si,f(MA,Z,r))}return L(ci,_o)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(jA,re,t.tradeCaches);if("Nothing"===ae.$)return f(WA,pa(f(ol,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,_o));var ie=ae.a,x=f(YS,ne,ie);return L(D(t,{tradeCaches:l(zA,re,x.tradeCache,t.tradeCaches)}),f(el,eT(re),x.cmd));case"NoOp":return L(t,_o);default:var N=e.a;f(al,"test",N);return L(t,_o)}}),XA=r(function(e,t){return f(YA,t,uy(e))}),ZA=Ge("txIn",VE),eB=je("txOut",Ua),tB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},rB=function(e){return{$:"EventSentryMsg",a:e}},nB=function(e){var t=f(Xy,rB,zh(e)),r=t.a,n=t.b;return x({dataFetchState:l(FS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Yd,"tradeCache init","processing",tB(e),0)]))},aB=function(e){return{$:"InitialNumTradesFetched",a:e}},iB=function(e){return f(SS,e.factory,aB)},oB=function(e){var t=nB(e),r=t.a,n=t.b,a=t.c;return x(r,$o(M([n,iB(r)])),a)},uB=function(e){return{$:"TxSentryMsg",a:e}},sB={align:rl,label:"noWeb3Provider",mainParagraphs:M([M([il("No web3 provider detected. Is "),f(tA,M([sA(l(nA,0,0,1))]),{label:il("Metamask"),url:"https://metamask.io/"}),il(" or some other web3 provider installed and unlocked?")])]),noticeType:Ng},cB={$:"TopLeft"},fB={align:cB,label:"screenToSmall",mainParagraphs:M([M([il("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:Ng},lB={align:rl,label:"wrongWeb3Network",mainParagraphs:M([M([il("Your wallet is set to an incorrect network.")]),M([il("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:Ag},dB={$:"NoneDetected"},hB=function(e){return{$:"OnlyNetwork",a:e}},pB=function(e){return f(wo,zh,xg(e))},gB={$:"ETCMain"},vB={$:"ETCTest"},yB={$:"Expanse"},mB={$:"Kovan"},bB={$:"Mainnet"},CB=function(e){return{$:"Private",a:e}},EB={$:"Rinkeby"},SB={$:"Ropsten"},TB={$:"RskMain"},wB={$:"RskTest"},IB=function(e){switch(e){case 1:return bB;case 2:return yB;case 3:return SB;case 4:return EB;case 30:return TB;case 31:return wB;case 42:return mB;case 41:return gB;case 62:return vB;default:return CB(e)}},AB=n(function(e,t,r){var n=e.a,a=e.b;return ml({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:ap})}),BB=n(function(e,t,n){var a=e.networkId?hB(IB(e.networkId)):dB,i=f(wo,function(e){return l(AB,L(eB,ZA),uB,e)},pB(a)),o=e.width<1024?si(fB):ci,u=f(xa,oB,ro),s=function(){return R(a,dB)?si(sB):"Nothing"===xg(a).$?si(lB):ci}(),c=xC(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=zv(f(Bi,r(function(e,t){return f(Qi,eT(e),t)}),g)),y=$o(f(Bi,r(function(e,t){return f(el,eT(e),t)}),p)),m=f(JA,v,f(XA,t,{key:n,screenWidth:e.width,submodel:QS,time:Dl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),$o(M([y,C])))}),kB=Oe,NB=kB(yr),RB=function(e){return NB},$B=function(e){return{$:"Refresh",a:e}},_B=r(function(e,t){return{$:"Every",a:e,b:t}}),LB=r(function(e,t){return{processes:t,taggers:e}}),xB=Np(f(LB,ap,ap)),PB=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(sS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),DB=Ne,UB=r(function(e,t){var r=e.a,n=e.b,a=f(ip,r,t);if("Nothing"===a.$)return l(Nl,r,M([n]),t);var i=a.a;return l(Nl,r,f(ka,n,i),t)}),OB=Be,MB=r(function(e,t){return{$:"Zone",a:e,b:t}}),FB=ca,VB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=OB(f(FB,n,f(yp,e,n)));return f(Up,function(t){return l(VB,e,a,l(Nl,n,t,r))},i)}return Np(r)}),KB=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 x(n,a,f(Up,function(e){return i},DB(t)))}),u=l(Ra,UB,ap,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(Nl,e,r,i),o)}),d=p(PB,s,c,o,u,i,x(yr,ap,Np(gr))),h=d.a,g=d.b,v=d.c;return f(Up,function(e){return Np(f(LB,u,e))},f(Up,function(t){return l(VB,e,h,g)},v))}),HB=function(e){return we(function(t){t(Se(e(Date.now())))})}(Dl),jB=n(function(e,t,r){var n=f(ip,t,r.taggers);if("Nothing"===n.$)return Np(r);var a=n.a,i=function(t){return Vp(f(xa,function(r){return f(vp,e,r(t))},a))};return f(Up,function(e){return Np(r)},f(Up,i,HB))}),qB=r(function(e,t){var r=t.a,n=t.b;return f(_B,r,f(Da,e,n))});pn.Time=Pe(xB,KB,jB,0,qB);var GB=Ue("Time"),zB=r(function(e,t){return GB(f(_B,e,t))}),YB=function(e){return f(zB,2e3,$B)},WB=function(e){return NB},JB=function(e){return{$:"DecryptionFinished",a:e}},QB=Ge("decryptionFinished",VE),XB=Ge("encryptionFinished",VE),ZB=function(e){return{$:"EncryptionFinished",a:e}},ek=function(e){return{$:"Refresh",a:e}},tk=function(e){return kB(M([f(zB,3e3,ek),XB(ZB),QB(function(e){return oE(JB(e))})]))},rk=yn,nk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return NB;case"CreateModel":t.a;return f(rk,Ay,YB());case"TradeModel":t.a;return f(rk,Ny,tk());case"MarketplaceModel":t.a;return f(rk,ZS,WB());default:t.a;return f(rk,WS,RB())}},ak=Ge("userPubkeyResult",VE),ik=Ge("walletSentryPort",VE),ok={$:"CheckForNewTrades"},uk={$:"UpdateTradePhases"},sk=function(e){return kB(M([f(zB,5e3,function(e){return ok}),f(zB,3e3,function(e){return uk})]))},ck=function(e){return{$:"Tick",a:e}},fk=function(e){return{$:"UserPubkeySet",a:e}},lk=function(e){return{$:"WalletStatus",a:e}},dk=function(e){return f(ol,"Error decoding JS walletSentry: "+e,ci)},hk=function(e){return{$:"ErrorDecoding",a:e}},pk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),gk=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Lh,"ref",DC),f(Lh,"txHash",gA(XE))),vk=function(e){var t=f(Vh,gk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(pk,r.ref,li(a))}return f(pk,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return hk("Error decoding tx data")},yk=function(e){var t=e.a;return f(rk,t.tagger,t.inPort(vk))},mk=f(Oi,IB,DC),bk=fu(f(Ko,Ql,f(Ko,Ad("Failure decoding stringy int"),Zo(IB)))),Ck=FE(M([bk,mk])),Ek=r(function(e,t){return{account:e,networkId:t}}),Sk=l(Mi,Ek,f(Lh,"account",gA(qE)),f(Lh,"networkId",Ck)),Tk=n(function(e,t,r){var n=f(Vh,Sk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),wk=function(e){var t=f(Ko,dk,f(Ko,pa,JS));return kB(U(M([f(zB,1e3,ck),ik(f(Tk,t,lk)),f(Nc,NB,f(wo,yk,e.txSentry)),ak(fk),kB(f(Bi,r(function(e,t){return f(rk,eT(e),t)}),f(xa,sk,e.tradeCaches)))]),M([nk(e)])))},Ik=function(e){return{$:"LinkClicked",a:e}},Ak=function(e){return{$:"UrlChanged",a:e}},Bk=n(function(e,t,r){return d(rA,e/255,t/255,r/255,1)}),kk=l(Bk,10,33,108),Nk={$:"Generic"},Rk=Nk,$k=r(function(e,t){return d(ZI,gT,Rk,f(ka,fT(sT),f(ka,oT(sT),e)),hT(M([t])))}),_k=function(e){return{$:"Fill",a:e}},Lk=_k(1),xk=Hi,Pk=function(e){return{$:"Px",a:e}},Dk=Pk,Uk=KT(8),Ok=function(e){return f(oA,Uk,l(iA,"bg-"+uA(e),"background-color",e))},Mk=f($k,M([fT(Lk),oT(Dk(150)),Ok(kk)]),xk),Fk=function(e){return{$:"GotoRoute",a:e}},Vk={$:"Active"},Kk={$:"Important"},Hk={$:"Normal"},jk=l(nA,1,1,1),qk=KT(2),Gk=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),zk=r(function(e,t){return R(e,t)?f(oA,qk,h(Gk,"p-"+Ni(e),e,e,e,e)):f(oA,qk,h(Gk,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Yk=KT(21),Wk=r(function(e,t){return{$:"Class",a:e,b:t}}),Jk=f(Wk,Yk,bT.cursorPointer),Qk=KT(17),Xk=function(e){return f(oA,Qk,l(LI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},Zk=function(e){return{$:"Normal",a:e}},eN=An,tN=r(function(e,t){return f(eN,e,Zk(t))}),rN=function(e){return f(tN,"click",Fi(e))},nN=f(Da,lT,rN),aN=KT(13),iN=f(Wk,aN,bT.textSemiBold),oN=KT(4),uN=function(e){return{$:"FontSize",a:e}},sN=function(e){return f(oA,oN,uN(e))},cN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([Xk(4),Ok(l(nA,0,0,1))]);default:return M([Xk(4),Ok(l(nA,.9,0,0))])}}();return f($k,U(M([f(zk,23,12),sN(22),iN,sA(jk),Jk,nN(t)]),n),il(e))}),fN=l(Bk,244,0,103),lN=function(e){return{$:"AlignX",a:e}},dN={$:"CenterX"},hN=lN(dN),pN=KT(3),gN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),vN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),yN=function(e){return f(oA,pN,l(gN,f(vN,e,e),e,e))},mN=function(e){return{$:"Describe",a:e}},bN={$:"Paragraph"},CN=r(function(e,t){return d(ZI,_T,Rk,f(ka,mN(bN),f(ka,fT(Lk),f(ka,yN(5),e))),hT(t))}),EN=f(Wk,aN,bT.bold),SN=f($k,M([sN(29),sA(jk),EN,hN,Jk,nN(Fk(Pv))]),f(CN,yr,M([il("DAI"),f($k,M([sA(fN)]),il("Hard"))]))),TN={$:"Right"},wN=lN(TN),IN={$:"AsColumn"},AN=IN,BN=r(function(e,t){return d(ZI,AN,Rk,f(ka,eA(bT.contentTop+" "+bT.contentLeft),f(ka,oT(sT),f(ka,fT(sT),e))),hT(t))}),kN={$:"AsRow"},NN=kN,RN=r(function(e,t){return d(ZI,NN,Rk,f(ka,eA(bT.contentLeft+" "+bT.contentCenterY),f(ka,fT(sT),f(ka,oT(sT),e))),hT(t))}),$N=function(e){return f(RN,M([fT(Lk),yN(30),f(zk,30,17)]),M([l(cN,"Browse Offers",Fk(Dv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Vk}return Hk}()),l(cN,"Create a New Offer",Fk(xv),function(){return"CreateModel"===e.submodel.$?Vk:Hk}()),function(){var t=Vd(e.wallet);if("Just"===t.$){var r=t.a;return l(cN,"My Trades",Fk(Lv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Vk:Hk}return Hk}())}return l(cN,"Connect to Wallet",XS,Kk)}(),f(BN,M([wN,yN(0),f(zk,8,0)]),M([SN]))]))},_N=rA,LN=r(function(e,t){return f($k,M([Xk(4),Ok(d(_N,0,0,1,.1)),sA(l(Bk,16,7,234)),sN(e),iN,f(zk,15,13)]),il(ul(t)))}),xN=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),PN=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(oA,qk,h(Gk,"p-"+Ni(t),t,t,t,t)):f(oA,qk,h(Gk,d(xN,t,r,n,a),t,r,n,a))},DN=function(e){return function(){var t=Vd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?xk:f(RN,M([yN(10),PN({bottom:20,left:20,right:20,top:10})]),M([f($k,M([sN(24),iN]),il("Trade History for User")),f(LN,18,e.agentAddress)]))},UN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},ON=function(e){return hl(e)},MN={$:"BurnWindow"},FN={$:"FiatPrice"},VN={$:"Margin"},KN={$:"Offer"},HN={$:"PaymentWindow"},jN=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),qN=TI,GN={$:"Left"},zN=lN(GN),YN=function(e){return{$:"AlignY",a:e}},WN={$:"CenterY"},JN=YN(WN),QN=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(ZI,AN,dT("label"),e,hT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(ZI,gT,Rk,a,hT(M([i])));switch(n.$){case"Above":return d(ZI,AN,dT("label"),e,hT(M([o,r])));case"Below":return d(ZI,AN,dT("label"),e,hT(M([r,o])));case"OnRight":return d(ZI,NN,dT("label"),e,hT(M([r,o])));default:return d(ZI,NN,dT("label"),e,hT(M([o,r])))}}),XN=function(e){return{$:"Label",a:e}},ZN={$:"NoAttribute"},eR=function(e){if("HiddenLabel"===e.$){var t=e.a;return mN(XN(t))}return ZN},tR=function(e){return"HiddenLabel"===e.$},rR=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return su("No key matched");var n=r.a;return Fi(n)},r=f(uu,t,f(Lh,"key",cu));return lT(f(tN,"keyup",r))},nR=function(e){return f(Nn,"tabIndex",Ni(e))},aR=f(Da,lT,nR),iR={$:"LivePolite"},oR=mN(iR),uR=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([tR(r)?ZN:yN(6),lT(rN(i(!a))),oR,rR(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),aR(0),Jk,zN,fT(Lk)]),e);return l(QN,o,r,d(ZI,gT,Rk,M([lT(f(qN,"role","checkbox")),lT(f(qN,"aria-checked",a?"true":"false")),eR(r),JN,oT(Lk),fT(sT)]),hT(M([n(a)]))))}),sR=Br,cR=function(e){return e*sR/180},fR=KT(26),lR=function(e){return{$:"MoveY",a:e}},dR=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),hR=function(e){return f(dR,fR,lR(-e))},pR=KT(24),gR=r(function(e,t){return{$:"Rotate",a:e,b:t}}),vR=function(e){return f(dR,pR,f(gR,x(0,0,1),e))},yR=KT(28),mR=function(e){return f(oA,yR,l(iA,"bc-"+uA(e),"border-color",e))},bR=KT(19),CR=function(e){return gd(M([e.inset?"box-inset":"box-",uw(e.offset.a)+"px",uw(e.offset.b)+"px",uw(e.blur)+"px",uw(e.size)+"px",uA(e.color)]))},ER=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(oA,bR,l(LI,CR(t),"box-shadow",cw(t)))},SR=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),TR=function(e){return f(oA,YI,h(SR,"b-"+Ni(e),e,e,e,e))},wR=r(function(e,t){return f(oA,YI,h(SR,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),IR=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?TR(r):f(wR,n,r):f(oA,YI,h(SR,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},AR=KT(12),BR=f(Wk,AR,bT.textCenter),kR=l(nA,1,1,1),NR=function(e){return f($k,M([eA("focusable"),fT(Dk(14)),oT(Dk(14)),sA(kR),JN,sN(9),BR,Xk(3),mR(e?l(nA,59/255,.6,252/255):l(nA,211/255,211/255,211/255)),ER({blur:1,color:e?d(_N,238/255,238/255,238/255,0):l(nA,238/255,238/255,238/255),offset:L(0,0),size:1}),Ok(e?l(nA,59/255,.6,252/255):kR),TR(e?0:1)]),e?f($k,M([mR(kR),oT(Dk(6)),fT(Dk(9)),vR(cR(-45)),hN,JN,hR(1),IR({bottom:2,left:2,right:0,top:0})]),xk):xk)},RR=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),$R={$:"OnRight"},_R=RR($R),LR=r(function(e,t){return f(uR,yr,{checked:t.checked,icon:NR,label:f(_R,yr,il(t.label)),onChange:f(jN,e,t.label)})}),xR={$:"Top"},PR=YN(xR),DR=f(Wk,aN,bT.textMedium),UR=function(e){return f(BN,M([yN(15),PR]),M([f($k,M([sN(28),DR]),il(e.label)),f(BN,M([yN(5)]),f(xa,LR(e.label),e.options))]))},OR=function(e){return f(RN,M([yN(20)]),f(xa,UR,e))},MR=function(e){return{$:"FiltersMsg",a:e}},FR=KT(20),VR=f(Wk,FR,bT.clip),KR=_k,HR=function(e){return f(oA,qk,h(Gk,"p-"+Ni(e),e,e,e,e))},jR=r(function(e,t){return f($k,M([fT(KR(e)),oT(Dk(60)),VR,Ok(jk)]),f($k,M([HR(12),JN,fT(Lk)]),t))}),qR=function(e){switch(e.$){case"Phase":return 1;case"Expires":return 2;case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},GR=function(e){return{$:"JustImage",a:e}},zR=GR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),YR=tT("alt"),WR=function(e){return f(tT,"src",rt(e))},JR=r(function(e,t){var r=t.src,n=t.description,a=f(hl,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(ZI,gT,Rk,f(ka,eA(bT.imageContainer),e),hT(M([d(ZI,gT,dT("img"),U(M([lT(WR(r)),lT(YR(n))]),a),hT(yr))])))}),QR=r(function(e,t){if("None"===t.$)return xk;var r=t.a;return f(JR,e,r)}),XR=GR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),ZR=function(e){return{$:"ChangeSort",a:e}},e$=function(e){return f($k,M([DR,sN(17)]),il(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},t$=r(function(e,t){return f(RN,M([yN(5),Jk,nN(ZR(e))]),M([e$(e),function(){if("Just"===t.$){var e=t.a;return f($k,M([JN]),f(QR,M([fT(Dk(8))]),function(){return"Ascending"===e.$?XR:zR}()))}return xk}()]))}),r$=r(function(e,t){return f(jR,qR(t),f(t$,t,e))}),n$=r(function(e,t){return f(RN,M([fT(Lk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(r$,r,t)},t))}),a$=l(Bk,150,150,150),i$=r(function(e,t){return f(hl,function(t){return f(vh,function(e){return f(gh,function(e){return e.checked&&e.testTrade(t)},e.options)},e)},t)}),o$=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},u$=r(function(e,t){return f(Ju,e.amount,t.amount)}),s$=r(function(e,t){return f(Ju,Ml(e),Ml(t))}),c$=n(function(e,t,r){return f(e,r,t)}),f$=function(e){var t=e.a;return(R(e.b,No)?c$:Ua)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(f$,L(dv,No),e,t):l(c$,Uu,o$(e.state.phase),o$(t.state.phase))});case"Expires":return r(function(e,t){return f(uv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(s$,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(u$,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(Nc,ma,l(Kd,r(function(e,t){return f(Uu,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(uv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(uv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},l$=l(Bk,233,237,242),d$=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),h$=function(e){return f($k,M([fT(Lk),oT(Lk),VR]),f(CN,M([sN(12)]),M([il(e.info)])))},p$=function(e){return f(Nc,xk,f(wo,h$,Gl(e)))},g$=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"}},v$=function(e){return{$:"TimeLeft",a:e}},y$=function(e){return{$:"TimeUp",a:e}},m$=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 Dl(0)}}),b$=r(function(e,t){return Dl(Md(e)-Md(t))}),C$=r(function(e,t){var r=f(m$,t.state.phase,t),n=f(b$,e,t.state.phaseStartTime),a=f(b$,r,n);return Md(a)>0?v$(L(a,r)):y$(r)}),E$=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},S$=l(nA,0,0,0),T$=l(Bk,51,183,2),w$=function(e){var t=Mu(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Go(n));return n+(function(){if(a){return f(Qo,a+1,f(Yo,1,uw(r)))}return""}()+"%")},I$=r(function(e,t){return GR({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"}()})}),A$=n(function(e,t,r){return f(QR,f(ka,oT(Dk(34)),e),f(I$,t,r))}),B$=r(function(e,t){var r=w$(t);if("0%"===r)return f($k,M([sN(16)]),il("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?T$:fN;return f(RN,M([yN(4)]),M([l(A$,yr,a,si(i)),f($k,M([sA(o),sN(16)]),il(n))]))}),k$=GR,N$=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(Nl,r,n,t)}),ap,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,k$({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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","₫")]))),R$=function(e){return f(Nc,"",f(wo,Qa,f(ip,e,N$)))},$$=function(e){return Go(e)<=3?e:$$(f(md,3,e))+","+f(tu,3,e)},_$=function(e){return $$(yd(e))},L$=function(e){return U(R$(e.fiatType),_$(e.amount))},x$=function(e){var t=function(){var t=f(ip,e.fiatType,N$);if("Nothing"===t.$)return xk;var r=t.a,n=(r.a,r.b);return f(QR,M([oT(Dk(26))]),n)}();return f(RN,M([yN(4)]),M([t,f($k,M([sA(d(_N,0,0,0,.5)),DR,fT(Dk(50))]),il(e.fiatType)),il(L$(e))]))},P$=function(e){return Md(e)<0},D$=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),U$=function(e){var t=lg(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(D$,zb(t),zb(r),zb(n),zb(a))}(f(Nc,L(Fu(0),Fu(0)),f(ms,n,Fu(60))))}(f(Nc,L(Fu(0),Fu(0)),f(ms,r,Fu(3600))))}(f(Nc,L(Fu(0),Fu(0)),f(ms,t,Fu(86400))))},O$=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!P$(a)){var u=r(function(e,t){return U(l(Is,2,P("0"),Ni(e)),t)}),s=Md(a)>0?i:o,c=U$(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(RN,U(M([yN(5)]),e),M([f($k,U(M([sA(h)]),t),il(f(u,c.days,"d"))),f($k,U(M([sA(d)]),t),il(f(u,c.hours,"h"))),f($k,U(M([sA(s)]),t),il(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Dl(0);e=p,t=g,n=v,a=y}}),M$={$:"Behind"},F$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),V$=function(e){return f(F$,M$,e)},K$=r(function(e,t){var r=nv(200*e),n=200-r,a=f($k,M([fT(KR(n))]),xk),i=M([oT(Dk(3)),Xk(20)]),o=f($k,U(i,M([fT(KR(r)),Ok(t)])),xk),u=f($k,U(i,M([fT(Lk),Ok(l$)])),xk);return f(RN,M([fT(Lk),V$(u)]),M([o,a]))}),H$=l(nA,1,1,0),j$=r(function(e,t){return Md(e)/Md(t)}),q$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(j$,o,u),c=(f($k,M([hN]),d(O$,yr,yr,L(a,i),o)),s<.1?fN:s<.2?H$:T$);return f(BN,U(M([yN(5)]),e),M([d(O$,M([hN]),t,L(a,i),o),f(K$,1-s,c)]))}),G$=function(e){var t=bd(Ml(e)),r=f(zl,".",t);if(!r.b)return t;if(r.b.b){al("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Qo,3,t);case 1:return f(Qo,4,f(Nc,t,f(wo,uw,f(wo,function(e){return e/100},f(wo,Ka,f(wo,nv,f(wo,ti(100),Sd(t))))))));default:var n=r.a;return f(Nc,f(Qo,n,t),f(wo,Ni,f(wo,nv,Sd(t))))}},z$=n(function(e,t,r){return f(jR,qR(t),function(){switch(t.$){case"Phase":return il(E$(r.state.phase));case"Expires":if("Open"===r.state.phase.$){var n=f(C$,e,r);if("TimeLeft"===n.$){var a=n.a,i=f(j$,a.a,a.b)<.05?fN:S$;return d(q$,M([fT(Lk)]),M([sN(16)]),L(i,l$),a)}var o=n.a;return d(q$,M([fT(Lk)]),M([sN(16)]),L(fN,l$),L(Dl(0),o))}return xk;case"Offer":return f(RN,M([yN(5)]),M([il(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(G$(r.parameters.tradeAmount)+" ")+g$(r.factory))]));case"FiatPrice":return x$(r.terms.price);case"Margin":var u=R(r.parameters.initiatorRole,co);return f(Nc,xk,f(wo,B$(u),r.derived.margin));case"PaymentWindow":var s=function(){return"Seller"===r.parameters.initiatorRole.$?fN:T$}(),c=_(Md(r.parameters.autoabortInterval),216e5)<0?s:S$;return d(O$,yr,yr,L(c,l$),r.parameters.autoabortInterval);default:var s=function(){return"Seller"===r.parameters.initiatorRole.$?T$:fN}(),c=_(Md(r.parameters.autoabortInterval),216e5)<0?s:S$;return d(O$,yr,yr,L(c,l$),r.parameters.autoreleaseInterval)}}())}),Y$=n(function(e,t,r){return f(BN,M([fT(Lk),yN(1),Ok(l$),Jk,nN(f(d$,r.factory,r.id))]),M([f(RN,M([fT(Lk),yN(1)]),f(xa,function(t){return l(z$,e,t,r)},t)),f(jR,1,p$(r.terms.paymentMethods))]))}),W$=Er,J$=a(function(e,t,r,n){return f(BN,M([fT(Lk),TR(2),Xk(8),mR(a$),yN(2),Ok(a$),VR]),f(xa,f(Y$,e,r),f(W$,f$(t.orderBy),f(i$,t.filtersModel,n))))}),Q$=a(function(e,t,r,n){return f(BN,M([fT(Lk),oT(Lk),HR(30),yN(5)]),M([f(Yi,MR,OR(t.filtersModel)),f(n$,t.orderBy,r),d(J$,e,t,r,n)]))}),X$=n(function(e,t,r){return R(t,yr)?xk:f(Yi,Oo,d(Q$,e,r.tradeTable,M([Ro,KN,FN,VN,HN,MN]),t))}),Z$=function(e){return f(hl,function(e){return ab(e.parameters)},BS(e))},e_={$:"NoneFound"},t_={$:"AllFetched"},r_={$:"FetchingTrades"},n_={$:"QueryingNumTrades"},a_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return n_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?r_:t_}return e_},i_=n(function(e,t,r){var n=zv(f(xa,function(e){return f(ON,UN(r),Z$(e))},t)),a=n,i=function(e){return f($k,M([sN(24),iN,sA(a$),hN,HR(20)]),il(e))},o=f(vh,Ja(e_),f(xa,a_,t))?M([i("No trades found.")]):f(xa,i,xC(f(xa,function(e){switch(a_(e).$){case"QueryingNumTrades":return si(tB(e.factory)+"Querying Factory...");case"NoneFound":return ci;case"FetchingTrades":return si(tB(e.factory)+"Fetching Trades");default:return ci}},t)));return f(BN,M([yN(10),fT(Lk)]),M([function(){return o.b?f(BN,M([yN(5)]),o):xk}(),l(X$,e,a,r)]))}),o_=n(function(e,t,r){return f(BN,M([Xk(5),Ok(jk),fT(Lk),oT(Lk),f(zk,0,20)]),M([DN(r),l(i_,e,t,r)]))}),u_=function(e){return{$:"ShowCurrencyDropdown",a:e}},s_={$:"AbortCreate"},c_=function(e){return{$:"AppCmd",a:e}},f_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),l_=function(e){return f(xa,function(e){return M([f($k,M([sA(fN)]),il("Caution! ")),il(e)])},xC(M([R(f(uv,e.autoreleaseInterval,Dl(12e5)),ba)?si(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."}()):ci,R(f(uv,e.autoabortInterval,Dl(36e5)),ba)?si(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.'}()):ci])))},d_=l(nA,0,0,1),h_=function(e){return f($k,M([PN({bottom:5,left:5,right:5,top:0}),nN(e),Xk(30),Ok(d(_N,1,1,1,.4)),TR(1),mR(d(_N,0,0,0,.3)),Jk,sN(14)]),f($k,M([sA(d(_N,0,0,0,.7))]),il("x")))},p_=Bn,g_=p_,v_=lT,y_=r(function(e,t){return f($k,M([V$(f($k,M([Ok(e),v_(f(g_,"position","fixed")),v_(f(g_,"z-index","1000")),v_(f(g_,"top","0")),v_(f(g_,"left","0")),v_(f(g_,"width","100%")),v_(f(g_,"height","100%"))]),xk)),fT(Lk),oT(Lk)]),t)}),m_={$:"InFront"},b_=function(e){return f(F$,m_,e)},C_=r(function(e,t){return{$:"Max",a:e,b:t}}),E_=r(function(e,t){return f(C_,e,t)}),S_=n(function(e,t,r){return l(Pa,y_,d(_N,0,0,.3,.6),f($k,U(M([hN,JN,fT(f(E_,500,sT)),Ok(jk),Xk(8),b_(f($k,M([wN,PR]),h_(r)))]),e),t))}),T_=r(function(e,t){if("Nothing"===t.$)return xk;var r=t.a;return f($k,U(M([Xk(5),mR(l(nA,.9,0,0)),TR(1),Ok(l(nA,1,.4,.4)),HR(5),hN,JN,fT(f(E_,200,sT)),sN(14)]),e),f(CN,yr,M([il(r)])))}),w_={$:"Above"},I_=function(e){return f(F$,w_,e)},A_=r(function(e,t){return f($k,M([Xk(4),f(zk,25,17),sN(18),iN,Ok(l$),I_(f(T_,M([hR(5)]),t))]),il(e))}),B_=a(function(e,t,r,n){return d(rA,e/255,t/255,r/255,n)}),k_=d(B_,1,31,52,.64),N_=KT(32),R_={$:"Active"},$_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),__=$n,L_=r(function(e,t){switch(t.$){case"NoAttribute":return ZN;case"Describe":var r=t.a;return mN(r);case"AlignX":var n=t.a;return lN(n);case"AlignY":var a=t.a;return YN(a);case"Width":var n=t.a;return cT(n);case"Height":var n=t.a;return iT(n);case"Class":var n=t.a,a=t.b;return f(Wk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(oA,i,o);case"Nearby":var u=t.a,s=t.b;return f(F$,u,f(zi,e,s));case"Attr":var c=t.a;return lT(f(__,e,c));default:var l=t.a,d=t.b;return f(dR,l,d)}}),x_=function(e){return f(L_,Kg,e)},P_=r(function(e,t){var r=t.a,n=t.b,a=x_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(qI,n,o));default:return L(r,n)}}),D_=function(e){var t=l(Ra,P_,L(yr,QI),e),r=t.a,n=t.b;return f(ka,xI(n),r)},U_=function(e){return f(oA,N_,f($_,R_,D_(e)))},O_=KT(33),M_={$:"Hover"},F_=function(e){return f(oA,O_,f($_,M_,D_(e)))},V_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f($k,M([Xk(4),Jk,nN(n),f(zk,25,17),sA(t),sN(18),iN,Ok(a),U_(M([Ok(o)])),F_(M([Ok(i)]))]),il(r))}),K_=r(function(e,t){return d(V_,x(d(_N,1,0,0,1),d(_N,1,0,0,.8),d(_N,1,0,0,.6)),jk,e,t)}),H_=function(e){return y_(d(_N,0,0,.3,.6))(f(BN,M([yN(10),hN,JN,Ok(d(_N,0,0,0,.5)),Xk(8),HR(20)]),f(xa,function(e){return f(CN,M([hN,JN,sN(20),iN,sA(jk),BR]),M([e]))},e)))},j_=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+yA(t)}e.a;return"https://kovan.etherscan.io/tx/"+yA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+yA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+yA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+yA(t)}}),q_={$:"Bottom"},G_=YN(q_),z_=eA(bT.underline),Y_=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(il(G$(Sb(a))),f(K_,"Yes, I definitely want to open this trade.",l(f_,r,n,a)))}return L(il("??"),f(A_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(S_,yr,f(BN,M([yN(20),HR(20),hN,oT(Lk),BR]),M([f($k,M([sN(26),iN,hN,JN]),il("Just to Confirm...")),f(BN,M([yN(20),hN,JN]),f(xa,CN(M([hN,sN(18),DR,sA(k_)])),U(l_(n),U(M([M([il("You will deposit "),i,il(" "+g$(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([il("This ususally requires two Metamask signatures. Your "+g$(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f($k,M([G_,hN]),o)])),s_);case"ApproveNeedsSig":var u=e.a;return f($k,M([nN(c_(d(Yd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),H_(M([il("Waiting for user signature for the approve call."),il("(check Metamask!)"),il("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f($k,M([nN(c_(d(Yd,"txChainModal clicked","misclick","ApproveMining",0)))]),H_(M([il("Mining the initial approve transaction..."),f(tA,M([z_,sA(d_)]),{label:il("See the transaction on Etherscan"),url:f(j_,eo(u),s)}),il("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f($k,M([nN(c_(d(Yd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),H_(M([il("Waiting for user signature for the create call."),il("(check Metamask!)")])));default:var r=e.a,s=e.b;return f($k,M([nN(c_(d(Yd,"txChainModal clicked","misclick","CreateMining",0)))]),H_(M([il("Mining the final create call..."),f(tA,M([z_,sA(d_)]),{label:il("See the transaction on Etherscan"),url:f(j_,r,s)}),il("You will be redirected when it's mined.")])))}}),W_=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return xk;var r=t.a;return f(Y_,r,e)},J_=function(e){return{$:"TradeAmountChanged",a:e}},Q_=tT("id"),X_=v_(Q_("inputError")),Z_=l(Bk,109,127,138),eL=GR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),tL=function(e){return f(QR,f(ka,oT(Dk(26)),e),eL)},rL=function(e){return f(RN,M([yN(4)]),M([tL(yr),f($k,M([sN(24),DR,sA(Z_)]),il(g$(e)))]))},nL=function(e){return{$:"HiddenLabel",a:e}},aL=nL,iL=tT("type"),oL=function(e){return L(e,!0)},uL=function(e){return{$:"MayStopPropagation",a:e}},sL=r(function(e,t){return f(eN,e,uL(t))}),cL=r(function(e,t){return l(La,Lh,t,e)}),fL=f(cL,M(["target","value"]),cu),lL=function(e){return f(sL,"input",f(Oi,oL,f(Oi,e,fL)))},dL=KT(0),hL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),pL=function(e){var t=function(e){return 1-e}(f(mc,1,f(ei,0,e)));return f(oA,dL,f(hL,"transparency-"+tw(t),t))},gL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),vL=f(Da,lT,qN("autocomplete")),yL=l(nA,136/255,138/255,133/255),mL=l(nA,186/255,189/255,182/255),bL=f(zk,12,12),CL=M([bL,Xk(3),mR(mL),Ok(kR),TR(1),yN(3),fT(Lk)]),EL=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},SL=function(e){return f(gh,EL,e)?ZN:eA("focusable")},TL=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},wL=ye,IL=r(function(e,t){return f(kn,e,wL(t))}),AL=IL("spellcheck"),BL=f(Da,lT,AL),kL=W,NL=KT(47),RL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(kL(e))),o=(i-1)*t+f(Nc,0,f(wo,a,r))+f(Nc,0,f(wo,a,n));return f(oA,NL,l(LI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),$L=tT("value"),_L=f(Da,lT,$L),LL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(ZT,"width",n)?L(r,n):L(f(ka,e,r),f(dS,"width",n));case"Height":e.a;return f(ZT,"height",n)?L(r,n):L(f(ka,e,r),f(dS,"height",n));case"Describe":e.a;return f(ZT,"described",n)?L(r,n):L(f(ka,e,r),f(dS,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(ZT,"align-x",n)?L(r,n):L(f(ka,e,r),f(dS,"align-x",n));case"AlignY":return f(ZT,"align-y",n)?L(r,n):L(f(ka,e,r),f(dS,"align-y",n));default:return f(ZT,"transform",n)?L(r,n):L(f(ka,e,r),f(dS,"transform",n))}}),L(yr,Qy),e).a},xL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,LL(e))}),PL=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}},DL=f(Da,Gi,hs),UL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([lT(lL(n.onChange))]),o=U(CL,t),u=f(xL,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(hl,TL,o),c=f(xL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(xL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(xL,o,function(e){return"Nearby"===e.$})),p=f(hl,f(Da,Xu,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([_L(n.text),lT(iL(a)),BL(e.spellchecked),eA(bT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return ZN;var r=t.a;return vL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(PL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(gL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(gL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(Nc,5,c);return x("textarea",U(M([BL(e.spellchecked),eA(bT.inputMultiline),f(Nc,ZN,f(wo,vL,e.autofill)),function(){if("Nothing"===u.$)return ZN;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return PN({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?ZN:s.a?d(RL,n.text,v,u,g):ZN}()]),h),M([DL(bI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(ZI,gT,Rk,f(ka,fT(Lk),zv(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([b_(f($k,f(ka,bL,U(s,U(M([sA(yL),eA(bT.noTextSelection+" "+bT.passPointerEvents),mR(d(_N,0,0,0,0)),Ok(d(_N,0,0,0,0)),oT(Lk),fT(Lk),pL(""===n.text?1:0)]),r))),a))])}()]))),hT(M([d(ZI,gT,dT(v),zv(M([M([SL(t),eR(n.label)]),y,i])),hT(m))])));return l(QN,f(ka,f(Wk,Yk,bT.cursorText),f(ka,tR(n.label)?ZN:yN(5),f(ka,oR,u))),n.label,b)}),OL=UL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),ML=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(OL,M([fT(Lk),oT(Dk(40)),TR(0)]),{label:aL(r),onChange:i,placeholder:n,text:a});return f(RN,U(M([yN(5)]),e),xC(M([f(wo,$k(M([zN])),o),si(s),f(wo,$k(M([wN])),u)])))}),FL={$:"Below"},VL=function(e){return f(F$,FL,e)},KL=function(e){return f(dR,fR,lR(e))},HL=n(function(e,t,r){return p(ML,M([fT(Dk(150)),DR,sN(24),VL(f(T_,M([X_,KL(5)]),r))]),L(ci,si(f($k,M([nN(c_(d(Yd,"click","misclick","dai symbol in dai input",0)))]),rL(e)))),"dai input",ci,t,J_)}),jL=$k(M([mR(l$),IR({bottom:2,left:0,right:0,top:0})])),qL=r(function(e,t){return f(BN,M([yN(10)]),M([f($k,M([sN(17),iN]),il(e)),t]))}),GL=r(function(e,t){return jL(f(qL,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(HL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),zL=function(e){return f(Nc,_E,xg(e))},YL=function(e){var t=function(){var t=ld(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+G$(f(Vl,r,100))+" "+g$(zL(e.wallet))+"."}return"There is a 1% fee."}();return f(RN,M([hN,f(zk,20,10),Ok(l(Bk,10,33,108)),Xk(8),yN(5),nN(c_(d(Yd,"click","misclick","fee notify element",0)))]),M([f($k,M([sN(18),sA(l(Bk,0,226,255)),iN]),il(t)),f($k,M([sN(17),sA(jk),DR]),il("We only collect this fee when trades resolve successfully."))]))},WL=function(e){return{$:"FiatAmountChanged",a:e}},JL=function(e){return{$:"FiatTypeChanged",a:e}},QL=r(function(e,t){return l(sS,n(function(t,r,n){return f(e,t,r)?l(Nl,t,r,n):n}),ap,t)}),XL=function(e){return f(QL,r(function(t,r){return f(Gg,e,t)}),N$)},ZL=GR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),ex=function(e){return f(QR,M([oT(Dk(26))]),f(Nc,ZL,f(wo,iu,f(ip,e,N$))))},tx=function(e){return v_(f(sL,"click",Fi(L(e,!0))))},rx=DL,nx=function(e){return{$:"AppendProperty",a:e}},ax=r(function(e,t){return nx(e+":"+t)}),ix=r(function(e,t){return f(ax,e,t.value)}),ox=ix("cursor"),ux={$:"Compatible"},sx={cursor:ux,value:"default"},cx=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),fx=function(e){return{$:"PseudoClassSelector",a:e}},lx=function(e){return cx(fx(e))}("hover"),dx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),hx=dx,px=hx,gx=px("span"),vx=r(function(e,t){return f(kn,et(e),rt(t))}),yx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),mx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),bx=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),Cx=r(function(e,t){return t<>>32-e}),Ex=function(e){var t=e.hash?e.seed^f(bx,461845907,f(Cx,15,f(bx,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(bx,2246822507,r^r>>>16),a=f(bx,3266489909,n^n>>>13);return(a^a>>>16)>>>0},Sx=r(function(e,t){return f(bx,5,f(Cx,13,e^f(bx,461845907,f(Cx,15,f(bx,3432918353,t)))))+3864292196}),Tx=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},$P=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+"]"}},_P=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,$P,r)));case"UniversalSelectorSequence":var r=e.a;return Cu(r)?"*":f(Ri,"",f(xa,$P,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,$P,r)))}},LP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([RP(t),_P(r)]))},xP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,_P(t),f(xa,LP,r)),i=f(Ri,"",M([f(Nc,"",f(wo,NP,n))]));return f(tc,f(Ri," ",f(hl,f(Da,Xu,Bd),a)),i)},PP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,xP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,kP(a),"\n",e,"}"]))}),DP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(PP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,SP,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,AP,PP(" ")),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(Ri,"\n\n",f(hl,f(Da,Xu,Bd),M([bP(t),f(Ri,"\n",f(xa,wP,r)),f(Ri,"\n",f(xa,IP,n)),f(Ri,"\n\n",f(xa,DP,a))])))},OP=function(e){return UP(mP(gP(e)))},MP=function(e){return f(Ri,"\n\n",f(xa,OP,e))},FP=function(e){return{$:"Snippet",a:e}},VP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),KP=function(e){return{$:"StyleBlockDeclaration",a:e}},HP=r(function(e,t){var r=l(Kx,t,yr,ci);return FP(M([KP(l(VP,r,yr,e))]))}),jP=function(e){return Cu(e)?"unstyled":f(Cs,P("_"),Rs(f(wx,15739,MP(gS(Ix(gS(f(HP,e,eP(yr)))))))))},qP=function(e){var t=jP(e),r=f(vx,"className",sl(t));return l(yx,r,e,t)},GP=a(function(e,t,r,n){return f(e,f(ka,qP(t),r),n)}),zP=function(e){return{$:"Unstyled",a:e}},YP=function(e){return zP(dw(e))},WP=YP,JP=r(function(e,t){return f(Tn,e,Xe(t))}),QP=function(e){return En(Xe(e))},XP=r(function(e,t){var r=e.b,n=e.c;return Cu(r)?t:l(Nl,n,r,t)}),ZP=function(e){return e.a},eD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,XP,i,s),p=l(Ra,tD,L(yr,h),c),g=p.a,v=p.b,o=l(MT,u,f(xa,ZP,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,XP,i,s),m=l(Ra,tD,L(yr,h),c),g=m.a,v=m.b,o=d(QP,y,u,f(xa,ZP,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,XP,i,s),b=l(Ra,eD,L(yr,h),c),g=b.a,v=b.b,o=l(OT,u,f(xa,ZP,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,XP,i,s),C=l(Ra,eD,L(yr,h),c),g=C.a,v=C.b,o=d(JP,y,u,f(xa,ZP,s),$a(g));return L(f(ka,L(r,o),a),v)}}),tD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,XP,n,o),c=l(Ra,tD,L(yr,s),u),h=c.a,p=c.b,a=l(MT,i,f(xa,ZP,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,XP,n,o),v=l(Ra,tD,L(yr,s),u),h=v.a,p=v.b,a=d(QP,g,i,f(xa,ZP,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,XP,n,o),y=l(Ra,eD,L(yr,s),u),h=y.a,p=y.b,a=l(OT,i,f(xa,ZP,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,XP,n,o),m=l(Ra,eD,L(yr,s),u),h=m.a,p=m.b,a=d(JP,g,i,f(xa,ZP,o),$a(h));return L(f(ka,a,r),p)}}),rD=r(function(e,t){return h(wl,Tl,e,t,Il,Il)}),nD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(Bd(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),aD=function(e){var t=f(nD,ci,e);if("Nothing"===t.$)return ap;var r=t.a,n=r.a,a=r.b;return f(rD,n,a)},iD=function(e){return{$:"ClassSelector",a:e}},oD=function(e){var t=e.a,r=e.b;return f(HP,r,eP(M([iD(t)])))},uD=function(e){return MP(gS(Ix(f(xa,oD,Ia(e)))))},sD=function(e){return l(MT,"style",yr,gS(dw(uD(e))))},cD=n(function(e,t,r){var n=f(xa,ZP,t),a=aD(t),i=l(Ra,tD,L(yr,a),r),o=i.a,u=i.b,s=sD(u);return l(MT,e,n,f(ka,s,$a(o)))}),fD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),lD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(fD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),dD=r(function(e,t){return L(f(lD,"_",t),sD(e))}),hD=n(function(e,t,r){var n=f(xa,ZP,t),a=aD(t),i=l(Ra,eD,L(yr,a),r),o=i.a,u=i.b,s=f(dD,u,o);return l(OT,e,n,f(ka,s,$a(o)))}),pD=a(function(e,t,r,n){var a=f(xa,ZP,r),i=aD(r),o=l(Ra,eD,L(yr,i),n),u=o.a,s=o.b,c=f(dD,s,u);return d(JP,e,t,a,f(ka,c,$a(u)))}),gD=a(function(e,t,r,n){var a=f(xa,ZP,r),i=aD(r),o=l(Ra,tD,L(yr,i),n),u=o.a,s=o.b,c=sD(s);return d(QP,e,t,a,f(ka,c,$a(u)))}),vD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(cD,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(gD,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(hD,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(pD,a,t,r,n)}},yD=vD,mD=function(e){return rx(yD(d(GP,gx,M([lx(M([ox(sx)]))]),yr,M([WP(e)]))))},bD=J,CD=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),ED=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),SD=function(e){return l(La,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 si(h(CD,n,a,i,o,u))}return ci}(),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 si(l(ED,a,t,i))}return ci}())}),L(ci,ci),e)},TD=r(function(e,t){var r=SD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(ZI,NN,Rk,f(ka,eA(bT.contentLeft+" "+bT.contentCenterY+" "+bT.wrapped),f(ka,fT(sT),f(ka,oT(sT),e))),hT(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?si(PN({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(ZI,NN,Rk,f(ka,eA(bT.contentLeft+" "+bT.contentCenterY+" "+bT.wrapped),f(ka,fT(sT),f(ka,oT(sT),U(e,M([h]))))),hT(t))}var p=-s/2,g=-u/2;return d(ZI,gT,Rk,e,hT(M([d(ZI,NN,Rk,f(ka,eA(bT.contentLeft+" "+bT.contentCenterY+" "+bT.wrapped),f(ka,lT(f(g_,"margin",uw(p)+"px "+uw(g)+"px")),f(ka,lT(f(g_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,lT(f(g_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(oA,pN,l(gN,o,u,s)),yr))))),hT(t))])))}),wD=i(function(e,t,r,n,a){var i=f(OL,M([fT(Dk(80)),oT(Dk(40)),sN(24),DR,mR(l$),tx(r)]),{label:aL("currency type"),onChange:f(Ko,bD,n),placeholder:ci,text:t}),o=f(ip,t,N$),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return xk;r.b;return f(TD,M([fT(Dk(350)),mR(S$),TR(1),Ok(jk),HR(10),hN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(RN,M([fT(Dk(80)),yN(9),f(zk,0,5),tx(n(t)),F_(M([Ok(l(nA,.8,.8,1))]))]),M([f(QR,M([oT(Dk(26))]),a),f($k,M([sN(16),iN]),mD(t))]))},Ia(XL(t))))}return xk}();return f(RN,M([yN(4),VL(u)]),M([f($k,M([nN(a)]),ex(t)),i]))}),ID=i(function(e,t,r,n,a){var i=c_(d(Yd,"click","misclick","currency flag",0)),o=f($k,M([nN(c_(d(Yd,"click","misclick","currency symbol",0)))]),il(R$(e))),u=f($k,M([VL(f(T_,M([X_,KL(5)]),a))]),h(wD,r,e,u_(!0),JL,i));return p(ML,M([fT(Dk(250)),DR,sN(24),VL(f(T_,M([X_,KL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,WL)}),AD=function(e){return jL(f(qL,"For fiat",h(ID,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},BD=function(e){return{$:"ChangeRole",a:e}},kD=d(B_,1,31,52,.13),ND=r(function(e,t){var r=M([sN(24),DR,Jk]),n=function(){return"Buyer"===t.$?L(r,U(r,M([sA(kD)]))):L(U(r,M([sA(kD)])),r)}(),a=n.a,i=n.b;return f(RN,M([yN(20)]),M([f($k,U(M([nN(BD(fo))]),i),il("Sell "+e)),f($k,U(M([nN(BD(co))]),a),il("Buy "+e))]))}),RD=r(function(e,t){return f(qL,"Trade Type",f(ND,g$(e),t.inputs.userRole))}),$D=ER({blur:20,color:d(B_,0,0,0,.04),offset:L(0,3),size:0}),_D=f(Wk,pN,bT.spaceEvenly),LD=function(e){var t=zL(e.wallet);return f(BN,M([fT(Lk),yN(20),Ok(jk),Xk(5),HR(20),$D]),M([f(RN,M([fT(Lk),_D]),M([f(RD,t,e),f(GL,t,e),AD(e)])),YL(e)]))},xD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),PD={$:"Web3Connect"},DD=function(e){return f($k,M([hN]),function(){var t=L(Vd(e),xg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(K_,"Open Trade",f(xD,n,r))}t.b;return f(A_,"Unsupported Network",ci)}t.a;return f(K_,"Connect to Wallet",PD)}())},UD=function(e){return{$:"AutoabortIntervalChanged",a:e}},OD=function(e){return{$:"ChangePaymentMethodText",a:e}},MD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),FD=MD,VD=function(e){return f(FD,M([sA(d(_N,0,0,0,.2))]),function(){return il("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")}())},KD={$:"TextArea"},HD=r(function(e,t){return l(UL,{autofill:ci,spellchecked:t.spellcheck,type_:KD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),jD=n(function(e,t,r){var n=f($k,M([sN(22),iN]),il("Payment Method")),a=f(HD,M([fT(Lk),oT(Dk(150)),Ok(d(B_,155,203,255,.2)),TR(0)]),{label:aL("payment method"),onChange:OD,placeholder:""===r?si(VD(t)):ci,spellcheck:!0,text:r});return f(BN,M([yN(20),PN({bottom:15,left:45,right:45,top:0}),fT(Lk),I_(f(T_,M([X_,KL(30),HR(10),sN(20),fT(Dk(400))]),e))]),M([n,a]))}),qD=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."},GD=a(function(e,t,r,n){var a=l(Is,e,P("0"),Ni(n));return f($k,M([sN(22),sA(t)]),il(U(a,r)))}),zD=function(e){return Md(e)<0?Dl(0):e},YD=n(function(e,t,n){var a=r(function(e,r){return f(BN,M([yN(4)]),M([f($k,M([HR(4),Jk,nN(n(f(ub,t,e)))]),f(QR,M([oT(Dk(10))]),XR)),r,f($k,M([HR(4),Jk,nN(n(function(e){return Md(e)?e:Dl(3e5)}(zD(f(b$,t,e)))))]),f(QR,M([oT(Dk(10))]),zR))]))}),i=U$(t);return f(RN,M([_D,yN(10)]),M([f(a,Dl(864e5),d(GD,3,e," days",i.days)),f(a,Dl(36e5),d(GD,2,e," hours",i.hours)),f(a,Dl(3e5),d(GD,2,e," min",i.min))]))}),WD=o(function(e,t,r,n,a,i){var o=f($k,M([Ok(d(B_,155,203,255,.2)),Xk(5),HR(15),I_(f(T_,M([X_]),a))]),l(YD,S$,n,i)),u=f(RN,M([yN(30)]),M([f(QR,M([oT(Dk(40)),nN(c_(d(Yd,"click","misclick","symbol for "+t,0)))]),e),f($k,M([sN(22),iN]),il(t))])),s=f(CN,M([sN(17),DR,sA(k_)]),M([il(r)]));return f(BN,M([fT(Lk),Xk(10),Ok(l(Bk,237,237,237)),yN(2)]),f(xa,$k(M([Ok(jk),f(zk,45,18),fT(Lk)])),M([u,f(RN,M([fT(Lk),yN(25),Ok(jk)]),M([o,s]))])))}),JD=GR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),QD=f(Wk,FR,bT.clipX),XD=f(Wk,FR,bT.clipY),ZD=i(function(e,t,r,n,a){return f(BN,M([yN(15),Xk(8),QD,XD,Ok(jk)]),M([p(WD,JD,"Payment Window",qD(a),r,n,UD),l(jD,t,a,e)]))}),eU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},tU=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."},rU=GR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),nU=n(function(e,t,r){return f($k,M([Xk(8),QD,XD,Ok(jk)]),p(WD,rU,"Burn/Release Window",tU(r),e,t,eU))}),aU=function(e){return{$:"AutorecallIntervalChanged",a:e}},iU=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."},oU=GR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),uU=n(function(e,t,r){return f($k,M([Xk(8),Ok(jk),QD,XD]),p(WD,oU,"Open Window",iU(r),e,t,aU))}),sU=function(e){return f(BN,M([fT(Lk),yN(20)]),M([l(uU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(ZD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(nU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},cU=function(e){return f(BN,M([fT(f(E_,1e3,Lk)),hN,yN(20),PN({bottom:30,left:40,right:40,top:0}),nN(u_(!1)),b_(W_(e))]),M([LD(e),sU(e),DD(e.wallet)]))},fU=Es(Nm(8226)),lU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),dU=r(function(e,t){return l(Ra,ka,t,e)}),hU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(dU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),pU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(dU,f(oc,e%r,t),l(hU,yr,e/r|0,t))):f(oc,e,t)}),gU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(ZT,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(dS,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),vU=function(e){return d(gU,Ua,Qy,e,yr)},yU=r(function(e,t){return f($k,M([fT(Lk),b_(f(RN,M([yN(3),fT(KR(100)),fT(t),VR]),f(lU,f($k,M([sA(d(_N,0,0,0,.1)),sN(14)]),il(fU)),f(xa,f(Da,$k(M([sA(d(_N,0,0,0,.2))])),il),f(pU,100,(e?$a:Ua)(vU(f(xa,f(Ko,iu,Qa),Ia(N$)))))))))]),il(" "))}),mU=r(function(e,t){var r=t.url,n=t.label;return d(ZI,gT,dT("a"),f(ka,lT(rT(r)),f(ka,lT(nT("noopener noreferrer")),f(ka,fT(sT),f(ka,oT(sT),f(ka,eA(bT.contentCenterX+" "+bT.contentCenterY),e))))),hT(M([n])))}),bU=eA(bT.italic),CU=function(){var e=f(Da,$k(M([sA(l(nA,.8,.2,.2))])),il),t=f(Da,$k(M([EN])),il);return f(BN,M([fT(Lk),oT(Lk),Ok(jk),Xk(6),yN(50),ER({blur:20,color:d(B_,0,0,0,.1),offset:L(0,3),size:0}),Xk(10),HR(20)]),M([f(yU,!1,Lk),f(BN,M([hN,fT(f(E_,700,Lk)),yN(20)]),M([f(CN,M([sN(70),EN,hN,BR]),M([il("DAI"),e("Hard")])),f(RN,M([sN(30),iN,hN,BR,bU]),M([il("The "),e("Global"),il(", "),e("Unkillable"),il(" Crypto Gateway")]))])),f(RN,M([Ok(a$),yN(2),hN,PR,fT(Lk)]),M([f($k,M([f(zk,40,10),Ok(jk),fT(Lk),oT(Lk)]),f(BN,M([yN(60),wN]),M([f($k,M([sN(40),iN,hN]),il("Want to learn more?")),f(mU,M([Xk(4),Jk,f(zk,25,17),Ok(d_),sA(jk),EN,sN(24),hN]),{label:f(CN,M([BR]),M([il("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"})]))),f($k,M([f(zk,40,10),Ok(jk),fT(Lk),oT(Lk)]),f(BN,M([zN,yN(60)]),M([f($k,M([sN(40),iN,hN]),il("Ready to try it out?")),f(BN,M([yN(10),fT(Dk(400)),hN]),M([f(CN,M([sN(24),fT(Lk)]),M([il("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f(CN,M([sN(24),fT(Lk)]),M([il("Then follow the links at the top of this page to browse "),t("Sell Offers"),il(", browse "),t("Buy Offers"),il(", or "),t("Create Your Own Offer"),il(".")]))]))])))])),f($k,M([G_,fT(Lk)]),f(yU,!0,Lk))]))}(),EU=function(e){return{$:"ShowCurrencyDropdown",a:e}},SU=r(function(e,t){return hl(t(e))}),TU=n(function(e,t,r){return R(t,yr)?xk:f(Yi,bv,d(Q$,e,r.tradeTable,M([dv,KN,FN,VN,HN,MN]),t))}),wU=n(function(e,t,r){var n=l(SU,e,r.filterFunc,zv(f(xa,Z$,t))),a=function(e){return f($k,M([sN(24),iN,sA(a$),hN,HR(20)]),il(e))},i=f(vh,Ja(e_),f(xa,a_,t))?M([a("No trades found.")]):f(xa,a,xC(f(xa,function(e){switch(a_(e).$){case"QueryingNumTrades":return si(tB(e.factory)+"Querying Factory...");case"NoneFound":return ci;case"FetchingTrades":return si(tB(e.factory)+"Fetching Trades");default:return ci}},t)));return f(BN,M([yN(10)]),M([function(){return i.b?f(BN,M([yN(5)]),i):xk}(),l(TU,e,n,r)]))}),IU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(oA,Qk,l(LI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},AU=function(e){return f(tN,"focus",Fi(e))},BU=f(Da,lT,AU),kU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([BU(e(!0)),tx(e(!0))])}();return f(RN,U(e,M([oT(Dk(40)),ER({blur:20,color:d(B_,233,237,242,.05),offset:L(0,3),size:0})])),M([f($k,M([Ok(l$),oT(Dk(40)),IU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f($k,M([JN,f(zk,10,0)]),r)),f(OL,U(s,U(t,M([fT(Dk(100)),oT(Dk(40)),mR(l$),IU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),IR({bottom:1,left:0,right:1,top:1})]))),{label:aL(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(BN,M([fT(Lk),yN(8)]),M([f($k,M([sN(17),DR]),il(e)),t]))}),_U=KT(25),LU=function(e){return{$:"MoveX",a:e}},xU=function(e){return f(dR,_U,LU(-e))},PU={$:"OnLeft"},DU=function(e){return f(F$,PU,e)},UU=n(function(e,t,r){var n=tL(M([JN])),a=f(RN,M([yN(8),JN,fT(Dk(60))]),M([n,f($k,M([sN(16),JN]),il("max"))])),i=f(RN,M([yN(8),JN,fT(Dk(60))]),M([n,f($k,M([sN(16),JN]),il("min"))]));return f($U,"Dai Range",f(BN,M([yN(5),fT(Dk(200))]),M([v(kU,M([DU(f(T_,M([xU(5),fT(Dk(200))]),r.minDai))]),M([BU(EU(!1))]),i,"min Dai",e,ci,ci,RU),v(kU,M([DU(f(T_,M([xU(5),fT(Dk(200))]),r.maxDai))]),M([BU(EU(!1))]),a,"max Dai",t,ci,ci,NU)])))}),OU=function(e){var t=f(ip,e,N$);if("Nothing"===t.$)return il("*");var r=t.a,n=r.b;return f(QR,M([oT(Dk(26))]),n)},MU=function(e){return{$:"AppCmd",a:e}},FU=function(e){return{$:"FiatTypeInputChanged",a:e}},VU=n(function(e,t,r){var n=MU(d(Yd,"click","misclick","currency flag",0)),a=OU(t);f(RN,M([yN(8),JN,fT(Dk(60))]),M([a,f($k,M([sN(16),JN]),il("max"))])),f(RN,M([yN(8),JN,fT(Dk(60))]),M([a,f($k,M([sN(16),JN]),il("min"))]));return f($k,M([PR,fT(Dk(120))]),f($U,"Fiat Type",h(wD,e,t,EU(!0),FU,n)))}),KU={$:"AddSearchTerm"},HU=function(e){return{$:"PaymentMethodInputChanged",a:e}},jU=f(Lh,"keyCode",DC),qU=function(e){return f(tN,"keyup",f(uu,function(t){return 13===t?Fi(e):su(Ni(t))},jU))},GU=function(e){return f($U,"Search Payment Methods",f(OL,M([PR,fT(Dk(250)),oT(Dk(40)),mR(l$),ER({blur:20,color:d(B_,233,237,242,.05),offset:L(0,3),size:0}),v_(qU(KU))]),{label:aL("payment methods search"),onChange:HU,placeholder:ci,text:e}))},zU=function(e){return{$:"RemoveTerm",a:e}},YU=function(e){return f($k,M([HR(3),PR,Jk,nN(zU(e)),sN(10),sA(fN)]),il("x"))},WU=function(e){if(e.b){var t=e;return f(RN,M([fT(Lk),HR(10),yN(10)]),f(xa,function(e){return f(RN,M([Ok(d(B_,16,7,234,.2)),Xk(5),HR(4),yN(3)]),M([il(e),YU(e)]))},t))}return xk},JU=n(function(e,t,r){return f(BN,M([yN(10),fT(sT),hN]),M([f(RN,M([fT(sT),yN(10)]),M([f($k,M([fT(sT),PR]),l(UU,e.minDai,e.maxDai,t)),f($k,M([fT(sT),PR]),l(VU,r,e.fiatType,t)),f(BN,M([fT(sT),PR,yN(5)]),M([GU(e.paymentMethod),WU(e.paymentMethodTerms)]))]))]))}),QU=n(function(e,t,r){return f(BN,M([Xk(5),Ok(jk),fT(Lk),oT(Lk),nN(EU(!1))]),M([f(RN,M([fT(Lk),yN(10),HR(30)]),M([l(JU,r.inputs,r.errors,r.showCurrencyDropdown)])),l(wU,e,t,r)]))}),XU=function(e){return{$:"MessageInputChanged",a:e}},ZU={$:"MessageSubmit"},eO=IL("disabled"),tO=function(e){return{$:"MayPreventDefault",a:e}},rO=r(function(e,t){return f(eN,e,tO(t))}),nO=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):su("Not the enter key")},n=f(uu,r,f(Lh,"key",cu));return lT(f(rO,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),aO=function(e){return f(nO,"Enter",e)},iO={$:"Button"},oO=r(function(e,t){var r=t.onPress,n=t.label;return d(ZI,gT,Rk,f(ka,fT(sT),f(ka,oT(sT),f(ka,eA(bT.contentCenterX+" "+bT.contentCenterY+" "+bT.seButton+" "+bT.noTextSelection),f(ka,Jk,f(ka,SL(e),f(ka,mN(iO),f(ka,lT(nR(0)),function(){if("Nothing"===r.$)return f(ka,lT(eO(!0)),e);var t=r.a;return f(ka,nN(t),f(ka,aO(t),e))}()))))))),hT(M([n])))}),uO=function(e){return f(BN,M([fT(Lk),yN(10)]),M([f(HD,M([fT(Lk),oT(Dk(100))]),{label:aL("messageInput"),onChange:XU,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(oO,M([hN,sN(24)]),{label:il("Submit"),onPress:si(ZU)})]))},sO=f(Wk,FR,bT.scrollbarsY),cO=r(function(e,t){return f($k,M([oT(Lk),fT(Lk)]),f($k,U(M([v_(f(g_,"position","absolute")),v_(f(g_,"top","0")),v_(f(g_,"right","0")),v_(f(g_,"bottom","0")),v_(f(g_,"left","0")),sO]),e),t))}),fO=l(Bk,200,205,210),lO=n(function(e,t,r){var n=M([wN,Ok(d_),sA(jk),IU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([zN,Ok(fO),sA(S$),IU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f($k,U(M([HR(7)]),u),f(CN,yr,M([il(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(nA,0,0,1),jk,"Initiator opened the trade"));case"Recalled":return si(x(l(nA,0,0,1),jk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Qo,8,ul(t))+"..";return si(x(l(nA,1,0,1),jk,r+" committed to the trade"));case"Aborted":return si(x(l(nA,1,0,0),jk,"Buyer aborted the trade"));case"Claimed":return si(x(l(nA,0,1,0),jk,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(nA,0,0,1),jk,"Seller released the "+g$(e)+" and closed the contract"));default:return si(x(l(nA,0,0,1),jk,"Seller burned the "+g$(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($k,M([Xk(3),TR(1),mR(l(nA,1,0,1)),hN,Ok(h)]),f(CN,M([sA(p)]),M([il(g)])))}),dO=n(function(e,t,r){if(r.b){var n=r;return f(cO,M([fT(Lk),oT(Lk),Xk(5),TR(1),mR(S$),HR(10)]),f(BN,M([fT(Lk),oT(Lk),yN(10)]),f(xa,f(lO,e,t),n)))}return f($k,M([fT(Lk),oT(Lk),Xk(5),TR(1),mR(S$),hN,sA(l(nA,.5,.5,.5)),bU]),il("no messages found."))}),hO=Cr,pO=function(e){return f(BN,M([fT(Lk),oT(Lk),yN(10),TR(1),Xk(5),HR(20)]),M([l(dO,e.trade.factory,e.userRole,f(hO,function(e){return e.blocknum},Sa(e.history))),uO(e)]))},gO=function(e){return f($k,M([Ok(jk),Xk(8),$D,fT(Lk),oT(Lk)]),pO(e))},vO={$:"ToggleChat"},yO=function(e){if(e.showChatHistory){var t=f(Nc,xk,f(wo,gO,e.chatHistoryModel));return f($k,M([oT(Lk),fT(Dk(500)),HR(20),wN]),l(S_,M([oT(Lk),fT(Lk)]),f(Yi,oE,t),vO))}return xk},mO=function(e){return"Buyer"===e.initiatorRole.$?fo:co},bO=function(e){return L$(e)+" "+e.fiatType},CO={$:"AbortAction"},EO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),SO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return xk}if("LoadedTrade"!==t.b.$)return xk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=bO(n.terms.price),u=G$(Sb(i)),s=G$(n.parameters.tradeAmount)+" "+g$(n.factory),c=function(){return"Buyer"===mO(n.parameters).$?L(f($k,M([DR,sA(S$)]),il("buyer")),M([il("pay the seller "),f($k,M([sA(d_)]),il(o)),il(" in exchange for the "),f($k,M([sA(d_)]),il(s)),il(" held in this contract.")])):L(f($k,M([DR,sA(S$)]),il("seller")),M([il("accept "),f($k,M([sA(d_)]),il(o)),il(" from the buyer in exchange for the "),f($k,M([sA(d_)]),il(s)),il(" held in this contract.")]))}(),d=c.a,h=c.b;return l(S_,yr,f(BN,M([yN(20),HR(20),hN,oT(Lk),BR]),M([f($k,M([sN(26),iN,hN,JN]),il("Just to Confirm...")),f(BN,M([yN(20),hN,JN]),f(xa,CN(M([hN,sN(18),DR,sA(k_)])),U(M([U(M([il("You will deposit "),f($k,M([sA(d_)]),il(u+" "+g$(n.factory))),il(", thereby becoming the "),d,il(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([il("(This ususally requires two Metamask signatures. Your "+g$(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f($k,M([G_,hN]),f(K_,"Yes, I definitely want to commit to this trade.",l(EO,n,a,i)))])),CO);case"ApproveNeedsSig":return H_(M([il("Waiting for user signature for the approve call."),il("(check Metamask!)"),il("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return H_(M([il("Mining the initial approve transaction..."),f(tA,M([z_,sA(d_)]),{label:il("See the transaction on Etherscan"),url:f(j_,n.factory,p)}),il("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return H_(M([il("Waiting for user signature for the final commit call."),il("(check Metamask!)"),il("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return H_(M([il("Mining the final commit transaction..."),f(tA,M([z_,sA(d_)]),{label:il("See the transaction"),url:f(j_,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(S_,yr,f(BN,M([yN(20),HR(20),hN,oT(Lk),BR]),M([f($k,M([sN(26),iN,hN,JN]),il("Just to Confirm...")),f(BN,M([yN(20),hN,JN]),f(xa,CN(M([hN,sN(18),DR,sA(k_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([il('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 '+g$(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([il("Aborting will incur a small penalty on both parties, and refund the rest of the "+g$(n.factory)+".")])]);case"Release":return M([M([il("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([il("This will destroy the "+g$(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f($k,M([G_,hN]),function(e){return f(K_,e,IE(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 "+g$(n.factory)+".";default:return"I understand. Burn the "+g$(n.factory)+"."}}()))])),CO);case"ActionNeedsSig":var g=r.a;return H_(M([il("Waiting for user signature for the "+BE(g)+" call."),il("(check Metamask!)")]));default:var g=r.a,p=r.b;return xk}},TO=RN(M([fT(Lk),Ok(jk),Xk(5),HR(20),_D,$D])),wO=function(e){return f(RN,M([yN(8)]),M([f(QR,yr,eL),f($k,M([sN(24),DR]),il(G$(e)))]))},IO=r(function(e,t){var r=f(So,To(e),f(wo,function(e){return e.address},Vd(t)));return f(qL,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"}(),wO(e.parameters.tradeAmount))}),AO=function(e){return f(RN,M([yN(5)]),M([ex(e.fiatType),f($k,M([sN(24),DR]),il(bO(e)))]))},BO=function(e){return f(qL,"For Fiat",AO(e.terms.price))},kO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},NO=l(Bk,250,165,22),RO=l(Bk,255,0,0),$O=l(Bk,0,255,0),_O=GR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),LO=GR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),xO=GR({description:"released",src:"/DAIHard/static/img/released.svg"}),PO={$:"ToggleStatsModal"},DO=function(e){return f(hO,Ua,e)},UO=n(function(e,t,n){var a=zv(f(xa,function(e){return f(hl,function(e){return R(f(Io,e,n),si(t))},f(AS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(ih,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(ih,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:jl,amountReleased:jl,numAborts:0,numBurns:0,numReleases:0},a),u=f(wo,Dl,Gl(DO(f(AS,function(e){return function(e){return e?si(e):ci}(Md(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}}),OO=r(function(e,t){return d(V_,x(d(_N,0,0,1,1),d(_N,0,0,1,.8),d(_N,0,0,1,.6)),jk,e,t)}),MO=function(e){return{$:"ViewUserHistory",a:e}},FO=f(MB,0,yr),VO=f(Wk,aN,bT.textNormalWeight),KO=r(function(e,t){return Za(e/t)}),HO=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}}),jO=r(function(e,t){var r=e.a,n=e.b;return l(HO,r,f(KO,Md(t),6e4),n)}),qO=r(function(e,t){return f(Bs,24,f(KO,f(jO,e,t),60))}),GO=r(function(e,t){return f(Bs,1e3,Md(t))}),zO=r(function(e,t){return f(Bs,60,f(jO,e,t))}),YO={$:"Apr"},WO={$:"Aug"},JO={$:"Dec"},QO={$:"Feb"},XO={$:"Jan"},ZO={$:"Jul"},eM={$:"Jun"},tM={$:"Mar"},rM={$:"May"},nM={$:"Nov"},aM={$:"Oct"},iM={$:"Sep"},oM=function(e){var t=f(KO,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)}},uM=r(function(e,t){switch(oM(f(jO,e,t)).month){case 1:return XO;case 2:return QO;case 3:return tM;case 4:return YO;case 5:return rM;case 6:return eM;case 7:return ZO;case 8:return WO;case 9:return iM;case 10:return aM;case 11:return nM;default:return JO}}),sM=r(function(e,t){return f(Bs,60,f(KO,Md(t),1e3))}),cM={$:"Fri"},fM={$:"Mon"},lM={$:"Sat"},dM={$:"Sun"},hM={$:"Thu"},pM={$:"Tue"},gM={$:"Wed"},vM=r(function(e,t){switch(f(Bs,7,f(KO,f(jO,e,t),1440))){case 0:return hM;case 1:return cM;case 2:return lM;case 3:return dM;case 4:return fM;case 5:return pM;default:return gM}}),yM=n(function(e,t,r){return e.toAmPm(f(qO,t,r))}),mM=r(function(e,t){return oM(f(jO,e,t)).day}),bM=mM,CM=M([dM,fM,pM,gM,hM,cM,lM]),EM=r(function(e,t){return function(e){return e.a}(f(Nc,L(0,dM),Gl(f(hl,function(r){return R(r.b,f(vM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),CM)))))}),SM=function(e){return l(Ra,Na,0,e)},TM=r(function(e,t){return oM(f(jO,e,t)).year}),wM=function(e){return!f(Bs,4,e)&&(!!f(Bs,100,e)||!f(Bs,400,e))},IM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return wM(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}}),AM=M([XO,QO,tM,YO,rM,eM,ZO,WO,iM,aM,nM,JO]),BM=r(function(e,t){return f(Nc,L(0,XO),Gl(f(hl,function(r){r.a;return R(r.b,f(uM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),AM))))}),kM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(BM,e,t))}),NM=r(function(e,t){var r=f(oc,f(kM,e,t)-1,AM);return SM(f(xa,IM(f(TM,e,t)),r))+f(bM,e,t)}),RM=r(function(e,t){return f(kM,e,t)/4|0}),$M=r(function(e,t){var r=Ni(t),n=e-Go(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),_M=function(e){return e?e<=12?e:e-12:12},LM=nv(315576e5),xM=r(function(e,t){return Dl(LM*f(TM,e,t))}),PM=r(function(e,t){var r=f(xM,e,t),n=f(EM,e,r);return 1+((f(NM,e,t)+n)/7|0)}),DM=r(function(e,t){return Ni(f(TM,e,t))}),UM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(kM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(kM,t,r));case"MonthFixed":return f($M,2,f(kM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(uM,t,r));case"MonthNameFull":return e.toMonthName(f(uM,t,r));case"QuarterNumber":return Ni(1+f(RM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(RM,t,r));case"DayOfMonthNumber":return Ni(f(bM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(bM,t,r));case"DayOfMonthFixed":return f($M,2,f(bM,t,r));case"DayOfYearNumber":return Ni(f(NM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(NM,t,r));case"DayOfYearFixed":return f($M,3,f(NM,t,r));case"DayOfWeekNumber":return Ni(f(EM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(EM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(vM,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(vM,t,r));case"WeekOfYearNumber":return Ni(f(PM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(PM,t,r));case"WeekOfYearFixed":return f($M,2,f(PM,t,r));case"YearNumberLastTwo":return f(tu,2,f(DM,t,r));case"YearNumber":return f(DM,t,r);case"AmPmUppercase":return bD(l(yM,e,t,r));case"AmPmLowercase":return nd(l(yM,e,t,r));case"HourMilitaryNumber":return Ni(f(qO,t,r));case"HourMilitaryFixed":return f($M,2,f(qO,t,r));case"HourNumber":return Ni(_M(f(qO,t,r)));case"HourFixed":return f($M,2,_M(f(qO,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(qO,t,r));case"HourMilitaryFromOneFixed":return f($M,2,1+f(qO,t,r));case"MinuteNumber":return Ni(f(zO,t,r));case"MinuteFixed":return f($M,2,f(zO,t,r));case"SecondNumber":return Ni(f(sM,t,r));case"SecondFixed":return f($M,2,f(sM,t,r));case"MillisecondNumber":return Ni(f(GO,t,r));case"MillisecondFixed":return f($M,3,f(GO,t,r));default:return n.a}}),OM=a(function(e,t,r,n){return f(Ri,"",f(xa,l(UM,e,r,n),t))}),MM=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),FM=function(e){return e>11?"pm":"am"},VM=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"}},KM=function(e){switch(f(Bs,100,e)){case 11:case 12:case 13:return"th";default:switch(f(Bs,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},HM=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"}},jM=p(MM,VM,f(Ko,VM,Qo(3)),HM,f(Ko,HM,Qo(3)),FM,KM),qM=OM(jM),GM={$:"MonthNameFull"},zM=GM,YM=function(e){return{$:"Text",a:e}},WM=YM,JM={$:"YearNumber"},QM=JM,XM=n(function(e,t,n){var a=r(function(e,t){return f(BN,M([sN(18),yN(6)]),M([f($k,M([EN]),il(e)),f($k,M([VO]),il(t))]))}),i=qM(M([zM,WM(", "),QM])),o=f(BN,M([yN(23),fT(Lk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,FO,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+G$(n.amountReleased)+" "+g$(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+G$(n.amountBurned)+" "+g$(e)+" Burned")])),M([f($k,M([hN]),f(OO,"View User History",MO(n.asRole)))])));return f(BN,M([Xk(8),QD,XD,Ok(l$),yN(1),ER({blur:20,color:d(_N,0,0,0,.08),offset:L(0,0),size:0})]),M([f($k,M([fT(Lk),Ok(jk),HR(17)]),f(LN,18,t)),f($k,M([fT(Lk),Ok(jk),HR(17)]),o)]))}),ZM=n(function(e,t,r){var n=l(UO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=kO(e.parameters.initiatorRole)+" Stats";return f($k,r?M([VL(f($k,M([KL(30),wN]),l(XM,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(qL,a,f(RN,M([fT(Lk),yN(20),Jk,nN(PO)]),f(xa,RN(M([yN(5)])),M([M([f(QR,M([oT(Dk(28))]),xO),f($k,M([sN(24),DR,sA($O)]),il(l(Is,2,P("0"),Ni(n.numReleases))))]),M([f(QR,M([oT(Dk(28))]),_O),f($k,M([sN(24),DR,sA(NO)]),il(l(Is,2,P("0"),Ni(n.numAborts))))]),M([f(QR,M([oT(Dk(28))]),LO),f($k,M([sN(24),DR,sA(RO)]),il(l(Is,2,P("0"),Ni(n.numBurns))))])])))))}),eF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+ul(t)}e.a;return"https://kovan.etherscan.io/address/"+ul(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+ul(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+ul(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+ul(t)}}),tF=n(function(e,t,r){return f(tA,e,{label:il(ul(r)),url:f(eF,t,r)})}),rF=function(e){return f(qL,"Trade Status",f(BN,M([sN(24),DR,yN(8)]),M([il(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,M([sN(12),sA(d_),z_]),e.factory,e.creationInfo.address)])))},nF=i(function(e,t,r,n,a){return TO(M([rF(t),f(IO,t,r),BO(t),l(ZM,t,n,a)]))}),aF=l(Bk,9,32,107),iF=GR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),oF=f($k,M([Xk(4),Jk,nN(vO),HR(5),Ok(l(Bk,22,0,255))]),f(QR,M([fT(Dk(42))]),iF)),uF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},sF=function(e){return f(BN,M([Xk(12),Ok(l$),HR(15),yN(15)]),M([f($k,M([sN(24),iN,bU]),il("Fiat Payment Method")),f(CN,M([sN(18),oT(sT),Ok(jk),ER({blur:5,color:d(_N,0,0,0,.2),offset:L(-3,3),size:0}),Xk(3),HR(5)]),M([f(Nc,f($k,M([sA(kD),bU]),il("No payment methods found.")),f(wo,il,f(wo,function(e){return e.info},Gl(e))))]))]))},cF={$:"Active"},fF=function(e){return{$:"ExpandPhase",a:e}},lF=M([Ok(aF),sA(jk)]),dF=r(function(e,t){return{$:"Min",a:e,b:t}}),hF=r(function(e,t){return f(dF,e,t)}),pF=function(e){return M(e?[Xk(12),PR,oT(f(hF,380,sT))]:[Xk(12),hN])},gF=M([Ok(jk)]),vF=GR({description:"flame",src:"/DAIHard/static/img/flame.png"}),yF=r(function(e,t){return Ol(f(us,Ml(e),Ml(t)))}),mF=r(function(e,t){return d(V_,x(d(_N,1,.6,.2,1),d(_N,1,.6,.2,.8),d(_N,1,.6,.2,.6)),jk,e,t)}),bF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),CF=function(e){return{$:"ContractActionClicked",a:e}},EF={$:"Web3Connect"},SF=n(function(e,t,r){var n=Vd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(C$,e,t).$?xk:f(RN,M([yN(8)]),function(){var e=x(t.state.phase,f(To,t,a.address),f(Io,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,IE,f(OO,"Remove and Refund this Trade",TE))])}break e}var r=(e.a,e.b,Ml(rb(t.parameters)));return M([f(K_,"Deposit and Commit to Trade",l(bF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,CF,f(mF,"Abort Trade",sE)),f(Yi,CF,f(K_,"Confirm Payment",gE)),oF])}e.a,e.c.a;return M([oF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,CF,f(K_,"Burn it All!",pE)),f(Yi,CF,f(OO,"Release Everything",wE)),oF])}e.a,e.c.a;return M([oF])}break e;default:break e}return yr}())}return f(K_,"Connect to Wallet",EF)}),TF={$:"Finished"},wF={$:"NotStarted"},IF=r(function(e,t){var r=L(o$(t),o$(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?wF:R(n,a)?cF:TF}),AF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),BF=r(function(e,t){return l(AF,yr,e,t)}),kF=a(function(e,t,r,n){var a=G$(f(ih,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+g$(r.factory),i=G$(r.parameters.tradeAmount)+" "+g$(r.factory),o=f(RN,yr,f(BF,3,f(QR,M([oT(Dk(18))]),vF))),u=f(Da,$k(M([sA(l(nA,1,0,0))])),il),s=R(e,r.state.phase),c=f(So,Io(r),f(wo,function(e){return e.address},Vd(n))),d=s?jk:S$,h=CN(M([sA(d),sN(18),iN])),p=bO(r.terms.price),g=s?l(Bk,0,226,255):l(Bk,16,7,234),v=f(Da,$k(M([sA(g)])),il),y=G$(r.parameters.buyerDeposit)+" "+g$(r.factory),m=r.parameters.abortPunishment,b=G$(m)+" "+g$(r.factory),C=G$(f(yF,r.parameters.buyerDeposit,m))+" "+g$(r.factory),E=G$(f(yF,r.parameters.tradeAmount,m))+" "+g$(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([il("Your "),u("burnable deposit"),il(" of "),v(y),il(" is now held in this contract, and your offer to buy "),v(i),il(" for "),v(p),il(" is now listed in the marketplace.")]),M([il("If another user likes your offer, they can become the Seller by depositing the full "),v(i),il(" into this contract.")]),M([il("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),il(" to you.")])])):f(xa,h,M([M([il("Your offer to sell the "),v(i),il(" held in this contract for "),v(p),il(" is now listed in the marketplace.")]),M([il("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),il(" of 1/3 of the trade amount "),v("("+y+")"),il(" into this contract.")]),M([il("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),il(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([il("You must now pay the Seller "),v(p),il(" via the Fiat Payment Method, "),f($k,M([iN]),il("and then click ")),u("Confirm Payment"),il(" before the payment window runs out. Use the chat to coordinate.")]),M([il("If you abort the trade, or do not confirm payment before this time is up, "),v(b),il(" (1/4 of the "),u("burnable deposit"),il(") will be "),u("burned"),il(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),il(" to the Seller, "),v(C),il(" to you).")]),M([il("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),il(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([il("Work and communicate with the Buyer to receive "),v(p),il(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([il("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),il(" (1/4 of the "),u("burnable deposit"),il(") will be "),u("burned"),il(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),il(" to you, "),v(C),il(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([il("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),il(" will be released to you.")]),M([il("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),il(" In this case the "),v(a),il(" will be lost to both parties.")]),M([il("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([il("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([il("So, have you recieved the "),v(p),il("? If so, you can click "),v("Release Everything"),il(".")]),M([il("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),il(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([il("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([il("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([il("The Seller has deposited "),v(i),il(" into this contract, and offers to sell it for "),v(p),il(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),il(" into this contract by clicking "),u("Deposit and Commit to Trade"),il(".")]),M([il("If the trade is successful, the combined "+g$(r.factory)+" balance "),v("("+a+")"),il(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,il(" for both parties (see Payment Window for more on this).")]),M([il("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),il(" within the payment window.")])])):f(xa,h,M([M([il("The Buyer is offering to buy "),v(i),il(" for "),v(p),il(", and has deposited "),v(y),il(" into this contract as a "),u("burnable deposit"),il(". To become the Seller, deposit "),v(i),il(" into this contract by clicking "),u("Deposit and Commit to Trade"),il(".")]),M([il("When you receive the "),v(p),il(" from the Buyer, the combined "+g$(r.factory)+" balance "),v("("+a+")"),il(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,il(" for both parties (see Payment Window for more on this).")]),M([il("Don't commit unless you can receive "),v(p),il(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([il("During this phase, the Buyer is expected to transfer "),v(p),il(" to the Seller, as described in Fiat Payment Method, "),f($k,M([iN]),il("and ")),u("Confirm the Payment "),il(" before the payment window runs out. This would move the trade to the final phase.")]),M([il("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),il(" (1/4 of the "),u("burnable deposit"),il(" amount) will be "),u("burned"),il(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),il(" to the Seller, "),v(C),il(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([il("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([il("If the Seller can verify he has received the "),v(p),il(", he will probably release the total balance of "),v(i),il(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),il(".")]),M([il("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),il(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(BN,M([fT(Lk),oT(Lk),HR(20),yN(30)]),M([f(RN,M([fT(Lk)]),M([f($k,M([sN(24),iN,sA(g),zN]),il(T))])),f(BN,M([fT(Lk),JN,yN(13)]),w),f($k,M([wN]),function(){switch(f(IF,r,e).$){case"Active":return l(SF,t,r,n);case"NotStarted":return f($k,M([sN(20),iN,bU,sA(a$)]),il("Phase not yet started."));default:return f($k,M([sN(20),iN,bU]),il("Phase no longer active."))}}())]))}),NF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},RF=GR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),$F=GR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),_F={$:"None"},LF=_F,xF=GR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),PF=function(e){switch(e.$){case"Open":return xF;case"Committed":return RF;case"Judgment":return $F;default:return LF}},DF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),UF=a(function(e,t,r,n){return d(DF,e,t,r,n)}),OF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},MF=function(e){return function(e){return d(UF,e.red,e.green,e.blue,e.alpha)}(OF(e))},FF=function(e){return{$:"Circle",a:e}},VF=FF,KF=d(DF,0,0,0,1),HF={$:"Flat"},jF={$:"Sharp"},qF=function(e){return{$:"Uniform",a:e}},GF=qF,zF={cap:HF,dashPattern:yr,dashPhase:0,fill:GF(KF),join:jF,thickness:2},YF=n(function(e,t,r){return D(zF,{dashPattern:e,fill:r,thickness:t})}),WF=YF(yr),JF={$:"Transparent"},QF=JF,XF=f(WF,0,QF),ZF=r(function(e,t){return{$:"Shape",a:e,b:t}}),eV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},tV=function(e){return f(Da,eV,ZF(e))},rV=function(e){return tV(L(e,XF))},nV=function(e){return L(-e.a,-e.b)},aV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),iV=r(function(e,t){return f(aV,nV(e(t)),t)}),oV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},uV=r(function(e,t){return{$:"Path",a:e,b:t}}),sV=kr,cV=Nr,fV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=cV(n),i=sV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},lV=function(e){return xa(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)})},dV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(lV,e,M([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),hV=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},pV=function(e){var t=gV(e.basic),r=oV(f(xa,fV(e),t)),n=r.a,a=r.b;return{toBottom:-f(Nc,0,aI(a)),toLeft:-f(Nc,0,aI(n)),toRight:f(Nc,0,nI(n)),toTop:f(Nc,0,nI(a))}},gV=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(dV,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(dV,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(dV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(lV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(uV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(lV,R(C,HF)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(dV,0,E);case"Group":var S=e.a;return f(lV,0,zv(f(xa,f(Ko,pV,hV),S)));default:var T=e.b;return f(lV,0,hV(pV(T)))}},vV=function(e){var t=pV(e);return t.toTop+t.toBottom},yV=function(e){var t=pV(e);return L(-t.toLeft,t.toTop)},mV=function(e){var t=pV(e);return t.toLeft+t.toRight},bV=En("http://www.w3.org/2000/svg"),CV=bV("svg"),EV=Nn("height"),SV=Nn("version"),TV=Nn("width"),wV=bV("circle"),IV=bV("ellipse"),AV=bV("foreignObject"),BV=bV("g"),kV=bV("image"),NV=bV("polygon"),RV=bV("polyline"),$V=bV("rect"),_V=dw,LV=bV("text"),xV=Nn("id"),PV=Nn("points"),DV=Nn("r"),UV=Nn("rx"),OV=Nn("ry"),MV=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},FV=function(e){return{$:"Group",a:e}},VV=Nn("dominant-baseline"),KV=Nn("fill"),HV=Nn("fill-opacity"),jV=Nn("font-family"),qV=Nn("font-size"),GV=Nn("font-style"),zV=Nn("font-variant"),YV=Nn("font-weight"),WV=Nn("opacity"),JV=Nn("stroke"),QV=Nn("stroke-dasharray"),XV=Nn("stroke-dashoffset"),ZV=Nn("stroke-linecap"),eK=Nn("stroke-linejoin"),tK=Nn("stroke-opacity"),rK=Nn("stroke-width"),nK=Nn("text-anchor"),aK=Nn("text-decoration"),iK=Nn("transform"),oK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},uK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},sK=n(function(e,t,r){return d(DF,e,t,r,1)}),cK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return nv(1e4*e)/100};return gd(M(["rgba(",uw(i(t)),"%,",uw(i(r)),"%,",uw(i(n)),"%,",uw(function(e){return nv(1e3*e)/1e3}(a)),")"]))},fK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},lK=function(e){var t=fK(e),r=t.red,n=t.green,a=t.blue;return cK(l(sK,r,n,a))},dK=function(e){if("Uniform"===e.$){var t=e.a;return lK(t)}return"none"},hK=function(e){var t=fK(e),r=t.alpha;return uw(r)},pK=function(e){if("Uniform"===e.$){var t=e.a;return hK(t)}return"0"},gK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},vK=function(e){var t=uw(e.scale.b),r=uw(e.scale.a),n=uw(-e.rotation/2/sR*360),a=uw(-e.shift.b),i=uw(e.shift.a);return gd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},yK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([JV(dK(r.fill)),tK(pK(r.fill)),rK(uw(r.thickness)),ZV(oK(r.cap)),eK(gK(r.join)),KV("none"),WV(uw(e.opacity)),iK(vK(e)),XV(Ni(r.dashPhase)),QV(uK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([KV(dK(a)),HV(pK(a)),JV(dK(r.fill)),tK(pK(r.fill)),rK(uw(r.thickness)),ZV(oK(r.cap)),eK(gK(r.join)),WV(uw(e.opacity)),iK(vK(e)),XV(Ni(r.dashPhase)),QV(uK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([KV(dK(qF(o.color))),jV(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),qV(Ni(o.size)),YV(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"}}()),GV(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),zV(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),aK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),nK("middle"),VV("middle"),iK(vK(e))]);default:return M([iK(vK(e))])}},mK=Nn("x"),bK=Nn("y"),CK=r(function(e,t){return M([TV(uw(e)),EV(uw(t)),mK(uw(-e/2)),bK(uw(-t/2))])}),EK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([uw(t),uw(-r)]))},e))},SK=tN,TK=r(function(e,t){return f(e,t.a,t.b)}),wK=function(e){return f(xa,TK(SK),e)},IK=function(e){e:for(;;){var t=f(Nc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(RV,U(M([xV(t),PV(EK(i))]),U(yK(e),wK(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(NV,U(M([xV(t),PV(EK(i))]),U(yK(e),wK(e.handlers))),yr);case"Circle":var c=s.a;return f(wV,U(M([xV(t),DV(uw(c))]),U(yK(e),wK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(IV,U(M([xV(t),UV(uw(d)),OV(uw(h))]),U(yK(e),wK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f($V,U(M([xV(t),UV(uw(c)),OV(uw(c))]),U(f(CK,p,g),U(yK(e),wK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(uV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(LV,U(M([xV(t)]),U(yK(e),wK(e.handlers))),M([_V(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(kV,U(M([xV(t),MV(C)]),U(f(CK,p,g),U(yK(e),wK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(AV,U(M([xV(t)]),U(f(CK,p,g),U(yK(e),wK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(BV,f(ka,xV(t),U(yK(e),wK(e.handlers))),l(Ra,r(function(e,t){return f(ka,IK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:FV(M([w,I]))});e=v;continue e}}},AK=r(function(e,t){var r=e.a,n=e.b,a=uw(r),i=uw(n);return f(LT,yr,M([f(CV,M([TV(a),EV(i),SV("1.1")]),M([IK(t)]))]))}),BK=function(e){return f(AK,L(mV(e),vV(e)),f(iV,yV,e))},kK=r(function(e,t){var r=PF(e),n=function(){switch(t.$){case"NotStarted":return l(Bk,10,33,108);case"Active":return l(Bk,0,100,170);default:return l(Bk,1,129,104)}}(),a=rx(BK(f(rV,GF(MF(n)),VF(50))));return f($k,M([hN,b_(f(QR,M([hN,JN,oT(Dk(60))]),r))]),a)}),NK=function(e){var t=M([bU,iN,sN(20)]);switch(e.$){case"Active":return f($k,U(t,M([sA(fN)])),il("Active"));case"NotStarted":return f($k,U(t,M([sA(a$)])),il("Not Started"));default:return f($k,t,il("Finished"))}},RK=n(function(e,t,r){var n=f(IF,t,e),a=function(){return"Active"===n.$?l(Bk,0,226,255):S$}(),i=f($k,M([sA(a),sN(20),iN,hN]),il(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 xk;switch(n.$){case"NotStarted":return d(O$,M([hN]),M([sN(22),DR]),L(S$,l$),f(m$,e,t));case"Active":var a=f(C$,r,t);if("TimeLeft"===a.$){var i=a.a;return d(q$,M([hN]),M([sN(22),DR]),L(jk,l$),i)}return f(BN,M([hN,yN(10)]),M([f($k,M([hN]),il(NF(e))),f(OO,"Poke",IE(SE))]));default:return f($k,M([oT(Dk(1))]),xk)}}();return f(BN,M([HR(20),yN(10),oT(Lk)]),M([f($k,M([PR,hN]),i),f($k,M([oT(Lk),hN]),f($k,M([JN]),f(kK,e,n))),f(BN,M([yN(10),G_,hN]),M([f($k,M([hN]),NK(n)),o]))]))}),$K=o(function(e,t,r,n,a,i){var o=f(IF,r,t),u=f($k,M([HR(10),fT(Lk),oT(Lk)]),d(kF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Dl(0)}}(),c=l(RK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(b$,f(ub,r.state.phaseStartTime,s),i);default:Dl(0)}}(),f($k,M([oT(Lk),fT(Dk(1)),Ok(function(){return"Active"===o.$?l(nA,0,0,1):l$}())]),xk)),p=a?f(RN,U(pF(e),U(R(o,cF)?lF:gF,M([fT(Lk)]))),M([c,h,u])):f(RN,U(pF(e),U(R(o,cF)?lF:gF,M([Jk,nN(fF(t))]))),M([c]));return!e&&R(o,cF)?f(BN,M([fT(Lk),yN(20),PN({bottom:20,left:0,right:0,top:0})]),M([p,sF(r.terms.paymentMethods)])):p}),_K=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(RN,M([hN,Xk(12),HR(30),yN(10),Ok(aF),sN(24),iN,sA(jk)]),M([il("Trade "+uF(t.state.closedReason)),oF])):e?f(BN,M([fT(Lk),yN(10)]),M([f(RN,M([fT(Lk),oT(sT),yN(20)]),M([p($K,e,mo,t,n,R(r,mo),a),p($K,e,vo,t,n,R(r,vo),a),p($K,e,yo,t,n,R(r,yo),a)])),sF(t.terms.paymentMethods)])):f(BN,M([fT(Lk),oT(sT),yN(20)]),M([p($K,e,mo,t,n,R(r,mo),a),p($K,e,vo,t,n,R(r,vo),a),p($K,e,yo,t,n,R(r,yo),a)]))}),LK=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(BN,M([fT(Lk),oT(Lk),yN(40)]),M([h(nF,t,i,n.wallet,r,n.showStatsModal),f($k,M([fT(Lk),f(zk,40,0),yN(40)]),h(_K,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f($k,M([hN,JN,sN(30)]),il("Loading trade info..."));default:return f($k,M([hN,JN,sN(30)]),il("Invalid trade"))}}(),M([yO(n),SO(n)]))}),xK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),PK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(CU,yr);case"CreateModel":var n=r.a;return L(f(Yi,Ay,cU(n)),yr);case"TradeModel":var a=r.a;return l(xK,Yi(Ny),xa(Yi(Ny)),d(LK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,ZS,l(QU,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,WS,l(o_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f($k,M([fT(Lk),oT(Lk),Xk(10)]),n),a)}),DK=function(e){return{$:"DismissNotice",a:e}},UK=function(e){return f(dR,_U,LU(e))},OK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(nA,1,1,1):l(nA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Bk,100,200,255);case"Caution":return l(Bk,255,188,0);case"Error":return l(Bk,255,70,70);default:return l(Bk,200,200,200)}}(),o=f($k,M([wN,PR,hR(5),UK(5)]),h_(DK(t)));return f($k,M([Ok(i),Xk(10),HR(8),fT(Lk),TR(1),mR(d(_N,0,0,0,.15)),$D]),f(BN,M([yN(4),fT(Lk)]),f(Bi,r(function(e,t){return f(CN,M([fT(Lk),sA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},MK=function(e){return R(e,yr)?yr:M([f(BN,M([xU(20),hR(20),yN(10),wN,G_,fT(Dk(300)),sN(15)]),f(xa,OK,f(hl,function(e){return R(e.b.align,rl)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(BN,M([UK(20),KL(100),yN(10),zN,PR,fT(Dk(300)),sN(15)]),f(xa,OK,f(hl,function(e){return R(e.b.align,cB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},FK=r(function(e,t){var r=f(PK,e,t),n=r.a,a=r.b;return L(f(BN,M([V$(Mk),b_($N(t)),fT(Lk),oT(Lk),HR(30)]),M([f($k,M([oT(Dk(50))]),xk),n])),U(a,MK(t.userNotices)))}),VK=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),KK=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),HK={$:"AllowHover"},jK={$:"Layout"},qK={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(rA,155/255,203/255,1,1),offset:L(0,0),size:3})},GK=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?qK:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?HK:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?jK:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},zK=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(gT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),gT);case"Text":var a=t.a;return CI(a);default:return CI("")}}),YK=n(function(e,t,r){var n=GK(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?VK(n):KK(n)}();return f(zK,a,d(ZI,gT,Rk,t,hT(M([r]))))}),WK=KT(5),JK=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),QK={$:"SansSerif"},XK=function(e){return{$:"Typeface",a:e}},ZK=Y,eH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",ZK(nd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",ZK(nd(t)));default:var t=e.a.name;return f(Ri,"-",ZK(nd(t)))}}())}),tH=function(){var e=M([XK("Open Sans"),XK("Helvetica"),XK("Verdana"),QK]);return M([f(oA,Uk,l(iA,"bg-color-"+uA(d(rA,1,1,1,0)),"background-color",d(rA,1,1,1,0))),f(oA,aA,l(iA,"font-color-"+uA(d(rA,0,0,0,1)),"color",d(rA,0,0,0,1))),f(oA,oN,uN(20)),f(oA,WK,f(JK,l(Ra,eH,"font-",e),e))])}(),rH=n(function(e,t,r){var n=e.options;return l(YK,n,f(ka,eA(f(Ri," ",M([bT.root,bT.any,bT.single]))),U(tH,t)),r)}),nH=rH({options:yr}),aH=function(e){return f(oA,WK,f(JK,l(Ra,eH,"ff-",e),e))},iH=QK,oH=XK,uH=function(e){return{body:M([function(){var t=f(FK,e.screenWidth,e),r=t.a,n=t.b,a=U(M([fT(Lk),oT(Lk),aH(M([oH("Soleil"),iH]))]),f(xa,b_,n));return f(nH,a,r)}()]),title:"DAIHard"}},sH=Ht,cH=sH({init:BB,onUrlChange:Ak,onUrlRequest:Ik,subscriptions:wk,update:QA,view:uH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:cH(f(uu,function(e){return f(uu,function(t){return f(uu,function(r){return Fi({height:r,networkId:t,width:e})},f(Lh,"height",DC))},f(Lh,"networkId",DC))},f(Lh,"width",DC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/src/AgentHistory/State.elm b/src/AgentHistory/State.elm index 470c62c..4e12609 100644 --- a/src/AgentHistory/State.elm +++ b/src/AgentHistory/State.elm @@ -25,6 +25,7 @@ import Time import TokenValue exposing (TokenValue) import TradeCache.State as TradeCache import TradeCache.Types as TradeCache exposing (TradeCache) +import TradeTable.Filters.Types as Filter import TradeTable.State as TradeTable import TradeTable.Types as TradeTable import Wallet @@ -37,6 +38,10 @@ init wallet agentAddress = , tradeTable = TradeTable.init ( TradeTable.Phase, TradeTable.Ascending ) + [ Filter.phases True True True False + , Filter.offerType True True + , Filter.role agentAddress True True + ] } , Cmd.none ) diff --git a/src/AgentHistory/View.elm b/src/AgentHistory/View.elm index 569f914..e2cda4a 100644 --- a/src/AgentHistory/View.elm +++ b/src/AgentHistory/View.elm @@ -54,21 +54,16 @@ pageTitleElement model = userInfo.address == model.agentAddress in if viewingOwnHistory then - Element.el - [ Element.paddingXY 30 10 - , Element.Font.size 24 - , Element.Font.semiBold - ] - (Element.text "Your Trades") + Element.none else Element.row [ Element.spacing 10 , Element.paddingEach { top = 10 - , left = 30 - , right = 30 - , bottom = 30 + , left = 20 + , right = 20 + , bottom = 20 } ] [ Element.el @@ -137,7 +132,9 @@ resultsAndStatusElement time tradeCaches model = |> List.map statusMsgElement in Element.column - [ Element.spacing 10 ] + [ Element.spacing 10 + , Element.width Element.fill + ] [ case statusMessages of [] -> Element.none diff --git a/src/Marketplace/State.elm b/src/Marketplace/State.elm index e9c72fc..51a867f 100644 --- a/src/Marketplace/State.elm +++ b/src/Marketplace/State.elm @@ -23,6 +23,7 @@ import Time import TokenValue exposing (TokenValue) import TradeCache.State as TradeCache import TradeCache.Types as TradeCache exposing (TradeCache) +import TradeTable.Filters.Types as Filters import TradeTable.State as TradeTable import TradeTable.Types as TradeTable import Wallet @@ -34,6 +35,9 @@ init wallet = , tradeTable = TradeTable.init ( TradeTable.Expires, TradeTable.Ascending ) + [ Filters.offerType True True + , Filters.phases True False False False + ] , inputs = initialInputs , errors = noErrors , showCurrencyDropdown = False diff --git a/src/TradeTable/Filters/State.elm b/src/TradeTable/Filters/State.elm new file mode 100644 index 0000000..845791b --- /dev/null +++ b/src/TradeTable/Filters/State.elm @@ -0,0 +1,30 @@ +module TradeTable.Filters.State exposing (init, update) + +import List.Extra +import TradeTable.Filters.Types exposing (..) + + +init : List FilterSet -> Model +init = + identity + + +update : Msg -> Model -> Model +update msg filterSets = + case msg of + SetOption filterSetLabel optionLabel checked -> + filterSets + |> List.Extra.updateIf (.label >> (==) filterSetLabel) + (\filterSet -> + { filterSet + | options = + filterSet.options + |> List.Extra.updateIf (.label >> (==) optionLabel) + (setOption checked) + } + ) + + +setOption : Bool -> Option -> Option +setOption checked option = + { option | checked = checked } diff --git a/src/TradeTable/Filters/Types.elm b/src/TradeTable/Filters/Types.elm new file mode 100644 index 0000000..e92d44f --- /dev/null +++ b/src/TradeTable/Filters/Types.elm @@ -0,0 +1,96 @@ +module TradeTable.Filters.Types exposing (FilterSet, Model, Msg(..), Option, filterTrades, offerType, phases, role) + +import CommonTypes exposing (..) +import Contracts.Types as CTypes +import Eth.Types exposing (Address) + + +type alias Model = + List FilterSet + + +type Msg + = SetOption String String Bool + + +type alias FilterSet = + { label : String + , options : List Option + } + + +type alias Option = + { label : String + , checked : Bool + , testTrade : CTypes.FullTradeInfo -> Bool + } + + +phases : Bool -> Bool -> Bool -> Bool -> FilterSet +phases openChecked committedChecked judgementChecked closedChecked = + FilterSet + "Phase" + [ Option + "Open" + openChecked + (\t -> t.state.phase == CTypes.Open) + , Option + "Committed" + committedChecked + (\t -> t.state.phase == CTypes.Committed) + , Option + "Judgment" + judgementChecked + (\t -> t.state.phase == CTypes.Judgment) + , Option + "Closed" + closedChecked + (\t -> t.state.phase == CTypes.Closed) + ] + + +role : Address -> Bool -> Bool -> FilterSet +role addr buyerChecked sellerChecked = + FilterSet + "Role" + [ Option + "Buyer" + buyerChecked + (\t -> CTypes.getBuyerOrSeller t addr == Just Buyer) + , Option + "Seller" + sellerChecked + (\t -> CTypes.getBuyerOrSeller t addr == Just Seller) + ] + + +offerType : Bool -> Bool -> FilterSet +offerType buyingChecked sellingChecked = + FilterSet + "Offer Type" + [ Option + "Buying" + buyingChecked + (\t -> t.parameters.initiatorRole == Buyer) + , Option + "Selling" + sellingChecked + (\t -> t.parameters.initiatorRole == Seller) + ] + + +filterTrades : List FilterSet -> List CTypes.FullTradeInfo -> List CTypes.FullTradeInfo +filterTrades filterSets trades = + trades + |> List.filter + (\trade -> + filterSets + |> List.all + (\filterSet -> + filterSet.options + |> List.any + (\option -> + option.checked && option.testTrade trade + ) + ) + ) diff --git a/src/TradeTable/Filters/View.elm b/src/TradeTable/Filters/View.elm new file mode 100644 index 0000000..a5e162e --- /dev/null +++ b/src/TradeTable/Filters/View.elm @@ -0,0 +1,43 @@ +module TradeTable.Filters.View exposing (view) + +import Element exposing (Element) +import Element.Font +import Element.Input +import TradeTable.Filters.Types exposing (..) + + +view : Model -> Element Msg +view filterSets = + Element.row + [ Element.spacing 20 ] + <| + List.map viewFilterSet filterSets + + +viewFilterSet : FilterSet -> Element Msg +viewFilterSet filterSet = + Element.column + [ Element.spacing 15 + , Element.alignTop + ] + [ Element.el + [ Element.Font.size 28 + , Element.Font.medium + ] + (Element.text filterSet.label) + , Element.column + [ Element.spacing 5 ] + <| + List.map (viewOption filterSet.label) filterSet.options + ] + + +viewOption : String -> Option -> Element Msg +viewOption filterSetLabel option = + Element.Input.checkbox + [] + { onChange = SetOption filterSetLabel option.label + , icon = Element.Input.defaultCheckbox + , checked = option.checked + , label = Element.Input.labelRight [] <| Element.text option.label + } diff --git a/src/TradeTable/State.elm b/src/TradeTable/State.elm index 6f10792..3fe665a 100644 --- a/src/TradeTable/State.elm +++ b/src/TradeTable/State.elm @@ -3,10 +3,12 @@ module TradeTable.State exposing (init, update) import AppCmd exposing (AppCmd) import ChainCmd exposing (ChainCmd) import Routing +import TradeTable.Filters.State as Filters +import TradeTable.Filters.Types as Filters import TradeTable.Types exposing (..) -init : ( ColType, Ordering ) -> Model +init : ( ColType, Ordering ) -> Filters.Model -> Model init = Model @@ -36,5 +38,12 @@ update msg prevModel = | orderBy = newOrderBy } + FiltersMsg filtersMsg -> + justModelUpdate + { prevModel + | filtersModel = + prevModel.filtersModel |> Filters.update filtersMsg + } + NoOp -> justModelUpdate prevModel diff --git a/src/TradeTable/Types.elm b/src/TradeTable/Types.elm index 7e9e8be..4e1bfa3 100644 --- a/src/TradeTable/Types.elm +++ b/src/TradeTable/Types.elm @@ -4,16 +4,19 @@ import AppCmd exposing (AppCmd) import ChainCmd exposing (ChainCmd) import CommonTypes exposing (..) import Contracts.Types as CTypes +import TradeTable.Filters.Types as Filters type alias Model = { orderBy : ( ColType, Ordering ) + , filtersModel : Filters.Model } type Msg = TradeClicked FactoryType Int | ChangeSort ColType + | FiltersMsg Filters.Msg | NoOp diff --git a/src/TradeTable/View.elm b/src/TradeTable/View.elm index b75b6ed..fa3578d 100644 --- a/src/TradeTable/View.elm +++ b/src/TradeTable/View.elm @@ -15,6 +15,8 @@ import Images exposing (Image) import PaymentMethods exposing (PaymentMethod) import Time import TokenValue exposing (TokenValue) +import TradeTable.Filters.Types as Filters +import TradeTable.Filters.View as Filters import TradeTable.Types exposing (..) @@ -26,7 +28,8 @@ view time model colTypes trades = , Element.padding 30 , Element.spacing 5 ] - [ viewColHeaders model.orderBy colTypes + [ Element.map FiltersMsg <| Filters.view model.filtersModel + , viewColHeaders model.orderBy colTypes , viewTradeRows time model colTypes trades ] @@ -147,6 +150,7 @@ viewTradeRows time model colTypes trades = , Element.clip ] (trades + |> Filters.filterTrades model.filtersModel |> List.sortWith (sortByFunc model.orderBy) |> List.map (viewTradeRow time colTypes) ) @@ -162,7 +166,7 @@ viewTradeRow time colTypes trade = , Element.Events.onClick (TradeClicked trade.factory trade.id) ] [ Element.row - [ Element.width <| Element.fillPortion 6 + [ Element.width <| Element.fill , Element.spacing 1 ] (colTypes From ce919700e0afd80f1328251b909d5077dbbacad4 Mon Sep 17 00:00:00 2001 From: oglog Date: Tue, 13 Aug 2019 10:55:44 +0200 Subject: [PATCH 08/19] Moved filters out of TradeTable; re-implemented searching; improved TC status message rendering --- docs/404.html | 2 +- docs/index.html | 2 +- ...0befad.js => main-b49f933e0cbbcb672399.js} | 2 +- src/AgentHistory/State.elm | 18 +- src/AgentHistory/Types.elm | 14 +- src/AgentHistory/View.elm | 73 +++--- src/Contracts/Types.elm | 2 +- src/{TradeTable => }/Filters/State.elm | 4 +- src/{TradeTable => }/Filters/Types.elm | 24 +- src/{TradeTable => }/Filters/View.elm | 4 +- src/Marketplace/State.elm | 216 ++++++++-------- src/Marketplace/Types.elm | 43 ++-- src/Marketplace/View.elm | 238 +++++++++--------- src/TradeTable/State.elm | 11 +- src/TradeTable/Types.elm | 3 - src/TradeTable/View.elm | 7 +- 16 files changed, 321 insertions(+), 342 deletions(-) rename docs/static/js/{main-4fee17038e82ec0befad.js => main-b49f933e0cbbcb672399.js} (51%) rename src/{TradeTable => }/Filters/State.elm (88%) rename src/{TradeTable => }/Filters/Types.elm (78%) rename src/{TradeTable => }/Filters/View.elm (91%) diff --git a/docs/404.html b/docs/404.html index a954339..b507100 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 a954339..b507100 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-4fee17038e82ec0befad.js b/docs/static/js/main-b49f933e0cbbcb672399.js similarity index 51% rename from docs/static/js/main-4fee17038e82ec0befad.js rename to docs/static/js/main-b49f933e0cbbcb672399.js index 4daa876..93cea02 100644 --- a/docs/static/js/main-4fee17038e82ec0befad.js +++ b/docs/static/js/main-b49f933e0cbbcb672399.js @@ -4,4 +4,4 @@ * @author Feross Aboukhadijeh * @license MIT */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(pp,o,function(e){return si(gp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(yp,e,L(r,Tp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(yp,e,L(r,Sp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=Xg(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?Fg(o):Mg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return Xg(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Vg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Hg,Kg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(Ko,xa(Zs),f(Ko,xs,Xs))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ch,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ch,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ep)}),i.addEventListener("timeout",function(){a(wp)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),gp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(bp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Hg,Kg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Hg,Kg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Hg,Kg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co={$:"Buyer"},fo={$:"Seller"},lo=r(function(e,t){return{label:e,options:t}}),ho=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),po=r(function(e,t){return f(lo,"Offer Type",M([l(ho,"Buying",e,function(e){return R(e.parameters.initiatorRole,co)}),l(ho,"Selling",t,function(e){return R(e.parameters.initiatorRole,fo)})]))}),go={$:"Closed"},vo={$:"Committed"},yo={$:"Judgment"},mo={$:"Open"},bo=a(function(e,t,r,n){return f(lo,"Phase",M([l(ho,"Open",e,function(e){return R(e.state.phase,mo)}),l(ho,"Committed",t,function(e){return R(e.state.phase,vo)}),l(ho,"Judgment",r,function(e){return R(e.state.phase,yo)}),l(ho,"Closed",n,function(e){return R(e.state.phase,go)})]))}),Co={$:"Initiator"},Eo={$:"Responder"},So=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),To=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(Co):f(So,function(e){return R(t,e)?si(Eo):ci},e.state.responder)}),wo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),Io=r(function(e,t){return f(wo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return co}if("Seller"===r.b.$){r.a,r.b;return co}r.a,r.b;return fo},f(To,e,t))}),Ao=n(function(e,t,r){return f(lo,"Role",M([l(ho,"Buyer",t,function(t){return R(f(Io,t,e),si(co))}),l(ho,"Seller",r,function(t){return R(f(Io,t,e),si(fo))})]))}),Bo=r(function(e,t){return{filtersModel:t,orderBy:e}}),ko=Bo,No={$:"Ascending"},Ro={$:"Phase"},$o=Oe,_o=$o(yr),Lo=r(function(e,t){return L({agentAddress:t,tradeTable:f(ko,L(Ro,No),M([d(bo,!0,!0,!0,!1),f(po,!0,!0),l(Ao,t,!0,!0)])),wallet:e},_o)}),xo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Po={$:"None"},Do=Po,Uo=function(e){return d(xo,e,_o,Do,yr)},Oo=function(e){return{$:"TradeTableMsg",a:e}},Mo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),Fo=r(function(e,t){return f(Mo,e,t)}),Vo=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),Ko=n(function(e,t,r){return t(e(r))}),Ho=r(function(e,t){if("None"===t.$)return Po;var r=t.a,n=t.b,a=l(Vo,f(wo,Da(e),r.onSign),f(wo,Da(e),r.onBroadcast),f(wo,function(t){var r=t.a,n=t.b;return L(f(Ko,r,e),f(wo,function(t){return{confirmations:t.confirmations,toMsg:f(Ko,t.toMsg,e)}},n))},r.onMined));return f(Mo,a,n)}),jo=function(e){return{$:"AbiDecoder",a:e}},qo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Go=z,zo=Fr,Yo=r(function(e,t){return e<1?t:l(zo,e,Go(t),t)}),Wo=Yo(64),Jo=n(function(e,t,r){return L(f(qo,e,Wo(t)),r)}),Qo=r(function(e,t){return e<1?"":l(zo,0,e,t)}),Xo=Qo(64),Zo=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),eu=function(e){return-e},tu=r(function(e,t){return e<1?"":l(zo,-e,Go(t),t)}),ru=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(Qo,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(tu,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return jo(function(t){var r=t.a,n=t.b;return f(Zo,f(Jo,r,n),e(Xo(n)))})}(),nu=Hr,au=function(e){return f(nu,"0x",e)||f(nu,"0X",e)?f(Yo,2,e):e},iu=function(e){return e.b},ou=r(function(e,t){var r=e.a;return f(Zo,iu,r(function(e){return f(qo,e,e)}(au(t))))}),uu=Xr,su=ae,cu=Wr,fu=function(e){return f(uu,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return su(a)},cu)},lu=f(Ko,ou,fu),du=function(e){return{$:"Magnitude",a:e}},hu=function(e){return{$:"Pos",a:e}},pu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),gu=function(e){return{$:"MagnitudeNotNormalised",a:e}},vu=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 si(n)}return ci}},yu=function(e){var t=vu(e);return"Nothing"!==t.$&&t.a<0},mu=function(e){return{$:"Neg",a:e}},bu={$:"Zer"},Cu=function(e){return!e.b},Eu=r(function(e,t){var r=t.a;if(Cu(r))return bu;switch(e.$){case"Zero":return bu;case"Positive":return hu(t);default:return mu(t)}}),Su=r(function(e,t){return f(pu,e,gu(t))}),Tu=function(e){return f(La,r(function(t,r){return e(t)&&Cu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),wu=Ir,Iu=-1+f(wu,10,7),Au=Iu+1,Bu=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),ku=function(e){return e<0?f(Bu,Na(-1),ku(e+Au)):L(e/Au|0,e%Au)},Nu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=ku(r+e),i=a.a,o=a.b;return f(ka,o,f(Nu,i,n))}{if(!(_(e,Au)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Ru=function(e){var t=e.a;return du(Tu(f(Nu,0,t)))},$u=xa(eu),_u={$:"Negative"},Lu={$:"Positive"},xu={$:"Zero"},Pu=function(e){switch(e.$){case"Positive":return _u;case"Negative":return Lu;default:return xu}},Du=function(e){for(;;){var t=e.a,r=e.b,n=Ru(r),a=n.a;if(!yu(a))return f(Eu,t,du(a));e=f(Su,Pu(t),$u(a))}},Uu=pr,Ou=function(e){switch(f(Uu,e,0).$){case"LT":return _u;case"GT":return Lu;default:return xu}},Mu=function(e){return e<0?-e:e},Fu=function(e){return Du(f(pu,Ou(e),gu(M([Mu(e)]))))},Vu=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(wu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},Ku=function(e){switch(e.$){case"Zer":return bu;case"Neg":var t=e.a;return hu(t);default:return e}},Hu=function(e){return{$:"MagnitudePair",a:e}},ju=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(ka,L(a,u),f(ju,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(ju,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(ju,yr,s))}return yr}),qu=r(function(e,t){var r=e.a,n=t.a;return Hu(f(ju,r,n))}),Gu=function(e){switch(e.$){case"Zer":return f(Su,xu,yr);case"Neg":var t=e.a.a;return f(Su,Lu,$u(t));default:var t=e.a.a;return f(Su,Lu,t)}},zu=r(function(e,t){var r=Gu(t),n=r.b,a=Gu(e),i=a.b,o=f(qu,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Du(f(pu,Lu,gu(s)))}),Yu=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(R(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 Ta}return a.b.b?ba:f(Uu,e,t)}}),Wu=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},Ju=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(Yu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Wu(d(Yu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),Qu=r(function(e,t){return R(f(Ju,e,t),Ta)}),Xu=K,Zu=r(function(e,t){return!f(Qu,e,t)}),es=function(e){switch(e.$){case"Zer":return du(yr);case"Pos":default:var t=e.a;return t}},ts=r(function(e,t){var r=e.a;return Ru(gu(f(xa,ti(t),r)))}),rs=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(ts,du(n),a),u=f(rs,du(i),du(n)),s=u.a,c=f(zu,f(Eu,Lu,o),f(Eu,Lu,du(f(ka,0,s))));return es(c)}var a=r.a;return f(ts,du(n),a)}return du(yr)}),ns=function(e){switch(e.$){case"Zer":return xu;case"Pos":return Lu;default:return _u}},as=r(function(e,t){return R(e,xu)||R(t,xu)?xu:R(e,t)?Lu:_u}),is=r(function(e,t){return f(Eu,f(as,ns(e),ns(t)),f(rs,es(e),es(t)))}),os=function(e){switch(e.$){case"Zer":return bu;case"Pos":var t=e.a;return mu(t);default:var t=e.a;return hu(t)}},us=r(function(e,t){return f(zu,e,os(t))}),ss=Fu(0),cs=a(function(e,t,r,n){if(e){var a=Fu(e),i=f(is,f(is,a,n),t),o=f(Zu,i,r)?L(f(is,a,t),f(us,r,i)):L(ss,r),u=o.a,s=o.b,c=d(cs,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(zu,u,l),h)}return L(ss,r)}),fs=Fa(f(Va,2,Iu)),ls=n(function(e,t,r){return d(cs,f(wu,2,fs),e,t,r)}),ds=Fu(1),hs=r(function(e,t){return e}),ps=n(function(e,t,r){return l(Ra,hs(e),t,f(Ai,1,r))}),gs=function(e){return l(ps,is(Fu(Au)),ds,e)},vs=n(function(e,t,r){if(e){var n=l(ls,gs(e),t,r),a=n.a,i=n.b,o=l(vs,e-1,i,r),u=o.a,s=o.b;return L(f(zu,a,u),s)}return l(ls,gs(e),t,r)}),ys=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},ms=r(function(e,t){if(R(t,ss))return ci;var r=Ti(ys(e))-Ti(ys(t))+1,n=l(vs,f(ei,0,r),Ku(e),Ku(t)),a=n.a,i=n.b;return si(L(f(Eu,f(as,ns(e),ns(t)),es(a)),f(Eu,ns(e),es(i))))}),bs=f(is,Fu(2),Fu(2147483648)),Cs=xr,Es=function(e){return f(Cs,e,"")},Ss=Pn,Ts=n(function(e,t,r){return e<=0?r:l(Ts,e>>1,U(t,t),1&e?U(r,t):r)}),ws=r(function(e,t){return l(Ts,e,t,"")}),Is=n(function(e,t,r){return U(f(ws,e-Go(r),Es(t)),r)}),As=te,Bs=Ar,ks=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},Ns=r(function(e,t){for(;;){if(t<16)return f(ka,ks(t),e);var r=f(ka,ks(f(Bs,16,t)),e),n=t/16|0;e=r,t=n}}),Rs=function(e){return As(e<0?f(ka,P("-"),f(Ns,yr,-e)):f(Ns,yr,e))},$s=function(e){var t=f(ms,e,bs);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=Rs(Vu(a));return R(n,Fu(0))?i:U($s(n),l(Is,8,P("0"),i))},_s=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,du(yr))?"0":$s(hu(t));default:var t=e.a;return"-"+_s(f(is,Fu(-1),e))}},Ls=function(e){return l(Is,64,P("0"),e)},xs=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=Ls(Rs(a)),c=function(e){return U(e,n)}(Ls(Rs(u)));return x(a+32+(Go(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Ps=Dr,Ds=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))))}),Us=n(function(e,t,n){return l(Ps,r(function(t,r){return l(Ds,e,yi(t),r)}),t,n)}),Os=function(e){return $a(l(Us,ka,yr,e))},Ms=function(e){return f(Ri,"",f(xa,f(Ko,Rs,f(Is,2,P("0"))),Os(e)))},Fs=function(e){return 64-f(Bs,64,e)},Vs=function(e){return U(e,f(ws,Fs(Go(e)),"0"))},Ks=function(e){return L(si(Go(e)/2|0),Vs(e))},Hs=function(e){return L(ci,Ls(e))},js=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},qs=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"}},Gs=Ur,zs=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(Cs,P("1"),r),!0);case"1":return L(f(Cs,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Cs,P("0"),r),!1);case"1":return L(f(Cs,P("1"),r),!0);default:break e}return L(r,!0)});return l(Gs,t,L("",!1),e).a},Ys=function(e){return l(Gs,ka,yr,e)},Ws=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Yo,e,t),i=f(ka,l(zo,0,e,t),r);e=n,t=a,r=i}}),Js=r(function(e,t){return e&&""!==t?l(Ws,e,t,yr):M([t])}),Qs=function(e){var t=function(){var t=Ys(_s(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(Ko,zs,f(Is,256,P("1"))))}var r=t;return L(r,f(Is,256,P("0")))}(),r=t.a,n=t.b;return As(f(xa,js,f(Js,4,n(f(Ri,"",f(xa,qs,r))))))},Xs=function(e){return{$:"Hex",a:e}},Zs=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Hs(t);case"UintE":var r=e.a;return Hs(_s(r));case"IntE":var n=e.a;return Hs(Qs(n));case"BoolE":return Hs(e.a?"1":"0");case"DBytesE":var a=e.a.a;return Ks(a);case"BytesE":var a=e.a.a;return Hs(au(a));case"StringE":var i=e.a;return Ks(Ms(i));case"ListE":var o=e.a;return function(e){var t=e.a;return Ks(t)}(Xt()(o));default:var i=e.a;return Hs(au(i))}};try{var ec=Xt();Xt=function(){return ec}}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 tc=Pr,rc=function(e){return 1===Go(e)?f(tc,"0",e):e},nc=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(ka,n,r);e=i,t=o,r=u}}}),ac=r(function(e,t){return $a(l(nc,e,t,yr))}),ic=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(ac,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(ic,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),oc=r(function(e,t){return l(ic,0,e,t)}),uc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),sc=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 Pt(e.a)}},cc={$:"LE"},fc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,cc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,cc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,cc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,cc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,cc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,cc));case"Seq":var i=e.b;return l(lc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),lc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(fc,n,t,r);e=i,t=o,r=u}}),dc=Dt,hc=r(function(e,t){return{$:"Seq",a:e,b:t}}),pc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+sc(r),i=n;e=a,t=i}}),gc=function(e){return f(hc,f(pc,0,e),e)},vc=function(e){return{$:"U8",a:e}},yc=vc,mc=r(function(e,t){return _(e,t)<0?e:t}),bc=hr,Cc=function(e){return{$:"Bytes",a:e}},Ec=Cc,Sc=function(e){return dc(gc(f(xa,Ec,$a(e))))},Tc=Pt,wc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Ic=function(e){return{$:"Decoder",a:e}},Ac=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}}),Bc=r(function(e,t){return Ic(f(Ac,e,t))}),kc=Ic(Yn),Nc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Rc=function(e){return{$:"Done",a:e}},$c=function(e){return{$:"Loop",a:e}},_c=r(function(e,t){var n=t.a;return Ic(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),Lc=function(e){return Ic(r(function(t,r){return L(r,e)}))},xc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Lc(Rc($a(n))):f(_c,function(e){return $c(L(r-1,f(ka,e,n)))},e)}),Pc=function(e){return f(Nc,yr,f(wc,f(Bc,L(Tc(e),yr),xc(kc)),e))},Dc=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))}),Uc=r(function(e,t){return l(Dc,Ss,e,t)}),Oc=f(Ai,0,4),Mc=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}}),Fc=xt,Vc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),Kc=function(e){return f(Vc,f(Ko,Fc,Ss(4294967295)),e)},Hc=r(function(e,t){return 5*t+e}),jc=4294967295>>>32-Ha,qc=ar,Gc=n(function(e,t,r){for(;;){var n=jc&t>>>e,a=f(qc,n,r);if("SubTree"!==a.$){var i=a.a;return f(qc,jc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),zc=function(e){return e>>>5<<5},Yc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,zc(r))>-1?f(qc,jc&e,i):l(Gc,n,e,a))}),Wc=r(function(e,t){var r=f(Yc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),Jc=n(function(e,t,r){var n=f(Hc,e,t);return f(Wc,n,r)}),Qc=ir,Xc=a(function(e,t,r,n){var a=jc&t>>>e,i=f(qc,a,n);if("SubTree"===i.$){var o=i.a,u=d(Xc,e-Ha,t,r,o);return l(Qc,a,za(u),n)}var s=i.a,c=l(Qc,jc&t,r,s);return l(Qc,a,Ga(c),n)}),Zc=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,zc(n))>-1?d(Ma,n,a,i,l(Qc,jc&e,t,o)):d(Ma,n,a,d(Xc,a,e,t,i),o)}),ef=n(function(e,t,r){return l(Zc,e,t,r)}),tf=a(function(e,t,r,n){var a=f(Hc,e,t);return l(ef,a,r,n)}),rf=Dn,nf=r(function(e,t){return l(Dc,rf,e,t)}),af=function(e){var t=l(La,r(function(t,n){var a={d0:l(Jc,0,t,e.state),d1:l(Jc,1,t,e.state),d2:l(Jc,2,t,e.state),d3:l(Jc,3,t,e.state),d4:l(Jc,4,t,e.state)},i=r(function(e,r){return d(tf,e,t,f(nf,f(Mc,e,a),f(Uc,Kc(f(Mc,f(Bs,5,e+1),a)),f(Mc,f(Bs,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Oc);return D(e,{state:t})},of=L(0,0),uf=function(e){return{current:of,lfsrstate:1,state:e,x:1,y:0}},sf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},cf=L(1,0),ff=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),lf=r(function(e,t){if(e){var n=f(ff,1,t);return l(Dc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),df=r(function(e,t){var r=f(Bs,32,e/32|0),n=f(ff,r,t),a=f(Bs,32,e);return f(lf,a,n)}),hf=n(function(e,t,r){var n=f(Yc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(Zc,e,t(a),r)}),pf=n(function(e,t,r){return l(hf,e,nf(t),r)}),gf=a(function(e,t,r,n){var a=f(Hc,e,t);return l(pf,a,r,n)}),vf=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),wf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(mc,n,r),i=f(xa,function(e){return f(Tf,e,g)},f(Ai,0,a)),o=Sf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(oc,i.outputLen,l(v,g,yr,i.outputLen))},kf=function(e){return{$:"KS",a:e}},Nf=function(e){var t=e.a;return kf({config:t,inputLength:0,partial:yr,state:f(ui,25,hs(of))})},Rf=function(e){return Ic(Wn(e))},$f=dc(gc(yr)),_f=r(function(e,t){var n=t.a;return Ic(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),Lf=r(function(e,t){return f(_f,function(e){return Rf(t)},Rf(e))}),xf=r(function(e,t){return f(Nc,$f,f(wc,f(Lf,e,Tc(t)-e),t))}),Pf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=Tc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+Tc(e)}),0,i),a)>-1))return kf(D(n,{inputLength:Tc(e)+n.inputLength,partial:i}));var o=Sc(i),u=f(Nc,$f,f(wc,Rf(a),o)),s=Pc(u),c=f(Af,s,n.state),d=Sf(c),h=f(xf,a,o),p=$f,g=kf(D(n,{inputLength:Tc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Df=r(function(e,t){return Bf(f(Pf,dc(gc(f(xa,yc,t))),Nf(e)))}),Uf=Df(uc),Of=function(e){return Xs(f(Ri,"",f(xa,f(Ko,Rs,rc),f(oc,4,Uf(f(xa,yi,Ys(e)))))))},Mf=function(e){return f(nu,"0x",e)||f(nu,"0X",e)?e:"0x"+e},Ff=function(e){var t=e.a;return Mf(t)},Vf=r(function(e,t){var r=xs(f(xa,Zs,t)),n=function(e){return U(e,r)}(au(Ff(Of(e))));return Xs(n)}),Kf=function(e){return{data:si(f(Vf,"poke()",yr)),decoder:lu(ru),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Hf=r(function(e,t){return{$:"Trade",a:e,b:t}}),jf=r(function(e,t){return D(t,{checked:e})}),qf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Gf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(qf,f(Ko,function(e){return e.label},Ja(r)),function(e){return D(e,{options:l(qf,f(Ko,function(e){return e.label},Ja(n)),jf(a),e.options)})},t)}),zf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Yf={$:"Descending"},Wf=function(e){return"Ascending"===e.$?Yf:No},Jf=function(e){return d(zf,e,_o,Do,yr)},Qf=r(function(e,t){return L(t.a,e(t.b))}),Xf=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(zf,t,_o,Do,M([da(f(Hf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(Qf,Wf,t.orderBy):L(a,No);return Jf(D(t,{orderBy:i}));case"FiltersMsg":var o=e.a;return Jf(D(t,{filtersModel:f(Gf,o,t.filtersModel)}));default:return Jf(t)}}),Zf=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},el=yn,tl=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=Zf(Kf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(Fo,a,n);return d(xo,t,_o,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(xo,t,_o,Do,M([da(f(Hf,o,u))]));case"TradeTableMsg":var s=e.a,c=f(Xf,s,t.tradeTable);return d(xo,D(t,{tradeTable:c.model}),f(el,Oo,c.cmd),f(Ho,Oo,c.chainCmd),f(xa,Ji(Oo),c.appCmds));default:return Uo(t)}}),rl={$:"BottomRight"},nl={$:"ShouldBeImpossible"},al=lr,il=function(e){return qi(e)},ol=r(function(e,t){f(al,e,t);return{align:rl,label:"unexpectedError",mainParagraphs:M([M([il(e)])]),noticeType:nl}}),ul=function(e){var t=e.a;return Mf(t)},sl=ye,cl=f(Ko,ul,sl),fl=f(Ko,_s,f(Ko,Mf,sl)),ll=f(Ko,Ff,sl),dl=f(Ko,Rs,f(Ko,Mf,sl)),hl=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),pl=un,gl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},vl=function(e){return gl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(Nc,pl,r))},f(hl,function(e){e.a;return!R(e.b,ci)},e)))},yl=function(e){return vl(M([L("to",f(wo,cl,e.to)),L("from",f(wo,cl,e.from)),L("gas",f(wo,dl,e.gas)),L("gasPrice",f(wo,fl,e.gasPrice)),L("value",f(wo,fl,e.value)),L("data",f(wo,ll,e.data)),L("nonce",f(wo,dl,e.nonce))]))},ml=function(e){return{$:"TxSentry",a:e}},bl=ye,Cl=r(function(e,t){return gl(M([L("ref",bl(e)),L("txParams",t)]))}),El=function(e){return{$:"Signing",a:e}},Sl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:El(e)}}),Tl={$:"Black"},wl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Il={$:"RBEmpty_elm_builtin"},Al={$:"Red"},Bl=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(wl,Al,t,r,h(wl,Tl,c,f,l,d),h(wl,Tl,i,o,u,s))}return h(wl,e,i,o,h(wl,Al,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(wl,Al,c,f,h(wl,Tl,g,v,y,m),h(wl,Tl,t,r,d,a))}return h(wl,e,t,r,n,a)}),kl=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(wl,Al,e,t,Il,Il);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Uu,e,a).$){case"LT":return h(Bl,n,a,i,l(kl,e,t,o),u);case"EQ":return h(wl,n,a,t,o,u);default:return h(Bl,n,a,i,o,l(kl,e,t,u))}}),Nl=n(function(e,t,r){var n=l(kl,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(wl,Tl,a,i,o,u)}return n}),Rl=n(function(e,t,r){var n=e.a,a=yl(r),i=l(Nl,n.ref,f(Sl,r,t),n.txs);return L(ml(D(n,{ref:n.ref+1,txs:i})),f(el,n.tagger,n.outPort(f(Cl,n.ref,a))))}),$l=Rl,_l=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,_o,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l($l,n,i,o))}return x(ci,_o,M([f(ol,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ll=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),xl=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Pl=function(e){return{$:"Posix",a:e}},Dl=Pl,Ul={autoabortInterval:Dl(0),autorecallInterval:Dl(0),autoreleaseInterval:Dl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:fo},Ol=function(e){return{$:"TokenValue",a:e}},Ml=function(e){return e.a},Fl=r(function(e,t){return f(Nc,ss,f(wo,Qa,f(ms,e,t)))}),Vl=r(function(e,t){return Ol(f(Fl,Ml(e),Fu(t)))}),Kl=function(e){return f(Vl,e,12)},Hl=function(e){return f(Vl,e,3)},jl=Ol(Fu(0)),ql=r(function(e,t){var r=jl;return{abortPunishment:Kl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Hl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Gl=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},zl=qr,Yl=function(e){var t=Gl(f(zl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Go(e)-1-r;return L(U(f(Qo,r,e),f(Yo,r+1,e)),n)},Wl=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 yr}}),Jl=function(e){var t=e.a,r=f(Wl,Ja(0),t);return du(r.b?t:yr)},Ql=Z,Xl=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}}}),Zl=n(function(e,t,r){var n=f(Xl,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(oc,e,r),l(Zl,e,t,n)):yr}),ed=r(function(e,t){return l(Zl,e,e,t)}),td=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(wo,ka(a),r)});return f(La,t,si(yr))}(Ua),rd=function(e){return f(wo,f(Da,Jl,du),td(f(xa,f(Ko,$a,f(Ko,As,Ql)),f(ed,7,$a(e)))))},nd=Q,ad=function(e){var t=Ys(nd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(wo,Eu(_u),rd(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(wo,Eu(Lu),rd(r))}return ci;default:var r=t;return f(wo,Eu(Lu),rd(r))}},id=function(e){var t=function(e){return!f(Bs,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(Nc,0,Gl(r)))}},od=function(e){return f(is,e,e)},ud=Fu(2),sd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ds;case"Neg":return bu;default:if(R(r,ds))return f(is,e,t);if(id(r)){var n=e,a=od(t),i=f(Fl,r,ud);e=n,t=a,r=i;continue e}var n=f(is,t,e),a=od(t),i=f(Fl,f(us,r,ds),ud);e=n,t=a,r=i;continue e}}),cd=r(function(e,t){return l(sd,ds,e,t)}),fd=function(e){if(""===e)return ci;var t=Yl(e),r=t.a,n=t.b,a=ad(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(is,o,f(cd,Fu(10),Fu(i)));return si(u)},ld=function(e){return f(wo,Ol,fd(e))},dd=jr,hd=function(e){for(;;){if(f(dd,".",e))return l(zo,0,-1,e);{if(!f(dd,"0",e))return""===e?"0":e;e=l(zo,0,-1,e)}}},pd=f(Da,f(Is,7,P("0")),Ni),gd=function(e){return f(Ri,"",e)},vd=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return gd(f(ka,Ni(n),f(xa,pd,a)))}return"0"},yd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return vd(t);default:var t=e.a;return"-"+vd(t)}},md=r(function(e,t){return e<1?t:l(zo,0,-e,t)}),bd=function(e){var t=l(Is,18,P("0"),yd(e)),r=f(md,18,t)+"."+f(tu,18,t);return function(e){return""===e?"0":e}(hd(r))},Cd=r(function(e,t){var r=bd(t),n=Gl(f(zl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Qo,a+1+e,r):f(Qo,a,r)}),Ed=r(function(e,t){if("Nothing"===e.$)return bd(Ml(t));var r=e.a;return f(Cd,r,Ml(t))}),Sd=ee,Td=function(e){var t=Sd(f(Ed,ci,e));if("Just"===t.$){return t.a}f(al,"Error converting tokenValue to float: string -> float failed",e);return 0},wd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=ld(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return Td(r)<1?fi("Trade amount can't be less than 1."):li(r)},Id=function(e){if(""===e)return fi("You must specify a fiat price.");var t=ad(e);if("Nothing"===t.$){var r=Sd(e);return fi("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 li(n)},Ad=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),Bd=function(e){return""===e},kd=function(e){return Bd(e)?ci:si(e)},Nd=function(e){return f(Ad,"You must specify a fiat type.",kd(e))},Rd=function(e){return""===e?fi("Must specify a payment method."):li(e)},$d=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),_d=g($d,ci,ci,ci,ci,ci,ci,ci),Ld=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},xd=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Pd={$:"Custom"},Dd=r(function(e,t){return{info:t,type_:e}}),Ud=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Od=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),Md=function(e){return e.a},Fd=function(e){return p(Ud,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Dd,Pd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Od,function(e){return D(_d,{daiAmount:si(e)})},wd(e.daiAmount)),f(Od,function(e){return D(_d,{fiatAmount:si(e)})},Id(e.fiatAmount)),f(Od,function(e){return D(_d,{fiatType:si(e)})},Nd(e.fiatType)),f(Od,function(e){return D(_d,{paymentMethod:si(e)})},Rd(e.paymentMethod)),Ld(d(xd,function(e){return Md(e)>0?li(e):fi(D(_d,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return Md(e)>0?li(e):fi(D(_d,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return Md(e)>0?li(e):fi(D(_d,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Vd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},Kd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Hd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},jd=function(e){var t=Fd(e.inputs),r=function(){return R(e.errors,_d)?_d:"Ok"===t.$?_d:t.a}();return D(e,{createParameters:l(Kd,ql,Vd(e.wallet),Hd(t)),errors:r})},qd=r(function(e,t){return jd(D(t,{inputs:e}))}),Gd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),zd=function(e){return d(Gd,f(qd,Ul,{allowance:ci,createParameters:ci,depositAmount:ci,errors:_d,inputs:Ul,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),_o,Do,yr)},Yd=a(function(e,t,r,n){return la(d(Ll,e,t,r,n))}),Wd=function(e){return{$:"Address",a:e}},Jd=f(Ko,au,f(Ko,nd,Wd)),Qd=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Jd("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return Jd("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return Jd("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return Jd("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return Jd("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},Xd=function(e){return Jd("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},Zd=function(e){return{$:"AddressE",a:e}},eh=Zd,th=function(e){return{$:"UintE",a:e}},rh=th,nh=n(function(e,t,r){return{data:si(f(Vf,"approve(address,uint256)",M([eh(t),rh(r)]))),decoder:lu(ru),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ah=function(e){return f(Vl,e,200)},ih=r(function(e,t){return Ol(f(zu,Ml(e),Ml(t)))}),oh=function(e){var t=f(Vl,e.tradeAmount,200);return f(ih,e.pokeReward,f(ih,ah(e.tradeAmount),f(ih,t,function(){return"Buyer"===e.initiatorRole.$?Hl(e.tradeAmount):e.tradeAmount}())))},uh=Mi(ya),sh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ch=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),fh=Xn,lh=Qn,dh=function(e){return f(lh,{caseInsensitive:!1,multiline:!1},e)},hh=Jn,ph=fh(f(Nc,hh,dh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),gh=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}}),vh=r(function(e,t){return!f(gh,f(Da,Xu,e),t)}),yh=vh(Ua),mh=q,bh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ch=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Eh=f(La,Ch(ka),li(yr)),Sh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},Th=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(wu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(wu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(wu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(wu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(wu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(wu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(wu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(wu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(wu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(wu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(wu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(wu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(wu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(wu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(wu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(Es(s)+" is not a valid hexadecimal character.")}}}),wh=function(e){if(Bd(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(nu,"-",e)){var t=f(Nc,yr,Sh(Ys(e)));return f(Zo,eu,l(Th,Ti(t)-1,t,0))}return l(Th,Go(e)-1,Ys(e),0)}();return f(Od,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Ih=function(e){var t=Ys(e);return function(e){return L(t,e)}(f(bh,yr,Eh(f(xa,wh,f(_i,"",f(Ri,"",f(xa,f(Ko,Rs,rc),f(oc,20,Uf(f(xa,f(Ko,mh,yi),t))))))))))},Ah=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Ih(au(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!ph(e)&&yh(o)},Bh=fh(f(Nc,hh,dh("^((0[Xx]){1})?[0-9a-f]{40}$"))),kh=fh(f(Nc,hh,dh("^((0[Xx]){1})?[0-9A-F]{40}$"))),Nh=function(e){return'"'+e+'"'},Rh=function(e){var t=au(e),r=f(Qo,24,t),n=f(tu,40,e);return 64===Go(t)&&f(ki,Ja(P("0")),r)?kh(n)||Bh(n)?li(Wd(n)):Ah(n)?li(Wd(n)):fi("Given address "+Nh(e)+" failed the EIP-55 checksum test."):40!==Go(t)?fi("Given address "+Nh(e)+" is not the correct length."):ph(t)?kh(t)||Bh(t)?li(Wd(t)):Ah(t)?li(Wd(t)):fi("Given address "+Nh(e)+" failed the EIP-55 checksum test."):fi("Given address "+Nh(e)+" contains invalid hex characters.")},$h=jo(function(e){var t=e.a,r=e.b;return f(Zo,f(Jo,t,r),Rh(Xo(r)))}),_h=r(function(e,t){var r=t.a;return jo(function(t){var n=t.a,a=t.b;return r(f(qo,n,f(Yo,64*e,a)))})}),Lh=Jr,xh=r(function(e,t){return f(Lh,"data",lu(f(_h,e,t)))}),Ph=Qr,Dh=r(function(e,t){return f(Lh,"topics",f(Ph,e,lu(t)))}),Uh=function(e){return f(wo,f(Ko,$a,f(Ra,r(function(e,t){return f(zu,Fu(e),f(is,t,bs))}),ss)),td(f(xa,f(Ko,$a,f(Ko,As,f(Ko,wh,Hd))),f(ed,8,$a(e)))))},Oh=function(e){var t=Ys(nd(e));e:for(;;){if(!t.b)return ci;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(wo,is(Fu(-1)),Uh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(wo,is(Fu(-1)),Uh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Uh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Uh(a)}t.b;return ci}break e;default:break e}}var a=t;return Uh(a)},Mh=jo(function(e){var t=e.a,r=e.b;return f(Zo,f(Jo,t,r),f(Ad,"Error Decoding Uint into BigInt",Oh(Mf(Xo(r)))))}),Fh=f(uh,f(Dh,1,$h),f(uh,f(xh,1,$h),f(uh,f(xh,0,Mh),Fi(sh)))),Vh=nn,Kh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Hh=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(Vh,e,gl(M([L("data",sl(t.data)),L("topics",f(Kh,ll,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),jh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),qh=r(function(e,t){return f(Zo,function(e){return e.id},f(jh,function(e){return f(Od,Di,f(Hh,Fh,e).returnData)},f(Ad,"No log found from that factoryAddress in that txReceipt",Gl(f(hl,function(t){return R(f(Ko,ul,nd)(t.address),f(Ko,ul,nd)(Qd(e)))},t.logs)))))}),Gh=n(function(e,t,r){return{data:si(f(Vf,"allowance(address,address)",M([eh(t),eh(r)]))),decoder:lu(Mh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),zh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Yh=function(e){switch(e.$){case"BlockNum":var t=e.a;return sl(Mf(Rs(t)));case"EarliestBlock":return sl("earliest");case"LatestBlock":return sl("latest");default:return sl("pending")}},Wh=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return vl(M([L("to",f(wo,cl,t)),L("from",f(wo,cl,r)),L("gas",f(wo,dl,n)),L("gasPrice",f(wo,fl,a)),L("value",f(wo,fl,i)),L("data",f(wo,ll,o))]))},Jh=function(e){return{$:"BadBody",a:e}},Qh=function(e){return{$:"BadStatus",a:e}},Xh=function(e){return{$:"BadUrl",a:e}},Zh={$:"NetworkError"},ep={$:"Timeout"},tp=rn,rp=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(Xh(r));case"Timeout_":return fi(ep);case"NetworkError_":return fi(Zh);case"BadStatus_":var n=t.a,a=t.b;return fi(Qh(n.statusCode));default:var n=t.a,a=t.b,i=f(tp,f(Lh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(Jh(Di(u)))}}),np=n(function(e,t,r){return gl(M([L("id",bl(e)),L("jsonrpc",sl("2.0")),L("method",sl(t)),L("params",f(Kh,Ua,r))]))}),ap=Il,ip=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Uu,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),op=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},up=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(wl,Al,p,g,h(wl,Tl,r,n,h(wl,Al,i,o,u,s),v),h(wl,Tl,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(wl,Tl,r,n,h(wl,Al,i,o,u,s),h(wl,Al,f,l,d,m))}return e},sp=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(wl,Al,i,o,h(wl,Tl,s,c,f,l),h(wl,Tl,r,n,d,h(wl,Al,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(wl,Tl,r,n,h(wl,Al,i,o,C,d),h(wl,Al,g,v,y,m))}return e},cp=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(wl,r,u,s,c,h(wl,Al,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 sp(t)}break e}o.a,o.d;return sp(t)}break e}return t}),fp=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(wl,t,r,n,fp(a),u)}var s=up(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Bl,c,f,l,fp(d),p)}return Il}return h(wl,t,r,n,fp(a),u)}return Il},lp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Il;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(wl,r,n,a,f(lp,e,i),o)}var s=up(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Bl,c,l,d,f(lp,e,p),v)}return Il}return h(wl,r,n,a,f(lp,e,i),o)}return f(dp,e,g(cp,e,t,r,n,a,i,o))}),dp=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(R(e,n)){var u=op(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Bl,r,s,c,i,fp(o))}return Il}return h(Bl,r,n,a,i,f(lp,e,o))}return Il}),hp=r(function(e,t){var r=f(lp,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(wl,Tl,n,a,i,o)}return r}),pp=n(function(e,t,r){var n=t(f(ip,e,r));if("Just"===n.$){var a=n.a;return l(Nl,e,a,r)}return f(hp,e,r)}),gp=function(e){return"Just"===e.$},vp=gn,yp=vn,mp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),bp=function(e){return{$:"BadUrl_",a:e}},Cp=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ep={$:"NetworkError_"},Sp=function(e){return{$:"Receiving",a:e}},Tp=function(e){return{$:"Sending",a:e}},wp={$:"Timeout_"},Ip=function(e){return f(ta,"application/json",f(xi,0,e))},Ap=n(function(e,t,r){return Ip(l(np,e,t,r))}),Bp=f(ea,"",Ua),kp=Te,Np=Se,Rp=function(e){if("Ok"===e.$){var t=e.a;return Np(t)}var r=e.a;return kp(r)},$p=function(e){return l(Zn,gr,Rp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},_p=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return $p({body:l(Ap,1,r,n),headers:yr,method:"POST",resolver:Bp(rp(a)),timeout:ci,url:t})},Lp=n(function(e,t,r){return _p({decoder:t.decoder,method:"eth_call",params:M([Wh(t),Yh(r)]),url:e})}),xp={$:"LatestBlock"},Pp=r(function(e,t){return l(Lp,e,t,xp)}),Dp=function(e){return{$:"Perform",a:e}},Up=sn,Op=Np(gr),Mp=r(function(e,t){return f(Up,function(t){return Np(e(t))},t)}),Fp=n(function(e,t,r){return f(Up,function(t){return f(Up,function(r){return Np(f(e,t,r))},r)},t)}),Vp=function(e){return l(La,Fp(ka),Np(yr),e)},Kp=r(function(e,t){var r=t.a;return Be(f(Up,vp(e),r))}),Hp=n(function(e,t,r){return f(Mp,function(e){return gr},Vp(f(xa,Kp(e),t)))}),jp=n(function(e,t,r){return Np(gr)}),qp=r(function(e,t){var r=t.a;return Dp(f(Mp,e,r))});pn.Task=Pe(Op,Hp,jp,qp);var Gp=Ue("Task"),zp=cn,Yp=r(function(e,t){return Gp(Dp(f(zp,f(Da,f(Da,Np,e),fi),f(Up,f(Da,f(Da,Np,e),li),t))))}),Wp=a(function(e,t,r,n){return f(Yp,n,f(Pp,zh(eo(e)),l(Gh,Xd(e),t,r)))}),Jp=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Jd("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return Jd("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return Jd("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return Jd("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return Jd("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Qp=function(e){return{$:"BoolE",a:e}},Xp=Qp,Zp=function(e){return{$:"StringE",a:e}},eg=Zp,tg=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:si(f(Vf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([eh(t),eh(r),Xp(n),rh(a),rh(i),rh(o),rh(u),rh(s),rh(c),rh(l),rh(d),eg(h),eg(p)]))),decoder:lu($h),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},rg=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:si(f(Vf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([eh(t),eh(r),Xp(n),rh(a),rh(i),rh(o),rh(u),rh(s),rh(c),rh(l),rh(d),eg(h),eg(p)]))),decoder:lu($h),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ng=r(function(e,t){return{paymentMethods:t,price:e}}),ag=function(e){return sl(yd(e))},ig=function(e){return f(Kh,Ua,M([sl(e.fiatType),ag(e.amount)]))},og=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},ug=function(e){return gl(M([L("type",sl(og(e.type_))),L("info",sl(e.info))]))},sg=function(e){var t=ig(e.price),r=f(Kh,ug,e.paymentMethods);return f(xi,0,gl(M([L("paymentmethods",r),L("price",t)])))},cg=r(function(e,t){return D(t,{value:si(e)})}),fg=function(e){return Fu(Md(e))},lg=function(e){return f(Fl,fg(e),Fu(1e3))},dg=r(function(e,t){var r=function(){return"Token"===e.$?tg:rg}();return function(){return"Native"===e.$?cg(Ml(oh(t))):Ua}()(r(Qd(e))(t.initiatorAddress)(Jp(e))(R(t.initiatorRole,fo))(Ml(t.tradeAmount))(Ml(Hl(t.tradeAmount)))(Ml(Kl(t.tradeAmount)))(Ml(t.pokeReward))(lg(t.autorecallInterval))(lg(t.autoabortInterval))(lg(t.autoreleaseInterval))(Ml(ah(t.tradeAmount)))(sg(f(ng,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),hg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),pg=function(e){return{$:"CreateNeedsSig",a:e}},gg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),vg=r(function(e,t){var r=Zf(f(dg,e,t)),n={onBroadcast:ci,onMined:si(L(hg(e),ci)),onSign:si(gg(e))};return L(si(pg(e)),f(Fo,n,r))}),yg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),mg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),bg=function(e){return{$:"ApproveNeedsSig",a:e}},Cg=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Eg=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Sg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),Tg={$:"NoOp"},wg=function(e){return{appCmds:yr,chainCmd:Do,cmd:_o,model:e}},Ig=function(e){return Ql(yd(e))},Ag={$:"Error"},Bg=r(function(e,t){f(al,e+" fetch error",t);return{align:rl,label:"web3FetchError",mainParagraphs:M([M([il('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:Ag}}),kg=r(function(e,t){return{align:rl,label:"web3MiningError",mainParagraphs:M([M([il('Error mining "'+e+'" transaction: '+t)])]),noticeType:Ag}}),Ng={$:"Caution"},Rg=r(function(e,t){return{align:rl,label:"web3SigError",mainParagraphs:M([M([il('Error signing "'+e+'" transaction: '+t)])]),noticeType:Ng}}),$g={$:"KovanDai"},_g=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo($g));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Lg=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},xg=function(e){return f(So,_g,Lg(e))},Pg=r(function(e,t){return 1-e(1-t)}),Dg=function(e){return f(wu,e,5)},Ug=Pg(Dg),Og={easing:Ug,offset:12,speed:200},Mg=function(e){return{$:"External",a:e}},Fg=function(e){return{$:"Internal",a:e}},Vg=function(e){return{$:"NotFound",a:e}},Kg=function(e){for(;;){e=e.a}},Hg=r(function(e,t){return Gp(Dp(f(Mp,e,t)))}),jg={$:"Http"},qg={$:"Https"},Gg=Kr,zg=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(Bd(a)||f(Gg,"@",a))return ci;var i=f(zl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=Ql(f(Yo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(zg,e,f(Qo,o,a),s,t,r,n))}return si(p(zg,e,a,ci,t,r,n))}),Wg=a(function(e,t,r,n){if(Bd(n))return ci;var a=f(zl,"/",n);if(a.b){var i=a.a;return h(Yg,e,f(Yo,i,n),t,r,f(Qo,i,n))}return h(Yg,e,"/",t,r,n)}),Jg=n(function(e,t,r){if(Bd(r))return ci;var n=f(zl,"?",r);if(n.b){var a=n.a;return d(Wg,e,si(f(Yo,a+1,r)),t,f(Qo,a,r))}return d(Wg,e,ci,t,r)}),Qg=r(function(e,t){if(Bd(t))return ci;var r=f(zl,"#",t);if(r.b){var n=r.a;return l(Jg,e,si(f(Yo,n+1,t)),f(Qo,n,t))}return l(Jg,e,ci,t)}),Xg=function(e){return f(nu,"http://",e)?f(Qg,jg,f(Yo,7,e)):f(nu,"https://",e)?f(Qg,qg,f(Yo,8,e)):ci},Zg=Wt,ev=Gt(zt),tv=sa,rv=r(function(e,t){return L(e,t)}),nv=_r,av=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=Mu(r-n),o=f(ei,1,nv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),iv=r(function(e,t){var n=r(function(t,r){return Vp(f(xa,tv(0),d(av,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,rv,ev,Zg(t)))}),ov=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Vd(t.wallet),xg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(Wp,a,n.address,Qd(eo(a)),yg(a));return d(Gd,t,i,Do,yr)}return wg(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Gd,D(t,{inputs:D(u,{userRole:o})}),_o,Do,M([function(){return"Buyer"===o.$?d(Yd,"create offer type changed","input","sell dai",0):d(Yd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return wg(f(qd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return wg(f(qd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return wg(f(qd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return wg(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return wg(f(qd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return wg(f(qd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return wg(f(qd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return wg(f(qd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Gd,(g?qd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),_o,Do,g?M([d(Yd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=Fd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(ql,n,m);return wg(D(t,{depositAmount:si(Ml(oh(b))),txChainStatus:si(f(Eg,v,b))}))}var C=y.a;return d(Gd,D(t,{errors:C}),f(Yp,hs(Tg),function(){return f(iv,D(Og,{offset:60}),"inputError")}()),Do,yr);case"AbortCreate":return d(Gd,D(t,{txChainStatus:ci}),_o,Do,M([d(Yd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(vg,v,b);var e=v.a,r=function(){var t=Zf(l(nh,Xd(e),Qd(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Cg,e,b))};return f(Fo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(Ju,a,E),ba)?L(si(bg(e)),r):f(vg,v,b)}return L(si(bg(e)),r)}(),T=S.a,w=S.b;return d(Gd,D(t,{txChainStatus:T}),_o,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return wg(D(t,{txChainStatus:si(l(mg,a,b,A))}))}var B=I.a;return d(Gd,D(t,{txChainStatus:ci}),_o,Do,M([pa(f(Rg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(Ju,N,P),ba))return wg($);var U=f(vg,eo(a),b),T=U.a,w=U.b;return d(Gd,D($,{txChainStatus:T}),_o,w,yr)}return wg($)}var O=k.a;return d(Gd,t,_o,Do,M([pa(f(Bg,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return wg(D(t,{txChainStatus:si(f(Sg,v,A))}))}var B=I.a;return d(Gd,D(t,{txChainStatus:ci}),_o,Do,M([pa(f(Rg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Gd,t,_o,Do,M([pa(f(kg,"create",B))]))}var F=e.a,V=e.b.a,K=f(So,Ig,Hd(f(qh,F,V)));if("Just"===K.$){var H=K.a;return d(Gd,t,_o,Do,M([da(f(Hf,F,H))]))}return d(Gd,t,_o,Do,M([pa(f(ol,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Gd,t,_o,Do,M([ga]));case"NoOp":return wg(t);default:var j=e.a;return d(Gd,t,_o,Do,M([j]))}}),uv=r(function(e,t){return f(Uu,Md(e),Md(t))}),sv=r(function(e,t){return R(t.state.phase,mo)&&R(f(uv,t.derived.phaseEndTime,e),Ta)}),cv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},fv=r(function(e,t){return{maxDai:t,minDai:e}}),lv=f(fv,ci,ci),dv={$:"Expires"},hv=function(e){return L({errors:lv,filterFunc:sv,inputs:cv,showCurrencyDropdown:!1,tradeTable:f(ko,L(dv,No),M([f(po,!0,!0),d(bo,!0,!1,!1,!1)])),wallet:e},_o)},pv=r(function(e,t){return D(t,{paymentMethod:e})}),gv=r(function(e,t){return D(t,{paymentMethodTerms:e})}),vv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return D(e,{inputs:f(gv,r,f(pv,"",e.inputs))})},yv=r(function(e,t){var r=f(hl,bc(e),t.inputs.paymentMethodTerms);return D(t,{inputs:f(gv,r,t.inputs)})}),mv=function(e){return D(e,{filterFunc:sv,inputs:cv})},bv=function(e){return{$:"TradeTableMsg",a:e}},Cv=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Ev=function(e){return d(Cv,e,_o,Do,yr)},Sv=r(function(e,t){return D(t,{fiatType:e})}),Tv=r(function(e,t){return D(t,{maxDai:e})}),wv=r(function(e,t){return D(t,{minDai:e})}),Iv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return Ev(D(t,{inputs:f(wv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return Ev(D(t,{inputs:f(Tv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return Ev(D(t,{inputs:f(Sv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return Ev(D(t,{inputs:(n?Sv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return Ev(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return Ev(D(t,{inputs:f(pv,r,t.inputs)}));case"AddSearchTerm":return Ev(vv(t));case"RemoveTerm":var a=e.a;return Ev(f(yv,a,t));case"ResetSearch":return Ev(mv(t));case"TradeTableMsg":var i=e.a,o=f(Xf,i,t.tradeTable);return d(Cv,D(t,{tradeTable:o.model}),f(el,bv,o.cmd),f(Ho,bv,o.chainCmd),f(xa,Ji(bv),o.appCmds));case"NoOp":return Ev(t);default:var u=e.a;return d(Cv,t,_o,Do,M([u]))}}),Av=a(function(e,t,r,n){return e(gl(M([L("title",sl(t)),L("body",function(){if("Nothing"===r.$)return pl;var e=r.a;return sl(e)}()),L("image",function(){if("Nothing"===n.$)return pl;var e=n.a;return sl(e)}())])))}),Bv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},kv=function(e){return e.a+"="+e.b},Nv=function(e){return e.b?"?"+f(Ri,"&",f(xa,kv,e)):""},Rv=r(function(e,t){return"/"+(f(Ri,"/",e)+Nv(t))}),$v=function(e){switch(e.$){case"Home":return f(Rv,M(["DAIHard"]),yr);case"Create":return f(Rv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Rv,M(["DAIHard","trade",Bv(t),Ni(r)]),yr);case"Marketplace":return f(Rv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Rv,M(["DAIHard","history",ul(n)]),yr);default:return f(Rv,yr,yr)}},_v={$:"NotFound"},Lv=function(e){return{$:"AgentHistory",a:e}},xv={$:"Create"},Pv={$:"Home"},Dv={$:"Marketplace"},Uv=function(e){return{$:"Parser",a:e}},Ov=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Mv=r(function(e,t){return Uv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Ov,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Fv=f(Mv,"ADDRESS",f(Ko,Rh,Hd)),Vv={$:"Eth"},Kv={$:"Kovan"},Hv=f(Mv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Vv));case"keth":return si(Zi(Kv));case"dai":return si(eo(Xi));case"kdai":return si(eo($g));case"xdai":return si(Zi(to));default:return ci}}),jv=f(Mv,"NUMBER",Ql),qv=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Ov,r,n,a,i,e(o))}),Gv=r(function(e,t){var r=t.a;return Uv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,qv(u),r(h(Ov,n,a,i,o,e)))})}),zv=function(e){return l(La,oo,yr,e)},Yv=r(function(e,t){return zv(f(xa,e,t))}),Wv=function(e){return Uv(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 R(u,e)?M([h(Ov,f(ka,u,r),s,a,i,o)]):yr}return yr})},Jv=r(function(e,t){var r=e.a,n=t.a;return Uv(function(e){return f(Yv,n,r(e))})}),Qv=Uv(function(e){return M([e])}),Xv=f(Jv,Wv("DAIHard"),function(e){return Uv(function(t){return f(Yv,function(e){return(0,e.a)(t)},e)})}(M([f(Gv,Pv,Qv),f(Gv,xv,Wv("create")),f(Gv,Hf,f(Jv,Wv("trade"),f(Jv,Hv,jv))),f(Gv,Dv,Wv("marketplace")),f(Gv,Lv,f(Jv,Wv("history"),Fv)),f(Gv,function(e){return Lv(e)},f(Jv,Wv("history"),Fv))]))),Zv=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 si(t.value)}return si(t.value)}return ci}},ey=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ey(r))}return yr}return yr},ty=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ey(r)}var r=t;return ey(r)},ry=Qt,ny=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),ay=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=ry(n);if("Nothing"===o.$)return t;var u=o.a,s=ry(i);if("Nothing"===s.$)return t;var c=s.a;return l(pp,u,ny(c),t)}return t}),iy=function(e){if("Nothing"===e.$)return ap;var t=e.a;return l(La,ay,ap,f(_i,"&",t))},oy=r(function(e,t){var r=e.a;return Zv(r(h(Ov,yr,ty(t.path),iy(t.query),t.fragment,Ua)))}),uy=function(e){return f(Nc,_v,f(oy,Xv,e))},sy=aa,cy=r(function(e,t){return f(sy,e,$v(t))}),fy=je("connectToWeb3",function(e){return pl}),ly=function(e){return gl(M([L("event",sl(e.event)),L("category",sl(e.category)),L("label",sl(e.label)),L("value",bl(e.value))]))},dy=r(function(e,t){return gl(M([L("address",sl(ul(e))),L("signSeedMsg",sl(t))]))}),hy=je("gTagOut",Ua),py=je("genPrivkey",Ua),gy=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),vy=n(function(e,t,r){return f(So,Yc(t),f(wo,function(e){return e.trades},f(gy,function(t){return R(t.factory,e)},r)))}),yy=je("notifyPort",Ua),my=je("requestNotifyPermissionPort",function(e){return pl}),by=r(function(e,t){return D(t,{wallet:e})}),Cy=r(function(e,t){return L(f(qd,t.inputs,D(t,{wallet:e})),function(){var t=L(Vd(e),xg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(Wp,n,r.address,Qd(eo(n)),yg(n))}return _o}())}),Ey=r(function(e,t){return D(t,{wallet:e})}),Sy=function(e){return{$:"AllowanceFetched",a:e}},Ty=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Vd(e),xg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(xg(e),si(i.factory))?d(Wp,a,n.address,i.creationInfo.address,Sy):_o}return _o}())}),wy=function(e){return{$:"AgentHistoryModel",a:e}},Iy=function(e){return{$:"CreateModel",a:e}},Ay=function(e){return{$:"CreateMsg",a:e}},By=function(e){return{$:"MarketplaceModel",a:e}},ky=function(e){return{$:"TradeModel",a:e}},Ny=function(e){return{$:"TradeMsg",a:e}},Ry=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,_o);case"CreateModel":var r=t.a,n=f(Cy,e,r),a=n.a,i=n.b;return L(Iy(a),f(el,Ay,i));case"TradeModel":var o=t.a,u=f(Ty,e,o),s=u.a,c=u.b;return L(ky(s),f(el,Ny,c));case"MarketplaceModel":var l=t.a;return L(By(f(Ey,e,l)),_o);default:var d=t.a;return L(wy(f(by,e,d)),_o)}}),$y=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),_y=function(e){return{$:"PartiallyLoadedTrade",a:e}},Ly=r(function(e,t){return _y(g($y,e,t,ci,ci,ci,ci,ci))}),xy=function(e){return{$:"CurrentBlockFetched",a:e}},Py=fu(f(Ko,au,wh)),Dy=function(e){return _p({decoder:Py,method:"eth_blockNumber",params:yr,url:e})},Uy=function(e){return f(Yp,xy,Dy(e))},Oy=r(function(e,t){return{address_:e,blocknum:t}}),My=function(e){return jo(function(t){return li(L(t,e))})},Fy=n(function(e,t,r){var n=t.a,a=r.a;return jo(function(t){return f(jh,function(t){var r=t.a,n=t.b;return f(Zo,Qf(e(n)),a(r))},n(t))})}),Vy=r(function(e,t){return l(Fy,r(function(e,t){return e(t)}),t,e)}),Ky=lu(f(Vy,Mh,f(Vy,$h,My(Oy)))),Hy=r(function(e,t){return{data:si(f(Vf,"createdTrades(uint256)",M([rh(t)]))),decoder:Ky,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),jy=n(function(e,t,r){return f(Yp,r,f(Pp,zh(e),f(Hy,Qd(e),t)))}),qy=function(e){return{$:"CreationInfoFetched",a:e}},Gy=r(function(e,t){return l(jy,e,Fu(t),qy)}),zy=function(e){return{$:"EventSentryMsg",a:e}},Yy=function(e){return{$:"BlockNumber",a:e}},Wy=function(e){return{$:"EventSentry",a:e}},Jy=function(e){return{$:"Set_elm_builtin",a:e}},Qy=Jy(ap),Xy=r(function(e,t){return L(Wy({blockNumber:ci,errors:yr,nodePath:t,pending:Qy,ref:1,requests:ap,tagger:e,watching:Qy}),f(Yp,f(Ko,Yy,e),Dy(t)))}),Zy=function(e){return f(Xy,zy,zh(e))},em=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),tm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},rm=tm(f(em,ci,ci)),nm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:mo,secureCommInfo:rm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),am=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),im=n(function(e,t,r){var n=f(Gy,t,r),a=Zy(t),i=a.a,o=a.b;return d(am,l(nm,f(Ly,t,r),i,e),$o(M([n,o,Uy(zh(t))])),Do,M([ha]))}),om=function(e){return{$:"LoadedTrade",a:e}},um=r(function(e,t){var r=Zy(t.factory),n=r.a,a=r.b;return d(am,l(nm,om(t),n,e),$o(M([a,Uy(zh(t.factory))])),Do,M([ha]))}),sm=function(e){return{data:si(f(Vf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},cm=function(e){return{data:si(f(Vf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},fm=function(e){return{data:si(f(Vf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},lm=r(function(e,t){return{data:si(f(Vf,"initiatorStatement(string)",M([eg(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),dm=function(e){return{data:si(f(Vf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},hm=function(e){return{data:si(f(Vf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},pm=r(function(e,t){return{data:si(f(Vf,"responderStatement(string)",M([eg(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),gm=r(function(e,t){return{amount:t,fiatType:e}}),vm=f(uu,function(e){var t=ad(e);if("Just"===t.$){var r=t.a;return Fi(r)}return su("Can't convert that to a BigInt")},cu),ym=l(Mi,gm,f(Ph,0,cu),f(Ph,1,vm)),mm={$:"Bank"},bm={$:"Cash"},Cm=function(e){switch(e){case"cash":return si(bm);case"bank":return si(mm);case"custom":return si(Pd);default:return ci}},Em=f(uu,function(e){var t=Cm(e);if("Just"===t.$){var r=t.a;return Fi(r)}return su("")},cu),Sm=l(Mi,Dd,f(Lh,"type",Em),f(Lh,"info",cu)),Tm=oe,wm=function(e){var t=l(Mi,ng,f(Lh,"price",ym),f(Lh,"paymentmethods",Tm(Sm)));return f(tp,t,e)},Im=r(function(e,t){return{commPubkey:t,responder:e}}),Am=r(function(e,t){var n=r(function(t,r){return l(zo,t,t+2*r,e)}),a=f(Ko,wh,Zo(ti(2)));return f(jh,function(t){return f(Zo,function(e){return f(n,t+64,e)},wh(l(zo,t,t+64,e)))},a(t))}),Bm=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),km=n(function(e,t,r){var n=l(Ra,Bm(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),Nm=j,Rm=function(e){return Es(Nm(e))},$m=function(e){return l(km,r(function(e,t){return U(t,Rm(e))}),"",e)},_m=jo(function(e){var t=e.a,r=e.b;return f(Zo,f(Jo,t,r),f(jh,$m,f(jh,f(Ko,xa(wh),Eh),f(Zo,hl(f(Ko,Bd,Xu)),f(Zo,Js(2),f(Am,t,Xo(r)))))))}),Lm=f(uh,f(xh,1,_m),f(uh,f(xh,0,$h),Fi(Im))),xm=r(function(e,t){return{commPubkey:t,terms:e}}),Pm=f(uh,f(xh,1,_m),f(uh,f(xh,0,_m),Fi(xm))),Dm=function(e){return{statement:e}},Um=f(uh,f(xh,0,_m),Fi(Dm)),Om=function(e){return{statement:e}},Mm=f(uh,f(xh,0,_m),Fi(Om)),Fm={$:"AbortedEvent"},Vm={$:"BurnedEvent"},Km={$:"ClaimedEvent"},Hm=function(e){return{$:"CommittedEvent",a:e}},jm=function(e){return{$:"InitiatedEvent",a:e}},qm=function(e){return{$:"InitiatorStatementLogEvent",a:e}},Gm={$:"PokeEvent"},zm={$:"RecalledEvent"},Ym={$:"ReleasedEvent"},Wm=function(e){return{$:"ResponderStatementLogEvent",a:e}},Jm=fh(f(Nc,hh,dh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),Qm=function(e){return Jm(e)?li(Xs(au(e))):fi("Something in here is not very hexy: "+Nh(e))},Xm=fu(Qm),Zm=f(Lh,"topics",f(Ph,0,Xm)),eb=function(e){return Xs(f(Ri,"",f(xa,f(Ko,Rs,rc),Uf(f(xa,yi,Ys(e))))))},tb=f(uu,function(e){return R(e,eb("Initiated(string,string)"))?f(Oi,jm,Pm):R(e,eb("Committed(address,string)"))?f(Oi,Hm,Lm):R(e,eb("Recalled()"))?Fi(zm):R(e,eb("Claimed()"))?Fi(Km):R(e,eb("Aborted()"))?Fi(Fm):R(e,eb("Released()"))?Fi(Ym):R(e,eb("Burned()"))?Fi(Vm):R(e,eb("InitiatorStatementLog(string)"))?f(Oi,qm,Um):R(e,eb("ResponderStatementLog(string)"))?f(Oi,Wm,Mm):R(e,eb("Poke()"))?Fi(Gm):su("Unrecognized topic hash")},Zm),rb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},nb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},ab=function(e){return R(e.buyerDeposit,Hl(e.tradeAmount))&&R(e.abortPunishment,Kl(e.tradeAmount))},ib={$:"Invalid"},ob=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),ub=r(function(e,t){return Dl(Md(t)+Md(e))}),sb=function(e){var t=Sd(yd(e.amount));if("Just"===t.$){return t.a}f(al,"Error converting FiatValue to float--string -> float failed!",e);return 0},cb=r(function(e,t){return(t-e)/e}),fb=r(function(e,t){var r=sb(t),n=Td(e);return"USD"===t.fiatType?si(f(cb,n,r)):ci}),lb=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 Dl(0)}}();return{margin:f(fb,e.tradeAmount,r.price),phaseEndTime:f(ub,t.phaseStartTime,n)}}),db=function(e){var t=x(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 om(v(ob,e.factory,e.id,n,a,o,u,s,l(lb,a,o,u)))}return _y(e)},hb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return db(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(al,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return ib}}),pb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return db(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(al,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return ib}}),gb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return db(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(al,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return ib}}),vb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return db(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return om(D(n,{state:e}));default:return ib}}),yb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return db(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(al,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return ib}}),mb=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}}),bb=lu(f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,ru,f(Vy,$h,My(mb))))))))))),Cb=function(e){return{data:si(f(Vf,"getParameters()",yr)),decoder:bb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Eb=function(e){return f(wo,function(e){return Dl(1e3*e)},Ql(yd(e)))},Sb=function(e){return Ol(e)},Tb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),wb=function(e){var t=f(Ad,"error converting BigInt to Time.Posix",Eb(e.autoabortInterval)),r=f(Ad,"error converting BigInt to Time.Posix",Eb(e.autoreleaseInterval)),a=f(Ad,"error converting BigInt to Time.Posix",Eb(e.autorecallInterval));return d(Tb,n(function(t,r,n){return{abortPunishment:Sb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Sb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?fo:co,pokeReward:Sb(e.pokeReward),tradeAmount:Sb(e.tradeAmount)}}),a,t,r)},Ib=n(function(e,t,r){return f(Yp,r,f(Mp,wb,f(Pp,zh(e),Cb(t))))}),Ab=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}}}}}}}}}}},Bb=lu(f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,My(Ab)))))))))))),kb=function(e){return{data:si(f(Vf,"getPhaseStartInfo()",yr)),decoder:Bb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Nb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),Rb=function(e){return h(Nb,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}}),Eb(e.v6),Eb(e.v7),Eb(e.v8),Eb(e.v9))},$b=n(function(e,t,r){return f(Yp,r,f(Mp,Rb,f(Pp,zh(e),kb(t))))}),_b=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Lb=lu(f(Vy,Mh,f(Vy,$h,f(Vy,Mh,f(Vy,Mh,f(Vy,Mh,My(_b))))))),xb=function(e){return{data:si(f(Vf,"getState()",yr)),decoder:Lb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Pb={$:"Aborted"},Db={$:"Burned"},Ub={$:"NotClosed"},Ob={$:"Recalled"},Mb={$:"Released"},Fb=function(e){switch(f(Nc,99,Ql(yd(e)))){case 0:return si(Ub);case 1:return si(Ob);case 2:return si(Pb);case 3:return si(Mb);case 4:return si(Db);default:return ci}},Vb=function(e){switch(f(Nc,99,Ql(yd(e)))){case 1:return si(mo);case 2:return si(vo);case 3:return si(yo);case 4:return si(go);default:return ci}},Kb=function(e){return R(e,Jd("0x0000000000000000000000000000000000000000"))?ci:si(e)},Hb=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),jb=function(e){var t=Eb(e.phaseStartTimestamp),r=Vb(e.phase),a=Fb(e.closedReason);return d(Hb,n(function(t,r,n){return{balance:Sb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:Kb(e.responder)}}),r,t,a)},qb=n(function(e,t,r){return f(Yp,r,f(Mp,jb,f(Pp,zh(e),xb(t))))}),Gb=i(function(e,t,r,n,a){return $o(M([l(Ib,e,t,r),l(qb,e,t,n),l($b,e,t,a)]))}),zb=function(e){var t=Ig(e);if("Just"===t.$){return t.a}f(al,"Warning! BigInt to Int conversion failed!",yd(e));return 0},Yb=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),Wb=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),Jb=function(e){return e.b?l(Wb,e,yr,0):qa},Qb=tn,Xb=function(e){var t=h(Qb,Yb,f(Lh,"encapsulation",cu),f(Lh,"iv",cu),f(Lh,"tag",cu),f(Lh,"encrypted",cu)),r=Tm(t),n=f(Vh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Yc,0,e),f(Yc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(Jb(i))},Zb=function(e){var t=function(e){var t=Go(e);return t>1114111?fi("string is too long"):li(f(Cs,Nm(t),e))};return f(Zo,Ri(""),Eh(f(xa,t,e)))},eC=function(e){var t=e.a,r=e.b;return Zb(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},tC=r(function(e,t){return gl(M([L("message",sl(e)),L("pubkeyHexStrings",f(Kh,sl,M([t.initiatorPubkey,t.responderPubkey])))]))}),rC=function(e){return{$:"LoadedCommInfo",a:e}},nC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),aC=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 rC(f(nC,r,n))}return tm(e)},iC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return aC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return rC(D(n,{initiatorPubkey:e}))}),oC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return aC(D(r,{responderPubkey:si(e)}))}var n=t.a;return rC(D(n,{responderPubkey:e}))}),uC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return co}r.a,r.b;return fo}if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return co}),sC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(Xl,a,n),o=As(f(oc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),cC=function(e){var t=Jb(f(sC,Ys(e),yr));return l(Kd,rv,h(Nb,Yb,f(Yc,0,t),f(Yc,1,t),f(Yc,2,t),f(Yc,3,t)),h(Nb,Yb,f(Yc,4,t),f(Yc,5,t),f(Yc,6,t),f(Yc,7,t)))},fC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),lC={$:"Aborted"},dC={$:"Burned"},hC={$:"Claimed"},pC=function(e){return{$:"Committed",a:e}},gC=function(e){return{$:"Encrypted",a:e}},vC={$:"FailedDecode"},yC={$:"Initiated"},mC={$:"Recalled"},bC={$:"Released"},CC=function(e){return{$:"StateChange",a:e}},EC=function(e){return{$:"Statement",a:e}},SC=fr,TC=cr,wC=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(SC,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(TC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),IC=or,AC=y,BC=a(function(e,t,r,n){var a=jc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(IC,Ga(r),n);var i=za(d(BC,e-Ha,t,r,ja));return f(IC,i,n)}var o=f(qc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(BC,e-Ha,t,r,u));return l(Qc,a,i,n)}var i=za(d(BC,e-Ha,t,r,AC(o)));return l(Qc,a,i,n)}),kC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(BC,c,r,e,AC(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(BC,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),NC=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(SC,32,r,e),o=f(kC,i,t);if(a<0){var u=l(TC,a,n,e);return f(kC,u,o)}return o}),RC=ur,$C=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(RC,i,t,r)}return f(ka,e,t)});return{nodeList:l(RC,i,yr,n),nodeListSize:t/32|0,tail:a}},_C=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(RC,o,t,r)}var n=e.a;return f(NC,n,t)});return f(NC,i,l(RC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(RC,o,t,r)}var n=e.a;return f(wC,n,t)});return f(ai,!0,f(wC,i,l(RC,o,$C(e),a)))}),LC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),xC=f(La,LC,yr),PC=n(function(e,t,r){var n=uC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(CC(yC));case"CommittedEvent":var r=t.a;return si(CC(pC(r.responder)));case"RecalledEvent":return si(CC(mC));case"ClaimedEvent":return si(CC(hC));case"AbortedEvent":return si(CC(lC));case"ReleasedEvent":return si(CC(bC));case"BurnedEvent":return si(CC(dC));case"InitiatorStatementLogEvent":var r=t.a;return si(EC({blocknum:e,message:function(){var e=cC(r.statement);if("Just"===e.$){var t=e.a;return gC(t)}return vC}(),who:n(Co)}));case"ResponderStatementLogEvent":var r=t.a;return si(EC({blocknum:e,message:function(){var e=cC(r.statement);if("Just"===e.$){var t=e.a;return gC(t)}return vC}(),who:n(Eo)}));default:return ci}}(),i=f(wo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(_C,r.history,Jb(xC(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(wo,fC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),xC(M([s])))}),DC=Gr,UC=function(e){var t=l(Mi,rv,f(Lh,"id",DC),f(Lh,"message",cu));return f(Od,Di,f(Vh,t,e))},OC=function(e){return{$:"Decrypted",a:e}},MC=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),FC=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(PC,n,a,t),o=i.a,u=i.b,s=i.c;return d(MC,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(MC,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(MC,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=UC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Yc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:OC(y)}),T=D(b,{eventInfo:EC(S)}),w=l(Zc,v,T,t.history);return d(MC,D(t,{history:w}),!1,ci,yr)}return d(MC,t,!1,ci,M([pa(f(ol,"got a decryption result, but for an event that is not a message!",b))]))}return d(MC,t,!1,ci,M([pa(f(ol,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(MC,t,!1,ci,M([pa(f(ol,"Error decoding decryption result",I))]))}}),VC=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),KC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),HC=function(e){return{onBroadcast:ci,onMined:si(L(VC(e),ci)),onSign:si(KC(e))}},jC=je("encryptToPubkeys",Ua),qC=n(function(e,t,r){return{data:si(f(Vf,"commit(address,string)",M([eh(t),eg(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),GC=n(function(e,t,r){return{data:si(f(Vf,"commit(address,string)",M([eh(t),eg(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),zC=function(e){return{$:"CommitMined",a:e}},YC={$:"CommitNeedsSig"},WC=function(e){return{$:"CommitSigned",a:e}},JC=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?GC:qC}(),a=Zf(function(){return"Token"===e.factory.$?Ua:cg(Ml(rb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(YC),f(Fo,{onBroadcast:ci,onMined:si(L(zC,ci)),onSign:si(WC)},a))}),QC=r(function(e,t){return gl(M([L("id",bl(e)),L("encapsulation",sl(t.encapsulatedKey)),L("iv",sl(t.iv)),L("tag",sl(t.tag)),L("encrypted",sl(t.message))]))}),XC=je("decryptMessage",Ua),ZC=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},eE=r(function(e,t){return $o(f(xa,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 XC(f(QC,r,s))}return _o}return _o},ZC(e.history)))}),tE=function(e){if("Just"===e.$){return e.a}return ci},rE=function(e){var t=tE(l(Kd,To,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(wo,function(e){return e.address},Vd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(eE,n,a)}return _o},nE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(PC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),aE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),iE=i(function(e,t,r,n,a){return f(nE,n,p(aE,e,r,t,qa,a,""))}),oE=function(e){return{$:"ChatHistoryMsg",a:e}},uE=a(function(e,t,r,n){var a=x(t,Vd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(Io,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(oE),n))}(h(iE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),sE={$:"Abort"},cE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),fE=function(e){return{$:"ActionNeedsSig",a:e}},lE=function(e){return{$:"ApproveMining",a:e}},dE={$:"ApproveNeedsSig"},hE=function(e){return{$:"ApproveSigned",a:e}},pE={$:"Burn"},gE={$:"Claim"},vE=function(e){return{$:"CommitMining",a:e}},yE=function(e){return{$:"ConfirmingAction",a:e}},mE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),bE=function(e){return{$:"EventLogFetched",a:e}},CE=function(e){return{$:"ParametersFetched",a:e}},EE=function(e){return{$:"PhaseInfoFetched",a:e}},SE={$:"Poke"},TE={$:"Recall"},wE={$:"Release"},IE=function(e){return{$:"StartContractAction",a:e}},AE=function(e){return{$:"StateFetched",a:e}},BE=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"}},kE=function(e){return d(am,e,_o,Do,yr)},NE={align:rl,label:"cantFindTradeWillRetry",mainParagraphs:M([M([il("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:Ag},RE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(Bg,e,r)}if("Nothing"===t.a.$){t.a;return f(ol,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ol,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),$E={align:rl,label:"tradeParametersNotDefault",mainParagraphs:M([M([il("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:Ag},_E=eo(Xi),LE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),xE=n(function(e,t,r){return l(pp,e,wo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),PE=r(function(e,t){var r=t.a;return Jy(f(hp,e,r))}),DE=n(function(e,t,r){var n=e.a,a=f(ip,t,n.requests);if("Nothing"===a.$)return L(Wy(n),_o);var i=a.a,o=L(i.watchOnce,Gl(r));if("Nothing"===o.b.$){o.b;return L(Wy(D(n,{requests:l(xE,t,r,n.requests)})),_o)}if(o.a){var u=o.b.a;return L(Wy(D(n,{requests:l(xE,t,r,n.requests),watching:f(PE,t,n.watching)})),f(Hg,i.tagger,Np(u)))}return L(Wy(D(n,{requests:l(xE,t,r,n.requests)})),$o(f(xa,function(e){return f(Hg,i.tagger,Np(e))},r)))}),UE=_e,OE=r(function(e,t){return f(Yp,f(Ko,Yy,t),f(Up,function(t){return Dy(e)},UE(2e3)))}),ME=ue,FE=ce,VE=Yr,KE=n(function(e,t,r){var n=function(e){return FE(M([e,ME(r)]))};return f(uu,function(a){var i=f(Vh,e,a);if("Ok"===i.$){var o=i.a,u=f(Vh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return su(Di(c))}return Fi(r)},VE)}),HE=a(function(e,t,r,n){return f(uh,l(KE,f(Lh,e,VE),t,r),n)}),jE=n(function(e,t,r){return f(uh,f(Lh,e,t),r)}),qE=fu(Rh),GE=fh(f(Nc,hh,dh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),zE=function(e){return{$:"BlockHash",a:e}},YE=function(e){return GE(e)?li(zE(au(e))):fi("Given blockHash "+Nh(e)+" is not valid.")},WE=fu(YE),JE=function(e){return{$:"TxHash",a:e}},QE=function(e){return GE(e)?li(JE(au(e))):fi("Given txHash "+Nh(e)+" is not valid.")},XE=fu(QE),ZE=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}}),eS=zr,tS=l(jE,"blockNumber",Py,l(jE,"blockHash",WE,l(jE,"transactionHash",XE,l(jE,"transactionIndex",Py,l(jE,"logIndex",Py,d(HE,"removed",eS,!1,l(jE,"topics",Tm(Xm),l(jE,"data",cu,l(jE,"address",qE,Fi(ZE)))))))))),rS=function(e){return f(Kh,function(e){if("Just"===e.$){var t=e.a;return sl(Ff(t))}return pl},e)},nS=function(e){return gl(M([L("fromBlock",Yh(e.fromBlock)),L("toBlock",Yh(e.toBlock)),L("address",cl(e.address)),L("topics",rS(e.topics))]))},aS=r(function(e,t){return _p({decoder:Tm(tS),method:"eth_getLogs",params:M([nS(t)]),url:e})}),iS=function(e){return{$:"BlockNum",a:e}},oS=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Up,function(r){return f(Mp,vi(r),f(aS,e,D(t,{fromBlock:iS(n),toBlock:iS(a)})))},f(aS,e,t)):f(aS,e,t)}),uS=n(function(e,t,r){var n=r.a,a=r.b;return f(aS,e,D(t,{fromBlock:iS(n),toBlock:iS(a)}))}),sS=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(sS,e,t,i)),c=o;e=u,t=s,r=c}}),cS=r(function(e,t){return l(sS,Nl,t,e)}),fS=r(function(e,t){var r=e.a,n=t.a;return Jy(f(cS,r,n))}),lS=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 $o(f(xa,function(t){return f(Yp,f(Ko,LE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},xC(f(xa,function(e){return f(ip,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(Wy(D(r,{blockNumber:si(a)})),$o(M([f(OE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,uS)]))):L(t,f(OE,r.nodePath,r.tagger))}return L(Wy(D(r,{blockNumber:si(a),pending:Qy,watching:f(fS,r.watching,r.pending)})),$o(M([f(OE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,oS),l(i,L(a,a),r.watching,uS)])))}var s=e.a.a;return L(Wy(D(r,{errors:f(ka,s,r.errors)})),f(OE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(DE,t,c,d)}var s=e.b.a;return L(Wy(D(r,{errors:f(ka,s,r.errors)})),_o)}),dS=r(function(e,t){var r=t.a;return Jy(l(Nl,e,gr,r))}),hS=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(Nl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(Wy(D(o,{watching:f(dS,a.ref,o.watching)})),f(Yp,f(Ko,LE(a.ref),a.tagger),e),a.ref)}(l(oS,a.nodePath,n,L(s,s)))}return x(Wy(D(o,{pending:f(dS,a.ref,o.pending)})),_o,a.ref)}),pS=hS(!1),gS=function(e){return M([e])},vS=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(Gy,r.factory,r.id):_o}}(),function(){var e=x(Vd(t.wallet),xg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(xg(t.wallet),si(a.factory))?d(Wp,n,r.address,a.creationInfo.address,Sy):_o}return _o}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(uE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?rE(t):_o,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(am,u,$o(M([l(qb,p.factory,p.creationInfo.address,AE),s,r])),Do,o)}return kE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return kE(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(am,t,_o,Do,M([pa(f(Bg,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(Ju,m,Ml(rb(C.parameters))),ba))return kE(u);var S=l(JC,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(am,D(u,{txChainStatus:T}),_o,w,yr)}return kE(u)}var y=g.a;return d(am,t,_o,Do,M([pa(f(Bg,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:zb(I.blocknum)},B=l(pS,bE,t.eventSentry,{address:A.address,fromBlock:iS(A.blocknum),toBlock:xp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(hb,A,t.trade)}),$=f(Nc,_E,nb(u.trade)),_=$o(M([N,h(Gb,$,A.address,CE,AE,EE)]));return d(am,u,_,Do,yr)}if("BadBody"===g.a.$){g.a.a;return d(am,t,_o,Do,M([pa(NE)]))}var y=g.a;return d(am,t,_o,Do,M([pa(f(Bg,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(vb,P,t.trade)});return d(am,u,rE(u),Do,yr)}return d(am,t,_o,Do,M([pa(f(RE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(ab(F)){var u=D(t,{trade:f(pb,F,t.trade)});return d(am,u,rE(u),Do,yr)}return d(am,t,_o,Do,M([pa($E)]))}var V=g.a.a;return d(am,t,_o,Do,M([pa(f(ol,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(am,t,_o,Do,M([pa(f(Bg,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(gb,H,t.trade)});return d(am,u,rE(u),Do,yr)}return d(am,t,_o,Do,M([pa(f(RE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Hh,tb,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(am,t,_o,Do,M([pa(f(ol,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(iC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(oC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=wm(e.terms);if("Ok"===r.$){var n=r.a;return L(f(yb,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ol,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(oE),n))}(l(PC,q.blockNumber,Y,r))}return d(uE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?rE(u):_o;return d(am,u,_,Do,f(oo,f(xa,pa,xC(M([X]))),o));case"ExpandPhase":var te=e.a;return kE(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return kE(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return kE(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(am,t,_o,Do,M([da(Lv(C.parameters.initiatorAddress))]))}return d(am,t,_o,Do,M([pa(f(ol,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return kE(D(t,{txChainStatus:si(f(mE,E,ie))}));case"AbortAction":return kE(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(JC,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=Zf(l(nh,Xd(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(hE)};return f(Fo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(Ju,i,Ml(rb(C.parameters))),ba)?L(si(dE),n):l(JC,C,E.address,E.commPubkey)}return L(si(dE),n)}(),T=oe.a,w=oe.b;return d(am,D(t,{txChainStatus:T}),_o,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,SE)||R(ue,TE)){var se=IE(ue),ce=t;e=se,t=ce;continue e}return kE(D(t,{txChainStatus:si(yE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Do,M([pa(f(ol,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=Zf(dm(n.creationInfo.address));return x(si(fE(TE)),f(Fo,HC(TE),a),yr);case"Claim":var a=Zf(fm(n.creationInfo.address));return x(si(fE(gE)),f(Fo,HC(gE),a),yr);case"Abort":var a=Zf(sm(n.creationInfo.address));return x(si(fE(sE)),f(Fo,HC(sE),a),yr);case"Release":var a=Zf(hm(n.creationInfo.address));return x(si(fE(wE)),f(Fo,HC(wE),a),yr);case"Burn":var a=Zf(cm(n.creationInfo.address));return x(si(fE(pE)),f(Fo,HC(pE),a),yr);default:var a=Zf(Kf(n.creationInfo.address));return x(si(fE(SE)),f(Fo,HC(SE),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(am,D(t,{txChainStatus:T}),_o,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return kE(D(t,{txChainStatus:si(lE(he))}))}var V=de.a;return d(am,D(t,{txChainStatus:ci}),_o,Do,M([pa(f(Rg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return kE(D(t,{txChainStatus:si(vE(he))}))}var V=de.a;return d(am,D(t,{txChainStatus:ci}),_o,Do,M([pa(f(Rg,"commit",V))]));case"CommitMined":return kE(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return kE(D(t,{txChainStatus:si(f(cE,ue,he))}))}var V=de.a;return d(am,D(t,{txChainStatus:ci}),_o,Do,M([pa(f(Rg,BE(ue),V))]));case"ActionMined":var ue=e.a;return kE(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(lS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(am,D(t,{eventSentry:ve}),_,Do,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(FC,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?rE(t):_o,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(jC(f(tC,r,a)),ci)}return L(_o,si(f(ol,"Trying to encrypt, but commInfo is not loaded",n)))}return L(_o,ci)}(),Te=Se.a,we=Se.b;return d(am,Ee,$o(M([s,Te])),Do,U(f(Qi,oE,Ce.appCmds),f(Nc,yr,f(wo,gS,f(wo,pa,we)))))}return d(am,t,_o,Do,M([pa(f(ol,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(jh,eC,Xb(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(To,p,E.address);if("Nothing"===Ne.$)return d(am,t,_o,Do,M([pa(f(ol,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return Zf("Initiator"===Re.$?f(lm,p.creationInfo.address,ke):f(pm,p.creationInfo.address,ke))}();return d(am,t,_o,f(Fo,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(am,t,_o,Do,M([pa(f(ol,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(am,t,_o,Do,M([pa(f(ol,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return kE(t)}var V=e.a.a;return d(am,t,_o,Do,M([pa(f(kg,"message",V))]));default:return d(am,t,_o,Do,M([ga]))}}),yS=r(function(e,t){return{address:e,blocknum:t}}),mS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},bS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(hS,!0,e,t,r))}),CS=n(function(e,t,r){var n=function(e){return r(f(Hh,Pm,e).returnData)},a={address:t.address,fromBlock:iS(t.blocknum),toBlock:iS(t.blocknum),topics:M([si(eb("Initiated(string,string)"))])};return l(bS,n,e,a)}),ES=function(e){return{data:si(f(Vf,"numTrades()",yr)),decoder:lu(Mh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},SS=r(function(e,t){return f(Yp,t,f(Pp,zh(e),ES(Qd(e))))}),TS=function(e){return{data:si(f(Vf,"phase()",yr)),decoder:lu(Mh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},wS=n(function(e,t,r){return f(Yp,r,f(Mp,Vb,f(Pp,zh(e),TS(t))))}),IS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),AS=r(function(e,t){return l(La,IS(e),yr,t)}),BS=function(e){return f(AS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},kS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},NS=function(e){return f(kS,Ja(ib),Sa(e.trades))},RS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:NS(e),loaded:Ti(BS(e))})})},$S=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),_S=r(function(e,t){var r=f(Yc,e,t.trades);if("Just"===r.$){var n=(r.a,l(Zc,e,ib,t.trades));return l($S,RS(D(t,{trades:n})),_o,yr)}return l($S,t,_o,M([pa(f(ol,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),LS=n(function(e,t,r){var n=f(Yc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(hb,t,a),o=l(Zc,e,i,r.trades);return L(RS(D(r,{trades:o})),yr)}return L(r,M([f(ol,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),xS=n(function(e,t,r){var n=f(Yc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(pb,t,a),o=l(Zc,e,i,r.trades);return l($S,RS(D(r,{trades:o})),_o,yr)}return l($S,r,_o,M([pa(f(ol,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),PS=n(function(e,t,r){var n=f(Yc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(Zc,e,om(D(a,{state:D(i,{phase:t})})),r.trades);return l($S,RS(D(r,{trades:o})),_o,yr)}return l($S,r,_o,M([pa(f(ol,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l($S,r,_o,M([pa(f(ol,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),DS=n(function(e,t,r){var n=f(Yc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(gb,t,a),o=l(Zc,e,i,r.trades);return l($S,RS(D(r,{trades:o})),_o,yr)}return l($S,r,_o,M([pa(f(ol,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),US=n(function(e,t,r){var n=f(Yc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(vb,t,a),o=l(Zc,e,i,r.trades);return l($S,RS(D(r,{trades:o})),_o,yr)}return l($S,r,_o,M([pa(f(ol,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),OS=n(function(e,t,r){var n=f(Yc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(yb,t,a),o=l(Zc,e,i,r.trades);return l($S,RS(D(r,{trades:o})),_o,yr)}return l($S,r,_o,M([pa(f(ol,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),MS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),FS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),VS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),KS=function(e){return{$:"NumTradesFetchedAgain",a:e}},HS=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),jS=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),qS=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),GS=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),zS=function(e){return l($S,e,_o,yr)},YS=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=zb(n),i=Jb(f(xa,Ly(t.factory),f(Ai,0,a-1))),o=$o(f(xa,function(e){return l(jy,t.factory,Fu(e),MS(e))},f(Ai,0,a-1)));return l($S,D(t,{dataFetchState:l(FS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l($S,t,_o,M([pa(f(Bg,"Factory numTrades",u))]));case"CheckForNewTrades":return l($S,t,f(SS,t.factory,KS),yr);case"UpdateTradePhases":var s=$o(xC(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(wS,e.factory,e.creationInfo.address,f(jS,e.factory,e.id)))},BS(t))));return l($S,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(PS,d,p,t),v=function(){var e=L(p,f(Yc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=mS(r);if("Just"===n.$){var a=n.a;return L(l(qb,c,a.address,GS(d)),yr)}return L(_o,M([pa(f(ol,"Phase fetched for a trade that has no creationInfo",r))]))}return L(_o,yr)}e.b;return L(_o,M([pa(f(ol,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l($S,g.tradeCache,$o(M([g.cmd,y])),f(oo,g.appCmds,m))};return l($S,t,_o,M([pa(f(RE,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=zb(n);if(_(C,E)<0){var S=t.dataFetchState,o=$o(f(xa,function(e){return l(jy,t.factory,Fu(e),MS(e))},f(Ai,C,E-1))),T=Jb(f(xa,Ly(t.factory),f(Ai,C,E-1)));return l($S,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(_C,t.trades,T)}),o,yr)}return zS(t)}b.b;return l($S,t,_o,M([pa(f(ol,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l($S,t,_o,M([pa(f(Bg,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(yS,w.address_,zb(w.blocknum)),A=l(CS,t.eventSentry,I,VS(d)),B=A.a,k=A.b,y=$o(M([h(Gb,t.factory,I.address,HS(d),GS(d),qS(d)),k])),N=l(LS,d,I,t),R=N.a,$=N.b;return l($S,RS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l($S,t,_o,M([pa(f(Bg,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l($S,t,_o,M([pa(f(Bg,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(xS,d,P,t)}var U=r.a.a;return l($S,t,_o,M([pa(f(ol,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(US,d,O,t)}return l($S,t,_o,M([pa(f(RE,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(DS,d,F,t)}return l($S,t,_o,M([pa(f(RE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=wm(V.terms);if("Ok"===K.$){var H=K.a;return l(OS,d,H,t)}var j=K.a;return f(_S,d,t)}var j=r.a;return l($S,t,_o,M([pa(f(ol,"Error decoding initiated event",j))]));default:var q=e.a,G=f(lS,q,t.eventSentry),z=G.a,y=G.b;return l($S,D(t,{eventSentry:z}),y,yr)}}),WS=function(e){return{$:"AgentHistoryMsg",a:e}},JS=function(e){return{$:"AppCmd",a:e}},QS={$:"BetaLandingPage"},XS={$:"ConnectToWeb3"},ZS=function(e){return{$:"MarketplaceMsg",a:e}},eT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),tT=r(function(e,t){return f(kn,e,sl(t))}),rT=function(e){return f(tT,"href",tt(e))},nT=Nn("rel"),aT=tT("target"),iT=function(e){return{$:"Height",a:e}},oT=iT,uT={$:"Content"},sT=uT,cT=function(e){return{$:"Width",a:e}},fT=cT,lT=function(e){return{$:"Attr",a:e}},dT=function(e){return{$:"NodeName",a:e}},hT=function(e){return{$:"Unkeyed",a:e}},pT={$:"AsEl"},gT=pT,vT=r(function(e,t){return{$:"Field",a:e,b:t}}),yT=f(vT,0,0),mT={$:"NoNearbyChildren"},bT={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"},CT=bT.any+" "+bT.column,ET=bT.any+" "+bT.grid,ST=bT.any+" "+bT.page,TT=bT.any+" "+bT.paragraph,wT=bT.any+" "+bT.row,IT=bT.any+" "+bT.single,AT=function(e){switch(e.$){case"AsRow":return wT;case"AsColumn":return CT;case"AsEl":return IT;case"AsGrid":return ET;case"AsParagraph":return TT;default:return ST}},BT=function(e){return{$:"Keyed",a:e}},kT={$:"NoStyleSheet"},NT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),RT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),$T={$:"AsParagraph"},_T=$T,LT=Sn("div"),xT=Sn("p"),PT=Sn("s"),DT=Sn("u"),UT=tT("className"),OT=function(e){return wn(Xe(e))},MT=function(e){return Sn(Xe(e))},FT=function(e){return{$:"Flag",a:e}},VT=function(e){return{$:"Second",a:e}},KT=function(e){return e>31?VT(1< .ctr > ."+bT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",Hw="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+fw(bT.any)+fw(bT.row)+" > "+fw(bT.any)+" { flex-basis: auto !important; } "+fw(bT.any)+fw(bT.row)+" > "+fw(bT.any)+fw(bT.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"+Kw,jw=function(e){return{$:"Intermediate",a:e}},qw=r(function(e,t){return jw({closing:t,others:yr,props:yr,selector:e})}),Gw=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,jw({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(Gw,f(qw,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(Gw,f(qw,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(Gw,f(qw,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(Gw,f(qw,n.selector,""),v),t.others)})}});return jw(l(La,a,n,t))}),zw=U(Hw,function(e){var t=function(e){return gd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),gd(f(xa,a,t.others)))};return gd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(Gw,f(qw,r,""),n),t)}),yr,e)))}(U(Mw,Vw))),Yw=l(MT,"style",yr,M([dw(zw)])),Ww=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+'"'}},Jw=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}},Qw=function(e){if("FontWith"===e.$){var t=e.a;return f(gh,Jw,t.variants)}return!1},Xw=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),Zw=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),eI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(Zw,"."+e+"."+t+", ."+e+" ."+t,n),f(Zw,"."+e+"."+t+"> ."+bT.text+", ."+e+" ."+t+" > ."+bT.text,a)])}),tI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(eI,i,bT.sizeByCapital,a),l(eI,i,bT.fullSize,n)))}),rI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(Zw,"."+r+"."+bT.sizeByCapital+", ."+r+" ."+bT.sizeByCapital,M([L("line-height","1")])),f(Zw,"."+r+"."+bT.sizeByCapital+"> ."+bT.text+", ."+r+" ."+bT.sizeByCapital+" > ."+bT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),nI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},aI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,mc,t,r))}return ci},iI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),oI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(Nc,e.descender,aI(t)),n=f(Nc,e.baseline,aI(f(hl,function(e){return!R(e,r)},t))),a=f(Nc,e.capital,nI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(iI,i,a-n,o),full:l(iI,u,a-r,s)}},uI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",uw(e.height)),L("vertical-align",uw(e.vertical)+"em"),L("font-size",uw(e.size)+"em")]))},sI=function(e){return l(Ra,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 si(L(uI(function(e){return e.full}(oI(a))),uI(function(e){return e.capital}(oI(a)))))}return t}return t}),ci,e)},cI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(AS,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=sI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,rI(t),n));var i=a.a;return f(Ri,"",f(xa,f(tI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},fI=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+'" '+Ni(r)}},lI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,fI,t.variants)))}return ci},dI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},hI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+uw(r)+"px, "+uw(n)+"px, "+uw(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("+uw(o)+"px, "+uw(u)+"px, "+uw(s)+"px)",b="scale3d("+uw(f)+", "+uw(l)+", "+uw(d)+")",C="rotate3d("+uw(p)+", "+uw(g)+", "+uw(v)+", "+uw(y)+"rad)";return si(m+" "+b+" "+C)}},pI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,Xw(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,Xw(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,Xw(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,Xw(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+bT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+bT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+bT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,Xw(!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,M([f(iw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(mc,1,1-c));return l(a,t,"."+u,M([f(iw,"opacity",uw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(iw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(AS,lI,p)),v=M([f(iw,"font-family",f(Ri,", ",f(xa,Ww,p))),f(iw,"font-feature-settings",g),f(iw,"font-variant",f(gh,Qw,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(iw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(iw,s,sw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+bT.row,A="."+(bT.wrapped+I),B="."+bT.alignRight,k="."+bT.paragraph,N="."+bT.page,R="."+bT.alignLeft,$=uw(S/2)+"px",_=uw(E/2)+"px",x="."+bT.column,y="."+C,P="."+bT.any;return gd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(iw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(iw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(iw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(iw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(iw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(iw,"margin-left",w)])),l(a,t,U(y,k),M([f(iw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(iw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(iw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(iw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(iw,"content","''"),f(iw,"display","block"),f(iw,"height","0"),f(iw,"width","0"),f(iw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(iw,"content","''"),f(iw,"display","block"),f(iw,"height","0"),f(iw,"width","0"),f(iw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(iw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(iw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,ew,F.rows))+"-cols-"+f(Ri,"-",f(xa,ew,F.columns))+"-space-x-"+ew(F.spacing.a)+"-space-y-"+ew(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=hI(ne),y=rw(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,M([f(iw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=dI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(cI(s),c)}),gI=r(function(e,t){return l(MT,"style",yr,M([dw(f(pI,e,t))]))}),vI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",Yw),f(ka,L("dynamic-stylesheet",f(gI,t,l(Ra,aw,L(Qy,M([lw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(gI,t,l(Ra,aw,L(Qy,M([lw(t.focus)])),r).b)),n)}),yI=a(function(e,t,r,n){return e?f(ka,Yw,f(ka,f(gI,t,l(Ra,aw,L(Qy,M([lw(t.focus)])),r).b),n)):f(ka,f(gI,t,l(Ra,aw,L(Qy,M([lw(t.focus)])),r).b),n)}),mI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(OT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(vI,!1,e,t,r);default:var e=i.a,t=i.b;return d(vI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return LT;case"p":return xT;default:return MT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(yI,!1,e,t,n);default:var e=i.a,t=i.b;return d(yI,!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(MT,e,n,M([f(u,r,M([UT(bT.any+" "+bT.single)]))]))}}();switch(o.$){case"AsRow":return f(WT,QT,e)&&!f(WT,JT,e)?s:f(WT,jT,e)?f(DT,M([UT(f(Ri," ",M([bT.any,bT.single,bT.container,bT.contentCenterY,bT.alignContainerRight])))]),M([s])):f(WT,qT,e)?f(PT,M([UT(f(Ri," ",M([bT.any,bT.single,bT.container,bT.contentCenterY,bT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(WT,YT,e)&&!f(WT,zT,e)?s:f(WT,GT,e)?f(PT,M([UT(f(Ri," ",M([bT.any,bT.single,bT.container,bT.alignContainerCenterY])))]),M([s])):f(WT,HT,e)?f(DT,M([UT(f(Ri," ",M([bT.any,bT.single,bT.container,bT.alignContainerBottom])))]),M([s])):s;default:return s}}),bI=dw,CI=function(e){return f(LT,M([UT(f(Ri," ",M([bT.any,bT.text,bT.widthContent,bT.heightContent])))]),M([bI(e)]))},EI=function(e){return l(MT,"div",M([UT(f(Ri," ",M([bT.any,bT.text,bT.widthFill,bT.heightFill])))]),M([dw(e)]))},SI=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 R(e,_T),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,_T),L(f(ka,L(n,f(s.html,kT,e)),i),Cu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,gT)?EI(c):CI(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 R(e,_T),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,_T),L(f(ka,f(o.html,kT,e),n),Cu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,gT)?EI(u):CI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Cu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(mI,n.has,n.node,n.attributes,BT(l(RT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(mI,n.has,n.node,n.attributes,BT(l(RT,"nearby-element-pls",s,n.children)),kT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Cu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(mI,n.has,n.node,n.attributes,hT(f(NT,m,n.children))),styles:g})}return Gi(h(mI,n.has,n.node,n.attributes,hT(f(NT,m,n.children)),kT))}),TI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),wI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(vT,a|r,n)}var i=e.a;return f(vT,r,i|n)}),II=KT(7),AI=KT(36),BI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(vT,r|a,n|i)}),kI=KT(6),NI=KT(38),RI=KT(30),$I=KT(29),_I=r(function(e,t){return{$:"Embedded",a:e,b:t}}),LI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),xI=function(e){return{$:"Transform",a:e}},PI=function(e){return{$:"ChildrenBehind",a:e}},DI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),UI=function(e){return{$:"ChildrenInFront",a:e}},OI=r(function(e,t){return f(LT,M([UT(function(){switch(e.$){case"Above":return f(Ri," ",M([bT.nearby,bT.single,bT.above]));case"Below":return f(Ri," ",M([bT.nearby,bT.single,bT.below]));case"OnRight":return f(Ri," ",M([bT.nearby,bT.single,bT.onRight]));case"OnLeft":return f(Ri," ",M([bT.nearby,bT.single,bT.onLeft]));case"InFront":return f(Ri," ",M([bT.nearby,bT.single,bT.inFront]));default:return f(Ri," ",M([bT.nearby,bT.single,bT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return dw("");case"Text":var e=t.a;return CI(e);case"Unstyled":return(0,t.a)(gT);default:return f(t.a.html,kT,gT)}}()]))}),MI=n(function(e,t,r){var n=f(OI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?PI(M([n])):UI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?PI(f(ka,n,a)):f(DI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(DI,M([n]),i):UI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(DI,f(ka,n,a),i):f(DI,a,f(ka,n,i))}}),FI=r(function(e,t){switch(t.$){case"Generic":return dT(e);case"NodeName":var r=t.a;return f(_I,r,e);default:var n=t.a,a=t.b;return f(_I,n,a)}}),VI=function(e){switch(e.$){case"Left":return bT.alignedHorizontally+" "+bT.alignLeft;case"Right":return bT.alignedHorizontally+" "+bT.alignRight;default:return bT.alignedHorizontally+" "+bT.alignCenterX}},KI=function(e){switch(e.$){case"Top":return bT.alignedVertically+" "+bT.alignTop;case"Bottom":return bT.alignedVertically+" "+bT.alignBottom;default:return bT.alignedVertically+" "+bT.alignCenterY}},HI=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),jI=function(e){return{$:"Moved",a:e}},qI=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return jI(x(r,0,0));case"MoveY":var n=t.a;return jI(x(0,n,0));case"MoveZ":var a=t.a;return jI(x(0,0,a));case"MoveXYZ":var i=t.a;return jI(i);case"Rotate":var i=t.a,o=t.b;return d(HI,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(HI,x(0,0,0),i,x(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 jI(x(s,n,a));case"MoveY":var c=t.a;return jI(x(r,c,a));case"MoveZ":var f=t.a;return jI(x(r,n,f));case"MoveXYZ":var i=t.a;return jI(i);case"Rotate":var i=t.a,o=t.b;return d(HI,u,x(1,1,1),i,o);default:var l=t.a;return d(HI,u,l,x(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(HI,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(HI,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(HI,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(HI,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(HI,u,h,v,y);default:var m=t.a;return d(HI,u,m,p,o)}}}),GI=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(yT,n,M([l(LI,n,"height",r+"px")]));case"Content":return x(f(wI,AI,yT),bT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(wI,YT,yT),bT.heightFill,yr):x(f(wI,YT,yT),bT.heightFillPortion+" height-fill-"+Ni(a),M([l(LI,bT.any+"."+bT.row+" > "+fw("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(LI,u,"min-height",Ni(i)+"px"),c=GI(o),d=c.a,h=c.b,p=c.c;return x(f(wI,zT,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(LI,u,"max-height",Ni(g)+"px"),v=GI(o),d=v.a,h=v.b,p=v.c;return x(f(wI,zT,d),u+" "+h,f(ka,s,p))}},zI=function(e){switch(e.$){case"Px":var t=e.a;return x(yT,bT.widthExact+" width-px-"+Ni(t),M([l(LI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(wI,NI,yT),bT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(wI,QT,yT),bT.widthFill,yr):x(f(wI,QT,yT),bT.widthFillPortion+" width-fill-"+Ni(r),M([l(LI,bT.any+"."+bT.row+" > "+fw("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(LI,i,"min-width",Ni(n)+"px"),u=zI(a),s=u.a,c=u.b,d=u.c;return x(f(wI,JT,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(LI,i,"max-width",Ni(h)+"px"),p=zI(a),s=p.a,c=p.b,d=p.c;return x(f(wI,JT,s),i+" "+c,f(ka,o,d))}},YI=KT(27),WI=r(function(e,t){if(R(e,YI)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),JI=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=rw(n);if("Nothing"===s.$)return{attributes:f(ka,UT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,UT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,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,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(WT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(wI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(WT,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(WI,S,I)){var p=nw(I)+" "+e,g=t,v=f(wI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=nw(I)+" "+e,g=t,v=f(wI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(wI,S,r),y=f(qI,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(WT,kI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=bT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(wI,kI,r),y=n,m=f(ka,l(LI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+bT.widthContent,g=t,v=f(wI,NI,f(wI,kI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+bT.widthFill,g=t,v=f(wI,QT,f(wI,kI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+bT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(wI,QT,f(wI,kI,r)),y=n,m=f(ka,l(LI,bT.any+"."+bT.row+" > "+fw("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=zI(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(BI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(WT,II,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(wI,II,r),y=n,m=f(ka,l(LI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=bT.heightContent+" "+e,g=t,v=f(wI,AI,f(wI,II,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=bT.heightFill+" "+e,g=t,v=f(wI,YT,f(wI,II,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+bT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(wI,YT,f(wI,II,r)),y=n,m=f(ka,l(LI,bT.any+"."+bT.column+" > "+fw("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=GI(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(BI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(FI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(FI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(FI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(FI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(FI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(FI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(FI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return dT("p");case"NodeName":var e=t.a;return dT(e);default:var r=t.a,n=t.b;return f(_I,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(TI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(TI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(TI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(TI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(MI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(WT,RI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=VI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(wI,qT,e);case"Right":return f(wI,jT,e);default:return e}}(f(wI,RI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(WT,$I,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=KI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(wI,GT,e);case"Bottom":return f(wI,HT,e);default:return e}}(f(wI,$I,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),QI={$:"Untransformed"},XI=QI,ZI=a(function(e,t,r,n){return l(SI,e,n,v(JI,AT(e),t,yT,XI,yr,yr,mT,$a(r)))}),eA=function(e){return lT(UT(e))},tA=r(function(e,t){var r=t.url,n=t.label;return d(ZI,gT,dT("a"),f(ka,lT(rT(r)),f(ka,lT(nT("noopener noreferrer")),f(ka,lT(aT("_blank")),f(ka,fT(sT),f(ka,oT(sT),f(ka,eA(bT.contentCenterX+" "+bT.contentCenterY),e)))))),hT(M([n])))}),rA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),nA=n(function(e,t,r){return d(rA,e,t,r,1)}),aA=KT(14),iA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),oA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),uA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return tw(t)+"-"+tw(r)+"-"+tw(n)+"-"+tw(a)},sA=function(e){return f(oA,aA,l(iA,"fc-"+uA(e),"color",e))},cA={align:rl,label:"cantConnectNoWeb3",mainParagraphs:M([M([il("You need a web3 provider (such as "),f(tA,M([sA(l(nA,0,0,1))]),{label:il("Metamask"),url:"https://metamask.io/"}),il(") to Connect.")]),M([il("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:Ng},fA={align:rl,label:"invalidUrl",mainParagraphs:M([M([il("I don't understand that URL...")]),M([il("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:Ag},lA=function(e){return{$:"Active",a:e}},dA=fu(f(Ko,Mf,f(Ko,Oh,Ad("Error decoding hex to BigInt")))),hA=function(){return fu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),pA=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}}}}}}}}}}}},gA=function(e){return FE(M([f(Oi,si,e),Fi(ci)]))},vA=f(uh,gA(f(Lh,"status",hA)),f(uh,gA(f(Lh,"root",cu)),l(jE,"logsBloom",cu,l(jE,"logs",Tm(tS),f(uh,gA(f(Lh,"contractAddress",qE)),l(jE,"cumulativeGasUsed",dA,l(jE,"gasUsed",dA,l(jE,"blockNumber",Py,l(jE,"blockHash",WE,l(jE,"transactionIndex",Py,l(jE,"transactionHash",XE,Fi(pA)))))))))))),yA=function(e){var t=e.a;return Mf(t)},mA=f(Ko,yA,sl),bA=r(function(e,t){return _p({decoder:vA,method:"eth_getTransactionReceipt",params:M([mA(t)]),url:e})}),CA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),EA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),SA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),TA=r(function(e,t){return f(wo,function(e){return e.toMsg},f(So,function(e){return e.b},f(So,function(e){return e.onMinedTagger},f(ip,t,e))))}),wA=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}}}}}}}}}}}},IA=function(e){return FE(M([ME(ci),f(Oi,si,e)]))},AA=l(jE,"input",cu,l(jE,"gas",Py,l(jE,"gasPrice",dA,l(jE,"value",dA,l(jE,"to",IA(qE),l(jE,"from",qE,l(jE,"transactionIndex",Py,l(jE,"blockNumber",IA(Py),l(jE,"blockHash",function(e){return f(uu,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},au(t))?Fi(ci):f(Oi,si,e)},cu)}(WE),l(jE,"nonce",Py,l(jE,"hash",XE,Fi(wA)))))))))))),BA=r(function(e,t){return _p({decoder:AA,method:"eth_getTransactionByHash",params:M([mA(t)]),url:e})}),kA=r(function(e,t){return{attempts:e,sleep:t}}),NA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(zp,function(e){return a>0?f(Up,function(e){return f(NA,f(kA,a,n),t)},UE(1e3*n)):kp(e)},t)}),RA=r(function(e,t){return f(Up,function(r){return f(NA,{attempts:30,sleep:1},f(BA,e,t))},UE(250))}),$A=r(function(e,t){return f(NA,{attempts:60,sleep:5},f(bA,e,t))}),_A=function(e){return{$:"Mined",a:e}},LA=function(e){return wo(function(t){return D(t,{status:_A(e)})})},xA=function(e){return{$:"Sent",a:e}},PA=function(e){return wo(function(t){return D(t,{status:xA(e)})})},DA=function(e){return{$:"Signed",a:e}},UA=function(e){return wo(function(t){return D(t,{status:DA(e)})})},OA=function(e){return"Nothing"!==e.$},MA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(ml(r),_o);case"TxSigned":var n=e.a,a=e.b,i=f(ip,n,r.txs);if("Just"===i.$){var o=i.a,u=function(){var e=o.onSignedTagger;if("Just"===e.$){var t=e.a;return f(Hg,t,Np(a))}return _o}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return _o;if("Just"===t.b.$){var r=t.b.a;return f(Hg,r,Np(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Hg,a,Np(fi(e)))}t.a,t.b,t.c;return _o};if("Ok"===a.$){var c=a.a,d=OA(o.onBroadcastTagger)||OA(o.onMinedTagger)?f(el,r.tagger,f(Yp,SA(n),f(RA,r.nodePath,c))):_o;return L(ml(D(r,{txs:l(pp,n,UA(c),r.txs)})),$o(M([u,d])))}var h=a.a;return L(ml(r),$o(M([u,s(h)])))}return L(ml(r),_o);case"TxSent":var n=e.a,p=e.b,g=f(ip,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(el,r.tagger,f(Yp,EA(n),f($A,r.nodePath,v.hash))):_o}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Hg,t,Np(li(v)))}return _o}();return L(ml(D(r,{txs:l(pp,n,PA(v),r.txs)})),$o(M([d,y])))}var h=p.a,s=function(){var e=L(o.onBroadcastTagger,o.onMinedTagger);if("Just"===e.a.$){var t=e.a.a;return f(Hg,t,Np(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Hg,n,Np(fi("Error with TxSent stuff")))}e.a,e.b;return _o}();return L(ml(r),s)}return L(ml(r),_o);case"TxMined":var n=e.a,m=e.b,b=f(ip,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Hg,a,Np(li(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 $o(M([f(el,r.tagger,f(Yp,f(CA,n,s),Dy(r.nodePath))),f(Hg,a,Np(li(C))),f(Hg,u.toMsg,Np(s))]))}return _o}();return L(ml(D(r,{txs:l(pp,n,LA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Hg,r,Np(fi("TxReceipt decoding failure")))}return _o}();return L(ml(r),S)}return L(ml(r),_o);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(TA,r.txs,n);if("Just"===A.$){var B=A.a;return L(ml(r),f(Hg,B,f(zp,function(e){return Np(D(I,{doneWatching:!0,reOrg:!0}))},f(Up,function(e){return Np(D(I,{doneWatching:!0}))},f(bA,r.nodePath,T.txHash)))))}return L(ml(r),_o)}if(R(w,T.lastCheckedBlock))return L(ml(r),f(el,r.tagger,f(Yp,f(CA,n,T),f(Up,function(e){return Dy(r.nodePath)},UE(2e3)))));var k=f(TA,r.txs,n);if("Just"===k.$){var B=k.a;return L(ml(r),$o(M([f(el,r.tagger,f(Yp,f(CA,n,I),f(Up,function(e){return Dy(r.nodePath)},UE(2e3)))),f(Hg,B,Np(I))])))}return L(ml(r),_o)}var n=e.a,h=e.c.a;return L(ml(r),_o);default:var h=e.a;return L(ml(r),_o)}}),FA=Jt,VA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),KA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),HA=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(KA,"#",e.fragment,l(KA,"?",e.query,U(f(VA,e.port_,U(t,e.host)),e.path)))},jA=r(function(e,t){return e<0?ci:Gl(f(Xl,e,t))}),qA=r(function(e,t){if(e<0)return t;var r=Sh(f(Xl,e,t)),n=f(oc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),GA=n(function(e,t,r){if(e<0)return r;var n=f(Xl,e,r),a=f(oc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),zA=r(function(e,t){return f(GA,e,hs(t))}),YA=r(function(e,t){$v(t);switch(t.$){case"Home":return L(D(e,{submodel:QS}),_o);case"Create":var r=zd(e.wallet),n=f(_l,e.txSentry,f(Ho,Ay,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(JA,U(f(Qi,Ay,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Iy(r.model),txSentry:a}),$o(M([f(el,Ay,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(vy,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(um,e.wallet,r)}return l(im,e.wallet,u,s)}(),c=f(_l,e.txSentry,f(Ho,Ny,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(JA,U(f(Qi,Ny,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:ky(r.model),txSentry:a}),$o(M([f(el,Ny,r.cmd),i]))));case"Marketplace":var d=hv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:By(h)}),$o(M([f(el,ZS,p)])));case"AgentHistory":var g=t.a,v=f(Lo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:wy(y)}),$o(M([f(el,WS,m)])));default:return L(f(uo,fA,e),_o)}}),WA=r(function(e,t){var r=t.a,n=t.b,a=f(QA,JS(e),r),i=a.a,o=a.b;return L(i,$o(M([n,o])))}),JA=r(function(e,t){var r=t.a,n=t.b;return l(Ra,WA,L(r,n),e)}),QA=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(QA,XS,t);case"GotoRoute":var n=r.a;return L(t,f(cy,t.key,n));case"GTag":var a=r.a;return L(t,hy(ly(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),hy(ly(d(Ll,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Av,yy,o,u,s));default:return L(t,my(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(qA,c,t.userNotices)}),_o);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(sy,t.key,HA(e))}var r=h.a;return FA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(XA,g,t);case"GotoRoute":var v=e.a;return L(t,$o(M([hy(ly(d(Ll,"GotoRoute","navigation",$v(v),0))),f(cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),_o);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,cA,t),_o):L(t,fy(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return _o;var t=e.a;return py(f(dy,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Vh,cu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=lA(l(xl,I,w,S)),B=f(Ry,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ol,"Unexpected wallet state encounted when setting commPubkey!",ci),t),_o)}T.a;return L(f(uo,f(ol,"User pubkey set, but I can no longer find the user address!",ci),t),_o)}var N=E.a;return L(l(Pa,uo,f(ol,"error decoding commPubkey from JS",N),t),_o);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(ov,R,_),P=f(_l,t.txSentry,f(Ho,Ay,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(JA,U(f(Qi,Ay,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Iy(x.model),txSentry:O}),$o(M([f(el,Ay,x.cmd),F]))))}return L(t,_o);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(vS,K,j),q=f(_l,t.txSentry,f(Ho,Ny,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(JA,U(f(Qi,Ny,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:ky(x.model),txSentry:O}),$o(M([f(el,Ny,x.cmd),F]))))}return L(t,_o);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Iv,G,Y);return f(JA,f(Qi,ZS,x.appCmds),L(D(t,{submodel:By(x.model)}),f(el,ZS,x.cmd)))}return L(t,_o);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(tl,W,Q),X=f(_l,t.txSentry,f(Ho,WS,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(JA,U(f(Qi,WS,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:wy(x.model),txSentry:O}),$o(M([f(el,WS,x.cmd),F]))))}return L(t,_o);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(Bu,si,f(MA,Z,r))}return L(ci,_o)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(jA,re,t.tradeCaches);if("Nothing"===ae.$)return f(WA,pa(f(ol,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,_o));var ie=ae.a,x=f(YS,ne,ie);return L(D(t,{tradeCaches:l(zA,re,x.tradeCache,t.tradeCaches)}),f(el,eT(re),x.cmd));case"NoOp":return L(t,_o);default:var N=e.a;f(al,"test",N);return L(t,_o)}}),XA=r(function(e,t){return f(YA,t,uy(e))}),ZA=Ge("txIn",VE),eB=je("txOut",Ua),tB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},rB=function(e){return{$:"EventSentryMsg",a:e}},nB=function(e){var t=f(Xy,rB,zh(e)),r=t.a,n=t.b;return x({dataFetchState:l(FS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Yd,"tradeCache init","processing",tB(e),0)]))},aB=function(e){return{$:"InitialNumTradesFetched",a:e}},iB=function(e){return f(SS,e.factory,aB)},oB=function(e){var t=nB(e),r=t.a,n=t.b,a=t.c;return x(r,$o(M([n,iB(r)])),a)},uB=function(e){return{$:"TxSentryMsg",a:e}},sB={align:rl,label:"noWeb3Provider",mainParagraphs:M([M([il("No web3 provider detected. Is "),f(tA,M([sA(l(nA,0,0,1))]),{label:il("Metamask"),url:"https://metamask.io/"}),il(" or some other web3 provider installed and unlocked?")])]),noticeType:Ng},cB={$:"TopLeft"},fB={align:cB,label:"screenToSmall",mainParagraphs:M([M([il("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:Ng},lB={align:rl,label:"wrongWeb3Network",mainParagraphs:M([M([il("Your wallet is set to an incorrect network.")]),M([il("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:Ag},dB={$:"NoneDetected"},hB=function(e){return{$:"OnlyNetwork",a:e}},pB=function(e){return f(wo,zh,xg(e))},gB={$:"ETCMain"},vB={$:"ETCTest"},yB={$:"Expanse"},mB={$:"Kovan"},bB={$:"Mainnet"},CB=function(e){return{$:"Private",a:e}},EB={$:"Rinkeby"},SB={$:"Ropsten"},TB={$:"RskMain"},wB={$:"RskTest"},IB=function(e){switch(e){case 1:return bB;case 2:return yB;case 3:return SB;case 4:return EB;case 30:return TB;case 31:return wB;case 42:return mB;case 41:return gB;case 62:return vB;default:return CB(e)}},AB=n(function(e,t,r){var n=e.a,a=e.b;return ml({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:ap})}),BB=n(function(e,t,n){var a=e.networkId?hB(IB(e.networkId)):dB,i=f(wo,function(e){return l(AB,L(eB,ZA),uB,e)},pB(a)),o=e.width<1024?si(fB):ci,u=f(xa,oB,ro),s=function(){return R(a,dB)?si(sB):"Nothing"===xg(a).$?si(lB):ci}(),c=xC(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=zv(f(Bi,r(function(e,t){return f(Qi,eT(e),t)}),g)),y=$o(f(Bi,r(function(e,t){return f(el,eT(e),t)}),p)),m=f(JA,v,f(XA,t,{key:n,screenWidth:e.width,submodel:QS,time:Dl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),$o(M([y,C])))}),kB=Oe,NB=kB(yr),RB=function(e){return NB},$B=function(e){return{$:"Refresh",a:e}},_B=r(function(e,t){return{$:"Every",a:e,b:t}}),LB=r(function(e,t){return{processes:t,taggers:e}}),xB=Np(f(LB,ap,ap)),PB=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(sS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),DB=Ne,UB=r(function(e,t){var r=e.a,n=e.b,a=f(ip,r,t);if("Nothing"===a.$)return l(Nl,r,M([n]),t);var i=a.a;return l(Nl,r,f(ka,n,i),t)}),OB=Be,MB=r(function(e,t){return{$:"Zone",a:e,b:t}}),FB=ca,VB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=OB(f(FB,n,f(yp,e,n)));return f(Up,function(t){return l(VB,e,a,l(Nl,n,t,r))},i)}return Np(r)}),KB=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 x(n,a,f(Up,function(e){return i},DB(t)))}),u=l(Ra,UB,ap,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(Nl,e,r,i),o)}),d=p(PB,s,c,o,u,i,x(yr,ap,Np(gr))),h=d.a,g=d.b,v=d.c;return f(Up,function(e){return Np(f(LB,u,e))},f(Up,function(t){return l(VB,e,h,g)},v))}),HB=function(e){return we(function(t){t(Se(e(Date.now())))})}(Dl),jB=n(function(e,t,r){var n=f(ip,t,r.taggers);if("Nothing"===n.$)return Np(r);var a=n.a,i=function(t){return Vp(f(xa,function(r){return f(vp,e,r(t))},a))};return f(Up,function(e){return Np(r)},f(Up,i,HB))}),qB=r(function(e,t){var r=t.a,n=t.b;return f(_B,r,f(Da,e,n))});pn.Time=Pe(xB,KB,jB,0,qB);var GB=Ue("Time"),zB=r(function(e,t){return GB(f(_B,e,t))}),YB=function(e){return f(zB,2e3,$B)},WB=function(e){return NB},JB=function(e){return{$:"DecryptionFinished",a:e}},QB=Ge("decryptionFinished",VE),XB=Ge("encryptionFinished",VE),ZB=function(e){return{$:"EncryptionFinished",a:e}},ek=function(e){return{$:"Refresh",a:e}},tk=function(e){return kB(M([f(zB,3e3,ek),XB(ZB),QB(function(e){return oE(JB(e))})]))},rk=yn,nk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return NB;case"CreateModel":t.a;return f(rk,Ay,YB());case"TradeModel":t.a;return f(rk,Ny,tk());case"MarketplaceModel":t.a;return f(rk,ZS,WB());default:t.a;return f(rk,WS,RB())}},ak=Ge("userPubkeyResult",VE),ik=Ge("walletSentryPort",VE),ok={$:"CheckForNewTrades"},uk={$:"UpdateTradePhases"},sk=function(e){return kB(M([f(zB,5e3,function(e){return ok}),f(zB,3e3,function(e){return uk})]))},ck=function(e){return{$:"Tick",a:e}},fk=function(e){return{$:"UserPubkeySet",a:e}},lk=function(e){return{$:"WalletStatus",a:e}},dk=function(e){return f(ol,"Error decoding JS walletSentry: "+e,ci)},hk=function(e){return{$:"ErrorDecoding",a:e}},pk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),gk=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Lh,"ref",DC),f(Lh,"txHash",gA(XE))),vk=function(e){var t=f(Vh,gk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(pk,r.ref,li(a))}return f(pk,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return hk("Error decoding tx data")},yk=function(e){var t=e.a;return f(rk,t.tagger,t.inPort(vk))},mk=f(Oi,IB,DC),bk=fu(f(Ko,Ql,f(Ko,Ad("Failure decoding stringy int"),Zo(IB)))),Ck=FE(M([bk,mk])),Ek=r(function(e,t){return{account:e,networkId:t}}),Sk=l(Mi,Ek,f(Lh,"account",gA(qE)),f(Lh,"networkId",Ck)),Tk=n(function(e,t,r){var n=f(Vh,Sk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),wk=function(e){var t=f(Ko,dk,f(Ko,pa,JS));return kB(U(M([f(zB,1e3,ck),ik(f(Tk,t,lk)),f(Nc,NB,f(wo,yk,e.txSentry)),ak(fk),kB(f(Bi,r(function(e,t){return f(rk,eT(e),t)}),f(xa,sk,e.tradeCaches)))]),M([nk(e)])))},Ik=function(e){return{$:"LinkClicked",a:e}},Ak=function(e){return{$:"UrlChanged",a:e}},Bk=n(function(e,t,r){return d(rA,e/255,t/255,r/255,1)}),kk=l(Bk,10,33,108),Nk={$:"Generic"},Rk=Nk,$k=r(function(e,t){return d(ZI,gT,Rk,f(ka,fT(sT),f(ka,oT(sT),e)),hT(M([t])))}),_k=function(e){return{$:"Fill",a:e}},Lk=_k(1),xk=Hi,Pk=function(e){return{$:"Px",a:e}},Dk=Pk,Uk=KT(8),Ok=function(e){return f(oA,Uk,l(iA,"bg-"+uA(e),"background-color",e))},Mk=f($k,M([fT(Lk),oT(Dk(150)),Ok(kk)]),xk),Fk=function(e){return{$:"GotoRoute",a:e}},Vk={$:"Active"},Kk={$:"Important"},Hk={$:"Normal"},jk=l(nA,1,1,1),qk=KT(2),Gk=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),zk=r(function(e,t){return R(e,t)?f(oA,qk,h(Gk,"p-"+Ni(e),e,e,e,e)):f(oA,qk,h(Gk,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Yk=KT(21),Wk=r(function(e,t){return{$:"Class",a:e,b:t}}),Jk=f(Wk,Yk,bT.cursorPointer),Qk=KT(17),Xk=function(e){return f(oA,Qk,l(LI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},Zk=function(e){return{$:"Normal",a:e}},eN=An,tN=r(function(e,t){return f(eN,e,Zk(t))}),rN=function(e){return f(tN,"click",Fi(e))},nN=f(Da,lT,rN),aN=KT(13),iN=f(Wk,aN,bT.textSemiBold),oN=KT(4),uN=function(e){return{$:"FontSize",a:e}},sN=function(e){return f(oA,oN,uN(e))},cN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([Xk(4),Ok(l(nA,0,0,1))]);default:return M([Xk(4),Ok(l(nA,.9,0,0))])}}();return f($k,U(M([f(zk,23,12),sN(22),iN,sA(jk),Jk,nN(t)]),n),il(e))}),fN=l(Bk,244,0,103),lN=function(e){return{$:"AlignX",a:e}},dN={$:"CenterX"},hN=lN(dN),pN=KT(3),gN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),vN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),yN=function(e){return f(oA,pN,l(gN,f(vN,e,e),e,e))},mN=function(e){return{$:"Describe",a:e}},bN={$:"Paragraph"},CN=r(function(e,t){return d(ZI,_T,Rk,f(ka,mN(bN),f(ka,fT(Lk),f(ka,yN(5),e))),hT(t))}),EN=f(Wk,aN,bT.bold),SN=f($k,M([sN(29),sA(jk),EN,hN,Jk,nN(Fk(Pv))]),f(CN,yr,M([il("DAI"),f($k,M([sA(fN)]),il("Hard"))]))),TN={$:"Right"},wN=lN(TN),IN={$:"AsColumn"},AN=IN,BN=r(function(e,t){return d(ZI,AN,Rk,f(ka,eA(bT.contentTop+" "+bT.contentLeft),f(ka,oT(sT),f(ka,fT(sT),e))),hT(t))}),kN={$:"AsRow"},NN=kN,RN=r(function(e,t){return d(ZI,NN,Rk,f(ka,eA(bT.contentLeft+" "+bT.contentCenterY),f(ka,fT(sT),f(ka,oT(sT),e))),hT(t))}),$N=function(e){return f(RN,M([fT(Lk),yN(30),f(zk,30,17)]),M([l(cN,"Browse Offers",Fk(Dv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Vk}return Hk}()),l(cN,"Create a New Offer",Fk(xv),function(){return"CreateModel"===e.submodel.$?Vk:Hk}()),function(){var t=Vd(e.wallet);if("Just"===t.$){var r=t.a;return l(cN,"My Trades",Fk(Lv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Vk:Hk}return Hk}())}return l(cN,"Connect to Wallet",XS,Kk)}(),f(BN,M([wN,yN(0),f(zk,8,0)]),M([SN]))]))},_N=rA,LN=r(function(e,t){return f($k,M([Xk(4),Ok(d(_N,0,0,1,.1)),sA(l(Bk,16,7,234)),sN(e),iN,f(zk,15,13)]),il(ul(t)))}),xN=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),PN=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(oA,qk,h(Gk,"p-"+Ni(t),t,t,t,t)):f(oA,qk,h(Gk,d(xN,t,r,n,a),t,r,n,a))},DN=function(e){return function(){var t=Vd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?xk:f(RN,M([yN(10),PN({bottom:20,left:20,right:20,top:10})]),M([f($k,M([sN(24),iN]),il("Trade History for User")),f(LN,18,e.agentAddress)]))},UN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},ON=function(e){return hl(e)},MN={$:"BurnWindow"},FN={$:"FiatPrice"},VN={$:"Margin"},KN={$:"Offer"},HN={$:"PaymentWindow"},jN=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),qN=TI,GN={$:"Left"},zN=lN(GN),YN=function(e){return{$:"AlignY",a:e}},WN={$:"CenterY"},JN=YN(WN),QN=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(ZI,AN,dT("label"),e,hT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(ZI,gT,Rk,a,hT(M([i])));switch(n.$){case"Above":return d(ZI,AN,dT("label"),e,hT(M([o,r])));case"Below":return d(ZI,AN,dT("label"),e,hT(M([r,o])));case"OnRight":return d(ZI,NN,dT("label"),e,hT(M([r,o])));default:return d(ZI,NN,dT("label"),e,hT(M([o,r])))}}),XN=function(e){return{$:"Label",a:e}},ZN={$:"NoAttribute"},eR=function(e){if("HiddenLabel"===e.$){var t=e.a;return mN(XN(t))}return ZN},tR=function(e){return"HiddenLabel"===e.$},rR=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return su("No key matched");var n=r.a;return Fi(n)},r=f(uu,t,f(Lh,"key",cu));return lT(f(tN,"keyup",r))},nR=function(e){return f(Nn,"tabIndex",Ni(e))},aR=f(Da,lT,nR),iR={$:"LivePolite"},oR=mN(iR),uR=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([tR(r)?ZN:yN(6),lT(rN(i(!a))),oR,rR(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),aR(0),Jk,zN,fT(Lk)]),e);return l(QN,o,r,d(ZI,gT,Rk,M([lT(f(qN,"role","checkbox")),lT(f(qN,"aria-checked",a?"true":"false")),eR(r),JN,oT(Lk),fT(sT)]),hT(M([n(a)]))))}),sR=Br,cR=function(e){return e*sR/180},fR=KT(26),lR=function(e){return{$:"MoveY",a:e}},dR=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),hR=function(e){return f(dR,fR,lR(-e))},pR=KT(24),gR=r(function(e,t){return{$:"Rotate",a:e,b:t}}),vR=function(e){return f(dR,pR,f(gR,x(0,0,1),e))},yR=KT(28),mR=function(e){return f(oA,yR,l(iA,"bc-"+uA(e),"border-color",e))},bR=KT(19),CR=function(e){return gd(M([e.inset?"box-inset":"box-",uw(e.offset.a)+"px",uw(e.offset.b)+"px",uw(e.blur)+"px",uw(e.size)+"px",uA(e.color)]))},ER=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(oA,bR,l(LI,CR(t),"box-shadow",cw(t)))},SR=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),TR=function(e){return f(oA,YI,h(SR,"b-"+Ni(e),e,e,e,e))},wR=r(function(e,t){return f(oA,YI,h(SR,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),IR=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?TR(r):f(wR,n,r):f(oA,YI,h(SR,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},AR=KT(12),BR=f(Wk,AR,bT.textCenter),kR=l(nA,1,1,1),NR=function(e){return f($k,M([eA("focusable"),fT(Dk(14)),oT(Dk(14)),sA(kR),JN,sN(9),BR,Xk(3),mR(e?l(nA,59/255,.6,252/255):l(nA,211/255,211/255,211/255)),ER({blur:1,color:e?d(_N,238/255,238/255,238/255,0):l(nA,238/255,238/255,238/255),offset:L(0,0),size:1}),Ok(e?l(nA,59/255,.6,252/255):kR),TR(e?0:1)]),e?f($k,M([mR(kR),oT(Dk(6)),fT(Dk(9)),vR(cR(-45)),hN,JN,hR(1),IR({bottom:2,left:2,right:0,top:0})]),xk):xk)},RR=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),$R={$:"OnRight"},_R=RR($R),LR=r(function(e,t){return f(uR,yr,{checked:t.checked,icon:NR,label:f(_R,yr,il(t.label)),onChange:f(jN,e,t.label)})}),xR={$:"Top"},PR=YN(xR),DR=f(Wk,aN,bT.textMedium),UR=function(e){return f(BN,M([yN(15),PR]),M([f($k,M([sN(28),DR]),il(e.label)),f(BN,M([yN(5)]),f(xa,LR(e.label),e.options))]))},OR=function(e){return f(RN,M([yN(20)]),f(xa,UR,e))},MR=function(e){return{$:"FiltersMsg",a:e}},FR=KT(20),VR=f(Wk,FR,bT.clip),KR=_k,HR=function(e){return f(oA,qk,h(Gk,"p-"+Ni(e),e,e,e,e))},jR=r(function(e,t){return f($k,M([fT(KR(e)),oT(Dk(60)),VR,Ok(jk)]),f($k,M([HR(12),JN,fT(Lk)]),t))}),qR=function(e){switch(e.$){case"Phase":return 1;case"Expires":return 2;case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},GR=function(e){return{$:"JustImage",a:e}},zR=GR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),YR=tT("alt"),WR=function(e){return f(tT,"src",rt(e))},JR=r(function(e,t){var r=t.src,n=t.description,a=f(hl,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(ZI,gT,Rk,f(ka,eA(bT.imageContainer),e),hT(M([d(ZI,gT,dT("img"),U(M([lT(WR(r)),lT(YR(n))]),a),hT(yr))])))}),QR=r(function(e,t){if("None"===t.$)return xk;var r=t.a;return f(JR,e,r)}),XR=GR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),ZR=function(e){return{$:"ChangeSort",a:e}},e$=function(e){return f($k,M([DR,sN(17)]),il(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},t$=r(function(e,t){return f(RN,M([yN(5),Jk,nN(ZR(e))]),M([e$(e),function(){if("Just"===t.$){var e=t.a;return f($k,M([JN]),f(QR,M([fT(Dk(8))]),function(){return"Ascending"===e.$?XR:zR}()))}return xk}()]))}),r$=r(function(e,t){return f(jR,qR(t),f(t$,t,e))}),n$=r(function(e,t){return f(RN,M([fT(Lk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(r$,r,t)},t))}),a$=l(Bk,150,150,150),i$=r(function(e,t){return f(hl,function(t){return f(vh,function(e){return f(gh,function(e){return e.checked&&e.testTrade(t)},e.options)},e)},t)}),o$=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},u$=r(function(e,t){return f(Ju,e.amount,t.amount)}),s$=r(function(e,t){return f(Ju,Ml(e),Ml(t))}),c$=n(function(e,t,r){return f(e,r,t)}),f$=function(e){var t=e.a;return(R(e.b,No)?c$:Ua)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(f$,L(dv,No),e,t):l(c$,Uu,o$(e.state.phase),o$(t.state.phase))});case"Expires":return r(function(e,t){return f(uv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(s$,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(u$,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(Nc,ma,l(Kd,r(function(e,t){return f(Uu,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(uv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(uv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},l$=l(Bk,233,237,242),d$=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),h$=function(e){return f($k,M([fT(Lk),oT(Lk),VR]),f(CN,M([sN(12)]),M([il(e.info)])))},p$=function(e){return f(Nc,xk,f(wo,h$,Gl(e)))},g$=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"}},v$=function(e){return{$:"TimeLeft",a:e}},y$=function(e){return{$:"TimeUp",a:e}},m$=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 Dl(0)}}),b$=r(function(e,t){return Dl(Md(e)-Md(t))}),C$=r(function(e,t){var r=f(m$,t.state.phase,t),n=f(b$,e,t.state.phaseStartTime),a=f(b$,r,n);return Md(a)>0?v$(L(a,r)):y$(r)}),E$=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},S$=l(nA,0,0,0),T$=l(Bk,51,183,2),w$=function(e){var t=Mu(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Go(n));return n+(function(){if(a){return f(Qo,a+1,f(Yo,1,uw(r)))}return""}()+"%")},I$=r(function(e,t){return GR({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"}()})}),A$=n(function(e,t,r){return f(QR,f(ka,oT(Dk(34)),e),f(I$,t,r))}),B$=r(function(e,t){var r=w$(t);if("0%"===r)return f($k,M([sN(16)]),il("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?T$:fN;return f(RN,M([yN(4)]),M([l(A$,yr,a,si(i)),f($k,M([sA(o),sN(16)]),il(n))]))}),k$=GR,N$=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(Nl,r,n,t)}),ap,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,k$({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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","₫")]))),R$=function(e){return f(Nc,"",f(wo,Qa,f(ip,e,N$)))},$$=function(e){return Go(e)<=3?e:$$(f(md,3,e))+","+f(tu,3,e)},_$=function(e){return $$(yd(e))},L$=function(e){return U(R$(e.fiatType),_$(e.amount))},x$=function(e){var t=function(){var t=f(ip,e.fiatType,N$);if("Nothing"===t.$)return xk;var r=t.a,n=(r.a,r.b);return f(QR,M([oT(Dk(26))]),n)}();return f(RN,M([yN(4)]),M([t,f($k,M([sA(d(_N,0,0,0,.5)),DR,fT(Dk(50))]),il(e.fiatType)),il(L$(e))]))},P$=function(e){return Md(e)<0},D$=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),U$=function(e){var t=lg(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(D$,zb(t),zb(r),zb(n),zb(a))}(f(Nc,L(Fu(0),Fu(0)),f(ms,n,Fu(60))))}(f(Nc,L(Fu(0),Fu(0)),f(ms,r,Fu(3600))))}(f(Nc,L(Fu(0),Fu(0)),f(ms,t,Fu(86400))))},O$=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!P$(a)){var u=r(function(e,t){return U(l(Is,2,P("0"),Ni(e)),t)}),s=Md(a)>0?i:o,c=U$(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(RN,U(M([yN(5)]),e),M([f($k,U(M([sA(h)]),t),il(f(u,c.days,"d"))),f($k,U(M([sA(d)]),t),il(f(u,c.hours,"h"))),f($k,U(M([sA(s)]),t),il(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Dl(0);e=p,t=g,n=v,a=y}}),M$={$:"Behind"},F$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),V$=function(e){return f(F$,M$,e)},K$=r(function(e,t){var r=nv(200*e),n=200-r,a=f($k,M([fT(KR(n))]),xk),i=M([oT(Dk(3)),Xk(20)]),o=f($k,U(i,M([fT(KR(r)),Ok(t)])),xk),u=f($k,U(i,M([fT(Lk),Ok(l$)])),xk);return f(RN,M([fT(Lk),V$(u)]),M([o,a]))}),H$=l(nA,1,1,0),j$=r(function(e,t){return Md(e)/Md(t)}),q$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(j$,o,u),c=(f($k,M([hN]),d(O$,yr,yr,L(a,i),o)),s<.1?fN:s<.2?H$:T$);return f(BN,U(M([yN(5)]),e),M([d(O$,M([hN]),t,L(a,i),o),f(K$,1-s,c)]))}),G$=function(e){var t=bd(Ml(e)),r=f(zl,".",t);if(!r.b)return t;if(r.b.b){al("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Qo,3,t);case 1:return f(Qo,4,f(Nc,t,f(wo,uw,f(wo,function(e){return e/100},f(wo,Ka,f(wo,nv,f(wo,ti(100),Sd(t))))))));default:var n=r.a;return f(Nc,f(Qo,n,t),f(wo,Ni,f(wo,nv,Sd(t))))}},z$=n(function(e,t,r){return f(jR,qR(t),function(){switch(t.$){case"Phase":return il(E$(r.state.phase));case"Expires":if("Open"===r.state.phase.$){var n=f(C$,e,r);if("TimeLeft"===n.$){var a=n.a,i=f(j$,a.a,a.b)<.05?fN:S$;return d(q$,M([fT(Lk)]),M([sN(16)]),L(i,l$),a)}var o=n.a;return d(q$,M([fT(Lk)]),M([sN(16)]),L(fN,l$),L(Dl(0),o))}return xk;case"Offer":return f(RN,M([yN(5)]),M([il(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(G$(r.parameters.tradeAmount)+" ")+g$(r.factory))]));case"FiatPrice":return x$(r.terms.price);case"Margin":var u=R(r.parameters.initiatorRole,co);return f(Nc,xk,f(wo,B$(u),r.derived.margin));case"PaymentWindow":var s=function(){return"Seller"===r.parameters.initiatorRole.$?fN:T$}(),c=_(Md(r.parameters.autoabortInterval),216e5)<0?s:S$;return d(O$,yr,yr,L(c,l$),r.parameters.autoabortInterval);default:var s=function(){return"Seller"===r.parameters.initiatorRole.$?T$:fN}(),c=_(Md(r.parameters.autoabortInterval),216e5)<0?s:S$;return d(O$,yr,yr,L(c,l$),r.parameters.autoreleaseInterval)}}())}),Y$=n(function(e,t,r){return f(BN,M([fT(Lk),yN(1),Ok(l$),Jk,nN(f(d$,r.factory,r.id))]),M([f(RN,M([fT(Lk),yN(1)]),f(xa,function(t){return l(z$,e,t,r)},t)),f(jR,1,p$(r.terms.paymentMethods))]))}),W$=Er,J$=a(function(e,t,r,n){return f(BN,M([fT(Lk),TR(2),Xk(8),mR(a$),yN(2),Ok(a$),VR]),f(xa,f(Y$,e,r),f(W$,f$(t.orderBy),f(i$,t.filtersModel,n))))}),Q$=a(function(e,t,r,n){return f(BN,M([fT(Lk),oT(Lk),HR(30),yN(5)]),M([f(Yi,MR,OR(t.filtersModel)),f(n$,t.orderBy,r),d(J$,e,t,r,n)]))}),X$=n(function(e,t,r){return R(t,yr)?xk:f(Yi,Oo,d(Q$,e,r.tradeTable,M([Ro,KN,FN,VN,HN,MN]),t))}),Z$=function(e){return f(hl,function(e){return ab(e.parameters)},BS(e))},e_={$:"NoneFound"},t_={$:"AllFetched"},r_={$:"FetchingTrades"},n_={$:"QueryingNumTrades"},a_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return n_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?r_:t_}return e_},i_=n(function(e,t,r){var n=zv(f(xa,function(e){return f(ON,UN(r),Z$(e))},t)),a=n,i=function(e){return f($k,M([sN(24),iN,sA(a$),hN,HR(20)]),il(e))},o=f(vh,Ja(e_),f(xa,a_,t))?M([i("No trades found.")]):f(xa,i,xC(f(xa,function(e){switch(a_(e).$){case"QueryingNumTrades":return si(tB(e.factory)+"Querying Factory...");case"NoneFound":return ci;case"FetchingTrades":return si(tB(e.factory)+"Fetching Trades");default:return ci}},t)));return f(BN,M([yN(10),fT(Lk)]),M([function(){return o.b?f(BN,M([yN(5)]),o):xk}(),l(X$,e,a,r)]))}),o_=n(function(e,t,r){return f(BN,M([Xk(5),Ok(jk),fT(Lk),oT(Lk),f(zk,0,20)]),M([DN(r),l(i_,e,t,r)]))}),u_=function(e){return{$:"ShowCurrencyDropdown",a:e}},s_={$:"AbortCreate"},c_=function(e){return{$:"AppCmd",a:e}},f_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),l_=function(e){return f(xa,function(e){return M([f($k,M([sA(fN)]),il("Caution! ")),il(e)])},xC(M([R(f(uv,e.autoreleaseInterval,Dl(12e5)),ba)?si(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."}()):ci,R(f(uv,e.autoabortInterval,Dl(36e5)),ba)?si(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.'}()):ci])))},d_=l(nA,0,0,1),h_=function(e){return f($k,M([PN({bottom:5,left:5,right:5,top:0}),nN(e),Xk(30),Ok(d(_N,1,1,1,.4)),TR(1),mR(d(_N,0,0,0,.3)),Jk,sN(14)]),f($k,M([sA(d(_N,0,0,0,.7))]),il("x")))},p_=Bn,g_=p_,v_=lT,y_=r(function(e,t){return f($k,M([V$(f($k,M([Ok(e),v_(f(g_,"position","fixed")),v_(f(g_,"z-index","1000")),v_(f(g_,"top","0")),v_(f(g_,"left","0")),v_(f(g_,"width","100%")),v_(f(g_,"height","100%"))]),xk)),fT(Lk),oT(Lk)]),t)}),m_={$:"InFront"},b_=function(e){return f(F$,m_,e)},C_=r(function(e,t){return{$:"Max",a:e,b:t}}),E_=r(function(e,t){return f(C_,e,t)}),S_=n(function(e,t,r){return l(Pa,y_,d(_N,0,0,.3,.6),f($k,U(M([hN,JN,fT(f(E_,500,sT)),Ok(jk),Xk(8),b_(f($k,M([wN,PR]),h_(r)))]),e),t))}),T_=r(function(e,t){if("Nothing"===t.$)return xk;var r=t.a;return f($k,U(M([Xk(5),mR(l(nA,.9,0,0)),TR(1),Ok(l(nA,1,.4,.4)),HR(5),hN,JN,fT(f(E_,200,sT)),sN(14)]),e),f(CN,yr,M([il(r)])))}),w_={$:"Above"},I_=function(e){return f(F$,w_,e)},A_=r(function(e,t){return f($k,M([Xk(4),f(zk,25,17),sN(18),iN,Ok(l$),I_(f(T_,M([hR(5)]),t))]),il(e))}),B_=a(function(e,t,r,n){return d(rA,e/255,t/255,r/255,n)}),k_=d(B_,1,31,52,.64),N_=KT(32),R_={$:"Active"},$_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),__=$n,L_=r(function(e,t){switch(t.$){case"NoAttribute":return ZN;case"Describe":var r=t.a;return mN(r);case"AlignX":var n=t.a;return lN(n);case"AlignY":var a=t.a;return YN(a);case"Width":var n=t.a;return cT(n);case"Height":var n=t.a;return iT(n);case"Class":var n=t.a,a=t.b;return f(Wk,n,a);case"StyleClass":var i=t.a,o=t.b;return f(oA,i,o);case"Nearby":var u=t.a,s=t.b;return f(F$,u,f(zi,e,s));case"Attr":var c=t.a;return lT(f(__,e,c));default:var l=t.a,d=t.b;return f(dR,l,d)}}),x_=function(e){return f(L_,Kg,e)},P_=r(function(e,t){var r=t.a,n=t.b,a=x_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(qI,n,o));default:return L(r,n)}}),D_=function(e){var t=l(Ra,P_,L(yr,QI),e),r=t.a,n=t.b;return f(ka,xI(n),r)},U_=function(e){return f(oA,N_,f($_,R_,D_(e)))},O_=KT(33),M_={$:"Hover"},F_=function(e){return f(oA,O_,f($_,M_,D_(e)))},V_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f($k,M([Xk(4),Jk,nN(n),f(zk,25,17),sA(t),sN(18),iN,Ok(a),U_(M([Ok(o)])),F_(M([Ok(i)]))]),il(r))}),K_=r(function(e,t){return d(V_,x(d(_N,1,0,0,1),d(_N,1,0,0,.8),d(_N,1,0,0,.6)),jk,e,t)}),H_=function(e){return y_(d(_N,0,0,.3,.6))(f(BN,M([yN(10),hN,JN,Ok(d(_N,0,0,0,.5)),Xk(8),HR(20)]),f(xa,function(e){return f(CN,M([hN,JN,sN(20),iN,sA(jk),BR]),M([e]))},e)))},j_=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+yA(t)}e.a;return"https://kovan.etherscan.io/tx/"+yA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+yA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+yA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+yA(t)}}),q_={$:"Bottom"},G_=YN(q_),z_=eA(bT.underline),Y_=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(il(G$(Sb(a))),f(K_,"Yes, I definitely want to open this trade.",l(f_,r,n,a)))}return L(il("??"),f(A_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(S_,yr,f(BN,M([yN(20),HR(20),hN,oT(Lk),BR]),M([f($k,M([sN(26),iN,hN,JN]),il("Just to Confirm...")),f(BN,M([yN(20),hN,JN]),f(xa,CN(M([hN,sN(18),DR,sA(k_)])),U(l_(n),U(M([M([il("You will deposit "),i,il(" "+g$(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([il("This ususally requires two Metamask signatures. Your "+g$(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f($k,M([G_,hN]),o)])),s_);case"ApproveNeedsSig":var u=e.a;return f($k,M([nN(c_(d(Yd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),H_(M([il("Waiting for user signature for the approve call."),il("(check Metamask!)"),il("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f($k,M([nN(c_(d(Yd,"txChainModal clicked","misclick","ApproveMining",0)))]),H_(M([il("Mining the initial approve transaction..."),f(tA,M([z_,sA(d_)]),{label:il("See the transaction on Etherscan"),url:f(j_,eo(u),s)}),il("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f($k,M([nN(c_(d(Yd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),H_(M([il("Waiting for user signature for the create call."),il("(check Metamask!)")])));default:var r=e.a,s=e.b;return f($k,M([nN(c_(d(Yd,"txChainModal clicked","misclick","CreateMining",0)))]),H_(M([il("Mining the final create call..."),f(tA,M([z_,sA(d_)]),{label:il("See the transaction on Etherscan"),url:f(j_,r,s)}),il("You will be redirected when it's mined.")])))}}),W_=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return xk;var r=t.a;return f(Y_,r,e)},J_=function(e){return{$:"TradeAmountChanged",a:e}},Q_=tT("id"),X_=v_(Q_("inputError")),Z_=l(Bk,109,127,138),eL=GR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),tL=function(e){return f(QR,f(ka,oT(Dk(26)),e),eL)},rL=function(e){return f(RN,M([yN(4)]),M([tL(yr),f($k,M([sN(24),DR,sA(Z_)]),il(g$(e)))]))},nL=function(e){return{$:"HiddenLabel",a:e}},aL=nL,iL=tT("type"),oL=function(e){return L(e,!0)},uL=function(e){return{$:"MayStopPropagation",a:e}},sL=r(function(e,t){return f(eN,e,uL(t))}),cL=r(function(e,t){return l(La,Lh,t,e)}),fL=f(cL,M(["target","value"]),cu),lL=function(e){return f(sL,"input",f(Oi,oL,f(Oi,e,fL)))},dL=KT(0),hL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),pL=function(e){var t=function(e){return 1-e}(f(mc,1,f(ei,0,e)));return f(oA,dL,f(hL,"transparency-"+tw(t),t))},gL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),vL=f(Da,lT,qN("autocomplete")),yL=l(nA,136/255,138/255,133/255),mL=l(nA,186/255,189/255,182/255),bL=f(zk,12,12),CL=M([bL,Xk(3),mR(mL),Ok(kR),TR(1),yN(3),fT(Lk)]),EL=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},SL=function(e){return f(gh,EL,e)?ZN:eA("focusable")},TL=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},wL=ye,IL=r(function(e,t){return f(kn,e,wL(t))}),AL=IL("spellcheck"),BL=f(Da,lT,AL),kL=W,NL=KT(47),RL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(kL(e))),o=(i-1)*t+f(Nc,0,f(wo,a,r))+f(Nc,0,f(wo,a,n));return f(oA,NL,l(LI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),$L=tT("value"),_L=f(Da,lT,$L),LL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(ZT,"width",n)?L(r,n):L(f(ka,e,r),f(dS,"width",n));case"Height":e.a;return f(ZT,"height",n)?L(r,n):L(f(ka,e,r),f(dS,"height",n));case"Describe":e.a;return f(ZT,"described",n)?L(r,n):L(f(ka,e,r),f(dS,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(ZT,"align-x",n)?L(r,n):L(f(ka,e,r),f(dS,"align-x",n));case"AlignY":return f(ZT,"align-y",n)?L(r,n):L(f(ka,e,r),f(dS,"align-y",n));default:return f(ZT,"transform",n)?L(r,n):L(f(ka,e,r),f(dS,"transform",n))}}),L(yr,Qy),e).a},xL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,LL(e))}),PL=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}},DL=f(Da,Gi,hs),UL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([lT(lL(n.onChange))]),o=U(CL,t),u=f(xL,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(hl,TL,o),c=f(xL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(xL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(xL,o,function(e){return"Nearby"===e.$})),p=f(hl,f(Da,Xu,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([_L(n.text),lT(iL(a)),BL(e.spellchecked),eA(bT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return ZN;var r=t.a;return vL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(PL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(gL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(gL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(Nc,5,c);return x("textarea",U(M([BL(e.spellchecked),eA(bT.inputMultiline),f(Nc,ZN,f(wo,vL,e.autofill)),function(){if("Nothing"===u.$)return ZN;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return PN({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?ZN:s.a?d(RL,n.text,v,u,g):ZN}()]),h),M([DL(bI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(ZI,gT,Rk,f(ka,fT(Lk),zv(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([b_(f($k,f(ka,bL,U(s,U(M([sA(yL),eA(bT.noTextSelection+" "+bT.passPointerEvents),mR(d(_N,0,0,0,0)),Ok(d(_N,0,0,0,0)),oT(Lk),fT(Lk),pL(""===n.text?1:0)]),r))),a))])}()]))),hT(M([d(ZI,gT,dT(v),zv(M([M([SL(t),eR(n.label)]),y,i])),hT(m))])));return l(QN,f(ka,f(Wk,Yk,bT.cursorText),f(ka,tR(n.label)?ZN:yN(5),f(ka,oR,u))),n.label,b)}),OL=UL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),ML=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(OL,M([fT(Lk),oT(Dk(40)),TR(0)]),{label:aL(r),onChange:i,placeholder:n,text:a});return f(RN,U(M([yN(5)]),e),xC(M([f(wo,$k(M([zN])),o),si(s),f(wo,$k(M([wN])),u)])))}),FL={$:"Below"},VL=function(e){return f(F$,FL,e)},KL=function(e){return f(dR,fR,lR(e))},HL=n(function(e,t,r){return p(ML,M([fT(Dk(150)),DR,sN(24),VL(f(T_,M([X_,KL(5)]),r))]),L(ci,si(f($k,M([nN(c_(d(Yd,"click","misclick","dai symbol in dai input",0)))]),rL(e)))),"dai input",ci,t,J_)}),jL=$k(M([mR(l$),IR({bottom:2,left:0,right:0,top:0})])),qL=r(function(e,t){return f(BN,M([yN(10)]),M([f($k,M([sN(17),iN]),il(e)),t]))}),GL=r(function(e,t){return jL(f(qL,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(HL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),zL=function(e){return f(Nc,_E,xg(e))},YL=function(e){var t=function(){var t=ld(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+G$(f(Vl,r,100))+" "+g$(zL(e.wallet))+"."}return"There is a 1% fee."}();return f(RN,M([hN,f(zk,20,10),Ok(l(Bk,10,33,108)),Xk(8),yN(5),nN(c_(d(Yd,"click","misclick","fee notify element",0)))]),M([f($k,M([sN(18),sA(l(Bk,0,226,255)),iN]),il(t)),f($k,M([sN(17),sA(jk),DR]),il("We only collect this fee when trades resolve successfully."))]))},WL=function(e){return{$:"FiatAmountChanged",a:e}},JL=function(e){return{$:"FiatTypeChanged",a:e}},QL=r(function(e,t){return l(sS,n(function(t,r,n){return f(e,t,r)?l(Nl,t,r,n):n}),ap,t)}),XL=function(e){return f(QL,r(function(t,r){return f(Gg,e,t)}),N$)},ZL=GR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),ex=function(e){return f(QR,M([oT(Dk(26))]),f(Nc,ZL,f(wo,iu,f(ip,e,N$))))},tx=function(e){return v_(f(sL,"click",Fi(L(e,!0))))},rx=DL,nx=function(e){return{$:"AppendProperty",a:e}},ax=r(function(e,t){return nx(e+":"+t)}),ix=r(function(e,t){return f(ax,e,t.value)}),ox=ix("cursor"),ux={$:"Compatible"},sx={cursor:ux,value:"default"},cx=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),fx=function(e){return{$:"PseudoClassSelector",a:e}},lx=function(e){return cx(fx(e))}("hover"),dx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),hx=dx,px=hx,gx=px("span"),vx=r(function(e,t){return f(kn,et(e),rt(t))}),yx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),mx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),bx=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),Cx=r(function(e,t){return t<>>32-e}),Ex=function(e){var t=e.hash?e.seed^f(bx,461845907,f(Cx,15,f(bx,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(bx,2246822507,r^r>>>16),a=f(bx,3266489909,n^n>>>13);return(a^a>>>16)>>>0},Sx=r(function(e,t){return f(bx,5,f(Cx,13,e^f(bx,461845907,f(Cx,15,f(bx,3432918353,t)))))+3864292196}),Tx=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},$P=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+"]"}},_P=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,$P,r)));case"UniversalSelectorSequence":var r=e.a;return Cu(r)?"*":f(Ri,"",f(xa,$P,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,$P,r)))}},LP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([RP(t),_P(r)]))},xP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,_P(t),f(xa,LP,r)),i=f(Ri,"",M([f(Nc,"",f(wo,NP,n))]));return f(tc,f(Ri," ",f(hl,f(Da,Xu,Bd),a)),i)},PP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,xP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,kP(a),"\n",e,"}"]))}),DP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(PP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,SP,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,AP,PP(" ")),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(Ri,"\n\n",f(hl,f(Da,Xu,Bd),M([bP(t),f(Ri,"\n",f(xa,wP,r)),f(Ri,"\n",f(xa,IP,n)),f(Ri,"\n\n",f(xa,DP,a))])))},OP=function(e){return UP(mP(gP(e)))},MP=function(e){return f(Ri,"\n\n",f(xa,OP,e))},FP=function(e){return{$:"Snippet",a:e}},VP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),KP=function(e){return{$:"StyleBlockDeclaration",a:e}},HP=r(function(e,t){var r=l(Kx,t,yr,ci);return FP(M([KP(l(VP,r,yr,e))]))}),jP=function(e){return Cu(e)?"unstyled":f(Cs,P("_"),Rs(f(wx,15739,MP(gS(Ix(gS(f(HP,e,eP(yr)))))))))},qP=function(e){var t=jP(e),r=f(vx,"className",sl(t));return l(yx,r,e,t)},GP=a(function(e,t,r,n){return f(e,f(ka,qP(t),r),n)}),zP=function(e){return{$:"Unstyled",a:e}},YP=function(e){return zP(dw(e))},WP=YP,JP=r(function(e,t){return f(Tn,e,Xe(t))}),QP=function(e){return En(Xe(e))},XP=r(function(e,t){var r=e.b,n=e.c;return Cu(r)?t:l(Nl,n,r,t)}),ZP=function(e){return e.a},eD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,XP,i,s),p=l(Ra,tD,L(yr,h),c),g=p.a,v=p.b,o=l(MT,u,f(xa,ZP,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,XP,i,s),m=l(Ra,tD,L(yr,h),c),g=m.a,v=m.b,o=d(QP,y,u,f(xa,ZP,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,XP,i,s),b=l(Ra,eD,L(yr,h),c),g=b.a,v=b.b,o=l(OT,u,f(xa,ZP,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,XP,i,s),C=l(Ra,eD,L(yr,h),c),g=C.a,v=C.b,o=d(JP,y,u,f(xa,ZP,s),$a(g));return L(f(ka,L(r,o),a),v)}}),tD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,XP,n,o),c=l(Ra,tD,L(yr,s),u),h=c.a,p=c.b,a=l(MT,i,f(xa,ZP,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,XP,n,o),v=l(Ra,tD,L(yr,s),u),h=v.a,p=v.b,a=d(QP,g,i,f(xa,ZP,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,XP,n,o),y=l(Ra,eD,L(yr,s),u),h=y.a,p=y.b,a=l(OT,i,f(xa,ZP,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,XP,n,o),m=l(Ra,eD,L(yr,s),u),h=m.a,p=m.b,a=d(JP,g,i,f(xa,ZP,o),$a(h));return L(f(ka,a,r),p)}}),rD=r(function(e,t){return h(wl,Tl,e,t,Il,Il)}),nD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(Bd(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),aD=function(e){var t=f(nD,ci,e);if("Nothing"===t.$)return ap;var r=t.a,n=r.a,a=r.b;return f(rD,n,a)},iD=function(e){return{$:"ClassSelector",a:e}},oD=function(e){var t=e.a,r=e.b;return f(HP,r,eP(M([iD(t)])))},uD=function(e){return MP(gS(Ix(f(xa,oD,Ia(e)))))},sD=function(e){return l(MT,"style",yr,gS(dw(uD(e))))},cD=n(function(e,t,r){var n=f(xa,ZP,t),a=aD(t),i=l(Ra,tD,L(yr,a),r),o=i.a,u=i.b,s=sD(u);return l(MT,e,n,f(ka,s,$a(o)))}),fD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),lD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(fD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),dD=r(function(e,t){return L(f(lD,"_",t),sD(e))}),hD=n(function(e,t,r){var n=f(xa,ZP,t),a=aD(t),i=l(Ra,eD,L(yr,a),r),o=i.a,u=i.b,s=f(dD,u,o);return l(OT,e,n,f(ka,s,$a(o)))}),pD=a(function(e,t,r,n){var a=f(xa,ZP,r),i=aD(r),o=l(Ra,eD,L(yr,i),n),u=o.a,s=o.b,c=f(dD,s,u);return d(JP,e,t,a,f(ka,c,$a(u)))}),gD=a(function(e,t,r,n){var a=f(xa,ZP,r),i=aD(r),o=l(Ra,tD,L(yr,i),n),u=o.a,s=o.b,c=sD(s);return d(QP,e,t,a,f(ka,c,$a(u)))}),vD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(cD,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(gD,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(hD,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(pD,a,t,r,n)}},yD=vD,mD=function(e){return rx(yD(d(GP,gx,M([lx(M([ox(sx)]))]),yr,M([WP(e)]))))},bD=J,CD=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),ED=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),SD=function(e){return l(La,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 si(h(CD,n,a,i,o,u))}return ci}(),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 si(l(ED,a,t,i))}return ci}())}),L(ci,ci),e)},TD=r(function(e,t){var r=SD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(ZI,NN,Rk,f(ka,eA(bT.contentLeft+" "+bT.contentCenterY+" "+bT.wrapped),f(ka,fT(sT),f(ka,oT(sT),e))),hT(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?si(PN({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(ZI,NN,Rk,f(ka,eA(bT.contentLeft+" "+bT.contentCenterY+" "+bT.wrapped),f(ka,fT(sT),f(ka,oT(sT),U(e,M([h]))))),hT(t))}var p=-s/2,g=-u/2;return d(ZI,gT,Rk,e,hT(M([d(ZI,NN,Rk,f(ka,eA(bT.contentLeft+" "+bT.contentCenterY+" "+bT.wrapped),f(ka,lT(f(g_,"margin",uw(p)+"px "+uw(g)+"px")),f(ka,lT(f(g_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,lT(f(g_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(oA,pN,l(gN,o,u,s)),yr))))),hT(t))])))}),wD=i(function(e,t,r,n,a){var i=f(OL,M([fT(Dk(80)),oT(Dk(40)),sN(24),DR,mR(l$),tx(r)]),{label:aL("currency type"),onChange:f(Ko,bD,n),placeholder:ci,text:t}),o=f(ip,t,N$),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return xk;r.b;return f(TD,M([fT(Dk(350)),mR(S$),TR(1),Ok(jk),HR(10),hN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(RN,M([fT(Dk(80)),yN(9),f(zk,0,5),tx(n(t)),F_(M([Ok(l(nA,.8,.8,1))]))]),M([f(QR,M([oT(Dk(26))]),a),f($k,M([sN(16),iN]),mD(t))]))},Ia(XL(t))))}return xk}();return f(RN,M([yN(4),VL(u)]),M([f($k,M([nN(a)]),ex(t)),i]))}),ID=i(function(e,t,r,n,a){var i=c_(d(Yd,"click","misclick","currency flag",0)),o=f($k,M([nN(c_(d(Yd,"click","misclick","currency symbol",0)))]),il(R$(e))),u=f($k,M([VL(f(T_,M([X_,KL(5)]),a))]),h(wD,r,e,u_(!0),JL,i));return p(ML,M([fT(Dk(250)),DR,sN(24),VL(f(T_,M([X_,KL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,WL)}),AD=function(e){return jL(f(qL,"For fiat",h(ID,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},BD=function(e){return{$:"ChangeRole",a:e}},kD=d(B_,1,31,52,.13),ND=r(function(e,t){var r=M([sN(24),DR,Jk]),n=function(){return"Buyer"===t.$?L(r,U(r,M([sA(kD)]))):L(U(r,M([sA(kD)])),r)}(),a=n.a,i=n.b;return f(RN,M([yN(20)]),M([f($k,U(M([nN(BD(fo))]),i),il("Sell "+e)),f($k,U(M([nN(BD(co))]),a),il("Buy "+e))]))}),RD=r(function(e,t){return f(qL,"Trade Type",f(ND,g$(e),t.inputs.userRole))}),$D=ER({blur:20,color:d(B_,0,0,0,.04),offset:L(0,3),size:0}),_D=f(Wk,pN,bT.spaceEvenly),LD=function(e){var t=zL(e.wallet);return f(BN,M([fT(Lk),yN(20),Ok(jk),Xk(5),HR(20),$D]),M([f(RN,M([fT(Lk),_D]),M([f(RD,t,e),f(GL,t,e),AD(e)])),YL(e)]))},xD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),PD={$:"Web3Connect"},DD=function(e){return f($k,M([hN]),function(){var t=L(Vd(e),xg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(K_,"Open Trade",f(xD,n,r))}t.b;return f(A_,"Unsupported Network",ci)}t.a;return f(K_,"Connect to Wallet",PD)}())},UD=function(e){return{$:"AutoabortIntervalChanged",a:e}},OD=function(e){return{$:"ChangePaymentMethodText",a:e}},MD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),FD=MD,VD=function(e){return f(FD,M([sA(d(_N,0,0,0,.2))]),function(){return il("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")}())},KD={$:"TextArea"},HD=r(function(e,t){return l(UL,{autofill:ci,spellchecked:t.spellcheck,type_:KD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),jD=n(function(e,t,r){var n=f($k,M([sN(22),iN]),il("Payment Method")),a=f(HD,M([fT(Lk),oT(Dk(150)),Ok(d(B_,155,203,255,.2)),TR(0)]),{label:aL("payment method"),onChange:OD,placeholder:""===r?si(VD(t)):ci,spellcheck:!0,text:r});return f(BN,M([yN(20),PN({bottom:15,left:45,right:45,top:0}),fT(Lk),I_(f(T_,M([X_,KL(30),HR(10),sN(20),fT(Dk(400))]),e))]),M([n,a]))}),qD=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."},GD=a(function(e,t,r,n){var a=l(Is,e,P("0"),Ni(n));return f($k,M([sN(22),sA(t)]),il(U(a,r)))}),zD=function(e){return Md(e)<0?Dl(0):e},YD=n(function(e,t,n){var a=r(function(e,r){return f(BN,M([yN(4)]),M([f($k,M([HR(4),Jk,nN(n(f(ub,t,e)))]),f(QR,M([oT(Dk(10))]),XR)),r,f($k,M([HR(4),Jk,nN(n(function(e){return Md(e)?e:Dl(3e5)}(zD(f(b$,t,e)))))]),f(QR,M([oT(Dk(10))]),zR))]))}),i=U$(t);return f(RN,M([_D,yN(10)]),M([f(a,Dl(864e5),d(GD,3,e," days",i.days)),f(a,Dl(36e5),d(GD,2,e," hours",i.hours)),f(a,Dl(3e5),d(GD,2,e," min",i.min))]))}),WD=o(function(e,t,r,n,a,i){var o=f($k,M([Ok(d(B_,155,203,255,.2)),Xk(5),HR(15),I_(f(T_,M([X_]),a))]),l(YD,S$,n,i)),u=f(RN,M([yN(30)]),M([f(QR,M([oT(Dk(40)),nN(c_(d(Yd,"click","misclick","symbol for "+t,0)))]),e),f($k,M([sN(22),iN]),il(t))])),s=f(CN,M([sN(17),DR,sA(k_)]),M([il(r)]));return f(BN,M([fT(Lk),Xk(10),Ok(l(Bk,237,237,237)),yN(2)]),f(xa,$k(M([Ok(jk),f(zk,45,18),fT(Lk)])),M([u,f(RN,M([fT(Lk),yN(25),Ok(jk)]),M([o,s]))])))}),JD=GR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),QD=f(Wk,FR,bT.clipX),XD=f(Wk,FR,bT.clipY),ZD=i(function(e,t,r,n,a){return f(BN,M([yN(15),Xk(8),QD,XD,Ok(jk)]),M([p(WD,JD,"Payment Window",qD(a),r,n,UD),l(jD,t,a,e)]))}),eU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},tU=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."},rU=GR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),nU=n(function(e,t,r){return f($k,M([Xk(8),QD,XD,Ok(jk)]),p(WD,rU,"Burn/Release Window",tU(r),e,t,eU))}),aU=function(e){return{$:"AutorecallIntervalChanged",a:e}},iU=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."},oU=GR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),uU=n(function(e,t,r){return f($k,M([Xk(8),Ok(jk),QD,XD]),p(WD,oU,"Open Window",iU(r),e,t,aU))}),sU=function(e){return f(BN,M([fT(Lk),yN(20)]),M([l(uU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(ZD,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(nU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},cU=function(e){return f(BN,M([fT(f(E_,1e3,Lk)),hN,yN(20),PN({bottom:30,left:40,right:40,top:0}),nN(u_(!1)),b_(W_(e))]),M([LD(e),sU(e),DD(e.wallet)]))},fU=Es(Nm(8226)),lU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),dU=r(function(e,t){return l(Ra,ka,t,e)}),hU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(dU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),pU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(dU,f(oc,e%r,t),l(hU,yr,e/r|0,t))):f(oc,e,t)}),gU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(ZT,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(dS,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),vU=function(e){return d(gU,Ua,Qy,e,yr)},yU=r(function(e,t){return f($k,M([fT(Lk),b_(f(RN,M([yN(3),fT(KR(100)),fT(t),VR]),f(lU,f($k,M([sA(d(_N,0,0,0,.1)),sN(14)]),il(fU)),f(xa,f(Da,$k(M([sA(d(_N,0,0,0,.2))])),il),f(pU,100,(e?$a:Ua)(vU(f(xa,f(Ko,iu,Qa),Ia(N$)))))))))]),il(" "))}),mU=r(function(e,t){var r=t.url,n=t.label;return d(ZI,gT,dT("a"),f(ka,lT(rT(r)),f(ka,lT(nT("noopener noreferrer")),f(ka,fT(sT),f(ka,oT(sT),f(ka,eA(bT.contentCenterX+" "+bT.contentCenterY),e))))),hT(M([n])))}),bU=eA(bT.italic),CU=function(){var e=f(Da,$k(M([sA(l(nA,.8,.2,.2))])),il),t=f(Da,$k(M([EN])),il);return f(BN,M([fT(Lk),oT(Lk),Ok(jk),Xk(6),yN(50),ER({blur:20,color:d(B_,0,0,0,.1),offset:L(0,3),size:0}),Xk(10),HR(20)]),M([f(yU,!1,Lk),f(BN,M([hN,fT(f(E_,700,Lk)),yN(20)]),M([f(CN,M([sN(70),EN,hN,BR]),M([il("DAI"),e("Hard")])),f(RN,M([sN(30),iN,hN,BR,bU]),M([il("The "),e("Global"),il(", "),e("Unkillable"),il(" Crypto Gateway")]))])),f(RN,M([Ok(a$),yN(2),hN,PR,fT(Lk)]),M([f($k,M([f(zk,40,10),Ok(jk),fT(Lk),oT(Lk)]),f(BN,M([yN(60),wN]),M([f($k,M([sN(40),iN,hN]),il("Want to learn more?")),f(mU,M([Xk(4),Jk,f(zk,25,17),Ok(d_),sA(jk),EN,sN(24),hN]),{label:f(CN,M([BR]),M([il("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"})]))),f($k,M([f(zk,40,10),Ok(jk),fT(Lk),oT(Lk)]),f(BN,M([zN,yN(60)]),M([f($k,M([sN(40),iN,hN]),il("Ready to try it out?")),f(BN,M([yN(10),fT(Dk(400)),hN]),M([f(CN,M([sN(24),fT(Lk)]),M([il("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f(CN,M([sN(24),fT(Lk)]),M([il("Then follow the links at the top of this page to browse "),t("Sell Offers"),il(", browse "),t("Buy Offers"),il(", or "),t("Create Your Own Offer"),il(".")]))]))])))])),f($k,M([G_,fT(Lk)]),f(yU,!0,Lk))]))}(),EU=function(e){return{$:"ShowCurrencyDropdown",a:e}},SU=r(function(e,t){return hl(t(e))}),TU=n(function(e,t,r){return R(t,yr)?xk:f(Yi,bv,d(Q$,e,r.tradeTable,M([dv,KN,FN,VN,HN,MN]),t))}),wU=n(function(e,t,r){var n=l(SU,e,r.filterFunc,zv(f(xa,Z$,t))),a=function(e){return f($k,M([sN(24),iN,sA(a$),hN,HR(20)]),il(e))},i=f(vh,Ja(e_),f(xa,a_,t))?M([a("No trades found.")]):f(xa,a,xC(f(xa,function(e){switch(a_(e).$){case"QueryingNumTrades":return si(tB(e.factory)+"Querying Factory...");case"NoneFound":return ci;case"FetchingTrades":return si(tB(e.factory)+"Fetching Trades");default:return ci}},t)));return f(BN,M([yN(10)]),M([function(){return i.b?f(BN,M([yN(5)]),i):xk}(),l(TU,e,n,r)]))}),IU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(oA,Qk,l(LI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},AU=function(e){return f(tN,"focus",Fi(e))},BU=f(Da,lT,AU),kU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([BU(e(!0)),tx(e(!0))])}();return f(RN,U(e,M([oT(Dk(40)),ER({blur:20,color:d(B_,233,237,242,.05),offset:L(0,3),size:0})])),M([f($k,M([Ok(l$),oT(Dk(40)),IU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f($k,M([JN,f(zk,10,0)]),r)),f(OL,U(s,U(t,M([fT(Dk(100)),oT(Dk(40)),mR(l$),IU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),IR({bottom:1,left:0,right:1,top:1})]))),{label:aL(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(BN,M([fT(Lk),yN(8)]),M([f($k,M([sN(17),DR]),il(e)),t]))}),_U=KT(25),LU=function(e){return{$:"MoveX",a:e}},xU=function(e){return f(dR,_U,LU(-e))},PU={$:"OnLeft"},DU=function(e){return f(F$,PU,e)},UU=n(function(e,t,r){var n=tL(M([JN])),a=f(RN,M([yN(8),JN,fT(Dk(60))]),M([n,f($k,M([sN(16),JN]),il("max"))])),i=f(RN,M([yN(8),JN,fT(Dk(60))]),M([n,f($k,M([sN(16),JN]),il("min"))]));return f($U,"Dai Range",f(BN,M([yN(5),fT(Dk(200))]),M([v(kU,M([DU(f(T_,M([xU(5),fT(Dk(200))]),r.minDai))]),M([BU(EU(!1))]),i,"min Dai",e,ci,ci,RU),v(kU,M([DU(f(T_,M([xU(5),fT(Dk(200))]),r.maxDai))]),M([BU(EU(!1))]),a,"max Dai",t,ci,ci,NU)])))}),OU=function(e){var t=f(ip,e,N$);if("Nothing"===t.$)return il("*");var r=t.a,n=r.b;return f(QR,M([oT(Dk(26))]),n)},MU=function(e){return{$:"AppCmd",a:e}},FU=function(e){return{$:"FiatTypeInputChanged",a:e}},VU=n(function(e,t,r){var n=MU(d(Yd,"click","misclick","currency flag",0)),a=OU(t);f(RN,M([yN(8),JN,fT(Dk(60))]),M([a,f($k,M([sN(16),JN]),il("max"))])),f(RN,M([yN(8),JN,fT(Dk(60))]),M([a,f($k,M([sN(16),JN]),il("min"))]));return f($k,M([PR,fT(Dk(120))]),f($U,"Fiat Type",h(wD,e,t,EU(!0),FU,n)))}),KU={$:"AddSearchTerm"},HU=function(e){return{$:"PaymentMethodInputChanged",a:e}},jU=f(Lh,"keyCode",DC),qU=function(e){return f(tN,"keyup",f(uu,function(t){return 13===t?Fi(e):su(Ni(t))},jU))},GU=function(e){return f($U,"Search Payment Methods",f(OL,M([PR,fT(Dk(250)),oT(Dk(40)),mR(l$),ER({blur:20,color:d(B_,233,237,242,.05),offset:L(0,3),size:0}),v_(qU(KU))]),{label:aL("payment methods search"),onChange:HU,placeholder:ci,text:e}))},zU=function(e){return{$:"RemoveTerm",a:e}},YU=function(e){return f($k,M([HR(3),PR,Jk,nN(zU(e)),sN(10),sA(fN)]),il("x"))},WU=function(e){if(e.b){var t=e;return f(RN,M([fT(Lk),HR(10),yN(10)]),f(xa,function(e){return f(RN,M([Ok(d(B_,16,7,234,.2)),Xk(5),HR(4),yN(3)]),M([il(e),YU(e)]))},t))}return xk},JU=n(function(e,t,r){return f(BN,M([yN(10),fT(sT),hN]),M([f(RN,M([fT(sT),yN(10)]),M([f($k,M([fT(sT),PR]),l(UU,e.minDai,e.maxDai,t)),f($k,M([fT(sT),PR]),l(VU,r,e.fiatType,t)),f(BN,M([fT(sT),PR,yN(5)]),M([GU(e.paymentMethod),WU(e.paymentMethodTerms)]))]))]))}),QU=n(function(e,t,r){return f(BN,M([Xk(5),Ok(jk),fT(Lk),oT(Lk),nN(EU(!1))]),M([f(RN,M([fT(Lk),yN(10),HR(30)]),M([l(JU,r.inputs,r.errors,r.showCurrencyDropdown)])),l(wU,e,t,r)]))}),XU=function(e){return{$:"MessageInputChanged",a:e}},ZU={$:"MessageSubmit"},eO=IL("disabled"),tO=function(e){return{$:"MayPreventDefault",a:e}},rO=r(function(e,t){return f(eN,e,tO(t))}),nO=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):su("Not the enter key")},n=f(uu,r,f(Lh,"key",cu));return lT(f(rO,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),aO=function(e){return f(nO,"Enter",e)},iO={$:"Button"},oO=r(function(e,t){var r=t.onPress,n=t.label;return d(ZI,gT,Rk,f(ka,fT(sT),f(ka,oT(sT),f(ka,eA(bT.contentCenterX+" "+bT.contentCenterY+" "+bT.seButton+" "+bT.noTextSelection),f(ka,Jk,f(ka,SL(e),f(ka,mN(iO),f(ka,lT(nR(0)),function(){if("Nothing"===r.$)return f(ka,lT(eO(!0)),e);var t=r.a;return f(ka,nN(t),f(ka,aO(t),e))}()))))))),hT(M([n])))}),uO=function(e){return f(BN,M([fT(Lk),yN(10)]),M([f(HD,M([fT(Lk),oT(Dk(100))]),{label:aL("messageInput"),onChange:XU,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(oO,M([hN,sN(24)]),{label:il("Submit"),onPress:si(ZU)})]))},sO=f(Wk,FR,bT.scrollbarsY),cO=r(function(e,t){return f($k,M([oT(Lk),fT(Lk)]),f($k,U(M([v_(f(g_,"position","absolute")),v_(f(g_,"top","0")),v_(f(g_,"right","0")),v_(f(g_,"bottom","0")),v_(f(g_,"left","0")),sO]),e),t))}),fO=l(Bk,200,205,210),lO=n(function(e,t,r){var n=M([wN,Ok(d_),sA(jk),IU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([zN,Ok(fO),sA(S$),IU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f($k,U(M([HR(7)]),u),f(CN,yr,M([il(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(nA,0,0,1),jk,"Initiator opened the trade"));case"Recalled":return si(x(l(nA,0,0,1),jk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Qo,8,ul(t))+"..";return si(x(l(nA,1,0,1),jk,r+" committed to the trade"));case"Aborted":return si(x(l(nA,1,0,0),jk,"Buyer aborted the trade"));case"Claimed":return si(x(l(nA,0,1,0),jk,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(nA,0,0,1),jk,"Seller released the "+g$(e)+" and closed the contract"));default:return si(x(l(nA,0,0,1),jk,"Seller burned the "+g$(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($k,M([Xk(3),TR(1),mR(l(nA,1,0,1)),hN,Ok(h)]),f(CN,M([sA(p)]),M([il(g)])))}),dO=n(function(e,t,r){if(r.b){var n=r;return f(cO,M([fT(Lk),oT(Lk),Xk(5),TR(1),mR(S$),HR(10)]),f(BN,M([fT(Lk),oT(Lk),yN(10)]),f(xa,f(lO,e,t),n)))}return f($k,M([fT(Lk),oT(Lk),Xk(5),TR(1),mR(S$),hN,sA(l(nA,.5,.5,.5)),bU]),il("no messages found."))}),hO=Cr,pO=function(e){return f(BN,M([fT(Lk),oT(Lk),yN(10),TR(1),Xk(5),HR(20)]),M([l(dO,e.trade.factory,e.userRole,f(hO,function(e){return e.blocknum},Sa(e.history))),uO(e)]))},gO=function(e){return f($k,M([Ok(jk),Xk(8),$D,fT(Lk),oT(Lk)]),pO(e))},vO={$:"ToggleChat"},yO=function(e){if(e.showChatHistory){var t=f(Nc,xk,f(wo,gO,e.chatHistoryModel));return f($k,M([oT(Lk),fT(Dk(500)),HR(20),wN]),l(S_,M([oT(Lk),fT(Lk)]),f(Yi,oE,t),vO))}return xk},mO=function(e){return"Buyer"===e.initiatorRole.$?fo:co},bO=function(e){return L$(e)+" "+e.fiatType},CO={$:"AbortAction"},EO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),SO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return xk}if("LoadedTrade"!==t.b.$)return xk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=bO(n.terms.price),u=G$(Sb(i)),s=G$(n.parameters.tradeAmount)+" "+g$(n.factory),c=function(){return"Buyer"===mO(n.parameters).$?L(f($k,M([DR,sA(S$)]),il("buyer")),M([il("pay the seller "),f($k,M([sA(d_)]),il(o)),il(" in exchange for the "),f($k,M([sA(d_)]),il(s)),il(" held in this contract.")])):L(f($k,M([DR,sA(S$)]),il("seller")),M([il("accept "),f($k,M([sA(d_)]),il(o)),il(" from the buyer in exchange for the "),f($k,M([sA(d_)]),il(s)),il(" held in this contract.")]))}(),d=c.a,h=c.b;return l(S_,yr,f(BN,M([yN(20),HR(20),hN,oT(Lk),BR]),M([f($k,M([sN(26),iN,hN,JN]),il("Just to Confirm...")),f(BN,M([yN(20),hN,JN]),f(xa,CN(M([hN,sN(18),DR,sA(k_)])),U(M([U(M([il("You will deposit "),f($k,M([sA(d_)]),il(u+" "+g$(n.factory))),il(", thereby becoming the "),d,il(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([il("(This ususally requires two Metamask signatures. Your "+g$(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f($k,M([G_,hN]),f(K_,"Yes, I definitely want to commit to this trade.",l(EO,n,a,i)))])),CO);case"ApproveNeedsSig":return H_(M([il("Waiting for user signature for the approve call."),il("(check Metamask!)"),il("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return H_(M([il("Mining the initial approve transaction..."),f(tA,M([z_,sA(d_)]),{label:il("See the transaction on Etherscan"),url:f(j_,n.factory,p)}),il("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return H_(M([il("Waiting for user signature for the final commit call."),il("(check Metamask!)"),il("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return H_(M([il("Mining the final commit transaction..."),f(tA,M([z_,sA(d_)]),{label:il("See the transaction"),url:f(j_,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(S_,yr,f(BN,M([yN(20),HR(20),hN,oT(Lk),BR]),M([f($k,M([sN(26),iN,hN,JN]),il("Just to Confirm...")),f(BN,M([yN(20),hN,JN]),f(xa,CN(M([hN,sN(18),DR,sA(k_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([il('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 '+g$(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([il("Aborting will incur a small penalty on both parties, and refund the rest of the "+g$(n.factory)+".")])]);case"Release":return M([M([il("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([il("This will destroy the "+g$(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f($k,M([G_,hN]),function(e){return f(K_,e,IE(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 "+g$(n.factory)+".";default:return"I understand. Burn the "+g$(n.factory)+"."}}()))])),CO);case"ActionNeedsSig":var g=r.a;return H_(M([il("Waiting for user signature for the "+BE(g)+" call."),il("(check Metamask!)")]));default:var g=r.a,p=r.b;return xk}},TO=RN(M([fT(Lk),Ok(jk),Xk(5),HR(20),_D,$D])),wO=function(e){return f(RN,M([yN(8)]),M([f(QR,yr,eL),f($k,M([sN(24),DR]),il(G$(e)))]))},IO=r(function(e,t){var r=f(So,To(e),f(wo,function(e){return e.address},Vd(t)));return f(qL,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"}(),wO(e.parameters.tradeAmount))}),AO=function(e){return f(RN,M([yN(5)]),M([ex(e.fiatType),f($k,M([sN(24),DR]),il(bO(e)))]))},BO=function(e){return f(qL,"For Fiat",AO(e.terms.price))},kO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},NO=l(Bk,250,165,22),RO=l(Bk,255,0,0),$O=l(Bk,0,255,0),_O=GR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),LO=GR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),xO=GR({description:"released",src:"/DAIHard/static/img/released.svg"}),PO={$:"ToggleStatsModal"},DO=function(e){return f(hO,Ua,e)},UO=n(function(e,t,n){var a=zv(f(xa,function(e){return f(hl,function(e){return R(f(Io,e,n),si(t))},f(AS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(ih,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(ih,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:jl,amountReleased:jl,numAborts:0,numBurns:0,numReleases:0},a),u=f(wo,Dl,Gl(DO(f(AS,function(e){return function(e){return e?si(e):ci}(Md(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}}),OO=r(function(e,t){return d(V_,x(d(_N,0,0,1,1),d(_N,0,0,1,.8),d(_N,0,0,1,.6)),jk,e,t)}),MO=function(e){return{$:"ViewUserHistory",a:e}},FO=f(MB,0,yr),VO=f(Wk,aN,bT.textNormalWeight),KO=r(function(e,t){return Za(e/t)}),HO=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}}),jO=r(function(e,t){var r=e.a,n=e.b;return l(HO,r,f(KO,Md(t),6e4),n)}),qO=r(function(e,t){return f(Bs,24,f(KO,f(jO,e,t),60))}),GO=r(function(e,t){return f(Bs,1e3,Md(t))}),zO=r(function(e,t){return f(Bs,60,f(jO,e,t))}),YO={$:"Apr"},WO={$:"Aug"},JO={$:"Dec"},QO={$:"Feb"},XO={$:"Jan"},ZO={$:"Jul"},eM={$:"Jun"},tM={$:"Mar"},rM={$:"May"},nM={$:"Nov"},aM={$:"Oct"},iM={$:"Sep"},oM=function(e){var t=f(KO,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)}},uM=r(function(e,t){switch(oM(f(jO,e,t)).month){case 1:return XO;case 2:return QO;case 3:return tM;case 4:return YO;case 5:return rM;case 6:return eM;case 7:return ZO;case 8:return WO;case 9:return iM;case 10:return aM;case 11:return nM;default:return JO}}),sM=r(function(e,t){return f(Bs,60,f(KO,Md(t),1e3))}),cM={$:"Fri"},fM={$:"Mon"},lM={$:"Sat"},dM={$:"Sun"},hM={$:"Thu"},pM={$:"Tue"},gM={$:"Wed"},vM=r(function(e,t){switch(f(Bs,7,f(KO,f(jO,e,t),1440))){case 0:return hM;case 1:return cM;case 2:return lM;case 3:return dM;case 4:return fM;case 5:return pM;default:return gM}}),yM=n(function(e,t,r){return e.toAmPm(f(qO,t,r))}),mM=r(function(e,t){return oM(f(jO,e,t)).day}),bM=mM,CM=M([dM,fM,pM,gM,hM,cM,lM]),EM=r(function(e,t){return function(e){return e.a}(f(Nc,L(0,dM),Gl(f(hl,function(r){return R(r.b,f(vM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),CM)))))}),SM=function(e){return l(Ra,Na,0,e)},TM=r(function(e,t){return oM(f(jO,e,t)).year}),wM=function(e){return!f(Bs,4,e)&&(!!f(Bs,100,e)||!f(Bs,400,e))},IM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return wM(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}}),AM=M([XO,QO,tM,YO,rM,eM,ZO,WO,iM,aM,nM,JO]),BM=r(function(e,t){return f(Nc,L(0,XO),Gl(f(hl,function(r){r.a;return R(r.b,f(uM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),AM))))}),kM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(BM,e,t))}),NM=r(function(e,t){var r=f(oc,f(kM,e,t)-1,AM);return SM(f(xa,IM(f(TM,e,t)),r))+f(bM,e,t)}),RM=r(function(e,t){return f(kM,e,t)/4|0}),$M=r(function(e,t){var r=Ni(t),n=e-Go(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),_M=function(e){return e?e<=12?e:e-12:12},LM=nv(315576e5),xM=r(function(e,t){return Dl(LM*f(TM,e,t))}),PM=r(function(e,t){var r=f(xM,e,t),n=f(EM,e,r);return 1+((f(NM,e,t)+n)/7|0)}),DM=r(function(e,t){return Ni(f(TM,e,t))}),UM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(kM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(kM,t,r));case"MonthFixed":return f($M,2,f(kM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(uM,t,r));case"MonthNameFull":return e.toMonthName(f(uM,t,r));case"QuarterNumber":return Ni(1+f(RM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(RM,t,r));case"DayOfMonthNumber":return Ni(f(bM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(bM,t,r));case"DayOfMonthFixed":return f($M,2,f(bM,t,r));case"DayOfYearNumber":return Ni(f(NM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(NM,t,r));case"DayOfYearFixed":return f($M,3,f(NM,t,r));case"DayOfWeekNumber":return Ni(f(EM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(EM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(vM,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(vM,t,r));case"WeekOfYearNumber":return Ni(f(PM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(PM,t,r));case"WeekOfYearFixed":return f($M,2,f(PM,t,r));case"YearNumberLastTwo":return f(tu,2,f(DM,t,r));case"YearNumber":return f(DM,t,r);case"AmPmUppercase":return bD(l(yM,e,t,r));case"AmPmLowercase":return nd(l(yM,e,t,r));case"HourMilitaryNumber":return Ni(f(qO,t,r));case"HourMilitaryFixed":return f($M,2,f(qO,t,r));case"HourNumber":return Ni(_M(f(qO,t,r)));case"HourFixed":return f($M,2,_M(f(qO,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(qO,t,r));case"HourMilitaryFromOneFixed":return f($M,2,1+f(qO,t,r));case"MinuteNumber":return Ni(f(zO,t,r));case"MinuteFixed":return f($M,2,f(zO,t,r));case"SecondNumber":return Ni(f(sM,t,r));case"SecondFixed":return f($M,2,f(sM,t,r));case"MillisecondNumber":return Ni(f(GO,t,r));case"MillisecondFixed":return f($M,3,f(GO,t,r));default:return n.a}}),OM=a(function(e,t,r,n){return f(Ri,"",f(xa,l(UM,e,r,n),t))}),MM=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),FM=function(e){return e>11?"pm":"am"},VM=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"}},KM=function(e){switch(f(Bs,100,e)){case 11:case 12:case 13:return"th";default:switch(f(Bs,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},HM=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"}},jM=p(MM,VM,f(Ko,VM,Qo(3)),HM,f(Ko,HM,Qo(3)),FM,KM),qM=OM(jM),GM={$:"MonthNameFull"},zM=GM,YM=function(e){return{$:"Text",a:e}},WM=YM,JM={$:"YearNumber"},QM=JM,XM=n(function(e,t,n){var a=r(function(e,t){return f(BN,M([sN(18),yN(6)]),M([f($k,M([EN]),il(e)),f($k,M([VO]),il(t))]))}),i=qM(M([zM,WM(", "),QM])),o=f(BN,M([yN(23),fT(Lk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,FO,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+G$(n.amountReleased)+" "+g$(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+G$(n.amountBurned)+" "+g$(e)+" Burned")])),M([f($k,M([hN]),f(OO,"View User History",MO(n.asRole)))])));return f(BN,M([Xk(8),QD,XD,Ok(l$),yN(1),ER({blur:20,color:d(_N,0,0,0,.08),offset:L(0,0),size:0})]),M([f($k,M([fT(Lk),Ok(jk),HR(17)]),f(LN,18,t)),f($k,M([fT(Lk),Ok(jk),HR(17)]),o)]))}),ZM=n(function(e,t,r){var n=l(UO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=kO(e.parameters.initiatorRole)+" Stats";return f($k,r?M([VL(f($k,M([KL(30),wN]),l(XM,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(qL,a,f(RN,M([fT(Lk),yN(20),Jk,nN(PO)]),f(xa,RN(M([yN(5)])),M([M([f(QR,M([oT(Dk(28))]),xO),f($k,M([sN(24),DR,sA($O)]),il(l(Is,2,P("0"),Ni(n.numReleases))))]),M([f(QR,M([oT(Dk(28))]),_O),f($k,M([sN(24),DR,sA(NO)]),il(l(Is,2,P("0"),Ni(n.numAborts))))]),M([f(QR,M([oT(Dk(28))]),LO),f($k,M([sN(24),DR,sA(RO)]),il(l(Is,2,P("0"),Ni(n.numBurns))))])])))))}),eF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+ul(t)}e.a;return"https://kovan.etherscan.io/address/"+ul(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+ul(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+ul(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+ul(t)}}),tF=n(function(e,t,r){return f(tA,e,{label:il(ul(r)),url:f(eF,t,r)})}),rF=function(e){return f(qL,"Trade Status",f(BN,M([sN(24),DR,yN(8)]),M([il(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,M([sN(12),sA(d_),z_]),e.factory,e.creationInfo.address)])))},nF=i(function(e,t,r,n,a){return TO(M([rF(t),f(IO,t,r),BO(t),l(ZM,t,n,a)]))}),aF=l(Bk,9,32,107),iF=GR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),oF=f($k,M([Xk(4),Jk,nN(vO),HR(5),Ok(l(Bk,22,0,255))]),f(QR,M([fT(Dk(42))]),iF)),uF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},sF=function(e){return f(BN,M([Xk(12),Ok(l$),HR(15),yN(15)]),M([f($k,M([sN(24),iN,bU]),il("Fiat Payment Method")),f(CN,M([sN(18),oT(sT),Ok(jk),ER({blur:5,color:d(_N,0,0,0,.2),offset:L(-3,3),size:0}),Xk(3),HR(5)]),M([f(Nc,f($k,M([sA(kD),bU]),il("No payment methods found.")),f(wo,il,f(wo,function(e){return e.info},Gl(e))))]))]))},cF={$:"Active"},fF=function(e){return{$:"ExpandPhase",a:e}},lF=M([Ok(aF),sA(jk)]),dF=r(function(e,t){return{$:"Min",a:e,b:t}}),hF=r(function(e,t){return f(dF,e,t)}),pF=function(e){return M(e?[Xk(12),PR,oT(f(hF,380,sT))]:[Xk(12),hN])},gF=M([Ok(jk)]),vF=GR({description:"flame",src:"/DAIHard/static/img/flame.png"}),yF=r(function(e,t){return Ol(f(us,Ml(e),Ml(t)))}),mF=r(function(e,t){return d(V_,x(d(_N,1,.6,.2,1),d(_N,1,.6,.2,.8),d(_N,1,.6,.2,.6)),jk,e,t)}),bF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),CF=function(e){return{$:"ContractActionClicked",a:e}},EF={$:"Web3Connect"},SF=n(function(e,t,r){var n=Vd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(C$,e,t).$?xk:f(RN,M([yN(8)]),function(){var e=x(t.state.phase,f(To,t,a.address),f(Io,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,IE,f(OO,"Remove and Refund this Trade",TE))])}break e}var r=(e.a,e.b,Ml(rb(t.parameters)));return M([f(K_,"Deposit and Commit to Trade",l(bF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,CF,f(mF,"Abort Trade",sE)),f(Yi,CF,f(K_,"Confirm Payment",gE)),oF])}e.a,e.c.a;return M([oF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,CF,f(K_,"Burn it All!",pE)),f(Yi,CF,f(OO,"Release Everything",wE)),oF])}e.a,e.c.a;return M([oF])}break e;default:break e}return yr}())}return f(K_,"Connect to Wallet",EF)}),TF={$:"Finished"},wF={$:"NotStarted"},IF=r(function(e,t){var r=L(o$(t),o$(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?wF:R(n,a)?cF:TF}),AF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),BF=r(function(e,t){return l(AF,yr,e,t)}),kF=a(function(e,t,r,n){var a=G$(f(ih,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+g$(r.factory),i=G$(r.parameters.tradeAmount)+" "+g$(r.factory),o=f(RN,yr,f(BF,3,f(QR,M([oT(Dk(18))]),vF))),u=f(Da,$k(M([sA(l(nA,1,0,0))])),il),s=R(e,r.state.phase),c=f(So,Io(r),f(wo,function(e){return e.address},Vd(n))),d=s?jk:S$,h=CN(M([sA(d),sN(18),iN])),p=bO(r.terms.price),g=s?l(Bk,0,226,255):l(Bk,16,7,234),v=f(Da,$k(M([sA(g)])),il),y=G$(r.parameters.buyerDeposit)+" "+g$(r.factory),m=r.parameters.abortPunishment,b=G$(m)+" "+g$(r.factory),C=G$(f(yF,r.parameters.buyerDeposit,m))+" "+g$(r.factory),E=G$(f(yF,r.parameters.tradeAmount,m))+" "+g$(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([il("Your "),u("burnable deposit"),il(" of "),v(y),il(" is now held in this contract, and your offer to buy "),v(i),il(" for "),v(p),il(" is now listed in the marketplace.")]),M([il("If another user likes your offer, they can become the Seller by depositing the full "),v(i),il(" into this contract.")]),M([il("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),il(" to you.")])])):f(xa,h,M([M([il("Your offer to sell the "),v(i),il(" held in this contract for "),v(p),il(" is now listed in the marketplace.")]),M([il("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),il(" of 1/3 of the trade amount "),v("("+y+")"),il(" into this contract.")]),M([il("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),il(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([il("You must now pay the Seller "),v(p),il(" via the Fiat Payment Method, "),f($k,M([iN]),il("and then click ")),u("Confirm Payment"),il(" before the payment window runs out. Use the chat to coordinate.")]),M([il("If you abort the trade, or do not confirm payment before this time is up, "),v(b),il(" (1/4 of the "),u("burnable deposit"),il(") will be "),u("burned"),il(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),il(" to the Seller, "),v(C),il(" to you).")]),M([il("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),il(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([il("Work and communicate with the Buyer to receive "),v(p),il(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([il("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),il(" (1/4 of the "),u("burnable deposit"),il(") will be "),u("burned"),il(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),il(" to you, "),v(C),il(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([il("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),il(" will be released to you.")]),M([il("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),il(" In this case the "),v(a),il(" will be lost to both parties.")]),M([il("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([il("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([il("So, have you recieved the "),v(p),il("? If so, you can click "),v("Release Everything"),il(".")]),M([il("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),il(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([il("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([il("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([il("The Seller has deposited "),v(i),il(" into this contract, and offers to sell it for "),v(p),il(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),il(" into this contract by clicking "),u("Deposit and Commit to Trade"),il(".")]),M([il("If the trade is successful, the combined "+g$(r.factory)+" balance "),v("("+a+")"),il(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,il(" for both parties (see Payment Window for more on this).")]),M([il("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),il(" within the payment window.")])])):f(xa,h,M([M([il("The Buyer is offering to buy "),v(i),il(" for "),v(p),il(", and has deposited "),v(y),il(" into this contract as a "),u("burnable deposit"),il(". To become the Seller, deposit "),v(i),il(" into this contract by clicking "),u("Deposit and Commit to Trade"),il(".")]),M([il("When you receive the "),v(p),il(" from the Buyer, the combined "+g$(r.factory)+" balance "),v("("+a+")"),il(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,il(" for both parties (see Payment Window for more on this).")]),M([il("Don't commit unless you can receive "),v(p),il(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([il("During this phase, the Buyer is expected to transfer "),v(p),il(" to the Seller, as described in Fiat Payment Method, "),f($k,M([iN]),il("and ")),u("Confirm the Payment "),il(" before the payment window runs out. This would move the trade to the final phase.")]),M([il("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),il(" (1/4 of the "),u("burnable deposit"),il(" amount) will be "),u("burned"),il(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),il(" to the Seller, "),v(C),il(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([il("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([il("If the Seller can verify he has received the "),v(p),il(", he will probably release the total balance of "),v(i),il(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),il(".")]),M([il("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),il(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(BN,M([fT(Lk),oT(Lk),HR(20),yN(30)]),M([f(RN,M([fT(Lk)]),M([f($k,M([sN(24),iN,sA(g),zN]),il(T))])),f(BN,M([fT(Lk),JN,yN(13)]),w),f($k,M([wN]),function(){switch(f(IF,r,e).$){case"Active":return l(SF,t,r,n);case"NotStarted":return f($k,M([sN(20),iN,bU,sA(a$)]),il("Phase not yet started."));default:return f($k,M([sN(20),iN,bU]),il("Phase no longer active."))}}())]))}),NF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},RF=GR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),$F=GR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),_F={$:"None"},LF=_F,xF=GR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),PF=function(e){switch(e.$){case"Open":return xF;case"Committed":return RF;case"Judgment":return $F;default:return LF}},DF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),UF=a(function(e,t,r,n){return d(DF,e,t,r,n)}),OF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},MF=function(e){return function(e){return d(UF,e.red,e.green,e.blue,e.alpha)}(OF(e))},FF=function(e){return{$:"Circle",a:e}},VF=FF,KF=d(DF,0,0,0,1),HF={$:"Flat"},jF={$:"Sharp"},qF=function(e){return{$:"Uniform",a:e}},GF=qF,zF={cap:HF,dashPattern:yr,dashPhase:0,fill:GF(KF),join:jF,thickness:2},YF=n(function(e,t,r){return D(zF,{dashPattern:e,fill:r,thickness:t})}),WF=YF(yr),JF={$:"Transparent"},QF=JF,XF=f(WF,0,QF),ZF=r(function(e,t){return{$:"Shape",a:e,b:t}}),eV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},tV=function(e){return f(Da,eV,ZF(e))},rV=function(e){return tV(L(e,XF))},nV=function(e){return L(-e.a,-e.b)},aV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),iV=r(function(e,t){return f(aV,nV(e(t)),t)}),oV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},uV=r(function(e,t){return{$:"Path",a:e,b:t}}),sV=kr,cV=Nr,fV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=cV(n),i=sV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},lV=function(e){return xa(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)})},dV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(lV,e,M([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),hV=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},pV=function(e){var t=gV(e.basic),r=oV(f(xa,fV(e),t)),n=r.a,a=r.b;return{toBottom:-f(Nc,0,aI(a)),toLeft:-f(Nc,0,aI(n)),toRight:f(Nc,0,nI(n)),toTop:f(Nc,0,nI(a))}},gV=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(dV,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(dV,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(dV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(lV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(uV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(lV,R(C,HF)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(dV,0,E);case"Group":var S=e.a;return f(lV,0,zv(f(xa,f(Ko,pV,hV),S)));default:var T=e.b;return f(lV,0,hV(pV(T)))}},vV=function(e){var t=pV(e);return t.toTop+t.toBottom},yV=function(e){var t=pV(e);return L(-t.toLeft,t.toTop)},mV=function(e){var t=pV(e);return t.toLeft+t.toRight},bV=En("http://www.w3.org/2000/svg"),CV=bV("svg"),EV=Nn("height"),SV=Nn("version"),TV=Nn("width"),wV=bV("circle"),IV=bV("ellipse"),AV=bV("foreignObject"),BV=bV("g"),kV=bV("image"),NV=bV("polygon"),RV=bV("polyline"),$V=bV("rect"),_V=dw,LV=bV("text"),xV=Nn("id"),PV=Nn("points"),DV=Nn("r"),UV=Nn("rx"),OV=Nn("ry"),MV=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},FV=function(e){return{$:"Group",a:e}},VV=Nn("dominant-baseline"),KV=Nn("fill"),HV=Nn("fill-opacity"),jV=Nn("font-family"),qV=Nn("font-size"),GV=Nn("font-style"),zV=Nn("font-variant"),YV=Nn("font-weight"),WV=Nn("opacity"),JV=Nn("stroke"),QV=Nn("stroke-dasharray"),XV=Nn("stroke-dashoffset"),ZV=Nn("stroke-linecap"),eK=Nn("stroke-linejoin"),tK=Nn("stroke-opacity"),rK=Nn("stroke-width"),nK=Nn("text-anchor"),aK=Nn("text-decoration"),iK=Nn("transform"),oK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},uK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},sK=n(function(e,t,r){return d(DF,e,t,r,1)}),cK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return nv(1e4*e)/100};return gd(M(["rgba(",uw(i(t)),"%,",uw(i(r)),"%,",uw(i(n)),"%,",uw(function(e){return nv(1e3*e)/1e3}(a)),")"]))},fK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},lK=function(e){var t=fK(e),r=t.red,n=t.green,a=t.blue;return cK(l(sK,r,n,a))},dK=function(e){if("Uniform"===e.$){var t=e.a;return lK(t)}return"none"},hK=function(e){var t=fK(e),r=t.alpha;return uw(r)},pK=function(e){if("Uniform"===e.$){var t=e.a;return hK(t)}return"0"},gK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},vK=function(e){var t=uw(e.scale.b),r=uw(e.scale.a),n=uw(-e.rotation/2/sR*360),a=uw(-e.shift.b),i=uw(e.shift.a);return gd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},yK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([JV(dK(r.fill)),tK(pK(r.fill)),rK(uw(r.thickness)),ZV(oK(r.cap)),eK(gK(r.join)),KV("none"),WV(uw(e.opacity)),iK(vK(e)),XV(Ni(r.dashPhase)),QV(uK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([KV(dK(a)),HV(pK(a)),JV(dK(r.fill)),tK(pK(r.fill)),rK(uw(r.thickness)),ZV(oK(r.cap)),eK(gK(r.join)),WV(uw(e.opacity)),iK(vK(e)),XV(Ni(r.dashPhase)),QV(uK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([KV(dK(qF(o.color))),jV(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),qV(Ni(o.size)),YV(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"}}()),GV(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),zV(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),aK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),nK("middle"),VV("middle"),iK(vK(e))]);default:return M([iK(vK(e))])}},mK=Nn("x"),bK=Nn("y"),CK=r(function(e,t){return M([TV(uw(e)),EV(uw(t)),mK(uw(-e/2)),bK(uw(-t/2))])}),EK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([uw(t),uw(-r)]))},e))},SK=tN,TK=r(function(e,t){return f(e,t.a,t.b)}),wK=function(e){return f(xa,TK(SK),e)},IK=function(e){e:for(;;){var t=f(Nc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(RV,U(M([xV(t),PV(EK(i))]),U(yK(e),wK(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(NV,U(M([xV(t),PV(EK(i))]),U(yK(e),wK(e.handlers))),yr);case"Circle":var c=s.a;return f(wV,U(M([xV(t),DV(uw(c))]),U(yK(e),wK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(IV,U(M([xV(t),UV(uw(d)),OV(uw(h))]),U(yK(e),wK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f($V,U(M([xV(t),UV(uw(c)),OV(uw(c))]),U(f(CK,p,g),U(yK(e),wK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(uV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(LV,U(M([xV(t)]),U(yK(e),wK(e.handlers))),M([_V(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(kV,U(M([xV(t),MV(C)]),U(f(CK,p,g),U(yK(e),wK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(AV,U(M([xV(t)]),U(f(CK,p,g),U(yK(e),wK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(BV,f(ka,xV(t),U(yK(e),wK(e.handlers))),l(Ra,r(function(e,t){return f(ka,IK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:FV(M([w,I]))});e=v;continue e}}},AK=r(function(e,t){var r=e.a,n=e.b,a=uw(r),i=uw(n);return f(LT,yr,M([f(CV,M([TV(a),EV(i),SV("1.1")]),M([IK(t)]))]))}),BK=function(e){return f(AK,L(mV(e),vV(e)),f(iV,yV,e))},kK=r(function(e,t){var r=PF(e),n=function(){switch(t.$){case"NotStarted":return l(Bk,10,33,108);case"Active":return l(Bk,0,100,170);default:return l(Bk,1,129,104)}}(),a=rx(BK(f(rV,GF(MF(n)),VF(50))));return f($k,M([hN,b_(f(QR,M([hN,JN,oT(Dk(60))]),r))]),a)}),NK=function(e){var t=M([bU,iN,sN(20)]);switch(e.$){case"Active":return f($k,U(t,M([sA(fN)])),il("Active"));case"NotStarted":return f($k,U(t,M([sA(a$)])),il("Not Started"));default:return f($k,t,il("Finished"))}},RK=n(function(e,t,r){var n=f(IF,t,e),a=function(){return"Active"===n.$?l(Bk,0,226,255):S$}(),i=f($k,M([sA(a),sN(20),iN,hN]),il(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 xk;switch(n.$){case"NotStarted":return d(O$,M([hN]),M([sN(22),DR]),L(S$,l$),f(m$,e,t));case"Active":var a=f(C$,r,t);if("TimeLeft"===a.$){var i=a.a;return d(q$,M([hN]),M([sN(22),DR]),L(jk,l$),i)}return f(BN,M([hN,yN(10)]),M([f($k,M([hN]),il(NF(e))),f(OO,"Poke",IE(SE))]));default:return f($k,M([oT(Dk(1))]),xk)}}();return f(BN,M([HR(20),yN(10),oT(Lk)]),M([f($k,M([PR,hN]),i),f($k,M([oT(Lk),hN]),f($k,M([JN]),f(kK,e,n))),f(BN,M([yN(10),G_,hN]),M([f($k,M([hN]),NK(n)),o]))]))}),$K=o(function(e,t,r,n,a,i){var o=f(IF,r,t),u=f($k,M([HR(10),fT(Lk),oT(Lk)]),d(kF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Dl(0)}}(),c=l(RK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(b$,f(ub,r.state.phaseStartTime,s),i);default:Dl(0)}}(),f($k,M([oT(Lk),fT(Dk(1)),Ok(function(){return"Active"===o.$?l(nA,0,0,1):l$}())]),xk)),p=a?f(RN,U(pF(e),U(R(o,cF)?lF:gF,M([fT(Lk)]))),M([c,h,u])):f(RN,U(pF(e),U(R(o,cF)?lF:gF,M([Jk,nN(fF(t))]))),M([c]));return!e&&R(o,cF)?f(BN,M([fT(Lk),yN(20),PN({bottom:20,left:0,right:0,top:0})]),M([p,sF(r.terms.paymentMethods)])):p}),_K=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(RN,M([hN,Xk(12),HR(30),yN(10),Ok(aF),sN(24),iN,sA(jk)]),M([il("Trade "+uF(t.state.closedReason)),oF])):e?f(BN,M([fT(Lk),yN(10)]),M([f(RN,M([fT(Lk),oT(sT),yN(20)]),M([p($K,e,mo,t,n,R(r,mo),a),p($K,e,vo,t,n,R(r,vo),a),p($K,e,yo,t,n,R(r,yo),a)])),sF(t.terms.paymentMethods)])):f(BN,M([fT(Lk),oT(sT),yN(20)]),M([p($K,e,mo,t,n,R(r,mo),a),p($K,e,vo,t,n,R(r,vo),a),p($K,e,yo,t,n,R(r,yo),a)]))}),LK=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(BN,M([fT(Lk),oT(Lk),yN(40)]),M([h(nF,t,i,n.wallet,r,n.showStatsModal),f($k,M([fT(Lk),f(zk,40,0),yN(40)]),h(_K,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f($k,M([hN,JN,sN(30)]),il("Loading trade info..."));default:return f($k,M([hN,JN,sN(30)]),il("Invalid trade"))}}(),M([yO(n),SO(n)]))}),xK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),PK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(CU,yr);case"CreateModel":var n=r.a;return L(f(Yi,Ay,cU(n)),yr);case"TradeModel":var a=r.a;return l(xK,Yi(Ny),xa(Yi(Ny)),d(LK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,ZS,l(QU,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,WS,l(o_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f($k,M([fT(Lk),oT(Lk),Xk(10)]),n),a)}),DK=function(e){return{$:"DismissNotice",a:e}},UK=function(e){return f(dR,_U,LU(e))},OK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(nA,1,1,1):l(nA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Bk,100,200,255);case"Caution":return l(Bk,255,188,0);case"Error":return l(Bk,255,70,70);default:return l(Bk,200,200,200)}}(),o=f($k,M([wN,PR,hR(5),UK(5)]),h_(DK(t)));return f($k,M([Ok(i),Xk(10),HR(8),fT(Lk),TR(1),mR(d(_N,0,0,0,.15)),$D]),f(BN,M([yN(4),fT(Lk)]),f(Bi,r(function(e,t){return f(CN,M([fT(Lk),sA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},MK=function(e){return R(e,yr)?yr:M([f(BN,M([xU(20),hR(20),yN(10),wN,G_,fT(Dk(300)),sN(15)]),f(xa,OK,f(hl,function(e){return R(e.b.align,rl)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(BN,M([UK(20),KL(100),yN(10),zN,PR,fT(Dk(300)),sN(15)]),f(xa,OK,f(hl,function(e){return R(e.b.align,cB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},FK=r(function(e,t){var r=f(PK,e,t),n=r.a,a=r.b;return L(f(BN,M([V$(Mk),b_($N(t)),fT(Lk),oT(Lk),HR(30)]),M([f($k,M([oT(Dk(50))]),xk),n])),U(a,MK(t.userNotices)))}),VK=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),KK=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),HK={$:"AllowHover"},jK={$:"Layout"},qK={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(rA,155/255,203/255,1,1),offset:L(0,0),size:3})},GK=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?qK:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?HK:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?jK:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},zK=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(gT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),gT);case"Text":var a=t.a;return CI(a);default:return CI("")}}),YK=n(function(e,t,r){var n=GK(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?VK(n):KK(n)}();return f(zK,a,d(ZI,gT,Rk,t,hT(M([r]))))}),WK=KT(5),JK=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),QK={$:"SansSerif"},XK=function(e){return{$:"Typeface",a:e}},ZK=Y,eH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",ZK(nd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",ZK(nd(t)));default:var t=e.a.name;return f(Ri,"-",ZK(nd(t)))}}())}),tH=function(){var e=M([XK("Open Sans"),XK("Helvetica"),XK("Verdana"),QK]);return M([f(oA,Uk,l(iA,"bg-color-"+uA(d(rA,1,1,1,0)),"background-color",d(rA,1,1,1,0))),f(oA,aA,l(iA,"font-color-"+uA(d(rA,0,0,0,1)),"color",d(rA,0,0,0,1))),f(oA,oN,uN(20)),f(oA,WK,f(JK,l(Ra,eH,"font-",e),e))])}(),rH=n(function(e,t,r){var n=e.options;return l(YK,n,f(ka,eA(f(Ri," ",M([bT.root,bT.any,bT.single]))),U(tH,t)),r)}),nH=rH({options:yr}),aH=function(e){return f(oA,WK,f(JK,l(Ra,eH,"ff-",e),e))},iH=QK,oH=XK,uH=function(e){return{body:M([function(){var t=f(FK,e.screenWidth,e),r=t.a,n=t.b,a=U(M([fT(Lk),oT(Lk),aH(M([oH("Soleil"),iH]))]),f(xa,b_,n));return f(nH,a,r)}()]),title:"DAIHard"}},sH=Ht,cH=sH({init:BB,onUrlChange:Ak,onUrlRequest:Ik,subscriptions:wk,update:QA,view:uH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:cH(f(uu,function(e){return f(uu,function(t){return f(uu,function(r){return Fi({height:r,networkId:t,width:e})},f(Lh,"height",DC))},f(Lh,"networkId",DC))},f(Lh,"width",DC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file +var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(vp,o,function(e){return si(yp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(bp,e,L(r,Ip({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(bp,e,L(r,wp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=ev(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?Kg(o):Vg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return ev(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Hg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(qg,jg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(jo,xa(tc),f(jo,Ds,ec))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(lh,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(lh,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Tp)}),i.addEventListener("timeout",function(){a(Ap)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),yp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(Ep(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(qg,jg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(qg,jg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(qg,jg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{label:e,options:t}}),po=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),go=r(function(e,t){return f(ho,"Offer Type",M([l(po,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(po,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),vo={$:"Closed"},yo={$:"Committed"},mo={$:"Judgment"},bo={$:"Open"},Co=a(function(e,t,r,n){return f(ho,"Phase",M([l(po,"Open",e,function(e){return R(e.state.phase,bo)}),l(po,"Committed",t,function(e){return R(e.state.phase,yo)}),l(po,"Judgment",r,function(e){return R(e.state.phase,mo)}),l(po,"Closed",n,function(e){return R(e.state.phase,vo)})]))}),Eo={$:"Initiator"},So={$:"Responder"},To=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),wo=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(Eo):f(To,function(e){return R(t,e)?si(So):ci},e.state.responder)}),Io=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),Ao=r(function(e,t){return f(Io,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(wo,e,t))}),Bo=n(function(e,t,r){return f(ho,"Role",M([l(po,"Buyer",t,function(t){return R(f(Ao,t,e),si(fo))}),l(po,"Seller",r,function(t){return R(f(Ao,t,e),si(lo))})]))}),ko=function(e){return{orderBy:e}},No=ko,Ro={$:"Ascending"},$o={$:"Phase"},_o=Oe,Lo=_o(yr),xo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(Co,!0,!0,!0,!1),f(go,!0,!0),l(Bo,t,!0,!0)])),tradeTable:No(L($o,Ro)),wallet:e},Lo)}),Po=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Do={$:"None"},Uo=Do,Oo=function(e){return d(Po,e,Lo,Uo,yr)},Mo=function(e){return{$:"TradeTableMsg",a:e}},Fo=function(e){return d(Po,e,Lo,Uo,yr)},Vo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),Ko=r(function(e,t){return f(Vo,e,t)}),Ho=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),jo=n(function(e,t,r){return t(e(r))}),qo=r(function(e,t){if("None"===t.$)return Do;var r=t.a,n=t.b,a=l(Ho,f(Io,Da(e),r.onSign),f(Io,Da(e),r.onBroadcast),f(Io,function(t){var r=t.a,n=t.b;return L(f(jo,r,e),f(Io,function(t){return{confirmations:t.confirmations,toMsg:f(jo,t.toMsg,e)}},n))},r.onMined));return f(Vo,a,n)}),Go=function(e){return{$:"AbiDecoder",a:e}},zo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Yo=z,Wo=Fr,Jo=r(function(e,t){return e<1?t:l(Wo,e,Yo(t),t)}),Qo=Jo(64),Xo=n(function(e,t,r){return L(f(zo,e,Qo(t)),r)}),Zo=r(function(e,t){return e<1?"":l(Wo,0,e,t)}),eu=Zo(64),tu=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),ru=function(e){return-e},nu=r(function(e,t){return e<1?"":l(Wo,-e,Yo(t),t)}),au=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(Zo,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(nu,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Go(function(t){var r=t.a,n=t.b;return f(tu,f(Xo,r,n),e(eu(n)))})}(),iu=Hr,ou=function(e){return f(iu,"0x",e)||f(iu,"0X",e)?f(Jo,2,e):e},uu=function(e){return e.b},su=r(function(e,t){var r=e.a;return f(tu,uu,r(function(e){return f(zo,e,e)}(ou(t))))}),cu=Xr,fu=ae,lu=Wr,du=function(e){return f(cu,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return fu(a)},lu)},hu=f(jo,su,du),pu=function(e){return{$:"Magnitude",a:e}},gu=function(e){return{$:"Pos",a:e}},vu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),yu=function(e){return{$:"MagnitudeNotNormalised",a:e}},mu=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 si(n)}return ci}},bu=function(e){var t=mu(e);return"Nothing"!==t.$&&t.a<0},Cu=function(e){return{$:"Neg",a:e}},Eu={$:"Zer"},Su=function(e){return!e.b},Tu=r(function(e,t){var r=t.a;if(Su(r))return Eu;switch(e.$){case"Zero":return Eu;case"Positive":return gu(t);default:return Cu(t)}}),wu=r(function(e,t){return f(vu,e,yu(t))}),Iu=function(e){return f(La,r(function(t,r){return e(t)&&Su(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Au=Ir,Bu=-1+f(Au,10,7),ku=Bu+1,Nu=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Ru=function(e){return e<0?f(Nu,Na(-1),Ru(e+ku)):L(e/ku|0,e%ku)},$u=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Ru(r+e),i=a.a,o=a.b;return f(ka,o,f($u,i,n))}{if(!(_(e,ku)>0))return M([e]);var u=M([e]);e=0,t=u}}}),_u=function(e){var t=e.a;return pu(Iu(f($u,0,t)))},Lu=xa(ru),xu={$:"Negative"},Pu={$:"Positive"},Du={$:"Zero"},Uu=function(e){switch(e.$){case"Positive":return xu;case"Negative":return Pu;default:return Du}},Ou=function(e){for(;;){var t=e.a,r=e.b,n=_u(r),a=n.a;if(!bu(a))return f(Tu,t,pu(a));e=f(wu,Uu(t),Lu(a))}},Mu=pr,Fu=function(e){switch(f(Mu,e,0).$){case"LT":return xu;case"GT":return Pu;default:return Du}},Vu=function(e){return e<0?-e:e},Ku=function(e){return Ou(f(vu,Fu(e),yu(M([Vu(e)]))))},Hu=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(Au,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},ju=function(e){switch(e.$){case"Zer":return Eu;case"Neg":var t=e.a;return gu(t);default:return e}},qu=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(ka,L(a,u),f(Gu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Gu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Gu,yr,s))}return yr}),zu=r(function(e,t){var r=e.a,n=t.a;return qu(f(Gu,r,n))}),Yu=function(e){switch(e.$){case"Zer":return f(wu,Du,yr);case"Neg":var t=e.a.a;return f(wu,Pu,Lu(t));default:var t=e.a.a;return f(wu,Pu,t)}},Wu=r(function(e,t){var r=Yu(t),n=r.b,a=Yu(e),i=a.b,o=f(zu,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Ou(f(vu,Pu,yu(s)))}),Ju=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(R(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 Ta}return a.b.b?ba:f(Mu,e,t)}}),Qu=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},Xu=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(Ju,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Qu(d(Ju,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),Zu=r(function(e,t){return R(f(Xu,e,t),Ta)}),es=K,ts=r(function(e,t){return!f(Zu,e,t)}),rs=function(e){switch(e.$){case"Zer":return pu(yr);case"Pos":default:var t=e.a;return t}},ns=r(function(e,t){var r=e.a;return _u(yu(f(xa,ti(t),r)))}),as=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(ns,pu(n),a),u=f(as,pu(i),pu(n)),s=u.a,c=f(Wu,f(Tu,Pu,o),f(Tu,Pu,pu(f(ka,0,s))));return rs(c)}var a=r.a;return f(ns,pu(n),a)}return pu(yr)}),is=function(e){switch(e.$){case"Zer":return Du;case"Pos":return Pu;default:return xu}},os=r(function(e,t){return R(e,Du)||R(t,Du)?Du:R(e,t)?Pu:xu}),us=r(function(e,t){return f(Tu,f(os,is(e),is(t)),f(as,rs(e),rs(t)))}),ss=function(e){switch(e.$){case"Zer":return Eu;case"Pos":var t=e.a;return Cu(t);default:var t=e.a;return gu(t)}},cs=r(function(e,t){return f(Wu,e,ss(t))}),fs=Ku(0),ls=a(function(e,t,r,n){if(e){var a=Ku(e),i=f(us,f(us,a,n),t),o=f(ts,i,r)?L(f(us,a,t),f(cs,r,i)):L(fs,r),u=o.a,s=o.b,c=d(ls,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Wu,u,l),h)}return L(fs,r)}),ds=Fa(f(Va,2,Bu)),hs=n(function(e,t,r){return d(ls,f(Au,2,ds),e,t,r)}),ps=Ku(1),gs=r(function(e,t){return e}),vs=n(function(e,t,r){return l(Ra,gs(e),t,f(Ai,1,r))}),ys=function(e){return l(vs,us(Ku(ku)),ps,e)},ms=n(function(e,t,r){if(e){var n=l(hs,ys(e),t,r),a=n.a,i=n.b,o=l(ms,e-1,i,r),u=o.a,s=o.b;return L(f(Wu,a,u),s)}return l(hs,ys(e),t,r)}),bs=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Cs=r(function(e,t){if(R(t,fs))return ci;var r=Ti(bs(e))-Ti(bs(t))+1,n=l(ms,f(ei,0,r),ju(e),ju(t)),a=n.a,i=n.b;return si(L(f(Tu,f(os,is(e),is(t)),rs(a)),f(Tu,is(e),rs(i))))}),Es=f(us,Ku(2),Ku(2147483648)),Ss=xr,Ts=function(e){return f(Ss,e,"")},ws=Pn,Is=n(function(e,t,r){return e<=0?r:l(Is,e>>1,U(t,t),1&e?U(r,t):r)}),As=r(function(e,t){return l(Is,e,t,"")}),Bs=n(function(e,t,r){return U(f(As,e-Yo(r),Ts(t)),r)}),ks=te,Ns=Ar,Rs=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},$s=r(function(e,t){for(;;){if(t<16)return f(ka,Rs(t),e);var r=f(ka,Rs(f(Ns,16,t)),e),n=t/16|0;e=r,t=n}}),_s=function(e){return ks(e<0?f(ka,P("-"),f($s,yr,-e)):f($s,yr,e))},Ls=function(e){var t=f(Cs,e,Es);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=_s(Hu(a));return R(n,Ku(0))?i:U(Ls(n),l(Bs,8,P("0"),i))},xs=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,pu(yr))?"0":Ls(gu(t));default:var t=e.a;return"-"+xs(f(us,Ku(-1),e))}},Ps=function(e){return l(Bs,64,P("0"),e)},Ds=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=Ps(_s(a)),c=function(e){return U(e,n)}(Ps(_s(u)));return x(a+32+(Yo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Us=Dr,Os=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))))}),Ms=n(function(e,t,n){return l(Us,r(function(t,r){return l(Os,e,yi(t),r)}),t,n)}),Fs=function(e){return $a(l(Ms,ka,yr,e))},Vs=function(e){return f(Ri,"",f(xa,f(jo,_s,f(Bs,2,P("0"))),Fs(e)))},Ks=function(e){return 64-f(Ns,64,e)},Hs=function(e){return U(e,f(As,Ks(Yo(e)),"0"))},js=function(e){return L(si(Yo(e)/2|0),Hs(e))},qs=function(e){return L(ci,Ps(e))},Gs=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},zs=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=Ur,Ws=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(Ss,P("1"),r),!0);case"1":return L(f(Ss,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Ss,P("0"),r),!1);case"1":return L(f(Ss,P("1"),r),!0);default:break e}return L(r,!0)});return l(Ys,t,L("",!1),e).a},Js=function(e){return l(Ys,ka,yr,e)},Qs=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Jo,e,t),i=f(ka,l(Wo,0,e,t),r);e=n,t=a,r=i}}),Xs=r(function(e,t){return e&&""!==t?l(Qs,e,t,yr):M([t])}),Zs=function(e){var t=function(){var t=Js(xs(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(jo,Ws,f(Bs,256,P("1"))))}var r=t;return L(r,f(Bs,256,P("0")))}(),r=t.a,n=t.b;return ks(f(xa,Gs,f(Xs,4,n(f(Ri,"",f(xa,zs,r))))))},ec=function(e){return{$:"Hex",a:e}},tc=function(e){switch(e.$){case"AddressE":var t=e.a.a;return qs(t);case"UintE":var r=e.a;return qs(xs(r));case"IntE":var n=e.a;return qs(Zs(n));case"BoolE":return qs(e.a?"1":"0");case"DBytesE":var a=e.a.a;return js(a);case"BytesE":var a=e.a.a;return qs(ou(a));case"StringE":var i=e.a;return js(Vs(i));case"ListE":var o=e.a;return function(e){var t=e.a;return js(t)}(Xt()(o));default:var i=e.a;return qs(ou(i))}};try{var rc=Xt();Xt=function(){return rc}}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 nc=Pr,ac=function(e){return 1===Yo(e)?f(nc,"0",e):e},ic=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(ka,n,r);e=i,t=o,r=u}}}),oc=r(function(e,t){return $a(l(ic,e,t,yr))}),uc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(oc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(uc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),sc=r(function(e,t){return l(uc,0,e,t)}),cc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),fc=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 Pt(e.a)}},lc={$:"LE"},dc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,lc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,lc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,lc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,lc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,lc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,lc));case"Seq":var i=e.b;return l(hc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),hc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(dc,n,t,r);e=i,t=o,r=u}}),pc=Dt,gc=r(function(e,t){return{$:"Seq",a:e,b:t}}),vc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+fc(r),i=n;e=a,t=i}}),yc=function(e){return f(gc,f(vc,0,e),e)},mc=function(e){return{$:"U8",a:e}},bc=mc,Cc=r(function(e,t){return _(e,t)<0?e:t}),Ec=hr,Sc=function(e){return{$:"Bytes",a:e}},Tc=Sc,wc=function(e){return pc(yc(f(xa,Tc,$a(e))))},Ic=Pt,Ac=r(function(e,t){var r=e.a;return f(zn,r,t)}),Bc=function(e){return{$:"Decoder",a:e}},kc=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}}),Nc=r(function(e,t){return Bc(f(kc,e,t))}),Rc=Bc(Yn),$c=r(function(e,t){if("Just"===t.$){return t.a}return e}),_c=function(e){return{$:"Done",a:e}},Lc=function(e){return{$:"Loop",a:e}},xc=r(function(e,t){var n=t.a;return Bc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),Pc=function(e){return Bc(r(function(t,r){return L(r,e)}))},Dc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Pc(_c($a(n))):f(xc,function(e){return Lc(L(r-1,f(ka,e,n)))},e)}),Uc=function(e){return f($c,yr,f(Ac,f(Nc,L(Ic(e),yr),Dc(Rc)),e))},Oc=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))}),Mc=r(function(e,t){return l(Oc,ws,e,t)}),Fc=f(Ai,0,4),Vc=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}}),Kc=xt,Hc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),jc=function(e){return f(Hc,f(jo,Kc,ws(4294967295)),e)},qc=r(function(e,t){return 5*t+e}),Gc=4294967295>>>32-Ha,zc=ar,Yc=n(function(e,t,r){for(;;){var n=Gc&t>>>e,a=f(zc,n,r);if("SubTree"!==a.$){var i=a.a;return f(zc,Gc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Wc=function(e){return e>>>5<<5},Jc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Wc(r))>-1?f(zc,Gc&e,i):l(Yc,n,e,a))}),Qc=r(function(e,t){var r=f(Jc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),Xc=n(function(e,t,r){var n=f(qc,e,t);return f(Qc,n,r)}),Zc=ir,ef=a(function(e,t,r,n){var a=Gc&t>>>e,i=f(zc,a,n);if("SubTree"===i.$){var o=i.a,u=d(ef,e-Ha,t,r,o);return l(Zc,a,za(u),n)}var s=i.a,c=l(Zc,Gc&t,r,s);return l(Zc,a,Ga(c),n)}),tf=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,Wc(n))>-1?d(Ma,n,a,i,l(Zc,Gc&e,t,o)):d(Ma,n,a,d(ef,a,e,t,i),o)}),rf=n(function(e,t,r){return l(tf,e,t,r)}),nf=a(function(e,t,r,n){var a=f(qc,e,t);return l(rf,a,r,n)}),af=Dn,of=r(function(e,t){return l(Oc,af,e,t)}),uf=function(e){var t=l(La,r(function(t,n){var a={d0:l(Xc,0,t,e.state),d1:l(Xc,1,t,e.state),d2:l(Xc,2,t,e.state),d3:l(Xc,3,t,e.state),d4:l(Xc,4,t,e.state)},i=r(function(e,r){return d(nf,e,t,f(of,f(Vc,e,a),f(Mc,jc(f(Vc,f(Ns,5,e+1),a)),f(Vc,f(Ns,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Fc);return D(e,{state:t})},sf=L(0,0),cf=function(e){return{current:sf,lfsrstate:1,state:e,x:1,y:0}},ff=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},lf=L(1,0),df=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),hf=r(function(e,t){if(e){var n=f(df,1,t);return l(Oc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),pf=r(function(e,t){var r=f(Ns,32,e/32|0),n=f(df,r,t),a=f(Ns,32,e);return f(hf,a,n)}),gf=n(function(e,t,r){var n=f(Jc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(tf,e,t(a),r)}),vf=n(function(e,t,r){return l(gf,e,of(t),r)}),yf=a(function(e,t,r,n){var a=f(qc,e,t);return l(vf,a,r,n)}),mf=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Af=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Cc,n,r),i=f(xa,function(e){return f(If,e,g)},f(Ai,0,a)),o=wf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(sc,i.outputLen,l(v,g,yr,i.outputLen))},Rf=function(e){return{$:"KS",a:e}},$f=function(e){var t=e.a;return Rf({config:t,inputLength:0,partial:yr,state:f(ui,25,gs(sf))})},_f=function(e){return Bc(Wn(e))},Lf=pc(yc(yr)),xf=r(function(e,t){var n=t.a;return Bc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),Pf=r(function(e,t){return f(xf,function(e){return _f(t)},_f(e))}),Df=r(function(e,t){return f($c,Lf,f(Ac,f(Pf,e,Ic(t)-e),t))}),Uf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=Ic(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+Ic(e)}),0,i),a)>-1))return Rf(D(n,{inputLength:Ic(e)+n.inputLength,partial:i}));var o=wc(i),u=f($c,Lf,f(Ac,_f(a),o)),s=Uc(u),c=f(kf,s,n.state),d=wf(c),h=f(Df,a,o),p=Lf,g=Rf(D(n,{inputLength:Ic(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Of=r(function(e,t){return Nf(f(Uf,pc(yc(f(xa,bc,t))),$f(e)))}),Mf=Of(cc),Ff=function(e){return ec(f(Ri,"",f(xa,f(jo,_s,ac),f(sc,4,Mf(f(xa,yi,Js(e)))))))},Vf=function(e){return f(iu,"0x",e)||f(iu,"0X",e)?e:"0x"+e},Kf=function(e){var t=e.a;return Vf(t)},Hf=r(function(e,t){var r=Ds(f(xa,tc,t)),n=function(e){return U(e,r)}(ou(Kf(Ff(e))));return ec(n)}),jf=function(e){return{data:si(f(Hf,"poke()",yr)),decoder:hu(au),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},qf=r(function(e,t){return D(t,{checked:e})}),Gf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),zf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Gf,f(jo,function(e){return e.label},Ja(r)),function(e){return D(e,{options:l(Gf,f(jo,function(e){return e.label},Ja(n)),qf(a),e.options)})},t)}),Yf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Wf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Jf={$:"Descending"},Qf=function(e){return"Ascending"===e.$?Jf:Ro},Xf=function(e){return d(Wf,e,Lo,Uo,yr)},Zf=r(function(e,t){return L(t.a,e(t.b))}),el=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Wf,t,Lo,Uo,M([da(f(Yf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(Zf,Qf,t.orderBy):L(a,Ro);return Xf(D(t,{orderBy:i}));default:return Xf(t)}}),tl=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},rl=yn,nl=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=tl(jf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(Ko,a,n);return d(Po,t,Lo,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Po,t,Lo,Uo,M([da(f(Yf,o,u))]));case"FiltersMsg":var s=e.a;return Fo(D(t,{filters:f(zf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(el,c,t.tradeTable);return d(Po,D(t,{tradeTable:l.model}),f(rl,Mo,l.cmd),f(qo,Mo,l.chainCmd),f(xa,Ji(Mo),l.appCmds));default:return Oo(t)}}),al={$:"BottomRight"},il={$:"ShouldBeImpossible"},ol=lr,ul=function(e){return qi(e)},sl=r(function(e,t){f(ol,e,t);return{align:al,label:"unexpectedError",mainParagraphs:M([M([ul(e)])]),noticeType:il}}),cl=function(e){var t=e.a;return Vf(t)},fl=ye,ll=f(jo,cl,fl),dl=f(jo,xs,f(jo,Vf,fl)),hl=f(jo,Kf,fl),pl=f(jo,_s,f(jo,Vf,fl)),gl=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),vl=un,yl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},ml=function(e){return yl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f($c,vl,r))},f(gl,function(e){e.a;return!R(e.b,ci)},e)))},bl=function(e){return ml(M([L("to",f(Io,ll,e.to)),L("from",f(Io,ll,e.from)),L("gas",f(Io,pl,e.gas)),L("gasPrice",f(Io,dl,e.gasPrice)),L("value",f(Io,dl,e.value)),L("data",f(Io,hl,e.data)),L("nonce",f(Io,pl,e.nonce))]))},Cl=function(e){return{$:"TxSentry",a:e}},El=ye,Sl=r(function(e,t){return yl(M([L("ref",El(e)),L("txParams",t)]))}),Tl=function(e){return{$:"Signing",a:e}},wl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Tl(e)}}),Il={$:"Black"},Al=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Bl={$:"RBEmpty_elm_builtin"},kl={$:"Red"},Nl=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(Al,kl,t,r,h(Al,Il,c,f,l,d),h(Al,Il,i,o,u,s))}return h(Al,e,i,o,h(Al,kl,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(Al,kl,c,f,h(Al,Il,g,v,y,m),h(Al,Il,t,r,d,a))}return h(Al,e,t,r,n,a)}),Rl=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Al,kl,e,t,Bl,Bl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Mu,e,a).$){case"LT":return h(Nl,n,a,i,l(Rl,e,t,o),u);case"EQ":return h(Al,n,a,t,o,u);default:return h(Nl,n,a,i,o,l(Rl,e,t,u))}}),$l=n(function(e,t,r){var n=l(Rl,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(Al,Il,a,i,o,u)}return n}),_l=n(function(e,t,r){var n=e.a,a=bl(r),i=l($l,n.ref,f(wl,r,t),n.txs);return L(Cl(D(n,{ref:n.ref+1,txs:i})),f(rl,n.tagger,n.outPort(f(Sl,n.ref,a))))}),Ll=_l,xl=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Lo,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Ll,n,i,o))}return x(ci,Lo,M([f(sl,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Pl=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Dl=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Ul=function(e){return{$:"Posix",a:e}},Ol=Ul,Ml={autoabortInterval:Ol(0),autorecallInterval:Ol(0),autoreleaseInterval:Ol(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Fl=function(e){return{$:"TokenValue",a:e}},Vl=function(e){return e.a},Kl=r(function(e,t){return f($c,fs,f(Io,Qa,f(Cs,e,t)))}),Hl=r(function(e,t){return Fl(f(Kl,Vl(e),Ku(t)))}),jl=function(e){return f(Hl,e,12)},ql=function(e){return f(Hl,e,3)},Gl=Fl(Ku(0)),zl=r(function(e,t){var r=Gl;return{abortPunishment:jl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:ql(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Yl=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Wl=qr,Jl=function(e){var t=Yl(f(Wl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Yo(e)-1-r;return L(U(f(Zo,r,e),f(Jo,r+1,e)),n)},Ql=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 yr}}),Xl=function(e){var t=e.a,r=f(Ql,Ja(0),t);return pu(r.b?t:yr)},Zl=Z,ed=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}}}),td=n(function(e,t,r){var n=f(ed,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(sc,e,r),l(td,e,t,n)):yr}),rd=r(function(e,t){return l(td,e,e,t)}),nd=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Io,ka(a),r)});return f(La,t,si(yr))}(Ua),ad=function(e){return f(Io,f(Da,Xl,pu),nd(f(xa,f(jo,$a,f(jo,ks,Zl)),f(rd,7,$a(e)))))},id=Q,od=function(e){var t=Js(id(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Io,Tu(xu),ad(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Io,Tu(Pu),ad(r))}return ci;default:var r=t;return f(Io,Tu(Pu),ad(r))}},ud=function(e){var t=function(e){return!f(Ns,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f($c,0,Yl(r)))}},sd=function(e){return f(us,e,e)},cd=Ku(2),fd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ps;case"Neg":return Eu;default:if(R(r,ps))return f(us,e,t);if(ud(r)){var n=e,a=sd(t),i=f(Kl,r,cd);e=n,t=a,r=i;continue e}var n=f(us,t,e),a=sd(t),i=f(Kl,f(cs,r,ps),cd);e=n,t=a,r=i;continue e}}),ld=r(function(e,t){return l(fd,ps,e,t)}),dd=function(e){if(""===e)return ci;var t=Jl(e),r=t.a,n=t.b,a=od(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(us,o,f(ld,Ku(10),Ku(i)));return si(u)},hd=function(e){return f(Io,Fl,dd(e))},pd=jr,gd=function(e){for(;;){if(f(pd,".",e))return l(Wo,0,-1,e);{if(!f(pd,"0",e))return""===e?"0":e;e=l(Wo,0,-1,e)}}},vd=f(Da,f(Bs,7,P("0")),Ni),yd=function(e){return f(Ri,"",e)},md=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return yd(f(ka,Ni(n),f(xa,vd,a)))}return"0"},bd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return md(t);default:var t=e.a;return"-"+md(t)}},Cd=r(function(e,t){return e<1?t:l(Wo,0,-e,t)}),Ed=function(e){var t=l(Bs,18,P("0"),bd(e)),r=f(Cd,18,t)+"."+f(nu,18,t);return function(e){return""===e?"0":e}(gd(r))},Sd=r(function(e,t){var r=Ed(t),n=Yl(f(Wl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Zo,a+1+e,r):f(Zo,a,r)}),Td=r(function(e,t){if("Nothing"===e.$)return Ed(Vl(t));var r=e.a;return f(Sd,r,Vl(t))}),wd=ee,Id=function(e){var t=wd(f(Td,ci,e));if("Just"===t.$){return t.a}f(ol,"Error converting tokenValue to float: string -> float failed",e);return 0},Ad=function(e){if(""===e)return fi("You must specify a trade amount.");var t=hd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return Id(r)<1?fi("Trade amount can't be less than 1."):li(r)},Bd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=od(e);if("Nothing"===t.$){var r=wd(e);return fi("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 li(n)},kd=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),Nd=function(e){return""===e},Rd=function(e){return Nd(e)?ci:si(e)},$d=function(e){return f(kd,"You must specify a fiat type.",Rd(e))},_d=function(e){return""===e?fi("Must specify a payment method."):li(e)},Ld=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),xd=g(Ld,ci,ci,ci,ci,ci,ci,ci),Pd=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Dd=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Ud={$:"Custom"},Od=r(function(e,t){return{info:t,type_:e}}),Md=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Fd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),Vd=function(e){return e.a},Kd=function(e){return p(Md,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Od,Ud,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Fd,function(e){return D(xd,{daiAmount:si(e)})},Ad(e.daiAmount)),f(Fd,function(e){return D(xd,{fiatAmount:si(e)})},Bd(e.fiatAmount)),f(Fd,function(e){return D(xd,{fiatType:si(e)})},$d(e.fiatType)),f(Fd,function(e){return D(xd,{paymentMethod:si(e)})},_d(e.paymentMethod)),Pd(d(Dd,function(e){return Vd(e)>0?li(e):fi(D(xd,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return Vd(e)>0?li(e):fi(D(xd,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return Vd(e)>0?li(e):fi(D(xd,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Hd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},jd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),qd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Gd=function(e){var t=Kd(e.inputs),r=function(){return R(e.errors,xd)?xd:"Ok"===t.$?xd:t.a}();return D(e,{createParameters:l(jd,zl,Hd(e.wallet),qd(t)),errors:r})},zd=r(function(e,t){return Gd(D(t,{inputs:e}))}),Yd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Wd=function(e){return d(Yd,f(zd,Ml,{allowance:ci,createParameters:ci,depositAmount:ci,errors:xd,inputs:Ml,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Lo,Uo,yr)},Jd=a(function(e,t,r,n){return la(d(Pl,e,t,r,n))}),Qd=function(e){return{$:"Address",a:e}},Xd=f(jo,ou,f(jo,id,Qd)),Zd=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Xd("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return Xd("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return Xd("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return Xd("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return Xd("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},eh=function(e){return Xd("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},th=function(e){return{$:"AddressE",a:e}},rh=th,nh=function(e){return{$:"UintE",a:e}},ah=nh,ih=n(function(e,t,r){return{data:si(f(Hf,"approve(address,uint256)",M([rh(t),ah(r)]))),decoder:hu(au),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),oh=function(e){return f(Hl,e,200)},uh=r(function(e,t){return Fl(f(Wu,Vl(e),Vl(t)))}),sh=function(e){var t=f(Hl,e.tradeAmount,200);return f(uh,e.pokeReward,f(uh,oh(e.tradeAmount),f(uh,t,function(){return"Buyer"===e.initiatorRole.$?ql(e.tradeAmount):e.tradeAmount}())))},ch=Mi(ya),fh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),lh=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),dh=Xn,hh=Qn,ph=function(e){return f(hh,{caseInsensitive:!1,multiline:!1},e)},gh=Jn,vh=dh(f($c,gh,ph("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),yh=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}}),mh=r(function(e,t){return!f(yh,f(Da,es,e),t)}),bh=mh(Ua),Ch=q,Eh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Sh=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Th=f(La,Sh(ka),li(yr)),wh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},Ih=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Au,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Au,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Au,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Au,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Au,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Au,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Au,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Au,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Au,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Au,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Au,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Au,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Au,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Au,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Au,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(Ts(s)+" is not a valid hexadecimal character.")}}}),Ah=function(e){if(Nd(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(iu,"-",e)){var t=f($c,yr,wh(Js(e)));return f(tu,ru,l(Ih,Ti(t)-1,t,0))}return l(Ih,Yo(e)-1,Js(e),0)}();return f(Fd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Bh=function(e){var t=Js(e);return function(e){return L(t,e)}(f(Eh,yr,Th(f(xa,Ah,f(_i,"",f(Ri,"",f(xa,f(jo,_s,ac),f(sc,20,Mf(f(xa,f(jo,Ch,yi),t))))))))))},kh=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Bh(ou(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!vh(e)&&bh(o)},Nh=dh(f($c,gh,ph("^((0[Xx]){1})?[0-9a-f]{40}$"))),Rh=dh(f($c,gh,ph("^((0[Xx]){1})?[0-9A-F]{40}$"))),$h=function(e){return'"'+e+'"'},_h=function(e){var t=ou(e),r=f(Zo,24,t),n=f(nu,40,e);return 64===Yo(t)&&f(ki,Ja(P("0")),r)?Rh(n)||Nh(n)?li(Qd(n)):kh(n)?li(Qd(n)):fi("Given address "+$h(e)+" failed the EIP-55 checksum test."):40!==Yo(t)?fi("Given address "+$h(e)+" is not the correct length."):vh(t)?Rh(t)||Nh(t)?li(Qd(t)):kh(t)?li(Qd(t)):fi("Given address "+$h(e)+" failed the EIP-55 checksum test."):fi("Given address "+$h(e)+" contains invalid hex characters.")},Lh=Go(function(e){var t=e.a,r=e.b;return f(tu,f(Xo,t,r),_h(eu(r)))}),xh=r(function(e,t){var r=t.a;return Go(function(t){var n=t.a,a=t.b;return r(f(zo,n,f(Jo,64*e,a)))})}),Ph=Jr,Dh=r(function(e,t){return f(Ph,"data",hu(f(xh,e,t)))}),Uh=Qr,Oh=r(function(e,t){return f(Ph,"topics",f(Uh,e,hu(t)))}),Mh=function(e){return f(Io,f(jo,$a,f(Ra,r(function(e,t){return f(Wu,Ku(e),f(us,t,Es))}),fs)),nd(f(xa,f(jo,$a,f(jo,ks,f(jo,Ah,qd))),f(rd,8,$a(e)))))},Fh=function(e){var t=Js(id(e));e:for(;;){if(!t.b)return ci;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(Io,us(Ku(-1)),Mh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Io,us(Ku(-1)),Mh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Mh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Mh(a)}t.b;return ci}break e;default:break e}}var a=t;return Mh(a)},Vh=Go(function(e){var t=e.a,r=e.b;return f(tu,f(Xo,t,r),f(kd,"Error Decoding Uint into BigInt",Fh(Vf(eu(r)))))}),Kh=f(ch,f(Oh,1,Lh),f(ch,f(Dh,1,Lh),f(ch,f(Dh,0,Vh),Fi(fh)))),Hh=nn,jh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),qh=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(Hh,e,yl(M([L("data",fl(t.data)),L("topics",f(jh,hl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Gh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),zh=r(function(e,t){return f(tu,function(e){return e.id},f(Gh,function(e){return f(Fd,Di,f(qh,Kh,e).returnData)},f(kd,"No log found from that factoryAddress in that txReceipt",Yl(f(gl,function(t){return R(f(jo,cl,id)(t.address),f(jo,cl,id)(Zd(e)))},t.logs)))))}),Yh=n(function(e,t,r){return{data:si(f(Hf,"allowance(address,address)",M([rh(t),rh(r)]))),decoder:hu(Vh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Wh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Jh=function(e){switch(e.$){case"BlockNum":var t=e.a;return fl(Vf(_s(t)));case"EarliestBlock":return fl("earliest");case"LatestBlock":return fl("latest");default:return fl("pending")}},Qh=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return ml(M([L("to",f(Io,ll,t)),L("from",f(Io,ll,r)),L("gas",f(Io,pl,n)),L("gasPrice",f(Io,dl,a)),L("value",f(Io,dl,i)),L("data",f(Io,hl,o))]))},Xh=function(e){return{$:"BadBody",a:e}},Zh=function(e){return{$:"BadStatus",a:e}},ep=function(e){return{$:"BadUrl",a:e}},tp={$:"NetworkError"},rp={$:"Timeout"},np=rn,ap=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(ep(r));case"Timeout_":return fi(rp);case"NetworkError_":return fi(tp);case"BadStatus_":var n=t.a,a=t.b;return fi(Zh(n.statusCode));default:var n=t.a,a=t.b,i=f(np,f(Ph,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(Xh(Di(u)))}}),ip=n(function(e,t,r){return yl(M([L("id",El(e)),L("jsonrpc",fl("2.0")),L("method",fl(t)),L("params",f(jh,Ua,r))]))}),op=Bl,up=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Mu,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),sp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},cp=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(Al,kl,p,g,h(Al,Il,r,n,h(Al,kl,i,o,u,s),v),h(Al,Il,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(Al,Il,r,n,h(Al,kl,i,o,u,s),h(Al,kl,f,l,d,m))}return e},fp=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(Al,kl,i,o,h(Al,Il,s,c,f,l),h(Al,Il,r,n,d,h(Al,kl,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Al,Il,r,n,h(Al,kl,i,o,C,d),h(Al,kl,g,v,y,m))}return e},lp=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(Al,r,u,s,c,h(Al,kl,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 fp(t)}break e}o.a,o.d;return fp(t)}break e}return t}),dp=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(Al,t,r,n,dp(a),u)}var s=cp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Nl,c,f,l,dp(d),p)}return Bl}return h(Al,t,r,n,dp(a),u)}return Bl},hp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Bl;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(Al,r,n,a,f(hp,e,i),o)}var s=cp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Nl,c,l,d,f(hp,e,p),v)}return Bl}return h(Al,r,n,a,f(hp,e,i),o)}return f(pp,e,g(lp,e,t,r,n,a,i,o))}),pp=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(R(e,n)){var u=sp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Nl,r,s,c,i,dp(o))}return Bl}return h(Nl,r,n,a,i,f(hp,e,o))}return Bl}),gp=r(function(e,t){var r=f(hp,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(Al,Il,n,a,i,o)}return r}),vp=n(function(e,t,r){var n=t(f(up,e,r));if("Just"===n.$){var a=n.a;return l($l,e,a,r)}return f(gp,e,r)}),yp=function(e){return"Just"===e.$},mp=gn,bp=vn,Cp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),Ep=function(e){return{$:"BadUrl_",a:e}},Sp=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Tp={$:"NetworkError_"},wp=function(e){return{$:"Receiving",a:e}},Ip=function(e){return{$:"Sending",a:e}},Ap={$:"Timeout_"},Bp=function(e){return f(ta,"application/json",f(xi,0,e))},kp=n(function(e,t,r){return Bp(l(ip,e,t,r))}),Np=f(ea,"",Ua),Rp=Te,$p=Se,_p=function(e){if("Ok"===e.$){var t=e.a;return $p(t)}var r=e.a;return Rp(r)},Lp=function(e){return l(Zn,gr,_p,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},xp=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Lp({body:l(kp,1,r,n),headers:yr,method:"POST",resolver:Np(ap(a)),timeout:ci,url:t})},Pp=n(function(e,t,r){return xp({decoder:t.decoder,method:"eth_call",params:M([Qh(t),Jh(r)]),url:e})}),Dp={$:"LatestBlock"},Up=r(function(e,t){return l(Pp,e,t,Dp)}),Op=function(e){return{$:"Perform",a:e}},Mp=sn,Fp=$p(gr),Vp=r(function(e,t){return f(Mp,function(t){return $p(e(t))},t)}),Kp=n(function(e,t,r){return f(Mp,function(t){return f(Mp,function(r){return $p(f(e,t,r))},r)},t)}),Hp=function(e){return l(La,Kp(ka),$p(yr),e)},jp=r(function(e,t){var r=t.a;return Be(f(Mp,mp(e),r))}),qp=n(function(e,t,r){return f(Vp,function(e){return gr},Hp(f(xa,jp(e),t)))}),Gp=n(function(e,t,r){return $p(gr)}),zp=r(function(e,t){var r=t.a;return Op(f(Vp,e,r))});pn.Task=Pe(Fp,qp,Gp,zp);var Yp=Ue("Task"),Wp=cn,Jp=r(function(e,t){return Yp(Op(f(Wp,f(Da,f(Da,$p,e),fi),f(Mp,f(Da,f(Da,$p,e),li),t))))}),Qp=a(function(e,t,r,n){return f(Jp,n,f(Up,Wh(eo(e)),l(Yh,eh(e),t,r)))}),Xp=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Xd("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return Xd("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return Xd("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return Xd("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return Xd("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Zp=function(e){return{$:"BoolE",a:e}},eg=Zp,tg=function(e){return{$:"StringE",a:e}},rg=tg,ng=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:si(f(Hf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([rh(t),rh(r),eg(n),ah(a),ah(i),ah(o),ah(u),ah(s),ah(c),ah(l),ah(d),rg(h),rg(p)]))),decoder:hu(Lh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ag=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:si(f(Hf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([rh(t),rh(r),eg(n),ah(a),ah(i),ah(o),ah(u),ah(s),ah(c),ah(l),ah(d),rg(h),rg(p)]))),decoder:hu(Lh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ig=r(function(e,t){return{paymentMethods:t,price:e}}),og=function(e){return fl(bd(e))},ug=function(e){return f(jh,Ua,M([fl(e.fiatType),og(e.amount)]))},sg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},cg=function(e){return yl(M([L("type",fl(sg(e.type_))),L("info",fl(e.info))]))},fg=function(e){var t=ug(e.price),r=f(jh,cg,e.paymentMethods);return f(xi,0,yl(M([L("paymentmethods",r),L("price",t)])))},lg=r(function(e,t){return D(t,{value:si(e)})}),dg=function(e){return Ku(Vd(e))},hg=function(e){return f(Kl,dg(e),Ku(1e3))},pg=r(function(e,t){var r=function(){return"Token"===e.$?ng:ag}();return function(){return"Native"===e.$?lg(Vl(sh(t))):Ua}()(r(Zd(e))(t.initiatorAddress)(Xp(e))(R(t.initiatorRole,lo))(Vl(t.tradeAmount))(Vl(ql(t.tradeAmount)))(Vl(jl(t.tradeAmount)))(Vl(t.pokeReward))(hg(t.autorecallInterval))(hg(t.autoabortInterval))(hg(t.autoreleaseInterval))(Vl(oh(t.tradeAmount)))(fg(f(ig,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),gg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),vg=function(e){return{$:"CreateNeedsSig",a:e}},yg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),mg=r(function(e,t){var r=tl(f(pg,e,t)),n={onBroadcast:ci,onMined:si(L(gg(e),ci)),onSign:si(yg(e))};return L(si(vg(e)),f(Ko,n,r))}),bg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Cg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),Eg=function(e){return{$:"ApproveNeedsSig",a:e}},Sg=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Tg=r(function(e,t){return{$:"Confirm",a:e,b:t}}),wg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),Ig={$:"NoOp"},Ag=function(e){return{appCmds:yr,chainCmd:Uo,cmd:Lo,model:e}},Bg=function(e){return Zl(bd(e))},kg={$:"Error"},Ng=r(function(e,t){f(ol,e+" fetch error",t);return{align:al,label:"web3FetchError",mainParagraphs:M([M([ul('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:kg}}),Rg=r(function(e,t){return{align:al,label:"web3MiningError",mainParagraphs:M([M([ul('Error mining "'+e+'" transaction: '+t)])]),noticeType:kg}}),$g={$:"Caution"},_g=r(function(e,t){return{align:al,label:"web3SigError",mainParagraphs:M([M([ul('Error signing "'+e+'" transaction: '+t)])]),noticeType:$g}}),Lg={$:"KovanDai"},xg=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Lg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Pg=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Dg=function(e){return f(To,xg,Pg(e))},Ug=r(function(e,t){return 1-e(1-t)}),Og=function(e){return f(Au,e,5)},Mg=Ug(Og),Fg={easing:Mg,offset:12,speed:200},Vg=function(e){return{$:"External",a:e}},Kg=function(e){return{$:"Internal",a:e}},Hg=function(e){return{$:"NotFound",a:e}},jg=function(e){for(;;){e=e.a}},qg=r(function(e,t){return Yp(Op(f(Vp,e,t)))}),Gg={$:"Http"},zg={$:"Https"},Yg=Kr,Wg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Jg=i(function(e,t,r,n,a){if(Nd(a)||f(Yg,"@",a))return ci;var i=f(Wl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=Zl(f(Jo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Wg,e,f(Zo,o,a),s,t,r,n))}return si(p(Wg,e,a,ci,t,r,n))}),Qg=a(function(e,t,r,n){if(Nd(n))return ci;var a=f(Wl,"/",n);if(a.b){var i=a.a;return h(Jg,e,f(Jo,i,n),t,r,f(Zo,i,n))}return h(Jg,e,"/",t,r,n)}),Xg=n(function(e,t,r){if(Nd(r))return ci;var n=f(Wl,"?",r);if(n.b){var a=n.a;return d(Qg,e,si(f(Jo,a+1,r)),t,f(Zo,a,r))}return d(Qg,e,ci,t,r)}),Zg=r(function(e,t){if(Nd(t))return ci;var r=f(Wl,"#",t);if(r.b){var n=r.a;return l(Xg,e,si(f(Jo,n+1,t)),f(Zo,n,t))}return l(Xg,e,ci,t)}),ev=function(e){return f(iu,"http://",e)?f(Zg,Gg,f(Jo,7,e)):f(iu,"https://",e)?f(Zg,zg,f(Jo,8,e)):ci},tv=Wt,rv=Gt(zt),nv=sa,av=r(function(e,t){return L(e,t)}),iv=_r,ov=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=Vu(r-n),o=f(ei,1,iv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),uv=r(function(e,t){var n=r(function(t,r){return Hp(f(xa,nv(0),d(ov,e.speed,e.easing,t,r-e.offset)))});return f(Mp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(Kp,av,rv,tv(t)))}),sv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Hd(t.wallet),Dg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(Qp,a,n.address,Zd(eo(a)),bg(a));return d(Yd,t,i,Uo,yr)}return Ag(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Yd,D(t,{inputs:D(u,{userRole:o})}),Lo,Uo,M([function(){return"Buyer"===o.$?d(Jd,"create offer type changed","input","sell dai",0):d(Jd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ag(f(zd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ag(f(zd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ag(f(zd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ag(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ag(f(zd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ag(f(zd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ag(f(zd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ag(f(zd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Yd,(g?zd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Lo,Uo,g?M([d(Jd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=Kd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(zl,n,m);return Ag(D(t,{depositAmount:si(Vl(sh(b))),txChainStatus:si(f(Tg,v,b))}))}var C=y.a;return d(Yd,D(t,{errors:C}),f(Jp,gs(Ig),function(){return f(uv,D(Fg,{offset:60}),"inputError")}()),Uo,yr);case"AbortCreate":return d(Yd,D(t,{txChainStatus:ci}),Lo,Uo,M([d(Jd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(mg,v,b);var e=v.a,r=function(){var t=tl(l(ih,eh(e),Zd(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Sg,e,b))};return f(Ko,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(Xu,a,E),ba)?L(si(Eg(e)),r):f(mg,v,b)}return L(si(Eg(e)),r)}(),T=S.a,w=S.b;return d(Yd,D(t,{txChainStatus:T}),Lo,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ag(D(t,{txChainStatus:si(l(Cg,a,b,A))}))}var B=I.a;return d(Yd,D(t,{txChainStatus:ci}),Lo,Uo,M([pa(f(_g,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(Xu,N,P),ba))return Ag($);var U=f(mg,eo(a),b),T=U.a,w=U.b;return d(Yd,D($,{txChainStatus:T}),Lo,w,yr)}return Ag($)}var O=k.a;return d(Yd,t,Lo,Uo,M([pa(f(Ng,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ag(D(t,{txChainStatus:si(f(wg,v,A))}))}var B=I.a;return d(Yd,D(t,{txChainStatus:ci}),Lo,Uo,M([pa(f(_g,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Yd,t,Lo,Uo,M([pa(f(Rg,"create",B))]))}var F=e.a,V=e.b.a,K=f(To,Bg,qd(f(zh,F,V)));if("Just"===K.$){var H=K.a;return d(Yd,t,Lo,Uo,M([da(f(Yf,F,H))]))}return d(Yd,t,Lo,Uo,M([pa(f(sl,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Yd,t,Lo,Uo,M([ga]));case"NoOp":return Ag(t);default:var j=e.a;return d(Yd,t,Lo,Uo,M([j]))}}),cv=r(function(e,t){return f(mh,function(e){return f(yh,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),fv=r(function(e,t){return f(Mu,Vd(e),Vd(t))}),lv=r(function(e,t){return R(f(fv,t.derived.phaseEndTime,e),Ta)}),dv=function(e){if(""===e)return li(ci);var t=hd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},hv=r(function(e,t){return{maxDai:t,minDai:e}}),pv=f(hv,ci,ci),gv=function(e){return l(Sh,r(function(t,r){return{dai:{max:r,min:t},fiatType:Rd(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Fd,function(e){return D(pv,{minDai:si(e)})},dv(e.minDai)),f(Fd,function(e){return D(pv,{maxDai:si(e)})},dv(e.maxDai)))},vv=r(function(e,t){var r=function(t){return f(mh,function(e){return f(Yg,id(e),id(t))},e)};return f(yh,function(e){return r(e.info)},t)}),yv=r(function(e,t){return D(t,{paymentMethod:e})}),mv=r(function(e,t){return D(t,{paymentMethodTerms:e})}),bv=r(function(e,t){return f(Xu,Vl(e),Vl(t))}),Cv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return Ev(D(e,{inputs:f(mv,r,f(yv,"",e.inputs))}))},Ev=function(e){var t=Cv(e),n=gv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(vv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(bv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(bv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(lv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(cv,t.filters,r)});return D(t,{filterFunc:s})},Sv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Tv={$:"Expires"},wv=function(e){return L(Ev({errors:pv,filterFunc:lv,filters:co(M([f(go,!0,!0),d(Co,!0,!1,!1,!1)])),inputs:Sv,showCurrencyDropdown:!1,tradeTable:No(L(Tv,Ro)),wallet:e}),Lo)},Iv=r(function(e,t){var r=f(gl,Ec(e),t.inputs.paymentMethodTerms);return Ev(D(t,{inputs:f(mv,r,t.inputs)}))}),Av=function(e){return Ev(D(e,{filterFunc:lv,inputs:Sv}))},Bv=function(e){return{$:"TradeTableMsg",a:e}},kv=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Nv=function(e){return d(kv,e,Lo,Uo,yr)},Rv=r(function(e,t){return D(t,{fiatType:e})}),$v=r(function(e,t){return D(t,{maxDai:e})}),_v=r(function(e,t){return D(t,{minDai:e})}),Lv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return Nv(D(t,{inputs:f(_v,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return Nv(D(t,{inputs:f($v,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return Nv(D(t,{inputs:f(Rv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return Nv(D(t,{inputs:(n?Rv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return Nv(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return Nv(D(t,{inputs:f(yv,r,t.inputs)}));case"AddSearchTerm":return Nv(Cv(t));case"RemoveTerm":var a=e.a;return Nv(f(Iv,a,t));case"ApplyInputs":return d(kv,Ev(t),Lo,Uo,yr);case"ResetSearch":return Nv(Av(t));case"FiltersMsg":var i=e.a;return Nv(Ev(D(t,{filters:f(zf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(el,o,t.tradeTable);return d(kv,D(t,{tradeTable:u.model}),f(rl,Bv,u.cmd),f(qo,Bv,u.chainCmd),f(xa,Ji(Bv),u.appCmds));case"NoOp":return Nv(t);default:var s=e.a;return d(kv,t,Lo,Uo,M([s]))}}),xv=a(function(e,t,r,n){return e(yl(M([L("title",fl(t)),L("body",function(){if("Nothing"===r.$)return vl;var e=r.a;return fl(e)}()),L("image",function(){if("Nothing"===n.$)return vl;var e=n.a;return fl(e)}())])))}),Pv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Dv=function(e){return e.a+"="+e.b},Uv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Dv,e)):""},Ov=r(function(e,t){return"/"+(f(Ri,"/",e)+Uv(t))}),Mv=function(e){switch(e.$){case"Home":return f(Ov,M(["DAIHard"]),yr);case"Create":return f(Ov,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Ov,M(["DAIHard","trade",Pv(t),Ni(r)]),yr);case"Marketplace":return f(Ov,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Ov,M(["DAIHard","history",cl(n)]),yr);default:return f(Ov,yr,yr)}},Fv={$:"NotFound"},Vv=function(e){return{$:"AgentHistory",a:e}},Kv={$:"Create"},Hv={$:"Home"},jv={$:"Marketplace"},qv=function(e){return{$:"Parser",a:e}},Gv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),zv=r(function(e,t){return qv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Gv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Yv=f(zv,"ADDRESS",f(jo,_h,qd)),Wv={$:"Eth"},Jv={$:"Kovan"},Qv=f(zv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Wv));case"keth":return si(Zi(Jv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Lg));case"xdai":return si(Zi(to));default:return ci}}),Xv=f(zv,"NUMBER",Zl),Zv=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Gv,r,n,a,i,e(o))}),ey=r(function(e,t){var r=t.a;return qv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,Zv(u),r(h(Gv,n,a,i,o,e)))})}),ty=function(e){return l(La,oo,yr,e)},ry=r(function(e,t){return ty(f(xa,e,t))}),ny=function(e){return qv(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 R(u,e)?M([h(Gv,f(ka,u,r),s,a,i,o)]):yr}return yr})},ay=r(function(e,t){var r=e.a,n=t.a;return qv(function(e){return f(ry,n,r(e))})}),iy=qv(function(e){return M([e])}),oy=f(ay,ny("DAIHard"),function(e){return qv(function(t){return f(ry,function(e){return(0,e.a)(t)},e)})}(M([f(ey,Hv,iy),f(ey,Kv,ny("create")),f(ey,Yf,f(ay,ny("trade"),f(ay,Qv,Xv))),f(ey,jv,ny("marketplace")),f(ey,Vv,f(ay,ny("history"),Yv)),f(ey,function(e){return Vv(e)},f(ay,ny("history"),Yv))]))),uy=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 si(t.value)}return si(t.value)}return ci}},sy=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,sy(r))}return yr}return yr},cy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return sy(r)}var r=t;return sy(r)},fy=Qt,ly=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),dy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=fy(n);if("Nothing"===o.$)return t;var u=o.a,s=fy(i);if("Nothing"===s.$)return t;var c=s.a;return l(vp,u,ly(c),t)}return t}),hy=function(e){if("Nothing"===e.$)return op;var t=e.a;return l(La,dy,op,f(_i,"&",t))},py=r(function(e,t){var r=e.a;return uy(r(h(Gv,yr,cy(t.path),hy(t.query),t.fragment,Ua)))}),gy=function(e){return f($c,Fv,f(py,oy,e))},vy=aa,yy=r(function(e,t){return f(vy,e,Mv(t))}),my=je("connectToWeb3",function(e){return vl}),by=function(e){return yl(M([L("event",fl(e.event)),L("category",fl(e.category)),L("label",fl(e.label)),L("value",El(e.value))]))},Cy=r(function(e,t){return yl(M([L("address",fl(cl(e))),L("signSeedMsg",fl(t))]))}),Ey=je("gTagOut",Ua),Sy=je("genPrivkey",Ua),Ty=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),wy=n(function(e,t,r){return f(To,Jc(t),f(Io,function(e){return e.trades},f(Ty,function(t){return R(t.factory,e)},r)))}),Iy=je("notifyPort",Ua),Ay=je("requestNotifyPermissionPort",function(e){return vl}),By=r(function(e,t){return D(t,{wallet:e})}),ky=r(function(e,t){return L(f(zd,t.inputs,D(t,{wallet:e})),function(){var t=L(Hd(e),Dg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(Qp,n,r.address,Zd(eo(n)),bg(n))}return Lo}())}),Ny=r(function(e,t){return D(t,{wallet:e})}),Ry=function(e){return{$:"AllowanceFetched",a:e}},$y=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Hd(e),Dg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Dg(e),si(i.factory))?d(Qp,a,n.address,i.creationInfo.address,Ry):Lo}return Lo}())}),_y=function(e){return{$:"AgentHistoryModel",a:e}},Ly=function(e){return{$:"CreateModel",a:e}},xy=function(e){return{$:"CreateMsg",a:e}},Py=function(e){return{$:"MarketplaceModel",a:e}},Dy=function(e){return{$:"TradeModel",a:e}},Uy=function(e){return{$:"TradeMsg",a:e}},Oy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Lo);case"CreateModel":var r=t.a,n=f(ky,e,r),a=n.a,i=n.b;return L(Ly(a),f(rl,xy,i));case"TradeModel":var o=t.a,u=f($y,e,o),s=u.a,c=u.b;return L(Dy(s),f(rl,Uy,c));case"MarketplaceModel":var l=t.a;return L(Py(f(Ny,e,l)),Lo);default:var d=t.a;return L(_y(f(By,e,d)),Lo)}}),My=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Fy=function(e){return{$:"PartiallyLoadedTrade",a:e}},Vy=r(function(e,t){return Fy(g(My,e,t,ci,ci,ci,ci,ci))}),Ky=function(e){return{$:"CurrentBlockFetched",a:e}},Hy=du(f(jo,ou,Ah)),jy=function(e){return xp({decoder:Hy,method:"eth_blockNumber",params:yr,url:e})},qy=function(e){return f(Jp,Ky,jy(e))},Gy=r(function(e,t){return{address_:e,blocknum:t}}),zy=function(e){return Go(function(t){return li(L(t,e))})},Yy=n(function(e,t,r){var n=t.a,a=r.a;return Go(function(t){return f(Gh,function(t){var r=t.a,n=t.b;return f(tu,Zf(e(n)),a(r))},n(t))})}),Wy=r(function(e,t){return l(Yy,r(function(e,t){return e(t)}),t,e)}),Jy=hu(f(Wy,Vh,f(Wy,Lh,zy(Gy)))),Qy=r(function(e,t){return{data:si(f(Hf,"createdTrades(uint256)",M([ah(t)]))),decoder:Jy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xy=n(function(e,t,r){return f(Jp,r,f(Up,Wh(e),f(Qy,Zd(e),t)))}),Zy=function(e){return{$:"CreationInfoFetched",a:e}},em=r(function(e,t){return l(Xy,e,Ku(t),Zy)}),tm=function(e){return{$:"EventSentryMsg",a:e}},rm=function(e){return{$:"BlockNumber",a:e}},nm=function(e){return{$:"EventSentry",a:e}},am=function(e){return{$:"Set_elm_builtin",a:e}},im=am(op),om=r(function(e,t){return L(nm({blockNumber:ci,errors:yr,nodePath:t,pending:im,ref:1,requests:op,tagger:e,watching:im}),f(Jp,f(jo,rm,e),jy(t)))}),um=function(e){return f(om,tm,Wh(e))},sm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),cm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},fm=cm(f(sm,ci,ci)),lm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:bo,secureCommInfo:fm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),dm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),hm=n(function(e,t,r){var n=f(em,t,r),a=um(t),i=a.a,o=a.b;return d(dm,l(lm,f(Vy,t,r),i,e),_o(M([n,o,qy(Wh(t))])),Uo,M([ha]))}),pm=function(e){return{$:"LoadedTrade",a:e}},gm=r(function(e,t){var r=um(t.factory),n=r.a,a=r.b;return d(dm,l(lm,pm(t),n,e),_o(M([a,qy(Wh(t.factory))])),Uo,M([ha]))}),vm=function(e){return{data:si(f(Hf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},ym=function(e){return{data:si(f(Hf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},mm=function(e){return{data:si(f(Hf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},bm=r(function(e,t){return{data:si(f(Hf,"initiatorStatement(string)",M([rg(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Cm=function(e){return{data:si(f(Hf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Em=function(e){return{data:si(f(Hf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Sm=r(function(e,t){return{data:si(f(Hf,"responderStatement(string)",M([rg(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Tm=r(function(e,t){return{amount:t,fiatType:e}}),wm=f(cu,function(e){var t=od(e);if("Just"===t.$){var r=t.a;return Fi(r)}return fu("Can't convert that to a BigInt")},lu),Im=l(Mi,Tm,f(Uh,0,lu),f(Uh,1,wm)),Am={$:"Bank"},Bm={$:"Cash"},km=function(e){switch(e){case"cash":return si(Bm);case"bank":return si(Am);case"custom":return si(Ud);default:return ci}},Nm=f(cu,function(e){var t=km(e);if("Just"===t.$){var r=t.a;return Fi(r)}return fu("")},lu),Rm=l(Mi,Od,f(Ph,"type",Nm),f(Ph,"info",lu)),$m=oe,_m=function(e){var t=l(Mi,ig,f(Ph,"price",Im),f(Ph,"paymentmethods",$m(Rm)));return f(np,t,e)},Lm=r(function(e,t){return{commPubkey:t,responder:e}}),xm=r(function(e,t){var n=r(function(t,r){return l(Wo,t,t+2*r,e)}),a=f(jo,Ah,tu(ti(2)));return f(Gh,function(t){return f(tu,function(e){return f(n,t+64,e)},Ah(l(Wo,t,t+64,e)))},a(t))}),Pm=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),Dm=n(function(e,t,r){var n=l(Ra,Pm(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),Um=j,Om=function(e){return Ts(Um(e))},Mm=function(e){return l(Dm,r(function(e,t){return U(t,Om(e))}),"",e)},Fm=Go(function(e){var t=e.a,r=e.b;return f(tu,f(Xo,t,r),f(Gh,Mm,f(Gh,f(jo,xa(Ah),Th),f(tu,gl(f(jo,Nd,es)),f(tu,Xs(2),f(xm,t,eu(r)))))))}),Vm=f(ch,f(Dh,1,Fm),f(ch,f(Dh,0,Lh),Fi(Lm))),Km=r(function(e,t){return{commPubkey:t,terms:e}}),Hm=f(ch,f(Dh,1,Fm),f(ch,f(Dh,0,Fm),Fi(Km))),jm=function(e){return{statement:e}},qm=f(ch,f(Dh,0,Fm),Fi(jm)),Gm=function(e){return{statement:e}},zm=f(ch,f(Dh,0,Fm),Fi(Gm)),Ym={$:"AbortedEvent"},Wm={$:"BurnedEvent"},Jm={$:"ClaimedEvent"},Qm=function(e){return{$:"CommittedEvent",a:e}},Xm=function(e){return{$:"InitiatedEvent",a:e}},Zm=function(e){return{$:"InitiatorStatementLogEvent",a:e}},eb={$:"PokeEvent"},tb={$:"RecalledEvent"},rb={$:"ReleasedEvent"},nb=function(e){return{$:"ResponderStatementLogEvent",a:e}},ab=dh(f($c,gh,ph("^((0[Xx]){1})?[0-9a-fA-F]+$"))),ib=function(e){return ab(e)?li(ec(ou(e))):fi("Something in here is not very hexy: "+$h(e))},ob=du(ib),ub=f(Ph,"topics",f(Uh,0,ob)),sb=function(e){return ec(f(Ri,"",f(xa,f(jo,_s,ac),Mf(f(xa,yi,Js(e))))))},cb=f(cu,function(e){return R(e,sb("Initiated(string,string)"))?f(Oi,Xm,Hm):R(e,sb("Committed(address,string)"))?f(Oi,Qm,Vm):R(e,sb("Recalled()"))?Fi(tb):R(e,sb("Claimed()"))?Fi(Jm):R(e,sb("Aborted()"))?Fi(Ym):R(e,sb("Released()"))?Fi(rb):R(e,sb("Burned()"))?Fi(Wm):R(e,sb("InitiatorStatementLog(string)"))?f(Oi,Zm,qm):R(e,sb("ResponderStatementLog(string)"))?f(Oi,nb,zm):R(e,sb("Poke()"))?Fi(eb):fu("Unrecognized topic hash")},ub),fb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},lb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},db=function(e){return R(e.buyerDeposit,ql(e.tradeAmount))&&R(e.abortPunishment,jl(e.tradeAmount))},hb={$:"Invalid"},pb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),gb=r(function(e,t){return Ol(Vd(t)+Vd(e))}),vb=function(e){var t=wd(bd(e.amount));if("Just"===t.$){return t.a}f(ol,"Error converting FiatValue to float--string -> float failed!",e);return 0},yb=r(function(e,t){return(t-e)/e}),mb=r(function(e,t){var r=vb(t),n=Id(e);return"USD"===t.fiatType?si(f(yb,n,r)):ci}),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 Ol(f(Au,2,31)-1)}}();return{margin:f(mb,e.tradeAmount,r.price),phaseEndTime:f(gb,t.phaseStartTime,n)}}),Cb=function(e){var t=x(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 pm(v(pb,e.factory,e.id,n,a,o,u,s,l(bb,a,o,u)))}return Fy(e)},Eb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Cb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(ol,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return hb}}),Sb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Cb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(ol,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return hb}}),Tb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Cb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(ol,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return hb}}),wb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Cb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return pm(D(n,{state:e}));default:return hb}}),Ib=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Cb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(ol,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return hb}}),Ab=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}}),Bb=hu(f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,au,f(Wy,Lh,zy(Ab))))))))))),kb=function(e){return{data:si(f(Hf,"getParameters()",yr)),decoder:Bb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Nb=function(e){return f(Io,function(e){return Ol(1e3*e)},Zl(bd(e)))},Rb=function(e){return Fl(e)},$b=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),_b=function(e){var t=f(kd,"error converting BigInt to Time.Posix",Nb(e.autoabortInterval)),r=f(kd,"error converting BigInt to Time.Posix",Nb(e.autoreleaseInterval)),a=f(kd,"error converting BigInt to Time.Posix",Nb(e.autorecallInterval));return d($b,n(function(t,r,n){return{abortPunishment:Rb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Rb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:Rb(e.pokeReward),tradeAmount:Rb(e.tradeAmount)}}),a,t,r)},Lb=n(function(e,t,r){return f(Jp,r,f(Vp,_b,f(Up,Wh(e),kb(t))))}),xb=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}}}}}}}}}}},Pb=hu(f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,zy(xb)))))))))))),Db=function(e){return{data:si(f(Hf,"getPhaseStartInfo()",yr)),decoder:Pb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Ub=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),Ob=function(e){return h(Ub,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}}),Nb(e.v6),Nb(e.v7),Nb(e.v8),Nb(e.v9))},Mb=n(function(e,t,r){return f(Jp,r,f(Vp,Ob,f(Up,Wh(e),Db(t))))}),Fb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Vb=hu(f(Wy,Vh,f(Wy,Lh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,zy(Fb))))))),Kb=function(e){return{data:si(f(Hf,"getState()",yr)),decoder:Vb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Hb={$:"Aborted"},jb={$:"Burned"},qb={$:"NotClosed"},Gb={$:"Recalled"},zb={$:"Released"},Yb=function(e){switch(f($c,99,Zl(bd(e)))){case 0:return si(qb);case 1:return si(Gb);case 2:return si(Hb);case 3:return si(zb);case 4:return si(jb);default:return ci}},Wb=function(e){switch(f($c,99,Zl(bd(e)))){case 1:return si(bo);case 2:return si(yo);case 3:return si(mo);case 4:return si(vo);default:return ci}},Jb=function(e){return R(e,Xd("0x0000000000000000000000000000000000000000"))?ci:si(e)},Qb=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),Xb=function(e){var t=Nb(e.phaseStartTimestamp),r=Wb(e.phase),a=Yb(e.closedReason);return d(Qb,n(function(t,r,n){return{balance:Rb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:Jb(e.responder)}}),r,t,a)},Zb=n(function(e,t,r){return f(Jp,r,f(Vp,Xb,f(Up,Wh(e),Kb(t))))}),eC=i(function(e,t,r,n,a){return _o(M([l(Lb,e,t,r),l(Zb,e,t,n),l(Mb,e,t,a)]))}),tC=function(e){var t=Bg(e);if("Just"===t.$){return t.a}f(ol,"Warning! BigInt to Int conversion failed!",bd(e));return 0},rC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),nC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),aC=function(e){return e.b?l(nC,e,yr,0):qa},iC=tn,oC=function(e){var t=h(iC,rC,f(Ph,"encapsulation",lu),f(Ph,"iv",lu),f(Ph,"tag",lu),f(Ph,"encrypted",lu)),r=$m(t),n=f(Hh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Jc,0,e),f(Jc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(aC(i))},uC=function(e){var t=function(e){var t=Yo(e);return t>1114111?fi("string is too long"):li(f(Ss,Um(t),e))};return f(tu,Ri(""),Th(f(xa,t,e)))},sC=function(e){var t=e.a,r=e.b;return uC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},cC=r(function(e,t){return yl(M([L("message",fl(e)),L("pubkeyHexStrings",f(jh,fl,M([t.initiatorPubkey,t.responderPubkey])))]))}),fC=function(e){return{$:"LoadedCommInfo",a:e}},lC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dC=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 fC(f(lC,r,n))}return cm(e)},hC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return dC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return fC(D(n,{initiatorPubkey:e}))}),pC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return dC(D(r,{responderPubkey:si(e)}))}var n=t.a;return fC(D(n,{responderPubkey:e}))}),gC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),vC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(ed,a,n),o=ks(f(sc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),yC=function(e){var t=aC(f(vC,Js(e),yr));return l(jd,av,h(Ub,rC,f(Jc,0,t),f(Jc,1,t),f(Jc,2,t),f(Jc,3,t)),h(Ub,rC,f(Jc,4,t),f(Jc,5,t),f(Jc,6,t),f(Jc,7,t)))},mC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),bC={$:"Aborted"},CC={$:"Burned"},EC={$:"Claimed"},SC=function(e){return{$:"Committed",a:e}},TC=function(e){return{$:"Encrypted",a:e}},wC={$:"FailedDecode"},IC={$:"Initiated"},AC={$:"Recalled"},BC={$:"Released"},kC=function(e){return{$:"StateChange",a:e}},NC=function(e){return{$:"Statement",a:e}},RC=fr,$C=cr,_C=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(RC,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l($C,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),LC=or,xC=y,PC=a(function(e,t,r,n){var a=Gc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(LC,Ga(r),n);var i=za(d(PC,e-Ha,t,r,ja));return f(LC,i,n)}var o=f(zc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(PC,e-Ha,t,r,u));return l(Zc,a,i,n)}var i=za(d(PC,e-Ha,t,r,xC(o)));return l(Zc,a,i,n)}),DC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(PC,c,r,e,xC(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(PC,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),UC=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(RC,32,r,e),o=f(DC,i,t);if(a<0){var u=l($C,a,n,e);return f(DC,u,o)}return o}),OC=ur,MC=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(OC,i,t,r)}return f(ka,e,t)});return{nodeList:l(OC,i,yr,n),nodeListSize:t/32|0,tail:a}},FC=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(OC,o,t,r)}var n=e.a;return f(UC,n,t)});return f(UC,i,l(OC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(OC,o,t,r)}var n=e.a;return f(_C,n,t)});return f(ai,!0,f(_C,i,l(OC,o,MC(e),a)))}),VC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),KC=f(La,VC,yr),HC=n(function(e,t,r){var n=gC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(kC(IC));case"CommittedEvent":var r=t.a;return si(kC(SC(r.responder)));case"RecalledEvent":return si(kC(AC));case"ClaimedEvent":return si(kC(EC));case"AbortedEvent":return si(kC(bC));case"ReleasedEvent":return si(kC(BC));case"BurnedEvent":return si(kC(CC));case"InitiatorStatementLogEvent":var r=t.a;return si(NC({blocknum:e,message:function(){var e=yC(r.statement);if("Just"===e.$){var t=e.a;return TC(t)}return wC}(),who:n(Eo)}));case"ResponderStatementLogEvent":var r=t.a;return si(NC({blocknum:e,message:function(){var e=yC(r.statement);if("Just"===e.$){var t=e.a;return TC(t)}return wC}(),who:n(So)}));default:return ci}}(),i=f(Io,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(FC,r.history,aC(KC(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Io,mC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),KC(M([s])))}),jC=Gr,qC=function(e){var t=l(Mi,av,f(Ph,"id",jC),f(Ph,"message",lu));return f(Fd,Di,f(Hh,t,e))},GC=function(e){return{$:"Decrypted",a:e}},zC=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),YC=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(HC,n,a,t),o=i.a,u=i.b,s=i.c;return d(zC,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(zC,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(zC,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=qC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Jc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:GC(y)}),T=D(b,{eventInfo:NC(S)}),w=l(tf,v,T,t.history);return d(zC,D(t,{history:w}),!1,ci,yr)}return d(zC,t,!1,ci,M([pa(f(sl,"got a decryption result, but for an event that is not a message!",b))]))}return d(zC,t,!1,ci,M([pa(f(sl,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(zC,t,!1,ci,M([pa(f(sl,"Error decoding decryption result",I))]))}}),WC=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),JC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),QC=function(e){return{onBroadcast:ci,onMined:si(L(WC(e),ci)),onSign:si(JC(e))}},XC=je("encryptToPubkeys",Ua),ZC=n(function(e,t,r){return{data:si(f(Hf,"commit(address,string)",M([rh(t),rg(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),eE=n(function(e,t,r){return{data:si(f(Hf,"commit(address,string)",M([rh(t),rg(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tE=function(e){return{$:"CommitMined",a:e}},rE={$:"CommitNeedsSig"},nE=function(e){return{$:"CommitSigned",a:e}},aE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?eE:ZC}(),a=tl(function(){return"Token"===e.factory.$?Ua:lg(Vl(fb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(rE),f(Ko,{onBroadcast:ci,onMined:si(L(tE,ci)),onSign:si(nE)},a))}),iE=r(function(e,t){return yl(M([L("id",El(e)),L("encapsulation",fl(t.encapsulatedKey)),L("iv",fl(t.iv)),L("tag",fl(t.tag)),L("encrypted",fl(t.message))]))}),oE=je("decryptMessage",Ua),uE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},sE=r(function(e,t){return _o(f(xa,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 oE(f(iE,r,s))}return Lo}return Lo},uE(e.history)))}),cE=function(e){if("Just"===e.$){return e.a}return ci},fE=function(e){var t=cE(l(jd,wo,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Io,function(e){return e.address},Hd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(sE,n,a)}return Lo},lE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(HC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),dE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),hE=i(function(e,t,r,n,a){return f(lE,n,p(dE,e,r,t,qa,a,""))}),pE=function(e){return{$:"ChatHistoryMsg",a:e}},gE=a(function(e,t,r,n){var a=x(t,Hd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(Ao,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(pE),n))}(h(hE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),vE={$:"Abort"},yE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),mE=function(e){return{$:"ActionNeedsSig",a:e}},bE=function(e){return{$:"ApproveMining",a:e}},CE={$:"ApproveNeedsSig"},EE=function(e){return{$:"ApproveSigned",a:e}},SE={$:"Burn"},TE={$:"Claim"},wE=function(e){return{$:"CommitMining",a:e}},IE=function(e){return{$:"ConfirmingAction",a:e}},AE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),BE=function(e){return{$:"EventLogFetched",a:e}},kE=function(e){return{$:"ParametersFetched",a:e}},NE=function(e){return{$:"PhaseInfoFetched",a:e}},RE={$:"Poke"},$E={$:"Recall"},_E={$:"Release"},LE=function(e){return{$:"StartContractAction",a:e}},xE=function(e){return{$:"StateFetched",a:e}},PE=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"}},DE=function(e){return d(dm,e,Lo,Uo,yr)},UE={align:al,label:"cantFindTradeWillRetry",mainParagraphs:M([M([ul("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:kg},OE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(Ng,e,r)}if("Nothing"===t.a.$){t.a;return f(sl,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(sl,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),ME={align:al,label:"tradeParametersNotDefault",mainParagraphs:M([M([ul("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:kg},FE=eo(Xi),VE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),KE=n(function(e,t,r){return l(vp,e,Io(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),HE=r(function(e,t){var r=t.a;return am(f(gp,e,r))}),jE=n(function(e,t,r){var n=e.a,a=f(up,t,n.requests);if("Nothing"===a.$)return L(nm(n),Lo);var i=a.a,o=L(i.watchOnce,Yl(r));if("Nothing"===o.b.$){o.b;return L(nm(D(n,{requests:l(KE,t,r,n.requests)})),Lo)}if(o.a){var u=o.b.a;return L(nm(D(n,{requests:l(KE,t,r,n.requests),watching:f(HE,t,n.watching)})),f(qg,i.tagger,$p(u)))}return L(nm(D(n,{requests:l(KE,t,r,n.requests)})),_o(f(xa,function(e){return f(qg,i.tagger,$p(e))},r)))}),qE=_e,GE=r(function(e,t){return f(Jp,f(jo,rm,t),f(Mp,function(t){return jy(e)},qE(2e3)))}),zE=ue,YE=ce,WE=Yr,JE=n(function(e,t,r){var n=function(e){return YE(M([e,zE(r)]))};return f(cu,function(a){var i=f(Hh,e,a);if("Ok"===i.$){var o=i.a,u=f(Hh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return fu(Di(c))}return Fi(r)},WE)}),QE=a(function(e,t,r,n){return f(ch,l(JE,f(Ph,e,WE),t,r),n)}),XE=n(function(e,t,r){return f(ch,f(Ph,e,t),r)}),ZE=du(_h),eS=dh(f($c,gh,ph("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),tS=function(e){return{$:"BlockHash",a:e}},rS=function(e){return eS(e)?li(tS(ou(e))):fi("Given blockHash "+$h(e)+" is not valid.")},nS=du(rS),aS=function(e){return{$:"TxHash",a:e}},iS=function(e){return eS(e)?li(aS(ou(e))):fi("Given txHash "+$h(e)+" is not valid.")},oS=du(iS),uS=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}}),sS=zr,cS=l(XE,"blockNumber",Hy,l(XE,"blockHash",nS,l(XE,"transactionHash",oS,l(XE,"transactionIndex",Hy,l(XE,"logIndex",Hy,d(QE,"removed",sS,!1,l(XE,"topics",$m(ob),l(XE,"data",lu,l(XE,"address",ZE,Fi(uS)))))))))),fS=function(e){return f(jh,function(e){if("Just"===e.$){var t=e.a;return fl(Kf(t))}return vl},e)},lS=function(e){return yl(M([L("fromBlock",Jh(e.fromBlock)),L("toBlock",Jh(e.toBlock)),L("address",ll(e.address)),L("topics",fS(e.topics))]))},dS=r(function(e,t){return xp({decoder:$m(cS),method:"eth_getLogs",params:M([lS(t)]),url:e})}),hS=function(e){return{$:"BlockNum",a:e}},pS=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Mp,function(r){return f(Vp,vi(r),f(dS,e,D(t,{fromBlock:hS(n),toBlock:hS(a)})))},f(dS,e,t)):f(dS,e,t)}),gS=n(function(e,t,r){var n=r.a,a=r.b;return f(dS,e,D(t,{fromBlock:hS(n),toBlock:hS(a)}))}),vS=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(vS,e,t,i)),c=o;e=u,t=s,r=c}}),yS=r(function(e,t){return l(vS,$l,t,e)}),mS=r(function(e,t){var r=e.a,n=t.a;return am(f(yS,r,n))}),bS=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 _o(f(xa,function(t){return f(Jp,f(jo,VE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},KC(f(xa,function(e){return f(up,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(nm(D(r,{blockNumber:si(a)})),_o(M([f(GE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,gS)]))):L(t,f(GE,r.nodePath,r.tagger))}return L(nm(D(r,{blockNumber:si(a),pending:im,watching:f(mS,r.watching,r.pending)})),_o(M([f(GE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,pS),l(i,L(a,a),r.watching,gS)])))}var s=e.a.a;return L(nm(D(r,{errors:f(ka,s,r.errors)})),f(GE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(jE,t,c,d)}var s=e.b.a;return L(nm(D(r,{errors:f(ka,s,r.errors)})),Lo)}),CS=r(function(e,t){var r=t.a;return am(l($l,e,gr,r))}),ES=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l($l,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(nm(D(o,{watching:f(CS,a.ref,o.watching)})),f(Jp,f(jo,VE(a.ref),a.tagger),e),a.ref)}(l(pS,a.nodePath,n,L(s,s)))}return x(nm(D(o,{pending:f(CS,a.ref,o.pending)})),Lo,a.ref)}),SS=ES(!1),TS=function(e){return M([e])},wS=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(em,r.factory,r.id):Lo}}(),function(){var e=x(Hd(t.wallet),Dg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Dg(t.wallet),si(a.factory))?d(Qp,n,r.address,a.creationInfo.address,Ry):Lo}return Lo}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(gE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?fE(t):Lo,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(dm,u,_o(M([l(Zb,p.factory,p.creationInfo.address,xE),s,r])),Uo,o)}return DE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return DE(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(dm,t,Lo,Uo,M([pa(f(Ng,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(Xu,m,Vl(fb(C.parameters))),ba))return DE(u);var S=l(aE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(dm,D(u,{txChainStatus:T}),Lo,w,yr)}return DE(u)}var y=g.a;return d(dm,t,Lo,Uo,M([pa(f(Ng,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:tC(I.blocknum)},B=l(SS,BE,t.eventSentry,{address:A.address,fromBlock:hS(A.blocknum),toBlock:Dp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(Eb,A,t.trade)}),$=f($c,FE,lb(u.trade)),_=_o(M([N,h(eC,$,A.address,kE,xE,NE)]));return d(dm,u,_,Uo,yr)}if("BadBody"===g.a.$){g.a.a;return d(dm,t,Lo,Uo,M([pa(UE)]))}var y=g.a;return d(dm,t,Lo,Uo,M([pa(f(Ng,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(wb,P,t.trade)});return d(dm,u,fE(u),Uo,yr)}return d(dm,t,Lo,Uo,M([pa(f(OE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(db(F)){var u=D(t,{trade:f(Sb,F,t.trade)});return d(dm,u,fE(u),Uo,yr)}return d(dm,t,Lo,Uo,M([pa(ME)]))}var V=g.a.a;return d(dm,t,Lo,Uo,M([pa(f(sl,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(dm,t,Lo,Uo,M([pa(f(Ng,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Tb,H,t.trade)});return d(dm,u,fE(u),Uo,yr)}return d(dm,t,Lo,Uo,M([pa(f(OE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(qh,cb,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(dm,t,Lo,Uo,M([pa(f(sl,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(hC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(pC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=_m(e.terms);if("Ok"===r.$){var n=r.a;return L(f(Ib,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(sl,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(pE),n))}(l(HC,q.blockNumber,Y,r))}return d(gE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?fE(u):Lo;return d(dm,u,_,Uo,f(oo,f(xa,pa,KC(M([X]))),o));case"ExpandPhase":var te=e.a;return DE(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return DE(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return DE(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(dm,t,Lo,Uo,M([da(Vv(C.parameters.initiatorAddress))]))}return d(dm,t,Lo,Uo,M([pa(f(sl,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return DE(D(t,{txChainStatus:si(f(AE,E,ie))}));case"AbortAction":return DE(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(aE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=tl(l(ih,eh(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(EE)};return f(Ko,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(Xu,i,Vl(fb(C.parameters))),ba)?L(si(CE),n):l(aE,C,E.address,E.commPubkey)}return L(si(CE),n)}(),T=oe.a,w=oe.b;return d(dm,D(t,{txChainStatus:T}),Lo,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,RE)||R(ue,$E)){var se=LE(ue),ce=t;e=se,t=ce;continue e}return DE(D(t,{txChainStatus:si(IE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Uo,M([pa(f(sl,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=tl(Cm(n.creationInfo.address));return x(si(mE($E)),f(Ko,QC($E),a),yr);case"Claim":var a=tl(mm(n.creationInfo.address));return x(si(mE(TE)),f(Ko,QC(TE),a),yr);case"Abort":var a=tl(vm(n.creationInfo.address));return x(si(mE(vE)),f(Ko,QC(vE),a),yr);case"Release":var a=tl(Em(n.creationInfo.address));return x(si(mE(_E)),f(Ko,QC(_E),a),yr);case"Burn":var a=tl(ym(n.creationInfo.address));return x(si(mE(SE)),f(Ko,QC(SE),a),yr);default:var a=tl(jf(n.creationInfo.address));return x(si(mE(RE)),f(Ko,QC(RE),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(dm,D(t,{txChainStatus:T}),Lo,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return DE(D(t,{txChainStatus:si(bE(he))}))}var V=de.a;return d(dm,D(t,{txChainStatus:ci}),Lo,Uo,M([pa(f(_g,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return DE(D(t,{txChainStatus:si(wE(he))}))}var V=de.a;return d(dm,D(t,{txChainStatus:ci}),Lo,Uo,M([pa(f(_g,"commit",V))]));case"CommitMined":return DE(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return DE(D(t,{txChainStatus:si(f(yE,ue,he))}))}var V=de.a;return d(dm,D(t,{txChainStatus:ci}),Lo,Uo,M([pa(f(_g,PE(ue),V))]));case"ActionMined":var ue=e.a;return DE(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(bS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(dm,D(t,{eventSentry:ve}),_,Uo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(YC,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?fE(t):Lo,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(XC(f(cC,r,a)),ci)}return L(Lo,si(f(sl,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Lo,ci)}(),Te=Se.a,we=Se.b;return d(dm,Ee,_o(M([s,Te])),Uo,U(f(Qi,pE,Ce.appCmds),f($c,yr,f(Io,TS,f(Io,pa,we)))))}return d(dm,t,Lo,Uo,M([pa(f(sl,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Gh,sC,oC(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(wo,p,E.address);if("Nothing"===Ne.$)return d(dm,t,Lo,Uo,M([pa(f(sl,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return tl("Initiator"===Re.$?f(bm,p.creationInfo.address,ke):f(Sm,p.creationInfo.address,ke))}();return d(dm,t,Lo,f(Ko,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(dm,t,Lo,Uo,M([pa(f(sl,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(dm,t,Lo,Uo,M([pa(f(sl,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return DE(t)}var V=e.a.a;return d(dm,t,Lo,Uo,M([pa(f(Rg,"message",V))]));default:return d(dm,t,Lo,Uo,M([ga]))}}),IS=r(function(e,t){return{address:e,blocknum:t}}),AS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},BS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(ES,!0,e,t,r))}),kS=n(function(e,t,r){var n=function(e){return r(f(qh,Hm,e).returnData)},a={address:t.address,fromBlock:hS(t.blocknum),toBlock:hS(t.blocknum),topics:M([si(sb("Initiated(string,string)"))])};return l(BS,n,e,a)}),NS=function(e){return{data:si(f(Hf,"numTrades()",yr)),decoder:hu(Vh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},RS=r(function(e,t){return f(Jp,t,f(Up,Wh(e),NS(Zd(e))))}),$S=function(e){return{data:si(f(Hf,"phase()",yr)),decoder:hu(Vh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},_S=n(function(e,t,r){return f(Jp,r,f(Vp,Wb,f(Up,Wh(e),$S(t))))}),LS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),xS=r(function(e,t){return l(La,LS(e),yr,t)}),PS=function(e){return f(xS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},DS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},US=function(e){return f(DS,Ja(hb),Sa(e.trades))},OS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:US(e),loaded:Ti(PS(e))})})},MS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),FS=r(function(e,t){var r=f(Jc,e,t.trades);if("Just"===r.$){var n=(r.a,l(tf,e,hb,t.trades));return l(MS,OS(D(t,{trades:n})),Lo,yr)}return l(MS,t,Lo,M([pa(f(sl,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),VS=n(function(e,t,r){var n=f(Jc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Eb,t,a),o=l(tf,e,i,r.trades);return L(OS(D(r,{trades:o})),yr)}return L(r,M([f(sl,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),KS=n(function(e,t,r){var n=f(Jc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Sb,t,a),o=l(tf,e,i,r.trades);return l(MS,OS(D(r,{trades:o})),Lo,yr)}return l(MS,r,Lo,M([pa(f(sl,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),HS=n(function(e,t,r){var n=f(Jc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(tf,e,pm(D(a,{state:D(i,{phase:t})})),r.trades);return l(MS,OS(D(r,{trades:o})),Lo,yr)}return l(MS,r,Lo,M([pa(f(sl,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(MS,r,Lo,M([pa(f(sl,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),jS=n(function(e,t,r){var n=f(Jc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Tb,t,a),o=l(tf,e,i,r.trades);return l(MS,OS(D(r,{trades:o})),Lo,yr)}return l(MS,r,Lo,M([pa(f(sl,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),qS=n(function(e,t,r){var n=f(Jc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(wb,t,a),o=l(tf,e,i,r.trades);return l(MS,OS(D(r,{trades:o})),Lo,yr)}return l(MS,r,Lo,M([pa(f(sl,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Jc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Ib,t,a),o=l(tf,e,i,r.trades);return l(MS,OS(D(r,{trades:o})),Lo,yr)}return l(MS,r,Lo,M([pa(f(sl,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),zS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),YS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),WS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),JS=function(e){return{$:"NumTradesFetchedAgain",a:e}},QS=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),XS=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),ZS=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),eT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),tT=function(e){return l(MS,e,Lo,yr)},rT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=tC(n),i=aC(f(xa,Vy(t.factory),f(Ai,0,a-1))),o=_o(f(xa,function(e){return l(Xy,t.factory,Ku(e),zS(e))},f(Ai,0,a-1)));return l(MS,D(t,{dataFetchState:l(YS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(MS,t,Lo,M([pa(f(Ng,"Factory numTrades",u))]));case"CheckForNewTrades":return l(MS,t,f(RS,t.factory,JS),yr);case"UpdateTradePhases":var s=_o(KC(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(_S,e.factory,e.creationInfo.address,f(XS,e.factory,e.id)))},PS(t))));return l(MS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(HS,d,p,t),v=function(){var e=L(p,f(Jc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=AS(r);if("Just"===n.$){var a=n.a;return L(l(Zb,c,a.address,eT(d)),yr)}return L(Lo,M([pa(f(sl,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Lo,yr)}e.b;return L(Lo,M([pa(f(sl,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(MS,g.tradeCache,_o(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(MS,t,Lo,M([pa(f(OE,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=tC(n);if(_(C,E)<0){var S=t.dataFetchState,o=_o(f(xa,function(e){return l(Xy,t.factory,Ku(e),zS(e))},f(Ai,C,E-1))),T=aC(f(xa,Vy(t.factory),f(Ai,C,E-1)));return l(MS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(FC,t.trades,T)}),o,yr)}return tT(t)}b.b;return l(MS,t,Lo,M([pa(f(sl,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(MS,t,Lo,M([pa(f(Ng,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(IS,w.address_,tC(w.blocknum)),A=l(kS,t.eventSentry,I,WS(d)),B=A.a,k=A.b,y=_o(M([h(eC,t.factory,I.address,QS(d),eT(d),ZS(d)),k])),N=l(VS,d,I,t),R=N.a,$=N.b;return l(MS,OS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(MS,t,Lo,M([pa(f(Ng,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(MS,t,Lo,M([pa(f(Ng,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(KS,d,P,t)}var U=r.a.a;return l(MS,t,Lo,M([pa(f(sl,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(qS,d,O,t)}return l(MS,t,Lo,M([pa(f(OE,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(jS,d,F,t)}return l(MS,t,Lo,M([pa(f(OE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=_m(V.terms);if("Ok"===K.$){var H=K.a;return l(GS,d,H,t)}var j=K.a;return f(FS,d,t)}var j=r.a;return l(MS,t,Lo,M([pa(f(sl,"Error decoding initiated event",j))]));default:var q=e.a,G=f(bS,q,t.eventSentry),z=G.a,y=G.b;return l(MS,D(t,{eventSentry:z}),y,yr)}}),nT=function(e){return{$:"AgentHistoryMsg",a:e}},aT=function(e){return{$:"AppCmd",a:e}},iT={$:"BetaLandingPage"},oT={$:"ConnectToWeb3"},uT=function(e){return{$:"MarketplaceMsg",a:e}},sT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),cT=r(function(e,t){return f(kn,e,fl(t))}),fT=function(e){return f(cT,"href",tt(e))},lT=Nn("rel"),dT=cT("target"),hT=function(e){return{$:"Height",a:e}},pT=hT,gT={$:"Content"},vT=gT,yT=function(e){return{$:"Width",a:e}},mT=yT,bT=function(e){return{$:"Attr",a:e}},CT=function(e){return{$:"NodeName",a:e}},ET=function(e){return{$:"Unkeyed",a:e}},ST={$:"AsEl"},TT=ST,wT=r(function(e,t){return{$:"Field",a:e,b:t}}),IT=f(wT,0,0),AT={$:"NoNearbyChildren"},BT={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"},kT=BT.any+" "+BT.column,NT=BT.any+" "+BT.grid,RT=BT.any+" "+BT.page,$T=BT.any+" "+BT.paragraph,_T=BT.any+" "+BT.row,LT=BT.any+" "+BT.single,xT=function(e){switch(e.$){case"AsRow":return _T;case"AsColumn":return kT;case"AsEl":return LT;case"AsGrid":return NT;case"AsParagraph":return $T;default:return RT}},PT=function(e){return{$:"Keyed",a:e}},DT={$:"NoStyleSheet"},UT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),OT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),MT={$:"AsParagraph"},FT=MT,VT=Sn("div"),KT=Sn("p"),HT=Sn("s"),jT=Sn("u"),qT=cT("className"),GT=function(e){return wn(Xe(e))},zT=function(e){return Sn(Xe(e))},YT=function(e){return{$:"Flag",a:e}},WT=function(e){return{$:"Second",a:e}},JT=function(e){return e>31?WT(1< .ctr > ."+BT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",Qw="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+mw(BT.any)+mw(BT.row)+" > "+mw(BT.any)+" { flex-basis: auto !important; } "+mw(BT.any)+mw(BT.row)+" > "+mw(BT.any)+mw(BT.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"+Jw,Xw=function(e){return{$:"Intermediate",a:e}},Zw=r(function(e,t){return Xw({closing:t,others:yr,props:yr,selector:e})}),eI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,Xw({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(eI,f(Zw,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(eI,f(Zw,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(eI,f(Zw,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(eI,f(Zw,n.selector,""),v),t.others)})}});return Xw(l(La,a,n,t))}),tI=U(Qw,function(e){var t=function(e){return yd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),yd(f(xa,a,t.others)))};return yd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(eI,f(Zw,r,""),n),t)}),yr,e)))}(U(zw,Ww))),rI=l(zT,"style",yr,M([Cw(tI)])),nI=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+'"'}},aI=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}},iI=function(e){if("FontWith"===e.$){var t=e.a;return f(yh,aI,t.variants)}return!1},oI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),uI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),sI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(uI,"."+e+"."+t+", ."+e+" ."+t,n),f(uI,"."+e+"."+t+"> ."+BT.text+", ."+e+" ."+t+" > ."+BT.text,a)])}),cI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(sI,i,BT.sizeByCapital,a),l(sI,i,BT.fullSize,n)))}),fI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(uI,"."+r+"."+BT.sizeByCapital+", ."+r+" ."+BT.sizeByCapital,M([L("line-height","1")])),f(uI,"."+r+"."+BT.sizeByCapital+"> ."+BT.text+", ."+r+" ."+BT.sizeByCapital+" > ."+BT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),lI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},dI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Cc,t,r))}return ci},hI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),pI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f($c,e.descender,dI(t)),n=f($c,e.baseline,dI(f(gl,function(e){return!R(e,r)},t))),a=f($c,e.capital,lI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(hI,i,a-n,o),full:l(hI,u,a-r,s)}},gI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",gw(e.height)),L("vertical-align",gw(e.vertical)+"em"),L("font-size",gw(e.size)+"em")]))},vI=function(e){return l(Ra,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 si(L(gI(function(e){return e.full}(pI(a))),gI(function(e){return e.capital}(pI(a)))))}return t}return t}),ci,e)},yI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(xS,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=vI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,fI(t),n));var i=a.a;return f(Ri,"",f(xa,f(cI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},mI=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+'" '+Ni(r)}},bI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,mI,t.variants)))}return ci},CI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},EI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+gw(r)+"px, "+gw(n)+"px, "+gw(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("+gw(o)+"px, "+gw(u)+"px, "+gw(s)+"px)",b="scale3d("+gw(f)+", "+gw(l)+", "+gw(d)+")",C="rotate3d("+gw(p)+", "+gw(g)+", "+gw(v)+", "+gw(y)+"rad)";return si(m+" "+b+" "+C)}},SI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,oI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,oI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,oI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,oI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+BT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+BT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+BT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,oI(!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,M([f(hw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Cc,1,1-c));return l(a,t,"."+u,M([f(hw,"opacity",gw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(hw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(xS,bI,p)),v=M([f(hw,"font-family",f(Ri,", ",f(xa,nI,p))),f(hw,"font-feature-settings",g),f(hw,"font-variant",f(yh,iI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(hw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(hw,s,vw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+BT.row,A="."+(BT.wrapped+I),B="."+BT.alignRight,k="."+BT.paragraph,N="."+BT.page,R="."+BT.alignLeft,$=gw(S/2)+"px",_=gw(E/2)+"px",x="."+BT.column,y="."+C,P="."+BT.any;return yd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(hw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(hw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(hw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(hw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(hw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(hw,"margin-left",w)])),l(a,t,U(y,k),M([f(hw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(hw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(hw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(hw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(hw,"content","''"),f(hw,"display","block"),f(hw,"height","0"),f(hw,"width","0"),f(hw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(hw,"content","''"),f(hw,"display","block"),f(hw,"height","0"),f(hw,"width","0"),f(hw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(hw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(hw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,sw,F.rows))+"-cols-"+f(Ri,"-",f(xa,sw,F.columns))+"-space-x-"+sw(F.spacing.a)+"-space-y-"+sw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=EI(ne),y=fw(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,M([f(hw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=CI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(yI(s),c)}),TI=r(function(e,t){return l(zT,"style",yr,M([Cw(f(SI,e,t))]))}),wI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",rI),f(ka,L("dynamic-stylesheet",f(TI,t,l(Ra,dw,L(im,M([bw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(TI,t,l(Ra,dw,L(im,M([bw(t.focus)])),r).b)),n)}),II=a(function(e,t,r,n){return e?f(ka,rI,f(ka,f(TI,t,l(Ra,dw,L(im,M([bw(t.focus)])),r).b),n)):f(ka,f(TI,t,l(Ra,dw,L(im,M([bw(t.focus)])),r).b),n)}),AI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(GT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(wI,!1,e,t,r);default:var e=i.a,t=i.b;return d(wI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return VT;case"p":return KT;default:return zT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(II,!1,e,t,n);default:var e=i.a,t=i.b;return d(II,!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(zT,e,n,M([f(u,r,M([qT(BT.any+" "+BT.single)]))]))}}();switch(o.$){case"AsRow":return f(nw,iw,e)&&!f(nw,aw,e)?s:f(nw,XT,e)?f(jT,M([qT(f(Ri," ",M([BT.any,BT.single,BT.container,BT.contentCenterY,BT.alignContainerRight])))]),M([s])):f(nw,ZT,e)?f(HT,M([qT(f(Ri," ",M([BT.any,BT.single,BT.container,BT.contentCenterY,BT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(nw,rw,e)&&!f(nw,tw,e)?s:f(nw,ew,e)?f(HT,M([qT(f(Ri," ",M([BT.any,BT.single,BT.container,BT.alignContainerCenterY])))]),M([s])):f(nw,QT,e)?f(jT,M([qT(f(Ri," ",M([BT.any,BT.single,BT.container,BT.alignContainerBottom])))]),M([s])):s;default:return s}}),BI=Cw,kI=function(e){return f(VT,M([qT(f(Ri," ",M([BT.any,BT.text,BT.widthContent,BT.heightContent])))]),M([BI(e)]))},NI=function(e){return l(zT,"div",M([qT(f(Ri," ",M([BT.any,BT.text,BT.widthFill,BT.heightFill])))]),M([Cw(e)]))},RI=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 R(e,FT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,FT),L(f(ka,L(n,f(s.html,DT,e)),i),Su(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,TT)?NI(c):kI(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 R(e,FT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,FT),L(f(ka,f(o.html,DT,e),n),Su(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,TT)?NI(u):kI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Su(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(AI,n.has,n.node,n.attributes,PT(l(OT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(AI,n.has,n.node,n.attributes,PT(l(OT,"nearby-element-pls",s,n.children)),DT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Su(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(AI,n.has,n.node,n.attributes,ET(f(UT,m,n.children))),styles:g})}return Gi(h(AI,n.has,n.node,n.attributes,ET(f(UT,m,n.children)),DT))}),$I=r(function(e,t){return f(Nn,Ze(e),rt(t))}),_I=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(wT,a|r,n)}var i=e.a;return f(wT,r,i|n)}),LI=JT(7),xI=JT(36),PI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(wT,r|a,n|i)}),DI=JT(6),UI=JT(38),OI=JT(30),MI=JT(29),FI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),VI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),KI=function(e){return{$:"Transform",a:e}},HI=function(e){return{$:"ChildrenBehind",a:e}},jI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),qI=function(e){return{$:"ChildrenInFront",a:e}},GI=r(function(e,t){return f(VT,M([qT(function(){switch(e.$){case"Above":return f(Ri," ",M([BT.nearby,BT.single,BT.above]));case"Below":return f(Ri," ",M([BT.nearby,BT.single,BT.below]));case"OnRight":return f(Ri," ",M([BT.nearby,BT.single,BT.onRight]));case"OnLeft":return f(Ri," ",M([BT.nearby,BT.single,BT.onLeft]));case"InFront":return f(Ri," ",M([BT.nearby,BT.single,BT.inFront]));default:return f(Ri," ",M([BT.nearby,BT.single,BT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Cw("");case"Text":var e=t.a;return kI(e);case"Unstyled":return(0,t.a)(TT);default:return f(t.a.html,DT,TT)}}()]))}),zI=n(function(e,t,r){var n=f(GI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?HI(M([n])):qI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?HI(f(ka,n,a)):f(jI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(jI,M([n]),i):qI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(jI,f(ka,n,a),i):f(jI,a,f(ka,n,i))}}),YI=r(function(e,t){switch(t.$){case"Generic":return CT(e);case"NodeName":var r=t.a;return f(FI,r,e);default:var n=t.a,a=t.b;return f(FI,n,a)}}),WI=function(e){switch(e.$){case"Left":return BT.alignedHorizontally+" "+BT.alignLeft;case"Right":return BT.alignedHorizontally+" "+BT.alignRight;default:return BT.alignedHorizontally+" "+BT.alignCenterX}},JI=function(e){switch(e.$){case"Top":return BT.alignedVertically+" "+BT.alignTop;case"Bottom":return BT.alignedVertically+" "+BT.alignBottom;default:return BT.alignedVertically+" "+BT.alignCenterY}},QI=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),XI=function(e){return{$:"Moved",a:e}},ZI=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return XI(x(r,0,0));case"MoveY":var n=t.a;return XI(x(0,n,0));case"MoveZ":var a=t.a;return XI(x(0,0,a));case"MoveXYZ":var i=t.a;return XI(i);case"Rotate":var i=t.a,o=t.b;return d(QI,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(QI,x(0,0,0),i,x(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 XI(x(s,n,a));case"MoveY":var c=t.a;return XI(x(r,c,a));case"MoveZ":var f=t.a;return XI(x(r,n,f));case"MoveXYZ":var i=t.a;return XI(i);case"Rotate":var i=t.a,o=t.b;return d(QI,u,x(1,1,1),i,o);default:var l=t.a;return d(QI,u,l,x(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(QI,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(QI,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(QI,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(QI,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(QI,u,h,v,y);default:var m=t.a;return d(QI,u,m,p,o)}}}),eA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(IT,n,M([l(VI,n,"height",r+"px")]));case"Content":return x(f(_I,xI,IT),BT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(_I,rw,IT),BT.heightFill,yr):x(f(_I,rw,IT),BT.heightFillPortion+" height-fill-"+Ni(a),M([l(VI,BT.any+"."+BT.row+" > "+mw("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(VI,u,"min-height",Ni(i)+"px"),c=eA(o),d=c.a,h=c.b,p=c.c;return x(f(_I,tw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(VI,u,"max-height",Ni(g)+"px"),v=eA(o),d=v.a,h=v.b,p=v.c;return x(f(_I,tw,d),u+" "+h,f(ka,s,p))}},tA=function(e){switch(e.$){case"Px":var t=e.a;return x(IT,BT.widthExact+" width-px-"+Ni(t),M([l(VI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(_I,UI,IT),BT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(_I,iw,IT),BT.widthFill,yr):x(f(_I,iw,IT),BT.widthFillPortion+" width-fill-"+Ni(r),M([l(VI,BT.any+"."+BT.row+" > "+mw("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(VI,i,"min-width",Ni(n)+"px"),u=tA(a),s=u.a,c=u.b,d=u.c;return x(f(_I,aw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(VI,i,"max-width",Ni(h)+"px"),p=tA(a),s=p.a,c=p.b,d=p.c;return x(f(_I,aw,s),i+" "+c,f(ka,o,d))}},rA=JT(27),nA=r(function(e,t){if(R(e,rA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),aA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=fw(n);if("Nothing"===s.$)return{attributes:f(ka,qT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,qT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,KI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(nw,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(_I,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(nw,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(nA,S,I)){var p=lw(I)+" "+e,g=t,v=f(_I,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=lw(I)+" "+e,g=t,v=f(_I,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(_I,S,r),y=f(ZI,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(nw,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=BT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(_I,DI,r),y=n,m=f(ka,l(VI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+BT.widthContent,g=t,v=f(_I,UI,f(_I,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+BT.widthFill,g=t,v=f(_I,iw,f(_I,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+BT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(_I,iw,f(_I,DI,r)),y=n,m=f(ka,l(VI,BT.any+"."+BT.row+" > "+mw("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=tA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(PI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(nw,LI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(_I,LI,r),y=n,m=f(ka,l(VI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=BT.heightContent+" "+e,g=t,v=f(_I,xI,f(_I,LI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=BT.heightFill+" "+e,g=t,v=f(_I,rw,f(_I,LI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+BT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(_I,rw,f(_I,LI,r)),y=n,m=f(ka,l(VI,BT.any+"."+BT.column+" > "+mw("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=eA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(PI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(YI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(YI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(YI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(YI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(YI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(YI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(YI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return CT("p");case"NodeName":var e=t.a;return CT(e);default:var r=t.a,n=t.b;return f(FI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f($I,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f($I,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f($I,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f($I,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(zI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(nw,OI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=WI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(_I,ZT,e);case"Right":return f(_I,XT,e);default:return e}}(f(_I,OI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(nw,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=JI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(_I,ew,e);case"Bottom":return f(_I,QT,e);default:return e}}(f(_I,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),iA={$:"Untransformed"},oA=iA,uA=a(function(e,t,r,n){return l(RI,e,n,v(aA,xT(e),t,IT,oA,yr,yr,AT,$a(r)))}),sA=function(e){return bT(qT(e))},cA=r(function(e,t){var r=t.url,n=t.label;return d(uA,TT,CT("a"),f(ka,bT(fT(r)),f(ka,bT(lT("noopener noreferrer")),f(ka,bT(dT("_blank")),f(ka,mT(vT),f(ka,pT(vT),f(ka,sA(BT.contentCenterX+" "+BT.contentCenterY),e)))))),ET(M([n])))}),fA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),lA=n(function(e,t,r){return d(fA,e,t,r,1)}),dA=JT(14),hA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),pA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),gA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return cw(t)+"-"+cw(r)+"-"+cw(n)+"-"+cw(a)},vA=function(e){return f(pA,dA,l(hA,"fc-"+gA(e),"color",e))},yA={align:al,label:"cantConnectNoWeb3",mainParagraphs:M([M([ul("You need a web3 provider (such as "),f(cA,M([vA(l(lA,0,0,1))]),{label:ul("Metamask"),url:"https://metamask.io/"}),ul(") to Connect.")]),M([ul("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:$g},mA={align:al,label:"invalidUrl",mainParagraphs:M([M([ul("I don't understand that URL...")]),M([ul("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:kg},bA=function(e){return{$:"Active",a:e}},CA=du(f(jo,Vf,f(jo,Fh,kd("Error decoding hex to BigInt")))),EA=function(){return du(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),SA=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}}}}}}}}}}}},TA=function(e){return YE(M([f(Oi,si,e),Fi(ci)]))},wA=f(ch,TA(f(Ph,"status",EA)),f(ch,TA(f(Ph,"root",lu)),l(XE,"logsBloom",lu,l(XE,"logs",$m(cS),f(ch,TA(f(Ph,"contractAddress",ZE)),l(XE,"cumulativeGasUsed",CA,l(XE,"gasUsed",CA,l(XE,"blockNumber",Hy,l(XE,"blockHash",nS,l(XE,"transactionIndex",Hy,l(XE,"transactionHash",oS,Fi(SA)))))))))))),IA=function(e){var t=e.a;return Vf(t)},AA=f(jo,IA,fl),BA=r(function(e,t){return xp({decoder:wA,method:"eth_getTransactionReceipt",params:M([AA(t)]),url:e})}),kA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),NA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),RA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),$A=r(function(e,t){return f(Io,function(e){return e.toMsg},f(To,function(e){return e.b},f(To,function(e){return e.onMinedTagger},f(up,t,e))))}),_A=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(f){return{blockHash:r,blockNumber:n,from:i,gas:c,gasPrice:s,hash:e,input:f,nonce:t,to:o,transactionIndex:a,value:u}}}}}}}}}}}},LA=function(e){return YE(M([zE(ci),f(Oi,si,e)]))},xA=l(XE,"input",lu,l(XE,"gas",Hy,l(XE,"gasPrice",CA,l(XE,"value",CA,l(XE,"to",LA(ZE),l(XE,"from",ZE,l(XE,"transactionIndex",Hy,l(XE,"blockNumber",LA(Hy),l(XE,"blockHash",function(e){return f(cu,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},ou(t))?Fi(ci):f(Oi,si,e)},lu)}(nS),l(XE,"nonce",Hy,l(XE,"hash",oS,Fi(_A)))))))))))),PA=r(function(e,t){return xp({decoder:xA,method:"eth_getTransactionByHash",params:M([AA(t)]),url:e})}),DA=r(function(e,t){return{attempts:e,sleep:t}}),UA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Wp,function(e){return a>0?f(Mp,function(e){return f(UA,f(DA,a,n),t)},qE(1e3*n)):Rp(e)},t)}),OA=r(function(e,t){return f(Mp,function(r){return f(UA,{attempts:30,sleep:1},f(PA,e,t))},qE(250))}),MA=r(function(e,t){return f(UA,{attempts:60,sleep:5},f(BA,e,t))}),FA=function(e){return{$:"Mined",a:e}},VA=function(e){return Io(function(t){return D(t,{status:FA(e)})})},KA=function(e){return{$:"Sent",a:e}},HA=function(e){return Io(function(t){return D(t,{status:KA(e)})})},jA=function(e){return{$:"Signed",a:e}},qA=function(e){return Io(function(t){return D(t,{status:jA(e)})})},GA=function(e){return"Nothing"!==e.$},zA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Cl(r),Lo);case"TxSigned":var n=e.a,a=e.b,i=f(up,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(qg,t,$p(a))}return Lo}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Lo;if("Just"===t.b.$){var r=t.b.a;return f(qg,r,$p(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(qg,a,$p(fi(e)))}t.a,t.b,t.c;return Lo};if("Ok"===a.$){var c=a.a,d=GA(o.onBroadcastTagger)||GA(o.onMinedTagger)?f(rl,r.tagger,f(Jp,RA(n),f(OA,r.nodePath,c))):Lo;return L(Cl(D(r,{txs:l(vp,n,qA(c),r.txs)})),_o(M([u,d])))}var h=a.a;return L(Cl(r),_o(M([u,s(h)])))}return L(Cl(r),Lo);case"TxSent":var n=e.a,p=e.b,g=f(up,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(rl,r.tagger,f(Jp,NA(n),f(MA,r.nodePath,v.hash))):Lo}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(qg,t,$p(li(v)))}return Lo}();return L(Cl(D(r,{txs:l(vp,n,HA(v),r.txs)})),_o(M([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(qg,t,$p(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(qg,n,$p(fi("Error with TxSent stuff")))}e.a,e.b;return Lo}();return L(Cl(r),s)}return L(Cl(r),Lo);case"TxMined":var n=e.a,m=e.b,b=f(up,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(qg,a,$p(li(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 _o(M([f(rl,r.tagger,f(Jp,f(kA,n,s),jy(r.nodePath))),f(qg,a,$p(li(C))),f(qg,u.toMsg,$p(s))]))}return Lo}();return L(Cl(D(r,{txs:l(vp,n,VA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(qg,r,$p(fi("TxReceipt decoding failure")))}return Lo}();return L(Cl(r),S)}return L(Cl(r),Lo);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f($A,r.txs,n);if("Just"===A.$){var B=A.a;return L(Cl(r),f(qg,B,f(Wp,function(e){return $p(D(I,{doneWatching:!0,reOrg:!0}))},f(Mp,function(e){return $p(D(I,{doneWatching:!0}))},f(BA,r.nodePath,T.txHash)))))}return L(Cl(r),Lo)}if(R(w,T.lastCheckedBlock))return L(Cl(r),f(rl,r.tagger,f(Jp,f(kA,n,T),f(Mp,function(e){return jy(r.nodePath)},qE(2e3)))));var k=f($A,r.txs,n);if("Just"===k.$){var B=k.a;return L(Cl(r),_o(M([f(rl,r.tagger,f(Jp,f(kA,n,I),f(Mp,function(e){return jy(r.nodePath)},qE(2e3)))),f(qg,B,$p(I))])))}return L(Cl(r),Lo)}var n=e.a,h=e.c.a;return L(Cl(r),Lo);default:var h=e.a;return L(Cl(r),Lo)}}),YA=Jt,WA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),JA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),QA=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(JA,"#",e.fragment,l(JA,"?",e.query,U(f(WA,e.port_,U(t,e.host)),e.path)))},XA=r(function(e,t){return e<0?ci:Yl(f(ed,e,t))}),ZA=r(function(e,t){if(e<0)return t;var r=wh(f(ed,e,t)),n=f(sc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),eB=n(function(e,t,r){if(e<0)return r;var n=f(ed,e,r),a=f(sc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),tB=r(function(e,t){return f(eB,e,gs(t))}),rB=r(function(e,t){Mv(t);switch(t.$){case"Home":return L(D(e,{submodel:iT}),Lo);case"Create":var r=Wd(e.wallet),n=f(xl,e.txSentry,f(qo,xy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(aB,U(f(Qi,xy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Ly(r.model),txSentry:a}),_o(M([f(rl,xy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(wy,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(gm,e.wallet,r)}return l(hm,e.wallet,u,s)}(),c=f(xl,e.txSentry,f(qo,Uy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(aB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),_o(M([f(rl,Uy,r.cmd),i]))));case"Marketplace":var d=wv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Py(h)}),_o(M([f(rl,uT,p)])));case"AgentHistory":var g=t.a,v=f(xo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:_y(y)}),_o(M([f(rl,nT,m)])));default:return L(f(uo,mA,e),Lo)}}),nB=r(function(e,t){var r=t.a,n=t.b,a=f(iB,aT(e),r),i=a.a,o=a.b;return L(i,_o(M([n,o])))}),aB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,nB,L(r,n),e)}),iB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(iB,oT,t);case"GotoRoute":var n=r.a;return L(t,f(yy,t.key,n));case"GTag":var a=r.a;return L(t,Ey(by(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),Ey(by(d(Pl,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(xv,Iy,o,u,s));default:return L(t,Ay(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(ZA,c,t.userNotices)}),Lo);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(vy,t.key,QA(e))}var r=h.a;return YA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(oB,g,t);case"GotoRoute":var v=e.a;return L(t,_o(M([Ey(by(d(Pl,"GotoRoute","navigation",Mv(v),0))),f(yy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Lo);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,yA,t),Lo):L(t,my(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Lo;var t=e.a;return Sy(f(Cy,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Hh,lu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=bA(l(Dl,I,w,S)),B=f(Oy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(sl,"Unexpected wallet state encounted when setting commPubkey!",ci),t),Lo)}T.a;return L(f(uo,f(sl,"User pubkey set, but I can no longer find the user address!",ci),t),Lo)}var N=E.a;return L(l(Pa,uo,f(sl,"error decoding commPubkey from JS",N),t),Lo);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(sv,R,_),P=f(xl,t.txSentry,f(qo,xy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(aB,U(f(Qi,xy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Ly(x.model),txSentry:O}),_o(M([f(rl,xy,x.cmd),F]))))}return L(t,Lo);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(wS,K,j),q=f(xl,t.txSentry,f(qo,Uy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(aB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),_o(M([f(rl,Uy,x.cmd),F]))))}return L(t,Lo);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Lv,G,Y);return f(aB,f(Qi,uT,x.appCmds),L(D(t,{submodel:Py(x.model)}),f(rl,uT,x.cmd)))}return L(t,Lo);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(nl,W,Q),X=f(xl,t.txSentry,f(qo,nT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(aB,U(f(Qi,nT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:_y(x.model),txSentry:O}),_o(M([f(rl,nT,x.cmd),F]))))}return L(t,Lo);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(Nu,si,f(zA,Z,r))}return L(ci,Lo)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(XA,re,t.tradeCaches);if("Nothing"===ae.$)return f(nB,pa(f(sl,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Lo));var ie=ae.a,x=f(rT,ne,ie);return L(D(t,{tradeCaches:l(tB,re,x.tradeCache,t.tradeCaches)}),f(rl,sT(re),x.cmd));case"NoOp":return L(t,Lo);default:var N=e.a;f(ol,"test",N);return L(t,Lo)}}),oB=r(function(e,t){return f(rB,t,gy(e))}),uB=Ge("txIn",WE),sB=je("txOut",Ua),cB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},fB=function(e){return{$:"EventSentryMsg",a:e}},lB=function(e){var t=f(om,fB,Wh(e)),r=t.a,n=t.b;return x({dataFetchState:l(YS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Jd,"tradeCache init","processing",cB(e),0)]))},dB=function(e){return{$:"InitialNumTradesFetched",a:e}},hB=function(e){return f(RS,e.factory,dB)},pB=function(e){var t=lB(e),r=t.a,n=t.b,a=t.c;return x(r,_o(M([n,hB(r)])),a)},gB=function(e){return{$:"TxSentryMsg",a:e}},vB={align:al,label:"noWeb3Provider",mainParagraphs:M([M([ul("No web3 provider detected. Is "),f(cA,M([vA(l(lA,0,0,1))]),{label:ul("Metamask"),url:"https://metamask.io/"}),ul(" or some other web3 provider installed and unlocked?")])]),noticeType:$g},yB={$:"TopLeft"},mB={align:yB,label:"screenToSmall",mainParagraphs:M([M([ul("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:$g},bB={align:al,label:"wrongWeb3Network",mainParagraphs:M([M([ul("Your wallet is set to an incorrect network.")]),M([ul("Switch to Ethereum mainnet, Ethereum test, Rootstock, or xDai.")])]),noticeType:kg},CB={$:"NoneDetected"},EB=function(e){return{$:"OnlyNetwork",a:e}},SB=function(e){return f(Io,Wh,Dg(e))},TB={$:"ETCMain"},wB={$:"ETCTest"},IB={$:"Expanse"},AB={$:"Kovan"},BB={$:"Mainnet"},kB=function(e){return{$:"Private",a:e}},NB={$:"Rinkeby"},RB={$:"Ropsten"},$B={$:"RskMain"},_B={$:"RskTest"},LB=function(e){switch(e){case 1:return BB;case 2:return IB;case 3:return RB;case 4:return NB;case 30:return $B;case 31:return _B;case 42:return AB;case 41:return TB;case 62:return wB;default:return kB(e)}},xB=n(function(e,t,r){var n=e.a,a=e.b;return Cl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:op})}),PB=n(function(e,t,n){var a=e.networkId?EB(LB(e.networkId)):CB,i=f(Io,function(e){return l(xB,L(sB,uB),gB,e)},SB(a)),o=e.width<1024?si(mB):ci,u=f(xa,pB,ro),s=function(){return R(a,CB)?si(vB):"Nothing"===Dg(a).$?si(bB):ci}(),c=KC(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ty(f(Bi,r(function(e,t){return f(Qi,sT(e),t)}),g)),y=_o(f(Bi,r(function(e,t){return f(rl,sT(e),t)}),p)),m=f(aB,v,f(oB,t,{key:n,screenWidth:e.width,submodel:iT,time:Ol(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),_o(M([y,C])))}),DB=Oe,UB=DB(yr),OB=function(e){return UB},MB=function(e){return{$:"Refresh",a:e}},FB=r(function(e,t){return{$:"Every",a:e,b:t}}),VB=r(function(e,t){return{processes:t,taggers:e}}),KB=$p(f(VB,op,op)),HB=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(vS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),jB=Ne,qB=r(function(e,t){var r=e.a,n=e.b,a=f(up,r,t);if("Nothing"===a.$)return l($l,r,M([n]),t);var i=a.a;return l($l,r,f(ka,n,i),t)}),GB=Be,zB=r(function(e,t){return{$:"Zone",a:e,b:t}}),YB=ca,WB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=GB(f(YB,n,f(bp,e,n)));return f(Mp,function(t){return l(WB,e,a,l($l,n,t,r))},i)}return $p(r)}),JB=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 x(n,a,f(Mp,function(e){return i},jB(t)))}),u=l(Ra,qB,op,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l($l,e,r,i),o)}),d=p(HB,s,c,o,u,i,x(yr,op,$p(gr))),h=d.a,g=d.b,v=d.c;return f(Mp,function(e){return $p(f(VB,u,e))},f(Mp,function(t){return l(WB,e,h,g)},v))}),QB=function(e){return we(function(t){t(Se(e(Date.now())))})}(Ol),XB=n(function(e,t,r){var n=f(up,t,r.taggers);if("Nothing"===n.$)return $p(r);var a=n.a,i=function(t){return Hp(f(xa,function(r){return f(mp,e,r(t))},a))};return f(Mp,function(e){return $p(r)},f(Mp,i,QB))}),ZB=r(function(e,t){var r=t.a,n=t.b;return f(FB,r,f(Da,e,n))});pn.Time=Pe(KB,JB,XB,0,ZB);var ek=Ue("Time"),tk=r(function(e,t){return ek(f(FB,e,t))}),rk=function(e){return f(tk,2e3,MB)},nk=function(e){return UB},ak=function(e){return{$:"DecryptionFinished",a:e}},ik=Ge("decryptionFinished",WE),ok=Ge("encryptionFinished",WE),uk=function(e){return{$:"EncryptionFinished",a:e}},sk=function(e){return{$:"Refresh",a:e}},ck=function(e){return DB(M([f(tk,3e3,sk),ok(uk),ik(function(e){return pE(ak(e))})]))},fk=yn,lk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return UB;case"CreateModel":t.a;return f(fk,xy,rk());case"TradeModel":t.a;return f(fk,Uy,ck());case"MarketplaceModel":t.a;return f(fk,uT,nk());default:t.a;return f(fk,nT,OB())}},dk=Ge("userPubkeyResult",WE),hk=Ge("walletSentryPort",WE),pk={$:"CheckForNewTrades"},gk={$:"UpdateTradePhases"},vk=function(e){return DB(M([f(tk,5e3,function(e){return pk}),f(tk,3e3,function(e){return gk})]))},yk=function(e){return{$:"Tick",a:e}},mk=function(e){return{$:"UserPubkeySet",a:e}},bk=function(e){return{$:"WalletStatus",a:e}},Ck=function(e){return f(sl,"Error decoding JS walletSentry: "+e,ci)},Ek=function(e){return{$:"ErrorDecoding",a:e}},Sk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Tk=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Ph,"ref",jC),f(Ph,"txHash",TA(oS))),wk=function(e){var t=f(Hh,Tk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Sk,r.ref,li(a))}return f(Sk,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return Ek("Error decoding tx data")},Ik=function(e){var t=e.a;return f(fk,t.tagger,t.inPort(wk))},Ak=f(Oi,LB,jC),Bk=du(f(jo,Zl,f(jo,kd("Failure decoding stringy int"),tu(LB)))),kk=YE(M([Bk,Ak])),Nk=r(function(e,t){return{account:e,networkId:t}}),Rk=l(Mi,Nk,f(Ph,"account",TA(ZE)),f(Ph,"networkId",kk)),$k=n(function(e,t,r){var n=f(Hh,Rk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),_k=function(e){var t=f(jo,Ck,f(jo,pa,aT));return DB(U(M([f(tk,1e3,yk),hk(f($k,t,bk)),f($c,UB,f(Io,Ik,e.txSentry)),dk(mk),DB(f(Bi,r(function(e,t){return f(fk,sT(e),t)}),f(xa,vk,e.tradeCaches)))]),M([lk(e)])))},Lk=function(e){return{$:"LinkClicked",a:e}},xk=function(e){return{$:"UrlChanged",a:e}},Pk=n(function(e,t,r){return d(fA,e/255,t/255,r/255,1)}),Dk=l(Pk,10,33,108),Uk={$:"Generic"},Ok=Uk,Mk=r(function(e,t){return d(uA,TT,Ok,f(ka,mT(vT),f(ka,pT(vT),e)),ET(M([t])))}),Fk=function(e){return{$:"Fill",a:e}},Vk=Fk(1),Kk=Hi,Hk=function(e){return{$:"Px",a:e}},jk=Hk,qk=JT(8),Gk=function(e){return f(pA,qk,l(hA,"bg-"+gA(e),"background-color",e))},zk=f(Mk,M([mT(Vk),pT(jk(150)),Gk(Dk)]),Kk),Yk=function(e){return{$:"GotoRoute",a:e}},Wk={$:"Active"},Jk={$:"Important"},Qk={$:"Normal"},Xk=l(lA,1,1,1),Zk=JT(2),eN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),tN=r(function(e,t){return R(e,t)?f(pA,Zk,h(eN,"p-"+Ni(e),e,e,e,e)):f(pA,Zk,h(eN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),rN=JT(21),nN=r(function(e,t){return{$:"Class",a:e,b:t}}),aN=f(nN,rN,BT.cursorPointer),iN=JT(17),oN=function(e){return f(pA,iN,l(VI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},uN=function(e){return{$:"Normal",a:e}},sN=An,cN=r(function(e,t){return f(sN,e,uN(t))}),fN=function(e){return f(cN,"click",Fi(e))},lN=f(Da,bT,fN),dN=JT(13),hN=f(nN,dN,BT.textSemiBold),pN=JT(4),gN=function(e){return{$:"FontSize",a:e}},vN=function(e){return f(pA,pN,gN(e))},yN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([oN(4),Gk(l(lA,0,0,1))]);default:return M([oN(4),Gk(l(lA,.9,0,0))])}}();return f(Mk,U(M([f(tN,23,12),vN(22),hN,vA(Xk),aN,lN(t)]),n),ul(e))}),mN=l(Pk,244,0,103),bN=function(e){return{$:"AlignX",a:e}},CN={$:"CenterX"},EN=bN(CN),SN=JT(3),TN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),wN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),IN=function(e){return f(pA,SN,l(TN,f(wN,e,e),e,e))},AN=function(e){return{$:"Describe",a:e}},BN={$:"Paragraph"},kN=r(function(e,t){return d(uA,FT,Ok,f(ka,AN(BN),f(ka,mT(Vk),f(ka,IN(5),e))),ET(t))}),NN=f(nN,dN,BT.bold),RN=f(Mk,M([vN(29),vA(Xk),NN,EN,aN,lN(Yk(Hv))]),f(kN,yr,M([ul("DAI"),f(Mk,M([vA(mN)]),ul("Hard"))]))),$N={$:"Right"},_N=bN($N),LN={$:"AsColumn"},xN=LN,PN=r(function(e,t){return d(uA,xN,Ok,f(ka,sA(BT.contentTop+" "+BT.contentLeft),f(ka,pT(vT),f(ka,mT(vT),e))),ET(t))}),DN={$:"AsRow"},UN=DN,ON=r(function(e,t){return d(uA,UN,Ok,f(ka,sA(BT.contentLeft+" "+BT.contentCenterY),f(ka,mT(vT),f(ka,pT(vT),e))),ET(t))}),MN=function(e){return f(ON,M([mT(Vk),IN(30),f(tN,30,17)]),M([l(yN,"Browse Offers",Yk(jv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Wk}return Qk}()),l(yN,"Create a New Offer",Yk(Kv),function(){return"CreateModel"===e.submodel.$?Wk:Qk}()),function(){var t=Hd(e.wallet);if("Just"===t.$){var r=t.a;return l(yN,"My Trades",Yk(Vv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Wk:Qk}return Qk}())}return l(yN,"Connect to Wallet",oT,Jk)}(),f(PN,M([_N,IN(0),f(tN,8,0)]),M([RN]))]))},FN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},VN=function(e){return gl(e)},KN=function(e){return f(gl,function(e){return db(e.parameters)},PS(e))},HN={$:"BurnWindow"},jN={$:"FiatPrice"},qN={$:"Margin"},GN={$:"Offer"},zN={$:"PaymentWindow"},YN=function(e){return{$:"AlignY",a:e}},WN={$:"CenterY"},JN=YN(WN),QN=JT(20),XN=f(nN,QN,BT.clip),ZN=Fk,eR=function(e){return f(pA,Zk,h(eN,"p-"+Ni(e),e,e,e,e))},tR=r(function(e,t){return f(Mk,M([mT(ZN(e)),pT(jk(60)),XN,Gk(Xk)]),f(Mk,M([eR(12),JN,mT(Vk)]),t))}),rR=function(e){switch(e.$){case"Phase":return 1;case"Expires":return 2;case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},nR=function(e){return{$:"JustImage",a:e}},aR=nR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),iR=cT("alt"),oR=function(e){return f(cT,"src",rt(e))},uR=r(function(e,t){var r=t.src,n=t.description,a=f(gl,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(uA,TT,Ok,f(ka,sA(BT.imageContainer),e),ET(M([d(uA,TT,CT("img"),U(M([bT(oR(r)),bT(iR(n))]),a),ET(yr))])))}),sR=r(function(e,t){if("None"===t.$)return Kk;var r=t.a;return f(uR,e,r)}),cR=nR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),fR=function(e){return{$:"ChangeSort",a:e}},lR=f(nN,dN,BT.textMedium),dR=function(e){return f(Mk,M([lR,vN(17)]),ul(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},hR=r(function(e,t){return f(ON,M([IN(5),aN,lN(fR(e))]),M([dR(e),function(){if("Just"===t.$){var e=t.a;return f(Mk,M([JN]),f(sR,M([mT(jk(8))]),function(){return"Ascending"===e.$?cR:aR}()))}return Kk}()]))}),pR=r(function(e,t){return f(tR,rR(t),f(hR,t,e))}),gR=r(function(e,t){return f(ON,M([mT(Vk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(pR,r,t)},t))}),vR=l(Pk,150,150,150),yR=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},mR=r(function(e,t){return f(Xu,e.amount,t.amount)}),bR=n(function(e,t,r){return f(e,r,t)}),CR=function(e){var t=e.a;return(R(e.b,Ro)?bR:Ua)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(CR,L(Tv,Ro),e,t):l(bR,Mu,yR(e.state.phase),yR(t.state.phase))});case"Expires":return r(function(e,t){return f(fv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(bv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(mR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f($c,ma,l(jd,r(function(e,t){return f(Mu,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(fv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(fv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},ER=l(Pk,233,237,242),SR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),TR=function(e){return f(Mk,M([mT(Vk),pT(Vk),XN]),f(kN,M([vN(12)]),M([ul(e.info)])))},wR=function(e){return f($c,Kk,f(Io,TR,Yl(e)))},IR=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"}},AR=function(e){return{$:"TimeLeft",a:e}},BR=function(e){return{$:"TimeUp",a:e}},kR=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 Ol(0)}}),NR=r(function(e,t){return Ol(Vd(e)-Vd(t))}),RR=r(function(e,t){var r=f(kR,t.state.phase,t),n=f(NR,e,t.state.phaseStartTime),a=f(NR,r,n);return Vd(a)>0?AR(L(a,r)):BR(r)}),$R=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},_R=l(lA,0,0,0),LR=l(Pk,51,183,2),xR=function(e){var t=Vu(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Yo(n));return n+(function(){if(a){return f(Zo,a+1,f(Jo,1,gw(r)))}return""}()+"%")},PR=r(function(e,t){return nR({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"}()})}),DR=n(function(e,t,r){return f(sR,f(ka,pT(jk(34)),e),f(PR,t,r))}),UR=r(function(e,t){var r=xR(t);if("0%"===r)return f(Mk,M([vN(16)]),ul("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?LR:mN;return f(ON,M([IN(4)]),M([l(DR,yr,a,si(i)),f(Mk,M([vA(o),vN(16)]),ul(n))]))}),OR=nR,MR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l($l,r,n,t)}),op,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,OR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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","₫")]))),FR=function(e){return f($c,"",f(Io,Qa,f(up,e,MR)))},VR=function(e){return Yo(e)<=3?e:VR(f(Cd,3,e))+","+f(nu,3,e)},KR=function(e){return VR(bd(e))},HR=function(e){return U(FR(e.fiatType),KR(e.amount))},jR=fA,qR=function(e){var t=function(){var t=f(up,e.fiatType,MR);if("Nothing"===t.$)return Kk;var r=t.a,n=(r.a,r.b);return f(sR,M([pT(jk(26))]),n)}();return f(ON,M([IN(4)]),M([t,f(Mk,M([vA(d(jR,0,0,0,.5)),lR,mT(jk(50))]),ul(e.fiatType)),ul(HR(e))]))},GR=function(e){return Vd(e)<0},zR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),YR=function(e){var t=hg(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(zR,tC(t),tC(r),tC(n),tC(a))}(f($c,L(Ku(0),Ku(0)),f(Cs,n,Ku(60))))}(f($c,L(Ku(0),Ku(0)),f(Cs,r,Ku(3600))))}(f($c,L(Ku(0),Ku(0)),f(Cs,t,Ku(86400))))},WR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!GR(a)){var u=r(function(e,t){return U(l(Bs,2,P("0"),Ni(e)),t)}),s=Vd(a)>0?i:o,c=YR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(ON,U(M([IN(5)]),e),M([f(Mk,U(M([vA(h)]),t),ul(f(u,c.days,"d"))),f(Mk,U(M([vA(d)]),t),ul(f(u,c.hours,"h"))),f(Mk,U(M([vA(s)]),t),ul(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Ol(0);e=p,t=g,n=v,a=y}}),JR={$:"Behind"},QR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),XR=function(e){return f(QR,JR,e)},ZR=r(function(e,t){var r=iv(200*e),n=200-r,a=f(Mk,M([mT(ZN(n))]),Kk),i=M([pT(jk(3)),oN(20)]),o=f(Mk,U(i,M([mT(ZN(r)),Gk(t)])),Kk),u=f(Mk,U(i,M([mT(Vk),Gk(ER)])),Kk);return f(ON,M([mT(Vk),XR(u)]),M([o,a]))}),e$=l(lA,1,1,0),t$=r(function(e,t){return Vd(e)/Vd(t)}),r$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(t$,o,u),c=(f(Mk,M([EN]),d(WR,yr,yr,L(a,i),o)),s<.1?mN:s<.2?e$:LR);return f(PN,U(M([IN(5)]),e),M([d(WR,M([EN]),t,L(a,i),o),f(ZR,1-s,c)]))}),n$=function(e){var t=Ed(Vl(e)),r=f(Wl,".",t);if(!r.b)return t;if(r.b.b){ol("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Zo,3,t);case 1:return f(Zo,4,f($c,t,f(Io,gw,f(Io,function(e){return e/100},f(Io,Ka,f(Io,iv,f(Io,ti(100),wd(t))))))));default:var n=r.a;return f($c,f(Zo,n,t),f(Io,Ni,f(Io,iv,wd(t))))}},a$=n(function(e,t,r){return f(tR,rR(t),function(){switch(t.$){case"Phase":return ul($R(r.state.phase));case"Expires":if("Open"===r.state.phase.$){var n=f(RR,e,r);if("TimeLeft"===n.$){var a=n.a,i=f(t$,a.a,a.b)<.05?mN:_R;return d(r$,M([mT(Vk)]),M([vN(16)]),L(i,ER),a)}var o=n.a;return d(r$,M([mT(Vk)]),M([vN(16)]),L(mN,ER),L(Ol(0),o))}return Kk;case"Offer":return f(ON,M([IN(5)]),M([ul(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(n$(r.parameters.tradeAmount)+" ")+IR(r.factory))]));case"FiatPrice":return qR(r.terms.price);case"Margin":var u=R(r.parameters.initiatorRole,fo);return f($c,Kk,f(Io,UR(u),r.derived.margin));case"PaymentWindow":var s=function(){return"Seller"===r.parameters.initiatorRole.$?mN:LR}(),c=_(Vd(r.parameters.autoabortInterval),216e5)<0?s:_R;return d(WR,yr,yr,L(c,ER),r.parameters.autoabortInterval);default:var s=function(){return"Seller"===r.parameters.initiatorRole.$?LR:mN}(),c=_(Vd(r.parameters.autoabortInterval),216e5)<0?s:_R;return d(WR,yr,yr,L(c,ER),r.parameters.autoreleaseInterval)}}())}),i$=n(function(e,t,r){return f(PN,M([mT(Vk),IN(1),Gk(ER),aN,lN(f(SR,r.factory,r.id))]),M([f(ON,M([mT(Vk),IN(1)]),f(xa,function(t){return l(a$,e,t,r)},t)),f(tR,1,wR(r.terms.paymentMethods))]))}),o$=Er,u$=JT(28),s$=function(e){return f(pA,u$,l(hA,"bc-"+gA(e),"border-color",e))},c$=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),f$=function(e){return f(pA,rA,h(c$,"b-"+Ni(e),e,e,e,e))},l$=a(function(e,t,r,n){return f(PN,M([mT(Vk),f$(2),oN(8),s$(vR),IN(2),Gk(vR),XN]),f(xa,f(i$,e,r),f(o$,CR(t.orderBy),n)))}),d$=a(function(e,t,r,n){return f(PN,M([mT(Vk),pT(Vk),IN(5)]),M([f(gR,t.orderBy,r),d(l$,e,t,r,n)]))}),h$=n(function(e,t,r){var n=ty(f(xa,function(e){return f(VN,FN(r),KN(e))},t));return R(n,yr)?Kk:f(Yi,Mo,d(d$,e,r.tradeTable,M([$o,GN,jN,qN,zN,HN]),n))}),p$=r(function(e,t){return f(Mk,M([oN(4),Gk(d(jR,0,0,1,.1)),vA(l(Pk,16,7,234)),vN(e),hN,f(tN,15,13)]),ul(cl(t)))}),g$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),v$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(pA,Zk,h(eN,"p-"+Ni(t),t,t,t,t)):f(pA,Zk,h(eN,d(g$,t,r,n,a),t,r,n,a))},y$=function(e){return function(){var t=Hd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?Kk:f(ON,M([IN(10),v$({bottom:20,left:20,right:20,top:10})]),M([f(Mk,M([vN(24),hN]),ul("Trade History for User")),f(p$,18,e.agentAddress)]))},m$=function(e){return{$:"FiltersMsg",a:e}},b$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),C$=$I,E$={$:"Left"},S$=bN(E$),T$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(uA,xN,CT("label"),e,ET(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(uA,TT,Ok,a,ET(M([i])));switch(n.$){case"Above":return d(uA,xN,CT("label"),e,ET(M([o,r])));case"Below":return d(uA,xN,CT("label"),e,ET(M([r,o])));case"OnRight":return d(uA,UN,CT("label"),e,ET(M([r,o])));default:return d(uA,UN,CT("label"),e,ET(M([o,r])))}}),w$=function(e){return{$:"Label",a:e}},I$={$:"NoAttribute"},A$=function(e){if("HiddenLabel"===e.$){var t=e.a;return AN(w$(t))}return I$},B$=function(e){return"HiddenLabel"===e.$},k$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return fu("No key matched");var n=r.a;return Fi(n)},r=f(cu,t,f(Ph,"key",lu));return bT(f(cN,"keyup",r))},N$=function(e){return f(Nn,"tabIndex",Ni(e))},R$=f(Da,bT,N$),$$={$:"LivePolite"},_$=AN($$),L$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([B$(r)?I$:IN(6),bT(fN(i(!a))),_$,k$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),R$(0),aN,S$,mT(Vk)]),e);return l(T$,o,r,d(uA,TT,Ok,M([bT(f(C$,"role","checkbox")),bT(f(C$,"aria-checked",a?"true":"false")),A$(r),JN,pT(Vk),mT(vT)]),ET(M([n(a)]))))}),x$=Br,P$=function(e){return e*x$/180},D$=JT(26),U$=function(e){return{$:"MoveY",a:e}},O$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),M$=function(e){return f(O$,D$,U$(-e))},F$=JT(24),V$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),K$=function(e){return f(O$,F$,f(V$,x(0,0,1),e))},H$=JT(19),j$=function(e){return yd(M([e.inset?"box-inset":"box-",gw(e.offset.a)+"px",gw(e.offset.b)+"px",gw(e.blur)+"px",gw(e.size)+"px",gA(e.color)]))},q$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(pA,H$,l(VI,j$(t),"box-shadow",yw(t)))},G$=r(function(e,t){return f(pA,rA,h(c$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),z$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?f$(r):f(G$,n,r):f(pA,rA,h(c$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},Y$=JT(12),W$=f(nN,Y$,BT.textCenter),J$=l(lA,1,1,1),Q$=function(e){return f(Mk,M([sA("focusable"),mT(jk(14)),pT(jk(14)),vA(J$),JN,vN(9),W$,oN(3),s$(e?l(lA,59/255,.6,252/255):l(lA,211/255,211/255,211/255)),q$({blur:1,color:e?d(jR,238/255,238/255,238/255,0):l(lA,238/255,238/255,238/255),offset:L(0,0),size:1}),Gk(e?l(lA,59/255,.6,252/255):J$),f$(e?0:1)]),e?f(Mk,M([s$(J$),pT(jk(6)),mT(jk(9)),K$(P$(-45)),EN,JN,M$(1),z$({bottom:2,left:2,right:0,top:0})]),Kk):Kk)},X$=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),Z$={$:"OnRight"},e_=X$(Z$),t_=r(function(e,t){return f(L$,yr,{checked:t.checked,icon:Q$,label:f(e_,yr,ul(t.label)),onChange:f(b$,e,t.label)})}),r_={$:"Top"},n_=YN(r_),a_=function(e){return f(PN,M([IN(15),n_]),M([f(Mk,M([vN(28),lR]),ul(e.label)),f(PN,M([IN(5)]),f(xa,t_(e.label),e.options))]))},i_=function(e){return f(ON,M([IN(20)]),f(xa,a_,e))},o_={$:"NoneFound"},u_={$:"AllFetched"},s_={$:"FetchingTrades"},c_={$:"QueryingNumTrades"},f_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return c_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?s_:u_}return o_},l_={$:"InFront"},d_=function(e){return f(QR,l_,e)},h_=r(function(e,t){var r=function(e){return f(Mk,M([vN(20),hN,vA(vR),EN]),ul(e))},n=f(mh,Ja(o_),f(xa,f_,e))?M([r("No trades found.")]):f(xa,r,KC(f(xa,function(e){switch(f_(e).$){case"QueryingNumTrades":return si("Querying "+cB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+cB(e.factory)+" Trades...");default:return ci}},e)));return f(Mk,M([mT(Vk),d_(f(PN,M([IN(5),S$]),n))]),f(Mk,M([EN]),f(Yi,m$,i_(t.filters))))}),p_=n(function(e,t,r){return f(PN,M([oN(5),Gk(Xk),mT(Vk),pT(Vk),f(tN,30,20)]),M([y$(r),f(h_,t,r),l(h$,e,t,r)]))}),g_=function(e){return{$:"ShowCurrencyDropdown",a:e}},v_={$:"AbortCreate"},y_=function(e){return{$:"AppCmd",a:e}},m_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),b_=function(e){return f(xa,function(e){return M([f(Mk,M([vA(mN)]),ul("Caution! ")),ul(e)])},KC(M([R(f(fv,e.autoreleaseInterval,Ol(12e5)),ba)?si(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."}()):ci,R(f(fv,e.autoabortInterval,Ol(36e5)),ba)?si(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.'}()):ci])))},C_=l(lA,0,0,1),E_=function(e){return f(Mk,M([v$({bottom:5,left:5,right:5,top:0}),lN(e),oN(30),Gk(d(jR,1,1,1,.4)),f$(1),s$(d(jR,0,0,0,.3)),aN,vN(14)]),f(Mk,M([vA(d(jR,0,0,0,.7))]),ul("x")))},S_=Bn,T_=S_,w_=bT,I_=r(function(e,t){return f(Mk,M([XR(f(Mk,M([Gk(e),w_(f(T_,"position","fixed")),w_(f(T_,"z-index","1000")),w_(f(T_,"top","0")),w_(f(T_,"left","0")),w_(f(T_,"width","100%")),w_(f(T_,"height","100%"))]),Kk)),mT(Vk),pT(Vk)]),t)}),A_=r(function(e,t){return{$:"Max",a:e,b:t}}),B_=r(function(e,t){return f(A_,e,t)}),k_=n(function(e,t,r){return l(Pa,I_,d(jR,0,0,.3,.6),f(Mk,U(M([EN,JN,mT(f(B_,500,vT)),Gk(Xk),oN(8),d_(f(Mk,M([_N,n_]),E_(r)))]),e),t))}),N_=r(function(e,t){if("Nothing"===t.$)return Kk;var r=t.a;return f(Mk,U(M([oN(5),s$(l(lA,.9,0,0)),f$(1),Gk(l(lA,1,.4,.4)),eR(5),EN,JN,mT(f(B_,200,vT)),vN(14)]),e),f(kN,yr,M([ul(r)])))}),R_={$:"Above"},$_=function(e){return f(QR,R_,e)},__=r(function(e,t){return f(Mk,M([oN(4),f(tN,25,17),vN(18),hN,Gk(ER),$_(f(N_,M([M$(5)]),t))]),ul(e))}),L_=a(function(e,t,r,n){return d(fA,e/255,t/255,r/255,n)}),x_=d(L_,1,31,52,.64),P_=JT(32),D_={$:"Active"},U_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),O_=$n,M_=r(function(e,t){switch(t.$){case"NoAttribute":return I$;case"Describe":var r=t.a;return AN(r);case"AlignX":var n=t.a;return bN(n);case"AlignY":var a=t.a;return YN(a);case"Width":var n=t.a;return yT(n);case"Height":var n=t.a;return hT(n);case"Class":var n=t.a,a=t.b;return f(nN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(pA,i,o);case"Nearby":var u=t.a,s=t.b;return f(QR,u,f(zi,e,s));case"Attr":var c=t.a;return bT(f(O_,e,c));default:var l=t.a,d=t.b;return f(O$,l,d)}}),F_=function(e){return f(M_,jg,e)},V_=r(function(e,t){var r=t.a,n=t.b,a=F_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(ZI,n,o));default:return L(r,n)}}),K_=function(e){var t=l(Ra,V_,L(yr,iA),e),r=t.a,n=t.b;return f(ka,KI(n),r)},H_=function(e){return f(pA,P_,f(U_,D_,K_(e)))},j_=JT(33),q_={$:"Hover"},G_=function(e){return f(pA,j_,f(U_,q_,K_(e)))},z_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Mk,M([oN(4),aN,lN(n),f(tN,25,17),vA(t),vN(18),hN,Gk(a),H_(M([Gk(o)])),G_(M([Gk(i)]))]),ul(r))}),Y_=r(function(e,t){return d(z_,x(d(jR,1,0,0,1),d(jR,1,0,0,.8),d(jR,1,0,0,.6)),Xk,e,t)}),W_=function(e){return I_(d(jR,0,0,.3,.6))(f(PN,M([IN(10),EN,JN,Gk(d(jR,0,0,0,.5)),oN(8),eR(20)]),f(xa,function(e){return f(kN,M([EN,JN,vN(20),hN,vA(Xk),W$]),M([e]))},e)))},J_=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+IA(t)}e.a;return"https://kovan.etherscan.io/tx/"+IA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+IA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+IA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+IA(t)}}),Q_={$:"Bottom"},X_=YN(Q_),Z_=sA(BT.underline),eL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(ul(n$(Rb(a))),f(Y_,"Yes, I definitely want to open this trade.",l(m_,r,n,a)))}return L(ul("??"),f(__,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(k_,yr,f(PN,M([IN(20),eR(20),EN,pT(Vk),W$]),M([f(Mk,M([vN(26),hN,EN,JN]),ul("Just to Confirm...")),f(PN,M([IN(20),EN,JN]),f(xa,kN(M([EN,vN(18),lR,vA(x_)])),U(b_(n),U(M([M([ul("You will deposit "),i,ul(" "+IR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([ul("This ususally requires two Metamask signatures. Your "+IR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Mk,M([X_,EN]),o)])),v_);case"ApproveNeedsSig":var u=e.a;return f(Mk,M([lN(y_(d(Jd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),W_(M([ul("Waiting for user signature for the approve call."),ul("(check Metamask!)"),ul("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Mk,M([lN(y_(d(Jd,"txChainModal clicked","misclick","ApproveMining",0)))]),W_(M([ul("Mining the initial approve transaction..."),f(cA,M([Z_,vA(C_)]),{label:ul("See the transaction on Etherscan"),url:f(J_,eo(u),s)}),ul("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Mk,M([lN(y_(d(Jd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),W_(M([ul("Waiting for user signature for the create call."),ul("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Mk,M([lN(y_(d(Jd,"txChainModal clicked","misclick","CreateMining",0)))]),W_(M([ul("Mining the final create call..."),f(cA,M([Z_,vA(C_)]),{label:ul("See the transaction on Etherscan"),url:f(J_,r,s)}),ul("You will be redirected when it's mined.")])))}}),tL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Kk;var r=t.a;return f(eL,r,e)},rL=function(e){return{$:"TradeAmountChanged",a:e}},nL=cT("id"),aL=w_(nL("inputError")),iL=l(Pk,109,127,138),oL=nR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),uL=function(e){return f(sR,f(ka,pT(jk(26)),e),oL)},sL=function(e){return f(ON,M([IN(4)]),M([uL(yr),f(Mk,M([vN(24),lR,vA(iL)]),ul(IR(e)))]))},cL=function(e){return{$:"HiddenLabel",a:e}},fL=cL,lL=cT("type"),dL=function(e){return L(e,!0)},hL=function(e){return{$:"MayStopPropagation",a:e}},pL=r(function(e,t){return f(sN,e,hL(t))}),gL=r(function(e,t){return l(La,Ph,t,e)}),vL=f(gL,M(["target","value"]),lu),yL=function(e){return f(pL,"input",f(Oi,dL,f(Oi,e,vL)))},mL=JT(0),bL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),CL=function(e){var t=function(e){return 1-e}(f(Cc,1,f(ei,0,e)));return f(pA,mL,f(bL,"transparency-"+cw(t),t))},EL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),SL=f(Da,bT,C$("autocomplete")),TL=l(lA,136/255,138/255,133/255),wL=l(lA,186/255,189/255,182/255),IL=f(tN,12,12),AL=M([IL,oN(3),s$(wL),Gk(J$),f$(1),IN(3),mT(Vk)]),BL=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},kL=function(e){return f(yh,BL,e)?I$:sA("focusable")},NL=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},RL=ye,$L=r(function(e,t){return f(kn,e,RL(t))}),_L=$L("spellcheck"),LL=f(Da,bT,_L),xL=W,PL=JT(47),DL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(xL(e))),o=(i-1)*t+f($c,0,f(Io,a,r))+f($c,0,f(Io,a,n));return f(pA,PL,l(VI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),UL=cT("value"),OL=f(Da,bT,UL),ML=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(uw,"width",n)?L(r,n):L(f(ka,e,r),f(CS,"width",n));case"Height":e.a;return f(uw,"height",n)?L(r,n):L(f(ka,e,r),f(CS,"height",n));case"Describe":e.a;return f(uw,"described",n)?L(r,n):L(f(ka,e,r),f(CS,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(uw,"align-x",n)?L(r,n):L(f(ka,e,r),f(CS,"align-x",n));case"AlignY":return f(uw,"align-y",n)?L(r,n):L(f(ka,e,r),f(CS,"align-y",n));default:return f(uw,"transform",n)?L(r,n):L(f(ka,e,r),f(CS,"transform",n))}}),L(yr,im),e).a},FL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,ML(e))}),VL=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}},KL=f(Da,Gi,gs),HL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([bT(yL(n.onChange))]),o=U(AL,t),u=f(FL,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(gl,NL,o),c=f(FL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(FL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(FL,o,function(e){return"Nearby"===e.$})),p=f(gl,f(Da,es,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([OL(n.text),bT(lL(a)),LL(e.spellchecked),sA(BT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return I$;var r=t.a;return SL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(VL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(EL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(EL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f($c,5,c);return x("textarea",U(M([LL(e.spellchecked),sA(BT.inputMultiline),f($c,I$,f(Io,SL,e.autofill)),function(){if("Nothing"===u.$)return I$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return v$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?I$:s.a?d(DL,n.text,v,u,g):I$}()]),h),M([KL(BI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(uA,TT,Ok,f(ka,mT(Vk),ty(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([d_(f(Mk,f(ka,IL,U(s,U(M([vA(TL),sA(BT.noTextSelection+" "+BT.passPointerEvents),s$(d(jR,0,0,0,0)),Gk(d(jR,0,0,0,0)),pT(Vk),mT(Vk),CL(""===n.text?1:0)]),r))),a))])}()]))),ET(M([d(uA,TT,CT(v),ty(M([M([kL(t),A$(n.label)]),y,i])),ET(m))])));return l(T$,f(ka,f(nN,rN,BT.cursorText),f(ka,B$(n.label)?I$:IN(5),f(ka,_$,u))),n.label,b)}),jL=HL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),qL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(jL,M([mT(Vk),pT(jk(40)),f$(0)]),{label:fL(r),onChange:i,placeholder:n,text:a});return f(ON,U(M([IN(5)]),e),KC(M([f(Io,Mk(M([S$])),o),si(s),f(Io,Mk(M([_N])),u)])))}),GL={$:"Below"},zL=function(e){return f(QR,GL,e)},YL=function(e){return f(O$,D$,U$(e))},WL=n(function(e,t,r){return p(qL,M([mT(jk(150)),lR,vN(24),zL(f(N_,M([aL,YL(5)]),r))]),L(ci,si(f(Mk,M([lN(y_(d(Jd,"click","misclick","dai symbol in dai input",0)))]),sL(e)))),"dai input",ci,t,rL)}),JL=Mk(M([s$(ER),z$({bottom:2,left:0,right:0,top:0})])),QL=r(function(e,t){return f(PN,M([IN(10)]),M([f(Mk,M([vN(17),hN]),ul(e)),t]))}),XL=r(function(e,t){return JL(f(QL,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(WL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),ZL=function(e){return f($c,FE,Dg(e))},ex=function(e){var t=function(){var t=hd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+n$(f(Hl,r,100))+" "+IR(ZL(e.wallet))+"."}return"There is a 1% fee."}();return f(ON,M([EN,f(tN,20,10),Gk(l(Pk,10,33,108)),oN(8),IN(5),lN(y_(d(Jd,"click","misclick","fee notify element",0)))]),M([f(Mk,M([vN(18),vA(l(Pk,0,226,255)),hN]),ul(t)),f(Mk,M([vN(17),vA(Xk),lR]),ul("We only collect this fee when trades resolve successfully."))]))},tx=function(e){return{$:"FiatAmountChanged",a:e}},rx=function(e){return{$:"FiatTypeChanged",a:e}},nx=r(function(e,t){return l(vS,n(function(t,r,n){return f(e,t,r)?l($l,t,r,n):n}),op,t)}),ax=function(e){return f(nx,r(function(t,r){return f(Yg,e,t)}),MR)},ix=nR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),ox=function(e){return f(sR,M([pT(jk(26))]),f($c,ix,f(Io,uu,f(up,e,MR))))},ux=function(e){return w_(f(pL,"click",Fi(L(e,!0))))},sx=KL,cx=function(e){return{$:"AppendProperty",a:e}},fx=r(function(e,t){return cx(e+":"+t)}),lx=r(function(e,t){return f(fx,e,t.value)}),dx=lx("cursor"),hx={$:"Compatible"},px={cursor:hx,value:"default"},gx=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),vx=function(e){return{$:"PseudoClassSelector",a:e}},yx=function(e){return gx(vx(e))}("hover"),mx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),bx=mx,Cx=bx,Ex=Cx("span"),Sx=r(function(e,t){return f(kn,et(e),rt(t))}),Tx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),wx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),Ix=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),Ax=r(function(e,t){return t<>>32-e}),Bx=function(e){var t=e.hash?e.seed^f(Ix,461845907,f(Ax,15,f(Ix,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(Ix,2246822507,r^r>>>16),a=f(Ix,3266489909,n^n>>>13);return(a^a>>>16)>>>0},kx=r(function(e,t){return f(Ix,5,f(Ax,13,e^f(Ix,461845907,f(Ax,15,f(Ix,3432918353,t)))))+3864292196}),Nx=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},UP=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+"]"}},OP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,UP,r)));case"UniversalSelectorSequence":var r=e.a;return Su(r)?"*":f(Ri,"",f(xa,UP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,UP,r)))}},MP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([DP(t),OP(r)]))},FP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,OP(t),f(xa,MP,r)),i=f(Ri,"",M([f($c,"",f(Io,PP,n))]));return f(nc,f(Ri," ",f(gl,f(Da,es,Nd),a)),i)},VP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,FP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,xP(a),"\n",e,"}"]))}),KP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(VP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,kP,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,_P,VP(" ")),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"}},HP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(gl,f(Da,es,Nd),M([IP(t),f(Ri,"\n",f(xa,RP,r)),f(Ri,"\n",f(xa,$P,n)),f(Ri,"\n\n",f(xa,KP,a))])))},jP=function(e){return HP(wP(EP(e)))},qP=function(e){return f(Ri,"\n\n",f(xa,jP,e))},GP=function(e){return{$:"Snippet",a:e}},zP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),YP=function(e){return{$:"StyleBlockDeclaration",a:e}},WP=r(function(e,t){var r=l(Yx,t,yr,ci);return GP(M([YP(l(zP,r,yr,e))]))}),JP=function(e){return Su(e)?"unstyled":f(Ss,P("_"),_s(f(Rx,15739,qP(TS($x(TS(f(WP,e,oP(yr)))))))))},QP=function(e){var t=JP(e),r=f(Sx,"className",fl(t));return l(Tx,r,e,t)},XP=a(function(e,t,r,n){return f(e,f(ka,QP(t),r),n)}),ZP=function(e){return{$:"Unstyled",a:e}},eD=function(e){return ZP(Cw(e))},tD=eD,rD=r(function(e,t){return f(Tn,e,Xe(t))}),nD=function(e){return En(Xe(e))},aD=r(function(e,t){var r=e.b,n=e.c;return Su(r)?t:l($l,n,r,t)}),iD=function(e){return e.a},oD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,aD,i,s),p=l(Ra,uD,L(yr,h),c),g=p.a,v=p.b,o=l(zT,u,f(xa,iD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,aD,i,s),m=l(Ra,uD,L(yr,h),c),g=m.a,v=m.b,o=d(nD,y,u,f(xa,iD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,aD,i,s),b=l(Ra,oD,L(yr,h),c),g=b.a,v=b.b,o=l(GT,u,f(xa,iD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,aD,i,s),C=l(Ra,oD,L(yr,h),c),g=C.a,v=C.b,o=d(rD,y,u,f(xa,iD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),uD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,aD,n,o),c=l(Ra,uD,L(yr,s),u),h=c.a,p=c.b,a=l(zT,i,f(xa,iD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,aD,n,o),v=l(Ra,uD,L(yr,s),u),h=v.a,p=v.b,a=d(nD,g,i,f(xa,iD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,aD,n,o),y=l(Ra,oD,L(yr,s),u),h=y.a,p=y.b,a=l(GT,i,f(xa,iD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,aD,n,o),m=l(Ra,oD,L(yr,s),u),h=m.a,p=m.b,a=d(rD,g,i,f(xa,iD,o),$a(h));return L(f(ka,a,r),p)}}),sD=r(function(e,t){return h(Al,Il,e,t,Bl,Bl)}),cD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(Nd(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),fD=function(e){var t=f(cD,ci,e);if("Nothing"===t.$)return op;var r=t.a,n=r.a,a=r.b;return f(sD,n,a)},lD=function(e){return{$:"ClassSelector",a:e}},dD=function(e){var t=e.a,r=e.b;return f(WP,r,oP(M([lD(t)])))},hD=function(e){return qP(TS($x(f(xa,dD,Ia(e)))))},pD=function(e){return l(zT,"style",yr,TS(Cw(hD(e))))},gD=n(function(e,t,r){var n=f(xa,iD,t),a=fD(t),i=l(Ra,uD,L(yr,a),r),o=i.a,u=i.b,s=pD(u);return l(zT,e,n,f(ka,s,$a(o)))}),vD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),yD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(vD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),mD=r(function(e,t){return L(f(yD,"_",t),pD(e))}),bD=n(function(e,t,r){var n=f(xa,iD,t),a=fD(t),i=l(Ra,oD,L(yr,a),r),o=i.a,u=i.b,s=f(mD,u,o);return l(GT,e,n,f(ka,s,$a(o)))}),CD=a(function(e,t,r,n){var a=f(xa,iD,r),i=fD(r),o=l(Ra,oD,L(yr,i),n),u=o.a,s=o.b,c=f(mD,s,u);return d(rD,e,t,a,f(ka,c,$a(u)))}),ED=a(function(e,t,r,n){var a=f(xa,iD,r),i=fD(r),o=l(Ra,uD,L(yr,i),n),u=o.a,s=o.b,c=pD(s);return d(nD,e,t,a,f(ka,c,$a(u)))}),SD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(gD,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(ED,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(bD,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(CD,a,t,r,n)}},TD=SD,wD=function(e){return sx(TD(d(XP,Ex,M([yx(M([dx(px)]))]),yr,M([tD(e)]))))},ID=J,AD=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),BD=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),kD=function(e){return l(La,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 si(h(AD,n,a,i,o,u))}return ci}(),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 si(l(BD,a,t,i))}return ci}())}),L(ci,ci),e)},ND=r(function(e,t){var r=kD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(uA,UN,Ok,f(ka,sA(BT.contentLeft+" "+BT.contentCenterY+" "+BT.wrapped),f(ka,mT(vT),f(ka,pT(vT),e))),ET(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?si(v$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(uA,UN,Ok,f(ka,sA(BT.contentLeft+" "+BT.contentCenterY+" "+BT.wrapped),f(ka,mT(vT),f(ka,pT(vT),U(e,M([h]))))),ET(t))}var p=-s/2,g=-u/2;return d(uA,TT,Ok,e,ET(M([d(uA,UN,Ok,f(ka,sA(BT.contentLeft+" "+BT.contentCenterY+" "+BT.wrapped),f(ka,bT(f(T_,"margin",gw(p)+"px "+gw(g)+"px")),f(ka,bT(f(T_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,bT(f(T_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(pA,SN,l(TN,o,u,s)),yr))))),ET(t))])))}),RD=i(function(e,t,r,n,a){var i=f(jL,M([mT(jk(80)),pT(jk(40)),vN(24),lR,s$(ER),ux(r)]),{label:fL("currency type"),onChange:f(jo,ID,n),placeholder:ci,text:t}),o=f(up,t,MR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return Kk;r.b;return f(ND,M([mT(jk(350)),s$(_R),f$(1),Gk(Xk),eR(10),EN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(ON,M([mT(jk(80)),IN(9),f(tN,0,5),ux(n(t)),G_(M([Gk(l(lA,.8,.8,1))]))]),M([f(sR,M([pT(jk(26))]),a),f(Mk,M([vN(16),hN]),wD(t))]))},Ia(ax(t))))}return Kk}();return f(ON,M([IN(4),zL(u)]),M([f(Mk,M([lN(a)]),ox(t)),i]))}),$D=i(function(e,t,r,n,a){var i=y_(d(Jd,"click","misclick","currency flag",0)),o=f(Mk,M([lN(y_(d(Jd,"click","misclick","currency symbol",0)))]),ul(FR(e))),u=f(Mk,M([zL(f(N_,M([aL,YL(5)]),a))]),h(RD,r,e,g_(!0),rx,i));return p(qL,M([mT(jk(250)),lR,vN(24),zL(f(N_,M([aL,YL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,tx)}),_D=function(e){return JL(f(QL,"For fiat",h($D,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},LD=function(e){return{$:"ChangeRole",a:e}},xD=d(L_,1,31,52,.13),PD=r(function(e,t){var r=M([vN(24),lR,aN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([vA(xD)]))):L(U(r,M([vA(xD)])),r)}(),a=n.a,i=n.b;return f(ON,M([IN(20)]),M([f(Mk,U(M([lN(LD(lo))]),i),ul("Sell "+e)),f(Mk,U(M([lN(LD(fo))]),a),ul("Buy "+e))]))}),DD=r(function(e,t){return f(QL,"Trade Type",f(PD,IR(e),t.inputs.userRole))}),UD=q$({blur:20,color:d(L_,0,0,0,.04),offset:L(0,3),size:0}),OD=f(nN,SN,BT.spaceEvenly),MD=function(e){var t=ZL(e.wallet);return f(PN,M([mT(Vk),IN(20),Gk(Xk),oN(5),eR(20),UD]),M([f(ON,M([mT(Vk),OD]),M([f(DD,t,e),f(XL,t,e),_D(e)])),ex(e)]))},FD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),VD={$:"Web3Connect"},KD=function(e){return f(Mk,M([EN]),function(){var t=L(Hd(e),Dg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(Y_,"Open Trade",f(FD,n,r))}t.b;return f(__,"Unsupported Network",ci)}t.a;return f(Y_,"Connect to Wallet",VD)}())},HD=function(e){return{$:"AutoabortIntervalChanged",a:e}},jD=function(e){return{$:"ChangePaymentMethodText",a:e}},qD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),GD=qD,zD=function(e){return f(GD,M([vA(d(jR,0,0,0,.2))]),function(){return ul("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")}())},YD={$:"TextArea"},WD=r(function(e,t){return l(HL,{autofill:ci,spellchecked:t.spellcheck,type_:YD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),JD=n(function(e,t,r){var n=f(Mk,M([vN(22),hN]),ul("Payment Method")),a=f(WD,M([mT(Vk),pT(jk(150)),Gk(d(L_,155,203,255,.2)),f$(0)]),{label:fL("payment method"),onChange:jD,placeholder:""===r?si(zD(t)):ci,spellcheck:!0,text:r});return f(PN,M([IN(20),v$({bottom:15,left:45,right:45,top:0}),mT(Vk),$_(f(N_,M([aL,YL(30),eR(10),vN(20),mT(jk(400))]),e))]),M([n,a]))}),QD=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."},XD=a(function(e,t,r,n){var a=l(Bs,e,P("0"),Ni(n));return f(Mk,M([vN(22),vA(t)]),ul(U(a,r)))}),ZD=function(e){return Vd(e)<0?Ol(0):e},eU=n(function(e,t,n){var a=r(function(e,r){return f(PN,M([IN(4)]),M([f(Mk,M([eR(4),aN,lN(n(f(gb,t,e)))]),f(sR,M([pT(jk(10))]),cR)),r,f(Mk,M([eR(4),aN,lN(n(function(e){return Vd(e)?e:Ol(3e5)}(ZD(f(NR,t,e)))))]),f(sR,M([pT(jk(10))]),aR))]))}),i=YR(t);return f(ON,M([OD,IN(10)]),M([f(a,Ol(864e5),d(XD,3,e," days",i.days)),f(a,Ol(36e5),d(XD,2,e," hours",i.hours)),f(a,Ol(3e5),d(XD,2,e," min",i.min))]))}),tU=o(function(e,t,r,n,a,i){var o=f(Mk,M([Gk(d(L_,155,203,255,.2)),oN(5),eR(15),$_(f(N_,M([aL]),a))]),l(eU,_R,n,i)),u=f(ON,M([IN(30)]),M([f(sR,M([pT(jk(40)),lN(y_(d(Jd,"click","misclick","symbol for "+t,0)))]),e),f(Mk,M([vN(22),hN]),ul(t))])),s=f(kN,M([vN(17),lR,vA(x_)]),M([ul(r)]));return f(PN,M([mT(Vk),oN(10),Gk(l(Pk,237,237,237)),IN(2)]),f(xa,Mk(M([Gk(Xk),f(tN,45,18),mT(Vk)])),M([u,f(ON,M([mT(Vk),IN(25),Gk(Xk)]),M([o,s]))])))}),rU=nR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),nU=f(nN,QN,BT.clipX),aU=f(nN,QN,BT.clipY),iU=i(function(e,t,r,n,a){return f(PN,M([IN(15),oN(8),nU,aU,Gk(Xk)]),M([p(tU,rU,"Payment Window",QD(a),r,n,HD),l(JD,t,a,e)]))}),oU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},uU=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."},sU=nR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),cU=n(function(e,t,r){return f(Mk,M([oN(8),nU,aU,Gk(Xk)]),p(tU,sU,"Burn/Release Window",uU(r),e,t,oU))}),fU=function(e){return{$:"AutorecallIntervalChanged",a:e}},lU=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."},dU=nR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),hU=n(function(e,t,r){return f(Mk,M([oN(8),Gk(Xk),nU,aU]),p(tU,dU,"Open Window",lU(r),e,t,fU))}),pU=function(e){return f(PN,M([mT(Vk),IN(20)]),M([l(hU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(iU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(cU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},gU=function(e){return f(PN,M([mT(f(B_,1e3,Vk)),EN,IN(20),v$({bottom:30,left:40,right:40,top:0}),lN(g_(!1)),d_(tL(e))]),M([MD(e),pU(e),KD(e.wallet)]))},vU=Ts(Um(8226)),yU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),mU=r(function(e,t){return l(Ra,ka,t,e)}),bU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(mU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),CU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(mU,f(sc,e%r,t),l(bU,yr,e/r|0,t))):f(sc,e,t)}),EU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(uw,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(CS,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),SU=function(e){return d(EU,Ua,im,e,yr)},TU=r(function(e,t){return f(Mk,M([mT(Vk),d_(f(ON,M([IN(3),mT(ZN(100)),mT(t),XN]),f(yU,f(Mk,M([vA(d(jR,0,0,0,.1)),vN(14)]),ul(vU)),f(xa,f(Da,Mk(M([vA(d(jR,0,0,0,.2))])),ul),f(CU,100,(e?$a:Ua)(SU(f(xa,f(jo,uu,Qa),Ia(MR)))))))))]),ul(" "))}),wU=r(function(e,t){var r=t.url,n=t.label;return d(uA,TT,CT("a"),f(ka,bT(fT(r)),f(ka,bT(lT("noopener noreferrer")),f(ka,mT(vT),f(ka,pT(vT),f(ka,sA(BT.contentCenterX+" "+BT.contentCenterY),e))))),ET(M([n])))}),IU=sA(BT.italic),AU=function(){var e=f(Da,Mk(M([vA(l(lA,.8,.2,.2))])),ul),t=f(Da,Mk(M([NN])),ul);return f(PN,M([mT(Vk),pT(Vk),Gk(Xk),oN(6),IN(50),q$({blur:20,color:d(L_,0,0,0,.1),offset:L(0,3),size:0}),oN(10),eR(20)]),M([f(TU,!1,Vk),f(PN,M([EN,mT(f(B_,700,Vk)),IN(20)]),M([f(kN,M([vN(70),NN,EN,W$]),M([ul("DAI"),e("Hard")])),f(ON,M([vN(30),hN,EN,W$,IU]),M([ul("The "),e("Global"),ul(", "),e("Unkillable"),ul(" Crypto Gateway")]))])),f(ON,M([Gk(vR),IN(2),EN,n_,mT(Vk)]),M([f(Mk,M([f(tN,40,10),Gk(Xk),mT(Vk),pT(Vk)]),f(PN,M([IN(60),_N]),M([f(Mk,M([vN(40),hN,EN]),ul("Want to learn more?")),f(wU,M([oN(4),aN,f(tN,25,17),Gk(C_),vA(Xk),NN,vN(24),EN]),{label:f(kN,M([W$]),M([ul("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"})]))),f(Mk,M([f(tN,40,10),Gk(Xk),mT(Vk),pT(Vk)]),f(PN,M([S$,IN(60)]),M([f(Mk,M([vN(40),hN,EN]),ul("Ready to try it out?")),f(PN,M([IN(10),mT(jk(400)),EN]),M([f(kN,M([vN(24),mT(Vk)]),M([ul("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f(kN,M([vN(24),mT(Vk)]),M([ul("Then follow the links at the top of this page to browse "),t("Sell Offers"),ul(", browse "),t("Buy Offers"),ul(", or "),t("Create Your Own Offer"),ul(".")]))]))])))])),f(Mk,M([X_,mT(Vk)]),f(TU,!0,Vk))]))}(),BU=function(e){return{$:"ShowCurrencyDropdown",a:e}},kU=r(function(e,t){return gl(t(e))}),NU=n(function(e,t,r){var n=l(kU,e,r.filterFunc,ty(f(xa,KN,t)));return R(n,yr)?Kk:f(Yi,Bv,d(d$,e,r.tradeTable,M([Tv,GN,jN,qN,zN,HN]),n))}),RU=function(e){return{$:"FiltersMsg",a:e}},$U={$:"ApplyInputs"},_U=$L("disabled"),LU=function(e){return{$:"MayPreventDefault",a:e}},xU=r(function(e,t){return f(sN,e,LU(t))}),PU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):fu("Not the enter key")},n=f(cu,r,f(Ph,"key",lu));return bT(f(xU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),DU=function(e){return f(PU,"Enter",e)},UU={$:"Button"},OU=r(function(e,t){var r=t.onPress,n=t.label;return d(uA,TT,Ok,f(ka,mT(vT),f(ka,pT(vT),f(ka,sA(BT.contentCenterX+" "+BT.contentCenterY+" "+BT.seButton+" "+BT.noTextSelection),f(ka,aN,f(ka,kL(e),f(ka,AN(UU),f(ka,bT(N$(0)),function(){if("Nothing"===r.$)return f(ka,bT(_U(!0)),e);var t=r.a;return f(ka,lN(t),f(ka,DU(t),e))}()))))))),ET(M([n])))}),MU=f(OU,M([Gk(C_),eR(10),oN(5)]),{label:f(Mk,M([vA(Xk),EN,JN]),ul("Apply")),onPress:si($U)}),FU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(pA,iN,l(VI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},VU=function(e){return f(cN,"focus",Fi(e))},KU=f(Da,bT,VU),HU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([KU(e(!0)),ux(e(!0))])}();return f(ON,U(e,M([pT(jk(40)),q$({blur:20,color:d(L_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Mk,M([Gk(ER),pT(jk(40)),FU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Mk,M([JN,f(tN,10,0)]),r)),f(jL,U(s,U(t,M([mT(jk(100)),pT(jk(40)),s$(ER),FU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),z$({bottom:1,left:0,right:1,top:1})]))),{label:fL(n),onChange:u,placeholder:i,text:a})]))}),jU=function(e){return{$:"MaxDaiChanged",a:e}},qU=function(e){return{$:"MinDaiChanged",a:e}},GU=r(function(e,t){return f(PN,M([mT(Vk),IN(8)]),M([f(Mk,M([vN(17),lR]),ul(e)),t]))}),zU=JT(25),YU=function(e){return{$:"MoveX",a:e}},WU=function(e){return f(O$,zU,YU(-e))},JU={$:"OnLeft"},QU=function(e){return f(QR,JU,e)},XU=n(function(e,t,r){var n=uL(M([JN])),a=f(ON,M([IN(8),JN,mT(jk(60))]),M([n,f(Mk,M([vN(16),JN]),ul("max"))])),i=f(ON,M([IN(8),JN,mT(jk(60))]),M([n,f(Mk,M([vN(16),JN]),ul("min"))]));return f(GU,"Dai Range",f(PN,M([IN(5),mT(jk(200))]),M([v(HU,M([QU(f(N_,M([WU(5),mT(jk(200))]),r.minDai))]),M([KU(BU(!1))]),i,"min Dai",e,ci,ci,qU),v(HU,M([QU(f(N_,M([WU(5),mT(jk(200))]),r.maxDai))]),M([KU(BU(!1))]),a,"max Dai",t,ci,ci,jU)])))}),ZU=function(e){var t=f(up,e,MR);if("Nothing"===t.$)return ul("*");var r=t.a,n=r.b;return f(sR,M([pT(jk(26))]),n)},eO=function(e){return{$:"AppCmd",a:e}},tO=function(e){return{$:"FiatTypeInputChanged",a:e}},rO=n(function(e,t,r){var n=eO(d(Jd,"click","misclick","currency flag",0)),a=ZU(t);f(ON,M([IN(8),JN,mT(jk(60))]),M([a,f(Mk,M([vN(16),JN]),ul("max"))])),f(ON,M([IN(8),JN,mT(jk(60))]),M([a,f(Mk,M([vN(16),JN]),ul("min"))]));return f(Mk,M([n_,mT(jk(120))]),f(GU,"Fiat Type",h(RD,e,t,BU(!0),tO,n)))}),nO={$:"AddSearchTerm"},aO=function(e){return{$:"PaymentMethodInputChanged",a:e}},iO=f(Ph,"keyCode",jC),oO=function(e){return f(cN,"keyup",f(cu,function(t){return 13===t?Fi(e):fu(Ni(t))},iO))},uO=function(e){return f(GU,"Search Payment Methods",f(jL,M([n_,mT(jk(250)),pT(jk(40)),s$(ER),q$({blur:20,color:d(L_,233,237,242,.05),offset:L(0,3),size:0}),w_(oO(nO))]),{label:fL("payment methods search"),onChange:aO,placeholder:ci,text:e}))},sO={$:"ResetSearch"},cO=f(OU,M([Gk(C_),eR(10),oN(5)]),{label:f(Mk,M([vA(Xk),EN,JN]),ul("Reset")),onPress:si(sO)}),fO=function(e){return{$:"RemoveTerm",a:e}},lO=function(e){return f(Mk,M([eR(3),n_,aN,lN(fO(e)),vN(10),vA(mN)]),ul("x"))},dO=function(e){if(e.b){var t=e;return f(ON,M([mT(Vk),eR(10),IN(10)]),f(xa,function(e){return f(ON,M([Gk(d(L_,16,7,234,.2)),oN(5),eR(4),IN(3)]),M([ul(e),lO(e)]))},t))}return Kk},hO=i(function(e,t,r,n,a){var i=function(e){return f(Mk,M([vN(20),hN,vA(vR),EN]),ul(e))},o=f(mh,Ja(o_),f(xa,f_,e))?M([i("No trades found.")]):f(xa,i,KC(f(xa,function(e){switch(f_(e).$){case"QueryingNumTrades":return si("Querying "+cB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+cB(e.factory)+" Trades...");default:return ci}},e)));return f(Mk,M([mT(Vk),d_(f(PN,M([IN(5),S$]),o))]),f(ON,M([EN,IN(50)]),M([f(Yi,RU,i_(t)),f(ON,M([mT(vT),IN(10)]),M([f(Mk,M([mT(vT),n_]),l(XU,r.minDai,r.maxDai,n)),f(Mk,M([mT(vT),n_]),l(rO,a,r.fiatType,n)),f(PN,M([mT(vT),n_,IN(5)]),M([uO(r.paymentMethod),dO(r.paymentMethodTerms)])),f(GU," ",f(PN,M([IN(5),mT(vT)]),M([MU,cO])))]))])))}),pO=n(function(e,t,r){return f(PN,M([oN(5),Gk(Xk),mT(Vk),pT(Vk),lN(BU(!1)),eR(30)]),M([f(ON,M([mT(Vk),IN(10)]),M([h(hO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),l(NU,e,t,r)]))}),gO=function(e){return{$:"MessageInputChanged",a:e}},vO={$:"MessageSubmit"},yO=function(e){return f(PN,M([mT(Vk),IN(10)]),M([f(WD,M([mT(Vk),pT(jk(100))]),{label:fL("messageInput"),onChange:gO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(OU,M([EN,vN(24)]),{label:ul("Submit"),onPress:si(vO)})]))},mO=f(nN,QN,BT.scrollbarsY),bO=r(function(e,t){return f(Mk,M([pT(Vk),mT(Vk)]),f(Mk,U(M([w_(f(T_,"position","absolute")),w_(f(T_,"top","0")),w_(f(T_,"right","0")),w_(f(T_,"bottom","0")),w_(f(T_,"left","0")),mO]),e),t))}),CO=l(Pk,200,205,210),EO=n(function(e,t,r){var n=M([_N,Gk(C_),vA(Xk),FU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([S$,Gk(CO),vA(_R),FU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Mk,U(M([eR(7)]),u),f(kN,yr,M([ul(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(lA,0,0,1),Xk,"Initiator opened the trade"));case"Recalled":return si(x(l(lA,0,0,1),Xk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Zo,8,cl(t))+"..";return si(x(l(lA,1,0,1),Xk,r+" committed to the trade"));case"Aborted":return si(x(l(lA,1,0,0),Xk,"Buyer aborted the trade"));case"Claimed":return si(x(l(lA,0,1,0),Xk,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(lA,0,0,1),Xk,"Seller released the "+IR(e)+" and closed the contract"));default:return si(x(l(lA,0,0,1),Xk,"Seller burned the "+IR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Kk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Mk,M([oN(3),f$(1),s$(l(lA,1,0,1)),EN,Gk(h)]),f(kN,M([vA(p)]),M([ul(g)])))}),SO=n(function(e,t,r){if(r.b){var n=r;return f(bO,M([mT(Vk),pT(Vk),oN(5),f$(1),s$(_R),eR(10)]),f(PN,M([mT(Vk),pT(Vk),IN(10)]),f(xa,f(EO,e,t),n)))}return f(Mk,M([mT(Vk),pT(Vk),oN(5),f$(1),s$(_R),EN,vA(l(lA,.5,.5,.5)),IU]),ul("no messages found."))}),TO=Cr,wO=function(e){return f(PN,M([mT(Vk),pT(Vk),IN(10),f$(1),oN(5),eR(20)]),M([l(SO,e.trade.factory,e.userRole,f(TO,function(e){return e.blocknum},Sa(e.history))),yO(e)]))},IO=function(e){return f(Mk,M([Gk(Xk),oN(8),UD,mT(Vk),pT(Vk)]),wO(e))},AO={$:"ToggleChat"},BO=function(e){if(e.showChatHistory){var t=f($c,Kk,f(Io,IO,e.chatHistoryModel));return f(Mk,M([pT(Vk),mT(jk(500)),eR(20),_N]),l(k_,M([pT(Vk),mT(Vk)]),f(Yi,pE,t),AO))}return Kk},kO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},NO=function(e){return HR(e)+" "+e.fiatType},RO={$:"AbortAction"},$O=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),_O=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return Kk}if("LoadedTrade"!==t.b.$)return Kk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=NO(n.terms.price),u=n$(Rb(i)),s=n$(n.parameters.tradeAmount)+" "+IR(n.factory),c=function(){return"Buyer"===kO(n.parameters).$?L(f(Mk,M([lR,vA(_R)]),ul("buyer")),M([ul("pay the seller "),f(Mk,M([vA(C_)]),ul(o)),ul(" in exchange for the "),f(Mk,M([vA(C_)]),ul(s)),ul(" held in this contract.")])):L(f(Mk,M([lR,vA(_R)]),ul("seller")),M([ul("accept "),f(Mk,M([vA(C_)]),ul(o)),ul(" from the buyer in exchange for the "),f(Mk,M([vA(C_)]),ul(s)),ul(" held in this contract.")]))}(),d=c.a,h=c.b;return l(k_,yr,f(PN,M([IN(20),eR(20),EN,pT(Vk),W$]),M([f(Mk,M([vN(26),hN,EN,JN]),ul("Just to Confirm...")),f(PN,M([IN(20),EN,JN]),f(xa,kN(M([EN,vN(18),lR,vA(x_)])),U(M([U(M([ul("You will deposit "),f(Mk,M([vA(C_)]),ul(u+" "+IR(n.factory))),ul(", thereby becoming the "),d,ul(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([ul("(This ususally requires two Metamask signatures. Your "+IR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Mk,M([X_,EN]),f(Y_,"Yes, I definitely want to commit to this trade.",l($O,n,a,i)))])),RO);case"ApproveNeedsSig":return W_(M([ul("Waiting for user signature for the approve call."),ul("(check Metamask!)"),ul("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return W_(M([ul("Mining the initial approve transaction..."),f(cA,M([Z_,vA(C_)]),{label:ul("See the transaction on Etherscan"),url:f(J_,n.factory,p)}),ul("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return W_(M([ul("Waiting for user signature for the final commit call."),ul("(check Metamask!)"),ul("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return W_(M([ul("Mining the final commit transaction..."),f(cA,M([Z_,vA(C_)]),{label:ul("See the transaction"),url:f(J_,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(k_,yr,f(PN,M([IN(20),eR(20),EN,pT(Vk),W$]),M([f(Mk,M([vN(26),hN,EN,JN]),ul("Just to Confirm...")),f(PN,M([IN(20),EN,JN]),f(xa,kN(M([EN,vN(18),lR,vA(x_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([ul('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 '+IR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([ul("Aborting will incur a small penalty on both parties, and refund the rest of the "+IR(n.factory)+".")])]);case"Release":return M([M([ul("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([ul("This will destroy the "+IR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Mk,M([X_,EN]),function(e){return f(Y_,e,LE(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 "+IR(n.factory)+".";default:return"I understand. Burn the "+IR(n.factory)+"."}}()))])),RO);case"ActionNeedsSig":var g=r.a;return W_(M([ul("Waiting for user signature for the "+PE(g)+" call."),ul("(check Metamask!)")]));default:var g=r.a,p=r.b;return Kk}},LO=ON(M([mT(Vk),Gk(Xk),oN(5),eR(20),OD,UD])),xO=function(e){return f(ON,M([IN(8)]),M([f(sR,yr,oL),f(Mk,M([vN(24),lR]),ul(n$(e)))]))},PO=r(function(e,t){var r=f(To,wo(e),f(Io,function(e){return e.address},Hd(t)));return f(QL,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"}(),xO(e.parameters.tradeAmount))}),DO=function(e){return f(ON,M([IN(5)]),M([ox(e.fiatType),f(Mk,M([vN(24),lR]),ul(NO(e)))]))},UO=function(e){return f(QL,"For Fiat",DO(e.terms.price))},OO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},MO=l(Pk,250,165,22),FO=l(Pk,255,0,0),VO=l(Pk,0,255,0),KO=nR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),HO=nR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),jO=nR({description:"released",src:"/DAIHard/static/img/released.svg"}),qO={$:"ToggleStatsModal"},GO=function(e){return f(TO,Ua,e)},zO=n(function(e,t,n){var a=ty(f(xa,function(e){return f(gl,function(e){return R(f(Ao,e,n),si(t))},f(xS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(uh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(uh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Gl,amountReleased:Gl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Io,Ol,Yl(GO(f(xS,function(e){return function(e){return e?si(e):ci}(Vd(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}}),YO=r(function(e,t){return d(z_,x(d(jR,0,0,1,1),d(jR,0,0,1,.8),d(jR,0,0,1,.6)),Xk,e,t)}),WO=function(e){return{$:"ViewUserHistory",a:e}},JO=f(zB,0,yr),QO=f(nN,dN,BT.textNormalWeight),XO=r(function(e,t){return Za(e/t)}),ZO=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}}),eM=r(function(e,t){var r=e.a,n=e.b;return l(ZO,r,f(XO,Vd(t),6e4),n)}),tM=r(function(e,t){return f(Ns,24,f(XO,f(eM,e,t),60))}),rM=r(function(e,t){return f(Ns,1e3,Vd(t))}),nM=r(function(e,t){return f(Ns,60,f(eM,e,t))}),aM={$:"Apr"},iM={$:"Aug"},oM={$:"Dec"},uM={$:"Feb"},sM={$:"Jan"},cM={$:"Jul"},fM={$:"Jun"},lM={$:"Mar"},dM={$:"May"},hM={$:"Nov"},pM={$:"Oct"},gM={$:"Sep"},vM=function(e){var t=f(XO,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)}},yM=r(function(e,t){switch(vM(f(eM,e,t)).month){case 1:return sM;case 2:return uM;case 3:return lM;case 4:return aM;case 5:return dM;case 6:return fM;case 7:return cM;case 8:return iM;case 9:return gM;case 10:return pM;case 11:return hM;default:return oM}}),mM=r(function(e,t){return f(Ns,60,f(XO,Vd(t),1e3))}),bM={$:"Fri"},CM={$:"Mon"},EM={$:"Sat"},SM={$:"Sun"},TM={$:"Thu"},wM={$:"Tue"},IM={$:"Wed"},AM=r(function(e,t){switch(f(Ns,7,f(XO,f(eM,e,t),1440))){case 0:return TM;case 1:return bM;case 2:return EM;case 3:return SM;case 4:return CM;case 5:return wM;default:return IM}}),BM=n(function(e,t,r){return e.toAmPm(f(tM,t,r))}),kM=r(function(e,t){return vM(f(eM,e,t)).day}),NM=kM,RM=M([SM,CM,wM,IM,TM,bM,EM]),$M=r(function(e,t){return function(e){return e.a}(f($c,L(0,SM),Yl(f(gl,function(r){return R(r.b,f(AM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),RM)))))}),_M=function(e){return l(Ra,Na,0,e)},LM=r(function(e,t){return vM(f(eM,e,t)).year}),xM=function(e){return!f(Ns,4,e)&&(!!f(Ns,100,e)||!f(Ns,400,e))},PM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return xM(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}}),DM=M([sM,uM,lM,aM,dM,fM,cM,iM,gM,pM,hM,oM]),UM=r(function(e,t){return f($c,L(0,sM),Yl(f(gl,function(r){r.a;return R(r.b,f(yM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),DM))))}),OM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(UM,e,t))}),MM=r(function(e,t){var r=f(sc,f(OM,e,t)-1,DM);return _M(f(xa,PM(f(LM,e,t)),r))+f(NM,e,t)}),FM=r(function(e,t){return f(OM,e,t)/4|0}),VM=r(function(e,t){var r=Ni(t),n=e-Yo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),KM=function(e){return e?e<=12?e:e-12:12},HM=iv(315576e5),jM=r(function(e,t){return Ol(HM*f(LM,e,t))}),qM=r(function(e,t){var r=f(jM,e,t),n=f($M,e,r);return 1+((f(MM,e,t)+n)/7|0)}),GM=r(function(e,t){return Ni(f(LM,e,t))}),zM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(OM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(OM,t,r));case"MonthFixed":return f(VM,2,f(OM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(yM,t,r));case"MonthNameFull":return e.toMonthName(f(yM,t,r));case"QuarterNumber":return Ni(1+f(FM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(FM,t,r));case"DayOfMonthNumber":return Ni(f(NM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(NM,t,r));case"DayOfMonthFixed":return f(VM,2,f(NM,t,r));case"DayOfYearNumber":return Ni(f(MM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(MM,t,r));case"DayOfYearFixed":return f(VM,3,f(MM,t,r));case"DayOfWeekNumber":return Ni(f($M,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f($M,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(AM,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(AM,t,r));case"WeekOfYearNumber":return Ni(f(qM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(qM,t,r));case"WeekOfYearFixed":return f(VM,2,f(qM,t,r));case"YearNumberLastTwo":return f(nu,2,f(GM,t,r));case"YearNumber":return f(GM,t,r);case"AmPmUppercase":return ID(l(BM,e,t,r));case"AmPmLowercase":return id(l(BM,e,t,r));case"HourMilitaryNumber":return Ni(f(tM,t,r));case"HourMilitaryFixed":return f(VM,2,f(tM,t,r));case"HourNumber":return Ni(KM(f(tM,t,r)));case"HourFixed":return f(VM,2,KM(f(tM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(tM,t,r));case"HourMilitaryFromOneFixed":return f(VM,2,1+f(tM,t,r));case"MinuteNumber":return Ni(f(nM,t,r));case"MinuteFixed":return f(VM,2,f(nM,t,r));case"SecondNumber":return Ni(f(mM,t,r));case"SecondFixed":return f(VM,2,f(mM,t,r));case"MillisecondNumber":return Ni(f(rM,t,r));case"MillisecondFixed":return f(VM,3,f(rM,t,r));default:return n.a}}),YM=a(function(e,t,r,n){return f(Ri,"",f(xa,l(zM,e,r,n),t))}),WM=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),JM=function(e){return e>11?"pm":"am"},QM=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"}},XM=function(e){switch(f(Ns,100,e)){case 11:case 12:case 13:return"th";default:switch(f(Ns,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},ZM=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"}},eF=p(WM,QM,f(jo,QM,Zo(3)),ZM,f(jo,ZM,Zo(3)),JM,XM),tF=YM(eF),rF={$:"MonthNameFull"},nF=rF,aF=function(e){return{$:"Text",a:e}},iF=aF,oF={$:"YearNumber"},uF=oF,sF=n(function(e,t,n){var a=r(function(e,t){return f(PN,M([vN(18),IN(6)]),M([f(Mk,M([NN]),ul(e)),f(Mk,M([QO]),ul(t))]))}),i=tF(M([nF,iF(", "),uF])),o=f(PN,M([IN(23),mT(Vk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,JO,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+n$(n.amountReleased)+" "+IR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+n$(n.amountBurned)+" "+IR(e)+" Burned")])),M([f(Mk,M([EN]),f(YO,"View User History",WO(n.asRole)))])));return f(PN,M([oN(8),nU,aU,Gk(ER),IN(1),q$({blur:20,color:d(jR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Mk,M([mT(Vk),Gk(Xk),eR(17)]),f(p$,18,t)),f(Mk,M([mT(Vk),Gk(Xk),eR(17)]),o)]))}),cF=n(function(e,t,r){var n=l(zO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=OO(e.parameters.initiatorRole)+" Stats";return f(Mk,r?M([zL(f(Mk,M([YL(30),_N]),l(sF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(QL,a,f(ON,M([mT(Vk),IN(20),aN,lN(qO)]),f(xa,ON(M([IN(5)])),M([M([f(sR,M([pT(jk(28))]),jO),f(Mk,M([vN(24),lR,vA(VO)]),ul(l(Bs,2,P("0"),Ni(n.numReleases))))]),M([f(sR,M([pT(jk(28))]),KO),f(Mk,M([vN(24),lR,vA(MO)]),ul(l(Bs,2,P("0"),Ni(n.numAborts))))]),M([f(sR,M([pT(jk(28))]),HO),f(Mk,M([vN(24),lR,vA(FO)]),ul(l(Bs,2,P("0"),Ni(n.numBurns))))])])))))}),fF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+cl(t)}e.a;return"https://kovan.etherscan.io/address/"+cl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+cl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+cl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+cl(t)}}),lF=n(function(e,t,r){return f(cA,e,{label:ul(cl(r)),url:f(fF,t,r)})}),dF=function(e){return f(QL,"Trade Status",f(PN,M([vN(24),lR,IN(8)]),M([ul(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(lF,M([vN(12),vA(C_),Z_]),e.factory,e.creationInfo.address)])))},hF=i(function(e,t,r,n,a){return LO(M([dF(t),f(PO,t,r),UO(t),l(cF,t,n,a)]))}),pF=l(Pk,9,32,107),gF=nR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),vF=f(Mk,M([oN(4),aN,lN(AO),eR(5),Gk(l(Pk,22,0,255))]),f(sR,M([mT(jk(42))]),gF)),yF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},mF=function(e){return f(PN,M([oN(12),Gk(ER),eR(15),IN(15)]),M([f(Mk,M([vN(24),hN,IU]),ul("Fiat Payment Method")),f(kN,M([vN(18),pT(vT),Gk(Xk),q$({blur:5,color:d(jR,0,0,0,.2),offset:L(-3,3),size:0}),oN(3),eR(5)]),M([f($c,f(Mk,M([vA(xD),IU]),ul("No payment methods found.")),f(Io,ul,f(Io,function(e){return e.info},Yl(e))))]))]))},bF={$:"Active"},CF=function(e){return{$:"ExpandPhase",a:e}},EF=M([Gk(pF),vA(Xk)]),SF=r(function(e,t){return{$:"Min",a:e,b:t}}),TF=r(function(e,t){return f(SF,e,t)}),wF=function(e){return M(e?[oN(12),n_,pT(f(TF,380,vT))]:[oN(12),EN])},IF=M([Gk(Xk)]),AF=nR({description:"flame",src:"/DAIHard/static/img/flame.png"}),BF=r(function(e,t){return Fl(f(cs,Vl(e),Vl(t)))}),kF=r(function(e,t){return d(z_,x(d(jR,1,.6,.2,1),d(jR,1,.6,.2,.8),d(jR,1,.6,.2,.6)),Xk,e,t)}),NF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),RF=function(e){return{$:"ContractActionClicked",a:e}},$F={$:"Web3Connect"},_F=n(function(e,t,r){var n=Hd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(RR,e,t).$?Kk:f(ON,M([IN(8)]),function(){var e=x(t.state.phase,f(wo,t,a.address),f(Ao,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,LE,f(YO,"Remove and Refund this Trade",$E))])}break e}var r=(e.a,e.b,Vl(fb(t.parameters)));return M([f(Y_,"Deposit and Commit to Trade",l(NF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,RF,f(kF,"Abort Trade",vE)),f(Yi,RF,f(Y_,"Confirm Payment",TE)),vF])}e.a,e.c.a;return M([vF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,RF,f(Y_,"Burn it All!",SE)),f(Yi,RF,f(YO,"Release Everything",_E)),vF])}e.a,e.c.a;return M([vF])}break e;default:break e}return yr}())}return f(Y_,"Connect to Wallet",$F)}),LF={$:"Finished"},xF={$:"NotStarted"},PF=r(function(e,t){var r=L(yR(t),yR(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?xF:R(n,a)?bF:LF}),DF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),UF=r(function(e,t){return l(DF,yr,e,t)}),OF=a(function(e,t,r,n){var a=n$(f(uh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+IR(r.factory),i=n$(r.parameters.tradeAmount)+" "+IR(r.factory),o=f(ON,yr,f(UF,3,f(sR,M([pT(jk(18))]),AF))),u=f(Da,Mk(M([vA(l(lA,1,0,0))])),ul),s=R(e,r.state.phase),c=f(To,Ao(r),f(Io,function(e){return e.address},Hd(n))),d=s?Xk:_R,h=kN(M([vA(d),vN(18),hN])),p=NO(r.terms.price),g=s?l(Pk,0,226,255):l(Pk,16,7,234),v=f(Da,Mk(M([vA(g)])),ul),y=n$(r.parameters.buyerDeposit)+" "+IR(r.factory),m=r.parameters.abortPunishment,b=n$(m)+" "+IR(r.factory),C=n$(f(BF,r.parameters.buyerDeposit,m))+" "+IR(r.factory),E=n$(f(BF,r.parameters.tradeAmount,m))+" "+IR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([ul("Your "),u("burnable deposit"),ul(" of "),v(y),ul(" is now held in this contract, and your offer to buy "),v(i),ul(" for "),v(p),ul(" is now listed in the marketplace.")]),M([ul("If another user likes your offer, they can become the Seller by depositing the full "),v(i),ul(" into this contract.")]),M([ul("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),ul(" to you.")])])):f(xa,h,M([M([ul("Your offer to sell the "),v(i),ul(" held in this contract for "),v(p),ul(" is now listed in the marketplace.")]),M([ul("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),ul(" of 1/3 of the trade amount "),v("("+y+")"),ul(" into this contract.")]),M([ul("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),ul(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([ul("You must now pay the Seller "),v(p),ul(" via the Fiat Payment Method, "),f(Mk,M([hN]),ul("and then click ")),u("Confirm Payment"),ul(" before the payment window runs out. Use the chat to coordinate.")]),M([ul("If you abort the trade, or do not confirm payment before this time is up, "),v(b),ul(" (1/4 of the "),u("burnable deposit"),ul(") will be "),u("burned"),ul(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ul(" to the Seller, "),v(C),ul(" to you).")]),M([ul("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),ul(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([ul("Work and communicate with the Buyer to receive "),v(p),ul(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([ul("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),ul(" (1/4 of the "),u("burnable deposit"),ul(") will be "),u("burned"),ul(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ul(" to you, "),v(C),ul(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([ul("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),ul(" will be released to you.")]),M([ul("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),ul(" In this case the "),v(a),ul(" will be lost to both parties.")]),M([ul("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([ul("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([ul("So, have you recieved the "),v(p),ul("? If so, you can click "),v("Release Everything"),ul(".")]),M([ul("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),ul(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([ul("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([ul("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([ul("The Seller has deposited "),v(i),ul(" into this contract, and offers to sell it for "),v(p),ul(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),ul(" into this contract by clicking "),u("Deposit and Commit to Trade"),ul(".")]),M([ul("If the trade is successful, the combined "+IR(r.factory)+" balance "),v("("+a+")"),ul(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,ul(" for both parties (see Payment Window for more on this).")]),M([ul("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),ul(" within the payment window.")])])):f(xa,h,M([M([ul("The Buyer is offering to buy "),v(i),ul(" for "),v(p),ul(", and has deposited "),v(y),ul(" into this contract as a "),u("burnable deposit"),ul(". To become the Seller, deposit "),v(i),ul(" into this contract by clicking "),u("Deposit and Commit to Trade"),ul(".")]),M([ul("When you receive the "),v(p),ul(" from the Buyer, the combined "+IR(r.factory)+" balance "),v("("+a+")"),ul(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,ul(" for both parties (see Payment Window for more on this).")]),M([ul("Don't commit unless you can receive "),v(p),ul(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([ul("During this phase, the Buyer is expected to transfer "),v(p),ul(" to the Seller, as described in Fiat Payment Method, "),f(Mk,M([hN]),ul("and ")),u("Confirm the Payment "),ul(" before the payment window runs out. This would move the trade to the final phase.")]),M([ul("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),ul(" (1/4 of the "),u("burnable deposit"),ul(" amount) will be "),u("burned"),ul(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ul(" to the Seller, "),v(C),ul(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([ul("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([ul("If the Seller can verify he has received the "),v(p),ul(", he will probably release the total balance of "),v(i),ul(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),ul(".")]),M([ul("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),ul(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(PN,M([mT(Vk),pT(Vk),eR(20),IN(30)]),M([f(ON,M([mT(Vk)]),M([f(Mk,M([vN(24),hN,vA(g),S$]),ul(T))])),f(PN,M([mT(Vk),JN,IN(13)]),w),f(Mk,M([_N]),function(){switch(f(PF,r,e).$){case"Active":return l(_F,t,r,n);case"NotStarted":return f(Mk,M([vN(20),hN,IU,vA(vR)]),ul("Phase not yet started."));default:return f(Mk,M([vN(20),hN,IU]),ul("Phase no longer active."))}}())]))}),MF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},FF=nR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),VF=nR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),KF={$:"None"},HF=KF,jF=nR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),qF=function(e){switch(e.$){case"Open":return jF;case"Committed":return FF;case"Judgment":return VF;default:return HF}},GF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),zF=a(function(e,t,r,n){return d(GF,e,t,r,n)}),YF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},WF=function(e){return function(e){return d(zF,e.red,e.green,e.blue,e.alpha)}(YF(e))},JF=function(e){return{$:"Circle",a:e}},QF=JF,XF=d(GF,0,0,0,1),ZF={$:"Flat"},eV={$:"Sharp"},tV=function(e){return{$:"Uniform",a:e}},rV=tV,nV={cap:ZF,dashPattern:yr,dashPhase:0,fill:rV(XF),join:eV,thickness:2},aV=n(function(e,t,r){return D(nV,{dashPattern:e,fill:r,thickness:t})}),iV=aV(yr),oV={$:"Transparent"},uV=oV,sV=f(iV,0,uV),cV=r(function(e,t){return{$:"Shape",a:e,b:t}}),fV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},lV=function(e){return f(Da,fV,cV(e))},dV=function(e){return lV(L(e,sV))},hV=function(e){return L(-e.a,-e.b)},pV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),gV=r(function(e,t){return f(pV,hV(e(t)),t)}),vV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},yV=r(function(e,t){return{$:"Path",a:e,b:t}}),mV=kr,bV=Nr,CV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=bV(n),i=mV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},EV=function(e){return xa(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)})},SV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(EV,e,M([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),TV=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},wV=function(e){var t=IV(e.basic),r=vV(f(xa,CV(e),t)),n=r.a,a=r.b;return{toBottom:-f($c,0,dI(a)),toLeft:-f($c,0,dI(n)),toRight:f($c,0,lI(n)),toTop:f($c,0,lI(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(SV,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(SV,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(SV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(EV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(yV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(EV,R(C,ZF)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(SV,0,E);case"Group":var S=e.a;return f(EV,0,ty(f(xa,f(jo,wV,TV),S)));default:var T=e.b;return f(EV,0,TV(wV(T)))}},AV=function(e){var t=wV(e);return t.toTop+t.toBottom},BV=function(e){var t=wV(e);return L(-t.toLeft,t.toTop)},kV=function(e){var t=wV(e);return t.toLeft+t.toRight},NV=En("http://www.w3.org/2000/svg"),RV=NV("svg"),$V=Nn("height"),_V=Nn("version"),LV=Nn("width"),xV=NV("circle"),PV=NV("ellipse"),DV=NV("foreignObject"),UV=NV("g"),OV=NV("image"),MV=NV("polygon"),FV=NV("polyline"),VV=NV("rect"),KV=Cw,HV=NV("text"),jV=Nn("id"),qV=Nn("points"),GV=Nn("r"),zV=Nn("rx"),YV=Nn("ry"),WV=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},JV=function(e){return{$:"Group",a:e}},QV=Nn("dominant-baseline"),XV=Nn("fill"),ZV=Nn("fill-opacity"),eK=Nn("font-family"),tK=Nn("font-size"),rK=Nn("font-style"),nK=Nn("font-variant"),aK=Nn("font-weight"),iK=Nn("opacity"),oK=Nn("stroke"),uK=Nn("stroke-dasharray"),sK=Nn("stroke-dashoffset"),cK=Nn("stroke-linecap"),fK=Nn("stroke-linejoin"),lK=Nn("stroke-opacity"),dK=Nn("stroke-width"),hK=Nn("text-anchor"),pK=Nn("text-decoration"),gK=Nn("transform"),vK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},yK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},mK=n(function(e,t,r){return d(GF,e,t,r,1)}),bK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return iv(1e4*e)/100};return yd(M(["rgba(",gw(i(t)),"%,",gw(i(r)),"%,",gw(i(n)),"%,",gw(function(e){return iv(1e3*e)/1e3}(a)),")"]))},CK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},EK=function(e){var t=CK(e),r=t.red,n=t.green,a=t.blue;return bK(l(mK,r,n,a))},SK=function(e){if("Uniform"===e.$){var t=e.a;return EK(t)}return"none"},TK=function(e){var t=CK(e),r=t.alpha;return gw(r)},wK=function(e){if("Uniform"===e.$){var t=e.a;return TK(t)}return"0"},IK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},AK=function(e){var t=gw(e.scale.b),r=gw(e.scale.a),n=gw(-e.rotation/2/x$*360),a=gw(-e.shift.b),i=gw(e.shift.a);return yd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},BK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([oK(SK(r.fill)),lK(wK(r.fill)),dK(gw(r.thickness)),cK(vK(r.cap)),fK(IK(r.join)),XV("none"),iK(gw(e.opacity)),gK(AK(e)),sK(Ni(r.dashPhase)),uK(yK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([XV(SK(a)),ZV(wK(a)),oK(SK(r.fill)),lK(wK(r.fill)),dK(gw(r.thickness)),cK(vK(r.cap)),fK(IK(r.join)),iK(gw(e.opacity)),gK(AK(e)),sK(Ni(r.dashPhase)),uK(yK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([XV(SK(tV(o.color))),eK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),tK(Ni(o.size)),aK(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"}}()),rK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),nK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),pK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),hK("middle"),QV("middle"),gK(AK(e))]);default:return M([gK(AK(e))])}},kK=Nn("x"),NK=Nn("y"),RK=r(function(e,t){return M([LV(gw(e)),$V(gw(t)),kK(gw(-e/2)),NK(gw(-t/2))])}),$K=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([gw(t),gw(-r)]))},e))},_K=cN,LK=r(function(e,t){return f(e,t.a,t.b)}),xK=function(e){return f(xa,LK(_K),e)},PK=function(e){e:for(;;){var t=f($c,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(FV,U(M([jV(t),qV($K(i))]),U(BK(e),xK(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(MV,U(M([jV(t),qV($K(i))]),U(BK(e),xK(e.handlers))),yr);case"Circle":var c=s.a;return f(xV,U(M([jV(t),GV(gw(c))]),U(BK(e),xK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(PV,U(M([jV(t),zV(gw(d)),YV(gw(h))]),U(BK(e),xK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(VV,U(M([jV(t),zV(gw(c)),YV(gw(c))]),U(f(RK,p,g),U(BK(e),xK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(yV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(HV,U(M([jV(t)]),U(BK(e),xK(e.handlers))),M([KV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(OV,U(M([jV(t),WV(C)]),U(f(RK,p,g),U(BK(e),xK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(DV,U(M([jV(t)]),U(f(RK,p,g),U(BK(e),xK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(UV,f(ka,jV(t),U(BK(e),xK(e.handlers))),l(Ra,r(function(e,t){return f(ka,PK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:JV(M([w,I]))});e=v;continue e}}},DK=r(function(e,t){var r=e.a,n=e.b,a=gw(r),i=gw(n);return f(VT,yr,M([f(RV,M([LV(a),$V(i),_V("1.1")]),M([PK(t)]))]))}),UK=function(e){return f(DK,L(kV(e),AV(e)),f(gV,BV,e))},OK=r(function(e,t){var r=qF(e),n=function(){switch(t.$){case"NotStarted":return l(Pk,10,33,108);case"Active":return l(Pk,0,100,170);default:return l(Pk,1,129,104)}}(),a=sx(UK(f(dV,rV(WF(n)),QF(50))));return f(Mk,M([EN,d_(f(sR,M([EN,JN,pT(jk(60))]),r))]),a)}),MK=function(e){var t=M([IU,hN,vN(20)]);switch(e.$){case"Active":return f(Mk,U(t,M([vA(mN)])),ul("Active"));case"NotStarted":return f(Mk,U(t,M([vA(vR)])),ul("Not Started"));default:return f(Mk,t,ul("Finished"))}},FK=n(function(e,t,r){var n=f(PF,t,e),a=function(){return"Active"===n.$?l(Pk,0,226,255):_R}(),i=f(Mk,M([vA(a),vN(20),hN,EN]),ul(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 Kk;switch(n.$){case"NotStarted":return d(WR,M([EN]),M([vN(22),lR]),L(_R,ER),f(kR,e,t));case"Active":var a=f(RR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(r$,M([EN]),M([vN(22),lR]),L(Xk,ER),i)}return f(PN,M([EN,IN(10)]),M([f(Mk,M([EN]),ul(MF(e))),f(YO,"Poke",LE(RE))]));default:return f(Mk,M([pT(jk(1))]),Kk)}}();return f(PN,M([eR(20),IN(10),pT(Vk)]),M([f(Mk,M([n_,EN]),i),f(Mk,M([pT(Vk),EN]),f(Mk,M([JN]),f(OK,e,n))),f(PN,M([IN(10),X_,EN]),M([f(Mk,M([EN]),MK(n)),o]))]))}),VK=o(function(e,t,r,n,a,i){var o=f(PF,r,t),u=f(Mk,M([eR(10),mT(Vk),pT(Vk)]),d(OF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Ol(0)}}(),c=l(FK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(NR,f(gb,r.state.phaseStartTime,s),i);default:Ol(0)}}(),f(Mk,M([pT(Vk),mT(jk(1)),Gk(function(){return"Active"===o.$?l(lA,0,0,1):ER}())]),Kk)),p=a?f(ON,U(wF(e),U(R(o,bF)?EF:IF,M([mT(Vk)]))),M([c,h,u])):f(ON,U(wF(e),U(R(o,bF)?EF:IF,M([aN,lN(CF(t))]))),M([c]));return!e&&R(o,bF)?f(PN,M([mT(Vk),IN(20),v$({bottom:20,left:0,right:0,top:0})]),M([p,mF(r.terms.paymentMethods)])):p}),KK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(ON,M([EN,oN(12),eR(30),IN(10),Gk(pF),vN(24),hN,vA(Xk)]),M([ul("Trade "+yF(t.state.closedReason)),vF])):e?f(PN,M([mT(Vk),IN(10)]),M([f(ON,M([mT(Vk),pT(vT),IN(20)]),M([p(VK,e,bo,t,n,R(r,bo),a),p(VK,e,yo,t,n,R(r,yo),a),p(VK,e,mo,t,n,R(r,mo),a)])),mF(t.terms.paymentMethods)])):f(PN,M([mT(Vk),pT(vT),IN(20)]),M([p(VK,e,bo,t,n,R(r,bo),a),p(VK,e,yo,t,n,R(r,yo),a),p(VK,e,mo,t,n,R(r,mo),a)]))}),HK=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(PN,M([mT(Vk),pT(Vk),IN(40)]),M([h(hF,t,i,n.wallet,r,n.showStatsModal),f(Mk,M([mT(Vk),f(tN,40,0),IN(40)]),h(KK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Mk,M([EN,JN,vN(30)]),ul("Loading trade info..."));default:return f(Mk,M([EN,JN,vN(30)]),ul("Invalid trade"))}}(),M([BO(n),_O(n)]))}),jK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),qK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(AU,yr);case"CreateModel":var n=r.a;return L(f(Yi,xy,gU(n)),yr);case"TradeModel":var a=r.a;return l(jK,Yi(Uy),xa(Yi(Uy)),d(HK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,uT,l(pO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,nT,l(p_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Mk,M([mT(Vk),pT(Vk),oN(10)]),n),a)}),GK=function(e){return{$:"DismissNotice",a:e}},zK=function(e){return f(O$,zU,YU(e))},YK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(lA,1,1,1):l(lA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Pk,100,200,255);case"Caution":return l(Pk,255,188,0);case"Error":return l(Pk,255,70,70);default:return l(Pk,200,200,200)}}(),o=f(Mk,M([_N,n_,M$(5),zK(5)]),E_(GK(t)));return f(Mk,M([Gk(i),oN(10),eR(8),mT(Vk),f$(1),s$(d(jR,0,0,0,.15)),UD]),f(PN,M([IN(4),mT(Vk)]),f(Bi,r(function(e,t){return f(kN,M([mT(Vk),vA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},WK=function(e){return R(e,yr)?yr:M([f(PN,M([WU(20),M$(20),IN(10),_N,X_,mT(jk(300)),vN(15)]),f(xa,YK,f(gl,function(e){return R(e.b.align,al)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(PN,M([zK(20),YL(100),IN(10),S$,n_,mT(jk(300)),vN(15)]),f(xa,YK,f(gl,function(e){return R(e.b.align,yB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},JK=r(function(e,t){var r=f(qK,e,t),n=r.a,a=r.b;return L(f(PN,M([XR(zk),d_(MN(t)),mT(Vk),pT(Vk),eR(30)]),M([f(Mk,M([pT(jk(50))]),Kk),n])),U(a,WK(t.userNotices)))}),QK=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),XK=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),ZK={$:"AllowHover"},eH={$:"Layout"},tH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(fA,155/255,203/255,1,1),offset:L(0,0),size:3})},rH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?tH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?ZK:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?eH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},nH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(TT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),TT);case"Text":var a=t.a;return kI(a);default:return kI("")}}),aH=n(function(e,t,r){var n=rH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?QK(n):XK(n)}();return f(nH,a,d(uA,TT,Ok,t,ET(M([r]))))}),iH=JT(5),oH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),uH={$:"SansSerif"},sH=function(e){return{$:"Typeface",a:e}},cH=Y,fH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",cH(id(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",cH(id(t)));default:var t=e.a.name;return f(Ri,"-",cH(id(t)))}}())}),lH=function(){var e=M([sH("Open Sans"),sH("Helvetica"),sH("Verdana"),uH]);return M([f(pA,qk,l(hA,"bg-color-"+gA(d(fA,1,1,1,0)),"background-color",d(fA,1,1,1,0))),f(pA,dA,l(hA,"font-color-"+gA(d(fA,0,0,0,1)),"color",d(fA,0,0,0,1))),f(pA,pN,gN(20)),f(pA,iH,f(oH,l(Ra,fH,"font-",e),e))])}(),dH=n(function(e,t,r){var n=e.options;return l(aH,n,f(ka,sA(f(Ri," ",M([BT.root,BT.any,BT.single]))),U(lH,t)),r)}),hH=dH({options:yr}),pH=function(e){return f(pA,iH,f(oH,l(Ra,fH,"ff-",e),e))},gH=uH,vH=sH,yH=function(e){return{body:M([function(){var t=f(JK,e.screenWidth,e),r=t.a,n=t.b,a=U(M([mT(Vk),pT(Vk),pH(M([vH("Soleil"),gH]))]),f(xa,d_,n));return f(hH,a,r)}()]),title:"DAIHard"}},mH=Ht,bH=mH({init:PB,onUrlChange:xk,onUrlRequest:Lk,subscriptions:_k,update:iB,view:yH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:bH(f(cu,function(e){return f(cu,function(t){return f(cu,function(r){return Fi({height:r,networkId:t,width:e})},f(Ph,"height",jC))},f(Ph,"networkId",jC))},f(Ph,"width",jC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/src/AgentHistory/State.elm b/src/AgentHistory/State.elm index 4e12609..55c2305 100644 --- a/src/AgentHistory/State.elm +++ b/src/AgentHistory/State.elm @@ -14,6 +14,8 @@ import Eth import Eth.Sentry.Event as EventSentry exposing (EventSentry) import Eth.Types exposing (Address) import FiatValue exposing (FiatValue) +import Filters.State as Filters +import Filters.Types as Filter import Flip exposing (flip) import Helpers.BigInt as BigIntHelpers import Helpers.Eth as EthHelpers @@ -25,7 +27,6 @@ import Time import TokenValue exposing (TokenValue) import TradeCache.State as TradeCache import TradeCache.Types as TradeCache exposing (TradeCache) -import TradeTable.Filters.Types as Filter import TradeTable.State as TradeTable import TradeTable.Types as TradeTable import Wallet @@ -35,13 +36,15 @@ init : Wallet.State -> Address -> ( Model, Cmd Msg ) init wallet agentAddress = ( { wallet = wallet , agentAddress = agentAddress - , tradeTable = - TradeTable.init - ( TradeTable.Phase, TradeTable.Ascending ) + , filters = + Filters.init [ Filter.phases True True True False , Filter.offerType True True , Filter.role agentAddress True True ] + , tradeTable = + TradeTable.init + ( TradeTable.Phase, TradeTable.Ascending ) } , Cmd.none ) @@ -81,6 +84,13 @@ update msg prevModel = ChainCmd.none [ AppCmd.GotoRoute (Routing.Trade factory id) ] + FiltersMsg filtersMsg -> + justModelUpdate + { prevModel + | filters = + prevModel.filters |> Filters.update filtersMsg + } + TradeTableMsg tradeTableMsg -> let ttUpdateResult = diff --git a/src/AgentHistory/Types.elm b/src/AgentHistory/Types.elm index 249f56c..2575808 100644 --- a/src/AgentHistory/Types.elm +++ b/src/AgentHistory/Types.elm @@ -1,4 +1,4 @@ -module AgentHistory.Types exposing (Model, Msg(..), UpdateResult) +module AgentHistory.Types exposing (Model, Msg(..), UpdateResult, justModelUpdate) import AppCmd exposing (AppCmd) import Array exposing (Array) @@ -11,6 +11,7 @@ import Eth.Net import Eth.Sentry.Event as EventSentry exposing (EventSentry) import Eth.Types exposing (Address) import FiatValue exposing (FiatValue) +import Filters.Types as Filters import Helpers.Eth as EthHelpers import Http import Json.Decode @@ -27,6 +28,7 @@ import Wallet type alias Model = { wallet : Wallet.State , agentAddress : Address + , filters : Filters.Model , tradeTable : TradeTable.Model } @@ -34,6 +36,7 @@ type alias Model = type Msg = Poke Address | TradeClicked FactoryType Int + | FiltersMsg Filters.Msg | TradeTableMsg TradeTable.Msg | NoOp @@ -44,3 +47,12 @@ type alias UpdateResult = , chainCmd : ChainCmd Msg , appCmds : List (AppCmd Msg) } + + +justModelUpdate : Model -> UpdateResult +justModelUpdate model = + UpdateResult + model + Cmd.none + ChainCmd.none + [] diff --git a/src/AgentHistory/View.elm b/src/AgentHistory/View.elm index e2cda4a..f4216b6 100644 --- a/src/AgentHistory/View.elm +++ b/src/AgentHistory/View.elm @@ -12,6 +12,7 @@ import Element.Font import Element.Input import Eth.Types exposing (Address) import FiatValue exposing (FiatValue) +import Filters.View as Filters import Helpers.Element as EH import Helpers.Time as TimeHelpers import Html.Events.Extra @@ -35,10 +36,11 @@ root time tradeCaches model = , Element.Background.color EH.white , Element.width Element.fill , Element.height Element.fill - , Element.paddingXY 0 20 + , Element.paddingXY 30 20 ] [ pageTitleElement model - , resultsAndStatusElement time tradeCaches model + , statusAndFiltersElement tradeCaches model + , maybeResultsElement time tradeCaches model ] @@ -75,37 +77,18 @@ pageTitleElement model = ] -tradeMatchesUserRole : CTypes.FullTradeInfo -> BuyerOrSeller -> Address -> Bool -tradeMatchesUserRole trade role userAddress = - CTypes.getBuyerOrSeller trade userAddress == Just role - - -resultsAndStatusElement : Time.Posix -> List TradeCache -> Model -> Element Msg -resultsAndStatusElement time tradeCaches model = +statusAndFiltersElement : List TradeCache -> Model -> Element Msg +statusAndFiltersElement tradeCaches model = let statusMsgElement s = Element.el - [ Element.Font.size 24 + [ Element.Font.size 20 , Element.Font.semiBold , Element.Font.color EH.darkGray , Element.centerX - , Element.padding 20 ] (Element.text s) - userTrades = - tradeCaches - |> List.map - (\tradeCache -> - TradeCache.loadedValidTrades tradeCache - |> filterTrades - (basicFilterFunc model) - ) - |> List.concat - - visibleTrades = - userTrades - statusMessages : List (Element Msg) statusMessages = if List.all ((==) TradeCache.NoneFound) (List.map TradeCache.loadingStatus tradeCaches) then @@ -117,13 +100,13 @@ resultsAndStatusElement time tradeCaches model = (\tc -> case TradeCache.loadingStatus tc of TradeCache.QueryingNumTrades -> - Just <| factoryName tc.factory ++ "Querying Factory..." + Just <| "Querying " ++ factoryName tc.factory ++ " Factory..." TradeCache.NoneFound -> Nothing TradeCache.FetchingTrades -> - Just <| factoryName tc.factory ++ "Fetching Trades" + Just <| "Fetching " ++ factoryName tc.factory ++ " Trades..." TradeCache.AllFetched -> Nothing @@ -131,22 +114,34 @@ resultsAndStatusElement time tradeCaches model = |> Maybe.Extra.values |> List.map statusMsgElement in - Element.column - [ Element.spacing 10 - , Element.width Element.fill - ] - [ case statusMessages of - [] -> - Element.none - - _ -> - Element.column [ Element.spacing 5 ] statusMessages - , maybeResultsElement time visibleTrades model + Element.el + [ Element.width Element.fill + , Element.inFront <| + Element.column + [ Element.spacing 5 + , Element.alignLeft + ] + statusMessages ] + (Element.el + [ Element.centerX ] + (Element.map FiltersMsg <| Filters.view model.filters) + ) -maybeResultsElement : Time.Posix -> List CTypes.FullTradeInfo -> Model -> Element Msg -maybeResultsElement time visibleTrades model = +maybeResultsElement : Time.Posix -> List TradeCache -> Model -> Element Msg +maybeResultsElement time tradeCaches model = + let + visibleTrades = + tradeCaches + |> List.map + (\tradeCache -> + TradeCache.loadedValidTrades tradeCache + |> filterTrades + (basicFilterFunc model) + ) + |> List.concat + in if visibleTrades == [] then Element.none diff --git a/src/Contracts/Types.elm b/src/Contracts/Types.elm index 5102ac9..c9a523e 100644 --- a/src/Contracts/Types.elm +++ b/src/Contracts/Types.elm @@ -358,7 +358,7 @@ deriveValues parameters state terms = parameters.autoreleaseInterval Closed -> - Time.millisToPosix 0 + Time.millisToPosix (2 ^ 31 - 1) in { phaseEndTime = TimeHelpers.add diff --git a/src/TradeTable/Filters/State.elm b/src/Filters/State.elm similarity index 88% rename from src/TradeTable/Filters/State.elm rename to src/Filters/State.elm index 845791b..ed6e543 100644 --- a/src/TradeTable/Filters/State.elm +++ b/src/Filters/State.elm @@ -1,7 +1,7 @@ -module TradeTable.Filters.State exposing (init, update) +module Filters.State exposing (init, update) +import Filters.Types exposing (..) import List.Extra -import TradeTable.Filters.Types exposing (..) init : List FilterSet -> Model diff --git a/src/TradeTable/Filters/Types.elm b/src/Filters/Types.elm similarity index 78% rename from src/TradeTable/Filters/Types.elm rename to src/Filters/Types.elm index e92d44f..906c089 100644 --- a/src/TradeTable/Filters/Types.elm +++ b/src/Filters/Types.elm @@ -1,4 +1,4 @@ -module TradeTable.Filters.Types exposing (FilterSet, Model, Msg(..), Option, filterTrades, offerType, phases, role) +module Filters.Types exposing (FilterSet, Model, Msg(..), Option, filterTrade, filterTrades, offerType, phases, role) import CommonTypes exposing (..) import Contracts.Types as CTypes @@ -82,15 +82,17 @@ offerType buyingChecked sellingChecked = filterTrades : List FilterSet -> List CTypes.FullTradeInfo -> List CTypes.FullTradeInfo filterTrades filterSets trades = trades - |> List.filter - (\trade -> - filterSets - |> List.all - (\filterSet -> - filterSet.options - |> List.any - (\option -> - option.checked && option.testTrade trade - ) + |> List.filter (filterTrade filterSets) + + +filterTrade : List FilterSet -> CTypes.FullTradeInfo -> Bool +filterTrade filterSets trade = + filterSets + |> List.all + (\filterSet -> + filterSet.options + |> List.any + (\option -> + option.checked && option.testTrade trade ) ) diff --git a/src/TradeTable/Filters/View.elm b/src/Filters/View.elm similarity index 91% rename from src/TradeTable/Filters/View.elm rename to src/Filters/View.elm index a5e162e..4fd3bdb 100644 --- a/src/TradeTable/Filters/View.elm +++ b/src/Filters/View.elm @@ -1,9 +1,9 @@ -module TradeTable.Filters.View exposing (view) +module Filters.View exposing (view) import Element exposing (Element) import Element.Font import Element.Input -import TradeTable.Filters.Types exposing (..) +import Filters.Types exposing (..) view : Model -> Element Msg diff --git a/src/Marketplace/State.elm b/src/Marketplace/State.elm index 51a867f..0c507bc 100644 --- a/src/Marketplace/State.elm +++ b/src/Marketplace/State.elm @@ -11,6 +11,8 @@ import Contracts.Wrappers import Eth.Sentry.Event as EventSentry exposing (EventSentry) import Eth.Types exposing (Address) import FiatValue exposing (FiatValue) +import Filters.State as Filters +import Filters.Types as Filters import Flip exposing (flip) import Helpers.BigInt as BigIntHelpers import Helpers.Eth as EthHelpers @@ -23,7 +25,6 @@ import Time import TokenValue exposing (TokenValue) import TradeCache.State as TradeCache import TradeCache.Types as TradeCache exposing (TradeCache) -import TradeTable.Filters.Types as Filters import TradeTable.State as TradeTable import TradeTable.Types as TradeTable import Wallet @@ -35,15 +36,17 @@ init wallet = , tradeTable = TradeTable.init ( TradeTable.Expires, TradeTable.Ascending ) - [ Filters.offerType True True - , Filters.phases True False False False - ] , inputs = initialInputs , errors = noErrors , showCurrencyDropdown = False + , filters = + Filters.init + [ Filters.offerType True True + , Filters.phases True False False False + ] , filterFunc = baseFilterFunc } - -- |> applyInputs + |> applyInputs , Cmd.none ) @@ -107,15 +110,26 @@ update msg prevModel = justModelUpdate (prevModel |> removePaymentInputTerm term) - -- ApplyInputs -> - -- UpdateResult - -- (prevModel |> applyInputs) - -- Cmd.none - -- [] + ApplyInputs -> + UpdateResult + (prevModel |> applyInputs) + Cmd.none + ChainCmd.none + [] + ResetSearch -> justModelUpdate (prevModel |> resetSearch) + FiltersMsg filtersMsg -> + justModelUpdate + ({ prevModel + | filters = + prevModel.filters |> Filters.update filtersMsg + } + |> applyInputs + ) + TradeTableMsg tradeTableMsg -> let ttUpdateResult = @@ -162,10 +176,7 @@ addPaymentInputTerm model = |> updatePaymentMethodInput "" |> updatePaymentMethodTerms newSearchTerms } - - - --- |> applyInputs + |> applyInputs removePaymentInputTerm : String -> Model -> Model @@ -176,101 +187,85 @@ removePaymentInputTerm term model = |> List.filter ((/=) term) in { model | inputs = model.inputs |> updatePaymentMethodTerms newTermList } + |> applyInputs +applyInputs : Model -> Model +applyInputs prevModel = + let + model = + prevModel |> addPaymentInputTerm + in + case inputsToQuery model.inputs of + Err errors -> + { prevModel | errors = errors } --- |> applyInputs --- applyInputs : Model -> Model --- applyInputs prevModel = --- let --- model = --- prevModel |> addPaymentInputTerm --- in --- case inputsToQuery model.inputs of --- Err errors -> --- { prevModel | errors = errors } --- Ok query -> --- let --- searchTest time trade = --- case query.paymentMethodTerms of --- [] -> --- True --- terms -> --- testTextMatch terms trade.terms.paymentMethods --- daiTest trade = --- (case query.dai.min of --- Nothing -> --- True --- Just min -> --- TokenValue.compare trade.parameters.tradeAmount min /= LT --- ) --- && (case query.dai.max of --- Nothing -> --- True --- Just max -> --- TokenValue.compare trade.parameters.tradeAmount max /= GT --- ) --- fiatTest trade = --- case query.fiat of --- Nothing -> --- True --- Just fiatQuery -> --- (trade.terms.price.fiatType == fiatQuery.type_) --- && (case fiatQuery.min of --- Nothing -> --- True --- Just min -> --- BigInt.compare trade.terms.price.amount min /= LT --- ) --- && (case fiatQuery.max of --- Nothing -> --- True --- Just max -> --- BigInt.compare trade.terms.price.amount max /= GT --- ) --- newFilterFunc now trade = --- baseFilterFunc now trade --- && (trade.parameters.initiatorRole /= model.browsingRole) --- && searchTest now trade --- && daiTest trade --- && fiatTest trade --- in --- { model --- | filterFunc = newFilterFunc --- } --- inputsToQuery : SearchInputs -> Result Errors Query --- inputsToQuery inputs = --- Result.map4 --- (\minDai maxDai fiatMin fiatMax -> --- { dai = --- { min = minDai --- , max = maxDai --- } --- , fiat = --- Maybe.map --- (\typeString -> --- { type_ = typeString --- , min = fiatMin --- , max = fiatMax --- } --- ) --- (String.Extra.nonEmpty inputs.fiatType) --- , paymentMethodTerms = --- inputs.paymentMethodTerms --- } --- ) --- (interpretDaiAmount inputs.minDai --- |> Result.mapError (\e -> { noErrors | minDai = Just e }) --- ) --- (interpretDaiAmount inputs.maxDai --- |> Result.mapError (\e -> { noErrors | maxDai = Just e }) --- ) --- (interpretFiatAmount inputs.minFiat --- |> Result.mapError (\e -> { noErrors | minFiat = Just e }) --- ) --- (interpretFiatAmount inputs.maxFiat --- |> Result.mapError (\e -> { noErrors | maxFiat = Just e }) --- ) + Ok query -> + let + searchTest time trade = + case query.paymentMethodTerms of + [] -> + True + + terms -> + testTextMatch terms trade.terms.paymentMethods + + daiTest trade = + (case query.dai.min of + Nothing -> + True + + Just min -> + TokenValue.compare trade.parameters.tradeAmount min /= LT + ) + && (case query.dai.max of + Nothing -> + True + + Just max -> + TokenValue.compare trade.parameters.tradeAmount max /= GT + ) + + fiatTest trade = + case query.fiatType of + Nothing -> + True + + Just fiatType -> + trade.terms.price.fiatType == fiatType + + newFilterFunc now trade = + baseFilterFunc now trade + && searchTest now trade + && daiTest trade + && fiatTest trade + && Filters.filterTrade model.filters trade + in + { model + | filterFunc = newFilterFunc + } + + +inputsToQuery : SearchInputs -> Result Errors Query +inputsToQuery inputs = + Result.map2 + (\minDai maxDai -> + { dai = + { min = minDai + , max = maxDai + } + , fiatType = + String.Extra.nonEmpty inputs.fiatType + , paymentMethodTerms = + inputs.paymentMethodTerms + } + ) + (interpretDaiAmount inputs.minDai + |> Result.mapError (\e -> { noErrors | minDai = Just e }) + ) + (interpretDaiAmount inputs.maxDai + |> Result.mapError (\e -> { noErrors | maxDai = Just e }) + ) interpretDaiAmount : String -> Result String (Maybe TokenValue) @@ -307,17 +302,12 @@ resetSearch model = | filterFunc = baseFilterFunc , inputs = initialInputs } - - -initialSortFunc : CTypes.FullTradeInfo -> CTypes.FullTradeInfo -> Order -initialSortFunc a b = - compare a.creationInfo.blocknum b.creationInfo.blocknum + |> applyInputs baseFilterFunc : Time.Posix -> CTypes.FullTradeInfo -> Bool baseFilterFunc now trade = - (trade.state.phase == CTypes.Open) - && (TimeHelpers.compare trade.derived.phaseEndTime now == GT) + TimeHelpers.compare trade.derived.phaseEndTime now == GT testTextMatch : List String -> List PaymentMethod -> Bool diff --git a/src/Marketplace/Types.elm b/src/Marketplace/Types.elm index fdbcf95..0e68208 100644 --- a/src/Marketplace/Types.elm +++ b/src/Marketplace/Types.elm @@ -1,4 +1,4 @@ -module Marketplace.Types exposing (Errors, Model, Msg(..), ResultColumnType(..), SearchInputs, UpdateResult, justModelUpdate, noErrors, updateFiatTypeInput, updateMaxDaiInput, updateMinDaiInput, updatePaymentMethodInput, updatePaymentMethodTerms) +module Marketplace.Types exposing (Errors, Model, Msg(..), Query, SearchInputs, TokenRange, UpdateResult, justModelUpdate, noErrors, updateFiatTypeInput, updateMaxDaiInput, updateMinDaiInput, updatePaymentMethodInput, updatePaymentMethodTerms) import AppCmd exposing (AppCmd) import Array exposing (Array) @@ -11,6 +11,7 @@ import Eth.Net import Eth.Sentry.Event as EventSentry exposing (EventSentry) import Eth.Types exposing (Address) import FiatValue exposing (FiatValue) +import Filters.Types as Filters import Helpers.Eth as EthHelpers import Http import Json.Decode @@ -25,10 +26,11 @@ import Wallet type alias Model = { wallet : Wallet.State - , tradeTable : TradeTable.Model , inputs : SearchInputs , errors : Errors , showCurrencyDropdown : Bool + , tradeTable : TradeTable.Model + , filters : Filters.Model , filterFunc : Time.Posix -> CTypes.FullTradeInfo -> Bool } @@ -42,9 +44,10 @@ type Msg | FiatTypeLostFocus | AddSearchTerm | RemoveTerm String - -- | ApplyInputs + | ApplyInputs | ResetSearch | TradeTableMsg TradeTable.Msg + | FiltersMsg Filters.Msg | AppCmd (AppCmd Msg) | NoOp @@ -85,21 +88,17 @@ noErrors = Errors Nothing Nothing +type alias Query = + { dai : TokenRange + , fiatType : Maybe String + , paymentMethodTerms : List String + } + --- type alias Query = --- { dai : TokenRange --- , fiat : Maybe FiatTypeAndRange --- , paymentMethodTerms : List String --- } --- type alias TokenRange = --- { min : Maybe TokenValue --- , max : Maybe TokenValue --- } --- type alias FiatTypeAndRange = --- { type_ : String --- , min : Maybe BigInt --- , max : Maybe BigInt --- } +type alias TokenRange = + { min : Maybe TokenValue + , max : Maybe TokenValue + } updatePaymentMethodInput : String -> SearchInputs -> SearchInputs @@ -125,13 +124,3 @@ updateMaxDaiInput input inputs = updatePaymentMethodTerms : List String -> SearchInputs -> SearchInputs updatePaymentMethodTerms terms inputs = { inputs | paymentMethodTerms = terms } - - -type ResultColumnType - = Expiring - | TradeAmount - | Fiat - | Margin - | PaymentMethods - | AutoabortWindow - | AutoreleaseWindow diff --git a/src/Marketplace/View.elm b/src/Marketplace/View.elm index 6f207ab..9ca31da 100644 --- a/src/Marketplace/View.elm +++ b/src/Marketplace/View.elm @@ -12,6 +12,8 @@ import Element.Events import Element.Font import Element.Input import FiatValue exposing (FiatValue) +import Filters.Types as Filters +import Filters.View as Filters import Helpers.Element as EH import Helpers.Time as TimeHelpers import Html.Events.Extra @@ -35,58 +37,102 @@ root time tradeCaches model = , Element.width Element.fill , Element.height Element.fill , Element.Events.onClick (ShowCurrencyDropdown False) + , Element.padding 30 ] [ Element.row [ Element.width Element.fill , Element.spacing 10 - , Element.padding 30 ] - [ searchInputElement model.inputs model.errors model.showCurrencyDropdown + [ statusFiltersAndSearchElement tradeCaches model.filters model.inputs model.errors model.showCurrencyDropdown ] - , resultsAndStatusElement time tradeCaches model + , maybeResultsElement time tradeCaches model ] -searchInputElement : SearchInputs -> Errors -> Bool -> Element Msg -searchInputElement inputs errors showCurrencyDropdown = - Element.column - [ Element.spacing 10 - , Element.width Element.shrink - , Element.centerX - ] - [ Element.row - [ Element.width Element.shrink - , Element.spacing 10 - ] - [ Element.el - [ Element.width <| Element.shrink - , Element.alignTop +statusFiltersAndSearchElement : List TradeCache -> Filters.Model -> SearchInputs -> Errors -> Bool -> Element Msg +statusFiltersAndSearchElement tradeCaches filters inputs errors showCurrencyDropdown = + let + statusMsgElement s = + Element.el + [ Element.Font.size 20 + , Element.Font.semiBold + , Element.Font.color EH.darkGray + , Element.centerX ] - <| - daiRangeInput inputs.minDai inputs.maxDai errors - , Element.el - [ Element.width Element.shrink - , Element.alignTop + (Element.text s) + + statusMessages : List (Element Msg) + statusMessages = + if List.all ((==) TradeCache.NoneFound) (List.map TradeCache.loadingStatus tradeCaches) then + [ statusMsgElement "No trades found." ] + + else + tradeCaches + |> List.map + (\tc -> + case TradeCache.loadingStatus tc of + TradeCache.QueryingNumTrades -> + Just <| "Querying " ++ factoryName tc.factory ++ " Factory..." + + TradeCache.NoneFound -> + Nothing + + TradeCache.FetchingTrades -> + Just <| "Fetching " ++ factoryName tc.factory ++ " Trades..." + + TradeCache.AllFetched -> + Nothing + ) + |> Maybe.Extra.values + |> List.map statusMsgElement + in + Element.el + [ Element.width Element.fill + , Element.inFront <| + Element.column + [ Element.spacing 5 + , Element.alignLeft ] - <| - fiatInput showCurrencyDropdown inputs.fiatType errors - , Element.column + statusMessages + ] + <| + Element.row + [ Element.centerX + , Element.spacing 50 + ] + [ Element.map FiltersMsg <| Filters.view filters + , Element.row [ Element.width Element.shrink - , Element.alignTop - , Element.spacing 5 + , Element.spacing 10 ] - [ paymentMethodsInput inputs.paymentMethod - , searchTermsDisplayElement inputs.paymentMethodTerms + [ Element.el + [ Element.width <| Element.shrink + , Element.alignTop + ] + <| + daiRangeInput inputs.minDai inputs.maxDai errors + , Element.el + [ Element.width Element.shrink + , Element.alignTop + ] + <| + fiatInput showCurrencyDropdown inputs.fiatType errors + , Element.column + [ Element.width Element.shrink + , Element.alignTop + , Element.spacing 5 + ] + [ paymentMethodsInput inputs.paymentMethod + , searchTermsDisplayElement inputs.paymentMethodTerms + ] + , Element.column + [ Element.spacing 5 + , Element.width Element.shrink + ] + [ applyButton, resetButton ] + |> withInputHeader " " ] - - -- , Element.column - -- [ Element.spacing 5 - -- , Element.width Element.shrink - -- ] - -- [ applyButton, resetButton ] - -- |> withInputHeader " " ] - ] searchTermsDisplayElement : List String -> Element Msg @@ -126,64 +172,15 @@ removeSearchTermButton term = (Element.text "x") -resultsAndStatusElement : Time.Posix -> List TradeCache -> Model -> Element Msg -resultsAndStatusElement time tradeCaches model = +maybeResultsElement : Time.Posix -> List TradeCache -> Model -> Element Msg +maybeResultsElement time tradeCaches model = let - statusMsgElement s = - Element.el - [ Element.Font.size 24 - , Element.Font.semiBold - , Element.Font.color EH.darkGray - , Element.centerX - , Element.padding 20 - ] - (Element.text s) - visibleTrades = tradeCaches |> List.map TradeCache.loadedValidTrades |> List.concat |> filterTrades time model.filterFunc - - statusMessages : List (Element Msg) - statusMessages = - if List.all ((==) TradeCache.NoneFound) (List.map TradeCache.loadingStatus tradeCaches) then - [ statusMsgElement "No trades found." ] - - else - tradeCaches - |> List.map - (\tc -> - case TradeCache.loadingStatus tc of - TradeCache.QueryingNumTrades -> - Just <| factoryName tc.factory ++ "Querying Factory..." - - TradeCache.NoneFound -> - Nothing - - TradeCache.FetchingTrades -> - Just <| factoryName tc.factory ++ "Fetching Trades" - - TradeCache.AllFetched -> - Nothing - ) - |> Maybe.Extra.values - |> List.map statusMsgElement in - Element.column - [ Element.spacing 10 ] - [ case statusMessages of - [] -> - Element.none - - _ -> - Element.column [ Element.spacing 5 ] statusMessages - , maybeResultsElement time visibleTrades model - ] - - -maybeResultsElement : Time.Posix -> List CTypes.FullTradeInfo -> Model -> Element Msg -maybeResultsElement time visibleTrades model = if visibleTrades == [] then Element.none @@ -302,39 +299,40 @@ paymentMethodsInput searchString = |> withInputHeader "Search Payment Methods" +applyButton : Element Msg +applyButton = + Element.Input.button + [ Element.Background.color EH.blue + , Element.padding 10 + , Element.Border.rounded 5 + ] + { onPress = Just ApplyInputs + , label = + Element.el + [ Element.Font.color EH.white + , Element.centerX + , Element.centerY + ] + (Element.text "Apply") + } + --- applyButton : Element Msg --- applyButton = --- Element.Input.button --- [ Element.Background.color EH.blue --- , Element.padding 10 --- , Element.Border.rounded 5 --- ] --- { onPress = Just ApplyInputs --- , label = --- Element.el --- [ Element.Font.color EH.white --- , Element.centerX --- , Element.centerY --- ] --- (Element.text "Apply") --- } --- resetButton : Element Msg --- resetButton = --- Element.Input.button --- [ Element.Background.color EH.blue --- , Element.padding 10 --- , Element.Border.rounded 5 --- ] --- { onPress = Just ResetSearch --- , label = --- Element.el --- [ Element.Font.color EH.white --- , Element.centerX --- , Element.centerY --- ] --- (Element.text "Reset") --- } +resetButton : Element Msg +resetButton = + Element.Input.button + [ Element.Background.color EH.blue + , Element.padding 10 + , Element.Border.rounded 5 + ] + { onPress = Just ResetSearch + , label = + Element.el + [ Element.Font.color EH.white + , Element.centerX + , Element.centerY + ] + (Element.text "Reset") + } withInputHeader : String -> Element Msg -> Element Msg diff --git a/src/TradeTable/State.elm b/src/TradeTable/State.elm index 3fe665a..6f10792 100644 --- a/src/TradeTable/State.elm +++ b/src/TradeTable/State.elm @@ -3,12 +3,10 @@ module TradeTable.State exposing (init, update) import AppCmd exposing (AppCmd) import ChainCmd exposing (ChainCmd) import Routing -import TradeTable.Filters.State as Filters -import TradeTable.Filters.Types as Filters import TradeTable.Types exposing (..) -init : ( ColType, Ordering ) -> Filters.Model -> Model +init : ( ColType, Ordering ) -> Model init = Model @@ -38,12 +36,5 @@ update msg prevModel = | orderBy = newOrderBy } - FiltersMsg filtersMsg -> - justModelUpdate - { prevModel - | filtersModel = - prevModel.filtersModel |> Filters.update filtersMsg - } - NoOp -> justModelUpdate prevModel diff --git a/src/TradeTable/Types.elm b/src/TradeTable/Types.elm index 4e1bfa3..7e9e8be 100644 --- a/src/TradeTable/Types.elm +++ b/src/TradeTable/Types.elm @@ -4,19 +4,16 @@ import AppCmd exposing (AppCmd) import ChainCmd exposing (ChainCmd) import CommonTypes exposing (..) import Contracts.Types as CTypes -import TradeTable.Filters.Types as Filters type alias Model = { orderBy : ( ColType, Ordering ) - , filtersModel : Filters.Model } type Msg = TradeClicked FactoryType Int | ChangeSort ColType - | FiltersMsg Filters.Msg | NoOp diff --git a/src/TradeTable/View.elm b/src/TradeTable/View.elm index fa3578d..b229a16 100644 --- a/src/TradeTable/View.elm +++ b/src/TradeTable/View.elm @@ -15,8 +15,6 @@ import Images exposing (Image) import PaymentMethods exposing (PaymentMethod) import Time import TokenValue exposing (TokenValue) -import TradeTable.Filters.Types as Filters -import TradeTable.Filters.View as Filters import TradeTable.Types exposing (..) @@ -25,11 +23,9 @@ view time model colTypes trades = Element.column [ Element.width Element.fill , Element.height Element.fill - , Element.padding 30 , Element.spacing 5 ] - [ Element.map FiltersMsg <| Filters.view model.filtersModel - , viewColHeaders model.orderBy colTypes + [ viewColHeaders model.orderBy colTypes , viewTradeRows time model colTypes trades ] @@ -150,7 +146,6 @@ viewTradeRows time model colTypes trades = , Element.clip ] (trades - |> Filters.filterTrades model.filtersModel |> List.sortWith (sortByFunc model.orderBy) |> List.map (viewTradeRow time colTypes) ) From 0336ceb30ebce1a0cd127f0657f02801eff284fe Mon Sep 17 00:00:00 2001 From: oglog Date: Wed, 14 Aug 2019 12:06:50 +0200 Subject: [PATCH 09/19] Fix sorting due to math overflow --- src/Contracts/Types.elm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Contracts/Types.elm b/src/Contracts/Types.elm index c9a523e..759a6b6 100644 --- a/src/Contracts/Types.elm +++ b/src/Contracts/Types.elm @@ -358,12 +358,17 @@ deriveValues parameters state terms = parameters.autoreleaseInterval Closed -> - Time.millisToPosix (2 ^ 31 - 1) + Time.millisToPosix 0 in { phaseEndTime = - TimeHelpers.add - state.phaseStartTime - currentPhaseInterval + case state.phase of + Closed -> + Time.millisToPosix (2 ^ 53 - 1) + + _ -> + TimeHelpers.add + state.phaseStartTime + currentPhaseInterval , margin = Margin.margin parameters.tradeAmount terms.price } From fef378923f47bc220918ac7d769c02eabd5f7236 Mon Sep 17 00:00:00 2001 From: oglog Date: Wed, 14 Aug 2019 12:08:02 +0200 Subject: [PATCH 10/19] Add Phase column in Marketplace if multiple phases appear --- src/Filters/State.elm | 4 ++-- src/Filters/Types.elm | 39 +++++++++++++++++++++++++++----- src/Filters/View.elm | 10 ++++----- src/Marketplace/View.elm | 48 +++++++++++++++++++++++++++++++--------- 4 files changed, 78 insertions(+), 23 deletions(-) diff --git a/src/Filters/State.elm b/src/Filters/State.elm index ed6e543..ce9dc72 100644 --- a/src/Filters/State.elm +++ b/src/Filters/State.elm @@ -12,9 +12,9 @@ init = update : Msg -> Model -> Model update msg filterSets = case msg of - SetOption filterSetLabel optionLabel checked -> + SetOption filterType optionLabel checked -> filterSets - |> List.Extra.updateIf (.label >> (==) filterSetLabel) + |> List.Extra.updateIf (.type_ >> (==) filterType) (\filterSet -> { filterSet | options = diff --git a/src/Filters/Types.elm b/src/Filters/Types.elm index 906c089..055c511 100644 --- a/src/Filters/Types.elm +++ b/src/Filters/Types.elm @@ -1,8 +1,9 @@ -module Filters.Types exposing (FilterSet, Model, Msg(..), Option, filterTrade, filterTrades, offerType, phases, role) +module Filters.Types exposing (FilterSet, FilterType(..), Model, Msg(..), Option, filterTrade, filterTrades, filterTypeLabel, getFilterSet, offerType, phases, role) import CommonTypes exposing (..) import Contracts.Types as CTypes import Eth.Types exposing (Address) +import List.Extra type alias Model = @@ -10,11 +11,11 @@ type alias Model = type Msg - = SetOption String String Bool + = SetOption FilterType String Bool type alias FilterSet = - { label : String + { type_ : FilterType , options : List Option } @@ -26,10 +27,36 @@ type alias Option = } +type FilterType + = Phase + | Role + | OfferType + + +filterTypeLabel : FilterType -> String +filterTypeLabel filterType = + case filterType of + Phase -> + "Phases" + + Role -> + "Role" + + OfferType -> + "Offer Type" + + +getFilterSet : FilterType -> Model -> Maybe FilterSet +getFilterSet filterType filterSets = + List.Extra.find + (.type_ >> (==) filterType) + filterSets + + phases : Bool -> Bool -> Bool -> Bool -> FilterSet phases openChecked committedChecked judgementChecked closedChecked = FilterSet - "Phase" + Phase [ Option "Open" openChecked @@ -52,7 +79,7 @@ phases openChecked committedChecked judgementChecked closedChecked = role : Address -> Bool -> Bool -> FilterSet role addr buyerChecked sellerChecked = FilterSet - "Role" + Role [ Option "Buyer" buyerChecked @@ -67,7 +94,7 @@ role addr buyerChecked sellerChecked = offerType : Bool -> Bool -> FilterSet offerType buyingChecked sellingChecked = FilterSet - "Offer Type" + OfferType [ Option "Buying" buyingChecked diff --git a/src/Filters/View.elm b/src/Filters/View.elm index 4fd3bdb..f39d1b7 100644 --- a/src/Filters/View.elm +++ b/src/Filters/View.elm @@ -24,19 +24,19 @@ viewFilterSet filterSet = [ Element.Font.size 28 , Element.Font.medium ] - (Element.text filterSet.label) + (Element.text <| filterTypeLabel filterSet.type_) , Element.column [ Element.spacing 5 ] <| - List.map (viewOption filterSet.label) filterSet.options + List.map (viewOption filterSet.type_) filterSet.options ] -viewOption : String -> Option -> Element Msg -viewOption filterSetLabel option = +viewOption : FilterType -> Option -> Element Msg +viewOption filterType option = Element.Input.checkbox [] - { onChange = SetOption filterSetLabel option.label + { onChange = SetOption filterType option.label , icon = Element.Input.defaultCheckbox , checked = option.checked , label = Element.Input.labelRight [] <| Element.text option.label diff --git a/src/Marketplace/View.elm b/src/Marketplace/View.elm index 9ca31da..d8ecf4c 100644 --- a/src/Marketplace/View.elm +++ b/src/Marketplace/View.elm @@ -18,6 +18,7 @@ import Helpers.Element as EH import Helpers.Time as TimeHelpers import Html.Events.Extra import Images exposing (Image) +import List.Extra import Margin import Marketplace.Types exposing (..) import Maybe.Extra @@ -31,6 +32,22 @@ import TradeTable.View as TradeTable root : Time.Posix -> List TradeCache -> Model -> Element Msg root time tradeCaches model = + let + showPhase = + let + numPhasesChecked = + model.filters + |> Filters.getFilterSet Filters.Phase + |> Maybe.map + (\filterSet -> + List.Extra.count + .checked + filterSet.options + ) + |> Maybe.withDefault 0 + in + numPhasesChecked /= 1 + in Element.column [ Element.Border.rounded 5 , Element.Background.color EH.white @@ -45,7 +62,11 @@ root time tradeCaches model = ] [ statusFiltersAndSearchElement tradeCaches model.filters model.inputs model.errors model.showCurrencyDropdown ] - , maybeResultsElement time tradeCaches model + , maybeResultsElement + time + showPhase + tradeCaches + model ] @@ -172,8 +193,8 @@ removeSearchTermButton term = (Element.text "x") -maybeResultsElement : Time.Posix -> List TradeCache -> Model -> Element Msg -maybeResultsElement time tradeCaches model = +maybeResultsElement : Time.Posix -> Bool -> List TradeCache -> Model -> Element Msg +maybeResultsElement time showPhase tradeCaches model = let visibleTrades = tradeCaches @@ -188,13 +209,20 @@ maybeResultsElement time tradeCaches model = TradeTable.view time model.tradeTable - [ TradeTable.Expires - , TradeTable.Offer - , TradeTable.FiatPrice - , TradeTable.Margin - , TradeTable.PaymentWindow - , TradeTable.BurnWindow - ] + ((if showPhase then + [ TradeTable.Phase ] + + else + [] + ) + ++ [ TradeTable.Expires + , TradeTable.Offer + , TradeTable.FiatPrice + , TradeTable.Margin + , TradeTable.PaymentWindow + , TradeTable.BurnWindow + ] + ) visibleTrades |> Element.map TradeTableMsg From aea662b6e72555c00a989dcd8d93935d770df4bd Mon Sep 17 00:00:00 2001 From: oglog Date: Wed, 14 Aug 2019 12:08:25 +0200 Subject: [PATCH 11/19] Change Ordering internals --- src/TradeTable/View.elm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/TradeTable/View.elm b/src/TradeTable/View.elm index b229a16..e095003 100644 --- a/src/TradeTable/View.elm +++ b/src/TradeTable/View.elm @@ -95,10 +95,10 @@ sortableColumnHeader colType maybeOrdering = [ Element.width <| Element.px 8 ] (case ordering of Ascending -> - Images.upArrow + Images.downArrow Descending -> - Images.downArrow + Images.upArrow ) ) @@ -350,8 +350,8 @@ sortByFunc ( sortCol, ordering ) = TimeHelpers.compare a.parameters.autoreleaseInterval b.parameters.autoreleaseInterval ) |> (if ordering == Ascending then - flip + identity else - identity + flip ) From fff51662980603bbf18c112c8cd01c16e027834e Mon Sep 17 00:00:00 2001 From: oglog Date: Wed, 14 Aug 2019 12:08:33 +0200 Subject: [PATCH 12/19] include recent build --- docs/404.html | 2 +- docs/index.html | 2 +- ...ain-8786240f7520bac83af5.js => main-2cc6fa5c22699ead1828.js} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename docs/static/js/{main-8786240f7520bac83af5.js => main-2cc6fa5c22699ead1828.js} (54%) diff --git a/docs/404.html b/docs/404.html index 0161957..6c9a2d0 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 0161957..6c9a2d0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-8786240f7520bac83af5.js b/docs/static/js/main-2cc6fa5c22699ead1828.js similarity index 54% rename from docs/static/js/main-8786240f7520bac83af5.js rename to docs/static/js/main-2cc6fa5c22699ead1828.js index 51f94c2..0c3f83d 100644 --- a/docs/static/js/main-8786240f7520bac83af5.js +++ b/docs/static/js/main-2cc6fa5c22699ead1828.js @@ -4,4 +4,4 @@ * @author Feross Aboukhadijeh * @license MIT */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(vp,o,function(e){return si(yp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(bp,e,L(r,Ip({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(bp,e,L(r,wp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=ev(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?Kg(o):Vg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return ev(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Hg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(qg,jg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(jo,xa(tc),f(jo,Ds,ec))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(lh,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(lh,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Tp)}),i.addEventListener("timeout",function(){a(Ap)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),yp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(Ep(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(qg,jg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(qg,jg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(qg,jg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{label:e,options:t}}),po=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),go=r(function(e,t){return f(ho,"Offer Type",M([l(po,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(po,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),vo={$:"Closed"},yo={$:"Committed"},mo={$:"Judgment"},bo={$:"Open"},Co=a(function(e,t,r,n){return f(ho,"Phase",M([l(po,"Open",e,function(e){return R(e.state.phase,bo)}),l(po,"Committed",t,function(e){return R(e.state.phase,yo)}),l(po,"Judgment",r,function(e){return R(e.state.phase,mo)}),l(po,"Closed",n,function(e){return R(e.state.phase,vo)})]))}),Eo={$:"Initiator"},So={$:"Responder"},To=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),wo=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(Eo):f(To,function(e){return R(t,e)?si(So):ci},e.state.responder)}),Io=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),Ao=r(function(e,t){return f(Io,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(wo,e,t))}),Bo=n(function(e,t,r){return f(ho,"Role",M([l(po,"Buyer",t,function(t){return R(f(Ao,t,e),si(fo))}),l(po,"Seller",r,function(t){return R(f(Ao,t,e),si(lo))})]))}),ko=function(e){return{orderBy:e}},No=ko,Ro={$:"Ascending"},$o={$:"Phase"},_o=Oe,Lo=_o(yr),xo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(Co,!0,!0,!0,!1),f(go,!0,!0),l(Bo,t,!0,!0)])),tradeTable:No(L($o,Ro)),wallet:e},Lo)}),Po=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Do={$:"None"},Uo=Do,Oo=function(e){return d(Po,e,Lo,Uo,yr)},Mo=function(e){return{$:"TradeTableMsg",a:e}},Fo=function(e){return d(Po,e,Lo,Uo,yr)},Vo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),Ko=r(function(e,t){return f(Vo,e,t)}),Ho=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),jo=n(function(e,t,r){return t(e(r))}),qo=r(function(e,t){if("None"===t.$)return Do;var r=t.a,n=t.b,a=l(Ho,f(Io,Da(e),r.onSign),f(Io,Da(e),r.onBroadcast),f(Io,function(t){var r=t.a,n=t.b;return L(f(jo,r,e),f(Io,function(t){return{confirmations:t.confirmations,toMsg:f(jo,t.toMsg,e)}},n))},r.onMined));return f(Vo,a,n)}),Go=function(e){return{$:"AbiDecoder",a:e}},zo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Yo=z,Wo=Fr,Jo=r(function(e,t){return e<1?t:l(Wo,e,Yo(t),t)}),Qo=Jo(64),Xo=n(function(e,t,r){return L(f(zo,e,Qo(t)),r)}),Zo=r(function(e,t){return e<1?"":l(Wo,0,e,t)}),eu=Zo(64),tu=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),ru=function(e){return-e},nu=r(function(e,t){return e<1?"":l(Wo,-e,Yo(t),t)}),au=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(Zo,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(nu,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Go(function(t){var r=t.a,n=t.b;return f(tu,f(Xo,r,n),e(eu(n)))})}(),iu=Hr,ou=function(e){return f(iu,"0x",e)||f(iu,"0X",e)?f(Jo,2,e):e},uu=function(e){return e.b},su=r(function(e,t){var r=e.a;return f(tu,uu,r(function(e){return f(zo,e,e)}(ou(t))))}),cu=Xr,fu=ae,lu=Wr,du=function(e){return f(cu,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return fu(a)},lu)},hu=f(jo,su,du),pu=function(e){return{$:"Magnitude",a:e}},gu=function(e){return{$:"Pos",a:e}},vu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),yu=function(e){return{$:"MagnitudeNotNormalised",a:e}},mu=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 si(n)}return ci}},bu=function(e){var t=mu(e);return"Nothing"!==t.$&&t.a<0},Cu=function(e){return{$:"Neg",a:e}},Eu={$:"Zer"},Su=function(e){return!e.b},Tu=r(function(e,t){var r=t.a;if(Su(r))return Eu;switch(e.$){case"Zero":return Eu;case"Positive":return gu(t);default:return Cu(t)}}),wu=r(function(e,t){return f(vu,e,yu(t))}),Iu=function(e){return f(La,r(function(t,r){return e(t)&&Su(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Au=Ir,Bu=-1+f(Au,10,7),ku=Bu+1,Nu=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Ru=function(e){return e<0?f(Nu,Na(-1),Ru(e+ku)):L(e/ku|0,e%ku)},$u=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Ru(r+e),i=a.a,o=a.b;return f(ka,o,f($u,i,n))}{if(!(_(e,ku)>0))return M([e]);var u=M([e]);e=0,t=u}}}),_u=function(e){var t=e.a;return pu(Iu(f($u,0,t)))},Lu=xa(ru),xu={$:"Negative"},Pu={$:"Positive"},Du={$:"Zero"},Uu=function(e){switch(e.$){case"Positive":return xu;case"Negative":return Pu;default:return Du}},Ou=function(e){for(;;){var t=e.a,r=e.b,n=_u(r),a=n.a;if(!bu(a))return f(Tu,t,pu(a));e=f(wu,Uu(t),Lu(a))}},Mu=pr,Fu=function(e){switch(f(Mu,e,0).$){case"LT":return xu;case"GT":return Pu;default:return Du}},Vu=function(e){return e<0?-e:e},Ku=function(e){return Ou(f(vu,Fu(e),yu(M([Vu(e)]))))},Hu=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(Au,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},ju=function(e){switch(e.$){case"Zer":return Eu;case"Neg":var t=e.a;return gu(t);default:return e}},qu=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(ka,L(a,u),f(Gu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Gu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Gu,yr,s))}return yr}),zu=r(function(e,t){var r=e.a,n=t.a;return qu(f(Gu,r,n))}),Yu=function(e){switch(e.$){case"Zer":return f(wu,Du,yr);case"Neg":var t=e.a.a;return f(wu,Pu,Lu(t));default:var t=e.a.a;return f(wu,Pu,t)}},Wu=r(function(e,t){var r=Yu(t),n=r.b,a=Yu(e),i=a.b,o=f(zu,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Ou(f(vu,Pu,yu(s)))}),Ju=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(R(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 Ta}return a.b.b?ba:f(Mu,e,t)}}),Qu=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},Xu=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(Ju,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return Qu(d(Ju,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),Zu=r(function(e,t){return R(f(Xu,e,t),Ta)}),es=K,ts=r(function(e,t){return!f(Zu,e,t)}),rs=function(e){switch(e.$){case"Zer":return pu(yr);case"Pos":default:var t=e.a;return t}},ns=r(function(e,t){var r=e.a;return _u(yu(f(xa,ti(t),r)))}),as=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(ns,pu(n),a),u=f(as,pu(i),pu(n)),s=u.a,c=f(Wu,f(Tu,Pu,o),f(Tu,Pu,pu(f(ka,0,s))));return rs(c)}var a=r.a;return f(ns,pu(n),a)}return pu(yr)}),is=function(e){switch(e.$){case"Zer":return Du;case"Pos":return Pu;default:return xu}},os=r(function(e,t){return R(e,Du)||R(t,Du)?Du:R(e,t)?Pu:xu}),us=r(function(e,t){return f(Tu,f(os,is(e),is(t)),f(as,rs(e),rs(t)))}),ss=function(e){switch(e.$){case"Zer":return Eu;case"Pos":var t=e.a;return Cu(t);default:var t=e.a;return gu(t)}},cs=r(function(e,t){return f(Wu,e,ss(t))}),fs=Ku(0),ls=a(function(e,t,r,n){if(e){var a=Ku(e),i=f(us,f(us,a,n),t),o=f(ts,i,r)?L(f(us,a,t),f(cs,r,i)):L(fs,r),u=o.a,s=o.b,c=d(ls,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Wu,u,l),h)}return L(fs,r)}),ds=Fa(f(Va,2,Bu)),hs=n(function(e,t,r){return d(ls,f(Au,2,ds),e,t,r)}),ps=Ku(1),gs=r(function(e,t){return e}),vs=n(function(e,t,r){return l(Ra,gs(e),t,f(Ai,1,r))}),ys=function(e){return l(vs,us(Ku(ku)),ps,e)},ms=n(function(e,t,r){if(e){var n=l(hs,ys(e),t,r),a=n.a,i=n.b,o=l(ms,e-1,i,r),u=o.a,s=o.b;return L(f(Wu,a,u),s)}return l(hs,ys(e),t,r)}),bs=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Cs=r(function(e,t){if(R(t,fs))return ci;var r=Ti(bs(e))-Ti(bs(t))+1,n=l(ms,f(ei,0,r),ju(e),ju(t)),a=n.a,i=n.b;return si(L(f(Tu,f(os,is(e),is(t)),rs(a)),f(Tu,is(e),rs(i))))}),Es=f(us,Ku(2),Ku(2147483648)),Ss=xr,Ts=function(e){return f(Ss,e,"")},ws=Pn,Is=n(function(e,t,r){return e<=0?r:l(Is,e>>1,U(t,t),1&e?U(r,t):r)}),As=r(function(e,t){return l(Is,e,t,"")}),Bs=n(function(e,t,r){return U(f(As,e-Yo(r),Ts(t)),r)}),ks=te,Ns=Ar,Rs=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},$s=r(function(e,t){for(;;){if(t<16)return f(ka,Rs(t),e);var r=f(ka,Rs(f(Ns,16,t)),e),n=t/16|0;e=r,t=n}}),_s=function(e){return ks(e<0?f(ka,P("-"),f($s,yr,-e)):f($s,yr,e))},Ls=function(e){var t=f(Cs,e,Es);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=_s(Hu(a));return R(n,Ku(0))?i:U(Ls(n),l(Bs,8,P("0"),i))},xs=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,pu(yr))?"0":Ls(gu(t));default:var t=e.a;return"-"+xs(f(us,Ku(-1),e))}},Ps=function(e){return l(Bs,64,P("0"),e)},Ds=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=Ps(_s(a)),c=function(e){return U(e,n)}(Ps(_s(u)));return x(a+32+(Yo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Us=Dr,Os=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))))}),Ms=n(function(e,t,n){return l(Us,r(function(t,r){return l(Os,e,yi(t),r)}),t,n)}),Fs=function(e){return $a(l(Ms,ka,yr,e))},Vs=function(e){return f(Ri,"",f(xa,f(jo,_s,f(Bs,2,P("0"))),Fs(e)))},Ks=function(e){return 64-f(Ns,64,e)},Hs=function(e){return U(e,f(As,Ks(Yo(e)),"0"))},js=function(e){return L(si(Yo(e)/2|0),Hs(e))},qs=function(e){return L(ci,Ps(e))},Gs=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},zs=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=Ur,Ws=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(Ss,P("1"),r),!0);case"1":return L(f(Ss,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Ss,P("0"),r),!1);case"1":return L(f(Ss,P("1"),r),!0);default:break e}return L(r,!0)});return l(Ys,t,L("",!1),e).a},Js=function(e){return l(Ys,ka,yr,e)},Qs=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Jo,e,t),i=f(ka,l(Wo,0,e,t),r);e=n,t=a,r=i}}),Xs=r(function(e,t){return e&&""!==t?l(Qs,e,t,yr):M([t])}),Zs=function(e){var t=function(){var t=Js(xs(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(jo,Ws,f(Bs,256,P("1"))))}var r=t;return L(r,f(Bs,256,P("0")))}(),r=t.a,n=t.b;return ks(f(xa,Gs,f(Xs,4,n(f(Ri,"",f(xa,zs,r))))))},ec=function(e){return{$:"Hex",a:e}},tc=function(e){switch(e.$){case"AddressE":var t=e.a.a;return qs(t);case"UintE":var r=e.a;return qs(xs(r));case"IntE":var n=e.a;return qs(Zs(n));case"BoolE":return qs(e.a?"1":"0");case"DBytesE":var a=e.a.a;return js(a);case"BytesE":var a=e.a.a;return qs(ou(a));case"StringE":var i=e.a;return js(Vs(i));case"ListE":var o=e.a;return function(e){var t=e.a;return js(t)}(Xt()(o));default:var i=e.a;return qs(ou(i))}};try{var rc=Xt();Xt=function(){return rc}}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 nc=Pr,ac=function(e){return 1===Yo(e)?f(nc,"0",e):e},ic=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(ka,n,r);e=i,t=o,r=u}}}),oc=r(function(e,t){return $a(l(ic,e,t,yr))}),uc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(oc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(uc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),sc=r(function(e,t){return l(uc,0,e,t)}),cc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),fc=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 Pt(e.a)}},lc={$:"LE"},dc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,lc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,lc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,lc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,lc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,lc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,lc));case"Seq":var i=e.b;return l(hc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),hc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(dc,n,t,r);e=i,t=o,r=u}}),pc=Dt,gc=r(function(e,t){return{$:"Seq",a:e,b:t}}),vc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+fc(r),i=n;e=a,t=i}}),yc=function(e){return f(gc,f(vc,0,e),e)},mc=function(e){return{$:"U8",a:e}},bc=mc,Cc=r(function(e,t){return _(e,t)<0?e:t}),Ec=hr,Sc=function(e){return{$:"Bytes",a:e}},Tc=Sc,wc=function(e){return pc(yc(f(xa,Tc,$a(e))))},Ic=Pt,Ac=r(function(e,t){var r=e.a;return f(zn,r,t)}),Bc=function(e){return{$:"Decoder",a:e}},kc=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}}),Nc=r(function(e,t){return Bc(f(kc,e,t))}),Rc=Bc(Yn),$c=r(function(e,t){if("Just"===t.$){return t.a}return e}),_c=function(e){return{$:"Done",a:e}},Lc=function(e){return{$:"Loop",a:e}},xc=r(function(e,t){var n=t.a;return Bc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return L(i,e(o))}))}),Pc=function(e){return Bc(r(function(t,r){return L(r,e)}))},Dc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Pc(_c($a(n))):f(xc,function(e){return Lc(L(r-1,f(ka,e,n)))},e)}),Uc=function(e){return f($c,yr,f(Ac,f(Nc,L(Ic(e),yr),Dc(Rc)),e))},Oc=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))}),Mc=r(function(e,t){return l(Oc,ws,e,t)}),Fc=f(Ai,0,4),Vc=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}}),Kc=xt,Hc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),jc=function(e){return f(Hc,f(jo,Kc,ws(4294967295)),e)},qc=r(function(e,t){return 5*t+e}),Gc=4294967295>>>32-Ha,zc=ar,Yc=n(function(e,t,r){for(;;){var n=Gc&t>>>e,a=f(zc,n,r);if("SubTree"!==a.$){var i=a.a;return f(zc,Gc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Wc=function(e){return e>>>5<<5},Jc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Wc(r))>-1?f(zc,Gc&e,i):l(Yc,n,e,a))}),Qc=r(function(e,t){var r=f(Jc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),Xc=n(function(e,t,r){var n=f(qc,e,t);return f(Qc,n,r)}),Zc=ir,ef=a(function(e,t,r,n){var a=Gc&t>>>e,i=f(zc,a,n);if("SubTree"===i.$){var o=i.a,u=d(ef,e-Ha,t,r,o);return l(Zc,a,za(u),n)}var s=i.a,c=l(Zc,Gc&t,r,s);return l(Zc,a,Ga(c),n)}),tf=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,Wc(n))>-1?d(Ma,n,a,i,l(Zc,Gc&e,t,o)):d(Ma,n,a,d(ef,a,e,t,i),o)}),rf=n(function(e,t,r){return l(tf,e,t,r)}),nf=a(function(e,t,r,n){var a=f(qc,e,t);return l(rf,a,r,n)}),af=Dn,of=r(function(e,t){return l(Oc,af,e,t)}),uf=function(e){var t=l(La,r(function(t,n){var a={d0:l(Xc,0,t,e.state),d1:l(Xc,1,t,e.state),d2:l(Xc,2,t,e.state),d3:l(Xc,3,t,e.state),d4:l(Xc,4,t,e.state)},i=r(function(e,r){return d(nf,e,t,f(of,f(Vc,e,a),f(Mc,jc(f(Vc,f(Ns,5,e+1),a)),f(Vc,f(Ns,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Fc);return D(e,{state:t})},sf=L(0,0),cf=function(e){return{current:sf,lfsrstate:1,state:e,x:1,y:0}},ff=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},lf=L(1,0),df=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),hf=r(function(e,t){if(e){var n=f(df,1,t);return l(Oc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),pf=r(function(e,t){var r=f(Ns,32,e/32|0),n=f(df,r,t),a=f(Ns,32,e);return f(hf,a,n)}),gf=n(function(e,t,r){var n=f(Jc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(tf,e,t(a),r)}),vf=n(function(e,t,r){return l(gf,e,of(t),r)}),yf=a(function(e,t,r,n){var a=f(qc,e,t);return l(vf,a,r,n)}),mf=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Af=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Cc,n,r),i=f(xa,function(e){return f(If,e,g)},f(Ai,0,a)),o=wf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(sc,i.outputLen,l(v,g,yr,i.outputLen))},Rf=function(e){return{$:"KS",a:e}},$f=function(e){var t=e.a;return Rf({config:t,inputLength:0,partial:yr,state:f(ui,25,gs(sf))})},_f=function(e){return Bc(Wn(e))},Lf=pc(yc(yr)),xf=r(function(e,t){var n=t.a;return Bc(r(function(t,r){var a=f(n,t,r),i=a.a,o=a.b;return f(e(o).a,t,i)}))}),Pf=r(function(e,t){return f(xf,function(e){return _f(t)},_f(e))}),Df=r(function(e,t){return f($c,Lf,f(Ac,f(Pf,e,Ic(t)-e),t))}),Uf=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=Ic(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+Ic(e)}),0,i),a)>-1))return Rf(D(n,{inputLength:Ic(e)+n.inputLength,partial:i}));var o=wc(i),u=f($c,Lf,f(Ac,_f(a),o)),s=Uc(u),c=f(kf,s,n.state),d=wf(c),h=f(Df,a,o),p=Lf,g=Rf(D(n,{inputLength:Ic(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Of=r(function(e,t){return Nf(f(Uf,pc(yc(f(xa,bc,t))),$f(e)))}),Mf=Of(cc),Ff=function(e){return ec(f(Ri,"",f(xa,f(jo,_s,ac),f(sc,4,Mf(f(xa,yi,Js(e)))))))},Vf=function(e){return f(iu,"0x",e)||f(iu,"0X",e)?e:"0x"+e},Kf=function(e){var t=e.a;return Vf(t)},Hf=r(function(e,t){var r=Ds(f(xa,tc,t)),n=function(e){return U(e,r)}(ou(Kf(Ff(e))));return ec(n)}),jf=function(e){return{data:si(f(Hf,"poke()",yr)),decoder:hu(au),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},qf=r(function(e,t){return D(t,{checked:e})}),Gf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),zf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Gf,f(jo,function(e){return e.label},Ja(r)),function(e){return D(e,{options:l(Gf,f(jo,function(e){return e.label},Ja(n)),qf(a),e.options)})},t)}),Yf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Wf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Jf={$:"Descending"},Qf=function(e){return"Ascending"===e.$?Jf:Ro},Xf=function(e){return d(Wf,e,Lo,Uo,yr)},Zf=r(function(e,t){return L(t.a,e(t.b))}),el=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Wf,t,Lo,Uo,M([da(f(Yf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(Zf,Qf,t.orderBy):L(a,Ro);return Xf(D(t,{orderBy:i}));default:return Xf(t)}}),tl=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},rl=yn,nl=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=tl(jf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(Ko,a,n);return d(Po,t,Lo,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Po,t,Lo,Uo,M([da(f(Yf,o,u))]));case"FiltersMsg":var s=e.a;return Fo(D(t,{filters:f(zf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(el,c,t.tradeTable);return d(Po,D(t,{tradeTable:l.model}),f(rl,Mo,l.cmd),f(qo,Mo,l.chainCmd),f(xa,Ji(Mo),l.appCmds));default:return Oo(t)}}),al={$:"BottomRight"},il={$:"ShouldBeImpossible"},ol=lr,ul=function(e){return qi(e)},sl=r(function(e,t){f(ol,e,t);return{align:al,label:"unexpectedError",mainParagraphs:M([M([ul(e)])]),noticeType:il}}),cl=function(e){var t=e.a;return Vf(t)},fl=ye,ll=f(jo,cl,fl),dl=f(jo,xs,f(jo,Vf,fl)),hl=f(jo,Kf,fl),pl=f(jo,_s,f(jo,Vf,fl)),gl=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),vl=un,yl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},ml=function(e){return yl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f($c,vl,r))},f(gl,function(e){e.a;return!R(e.b,ci)},e)))},bl=function(e){return ml(M([L("to",f(Io,ll,e.to)),L("from",f(Io,ll,e.from)),L("gas",f(Io,pl,e.gas)),L("gasPrice",f(Io,dl,e.gasPrice)),L("value",f(Io,dl,e.value)),L("data",f(Io,hl,e.data)),L("nonce",f(Io,pl,e.nonce))]))},Cl=function(e){return{$:"TxSentry",a:e}},El=ye,Sl=r(function(e,t){return yl(M([L("ref",El(e)),L("txParams",t)]))}),Tl=function(e){return{$:"Signing",a:e}},wl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Tl(e)}}),Il={$:"Black"},Al=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Bl={$:"RBEmpty_elm_builtin"},kl={$:"Red"},Nl=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(Al,kl,t,r,h(Al,Il,c,f,l,d),h(Al,Il,i,o,u,s))}return h(Al,e,i,o,h(Al,kl,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(Al,kl,c,f,h(Al,Il,g,v,y,m),h(Al,Il,t,r,d,a))}return h(Al,e,t,r,n,a)}),Rl=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Al,kl,e,t,Bl,Bl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Mu,e,a).$){case"LT":return h(Nl,n,a,i,l(Rl,e,t,o),u);case"EQ":return h(Al,n,a,t,o,u);default:return h(Nl,n,a,i,o,l(Rl,e,t,u))}}),$l=n(function(e,t,r){var n=l(Rl,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(Al,Il,a,i,o,u)}return n}),_l=n(function(e,t,r){var n=e.a,a=bl(r),i=l($l,n.ref,f(wl,r,t),n.txs);return L(Cl(D(n,{ref:n.ref+1,txs:i})),f(rl,n.tagger,n.outPort(f(Sl,n.ref,a))))}),Ll=_l,xl=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Lo,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Ll,n,i,o))}return x(ci,Lo,M([f(sl,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Pl=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Dl=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Ul=function(e){return{$:"Posix",a:e}},Ol=Ul,Ml={autoabortInterval:Ol(0),autorecallInterval:Ol(0),autoreleaseInterval:Ol(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Fl=function(e){return{$:"TokenValue",a:e}},Vl=function(e){return e.a},Kl=r(function(e,t){return f($c,fs,f(Io,Qa,f(Cs,e,t)))}),Hl=r(function(e,t){return Fl(f(Kl,Vl(e),Ku(t)))}),jl=function(e){return f(Hl,e,12)},ql=function(e){return f(Hl,e,3)},Gl=Fl(Ku(0)),zl=r(function(e,t){var r=Gl;return{abortPunishment:jl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:ql(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Yl=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Wl=qr,Jl=function(e){var t=Yl(f(Wl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Yo(e)-1-r;return L(U(f(Zo,r,e),f(Jo,r+1,e)),n)},Ql=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 yr}}),Xl=function(e){var t=e.a,r=f(Ql,Ja(0),t);return pu(r.b?t:yr)},Zl=Z,ed=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}}}),td=n(function(e,t,r){var n=f(ed,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(sc,e,r),l(td,e,t,n)):yr}),rd=r(function(e,t){return l(td,e,e,t)}),nd=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Io,ka(a),r)});return f(La,t,si(yr))}(Ua),ad=function(e){return f(Io,f(Da,Xl,pu),nd(f(xa,f(jo,$a,f(jo,ks,Zl)),f(rd,7,$a(e)))))},id=Q,od=function(e){var t=Js(id(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Io,Tu(xu),ad(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Io,Tu(Pu),ad(r))}return ci;default:var r=t;return f(Io,Tu(Pu),ad(r))}},ud=function(e){var t=function(e){return!f(Ns,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f($c,0,Yl(r)))}},sd=function(e){return f(us,e,e)},cd=Ku(2),fd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ps;case"Neg":return Eu;default:if(R(r,ps))return f(us,e,t);if(ud(r)){var n=e,a=sd(t),i=f(Kl,r,cd);e=n,t=a,r=i;continue e}var n=f(us,t,e),a=sd(t),i=f(Kl,f(cs,r,ps),cd);e=n,t=a,r=i;continue e}}),ld=r(function(e,t){return l(fd,ps,e,t)}),dd=function(e){if(""===e)return ci;var t=Jl(e),r=t.a,n=t.b,a=od(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(us,o,f(ld,Ku(10),Ku(i)));return si(u)},hd=function(e){return f(Io,Fl,dd(e))},pd=jr,gd=function(e){for(;;){if(f(pd,".",e))return l(Wo,0,-1,e);{if(!f(pd,"0",e))return""===e?"0":e;e=l(Wo,0,-1,e)}}},vd=f(Da,f(Bs,7,P("0")),Ni),yd=function(e){return f(Ri,"",e)},md=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return yd(f(ka,Ni(n),f(xa,vd,a)))}return"0"},bd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return md(t);default:var t=e.a;return"-"+md(t)}},Cd=r(function(e,t){return e<1?t:l(Wo,0,-e,t)}),Ed=function(e){var t=l(Bs,18,P("0"),bd(e)),r=f(Cd,18,t)+"."+f(nu,18,t);return function(e){return""===e?"0":e}(gd(r))},Sd=r(function(e,t){var r=Ed(t),n=Yl(f(Wl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(Zo,a+1+e,r):f(Zo,a,r)}),Td=r(function(e,t){if("Nothing"===e.$)return Ed(Vl(t));var r=e.a;return f(Sd,r,Vl(t))}),wd=ee,Id=function(e){var t=wd(f(Td,ci,e));if("Just"===t.$){return t.a}f(ol,"Error converting tokenValue to float: string -> float failed",e);return 0},Ad=function(e){if(""===e)return fi("You must specify a trade amount.");var t=hd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return Id(r)<1?fi("Trade amount can't be less than 1."):li(r)},Bd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=od(e);if("Nothing"===t.$){var r=wd(e);return fi("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 li(n)},kd=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),Nd=function(e){return""===e},Rd=function(e){return Nd(e)?ci:si(e)},$d=function(e){return f(kd,"You must specify a fiat type.",Rd(e))},_d=function(e){return""===e?fi("Must specify a payment method."):li(e)},Ld=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),xd=g(Ld,ci,ci,ci,ci,ci,ci,ci),Pd=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Dd=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Ud={$:"Custom"},Od=r(function(e,t){return{info:t,type_:e}}),Md=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Fd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),Vd=function(e){return e.a},Kd=function(e){return p(Md,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Od,Ud,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Fd,function(e){return D(xd,{daiAmount:si(e)})},Ad(e.daiAmount)),f(Fd,function(e){return D(xd,{fiatAmount:si(e)})},Bd(e.fiatAmount)),f(Fd,function(e){return D(xd,{fiatType:si(e)})},$d(e.fiatType)),f(Fd,function(e){return D(xd,{paymentMethod:si(e)})},_d(e.paymentMethod)),Pd(d(Dd,function(e){return Vd(e)>0?li(e):fi(D(xd,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return Vd(e)>0?li(e):fi(D(xd,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return Vd(e)>0?li(e):fi(D(xd,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Hd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},jd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),qd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Gd=function(e){var t=Kd(e.inputs),r=function(){return R(e.errors,xd)?xd:"Ok"===t.$?xd:t.a}();return D(e,{createParameters:l(jd,zl,Hd(e.wallet),qd(t)),errors:r})},zd=r(function(e,t){return Gd(D(t,{inputs:e}))}),Yd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Wd=function(e){return d(Yd,f(zd,Ml,{allowance:ci,createParameters:ci,depositAmount:ci,errors:xd,inputs:Ml,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Lo,Uo,yr)},Jd=a(function(e,t,r,n){return la(d(Pl,e,t,r,n))}),Qd=function(e){return{$:"Address",a:e}},Xd=f(jo,ou,f(jo,id,Qd)),Zd=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Xd("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return Xd("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return Xd("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return Xd("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return Xd("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},eh=function(e){return Xd("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},th=function(e){return{$:"AddressE",a:e}},rh=th,nh=function(e){return{$:"UintE",a:e}},ah=nh,ih=n(function(e,t,r){return{data:si(f(Hf,"approve(address,uint256)",M([rh(t),ah(r)]))),decoder:hu(au),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),oh=function(e){return f(Hl,e,200)},uh=r(function(e,t){return Fl(f(Wu,Vl(e),Vl(t)))}),sh=function(e){var t=f(Hl,e.tradeAmount,200);return f(uh,e.pokeReward,f(uh,oh(e.tradeAmount),f(uh,t,function(){return"Buyer"===e.initiatorRole.$?ql(e.tradeAmount):e.tradeAmount}())))},ch=Mi(ya),fh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),lh=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),dh=Xn,hh=Qn,ph=function(e){return f(hh,{caseInsensitive:!1,multiline:!1},e)},gh=Jn,vh=dh(f($c,gh,ph("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),yh=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}}),mh=r(function(e,t){return!f(yh,f(Da,es,e),t)}),bh=mh(Ua),Ch=q,Eh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Sh=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Th=f(La,Sh(ka),li(yr)),wh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},Ih=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Au,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Au,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Au,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Au,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Au,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Au,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Au,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Au,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Au,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Au,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Au,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Au,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Au,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Au,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Au,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(Ts(s)+" is not a valid hexadecimal character.")}}}),Ah=function(e){if(Nd(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(iu,"-",e)){var t=f($c,yr,wh(Js(e)));return f(tu,ru,l(Ih,Ti(t)-1,t,0))}return l(Ih,Yo(e)-1,Js(e),0)}();return f(Fd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Bh=function(e){var t=Js(e);return function(e){return L(t,e)}(f(Eh,yr,Th(f(xa,Ah,f(_i,"",f(Ri,"",f(xa,f(jo,_s,ac),f(sc,20,Mf(f(xa,f(jo,Ch,yi),t))))))))))},kh=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Bh(ou(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!vh(e)&&bh(o)},Nh=dh(f($c,gh,ph("^((0[Xx]){1})?[0-9a-f]{40}$"))),Rh=dh(f($c,gh,ph("^((0[Xx]){1})?[0-9A-F]{40}$"))),$h=function(e){return'"'+e+'"'},_h=function(e){var t=ou(e),r=f(Zo,24,t),n=f(nu,40,e);return 64===Yo(t)&&f(ki,Ja(P("0")),r)?Rh(n)||Nh(n)?li(Qd(n)):kh(n)?li(Qd(n)):fi("Given address "+$h(e)+" failed the EIP-55 checksum test."):40!==Yo(t)?fi("Given address "+$h(e)+" is not the correct length."):vh(t)?Rh(t)||Nh(t)?li(Qd(t)):kh(t)?li(Qd(t)):fi("Given address "+$h(e)+" failed the EIP-55 checksum test."):fi("Given address "+$h(e)+" contains invalid hex characters.")},Lh=Go(function(e){var t=e.a,r=e.b;return f(tu,f(Xo,t,r),_h(eu(r)))}),xh=r(function(e,t){var r=t.a;return Go(function(t){var n=t.a,a=t.b;return r(f(zo,n,f(Jo,64*e,a)))})}),Ph=Jr,Dh=r(function(e,t){return f(Ph,"data",hu(f(xh,e,t)))}),Uh=Qr,Oh=r(function(e,t){return f(Ph,"topics",f(Uh,e,hu(t)))}),Mh=function(e){return f(Io,f(jo,$a,f(Ra,r(function(e,t){return f(Wu,Ku(e),f(us,t,Es))}),fs)),nd(f(xa,f(jo,$a,f(jo,ks,f(jo,Ah,qd))),f(rd,8,$a(e)))))},Fh=function(e){var t=Js(id(e));e:for(;;){if(!t.b)return ci;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(Io,us(Ku(-1)),Mh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Io,us(Ku(-1)),Mh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Mh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Mh(a)}t.b;return ci}break e;default:break e}}var a=t;return Mh(a)},Vh=Go(function(e){var t=e.a,r=e.b;return f(tu,f(Xo,t,r),f(kd,"Error Decoding Uint into BigInt",Fh(Vf(eu(r)))))}),Kh=f(ch,f(Oh,1,Lh),f(ch,f(Dh,1,Lh),f(ch,f(Dh,0,Vh),Fi(fh)))),Hh=nn,jh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),qh=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(Hh,e,yl(M([L("data",fl(t.data)),L("topics",f(jh,hl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Gh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),zh=r(function(e,t){return f(tu,function(e){return e.id},f(Gh,function(e){return f(Fd,Di,f(qh,Kh,e).returnData)},f(kd,"No log found from that factoryAddress in that txReceipt",Yl(f(gl,function(t){return R(f(jo,cl,id)(t.address),f(jo,cl,id)(Zd(e)))},t.logs)))))}),Yh=n(function(e,t,r){return{data:si(f(Hf,"allowance(address,address)",M([rh(t),rh(r)]))),decoder:hu(Vh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Wh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Jh=function(e){switch(e.$){case"BlockNum":var t=e.a;return fl(Vf(_s(t)));case"EarliestBlock":return fl("earliest");case"LatestBlock":return fl("latest");default:return fl("pending")}},Qh=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return ml(M([L("to",f(Io,ll,t)),L("from",f(Io,ll,r)),L("gas",f(Io,pl,n)),L("gasPrice",f(Io,dl,a)),L("value",f(Io,dl,i)),L("data",f(Io,hl,o))]))},Xh=function(e){return{$:"BadBody",a:e}},Zh=function(e){return{$:"BadStatus",a:e}},ep=function(e){return{$:"BadUrl",a:e}},tp={$:"NetworkError"},rp={$:"Timeout"},np=rn,ap=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(ep(r));case"Timeout_":return fi(rp);case"NetworkError_":return fi(tp);case"BadStatus_":var n=t.a,a=t.b;return fi(Zh(n.statusCode));default:var n=t.a,a=t.b,i=f(np,f(Ph,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(Xh(Di(u)))}}),ip=n(function(e,t,r){return yl(M([L("id",El(e)),L("jsonrpc",fl("2.0")),L("method",fl(t)),L("params",f(jh,Ua,r))]))}),op=Bl,up=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Mu,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),sp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},cp=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(Al,kl,p,g,h(Al,Il,r,n,h(Al,kl,i,o,u,s),v),h(Al,Il,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(Al,Il,r,n,h(Al,kl,i,o,u,s),h(Al,kl,f,l,d,m))}return e},fp=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(Al,kl,i,o,h(Al,Il,s,c,f,l),h(Al,Il,r,n,d,h(Al,kl,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Al,Il,r,n,h(Al,kl,i,o,C,d),h(Al,kl,g,v,y,m))}return e},lp=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(Al,r,u,s,c,h(Al,kl,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 fp(t)}break e}o.a,o.d;return fp(t)}break e}return t}),dp=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(Al,t,r,n,dp(a),u)}var s=cp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(Nl,c,f,l,dp(d),p)}return Bl}return h(Al,t,r,n,dp(a),u)}return Bl},hp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Bl;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(Al,r,n,a,f(hp,e,i),o)}var s=cp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(Nl,c,l,d,f(hp,e,p),v)}return Bl}return h(Al,r,n,a,f(hp,e,i),o)}return f(pp,e,g(lp,e,t,r,n,a,i,o))}),pp=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(R(e,n)){var u=sp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(Nl,r,s,c,i,dp(o))}return Bl}return h(Nl,r,n,a,i,f(hp,e,o))}return Bl}),gp=r(function(e,t){var r=f(hp,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(Al,Il,n,a,i,o)}return r}),vp=n(function(e,t,r){var n=t(f(up,e,r));if("Just"===n.$){var a=n.a;return l($l,e,a,r)}return f(gp,e,r)}),yp=function(e){return"Just"===e.$},mp=gn,bp=vn,Cp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),Ep=function(e){return{$:"BadUrl_",a:e}},Sp=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Tp={$:"NetworkError_"},wp=function(e){return{$:"Receiving",a:e}},Ip=function(e){return{$:"Sending",a:e}},Ap={$:"Timeout_"},Bp=function(e){return f(ta,"application/json",f(xi,0,e))},kp=n(function(e,t,r){return Bp(l(ip,e,t,r))}),Np=f(ea,"",Ua),Rp=Te,$p=Se,_p=function(e){if("Ok"===e.$){var t=e.a;return $p(t)}var r=e.a;return Rp(r)},Lp=function(e){return l(Zn,gr,_p,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},xp=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Lp({body:l(kp,1,r,n),headers:yr,method:"POST",resolver:Np(ap(a)),timeout:ci,url:t})},Pp=n(function(e,t,r){return xp({decoder:t.decoder,method:"eth_call",params:M([Qh(t),Jh(r)]),url:e})}),Dp={$:"LatestBlock"},Up=r(function(e,t){return l(Pp,e,t,Dp)}),Op=function(e){return{$:"Perform",a:e}},Mp=sn,Fp=$p(gr),Vp=r(function(e,t){return f(Mp,function(t){return $p(e(t))},t)}),Kp=n(function(e,t,r){return f(Mp,function(t){return f(Mp,function(r){return $p(f(e,t,r))},r)},t)}),Hp=function(e){return l(La,Kp(ka),$p(yr),e)},jp=r(function(e,t){var r=t.a;return Be(f(Mp,mp(e),r))}),qp=n(function(e,t,r){return f(Vp,function(e){return gr},Hp(f(xa,jp(e),t)))}),Gp=n(function(e,t,r){return $p(gr)}),zp=r(function(e,t){var r=t.a;return Op(f(Vp,e,r))});pn.Task=Pe(Fp,qp,Gp,zp);var Yp=Ue("Task"),Wp=cn,Jp=r(function(e,t){return Yp(Op(f(Wp,f(Da,f(Da,$p,e),fi),f(Mp,f(Da,f(Da,$p,e),li),t))))}),Qp=a(function(e,t,r,n){return f(Jp,n,f(Up,Wh(eo(e)),l(Yh,eh(e),t,r)))}),Xp=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return Xd("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return Xd("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return Xd("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return Xd("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return Xd("0x092110996699c3E06e998d89F0f4586026e44F0F")}},Zp=function(e){return{$:"BoolE",a:e}},eg=Zp,tg=function(e){return{$:"StringE",a:e}},rg=tg,ng=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:si(f(Hf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([rh(t),rh(r),eg(n),ah(a),ah(i),ah(o),ah(u),ah(s),ah(c),ah(l),ah(d),rg(h),rg(p)]))),decoder:hu(Lh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ag=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:si(f(Hf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([rh(t),rh(r),eg(n),ah(a),ah(i),ah(o),ah(u),ah(s),ah(c),ah(l),ah(d),rg(h),rg(p)]))),decoder:hu(Lh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ig=r(function(e,t){return{paymentMethods:t,price:e}}),og=function(e){return fl(bd(e))},ug=function(e){return f(jh,Ua,M([fl(e.fiatType),og(e.amount)]))},sg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},cg=function(e){return yl(M([L("type",fl(sg(e.type_))),L("info",fl(e.info))]))},fg=function(e){var t=ug(e.price),r=f(jh,cg,e.paymentMethods);return f(xi,0,yl(M([L("paymentmethods",r),L("price",t)])))},lg=r(function(e,t){return D(t,{value:si(e)})}),dg=function(e){return Ku(Vd(e))},hg=function(e){return f(Kl,dg(e),Ku(1e3))},pg=r(function(e,t){var r=function(){return"Token"===e.$?ng:ag}();return function(){return"Native"===e.$?lg(Vl(sh(t))):Ua}()(r(Zd(e))(t.initiatorAddress)(Xp(e))(R(t.initiatorRole,lo))(Vl(t.tradeAmount))(Vl(ql(t.tradeAmount)))(Vl(jl(t.tradeAmount)))(Vl(t.pokeReward))(hg(t.autorecallInterval))(hg(t.autoabortInterval))(hg(t.autoreleaseInterval))(Vl(oh(t.tradeAmount)))(fg(f(ig,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),gg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),vg=function(e){return{$:"CreateNeedsSig",a:e}},yg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),mg=r(function(e,t){var r=tl(f(pg,e,t)),n={onBroadcast:ci,onMined:si(L(gg(e),ci)),onSign:si(yg(e))};return L(si(vg(e)),f(Ko,n,r))}),bg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Cg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),Eg=function(e){return{$:"ApproveNeedsSig",a:e}},Sg=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Tg=r(function(e,t){return{$:"Confirm",a:e,b:t}}),wg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),Ig={$:"NoOp"},Ag=function(e){return{appCmds:yr,chainCmd:Uo,cmd:Lo,model:e}},Bg=function(e){return Zl(bd(e))},kg={$:"Error"},Ng=r(function(e,t){f(ol,e+" fetch error",t);return{align:al,label:"web3FetchError",mainParagraphs:M([M([ul('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:kg}}),Rg=r(function(e,t){return{align:al,label:"web3MiningError",mainParagraphs:M([M([ul('Error mining "'+e+'" transaction: '+t)])]),noticeType:kg}}),$g={$:"Caution"},_g=r(function(e,t){return{align:al,label:"web3SigError",mainParagraphs:M([M([ul('Error signing "'+e+'" transaction: '+t)])]),noticeType:$g}}),Lg={$:"KovanDai"},xg=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Lg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Pg=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Dg=function(e){return f(To,xg,Pg(e))},Ug=r(function(e,t){return 1-e(1-t)}),Og=function(e){return f(Au,e,5)},Mg=Ug(Og),Fg={easing:Mg,offset:12,speed:200},Vg=function(e){return{$:"External",a:e}},Kg=function(e){return{$:"Internal",a:e}},Hg=function(e){return{$:"NotFound",a:e}},jg=function(e){for(;;){e=e.a}},qg=r(function(e,t){return Yp(Op(f(Vp,e,t)))}),Gg={$:"Http"},zg={$:"Https"},Yg=Kr,Wg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Jg=i(function(e,t,r,n,a){if(Nd(a)||f(Yg,"@",a))return ci;var i=f(Wl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=Zl(f(Jo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Wg,e,f(Zo,o,a),s,t,r,n))}return si(p(Wg,e,a,ci,t,r,n))}),Qg=a(function(e,t,r,n){if(Nd(n))return ci;var a=f(Wl,"/",n);if(a.b){var i=a.a;return h(Jg,e,f(Jo,i,n),t,r,f(Zo,i,n))}return h(Jg,e,"/",t,r,n)}),Xg=n(function(e,t,r){if(Nd(r))return ci;var n=f(Wl,"?",r);if(n.b){var a=n.a;return d(Qg,e,si(f(Jo,a+1,r)),t,f(Zo,a,r))}return d(Qg,e,ci,t,r)}),Zg=r(function(e,t){if(Nd(t))return ci;var r=f(Wl,"#",t);if(r.b){var n=r.a;return l(Xg,e,si(f(Jo,n+1,t)),f(Zo,n,t))}return l(Xg,e,ci,t)}),ev=function(e){return f(iu,"http://",e)?f(Zg,Gg,f(Jo,7,e)):f(iu,"https://",e)?f(Zg,zg,f(Jo,8,e)):ci},tv=Wt,rv=Gt(zt),nv=sa,av=r(function(e,t){return L(e,t)}),iv=_r,ov=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=Vu(r-n),o=f(ei,1,iv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),uv=r(function(e,t){var n=r(function(t,r){return Hp(f(xa,nv(0),d(ov,e.speed,e.easing,t,r-e.offset)))});return f(Mp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(Kp,av,rv,tv(t)))}),sv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Hd(t.wallet),Dg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(Qp,a,n.address,Zd(eo(a)),bg(a));return d(Yd,t,i,Uo,yr)}return Ag(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Yd,D(t,{inputs:D(u,{userRole:o})}),Lo,Uo,M([function(){return"Buyer"===o.$?d(Jd,"create offer type changed","input","sell dai",0):d(Jd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ag(f(zd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ag(f(zd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ag(f(zd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ag(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ag(f(zd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ag(f(zd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ag(f(zd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ag(f(zd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Yd,(g?zd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Lo,Uo,g?M([d(Jd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=Kd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(zl,n,m);return Ag(D(t,{depositAmount:si(Vl(sh(b))),txChainStatus:si(f(Tg,v,b))}))}var C=y.a;return d(Yd,D(t,{errors:C}),f(Jp,gs(Ig),function(){return f(uv,D(Fg,{offset:60}),"inputError")}()),Uo,yr);case"AbortCreate":return d(Yd,D(t,{txChainStatus:ci}),Lo,Uo,M([d(Jd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(mg,v,b);var e=v.a,r=function(){var t=tl(l(ih,eh(e),Zd(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Sg,e,b))};return f(Ko,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(Xu,a,E),ba)?L(si(Eg(e)),r):f(mg,v,b)}return L(si(Eg(e)),r)}(),T=S.a,w=S.b;return d(Yd,D(t,{txChainStatus:T}),Lo,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ag(D(t,{txChainStatus:si(l(Cg,a,b,A))}))}var B=I.a;return d(Yd,D(t,{txChainStatus:ci}),Lo,Uo,M([pa(f(_g,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(Xu,N,P),ba))return Ag($);var U=f(mg,eo(a),b),T=U.a,w=U.b;return d(Yd,D($,{txChainStatus:T}),Lo,w,yr)}return Ag($)}var O=k.a;return d(Yd,t,Lo,Uo,M([pa(f(Ng,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ag(D(t,{txChainStatus:si(f(wg,v,A))}))}var B=I.a;return d(Yd,D(t,{txChainStatus:ci}),Lo,Uo,M([pa(f(_g,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Yd,t,Lo,Uo,M([pa(f(Rg,"create",B))]))}var F=e.a,V=e.b.a,K=f(To,Bg,qd(f(zh,F,V)));if("Just"===K.$){var H=K.a;return d(Yd,t,Lo,Uo,M([da(f(Yf,F,H))]))}return d(Yd,t,Lo,Uo,M([pa(f(sl,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Yd,t,Lo,Uo,M([ga]));case"NoOp":return Ag(t);default:var j=e.a;return d(Yd,t,Lo,Uo,M([j]))}}),cv=r(function(e,t){return f(mh,function(e){return f(yh,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),fv=r(function(e,t){return f(Mu,Vd(e),Vd(t))}),lv=r(function(e,t){return R(f(fv,t.derived.phaseEndTime,e),Ta)}),dv=function(e){if(""===e)return li(ci);var t=hd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},hv=r(function(e,t){return{maxDai:t,minDai:e}}),pv=f(hv,ci,ci),gv=function(e){return l(Sh,r(function(t,r){return{dai:{max:r,min:t},fiatType:Rd(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Fd,function(e){return D(pv,{minDai:si(e)})},dv(e.minDai)),f(Fd,function(e){return D(pv,{maxDai:si(e)})},dv(e.maxDai)))},vv=r(function(e,t){var r=function(t){return f(mh,function(e){return f(Yg,id(e),id(t))},e)};return f(yh,function(e){return r(e.info)},t)}),yv=r(function(e,t){return D(t,{paymentMethod:e})}),mv=r(function(e,t){return D(t,{paymentMethodTerms:e})}),bv=r(function(e,t){return f(Xu,Vl(e),Vl(t))}),Cv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return Ev(D(e,{inputs:f(mv,r,f(yv,"",e.inputs))}))},Ev=function(e){var t=Cv(e),n=gv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(vv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(bv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(bv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(lv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(cv,t.filters,r)});return D(t,{filterFunc:s})},Sv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Tv={$:"Expires"},wv=function(e){return L(Ev({errors:pv,filterFunc:lv,filters:co(M([f(go,!0,!0),d(Co,!0,!1,!1,!1)])),inputs:Sv,showCurrencyDropdown:!1,tradeTable:No(L(Tv,Ro)),wallet:e}),Lo)},Iv=r(function(e,t){var r=f(gl,Ec(e),t.inputs.paymentMethodTerms);return Ev(D(t,{inputs:f(mv,r,t.inputs)}))}),Av=function(e){return Ev(D(e,{filterFunc:lv,inputs:Sv}))},Bv=function(e){return{$:"TradeTableMsg",a:e}},kv=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Nv=function(e){return d(kv,e,Lo,Uo,yr)},Rv=r(function(e,t){return D(t,{fiatType:e})}),$v=r(function(e,t){return D(t,{maxDai:e})}),_v=r(function(e,t){return D(t,{minDai:e})}),Lv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return Nv(D(t,{inputs:f(_v,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return Nv(D(t,{inputs:f($v,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return Nv(D(t,{inputs:f(Rv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return Nv(D(t,{inputs:(n?Rv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return Nv(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return Nv(D(t,{inputs:f(yv,r,t.inputs)}));case"AddSearchTerm":return Nv(Cv(t));case"RemoveTerm":var a=e.a;return Nv(f(Iv,a,t));case"ApplyInputs":return d(kv,Ev(t),Lo,Uo,yr);case"ResetSearch":return Nv(Av(t));case"FiltersMsg":var i=e.a;return Nv(Ev(D(t,{filters:f(zf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(el,o,t.tradeTable);return d(kv,D(t,{tradeTable:u.model}),f(rl,Bv,u.cmd),f(qo,Bv,u.chainCmd),f(xa,Ji(Bv),u.appCmds));case"NoOp":return Nv(t);default:var s=e.a;return d(kv,t,Lo,Uo,M([s]))}}),xv=a(function(e,t,r,n){return e(yl(M([L("title",fl(t)),L("body",function(){if("Nothing"===r.$)return vl;var e=r.a;return fl(e)}()),L("image",function(){if("Nothing"===n.$)return vl;var e=n.a;return fl(e)}())])))}),Pv=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Dv=function(e){return e.a+"="+e.b},Uv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Dv,e)):""},Ov=r(function(e,t){return"/"+(f(Ri,"/",e)+Uv(t))}),Mv=function(e){switch(e.$){case"Home":return f(Ov,M(["DAIHard"]),yr);case"Create":return f(Ov,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Ov,M(["DAIHard","trade",Pv(t),Ni(r)]),yr);case"Marketplace":return f(Ov,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Ov,M(["DAIHard","history",cl(n)]),yr);default:return f(Ov,yr,yr)}},Fv={$:"NotFound"},Vv=function(e){return{$:"AgentHistory",a:e}},Kv={$:"Create"},Hv={$:"Home"},jv={$:"Marketplace"},qv=function(e){return{$:"Parser",a:e}},Gv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),zv=r(function(e,t){return qv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Gv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Yv=f(zv,"ADDRESS",f(jo,_h,qd)),Wv={$:"Eth"},Jv={$:"Kovan"},Qv=f(zv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Wv));case"keth":return si(Zi(Jv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Lg));case"xdai":return si(Zi(to));default:return ci}}),Xv=f(zv,"NUMBER",Zl),Zv=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Gv,r,n,a,i,e(o))}),ey=r(function(e,t){var r=t.a;return qv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,Zv(u),r(h(Gv,n,a,i,o,e)))})}),ty=function(e){return l(La,oo,yr,e)},ry=r(function(e,t){return ty(f(xa,e,t))}),ny=function(e){return qv(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 R(u,e)?M([h(Gv,f(ka,u,r),s,a,i,o)]):yr}return yr})},ay=r(function(e,t){var r=e.a,n=t.a;return qv(function(e){return f(ry,n,r(e))})}),iy=qv(function(e){return M([e])}),oy=f(ay,ny("DAIHard"),function(e){return qv(function(t){return f(ry,function(e){return(0,e.a)(t)},e)})}(M([f(ey,Hv,iy),f(ey,Kv,ny("create")),f(ey,Yf,f(ay,ny("trade"),f(ay,Qv,Xv))),f(ey,jv,ny("marketplace")),f(ey,Vv,f(ay,ny("history"),Yv)),f(ey,function(e){return Vv(e)},f(ay,ny("history"),Yv))]))),uy=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 si(t.value)}return si(t.value)}return ci}},sy=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,sy(r))}return yr}return yr},cy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return sy(r)}var r=t;return sy(r)},fy=Qt,ly=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),dy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=fy(n);if("Nothing"===o.$)return t;var u=o.a,s=fy(i);if("Nothing"===s.$)return t;var c=s.a;return l(vp,u,ly(c),t)}return t}),hy=function(e){if("Nothing"===e.$)return op;var t=e.a;return l(La,dy,op,f(_i,"&",t))},py=r(function(e,t){var r=e.a;return uy(r(h(Gv,yr,cy(t.path),hy(t.query),t.fragment,Ua)))}),gy=function(e){return f($c,Fv,f(py,oy,e))},vy=aa,yy=r(function(e,t){return f(vy,e,Mv(t))}),my=je("connectToWeb3",function(e){return vl}),by=function(e){return yl(M([L("event",fl(e.event)),L("category",fl(e.category)),L("label",fl(e.label)),L("value",El(e.value))]))},Cy=r(function(e,t){return yl(M([L("address",fl(cl(e))),L("signSeedMsg",fl(t))]))}),Ey=je("gTagOut",Ua),Sy=je("genPrivkey",Ua),Ty=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),wy=n(function(e,t,r){return f(To,Jc(t),f(Io,function(e){return e.trades},f(Ty,function(t){return R(t.factory,e)},r)))}),Iy=je("notifyPort",Ua),Ay=je("requestNotifyPermissionPort",function(e){return vl}),By=r(function(e,t){return D(t,{wallet:e})}),ky=r(function(e,t){return L(f(zd,t.inputs,D(t,{wallet:e})),function(){var t=L(Hd(e),Dg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(Qp,n,r.address,Zd(eo(n)),bg(n))}return Lo}())}),Ny=r(function(e,t){return D(t,{wallet:e})}),Ry=function(e){return{$:"AllowanceFetched",a:e}},$y=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Hd(e),Dg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Dg(e),si(i.factory))?d(Qp,a,n.address,i.creationInfo.address,Ry):Lo}return Lo}())}),_y=function(e){return{$:"AgentHistoryModel",a:e}},Ly=function(e){return{$:"CreateModel",a:e}},xy=function(e){return{$:"CreateMsg",a:e}},Py=function(e){return{$:"MarketplaceModel",a:e}},Dy=function(e){return{$:"TradeModel",a:e}},Uy=function(e){return{$:"TradeMsg",a:e}},Oy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Lo);case"CreateModel":var r=t.a,n=f(ky,e,r),a=n.a,i=n.b;return L(Ly(a),f(rl,xy,i));case"TradeModel":var o=t.a,u=f($y,e,o),s=u.a,c=u.b;return L(Dy(s),f(rl,Uy,c));case"MarketplaceModel":var l=t.a;return L(Py(f(Ny,e,l)),Lo);default:var d=t.a;return L(_y(f(By,e,d)),Lo)}}),My=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Fy=function(e){return{$:"PartiallyLoadedTrade",a:e}},Vy=r(function(e,t){return Fy(g(My,e,t,ci,ci,ci,ci,ci))}),Ky=function(e){return{$:"CurrentBlockFetched",a:e}},Hy=du(f(jo,ou,Ah)),jy=function(e){return xp({decoder:Hy,method:"eth_blockNumber",params:yr,url:e})},qy=function(e){return f(Jp,Ky,jy(e))},Gy=r(function(e,t){return{address_:e,blocknum:t}}),zy=function(e){return Go(function(t){return li(L(t,e))})},Yy=n(function(e,t,r){var n=t.a,a=r.a;return Go(function(t){return f(Gh,function(t){var r=t.a,n=t.b;return f(tu,Zf(e(n)),a(r))},n(t))})}),Wy=r(function(e,t){return l(Yy,r(function(e,t){return e(t)}),t,e)}),Jy=hu(f(Wy,Vh,f(Wy,Lh,zy(Gy)))),Qy=r(function(e,t){return{data:si(f(Hf,"createdTrades(uint256)",M([ah(t)]))),decoder:Jy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xy=n(function(e,t,r){return f(Jp,r,f(Up,Wh(e),f(Qy,Zd(e),t)))}),Zy=function(e){return{$:"CreationInfoFetched",a:e}},em=r(function(e,t){return l(Xy,e,Ku(t),Zy)}),tm=function(e){return{$:"EventSentryMsg",a:e}},rm=function(e){return{$:"BlockNumber",a:e}},nm=function(e){return{$:"EventSentry",a:e}},am=function(e){return{$:"Set_elm_builtin",a:e}},im=am(op),om=r(function(e,t){return L(nm({blockNumber:ci,errors:yr,nodePath:t,pending:im,ref:1,requests:op,tagger:e,watching:im}),f(Jp,f(jo,rm,e),jy(t)))}),um=function(e){return f(om,tm,Wh(e))},sm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),cm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},fm=cm(f(sm,ci,ci)),lm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:bo,secureCommInfo:fm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),dm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),hm=n(function(e,t,r){var n=f(em,t,r),a=um(t),i=a.a,o=a.b;return d(dm,l(lm,f(Vy,t,r),i,e),_o(M([n,o,qy(Wh(t))])),Uo,M([ha]))}),pm=function(e){return{$:"LoadedTrade",a:e}},gm=r(function(e,t){var r=um(t.factory),n=r.a,a=r.b;return d(dm,l(lm,pm(t),n,e),_o(M([a,qy(Wh(t.factory))])),Uo,M([ha]))}),vm=function(e){return{data:si(f(Hf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},ym=function(e){return{data:si(f(Hf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},mm=function(e){return{data:si(f(Hf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},bm=r(function(e,t){return{data:si(f(Hf,"initiatorStatement(string)",M([rg(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Cm=function(e){return{data:si(f(Hf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Em=function(e){return{data:si(f(Hf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Sm=r(function(e,t){return{data:si(f(Hf,"responderStatement(string)",M([rg(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Tm=r(function(e,t){return{amount:t,fiatType:e}}),wm=f(cu,function(e){var t=od(e);if("Just"===t.$){var r=t.a;return Fi(r)}return fu("Can't convert that to a BigInt")},lu),Im=l(Mi,Tm,f(Uh,0,lu),f(Uh,1,wm)),Am={$:"Bank"},Bm={$:"Cash"},km=function(e){switch(e){case"cash":return si(Bm);case"bank":return si(Am);case"custom":return si(Ud);default:return ci}},Nm=f(cu,function(e){var t=km(e);if("Just"===t.$){var r=t.a;return Fi(r)}return fu("")},lu),Rm=l(Mi,Od,f(Ph,"type",Nm),f(Ph,"info",lu)),$m=oe,_m=function(e){var t=l(Mi,ig,f(Ph,"price",Im),f(Ph,"paymentmethods",$m(Rm)));return f(np,t,e)},Lm=r(function(e,t){return{commPubkey:t,responder:e}}),xm=r(function(e,t){var n=r(function(t,r){return l(Wo,t,t+2*r,e)}),a=f(jo,Ah,tu(ti(2)));return f(Gh,function(t){return f(tu,function(e){return f(n,t+64,e)},Ah(l(Wo,t,t+64,e)))},a(t))}),Pm=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),Dm=n(function(e,t,r){var n=l(Ra,Pm(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),Um=j,Om=function(e){return Ts(Um(e))},Mm=function(e){return l(Dm,r(function(e,t){return U(t,Om(e))}),"",e)},Fm=Go(function(e){var t=e.a,r=e.b;return f(tu,f(Xo,t,r),f(Gh,Mm,f(Gh,f(jo,xa(Ah),Th),f(tu,gl(f(jo,Nd,es)),f(tu,Xs(2),f(xm,t,eu(r)))))))}),Vm=f(ch,f(Dh,1,Fm),f(ch,f(Dh,0,Lh),Fi(Lm))),Km=r(function(e,t){return{commPubkey:t,terms:e}}),Hm=f(ch,f(Dh,1,Fm),f(ch,f(Dh,0,Fm),Fi(Km))),jm=function(e){return{statement:e}},qm=f(ch,f(Dh,0,Fm),Fi(jm)),Gm=function(e){return{statement:e}},zm=f(ch,f(Dh,0,Fm),Fi(Gm)),Ym={$:"AbortedEvent"},Wm={$:"BurnedEvent"},Jm={$:"ClaimedEvent"},Qm=function(e){return{$:"CommittedEvent",a:e}},Xm=function(e){return{$:"InitiatedEvent",a:e}},Zm=function(e){return{$:"InitiatorStatementLogEvent",a:e}},eb={$:"PokeEvent"},tb={$:"RecalledEvent"},rb={$:"ReleasedEvent"},nb=function(e){return{$:"ResponderStatementLogEvent",a:e}},ab=dh(f($c,gh,ph("^((0[Xx]){1})?[0-9a-fA-F]+$"))),ib=function(e){return ab(e)?li(ec(ou(e))):fi("Something in here is not very hexy: "+$h(e))},ob=du(ib),ub=f(Ph,"topics",f(Uh,0,ob)),sb=function(e){return ec(f(Ri,"",f(xa,f(jo,_s,ac),Mf(f(xa,yi,Js(e))))))},cb=f(cu,function(e){return R(e,sb("Initiated(string,string)"))?f(Oi,Xm,Hm):R(e,sb("Committed(address,string)"))?f(Oi,Qm,Vm):R(e,sb("Recalled()"))?Fi(tb):R(e,sb("Claimed()"))?Fi(Jm):R(e,sb("Aborted()"))?Fi(Ym):R(e,sb("Released()"))?Fi(rb):R(e,sb("Burned()"))?Fi(Wm):R(e,sb("InitiatorStatementLog(string)"))?f(Oi,Zm,qm):R(e,sb("ResponderStatementLog(string)"))?f(Oi,nb,zm):R(e,sb("Poke()"))?Fi(eb):fu("Unrecognized topic hash")},ub),fb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},lb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},db=function(e){return R(e.buyerDeposit,ql(e.tradeAmount))&&R(e.abortPunishment,jl(e.tradeAmount))},hb={$:"Invalid"},pb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),gb=r(function(e,t){return Ol(Vd(t)+Vd(e))}),vb=function(e){var t=wd(bd(e.amount));if("Just"===t.$){return t.a}f(ol,"Error converting FiatValue to float--string -> float failed!",e);return 0},yb=r(function(e,t){return(t-e)/e}),mb=r(function(e,t){var r=vb(t),n=Id(e);return"USD"===t.fiatType?si(f(yb,n,r)):ci}),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 Ol(f(Au,2,31)-1)}}();return{margin:f(mb,e.tradeAmount,r.price),phaseEndTime:f(gb,t.phaseStartTime,n)}}),Cb=function(e){var t=x(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 pm(v(pb,e.factory,e.id,n,a,o,u,s,l(bb,a,o,u)))}return Fy(e)},Eb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Cb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(ol,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return hb}}),Sb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Cb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(ol,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return hb}}),Tb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Cb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(ol,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return hb}}),wb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Cb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return pm(D(n,{state:e}));default:return hb}}),Ib=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Cb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(ol,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return hb}}),Ab=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}}),Bb=hu(f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,au,f(Wy,Lh,zy(Ab))))))))))),kb=function(e){return{data:si(f(Hf,"getParameters()",yr)),decoder:Bb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Nb=function(e){return f(Io,function(e){return Ol(1e3*e)},Zl(bd(e)))},Rb=function(e){return Fl(e)},$b=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),_b=function(e){var t=f(kd,"error converting BigInt to Time.Posix",Nb(e.autoabortInterval)),r=f(kd,"error converting BigInt to Time.Posix",Nb(e.autoreleaseInterval)),a=f(kd,"error converting BigInt to Time.Posix",Nb(e.autorecallInterval));return d($b,n(function(t,r,n){return{abortPunishment:Rb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Rb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:Rb(e.pokeReward),tradeAmount:Rb(e.tradeAmount)}}),a,t,r)},Lb=n(function(e,t,r){return f(Jp,r,f(Vp,_b,f(Up,Wh(e),kb(t))))}),xb=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}}}}}}}}}}},Pb=hu(f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,zy(xb)))))))))))),Db=function(e){return{data:si(f(Hf,"getPhaseStartInfo()",yr)),decoder:Pb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Ub=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),Ob=function(e){return h(Ub,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}}),Nb(e.v6),Nb(e.v7),Nb(e.v8),Nb(e.v9))},Mb=n(function(e,t,r){return f(Jp,r,f(Vp,Ob,f(Up,Wh(e),Db(t))))}),Fb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),Vb=hu(f(Wy,Vh,f(Wy,Lh,f(Wy,Vh,f(Wy,Vh,f(Wy,Vh,zy(Fb))))))),Kb=function(e){return{data:si(f(Hf,"getState()",yr)),decoder:Vb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Hb={$:"Aborted"},jb={$:"Burned"},qb={$:"NotClosed"},Gb={$:"Recalled"},zb={$:"Released"},Yb=function(e){switch(f($c,99,Zl(bd(e)))){case 0:return si(qb);case 1:return si(Gb);case 2:return si(Hb);case 3:return si(zb);case 4:return si(jb);default:return ci}},Wb=function(e){switch(f($c,99,Zl(bd(e)))){case 1:return si(bo);case 2:return si(yo);case 3:return si(mo);case 4:return si(vo);default:return ci}},Jb=function(e){return R(e,Xd("0x0000000000000000000000000000000000000000"))?ci:si(e)},Qb=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),Xb=function(e){var t=Nb(e.phaseStartTimestamp),r=Wb(e.phase),a=Yb(e.closedReason);return d(Qb,n(function(t,r,n){return{balance:Rb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:Jb(e.responder)}}),r,t,a)},Zb=n(function(e,t,r){return f(Jp,r,f(Vp,Xb,f(Up,Wh(e),Kb(t))))}),eC=i(function(e,t,r,n,a){return _o(M([l(Lb,e,t,r),l(Zb,e,t,n),l(Mb,e,t,a)]))}),tC=function(e){var t=Bg(e);if("Just"===t.$){return t.a}f(ol,"Warning! BigInt to Int conversion failed!",bd(e));return 0},rC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),nC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),aC=function(e){return e.b?l(nC,e,yr,0):qa},iC=tn,oC=function(e){var t=h(iC,rC,f(Ph,"encapsulation",lu),f(Ph,"iv",lu),f(Ph,"tag",lu),f(Ph,"encrypted",lu)),r=$m(t),n=f(Hh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Jc,0,e),f(Jc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(aC(i))},uC=function(e){var t=function(e){var t=Yo(e);return t>1114111?fi("string is too long"):li(f(Ss,Um(t),e))};return f(tu,Ri(""),Th(f(xa,t,e)))},sC=function(e){var t=e.a,r=e.b;return uC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},cC=r(function(e,t){return yl(M([L("message",fl(e)),L("pubkeyHexStrings",f(jh,fl,M([t.initiatorPubkey,t.responderPubkey])))]))}),fC=function(e){return{$:"LoadedCommInfo",a:e}},lC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dC=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 fC(f(lC,r,n))}return cm(e)},hC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return dC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return fC(D(n,{initiatorPubkey:e}))}),pC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return dC(D(r,{responderPubkey:si(e)}))}var n=t.a;return fC(D(n,{responderPubkey:e}))}),gC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),vC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(ed,a,n),o=ks(f(sc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),yC=function(e){var t=aC(f(vC,Js(e),yr));return l(jd,av,h(Ub,rC,f(Jc,0,t),f(Jc,1,t),f(Jc,2,t),f(Jc,3,t)),h(Ub,rC,f(Jc,4,t),f(Jc,5,t),f(Jc,6,t),f(Jc,7,t)))},mC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),bC={$:"Aborted"},CC={$:"Burned"},EC={$:"Claimed"},SC=function(e){return{$:"Committed",a:e}},TC=function(e){return{$:"Encrypted",a:e}},wC={$:"FailedDecode"},IC={$:"Initiated"},AC={$:"Recalled"},BC={$:"Released"},kC=function(e){return{$:"StateChange",a:e}},NC=function(e){return{$:"Statement",a:e}},RC=fr,$C=cr,_C=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(RC,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l($C,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),LC=or,xC=y,PC=a(function(e,t,r,n){var a=Gc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(LC,Ga(r),n);var i=za(d(PC,e-Ha,t,r,ja));return f(LC,i,n)}var o=f(zc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(PC,e-Ha,t,r,u));return l(Zc,a,i,n)}var i=za(d(PC,e-Ha,t,r,xC(o)));return l(Zc,a,i,n)}),DC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(PC,c,r,e,xC(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(PC,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),UC=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(RC,32,r,e),o=f(DC,i,t);if(a<0){var u=l($C,a,n,e);return f(DC,u,o)}return o}),OC=ur,MC=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(OC,i,t,r)}return f(ka,e,t)});return{nodeList:l(OC,i,yr,n),nodeListSize:t/32|0,tail:a}},FC=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(OC,o,t,r)}var n=e.a;return f(UC,n,t)});return f(UC,i,l(OC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(OC,o,t,r)}var n=e.a;return f(_C,n,t)});return f(ai,!0,f(_C,i,l(OC,o,MC(e),a)))}),VC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),KC=f(La,VC,yr),HC=n(function(e,t,r){var n=gC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(kC(IC));case"CommittedEvent":var r=t.a;return si(kC(SC(r.responder)));case"RecalledEvent":return si(kC(AC));case"ClaimedEvent":return si(kC(EC));case"AbortedEvent":return si(kC(bC));case"ReleasedEvent":return si(kC(BC));case"BurnedEvent":return si(kC(CC));case"InitiatorStatementLogEvent":var r=t.a;return si(NC({blocknum:e,message:function(){var e=yC(r.statement);if("Just"===e.$){var t=e.a;return TC(t)}return wC}(),who:n(Eo)}));case"ResponderStatementLogEvent":var r=t.a;return si(NC({blocknum:e,message:function(){var e=yC(r.statement);if("Just"===e.$){var t=e.a;return TC(t)}return wC}(),who:n(So)}));default:return ci}}(),i=f(Io,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(FC,r.history,aC(KC(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Io,mC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),KC(M([s])))}),jC=Gr,qC=function(e){var t=l(Mi,av,f(Ph,"id",jC),f(Ph,"message",lu));return f(Fd,Di,f(Hh,t,e))},GC=function(e){return{$:"Decrypted",a:e}},zC=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),YC=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(HC,n,a,t),o=i.a,u=i.b,s=i.c;return d(zC,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(zC,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(zC,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=qC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Jc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:GC(y)}),T=D(b,{eventInfo:NC(S)}),w=l(tf,v,T,t.history);return d(zC,D(t,{history:w}),!1,ci,yr)}return d(zC,t,!1,ci,M([pa(f(sl,"got a decryption result, but for an event that is not a message!",b))]))}return d(zC,t,!1,ci,M([pa(f(sl,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(zC,t,!1,ci,M([pa(f(sl,"Error decoding decryption result",I))]))}}),WC=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),JC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),QC=function(e){return{onBroadcast:ci,onMined:si(L(WC(e),ci)),onSign:si(JC(e))}},XC=je("encryptToPubkeys",Ua),ZC=n(function(e,t,r){return{data:si(f(Hf,"commit(address,string)",M([rh(t),rg(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),eE=n(function(e,t,r){return{data:si(f(Hf,"commit(address,string)",M([rh(t),rg(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tE=function(e){return{$:"CommitMined",a:e}},rE={$:"CommitNeedsSig"},nE=function(e){return{$:"CommitSigned",a:e}},aE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?eE:ZC}(),a=tl(function(){return"Token"===e.factory.$?Ua:lg(Vl(fb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(rE),f(Ko,{onBroadcast:ci,onMined:si(L(tE,ci)),onSign:si(nE)},a))}),iE=r(function(e,t){return yl(M([L("id",El(e)),L("encapsulation",fl(t.encapsulatedKey)),L("iv",fl(t.iv)),L("tag",fl(t.tag)),L("encrypted",fl(t.message))]))}),oE=je("decryptMessage",Ua),uE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},sE=r(function(e,t){return _o(f(xa,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 oE(f(iE,r,s))}return Lo}return Lo},uE(e.history)))}),cE=function(e){if("Just"===e.$){return e.a}return ci},fE=function(e){var t=cE(l(jd,wo,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Io,function(e){return e.address},Hd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(sE,n,a)}return Lo},lE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(HC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),dE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),hE=i(function(e,t,r,n,a){return f(lE,n,p(dE,e,r,t,qa,a,""))}),pE=function(e){return{$:"ChatHistoryMsg",a:e}},gE=a(function(e,t,r,n){var a=x(t,Hd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(Ao,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(pE),n))}(h(hE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),vE={$:"Abort"},yE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),mE=function(e){return{$:"ActionNeedsSig",a:e}},bE=function(e){return{$:"ApproveMining",a:e}},CE={$:"ApproveNeedsSig"},EE=function(e){return{$:"ApproveSigned",a:e}},SE={$:"Burn"},TE={$:"Claim"},wE=function(e){return{$:"CommitMining",a:e}},IE=function(e){return{$:"ConfirmingAction",a:e}},AE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),BE=function(e){return{$:"EventLogFetched",a:e}},kE=function(e){return{$:"ParametersFetched",a:e}},NE=function(e){return{$:"PhaseInfoFetched",a:e}},RE={$:"Poke"},$E={$:"Recall"},_E={$:"Release"},LE=function(e){return{$:"StartContractAction",a:e}},xE=function(e){return{$:"StateFetched",a:e}},PE=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"}},DE=function(e){return d(dm,e,Lo,Uo,yr)},UE={align:al,label:"cantFindTradeWillRetry",mainParagraphs:M([M([ul("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:kg},OE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(Ng,e,r)}if("Nothing"===t.a.$){t.a;return f(sl,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(sl,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),ME={align:al,label:"tradeParametersNotDefault",mainParagraphs:M([M([ul("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:kg},FE=eo(Xi),VE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),KE=n(function(e,t,r){return l(vp,e,Io(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),HE=r(function(e,t){var r=t.a;return am(f(gp,e,r))}),jE=n(function(e,t,r){var n=e.a,a=f(up,t,n.requests);if("Nothing"===a.$)return L(nm(n),Lo);var i=a.a,o=L(i.watchOnce,Yl(r));if("Nothing"===o.b.$){o.b;return L(nm(D(n,{requests:l(KE,t,r,n.requests)})),Lo)}if(o.a){var u=o.b.a;return L(nm(D(n,{requests:l(KE,t,r,n.requests),watching:f(HE,t,n.watching)})),f(qg,i.tagger,$p(u)))}return L(nm(D(n,{requests:l(KE,t,r,n.requests)})),_o(f(xa,function(e){return f(qg,i.tagger,$p(e))},r)))}),qE=_e,GE=r(function(e,t){return f(Jp,f(jo,rm,t),f(Mp,function(t){return jy(e)},qE(2e3)))}),zE=ue,YE=ce,WE=Yr,JE=n(function(e,t,r){var n=function(e){return YE(M([e,zE(r)]))};return f(cu,function(a){var i=f(Hh,e,a);if("Ok"===i.$){var o=i.a,u=f(Hh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return fu(Di(c))}return Fi(r)},WE)}),QE=a(function(e,t,r,n){return f(ch,l(JE,f(Ph,e,WE),t,r),n)}),XE=n(function(e,t,r){return f(ch,f(Ph,e,t),r)}),ZE=du(_h),eS=dh(f($c,gh,ph("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),tS=function(e){return{$:"BlockHash",a:e}},rS=function(e){return eS(e)?li(tS(ou(e))):fi("Given blockHash "+$h(e)+" is not valid.")},nS=du(rS),aS=function(e){return{$:"TxHash",a:e}},iS=function(e){return eS(e)?li(aS(ou(e))):fi("Given txHash "+$h(e)+" is not valid.")},oS=du(iS),uS=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}}),sS=zr,cS=l(XE,"blockNumber",Hy,l(XE,"blockHash",nS,l(XE,"transactionHash",oS,l(XE,"transactionIndex",Hy,l(XE,"logIndex",Hy,d(QE,"removed",sS,!1,l(XE,"topics",$m(ob),l(XE,"data",lu,l(XE,"address",ZE,Fi(uS)))))))))),fS=function(e){return f(jh,function(e){if("Just"===e.$){var t=e.a;return fl(Kf(t))}return vl},e)},lS=function(e){return yl(M([L("fromBlock",Jh(e.fromBlock)),L("toBlock",Jh(e.toBlock)),L("address",ll(e.address)),L("topics",fS(e.topics))]))},dS=r(function(e,t){return xp({decoder:$m(cS),method:"eth_getLogs",params:M([lS(t)]),url:e})}),hS=function(e){return{$:"BlockNum",a:e}},pS=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Mp,function(r){return f(Vp,vi(r),f(dS,e,D(t,{fromBlock:hS(n),toBlock:hS(a)})))},f(dS,e,t)):f(dS,e,t)}),gS=n(function(e,t,r){var n=r.a,a=r.b;return f(dS,e,D(t,{fromBlock:hS(n),toBlock:hS(a)}))}),vS=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(vS,e,t,i)),c=o;e=u,t=s,r=c}}),yS=r(function(e,t){return l(vS,$l,t,e)}),mS=r(function(e,t){var r=e.a,n=t.a;return am(f(yS,r,n))}),bS=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 _o(f(xa,function(t){return f(Jp,f(jo,VE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},KC(f(xa,function(e){return f(up,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(nm(D(r,{blockNumber:si(a)})),_o(M([f(GE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,gS)]))):L(t,f(GE,r.nodePath,r.tagger))}return L(nm(D(r,{blockNumber:si(a),pending:im,watching:f(mS,r.watching,r.pending)})),_o(M([f(GE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,pS),l(i,L(a,a),r.watching,gS)])))}var s=e.a.a;return L(nm(D(r,{errors:f(ka,s,r.errors)})),f(GE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(jE,t,c,d)}var s=e.b.a;return L(nm(D(r,{errors:f(ka,s,r.errors)})),Lo)}),CS=r(function(e,t){var r=t.a;return am(l($l,e,gr,r))}),ES=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l($l,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(nm(D(o,{watching:f(CS,a.ref,o.watching)})),f(Jp,f(jo,VE(a.ref),a.tagger),e),a.ref)}(l(pS,a.nodePath,n,L(s,s)))}return x(nm(D(o,{pending:f(CS,a.ref,o.pending)})),Lo,a.ref)}),SS=ES(!1),TS=function(e){return M([e])},wS=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(em,r.factory,r.id):Lo}}(),function(){var e=x(Hd(t.wallet),Dg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Dg(t.wallet),si(a.factory))?d(Qp,n,r.address,a.creationInfo.address,Ry):Lo}return Lo}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(gE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?fE(t):Lo,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(dm,u,_o(M([l(Zb,p.factory,p.creationInfo.address,xE),s,r])),Uo,o)}return DE(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return DE(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(dm,t,Lo,Uo,M([pa(f(Ng,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(Xu,m,Vl(fb(C.parameters))),ba))return DE(u);var S=l(aE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(dm,D(u,{txChainStatus:T}),Lo,w,yr)}return DE(u)}var y=g.a;return d(dm,t,Lo,Uo,M([pa(f(Ng,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:tC(I.blocknum)},B=l(SS,BE,t.eventSentry,{address:A.address,fromBlock:hS(A.blocknum),toBlock:Dp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(Eb,A,t.trade)}),$=f($c,FE,lb(u.trade)),_=_o(M([N,h(eC,$,A.address,kE,xE,NE)]));return d(dm,u,_,Uo,yr)}if("BadBody"===g.a.$){g.a.a;return d(dm,t,Lo,Uo,M([pa(UE)]))}var y=g.a;return d(dm,t,Lo,Uo,M([pa(f(Ng,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(wb,P,t.trade)});return d(dm,u,fE(u),Uo,yr)}return d(dm,t,Lo,Uo,M([pa(f(OE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(db(F)){var u=D(t,{trade:f(Sb,F,t.trade)});return d(dm,u,fE(u),Uo,yr)}return d(dm,t,Lo,Uo,M([pa(ME)]))}var V=g.a.a;return d(dm,t,Lo,Uo,M([pa(f(sl,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(dm,t,Lo,Uo,M([pa(f(Ng,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Tb,H,t.trade)});return d(dm,u,fE(u),Uo,yr)}return d(dm,t,Lo,Uo,M([pa(f(OE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(qh,cb,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(dm,t,Lo,Uo,M([pa(f(sl,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(hC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(pC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=_m(e.terms);if("Ok"===r.$){var n=r.a;return L(f(Ib,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(sl,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(pE),n))}(l(HC,q.blockNumber,Y,r))}return d(gE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?fE(u):Lo;return d(dm,u,_,Uo,f(oo,f(xa,pa,KC(M([X]))),o));case"ExpandPhase":var te=e.a;return DE(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return DE(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return DE(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(dm,t,Lo,Uo,M([da(Vv(C.parameters.initiatorAddress))]))}return d(dm,t,Lo,Uo,M([pa(f(sl,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return DE(D(t,{txChainStatus:si(f(AE,E,ie))}));case"AbortAction":return DE(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(aE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=tl(l(ih,eh(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(EE)};return f(Ko,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(Xu,i,Vl(fb(C.parameters))),ba)?L(si(CE),n):l(aE,C,E.address,E.commPubkey)}return L(si(CE),n)}(),T=oe.a,w=oe.b;return d(dm,D(t,{txChainStatus:T}),Lo,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,RE)||R(ue,$E)){var se=LE(ue),ce=t;e=se,t=ce;continue e}return DE(D(t,{txChainStatus:si(IE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Uo,M([pa(f(sl,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=tl(Cm(n.creationInfo.address));return x(si(mE($E)),f(Ko,QC($E),a),yr);case"Claim":var a=tl(mm(n.creationInfo.address));return x(si(mE(TE)),f(Ko,QC(TE),a),yr);case"Abort":var a=tl(vm(n.creationInfo.address));return x(si(mE(vE)),f(Ko,QC(vE),a),yr);case"Release":var a=tl(Em(n.creationInfo.address));return x(si(mE(_E)),f(Ko,QC(_E),a),yr);case"Burn":var a=tl(ym(n.creationInfo.address));return x(si(mE(SE)),f(Ko,QC(SE),a),yr);default:var a=tl(jf(n.creationInfo.address));return x(si(mE(RE)),f(Ko,QC(RE),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(dm,D(t,{txChainStatus:T}),Lo,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return DE(D(t,{txChainStatus:si(bE(he))}))}var V=de.a;return d(dm,D(t,{txChainStatus:ci}),Lo,Uo,M([pa(f(_g,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return DE(D(t,{txChainStatus:si(wE(he))}))}var V=de.a;return d(dm,D(t,{txChainStatus:ci}),Lo,Uo,M([pa(f(_g,"commit",V))]));case"CommitMined":return DE(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return DE(D(t,{txChainStatus:si(f(yE,ue,he))}))}var V=de.a;return d(dm,D(t,{txChainStatus:ci}),Lo,Uo,M([pa(f(_g,PE(ue),V))]));case"ActionMined":var ue=e.a;return DE(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(bS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(dm,D(t,{eventSentry:ve}),_,Uo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(YC,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?fE(t):Lo,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(XC(f(cC,r,a)),ci)}return L(Lo,si(f(sl,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Lo,ci)}(),Te=Se.a,we=Se.b;return d(dm,Ee,_o(M([s,Te])),Uo,U(f(Qi,pE,Ce.appCmds),f($c,yr,f(Io,TS,f(Io,pa,we)))))}return d(dm,t,Lo,Uo,M([pa(f(sl,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Gh,sC,oC(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(wo,p,E.address);if("Nothing"===Ne.$)return d(dm,t,Lo,Uo,M([pa(f(sl,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return tl("Initiator"===Re.$?f(bm,p.creationInfo.address,ke):f(Sm,p.creationInfo.address,ke))}();return d(dm,t,Lo,f(Ko,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(dm,t,Lo,Uo,M([pa(f(sl,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(dm,t,Lo,Uo,M([pa(f(sl,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return DE(t)}var V=e.a.a;return d(dm,t,Lo,Uo,M([pa(f(Rg,"message",V))]));default:return d(dm,t,Lo,Uo,M([ga]))}}),IS=r(function(e,t){return{address:e,blocknum:t}}),AS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},BS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(ES,!0,e,t,r))}),kS=n(function(e,t,r){var n=function(e){return r(f(qh,Hm,e).returnData)},a={address:t.address,fromBlock:hS(t.blocknum),toBlock:hS(t.blocknum),topics:M([si(sb("Initiated(string,string)"))])};return l(BS,n,e,a)}),NS=function(e){return{data:si(f(Hf,"numTrades()",yr)),decoder:hu(Vh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},RS=r(function(e,t){return f(Jp,t,f(Up,Wh(e),NS(Zd(e))))}),$S=function(e){return{data:si(f(Hf,"phase()",yr)),decoder:hu(Vh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},_S=n(function(e,t,r){return f(Jp,r,f(Vp,Wb,f(Up,Wh(e),$S(t))))}),LS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),xS=r(function(e,t){return l(La,LS(e),yr,t)}),PS=function(e){return f(xS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},DS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},US=function(e){return f(DS,Ja(hb),Sa(e.trades))},OS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:US(e),loaded:Ti(PS(e))})})},MS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),FS=r(function(e,t){var r=f(Jc,e,t.trades);if("Just"===r.$){var n=(r.a,l(tf,e,hb,t.trades));return l(MS,OS(D(t,{trades:n})),Lo,yr)}return l(MS,t,Lo,M([pa(f(sl,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),VS=n(function(e,t,r){var n=f(Jc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Eb,t,a),o=l(tf,e,i,r.trades);return L(OS(D(r,{trades:o})),yr)}return L(r,M([f(sl,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),KS=n(function(e,t,r){var n=f(Jc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Sb,t,a),o=l(tf,e,i,r.trades);return l(MS,OS(D(r,{trades:o})),Lo,yr)}return l(MS,r,Lo,M([pa(f(sl,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),HS=n(function(e,t,r){var n=f(Jc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(tf,e,pm(D(a,{state:D(i,{phase:t})})),r.trades);return l(MS,OS(D(r,{trades:o})),Lo,yr)}return l(MS,r,Lo,M([pa(f(sl,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(MS,r,Lo,M([pa(f(sl,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),jS=n(function(e,t,r){var n=f(Jc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Tb,t,a),o=l(tf,e,i,r.trades);return l(MS,OS(D(r,{trades:o})),Lo,yr)}return l(MS,r,Lo,M([pa(f(sl,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),qS=n(function(e,t,r){var n=f(Jc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(wb,t,a),o=l(tf,e,i,r.trades);return l(MS,OS(D(r,{trades:o})),Lo,yr)}return l(MS,r,Lo,M([pa(f(sl,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Jc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Ib,t,a),o=l(tf,e,i,r.trades);return l(MS,OS(D(r,{trades:o})),Lo,yr)}return l(MS,r,Lo,M([pa(f(sl,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),zS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),YS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),WS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),JS=function(e){return{$:"NumTradesFetchedAgain",a:e}},QS=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),XS=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),ZS=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),eT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),tT=function(e){return l(MS,e,Lo,yr)},rT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=tC(n),i=aC(f(xa,Vy(t.factory),f(Ai,0,a-1))),o=_o(f(xa,function(e){return l(Xy,t.factory,Ku(e),zS(e))},f(Ai,0,a-1)));return l(MS,D(t,{dataFetchState:l(YS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(MS,t,Lo,M([pa(f(Ng,"Factory numTrades",u))]));case"CheckForNewTrades":return l(MS,t,f(RS,t.factory,JS),yr);case"UpdateTradePhases":var s=_o(KC(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(_S,e.factory,e.creationInfo.address,f(XS,e.factory,e.id)))},PS(t))));return l(MS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(HS,d,p,t),v=function(){var e=L(p,f(Jc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=AS(r);if("Just"===n.$){var a=n.a;return L(l(Zb,c,a.address,eT(d)),yr)}return L(Lo,M([pa(f(sl,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Lo,yr)}e.b;return L(Lo,M([pa(f(sl,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(MS,g.tradeCache,_o(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(MS,t,Lo,M([pa(f(OE,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=tC(n);if(_(C,E)<0){var S=t.dataFetchState,o=_o(f(xa,function(e){return l(Xy,t.factory,Ku(e),zS(e))},f(Ai,C,E-1))),T=aC(f(xa,Vy(t.factory),f(Ai,C,E-1)));return l(MS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(FC,t.trades,T)}),o,yr)}return tT(t)}b.b;return l(MS,t,Lo,M([pa(f(sl,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(MS,t,Lo,M([pa(f(Ng,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(IS,w.address_,tC(w.blocknum)),A=l(kS,t.eventSentry,I,WS(d)),B=A.a,k=A.b,y=_o(M([h(eC,t.factory,I.address,QS(d),eT(d),ZS(d)),k])),N=l(VS,d,I,t),R=N.a,$=N.b;return l(MS,OS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(MS,t,Lo,M([pa(f(Ng,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(MS,t,Lo,M([pa(f(Ng,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(KS,d,P,t)}var U=r.a.a;return l(MS,t,Lo,M([pa(f(sl,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(qS,d,O,t)}return l(MS,t,Lo,M([pa(f(OE,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(jS,d,F,t)}return l(MS,t,Lo,M([pa(f(OE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=_m(V.terms);if("Ok"===K.$){var H=K.a;return l(GS,d,H,t)}var j=K.a;return f(FS,d,t)}var j=r.a;return l(MS,t,Lo,M([pa(f(sl,"Error decoding initiated event",j))]));default:var q=e.a,G=f(bS,q,t.eventSentry),z=G.a,y=G.b;return l(MS,D(t,{eventSentry:z}),y,yr)}}),nT=function(e){return{$:"AgentHistoryMsg",a:e}},aT=function(e){return{$:"AppCmd",a:e}},iT={$:"BetaLandingPage"},oT={$:"ConnectToWeb3"},uT=function(e){return{$:"MarketplaceMsg",a:e}},sT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),cT=r(function(e,t){return f(kn,e,fl(t))}),fT=function(e){return f(cT,"href",tt(e))},lT=Nn("rel"),dT=cT("target"),hT=function(e){return{$:"Height",a:e}},pT=hT,gT={$:"Content"},vT=gT,yT=function(e){return{$:"Width",a:e}},mT=yT,bT=function(e){return{$:"Attr",a:e}},CT=function(e){return{$:"NodeName",a:e}},ET=function(e){return{$:"Unkeyed",a:e}},ST={$:"AsEl"},TT=ST,wT=r(function(e,t){return{$:"Field",a:e,b:t}}),IT=f(wT,0,0),AT={$:"NoNearbyChildren"},BT={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"},kT=BT.any+" "+BT.column,NT=BT.any+" "+BT.grid,RT=BT.any+" "+BT.page,$T=BT.any+" "+BT.paragraph,_T=BT.any+" "+BT.row,LT=BT.any+" "+BT.single,xT=function(e){switch(e.$){case"AsRow":return _T;case"AsColumn":return kT;case"AsEl":return LT;case"AsGrid":return NT;case"AsParagraph":return $T;default:return RT}},PT=function(e){return{$:"Keyed",a:e}},DT={$:"NoStyleSheet"},UT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),OT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),MT={$:"AsParagraph"},FT=MT,VT=Sn("div"),KT=Sn("p"),HT=Sn("s"),jT=Sn("u"),qT=cT("className"),GT=function(e){return wn(Xe(e))},zT=function(e){return Sn(Xe(e))},YT=function(e){return{$:"Flag",a:e}},WT=function(e){return{$:"Second",a:e}},JT=function(e){return e>31?WT(1< .ctr > ."+BT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",Qw="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+mw(BT.any)+mw(BT.row)+" > "+mw(BT.any)+" { flex-basis: auto !important; } "+mw(BT.any)+mw(BT.row)+" > "+mw(BT.any)+mw(BT.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"+Jw,Xw=function(e){return{$:"Intermediate",a:e}},Zw=r(function(e,t){return Xw({closing:t,others:yr,props:yr,selector:e})}),eI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,Xw({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(eI,f(Zw,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(eI,f(Zw,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(eI,f(Zw,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(eI,f(Zw,n.selector,""),v),t.others)})}});return Xw(l(La,a,n,t))}),tI=U(Qw,function(e){var t=function(e){return yd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),yd(f(xa,a,t.others)))};return yd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(eI,f(Zw,r,""),n),t)}),yr,e)))}(U(zw,Ww))),rI=l(zT,"style",yr,M([Cw(tI)])),nI=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+'"'}},aI=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}},iI=function(e){if("FontWith"===e.$){var t=e.a;return f(yh,aI,t.variants)}return!1},oI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),uI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),sI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(uI,"."+e+"."+t+", ."+e+" ."+t,n),f(uI,"."+e+"."+t+"> ."+BT.text+", ."+e+" ."+t+" > ."+BT.text,a)])}),cI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(sI,i,BT.sizeByCapital,a),l(sI,i,BT.fullSize,n)))}),fI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(uI,"."+r+"."+BT.sizeByCapital+", ."+r+" ."+BT.sizeByCapital,M([L("line-height","1")])),f(uI,"."+r+"."+BT.sizeByCapital+"> ."+BT.text+", ."+r+" ."+BT.sizeByCapital+" > ."+BT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),lI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},dI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Cc,t,r))}return ci},hI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),pI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f($c,e.descender,dI(t)),n=f($c,e.baseline,dI(f(gl,function(e){return!R(e,r)},t))),a=f($c,e.capital,lI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(hI,i,a-n,o),full:l(hI,u,a-r,s)}},gI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",gw(e.height)),L("vertical-align",gw(e.vertical)+"em"),L("font-size",gw(e.size)+"em")]))},vI=function(e){return l(Ra,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 si(L(gI(function(e){return e.full}(pI(a))),gI(function(e){return e.capital}(pI(a)))))}return t}return t}),ci,e)},yI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(xS,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=vI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,fI(t),n));var i=a.a;return f(Ri,"",f(xa,f(cI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},mI=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+'" '+Ni(r)}},bI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,mI,t.variants)))}return ci},CI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},EI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+gw(r)+"px, "+gw(n)+"px, "+gw(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("+gw(o)+"px, "+gw(u)+"px, "+gw(s)+"px)",b="scale3d("+gw(f)+", "+gw(l)+", "+gw(d)+")",C="rotate3d("+gw(p)+", "+gw(g)+", "+gw(v)+", "+gw(y)+"rad)";return si(m+" "+b+" "+C)}},SI=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,oI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,oI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,oI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,oI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+BT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+BT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+BT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,oI(!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,M([f(hw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Cc,1,1-c));return l(a,t,"."+u,M([f(hw,"opacity",gw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(hw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(xS,bI,p)),v=M([f(hw,"font-family",f(Ri,", ",f(xa,nI,p))),f(hw,"font-feature-settings",g),f(hw,"font-variant",f(yh,iI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(hw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(hw,s,vw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+BT.row,A="."+(BT.wrapped+I),B="."+BT.alignRight,k="."+BT.paragraph,N="."+BT.page,R="."+BT.alignLeft,$=gw(S/2)+"px",_=gw(E/2)+"px",x="."+BT.column,y="."+C,P="."+BT.any;return yd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(hw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(hw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(hw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(hw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(hw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(hw,"margin-left",w)])),l(a,t,U(y,k),M([f(hw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(hw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(hw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(hw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(hw,"content","''"),f(hw,"display","block"),f(hw,"height","0"),f(hw,"width","0"),f(hw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(hw,"content","''"),f(hw,"display","block"),f(hw,"height","0"),f(hw,"width","0"),f(hw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(hw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(hw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,sw,F.rows))+"-cols-"+f(Ri,"-",f(xa,sw,F.columns))+"-space-x-"+sw(F.spacing.a)+"-space-y-"+sw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=EI(ne),y=fw(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,M([f(hw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=CI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(yI(s),c)}),TI=r(function(e,t){return l(zT,"style",yr,M([Cw(f(SI,e,t))]))}),wI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",rI),f(ka,L("dynamic-stylesheet",f(TI,t,l(Ra,dw,L(im,M([bw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(TI,t,l(Ra,dw,L(im,M([bw(t.focus)])),r).b)),n)}),II=a(function(e,t,r,n){return e?f(ka,rI,f(ka,f(TI,t,l(Ra,dw,L(im,M([bw(t.focus)])),r).b),n)):f(ka,f(TI,t,l(Ra,dw,L(im,M([bw(t.focus)])),r).b),n)}),AI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(GT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(wI,!1,e,t,r);default:var e=i.a,t=i.b;return d(wI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return VT;case"p":return KT;default:return zT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(II,!1,e,t,n);default:var e=i.a,t=i.b;return d(II,!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(zT,e,n,M([f(u,r,M([qT(BT.any+" "+BT.single)]))]))}}();switch(o.$){case"AsRow":return f(nw,iw,e)&&!f(nw,aw,e)?s:f(nw,XT,e)?f(jT,M([qT(f(Ri," ",M([BT.any,BT.single,BT.container,BT.contentCenterY,BT.alignContainerRight])))]),M([s])):f(nw,ZT,e)?f(HT,M([qT(f(Ri," ",M([BT.any,BT.single,BT.container,BT.contentCenterY,BT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(nw,rw,e)&&!f(nw,tw,e)?s:f(nw,ew,e)?f(HT,M([qT(f(Ri," ",M([BT.any,BT.single,BT.container,BT.alignContainerCenterY])))]),M([s])):f(nw,QT,e)?f(jT,M([qT(f(Ri," ",M([BT.any,BT.single,BT.container,BT.alignContainerBottom])))]),M([s])):s;default:return s}}),BI=Cw,kI=function(e){return f(VT,M([qT(f(Ri," ",M([BT.any,BT.text,BT.widthContent,BT.heightContent])))]),M([BI(e)]))},NI=function(e){return l(zT,"div",M([qT(f(Ri," ",M([BT.any,BT.text,BT.widthFill,BT.heightFill])))]),M([Cw(e)]))},RI=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 R(e,FT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,FT),L(f(ka,L(n,f(s.html,DT,e)),i),Su(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,TT)?NI(c):kI(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 R(e,FT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,FT),L(f(ka,f(o.html,DT,e),n),Su(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,TT)?NI(u):kI(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Su(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(AI,n.has,n.node,n.attributes,PT(l(OT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(AI,n.has,n.node,n.attributes,PT(l(OT,"nearby-element-pls",s,n.children)),DT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Su(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(AI,n.has,n.node,n.attributes,ET(f(UT,m,n.children))),styles:g})}return Gi(h(AI,n.has,n.node,n.attributes,ET(f(UT,m,n.children)),DT))}),$I=r(function(e,t){return f(Nn,Ze(e),rt(t))}),_I=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(wT,a|r,n)}var i=e.a;return f(wT,r,i|n)}),LI=JT(7),xI=JT(36),PI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(wT,r|a,n|i)}),DI=JT(6),UI=JT(38),OI=JT(30),MI=JT(29),FI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),VI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),KI=function(e){return{$:"Transform",a:e}},HI=function(e){return{$:"ChildrenBehind",a:e}},jI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),qI=function(e){return{$:"ChildrenInFront",a:e}},GI=r(function(e,t){return f(VT,M([qT(function(){switch(e.$){case"Above":return f(Ri," ",M([BT.nearby,BT.single,BT.above]));case"Below":return f(Ri," ",M([BT.nearby,BT.single,BT.below]));case"OnRight":return f(Ri," ",M([BT.nearby,BT.single,BT.onRight]));case"OnLeft":return f(Ri," ",M([BT.nearby,BT.single,BT.onLeft]));case"InFront":return f(Ri," ",M([BT.nearby,BT.single,BT.inFront]));default:return f(Ri," ",M([BT.nearby,BT.single,BT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Cw("");case"Text":var e=t.a;return kI(e);case"Unstyled":return(0,t.a)(TT);default:return f(t.a.html,DT,TT)}}()]))}),zI=n(function(e,t,r){var n=f(GI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?HI(M([n])):qI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?HI(f(ka,n,a)):f(jI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(jI,M([n]),i):qI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(jI,f(ka,n,a),i):f(jI,a,f(ka,n,i))}}),YI=r(function(e,t){switch(t.$){case"Generic":return CT(e);case"NodeName":var r=t.a;return f(FI,r,e);default:var n=t.a,a=t.b;return f(FI,n,a)}}),WI=function(e){switch(e.$){case"Left":return BT.alignedHorizontally+" "+BT.alignLeft;case"Right":return BT.alignedHorizontally+" "+BT.alignRight;default:return BT.alignedHorizontally+" "+BT.alignCenterX}},JI=function(e){switch(e.$){case"Top":return BT.alignedVertically+" "+BT.alignTop;case"Bottom":return BT.alignedVertically+" "+BT.alignBottom;default:return BT.alignedVertically+" "+BT.alignCenterY}},QI=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),XI=function(e){return{$:"Moved",a:e}},ZI=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return XI(x(r,0,0));case"MoveY":var n=t.a;return XI(x(0,n,0));case"MoveZ":var a=t.a;return XI(x(0,0,a));case"MoveXYZ":var i=t.a;return XI(i);case"Rotate":var i=t.a,o=t.b;return d(QI,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(QI,x(0,0,0),i,x(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 XI(x(s,n,a));case"MoveY":var c=t.a;return XI(x(r,c,a));case"MoveZ":var f=t.a;return XI(x(r,n,f));case"MoveXYZ":var i=t.a;return XI(i);case"Rotate":var i=t.a,o=t.b;return d(QI,u,x(1,1,1),i,o);default:var l=t.a;return d(QI,u,l,x(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(QI,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(QI,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(QI,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(QI,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(QI,u,h,v,y);default:var m=t.a;return d(QI,u,m,p,o)}}}),eA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(IT,n,M([l(VI,n,"height",r+"px")]));case"Content":return x(f(_I,xI,IT),BT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(_I,rw,IT),BT.heightFill,yr):x(f(_I,rw,IT),BT.heightFillPortion+" height-fill-"+Ni(a),M([l(VI,BT.any+"."+BT.row+" > "+mw("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(VI,u,"min-height",Ni(i)+"px"),c=eA(o),d=c.a,h=c.b,p=c.c;return x(f(_I,tw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(VI,u,"max-height",Ni(g)+"px"),v=eA(o),d=v.a,h=v.b,p=v.c;return x(f(_I,tw,d),u+" "+h,f(ka,s,p))}},tA=function(e){switch(e.$){case"Px":var t=e.a;return x(IT,BT.widthExact+" width-px-"+Ni(t),M([l(VI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(_I,UI,IT),BT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(_I,iw,IT),BT.widthFill,yr):x(f(_I,iw,IT),BT.widthFillPortion+" width-fill-"+Ni(r),M([l(VI,BT.any+"."+BT.row+" > "+mw("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(VI,i,"min-width",Ni(n)+"px"),u=tA(a),s=u.a,c=u.b,d=u.c;return x(f(_I,aw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(VI,i,"max-width",Ni(h)+"px"),p=tA(a),s=p.a,c=p.b,d=p.c;return x(f(_I,aw,s),i+" "+c,f(ka,o,d))}},rA=JT(27),nA=r(function(e,t){if(R(e,rA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),aA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=fw(n);if("Nothing"===s.$)return{attributes:f(ka,qT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,qT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,KI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(nw,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(_I,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(nw,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(nA,S,I)){var p=lw(I)+" "+e,g=t,v=f(_I,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=lw(I)+" "+e,g=t,v=f(_I,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(_I,S,r),y=f(ZI,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(nw,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=BT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(_I,DI,r),y=n,m=f(ka,l(VI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+BT.widthContent,g=t,v=f(_I,UI,f(_I,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+BT.widthFill,g=t,v=f(_I,iw,f(_I,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+BT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(_I,iw,f(_I,DI,r)),y=n,m=f(ka,l(VI,BT.any+"."+BT.row+" > "+mw("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=tA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(PI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(nw,LI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(_I,LI,r),y=n,m=f(ka,l(VI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=BT.heightContent+" "+e,g=t,v=f(_I,xI,f(_I,LI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=BT.heightFill+" "+e,g=t,v=f(_I,rw,f(_I,LI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+BT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(_I,rw,f(_I,LI,r)),y=n,m=f(ka,l(VI,BT.any+"."+BT.column+" > "+mw("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=eA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(PI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(YI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(YI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(YI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(YI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(YI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(YI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(YI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return CT("p");case"NodeName":var e=t.a;return CT(e);default:var r=t.a,n=t.b;return f(FI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f($I,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f($I,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f($I,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f($I,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(zI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(nw,OI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=WI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(_I,ZT,e);case"Right":return f(_I,XT,e);default:return e}}(f(_I,OI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(nw,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=JI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(_I,ew,e);case"Bottom":return f(_I,QT,e);default:return e}}(f(_I,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),iA={$:"Untransformed"},oA=iA,uA=a(function(e,t,r,n){return l(RI,e,n,v(aA,xT(e),t,IT,oA,yr,yr,AT,$a(r)))}),sA=function(e){return bT(qT(e))},cA=r(function(e,t){var r=t.url,n=t.label;return d(uA,TT,CT("a"),f(ka,bT(fT(r)),f(ka,bT(lT("noopener noreferrer")),f(ka,bT(dT("_blank")),f(ka,mT(vT),f(ka,pT(vT),f(ka,sA(BT.contentCenterX+" "+BT.contentCenterY),e)))))),ET(M([n])))}),fA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),lA=n(function(e,t,r){return d(fA,e,t,r,1)}),dA=JT(14),hA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),pA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),gA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return cw(t)+"-"+cw(r)+"-"+cw(n)+"-"+cw(a)},vA=function(e){return f(pA,dA,l(hA,"fc-"+gA(e),"color",e))},yA={align:al,label:"cantConnectNoWeb3",mainParagraphs:M([M([ul("You need a web3 provider (such as "),f(cA,M([vA(l(lA,0,0,1))]),{label:ul("Metamask"),url:"https://metamask.io/"}),ul(") to Connect.")]),M([ul("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:$g},mA={align:al,label:"invalidUrl",mainParagraphs:M([M([ul("I don't understand that URL...")]),M([ul("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:kg},bA=function(e){return{$:"Active",a:e}},CA=du(f(jo,Vf,f(jo,Fh,kd("Error decoding hex to BigInt")))),EA=function(){return du(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),SA=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}}}}}}}}}}}},TA=function(e){return YE(M([f(Oi,si,e),Fi(ci)]))},wA=f(ch,TA(f(Ph,"status",EA)),f(ch,TA(f(Ph,"root",lu)),l(XE,"logsBloom",lu,l(XE,"logs",$m(cS),f(ch,TA(f(Ph,"contractAddress",ZE)),l(XE,"cumulativeGasUsed",CA,l(XE,"gasUsed",CA,l(XE,"blockNumber",Hy,l(XE,"blockHash",nS,l(XE,"transactionIndex",Hy,l(XE,"transactionHash",oS,Fi(SA)))))))))))),IA=function(e){var t=e.a;return Vf(t)},AA=f(jo,IA,fl),BA=r(function(e,t){return xp({decoder:wA,method:"eth_getTransactionReceipt",params:M([AA(t)]),url:e})}),kA=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),NA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),RA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),$A=r(function(e,t){return f(Io,function(e){return e.toMsg},f(To,function(e){return e.b},f(To,function(e){return e.onMinedTagger},f(up,t,e))))}),_A=function(e){return function(t){return function(r){return function(n){return function(a){return function(i){return function(o){return function(u){return function(s){return function(c){return function(f){return{blockHash:r,blockNumber:n,from:i,gas:c,gasPrice:s,hash:e,input:f,nonce:t,to:o,transactionIndex:a,value:u}}}}}}}}}}}},LA=function(e){return YE(M([zE(ci),f(Oi,si,e)]))},xA=l(XE,"input",lu,l(XE,"gas",Hy,l(XE,"gasPrice",CA,l(XE,"value",CA,l(XE,"to",LA(ZE),l(XE,"from",ZE,l(XE,"transactionIndex",Hy,l(XE,"blockNumber",LA(Hy),l(XE,"blockHash",function(e){return f(cu,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},ou(t))?Fi(ci):f(Oi,si,e)},lu)}(nS),l(XE,"nonce",Hy,l(XE,"hash",oS,Fi(_A)))))))))))),PA=r(function(e,t){return xp({decoder:xA,method:"eth_getTransactionByHash",params:M([AA(t)]),url:e})}),DA=r(function(e,t){return{attempts:e,sleep:t}}),UA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Wp,function(e){return a>0?f(Mp,function(e){return f(UA,f(DA,a,n),t)},qE(1e3*n)):Rp(e)},t)}),OA=r(function(e,t){return f(Mp,function(r){return f(UA,{attempts:30,sleep:1},f(PA,e,t))},qE(250))}),MA=r(function(e,t){return f(UA,{attempts:60,sleep:5},f(BA,e,t))}),FA=function(e){return{$:"Mined",a:e}},VA=function(e){return Io(function(t){return D(t,{status:FA(e)})})},KA=function(e){return{$:"Sent",a:e}},HA=function(e){return Io(function(t){return D(t,{status:KA(e)})})},jA=function(e){return{$:"Signed",a:e}},qA=function(e){return Io(function(t){return D(t,{status:jA(e)})})},GA=function(e){return"Nothing"!==e.$},zA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Cl(r),Lo);case"TxSigned":var n=e.a,a=e.b,i=f(up,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(qg,t,$p(a))}return Lo}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Lo;if("Just"===t.b.$){var r=t.b.a;return f(qg,r,$p(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(qg,a,$p(fi(e)))}t.a,t.b,t.c;return Lo};if("Ok"===a.$){var c=a.a,d=GA(o.onBroadcastTagger)||GA(o.onMinedTagger)?f(rl,r.tagger,f(Jp,RA(n),f(OA,r.nodePath,c))):Lo;return L(Cl(D(r,{txs:l(vp,n,qA(c),r.txs)})),_o(M([u,d])))}var h=a.a;return L(Cl(r),_o(M([u,s(h)])))}return L(Cl(r),Lo);case"TxSent":var n=e.a,p=e.b,g=f(up,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(rl,r.tagger,f(Jp,NA(n),f(MA,r.nodePath,v.hash))):Lo}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(qg,t,$p(li(v)))}return Lo}();return L(Cl(D(r,{txs:l(vp,n,HA(v),r.txs)})),_o(M([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(qg,t,$p(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(qg,n,$p(fi("Error with TxSent stuff")))}e.a,e.b;return Lo}();return L(Cl(r),s)}return L(Cl(r),Lo);case"TxMined":var n=e.a,m=e.b,b=f(up,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(qg,a,$p(li(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 _o(M([f(rl,r.tagger,f(Jp,f(kA,n,s),jy(r.nodePath))),f(qg,a,$p(li(C))),f(qg,u.toMsg,$p(s))]))}return Lo}();return L(Cl(D(r,{txs:l(vp,n,VA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(qg,r,$p(fi("TxReceipt decoding failure")))}return Lo}();return L(Cl(r),S)}return L(Cl(r),Lo);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f($A,r.txs,n);if("Just"===A.$){var B=A.a;return L(Cl(r),f(qg,B,f(Wp,function(e){return $p(D(I,{doneWatching:!0,reOrg:!0}))},f(Mp,function(e){return $p(D(I,{doneWatching:!0}))},f(BA,r.nodePath,T.txHash)))))}return L(Cl(r),Lo)}if(R(w,T.lastCheckedBlock))return L(Cl(r),f(rl,r.tagger,f(Jp,f(kA,n,T),f(Mp,function(e){return jy(r.nodePath)},qE(2e3)))));var k=f($A,r.txs,n);if("Just"===k.$){var B=k.a;return L(Cl(r),_o(M([f(rl,r.tagger,f(Jp,f(kA,n,I),f(Mp,function(e){return jy(r.nodePath)},qE(2e3)))),f(qg,B,$p(I))])))}return L(Cl(r),Lo)}var n=e.a,h=e.c.a;return L(Cl(r),Lo);default:var h=e.a;return L(Cl(r),Lo)}}),YA=Jt,WA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),JA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),QA=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(JA,"#",e.fragment,l(JA,"?",e.query,U(f(WA,e.port_,U(t,e.host)),e.path)))},XA=r(function(e,t){return e<0?ci:Yl(f(ed,e,t))}),ZA=r(function(e,t){if(e<0)return t;var r=wh(f(ed,e,t)),n=f(sc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),eB=n(function(e,t,r){if(e<0)return r;var n=f(ed,e,r),a=f(sc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),tB=r(function(e,t){return f(eB,e,gs(t))}),rB=r(function(e,t){Mv(t);switch(t.$){case"Home":return L(D(e,{submodel:iT}),Lo);case"Create":var r=Wd(e.wallet),n=f(xl,e.txSentry,f(qo,xy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(aB,U(f(Qi,xy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Ly(r.model),txSentry:a}),_o(M([f(rl,xy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(wy,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(gm,e.wallet,r)}return l(hm,e.wallet,u,s)}(),c=f(xl,e.txSentry,f(qo,Uy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(aB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),_o(M([f(rl,Uy,r.cmd),i]))));case"Marketplace":var d=wv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Py(h)}),_o(M([f(rl,uT,p)])));case"AgentHistory":var g=t.a,v=f(xo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:_y(y)}),_o(M([f(rl,nT,m)])));default:return L(f(uo,mA,e),Lo)}}),nB=r(function(e,t){var r=t.a,n=t.b,a=f(iB,aT(e),r),i=a.a,o=a.b;return L(i,_o(M([n,o])))}),aB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,nB,L(r,n),e)}),iB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(iB,oT,t);case"GotoRoute":var n=r.a;return L(t,f(yy,t.key,n));case"GTag":var a=r.a;return L(t,Ey(by(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),Ey(by(d(Pl,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(xv,Iy,o,u,s));default:return L(t,Ay(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(ZA,c,t.userNotices)}),Lo);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(vy,t.key,QA(e))}var r=h.a;return YA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(oB,g,t);case"GotoRoute":var v=e.a;return L(t,_o(M([Ey(by(d(Pl,"GotoRoute","navigation",Mv(v),0))),f(yy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Lo);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,yA,t),Lo):L(t,my(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Lo;var t=e.a;return Sy(f(Cy,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Hh,lu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=bA(l(Dl,I,w,S)),B=f(Oy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(sl,"Unexpected wallet state encounted when setting commPubkey!",ci),t),Lo)}T.a;return L(f(uo,f(sl,"User pubkey set, but I can no longer find the user address!",ci),t),Lo)}var N=E.a;return L(l(Pa,uo,f(sl,"error decoding commPubkey from JS",N),t),Lo);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(sv,R,_),P=f(xl,t.txSentry,f(qo,xy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(aB,U(f(Qi,xy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Ly(x.model),txSentry:O}),_o(M([f(rl,xy,x.cmd),F]))))}return L(t,Lo);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(wS,K,j),q=f(xl,t.txSentry,f(qo,Uy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(aB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),_o(M([f(rl,Uy,x.cmd),F]))))}return L(t,Lo);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Lv,G,Y);return f(aB,f(Qi,uT,x.appCmds),L(D(t,{submodel:Py(x.model)}),f(rl,uT,x.cmd)))}return L(t,Lo);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(nl,W,Q),X=f(xl,t.txSentry,f(qo,nT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(aB,U(f(Qi,nT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:_y(x.model),txSentry:O}),_o(M([f(rl,nT,x.cmd),F]))))}return L(t,Lo);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(Nu,si,f(zA,Z,r))}return L(ci,Lo)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(XA,re,t.tradeCaches);if("Nothing"===ae.$)return f(nB,pa(f(sl,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Lo));var ie=ae.a,x=f(rT,ne,ie);return L(D(t,{tradeCaches:l(tB,re,x.tradeCache,t.tradeCaches)}),f(rl,sT(re),x.cmd));case"NoOp":return L(t,Lo);default:var N=e.a;f(ol,"test",N);return L(t,Lo)}}),oB=r(function(e,t){return f(rB,t,gy(e))}),uB=Ge("txIn",WE),sB=je("txOut",Ua),cB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},fB=function(e){return{$:"EventSentryMsg",a:e}},lB=function(e){var t=f(om,fB,Wh(e)),r=t.a,n=t.b;return x({dataFetchState:l(YS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Jd,"tradeCache init","processing",cB(e),0)]))},dB=function(e){return{$:"InitialNumTradesFetched",a:e}},hB=function(e){return f(RS,e.factory,dB)},pB=function(e){var t=lB(e),r=t.a,n=t.b,a=t.c;return x(r,_o(M([n,hB(r)])),a)},gB=function(e){return{$:"TxSentryMsg",a:e}},vB={align:al,label:"noWeb3Provider",mainParagraphs:M([M([ul("No web3 provider detected. Is "),f(cA,M([vA(l(lA,0,0,1))]),{label:ul("Metamask"),url:"https://metamask.io/"}),ul(" or some other web3 provider installed and unlocked?")])]),noticeType:$g},yB={$:"TopLeft"},mB={align:yB,label:"screenToSmall",mainParagraphs:M([M([ul("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:$g},bB={align:al,label:"wrongWeb3Network",mainParagraphs:M([M([ul("Make sure your wallet is set to a compatible network.")]),M([ul(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:kg},CB={$:"NoneDetected"},EB=function(e){return{$:"OnlyNetwork",a:e}},SB=function(e){return f(Io,Wh,Dg(e))},TB={$:"ETCMain"},wB={$:"ETCTest"},IB={$:"Expanse"},AB={$:"Kovan"},BB={$:"Mainnet"},kB=function(e){return{$:"Private",a:e}},NB={$:"Rinkeby"},RB={$:"Ropsten"},$B={$:"RskMain"},_B={$:"RskTest"},LB=function(e){switch(e){case 1:return BB;case 2:return IB;case 3:return RB;case 4:return NB;case 30:return $B;case 31:return _B;case 42:return AB;case 41:return TB;case 62:return wB;default:return kB(e)}},xB=n(function(e,t,r){var n=e.a,a=e.b;return Cl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:op})}),PB=n(function(e,t,n){var a=e.networkId?EB(LB(e.networkId)):CB,i=f(Io,function(e){return l(xB,L(sB,uB),gB,e)},SB(a)),o=e.width<1024?si(mB):ci,u=f(xa,pB,ro),s=function(){return R(a,CB)?si(vB):"Nothing"===Dg(a).$?si(bB):ci}(),c=KC(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ty(f(Bi,r(function(e,t){return f(Qi,sT(e),t)}),g)),y=_o(f(Bi,r(function(e,t){return f(rl,sT(e),t)}),p)),m=f(aB,v,f(oB,t,{key:n,screenWidth:e.width,submodel:iT,time:Ol(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),_o(M([y,C])))}),DB=Oe,UB=DB(yr),OB=function(e){return UB},MB=function(e){return{$:"Refresh",a:e}},FB=r(function(e,t){return{$:"Every",a:e,b:t}}),VB=r(function(e,t){return{processes:t,taggers:e}}),KB=$p(f(VB,op,op)),HB=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(vS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),jB=Ne,qB=r(function(e,t){var r=e.a,n=e.b,a=f(up,r,t);if("Nothing"===a.$)return l($l,r,M([n]),t);var i=a.a;return l($l,r,f(ka,n,i),t)}),GB=Be,zB=r(function(e,t){return{$:"Zone",a:e,b:t}}),YB=ca,WB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=GB(f(YB,n,f(bp,e,n)));return f(Mp,function(t){return l(WB,e,a,l($l,n,t,r))},i)}return $p(r)}),JB=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 x(n,a,f(Mp,function(e){return i},jB(t)))}),u=l(Ra,qB,op,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l($l,e,r,i),o)}),d=p(HB,s,c,o,u,i,x(yr,op,$p(gr))),h=d.a,g=d.b,v=d.c;return f(Mp,function(e){return $p(f(VB,u,e))},f(Mp,function(t){return l(WB,e,h,g)},v))}),QB=function(e){return we(function(t){t(Se(e(Date.now())))})}(Ol),XB=n(function(e,t,r){var n=f(up,t,r.taggers);if("Nothing"===n.$)return $p(r);var a=n.a,i=function(t){return Hp(f(xa,function(r){return f(mp,e,r(t))},a))};return f(Mp,function(e){return $p(r)},f(Mp,i,QB))}),ZB=r(function(e,t){var r=t.a,n=t.b;return f(FB,r,f(Da,e,n))});pn.Time=Pe(KB,JB,XB,0,ZB);var ek=Ue("Time"),tk=r(function(e,t){return ek(f(FB,e,t))}),rk=function(e){return f(tk,2e3,MB)},nk=function(e){return UB},ak=function(e){return{$:"DecryptionFinished",a:e}},ik=Ge("decryptionFinished",WE),ok=Ge("encryptionFinished",WE),uk=function(e){return{$:"EncryptionFinished",a:e}},sk=function(e){return{$:"Refresh",a:e}},ck=function(e){return DB(M([f(tk,3e3,sk),ok(uk),ik(function(e){return pE(ak(e))})]))},fk=yn,lk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return UB;case"CreateModel":t.a;return f(fk,xy,rk());case"TradeModel":t.a;return f(fk,Uy,ck());case"MarketplaceModel":t.a;return f(fk,uT,nk());default:t.a;return f(fk,nT,OB())}},dk=Ge("userPubkeyResult",WE),hk=Ge("walletSentryPort",WE),pk={$:"CheckForNewTrades"},gk={$:"UpdateTradePhases"},vk=function(e){return DB(M([f(tk,5e3,function(e){return pk}),f(tk,3e3,function(e){return gk})]))},yk=function(e){return{$:"Tick",a:e}},mk=function(e){return{$:"UserPubkeySet",a:e}},bk=function(e){return{$:"WalletStatus",a:e}},Ck=function(e){return f(sl,"Error decoding JS walletSentry: "+e,ci)},Ek=function(e){return{$:"ErrorDecoding",a:e}},Sk=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Tk=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Ph,"ref",jC),f(Ph,"txHash",TA(oS))),wk=function(e){var t=f(Hh,Tk,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Sk,r.ref,li(a))}return f(Sk,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return Ek("Error decoding tx data")},Ik=function(e){var t=e.a;return f(fk,t.tagger,t.inPort(wk))},Ak=f(Oi,LB,jC),Bk=du(f(jo,Zl,f(jo,kd("Failure decoding stringy int"),tu(LB)))),kk=YE(M([Bk,Ak])),Nk=r(function(e,t){return{account:e,networkId:t}}),Rk=l(Mi,Nk,f(Ph,"account",TA(ZE)),f(Ph,"networkId",kk)),$k=n(function(e,t,r){var n=f(Hh,Rk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),_k=function(e){var t=f(jo,Ck,f(jo,pa,aT));return DB(U(M([f(tk,1e3,yk),hk(f($k,t,bk)),f($c,UB,f(Io,Ik,e.txSentry)),dk(mk),DB(f(Bi,r(function(e,t){return f(fk,sT(e),t)}),f(xa,vk,e.tradeCaches)))]),M([lk(e)])))},Lk=function(e){return{$:"LinkClicked",a:e}},xk=function(e){return{$:"UrlChanged",a:e}},Pk=n(function(e,t,r){return d(fA,e/255,t/255,r/255,1)}),Dk=l(Pk,10,33,108),Uk={$:"Generic"},Ok=Uk,Mk=r(function(e,t){return d(uA,TT,Ok,f(ka,mT(vT),f(ka,pT(vT),e)),ET(M([t])))}),Fk=function(e){return{$:"Fill",a:e}},Vk=Fk(1),Kk=Hi,Hk=function(e){return{$:"Px",a:e}},jk=Hk,qk=JT(8),Gk=function(e){return f(pA,qk,l(hA,"bg-"+gA(e),"background-color",e))},zk=f(Mk,M([mT(Vk),pT(jk(150)),Gk(Dk)]),Kk),Yk=function(e){return{$:"GotoRoute",a:e}},Wk={$:"Active"},Jk={$:"Important"},Qk={$:"Normal"},Xk=l(lA,1,1,1),Zk=JT(2),eN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),tN=r(function(e,t){return R(e,t)?f(pA,Zk,h(eN,"p-"+Ni(e),e,e,e,e)):f(pA,Zk,h(eN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),rN=JT(21),nN=r(function(e,t){return{$:"Class",a:e,b:t}}),aN=f(nN,rN,BT.cursorPointer),iN=JT(17),oN=function(e){return f(pA,iN,l(VI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},uN=function(e){return{$:"Normal",a:e}},sN=An,cN=r(function(e,t){return f(sN,e,uN(t))}),fN=function(e){return f(cN,"click",Fi(e))},lN=f(Da,bT,fN),dN=JT(13),hN=f(nN,dN,BT.textSemiBold),pN=JT(4),gN=function(e){return{$:"FontSize",a:e}},vN=function(e){return f(pA,pN,gN(e))},yN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([oN(4),Gk(l(lA,0,0,1))]);default:return M([oN(4),Gk(l(lA,.9,0,0))])}}();return f(Mk,U(M([f(tN,23,12),vN(22),hN,vA(Xk),aN,lN(t)]),n),ul(e))}),mN=l(Pk,244,0,103),bN=function(e){return{$:"AlignX",a:e}},CN={$:"CenterX"},EN=bN(CN),SN=JT(3),TN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),wN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),IN=function(e){return f(pA,SN,l(TN,f(wN,e,e),e,e))},AN=function(e){return{$:"Describe",a:e}},BN={$:"Paragraph"},kN=r(function(e,t){return d(uA,FT,Ok,f(ka,AN(BN),f(ka,mT(Vk),f(ka,IN(5),e))),ET(t))}),NN=f(nN,dN,BT.bold),RN=f(Mk,M([vN(29),vA(Xk),NN,EN,aN,lN(Yk(Hv))]),f(kN,yr,M([ul("DAI"),f(Mk,M([vA(mN)]),ul("Hard"))]))),$N={$:"Right"},_N=bN($N),LN={$:"AsColumn"},xN=LN,PN=r(function(e,t){return d(uA,xN,Ok,f(ka,sA(BT.contentTop+" "+BT.contentLeft),f(ka,pT(vT),f(ka,mT(vT),e))),ET(t))}),DN={$:"AsRow"},UN=DN,ON=r(function(e,t){return d(uA,UN,Ok,f(ka,sA(BT.contentLeft+" "+BT.contentCenterY),f(ka,mT(vT),f(ka,pT(vT),e))),ET(t))}),MN=function(e){return f(ON,M([mT(Vk),IN(30),f(tN,30,17)]),M([l(yN,"Browse Offers",Yk(jv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Wk}return Qk}()),l(yN,"Create a New Offer",Yk(Kv),function(){return"CreateModel"===e.submodel.$?Wk:Qk}()),function(){var t=Hd(e.wallet);if("Just"===t.$){var r=t.a;return l(yN,"My Trades",Yk(Vv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Wk:Qk}return Qk}())}return l(yN,"Connect to Wallet",oT,Jk)}(),f(PN,M([_N,IN(0),f(tN,8,0)]),M([RN]))]))},FN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},VN=function(e){return gl(e)},KN=function(e){return f(gl,function(e){return db(e.parameters)},PS(e))},HN={$:"BurnWindow"},jN={$:"FiatPrice"},qN={$:"Margin"},GN={$:"Offer"},zN={$:"PaymentWindow"},YN=function(e){return{$:"AlignY",a:e}},WN={$:"CenterY"},JN=YN(WN),QN=JT(20),XN=f(nN,QN,BT.clip),ZN=Fk,eR=function(e){return f(pA,Zk,h(eN,"p-"+Ni(e),e,e,e,e))},tR=r(function(e,t){return f(Mk,M([mT(ZN(e)),pT(jk(60)),XN,Gk(Xk)]),f(Mk,M([eR(12),JN,mT(Vk)]),t))}),rR=function(e){switch(e.$){case"Phase":return 1;case"Expires":return 2;case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},nR=function(e){return{$:"JustImage",a:e}},aR=nR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),iR=cT("alt"),oR=function(e){return f(cT,"src",rt(e))},uR=r(function(e,t){var r=t.src,n=t.description,a=f(gl,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(uA,TT,Ok,f(ka,sA(BT.imageContainer),e),ET(M([d(uA,TT,CT("img"),U(M([bT(oR(r)),bT(iR(n))]),a),ET(yr))])))}),sR=r(function(e,t){if("None"===t.$)return Kk;var r=t.a;return f(uR,e,r)}),cR=nR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),fR=function(e){return{$:"ChangeSort",a:e}},lR=f(nN,dN,BT.textMedium),dR=function(e){return f(Mk,M([lR,vN(17)]),ul(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},hR=r(function(e,t){return f(ON,M([IN(5),aN,lN(fR(e))]),M([dR(e),function(){if("Just"===t.$){var e=t.a;return f(Mk,M([JN]),f(sR,M([mT(jk(8))]),function(){return"Ascending"===e.$?cR:aR}()))}return Kk}()]))}),pR=r(function(e,t){return f(tR,rR(t),f(hR,t,e))}),gR=r(function(e,t){return f(ON,M([mT(Vk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(pR,r,t)},t))}),vR=l(Pk,150,150,150),yR=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},mR=r(function(e,t){return f(Xu,e.amount,t.amount)}),bR=n(function(e,t,r){return f(e,r,t)}),CR=function(e){var t=e.a;return(R(e.b,Ro)?bR:Ua)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(CR,L(Tv,Ro),e,t):l(bR,Mu,yR(e.state.phase),yR(t.state.phase))});case"Expires":return r(function(e,t){return f(fv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(bv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(mR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f($c,ma,l(jd,r(function(e,t){return f(Mu,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(fv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(fv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},ER=l(Pk,233,237,242),SR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),TR=function(e){return f(Mk,M([mT(Vk),pT(Vk),XN]),f(kN,M([vN(12)]),M([ul(e.info)])))},wR=function(e){return f($c,Kk,f(Io,TR,Yl(e)))},IR=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"}},AR=function(e){return{$:"TimeLeft",a:e}},BR=function(e){return{$:"TimeUp",a:e}},kR=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 Ol(0)}}),NR=r(function(e,t){return Ol(Vd(e)-Vd(t))}),RR=r(function(e,t){var r=f(kR,t.state.phase,t),n=f(NR,e,t.state.phaseStartTime),a=f(NR,r,n);return Vd(a)>0?AR(L(a,r)):BR(r)}),$R=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},_R=l(lA,0,0,0),LR=l(Pk,51,183,2),xR=function(e){var t=Vu(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Yo(n));return n+(function(){if(a){return f(Zo,a+1,f(Jo,1,gw(r)))}return""}()+"%")},PR=r(function(e,t){return nR({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"}()})}),DR=n(function(e,t,r){return f(sR,f(ka,pT(jk(34)),e),f(PR,t,r))}),UR=r(function(e,t){var r=xR(t);if("0%"===r)return f(Mk,M([vN(16)]),ul("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?LR:mN;return f(ON,M([IN(4)]),M([l(DR,yr,a,si(i)),f(Mk,M([vA(o),vN(16)]),ul(n))]))}),OR=nR,MR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l($l,r,n,t)}),op,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,OR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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","₫")]))),FR=function(e){return f($c,"",f(Io,Qa,f(up,e,MR)))},VR=function(e){return Yo(e)<=3?e:VR(f(Cd,3,e))+","+f(nu,3,e)},KR=function(e){return VR(bd(e))},HR=function(e){return U(FR(e.fiatType),KR(e.amount))},jR=fA,qR=function(e){var t=function(){var t=f(up,e.fiatType,MR);if("Nothing"===t.$)return Kk;var r=t.a,n=(r.a,r.b);return f(sR,M([pT(jk(26))]),n)}();return f(ON,M([IN(4)]),M([t,f(Mk,M([vA(d(jR,0,0,0,.5)),lR,mT(jk(50))]),ul(e.fiatType)),ul(HR(e))]))},GR=function(e){return Vd(e)<0},zR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),YR=function(e){var t=hg(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(zR,tC(t),tC(r),tC(n),tC(a))}(f($c,L(Ku(0),Ku(0)),f(Cs,n,Ku(60))))}(f($c,L(Ku(0),Ku(0)),f(Cs,r,Ku(3600))))}(f($c,L(Ku(0),Ku(0)),f(Cs,t,Ku(86400))))},WR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!GR(a)){var u=r(function(e,t){return U(l(Bs,2,P("0"),Ni(e)),t)}),s=Vd(a)>0?i:o,c=YR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(ON,U(M([IN(5)]),e),M([f(Mk,U(M([vA(h)]),t),ul(f(u,c.days,"d"))),f(Mk,U(M([vA(d)]),t),ul(f(u,c.hours,"h"))),f(Mk,U(M([vA(s)]),t),ul(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Ol(0);e=p,t=g,n=v,a=y}}),JR={$:"Behind"},QR=r(function(e,t){return{$:"Nearby",a:e,b:t}}),XR=function(e){return f(QR,JR,e)},ZR=r(function(e,t){var r=iv(200*e),n=200-r,a=f(Mk,M([mT(ZN(n))]),Kk),i=M([pT(jk(3)),oN(20)]),o=f(Mk,U(i,M([mT(ZN(r)),Gk(t)])),Kk),u=f(Mk,U(i,M([mT(Vk),Gk(ER)])),Kk);return f(ON,M([mT(Vk),XR(u)]),M([o,a]))}),e$=l(lA,1,1,0),t$=r(function(e,t){return Vd(e)/Vd(t)}),r$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(t$,o,u),c=(f(Mk,M([EN]),d(WR,yr,yr,L(a,i),o)),s<.1?mN:s<.2?e$:LR);return f(PN,U(M([IN(5)]),e),M([d(WR,M([EN]),t,L(a,i),o),f(ZR,1-s,c)]))}),n$=function(e){var t=Ed(Vl(e)),r=f(Wl,".",t);if(!r.b)return t;if(r.b.b){ol("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(Zo,3,t);case 1:return f(Zo,4,f($c,t,f(Io,gw,f(Io,function(e){return e/100},f(Io,Ka,f(Io,iv,f(Io,ti(100),wd(t))))))));default:var n=r.a;return f($c,f(Zo,n,t),f(Io,Ni,f(Io,iv,wd(t))))}},a$=n(function(e,t,r){return f(tR,rR(t),function(){switch(t.$){case"Phase":return ul($R(r.state.phase));case"Expires":if("Open"===r.state.phase.$){var n=f(RR,e,r);if("TimeLeft"===n.$){var a=n.a,i=f(t$,a.a,a.b)<.05?mN:_R;return d(r$,M([mT(Vk)]),M([vN(16)]),L(i,ER),a)}var o=n.a;return d(r$,M([mT(Vk)]),M([vN(16)]),L(mN,ER),L(Ol(0),o))}return Kk;case"Offer":return f(ON,M([IN(5)]),M([ul(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(n$(r.parameters.tradeAmount)+" ")+IR(r.factory))]));case"FiatPrice":return qR(r.terms.price);case"Margin":var u=R(r.parameters.initiatorRole,fo);return f($c,Kk,f(Io,UR(u),r.derived.margin));case"PaymentWindow":var s=function(){return"Seller"===r.parameters.initiatorRole.$?mN:LR}(),c=_(Vd(r.parameters.autoabortInterval),216e5)<0?s:_R;return d(WR,yr,yr,L(c,ER),r.parameters.autoabortInterval);default:var s=function(){return"Seller"===r.parameters.initiatorRole.$?LR:mN}(),c=_(Vd(r.parameters.autoabortInterval),216e5)<0?s:_R;return d(WR,yr,yr,L(c,ER),r.parameters.autoreleaseInterval)}}())}),i$=n(function(e,t,r){return f(PN,M([mT(Vk),IN(1),Gk(ER),aN,lN(f(SR,r.factory,r.id))]),M([f(ON,M([mT(Vk),IN(1)]),f(xa,function(t){return l(a$,e,t,r)},t)),f(tR,1,wR(r.terms.paymentMethods))]))}),o$=Er,u$=JT(28),s$=function(e){return f(pA,u$,l(hA,"bc-"+gA(e),"border-color",e))},c$=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),f$=function(e){return f(pA,rA,h(c$,"b-"+Ni(e),e,e,e,e))},l$=a(function(e,t,r,n){return f(PN,M([mT(Vk),f$(2),oN(8),s$(vR),IN(2),Gk(vR),XN]),f(xa,f(i$,e,r),f(o$,CR(t.orderBy),n)))}),d$=a(function(e,t,r,n){return f(PN,M([mT(Vk),pT(Vk),IN(5)]),M([f(gR,t.orderBy,r),d(l$,e,t,r,n)]))}),h$=n(function(e,t,r){var n=ty(f(xa,function(e){return f(VN,FN(r),KN(e))},t));return R(n,yr)?Kk:f(Yi,Mo,d(d$,e,r.tradeTable,M([$o,GN,jN,qN,zN,HN]),n))}),p$=r(function(e,t){return f(Mk,M([oN(4),Gk(d(jR,0,0,1,.1)),vA(l(Pk,16,7,234)),vN(e),hN,f(tN,15,13)]),ul(cl(t)))}),g$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),v$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(pA,Zk,h(eN,"p-"+Ni(t),t,t,t,t)):f(pA,Zk,h(eN,d(g$,t,r,n,a),t,r,n,a))},y$=function(e){return function(){var t=Hd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?Kk:f(ON,M([IN(10),v$({bottom:20,left:20,right:20,top:10})]),M([f(Mk,M([vN(24),hN]),ul("Trade History for User")),f(p$,18,e.agentAddress)]))},m$=function(e){return{$:"FiltersMsg",a:e}},b$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),C$=$I,E$={$:"Left"},S$=bN(E$),T$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(uA,xN,CT("label"),e,ET(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(uA,TT,Ok,a,ET(M([i])));switch(n.$){case"Above":return d(uA,xN,CT("label"),e,ET(M([o,r])));case"Below":return d(uA,xN,CT("label"),e,ET(M([r,o])));case"OnRight":return d(uA,UN,CT("label"),e,ET(M([r,o])));default:return d(uA,UN,CT("label"),e,ET(M([o,r])))}}),w$=function(e){return{$:"Label",a:e}},I$={$:"NoAttribute"},A$=function(e){if("HiddenLabel"===e.$){var t=e.a;return AN(w$(t))}return I$},B$=function(e){return"HiddenLabel"===e.$},k$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return fu("No key matched");var n=r.a;return Fi(n)},r=f(cu,t,f(Ph,"key",lu));return bT(f(cN,"keyup",r))},N$=function(e){return f(Nn,"tabIndex",Ni(e))},R$=f(Da,bT,N$),$$={$:"LivePolite"},_$=AN($$),L$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([B$(r)?I$:IN(6),bT(fN(i(!a))),_$,k$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),R$(0),aN,S$,mT(Vk)]),e);return l(T$,o,r,d(uA,TT,Ok,M([bT(f(C$,"role","checkbox")),bT(f(C$,"aria-checked",a?"true":"false")),A$(r),JN,pT(Vk),mT(vT)]),ET(M([n(a)]))))}),x$=Br,P$=function(e){return e*x$/180},D$=JT(26),U$=function(e){return{$:"MoveY",a:e}},O$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),M$=function(e){return f(O$,D$,U$(-e))},F$=JT(24),V$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),K$=function(e){return f(O$,F$,f(V$,x(0,0,1),e))},H$=JT(19),j$=function(e){return yd(M([e.inset?"box-inset":"box-",gw(e.offset.a)+"px",gw(e.offset.b)+"px",gw(e.blur)+"px",gw(e.size)+"px",gA(e.color)]))},q$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(pA,H$,l(VI,j$(t),"box-shadow",yw(t)))},G$=r(function(e,t){return f(pA,rA,h(c$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),z$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?f$(r):f(G$,n,r):f(pA,rA,h(c$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},Y$=JT(12),W$=f(nN,Y$,BT.textCenter),J$=l(lA,1,1,1),Q$=function(e){return f(Mk,M([sA("focusable"),mT(jk(14)),pT(jk(14)),vA(J$),JN,vN(9),W$,oN(3),s$(e?l(lA,59/255,.6,252/255):l(lA,211/255,211/255,211/255)),q$({blur:1,color:e?d(jR,238/255,238/255,238/255,0):l(lA,238/255,238/255,238/255),offset:L(0,0),size:1}),Gk(e?l(lA,59/255,.6,252/255):J$),f$(e?0:1)]),e?f(Mk,M([s$(J$),pT(jk(6)),mT(jk(9)),K$(P$(-45)),EN,JN,M$(1),z$({bottom:2,left:2,right:0,top:0})]),Kk):Kk)},X$=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),Z$={$:"OnRight"},e_=X$(Z$),t_=r(function(e,t){return f(L$,yr,{checked:t.checked,icon:Q$,label:f(e_,yr,ul(t.label)),onChange:f(b$,e,t.label)})}),r_={$:"Top"},n_=YN(r_),a_=function(e){return f(PN,M([IN(15),n_]),M([f(Mk,M([vN(28),lR]),ul(e.label)),f(PN,M([IN(5)]),f(xa,t_(e.label),e.options))]))},i_=function(e){return f(ON,M([IN(20)]),f(xa,a_,e))},o_={$:"NoneFound"},u_={$:"AllFetched"},s_={$:"FetchingTrades"},c_={$:"QueryingNumTrades"},f_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return c_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?s_:u_}return o_},l_={$:"InFront"},d_=function(e){return f(QR,l_,e)},h_=r(function(e,t){var r=function(e){return f(Mk,M([vN(20),hN,vA(vR),EN]),ul(e))},n=f(mh,Ja(o_),f(xa,f_,e))?M([r("No trades found.")]):f(xa,r,KC(f(xa,function(e){switch(f_(e).$){case"QueryingNumTrades":return si("Querying "+cB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+cB(e.factory)+" Trades...");default:return ci}},e)));return f(Mk,M([mT(Vk),d_(f(PN,M([IN(5),S$]),n))]),f(Mk,M([EN]),f(Yi,m$,i_(t.filters))))}),p_=n(function(e,t,r){return f(PN,M([oN(5),Gk(Xk),mT(Vk),pT(Vk),f(tN,30,20)]),M([y$(r),f(h_,t,r),l(h$,e,t,r)]))}),g_=function(e){return{$:"ShowCurrencyDropdown",a:e}},v_={$:"AbortCreate"},y_=function(e){return{$:"AppCmd",a:e}},m_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),b_=function(e){return f(xa,function(e){return M([f(Mk,M([vA(mN)]),ul("Caution! ")),ul(e)])},KC(M([R(f(fv,e.autoreleaseInterval,Ol(12e5)),ba)?si(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."}()):ci,R(f(fv,e.autoabortInterval,Ol(36e5)),ba)?si(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.'}()):ci])))},C_=l(lA,0,0,1),E_=function(e){return f(Mk,M([v$({bottom:5,left:5,right:5,top:0}),lN(e),oN(30),Gk(d(jR,1,1,1,.4)),f$(1),s$(d(jR,0,0,0,.3)),aN,vN(14)]),f(Mk,M([vA(d(jR,0,0,0,.7))]),ul("x")))},S_=Bn,T_=S_,w_=bT,I_=r(function(e,t){return f(Mk,M([XR(f(Mk,M([Gk(e),w_(f(T_,"position","fixed")),w_(f(T_,"z-index","1000")),w_(f(T_,"top","0")),w_(f(T_,"left","0")),w_(f(T_,"width","100%")),w_(f(T_,"height","100%"))]),Kk)),mT(Vk),pT(Vk)]),t)}),A_=r(function(e,t){return{$:"Max",a:e,b:t}}),B_=r(function(e,t){return f(A_,e,t)}),k_=n(function(e,t,r){return l(Pa,I_,d(jR,0,0,.3,.6),f(Mk,U(M([EN,JN,mT(f(B_,500,vT)),Gk(Xk),oN(8),d_(f(Mk,M([_N,n_]),E_(r)))]),e),t))}),N_=r(function(e,t){if("Nothing"===t.$)return Kk;var r=t.a;return f(Mk,U(M([oN(5),s$(l(lA,.9,0,0)),f$(1),Gk(l(lA,1,.4,.4)),eR(5),EN,JN,mT(f(B_,200,vT)),vN(14)]),e),f(kN,yr,M([ul(r)])))}),R_={$:"Above"},$_=function(e){return f(QR,R_,e)},__=r(function(e,t){return f(Mk,M([oN(4),f(tN,25,17),vN(18),hN,Gk(ER),$_(f(N_,M([M$(5)]),t))]),ul(e))}),L_=a(function(e,t,r,n){return d(fA,e/255,t/255,r/255,n)}),x_=d(L_,1,31,52,.64),P_=JT(32),D_={$:"Active"},U_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),O_=$n,M_=r(function(e,t){switch(t.$){case"NoAttribute":return I$;case"Describe":var r=t.a;return AN(r);case"AlignX":var n=t.a;return bN(n);case"AlignY":var a=t.a;return YN(a);case"Width":var n=t.a;return yT(n);case"Height":var n=t.a;return hT(n);case"Class":var n=t.a,a=t.b;return f(nN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(pA,i,o);case"Nearby":var u=t.a,s=t.b;return f(QR,u,f(zi,e,s));case"Attr":var c=t.a;return bT(f(O_,e,c));default:var l=t.a,d=t.b;return f(O$,l,d)}}),F_=function(e){return f(M_,jg,e)},V_=r(function(e,t){var r=t.a,n=t.b,a=F_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(ZI,n,o));default:return L(r,n)}}),K_=function(e){var t=l(Ra,V_,L(yr,iA),e),r=t.a,n=t.b;return f(ka,KI(n),r)},H_=function(e){return f(pA,P_,f(U_,D_,K_(e)))},j_=JT(33),q_={$:"Hover"},G_=function(e){return f(pA,j_,f(U_,q_,K_(e)))},z_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Mk,M([oN(4),aN,lN(n),f(tN,25,17),vA(t),vN(18),hN,Gk(a),H_(M([Gk(o)])),G_(M([Gk(i)]))]),ul(r))}),Y_=r(function(e,t){return d(z_,x(d(jR,1,0,0,1),d(jR,1,0,0,.8),d(jR,1,0,0,.6)),Xk,e,t)}),W_=function(e){return I_(d(jR,0,0,.3,.6))(f(PN,M([IN(10),EN,JN,Gk(d(jR,0,0,0,.5)),oN(8),eR(20)]),f(xa,function(e){return f(kN,M([EN,JN,vN(20),hN,vA(Xk),W$]),M([e]))},e)))},J_=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+IA(t)}e.a;return"https://kovan.etherscan.io/tx/"+IA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+IA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+IA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+IA(t)}}),Q_={$:"Bottom"},X_=YN(Q_),Z_=sA(BT.underline),eL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(ul(n$(Rb(a))),f(Y_,"Yes, I definitely want to open this trade.",l(m_,r,n,a)))}return L(ul("??"),f(__,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(k_,yr,f(PN,M([IN(20),eR(20),EN,pT(Vk),W$]),M([f(Mk,M([vN(26),hN,EN,JN]),ul("Just to Confirm...")),f(PN,M([IN(20),EN,JN]),f(xa,kN(M([EN,vN(18),lR,vA(x_)])),U(b_(n),U(M([M([ul("You will deposit "),i,ul(" "+IR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([ul("This ususally requires two Metamask signatures. Your "+IR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Mk,M([X_,EN]),o)])),v_);case"ApproveNeedsSig":var u=e.a;return f(Mk,M([lN(y_(d(Jd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),W_(M([ul("Waiting for user signature for the approve call."),ul("(check Metamask!)"),ul("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Mk,M([lN(y_(d(Jd,"txChainModal clicked","misclick","ApproveMining",0)))]),W_(M([ul("Mining the initial approve transaction..."),f(cA,M([Z_,vA(C_)]),{label:ul("See the transaction on Etherscan"),url:f(J_,eo(u),s)}),ul("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Mk,M([lN(y_(d(Jd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),W_(M([ul("Waiting for user signature for the create call."),ul("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Mk,M([lN(y_(d(Jd,"txChainModal clicked","misclick","CreateMining",0)))]),W_(M([ul("Mining the final create call..."),f(cA,M([Z_,vA(C_)]),{label:ul("See the transaction on Etherscan"),url:f(J_,r,s)}),ul("You will be redirected when it's mined.")])))}}),tL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return Kk;var r=t.a;return f(eL,r,e)},rL=function(e){return{$:"TradeAmountChanged",a:e}},nL=cT("id"),aL=w_(nL("inputError")),iL=l(Pk,109,127,138),oL=nR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),uL=function(e){return f(sR,f(ka,pT(jk(26)),e),oL)},sL=function(e){return f(ON,M([IN(4)]),M([uL(yr),f(Mk,M([vN(24),lR,vA(iL)]),ul(IR(e)))]))},cL=function(e){return{$:"HiddenLabel",a:e}},fL=cL,lL=cT("type"),dL=function(e){return L(e,!0)},hL=function(e){return{$:"MayStopPropagation",a:e}},pL=r(function(e,t){return f(sN,e,hL(t))}),gL=r(function(e,t){return l(La,Ph,t,e)}),vL=f(gL,M(["target","value"]),lu),yL=function(e){return f(pL,"input",f(Oi,dL,f(Oi,e,vL)))},mL=JT(0),bL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),CL=function(e){var t=function(e){return 1-e}(f(Cc,1,f(ei,0,e)));return f(pA,mL,f(bL,"transparency-"+cw(t),t))},EL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),SL=f(Da,bT,C$("autocomplete")),TL=l(lA,136/255,138/255,133/255),wL=l(lA,186/255,189/255,182/255),IL=f(tN,12,12),AL=M([IL,oN(3),s$(wL),Gk(J$),f$(1),IN(3),mT(Vk)]),BL=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},kL=function(e){return f(yh,BL,e)?I$:sA("focusable")},NL=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},RL=ye,$L=r(function(e,t){return f(kn,e,RL(t))}),_L=$L("spellcheck"),LL=f(Da,bT,_L),xL=W,PL=JT(47),DL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(xL(e))),o=(i-1)*t+f($c,0,f(Io,a,r))+f($c,0,f(Io,a,n));return f(pA,PL,l(VI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),UL=cT("value"),OL=f(Da,bT,UL),ML=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(uw,"width",n)?L(r,n):L(f(ka,e,r),f(CS,"width",n));case"Height":e.a;return f(uw,"height",n)?L(r,n):L(f(ka,e,r),f(CS,"height",n));case"Describe":e.a;return f(uw,"described",n)?L(r,n):L(f(ka,e,r),f(CS,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(uw,"align-x",n)?L(r,n):L(f(ka,e,r),f(CS,"align-x",n));case"AlignY":return f(uw,"align-y",n)?L(r,n):L(f(ka,e,r),f(CS,"align-y",n));default:return f(uw,"transform",n)?L(r,n):L(f(ka,e,r),f(CS,"transform",n))}}),L(yr,im),e).a},FL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,ML(e))}),VL=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}},KL=f(Da,Gi,gs),HL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([bT(yL(n.onChange))]),o=U(AL,t),u=f(FL,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(gl,NL,o),c=f(FL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(FL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(FL,o,function(e){return"Nearby"===e.$})),p=f(gl,f(Da,es,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([OL(n.text),bT(lL(a)),LL(e.spellchecked),sA(BT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return I$;var r=t.a;return SL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(VL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(EL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(EL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f($c,5,c);return x("textarea",U(M([LL(e.spellchecked),sA(BT.inputMultiline),f($c,I$,f(Io,SL,e.autofill)),function(){if("Nothing"===u.$)return I$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return v$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?I$:s.a?d(DL,n.text,v,u,g):I$}()]),h),M([KL(BI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(uA,TT,Ok,f(ka,mT(Vk),ty(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([d_(f(Mk,f(ka,IL,U(s,U(M([vA(TL),sA(BT.noTextSelection+" "+BT.passPointerEvents),s$(d(jR,0,0,0,0)),Gk(d(jR,0,0,0,0)),pT(Vk),mT(Vk),CL(""===n.text?1:0)]),r))),a))])}()]))),ET(M([d(uA,TT,CT(v),ty(M([M([kL(t),A$(n.label)]),y,i])),ET(m))])));return l(T$,f(ka,f(nN,rN,BT.cursorText),f(ka,B$(n.label)?I$:IN(5),f(ka,_$,u))),n.label,b)}),jL=HL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),qL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(jL,M([mT(Vk),pT(jk(40)),f$(0)]),{label:fL(r),onChange:i,placeholder:n,text:a});return f(ON,U(M([IN(5)]),e),KC(M([f(Io,Mk(M([S$])),o),si(s),f(Io,Mk(M([_N])),u)])))}),GL={$:"Below"},zL=function(e){return f(QR,GL,e)},YL=function(e){return f(O$,D$,U$(e))},WL=n(function(e,t,r){return p(qL,M([mT(jk(150)),lR,vN(24),zL(f(N_,M([aL,YL(5)]),r))]),L(ci,si(f(Mk,M([lN(y_(d(Jd,"click","misclick","dai symbol in dai input",0)))]),sL(e)))),"dai input",ci,t,rL)}),JL=Mk(M([s$(ER),z$({bottom:2,left:0,right:0,top:0})])),QL=r(function(e,t){return f(PN,M([IN(10)]),M([f(Mk,M([vN(17),hN]),ul(e)),t]))}),XL=r(function(e,t){return JL(f(QL,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(WL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),ZL=function(e){return f($c,FE,Dg(e))},ex=function(e){var t=function(){var t=hd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+n$(f(Hl,r,100))+" "+IR(ZL(e.wallet))+"."}return"There is a 1% fee."}();return f(ON,M([EN,f(tN,20,10),Gk(l(Pk,10,33,108)),oN(8),IN(5),lN(y_(d(Jd,"click","misclick","fee notify element",0)))]),M([f(Mk,M([vN(18),vA(l(Pk,0,226,255)),hN]),ul(t)),f(Mk,M([vN(17),vA(Xk),lR]),ul("We only collect this fee when trades resolve successfully."))]))},tx=function(e){return{$:"FiatAmountChanged",a:e}},rx=function(e){return{$:"FiatTypeChanged",a:e}},nx=r(function(e,t){return l(vS,n(function(t,r,n){return f(e,t,r)?l($l,t,r,n):n}),op,t)}),ax=function(e){return f(nx,r(function(t,r){return f(Yg,e,t)}),MR)},ix=nR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),ox=function(e){return f(sR,M([pT(jk(26))]),f($c,ix,f(Io,uu,f(up,e,MR))))},ux=function(e){return w_(f(pL,"click",Fi(L(e,!0))))},sx=KL,cx=function(e){return{$:"AppendProperty",a:e}},fx=r(function(e,t){return cx(e+":"+t)}),lx=r(function(e,t){return f(fx,e,t.value)}),dx=lx("cursor"),hx={$:"Compatible"},px={cursor:hx,value:"default"},gx=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),vx=function(e){return{$:"PseudoClassSelector",a:e}},yx=function(e){return gx(vx(e))}("hover"),mx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),bx=mx,Cx=bx,Ex=Cx("span"),Sx=r(function(e,t){return f(kn,et(e),rt(t))}),Tx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),wx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),Ix=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),Ax=r(function(e,t){return t<>>32-e}),Bx=function(e){var t=e.hash?e.seed^f(Ix,461845907,f(Ax,15,f(Ix,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(Ix,2246822507,r^r>>>16),a=f(Ix,3266489909,n^n>>>13);return(a^a>>>16)>>>0},kx=r(function(e,t){return f(Ix,5,f(Ax,13,e^f(Ix,461845907,f(Ax,15,f(Ix,3432918353,t)))))+3864292196}),Nx=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},UP=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+"]"}},OP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,UP,r)));case"UniversalSelectorSequence":var r=e.a;return Su(r)?"*":f(Ri,"",f(xa,UP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,UP,r)))}},MP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([DP(t),OP(r)]))},FP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,OP(t),f(xa,MP,r)),i=f(Ri,"",M([f($c,"",f(Io,PP,n))]));return f(nc,f(Ri," ",f(gl,f(Da,es,Nd),a)),i)},VP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,FP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,xP(a),"\n",e,"}"]))}),KP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(VP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,kP,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,_P,VP(" ")),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"}},HP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(gl,f(Da,es,Nd),M([IP(t),f(Ri,"\n",f(xa,RP,r)),f(Ri,"\n",f(xa,$P,n)),f(Ri,"\n\n",f(xa,KP,a))])))},jP=function(e){return HP(wP(EP(e)))},qP=function(e){return f(Ri,"\n\n",f(xa,jP,e))},GP=function(e){return{$:"Snippet",a:e}},zP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),YP=function(e){return{$:"StyleBlockDeclaration",a:e}},WP=r(function(e,t){var r=l(Yx,t,yr,ci);return GP(M([YP(l(zP,r,yr,e))]))}),JP=function(e){return Su(e)?"unstyled":f(Ss,P("_"),_s(f(Rx,15739,qP(TS($x(TS(f(WP,e,oP(yr)))))))))},QP=function(e){var t=JP(e),r=f(Sx,"className",fl(t));return l(Tx,r,e,t)},XP=a(function(e,t,r,n){return f(e,f(ka,QP(t),r),n)}),ZP=function(e){return{$:"Unstyled",a:e}},eD=function(e){return ZP(Cw(e))},tD=eD,rD=r(function(e,t){return f(Tn,e,Xe(t))}),nD=function(e){return En(Xe(e))},aD=r(function(e,t){var r=e.b,n=e.c;return Su(r)?t:l($l,n,r,t)}),iD=function(e){return e.a},oD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,aD,i,s),p=l(Ra,uD,L(yr,h),c),g=p.a,v=p.b,o=l(zT,u,f(xa,iD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,aD,i,s),m=l(Ra,uD,L(yr,h),c),g=m.a,v=m.b,o=d(nD,y,u,f(xa,iD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,aD,i,s),b=l(Ra,oD,L(yr,h),c),g=b.a,v=b.b,o=l(GT,u,f(xa,iD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,aD,i,s),C=l(Ra,oD,L(yr,h),c),g=C.a,v=C.b,o=d(rD,y,u,f(xa,iD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),uD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,aD,n,o),c=l(Ra,uD,L(yr,s),u),h=c.a,p=c.b,a=l(zT,i,f(xa,iD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,aD,n,o),v=l(Ra,uD,L(yr,s),u),h=v.a,p=v.b,a=d(nD,g,i,f(xa,iD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,aD,n,o),y=l(Ra,oD,L(yr,s),u),h=y.a,p=y.b,a=l(GT,i,f(xa,iD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,aD,n,o),m=l(Ra,oD,L(yr,s),u),h=m.a,p=m.b,a=d(rD,g,i,f(xa,iD,o),$a(h));return L(f(ka,a,r),p)}}),sD=r(function(e,t){return h(Al,Il,e,t,Bl,Bl)}),cD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(Nd(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),fD=function(e){var t=f(cD,ci,e);if("Nothing"===t.$)return op;var r=t.a,n=r.a,a=r.b;return f(sD,n,a)},lD=function(e){return{$:"ClassSelector",a:e}},dD=function(e){var t=e.a,r=e.b;return f(WP,r,oP(M([lD(t)])))},hD=function(e){return qP(TS($x(f(xa,dD,Ia(e)))))},pD=function(e){return l(zT,"style",yr,TS(Cw(hD(e))))},gD=n(function(e,t,r){var n=f(xa,iD,t),a=fD(t),i=l(Ra,uD,L(yr,a),r),o=i.a,u=i.b,s=pD(u);return l(zT,e,n,f(ka,s,$a(o)))}),vD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),yD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(vD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),mD=r(function(e,t){return L(f(yD,"_",t),pD(e))}),bD=n(function(e,t,r){var n=f(xa,iD,t),a=fD(t),i=l(Ra,oD,L(yr,a),r),o=i.a,u=i.b,s=f(mD,u,o);return l(GT,e,n,f(ka,s,$a(o)))}),CD=a(function(e,t,r,n){var a=f(xa,iD,r),i=fD(r),o=l(Ra,oD,L(yr,i),n),u=o.a,s=o.b,c=f(mD,s,u);return d(rD,e,t,a,f(ka,c,$a(u)))}),ED=a(function(e,t,r,n){var a=f(xa,iD,r),i=fD(r),o=l(Ra,uD,L(yr,i),n),u=o.a,s=o.b,c=pD(s);return d(nD,e,t,a,f(ka,c,$a(u)))}),SD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(gD,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(ED,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(bD,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(CD,a,t,r,n)}},TD=SD,wD=function(e){return sx(TD(d(XP,Ex,M([yx(M([dx(px)]))]),yr,M([tD(e)]))))},ID=J,AD=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),BD=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),kD=function(e){return l(La,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 si(h(AD,n,a,i,o,u))}return ci}(),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 si(l(BD,a,t,i))}return ci}())}),L(ci,ci),e)},ND=r(function(e,t){var r=kD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(uA,UN,Ok,f(ka,sA(BT.contentLeft+" "+BT.contentCenterY+" "+BT.wrapped),f(ka,mT(vT),f(ka,pT(vT),e))),ET(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?si(v$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(uA,UN,Ok,f(ka,sA(BT.contentLeft+" "+BT.contentCenterY+" "+BT.wrapped),f(ka,mT(vT),f(ka,pT(vT),U(e,M([h]))))),ET(t))}var p=-s/2,g=-u/2;return d(uA,TT,Ok,e,ET(M([d(uA,UN,Ok,f(ka,sA(BT.contentLeft+" "+BT.contentCenterY+" "+BT.wrapped),f(ka,bT(f(T_,"margin",gw(p)+"px "+gw(g)+"px")),f(ka,bT(f(T_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,bT(f(T_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(pA,SN,l(TN,o,u,s)),yr))))),ET(t))])))}),RD=i(function(e,t,r,n,a){var i=f(jL,M([mT(jk(80)),pT(jk(40)),vN(24),lR,s$(ER),ux(r)]),{label:fL("currency type"),onChange:f(jo,ID,n),placeholder:ci,text:t}),o=f(up,t,MR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return Kk;r.b;return f(ND,M([mT(jk(350)),s$(_R),f$(1),Gk(Xk),eR(10),EN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(ON,M([mT(jk(80)),IN(9),f(tN,0,5),ux(n(t)),G_(M([Gk(l(lA,.8,.8,1))]))]),M([f(sR,M([pT(jk(26))]),a),f(Mk,M([vN(16),hN]),wD(t))]))},Ia(ax(t))))}return Kk}();return f(ON,M([IN(4),zL(u)]),M([f(Mk,M([lN(a)]),ox(t)),i]))}),$D=i(function(e,t,r,n,a){var i=y_(d(Jd,"click","misclick","currency flag",0)),o=f(Mk,M([lN(y_(d(Jd,"click","misclick","currency symbol",0)))]),ul(FR(e))),u=f(Mk,M([zL(f(N_,M([aL,YL(5)]),a))]),h(RD,r,e,g_(!0),rx,i));return p(qL,M([mT(jk(250)),lR,vN(24),zL(f(N_,M([aL,YL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,tx)}),_D=function(e){return JL(f(QL,"For fiat",h($D,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},LD=function(e){return{$:"ChangeRole",a:e}},xD=d(L_,1,31,52,.13),PD=r(function(e,t){var r=M([vN(24),lR,aN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([vA(xD)]))):L(U(r,M([vA(xD)])),r)}(),a=n.a,i=n.b;return f(ON,M([IN(20)]),M([f(Mk,U(M([lN(LD(lo))]),i),ul("Sell "+e)),f(Mk,U(M([lN(LD(fo))]),a),ul("Buy "+e))]))}),DD=r(function(e,t){return f(QL,"Trade Type",f(PD,IR(e),t.inputs.userRole))}),UD=q$({blur:20,color:d(L_,0,0,0,.04),offset:L(0,3),size:0}),OD=f(nN,SN,BT.spaceEvenly),MD=function(e){var t=ZL(e.wallet);return f(PN,M([mT(Vk),IN(20),Gk(Xk),oN(5),eR(20),UD]),M([f(ON,M([mT(Vk),OD]),M([f(DD,t,e),f(XL,t,e),_D(e)])),ex(e)]))},FD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),VD={$:"Web3Connect"},KD=function(e){return f(Mk,M([EN]),function(){var t=L(Hd(e),Dg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(Y_,"Open Trade",f(FD,n,r))}t.b;return f(__,"Unsupported Network",ci)}t.a;return f(Y_,"Connect to Wallet",VD)}())},HD=function(e){return{$:"AutoabortIntervalChanged",a:e}},jD=function(e){return{$:"ChangePaymentMethodText",a:e}},qD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),GD=qD,zD=function(e){return f(GD,M([vA(d(jR,0,0,0,.2))]),function(){return ul("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")}())},YD={$:"TextArea"},WD=r(function(e,t){return l(HL,{autofill:ci,spellchecked:t.spellcheck,type_:YD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),JD=n(function(e,t,r){var n=f(Mk,M([vN(22),hN]),ul("Payment Method")),a=f(WD,M([mT(Vk),pT(jk(150)),Gk(d(L_,155,203,255,.2)),f$(0)]),{label:fL("payment method"),onChange:jD,placeholder:""===r?si(zD(t)):ci,spellcheck:!0,text:r});return f(PN,M([IN(20),v$({bottom:15,left:45,right:45,top:0}),mT(Vk),$_(f(N_,M([aL,YL(30),eR(10),vN(20),mT(jk(400))]),e))]),M([n,a]))}),QD=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."},XD=a(function(e,t,r,n){var a=l(Bs,e,P("0"),Ni(n));return f(Mk,M([vN(22),vA(t)]),ul(U(a,r)))}),ZD=function(e){return Vd(e)<0?Ol(0):e},eU=n(function(e,t,n){var a=r(function(e,r){return f(PN,M([IN(4)]),M([f(Mk,M([eR(4),aN,lN(n(f(gb,t,e)))]),f(sR,M([pT(jk(10))]),cR)),r,f(Mk,M([eR(4),aN,lN(n(function(e){return Vd(e)?e:Ol(3e5)}(ZD(f(NR,t,e)))))]),f(sR,M([pT(jk(10))]),aR))]))}),i=YR(t);return f(ON,M([OD,IN(10)]),M([f(a,Ol(864e5),d(XD,3,e," days",i.days)),f(a,Ol(36e5),d(XD,2,e," hours",i.hours)),f(a,Ol(3e5),d(XD,2,e," min",i.min))]))}),tU=o(function(e,t,r,n,a,i){var o=f(Mk,M([Gk(d(L_,155,203,255,.2)),oN(5),eR(15),$_(f(N_,M([aL]),a))]),l(eU,_R,n,i)),u=f(ON,M([IN(30)]),M([f(sR,M([pT(jk(40)),lN(y_(d(Jd,"click","misclick","symbol for "+t,0)))]),e),f(Mk,M([vN(22),hN]),ul(t))])),s=f(kN,M([vN(17),lR,vA(x_)]),M([ul(r)]));return f(PN,M([mT(Vk),oN(10),Gk(l(Pk,237,237,237)),IN(2)]),f(xa,Mk(M([Gk(Xk),f(tN,45,18),mT(Vk)])),M([u,f(ON,M([mT(Vk),IN(25),Gk(Xk)]),M([o,s]))])))}),rU=nR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),nU=f(nN,QN,BT.clipX),aU=f(nN,QN,BT.clipY),iU=i(function(e,t,r,n,a){return f(PN,M([IN(15),oN(8),nU,aU,Gk(Xk)]),M([p(tU,rU,"Payment Window",QD(a),r,n,HD),l(JD,t,a,e)]))}),oU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},uU=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."},sU=nR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),cU=n(function(e,t,r){return f(Mk,M([oN(8),nU,aU,Gk(Xk)]),p(tU,sU,"Burn/Release Window",uU(r),e,t,oU))}),fU=function(e){return{$:"AutorecallIntervalChanged",a:e}},lU=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."},dU=nR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),hU=n(function(e,t,r){return f(Mk,M([oN(8),Gk(Xk),nU,aU]),p(tU,dU,"Open Window",lU(r),e,t,fU))}),pU=function(e){return f(PN,M([mT(Vk),IN(20)]),M([l(hU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(iU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(cU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},gU=function(e){return f(PN,M([mT(f(B_,1e3,Vk)),EN,IN(20),v$({bottom:30,left:40,right:40,top:0}),lN(g_(!1)),d_(tL(e))]),M([MD(e),pU(e),KD(e.wallet)]))},vU=Ts(Um(8226)),yU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),mU=r(function(e,t){return l(Ra,ka,t,e)}),bU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(mU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),CU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(mU,f(sc,e%r,t),l(bU,yr,e/r|0,t))):f(sc,e,t)}),EU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(uw,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(CS,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),SU=function(e){return d(EU,Ua,im,e,yr)},TU=r(function(e,t){return f(Mk,M([mT(Vk),d_(f(ON,M([IN(3),mT(ZN(100)),mT(t),XN]),f(yU,f(Mk,M([vA(d(jR,0,0,0,.1)),vN(14)]),ul(vU)),f(xa,f(Da,Mk(M([vA(d(jR,0,0,0,.2))])),ul),f(CU,100,(e?$a:Ua)(SU(f(xa,f(jo,uu,Qa),Ia(MR)))))))))]),ul(" "))}),wU=r(function(e,t){var r=t.url,n=t.label;return d(uA,TT,CT("a"),f(ka,bT(fT(r)),f(ka,bT(lT("noopener noreferrer")),f(ka,mT(vT),f(ka,pT(vT),f(ka,sA(BT.contentCenterX+" "+BT.contentCenterY),e))))),ET(M([n])))}),IU=sA(BT.italic),AU=function(){var e=f(Da,Mk(M([vA(l(lA,.8,.2,.2))])),ul),t=f(Da,Mk(M([NN])),ul);return f(PN,M([mT(Vk),pT(Vk),Gk(Xk),oN(6),IN(50),q$({blur:20,color:d(L_,0,0,0,.1),offset:L(0,3),size:0}),oN(10),eR(20)]),M([f(TU,!1,Vk),f(PN,M([EN,mT(f(B_,700,Vk)),IN(20)]),M([f(kN,M([vN(70),NN,EN,W$]),M([ul("DAI"),e("Hard")])),f(ON,M([vN(30),hN,EN,W$,IU]),M([ul("The "),e("Global"),ul(", "),e("Unkillable"),ul(" Crypto Gateway")]))])),f(ON,M([Gk(vR),IN(2),EN,n_,mT(Vk)]),M([f(Mk,M([f(tN,40,10),Gk(Xk),mT(Vk),pT(Vk)]),f(PN,M([IN(60),_N]),M([f(Mk,M([vN(40),hN,EN]),ul("Want to learn more?")),f(PN,M([IN(15)]),M([f(wU,M([oN(4),mT(Vk),aN,f(tN,25,17),Gk(C_),vA(Xk),NN,vN(24),EN]),{label:f(kN,M([W$]),M([ul("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"}),f(wU,M([oN(4),mT(Vk),aN,f(tN,25,17),Gk(C_),vA(Xk),NN,vN(24),EN]),{label:f(kN,M([W$]),M([ul("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})]))]))),f(Mk,M([f(tN,40,10),Gk(Xk),mT(Vk),pT(Vk)]),f(PN,M([S$,IN(60)]),M([f(Mk,M([vN(40),hN,EN]),ul("Ready to try it out?")),f(PN,M([IN(10),mT(jk(400)),EN]),M([f(kN,M([vN(24),mT(Vk)]),M([ul("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f(kN,M([vN(24),mT(Vk)]),M([ul("Then follow the links at the top of this page to browse "),t("Sell Offers"),ul(", browse "),t("Buy Offers"),ul(", or "),t("Create Your Own Offer"),ul(".")]))]))])))])),f(Mk,M([X_,mT(Vk)]),f(TU,!0,Vk))]))}(),BU=function(e){return{$:"ShowCurrencyDropdown",a:e}},kU=r(function(e,t){return gl(t(e))}),NU=n(function(e,t,r){var n=l(kU,e,r.filterFunc,ty(f(xa,KN,t)));return R(n,yr)?Kk:f(Yi,Bv,d(d$,e,r.tradeTable,M([Tv,GN,jN,qN,zN,HN]),n))}),RU=function(e){return{$:"FiltersMsg",a:e}},$U={$:"ApplyInputs"},_U=$L("disabled"),LU=function(e){return{$:"MayPreventDefault",a:e}},xU=r(function(e,t){return f(sN,e,LU(t))}),PU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):fu("Not the enter key")},n=f(cu,r,f(Ph,"key",lu));return bT(f(xU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),DU=function(e){return f(PU,"Enter",e)},UU={$:"Button"},OU=r(function(e,t){var r=t.onPress,n=t.label;return d(uA,TT,Ok,f(ka,mT(vT),f(ka,pT(vT),f(ka,sA(BT.contentCenterX+" "+BT.contentCenterY+" "+BT.seButton+" "+BT.noTextSelection),f(ka,aN,f(ka,kL(e),f(ka,AN(UU),f(ka,bT(N$(0)),function(){if("Nothing"===r.$)return f(ka,bT(_U(!0)),e);var t=r.a;return f(ka,lN(t),f(ka,DU(t),e))}()))))))),ET(M([n])))}),MU=f(OU,M([Gk(C_),eR(10),oN(5)]),{label:f(Mk,M([vA(Xk),EN,JN]),ul("Apply")),onPress:si($U)}),FU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(pA,iN,l(VI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},VU=function(e){return f(cN,"focus",Fi(e))},KU=f(Da,bT,VU),HU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([KU(e(!0)),ux(e(!0))])}();return f(ON,U(e,M([pT(jk(40)),q$({blur:20,color:d(L_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Mk,M([Gk(ER),pT(jk(40)),FU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Mk,M([JN,f(tN,10,0)]),r)),f(jL,U(s,U(t,M([mT(jk(100)),pT(jk(40)),s$(ER),FU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),z$({bottom:1,left:0,right:1,top:1})]))),{label:fL(n),onChange:u,placeholder:i,text:a})]))}),jU=function(e){return{$:"MaxDaiChanged",a:e}},qU=function(e){return{$:"MinDaiChanged",a:e}},GU=r(function(e,t){return f(PN,M([mT(Vk),IN(8)]),M([f(Mk,M([vN(17),lR]),ul(e)),t]))}),zU=JT(25),YU=function(e){return{$:"MoveX",a:e}},WU=function(e){return f(O$,zU,YU(-e))},JU={$:"OnLeft"},QU=function(e){return f(QR,JU,e)},XU=n(function(e,t,r){var n=uL(M([JN])),a=f(ON,M([IN(8),JN,mT(jk(60))]),M([n,f(Mk,M([vN(16),JN]),ul("max"))])),i=f(ON,M([IN(8),JN,mT(jk(60))]),M([n,f(Mk,M([vN(16),JN]),ul("min"))]));return f(GU,"Dai Range",f(PN,M([IN(5),mT(jk(200))]),M([v(HU,M([QU(f(N_,M([WU(5),mT(jk(200))]),r.minDai))]),M([KU(BU(!1))]),i,"min Dai",e,ci,ci,qU),v(HU,M([QU(f(N_,M([WU(5),mT(jk(200))]),r.maxDai))]),M([KU(BU(!1))]),a,"max Dai",t,ci,ci,jU)])))}),ZU=function(e){var t=f(up,e,MR);if("Nothing"===t.$)return ul("*");var r=t.a,n=r.b;return f(sR,M([pT(jk(26))]),n)},eO=function(e){return{$:"AppCmd",a:e}},tO=function(e){return{$:"FiatTypeInputChanged",a:e}},rO=n(function(e,t,r){var n=eO(d(Jd,"click","misclick","currency flag",0)),a=ZU(t);f(ON,M([IN(8),JN,mT(jk(60))]),M([a,f(Mk,M([vN(16),JN]),ul("max"))])),f(ON,M([IN(8),JN,mT(jk(60))]),M([a,f(Mk,M([vN(16),JN]),ul("min"))]));return f(Mk,M([n_,mT(jk(120))]),f(GU,"Fiat Type",h(RD,e,t,BU(!0),tO,n)))}),nO={$:"AddSearchTerm"},aO=function(e){return{$:"PaymentMethodInputChanged",a:e}},iO=f(Ph,"keyCode",jC),oO=function(e){return f(cN,"keyup",f(cu,function(t){return 13===t?Fi(e):fu(Ni(t))},iO))},uO=function(e){return f(GU,"Search Payment Methods",f(jL,M([n_,mT(jk(250)),pT(jk(40)),s$(ER),q$({blur:20,color:d(L_,233,237,242,.05),offset:L(0,3),size:0}),w_(oO(nO))]),{label:fL("payment methods search"),onChange:aO,placeholder:ci,text:e}))},sO={$:"ResetSearch"},cO=f(OU,M([Gk(C_),eR(10),oN(5)]),{label:f(Mk,M([vA(Xk),EN,JN]),ul("Reset")),onPress:si(sO)}),fO=function(e){return{$:"RemoveTerm",a:e}},lO=function(e){return f(Mk,M([eR(3),n_,aN,lN(fO(e)),vN(10),vA(mN)]),ul("x"))},dO=function(e){if(e.b){var t=e;return f(ON,M([mT(Vk),eR(10),IN(10)]),f(xa,function(e){return f(ON,M([Gk(d(L_,16,7,234,.2)),oN(5),eR(4),IN(3)]),M([ul(e),lO(e)]))},t))}return Kk},hO=i(function(e,t,r,n,a){var i=function(e){return f(Mk,M([vN(20),hN,vA(vR),EN]),ul(e))},o=f(mh,Ja(o_),f(xa,f_,e))?M([i("No trades found.")]):f(xa,i,KC(f(xa,function(e){switch(f_(e).$){case"QueryingNumTrades":return si("Querying "+cB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+cB(e.factory)+" Trades...");default:return ci}},e)));return f(Mk,M([mT(Vk),d_(f(PN,M([IN(5),S$]),o))]),f(ON,M([EN,IN(50)]),M([f(Yi,RU,i_(t)),f(ON,M([mT(vT),IN(10)]),M([f(Mk,M([mT(vT),n_]),l(XU,r.minDai,r.maxDai,n)),f(Mk,M([mT(vT),n_]),l(rO,a,r.fiatType,n)),f(PN,M([mT(vT),n_,IN(5)]),M([uO(r.paymentMethod),dO(r.paymentMethodTerms)])),f(GU," ",f(PN,M([IN(5),mT(vT)]),M([MU,cO])))]))])))}),pO=n(function(e,t,r){return f(PN,M([oN(5),Gk(Xk),mT(Vk),pT(Vk),lN(BU(!1)),eR(30)]),M([f(ON,M([mT(Vk),IN(10)]),M([h(hO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),l(NU,e,t,r)]))}),gO=function(e){return{$:"MessageInputChanged",a:e}},vO={$:"MessageSubmit"},yO=function(e){return f(PN,M([mT(Vk),IN(10)]),M([f(WD,M([mT(Vk),pT(jk(100))]),{label:fL("messageInput"),onChange:gO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(OU,M([EN,vN(24)]),{label:ul("Submit"),onPress:si(vO)})]))},mO=f(nN,QN,BT.scrollbarsY),bO=r(function(e,t){return f(Mk,M([pT(Vk),mT(Vk)]),f(Mk,U(M([w_(f(T_,"position","absolute")),w_(f(T_,"top","0")),w_(f(T_,"right","0")),w_(f(T_,"bottom","0")),w_(f(T_,"left","0")),mO]),e),t))}),CO=l(Pk,200,205,210),EO=n(function(e,t,r){var n=M([_N,Gk(C_),vA(Xk),FU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([S$,Gk(CO),vA(_R),FU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Mk,U(M([eR(7)]),u),f(kN,yr,M([ul(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(lA,0,0,1),Xk,"Initiator opened the trade"));case"Recalled":return si(x(l(lA,0,0,1),Xk,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(Zo,8,cl(t))+"..";return si(x(l(lA,1,0,1),Xk,r+" committed to the trade"));case"Aborted":return si(x(l(lA,1,0,0),Xk,"Buyer aborted the trade"));case"Claimed":return si(x(l(lA,0,1,0),Xk,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(lA,0,0,1),Xk,"Seller released the "+IR(e)+" and closed the contract"));default:return si(x(l(lA,0,0,1),Xk,"Seller burned the "+IR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return Kk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Mk,M([oN(3),f$(1),s$(l(lA,1,0,1)),EN,Gk(h)]),f(kN,M([vA(p)]),M([ul(g)])))}),SO=n(function(e,t,r){if(r.b){var n=r;return f(bO,M([mT(Vk),pT(Vk),oN(5),f$(1),s$(_R),eR(10)]),f(PN,M([mT(Vk),pT(Vk),IN(10)]),f(xa,f(EO,e,t),n)))}return f(Mk,M([mT(Vk),pT(Vk),oN(5),f$(1),s$(_R),EN,vA(l(lA,.5,.5,.5)),IU]),ul("no messages found."))}),TO=Cr,wO=function(e){return f(PN,M([mT(Vk),pT(Vk),IN(10),f$(1),oN(5),eR(20)]),M([l(SO,e.trade.factory,e.userRole,f(TO,function(e){return e.blocknum},Sa(e.history))),yO(e)]))},IO=function(e){return f(Mk,M([Gk(Xk),oN(8),UD,mT(Vk),pT(Vk)]),wO(e))},AO={$:"ToggleChat"},BO=function(e){if(e.showChatHistory){var t=f($c,Kk,f(Io,IO,e.chatHistoryModel));return f(Mk,M([pT(Vk),mT(jk(500)),eR(20),_N]),l(k_,M([pT(Vk),mT(Vk)]),f(Yi,pE,t),AO))}return Kk},kO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},NO=function(e){return HR(e)+" "+e.fiatType},RO={$:"AbortAction"},$O=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),_O=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return Kk}if("LoadedTrade"!==t.b.$)return Kk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=NO(n.terms.price),u=n$(Rb(i)),s=n$(n.parameters.tradeAmount)+" "+IR(n.factory),c=function(){return"Buyer"===kO(n.parameters).$?L(f(Mk,M([lR,vA(_R)]),ul("buyer")),M([ul("pay the seller "),f(Mk,M([vA(C_)]),ul(o)),ul(" in exchange for the "),f(Mk,M([vA(C_)]),ul(s)),ul(" held in this contract.")])):L(f(Mk,M([lR,vA(_R)]),ul("seller")),M([ul("accept "),f(Mk,M([vA(C_)]),ul(o)),ul(" from the buyer in exchange for the "),f(Mk,M([vA(C_)]),ul(s)),ul(" held in this contract.")]))}(),d=c.a,h=c.b;return l(k_,yr,f(PN,M([IN(20),eR(20),EN,pT(Vk),W$]),M([f(Mk,M([vN(26),hN,EN,JN]),ul("Just to Confirm...")),f(PN,M([IN(20),EN,JN]),f(xa,kN(M([EN,vN(18),lR,vA(x_)])),U(M([U(M([ul("You will deposit "),f(Mk,M([vA(C_)]),ul(u+" "+IR(n.factory))),ul(", thereby becoming the "),d,ul(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([ul("(This ususally requires two Metamask signatures. Your "+IR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Mk,M([X_,EN]),f(Y_,"Yes, I definitely want to commit to this trade.",l($O,n,a,i)))])),RO);case"ApproveNeedsSig":return W_(M([ul("Waiting for user signature for the approve call."),ul("(check Metamask!)"),ul("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return W_(M([ul("Mining the initial approve transaction..."),f(cA,M([Z_,vA(C_)]),{label:ul("See the transaction on Etherscan"),url:f(J_,n.factory,p)}),ul("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return W_(M([ul("Waiting for user signature for the final commit call."),ul("(check Metamask!)"),ul("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return W_(M([ul("Mining the final commit transaction..."),f(cA,M([Z_,vA(C_)]),{label:ul("See the transaction"),url:f(J_,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(k_,yr,f(PN,M([IN(20),eR(20),EN,pT(Vk),W$]),M([f(Mk,M([vN(26),hN,EN,JN]),ul("Just to Confirm...")),f(PN,M([IN(20),EN,JN]),f(xa,kN(M([EN,vN(18),lR,vA(x_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([ul('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 '+IR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([ul("Aborting will incur a small penalty on both parties, and refund the rest of the "+IR(n.factory)+".")])]);case"Release":return M([M([ul("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([ul("This will destroy the "+IR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Mk,M([X_,EN]),function(e){return f(Y_,e,LE(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 "+IR(n.factory)+".";default:return"I understand. Burn the "+IR(n.factory)+"."}}()))])),RO);case"ActionNeedsSig":var g=r.a;return W_(M([ul("Waiting for user signature for the "+PE(g)+" call."),ul("(check Metamask!)")]));default:var g=r.a,p=r.b;return Kk}},LO=ON(M([mT(Vk),Gk(Xk),oN(5),eR(20),OD,UD])),xO=function(e){return f(ON,M([IN(8)]),M([f(sR,yr,oL),f(Mk,M([vN(24),lR]),ul(n$(e)))]))},PO=r(function(e,t){var r=f(To,wo(e),f(Io,function(e){return e.address},Hd(t)));return f(QL,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"}(),xO(e.parameters.tradeAmount))}),DO=function(e){return f(ON,M([IN(5)]),M([ox(e.fiatType),f(Mk,M([vN(24),lR]),ul(NO(e)))]))},UO=function(e){return f(QL,"For Fiat",DO(e.terms.price))},OO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},MO=l(Pk,250,165,22),FO=l(Pk,255,0,0),VO=l(Pk,0,255,0),KO=nR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),HO=nR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),jO=nR({description:"released",src:"/DAIHard/static/img/released.svg"}),qO={$:"ToggleStatsModal"},GO=function(e){return f(TO,Ua,e)},zO=n(function(e,t,n){var a=ty(f(xa,function(e){return f(gl,function(e){return R(f(Ao,e,n),si(t))},f(xS,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(uh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(uh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Gl,amountReleased:Gl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Io,Ol,Yl(GO(f(xS,function(e){return function(e){return e?si(e):ci}(Vd(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}}),YO=r(function(e,t){return d(z_,x(d(jR,0,0,1,1),d(jR,0,0,1,.8),d(jR,0,0,1,.6)),Xk,e,t)}),WO=function(e){return{$:"ViewUserHistory",a:e}},JO=f(zB,0,yr),QO=f(nN,dN,BT.textNormalWeight),XO=r(function(e,t){return Za(e/t)}),ZO=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}}),eM=r(function(e,t){var r=e.a,n=e.b;return l(ZO,r,f(XO,Vd(t),6e4),n)}),tM=r(function(e,t){return f(Ns,24,f(XO,f(eM,e,t),60))}),rM=r(function(e,t){return f(Ns,1e3,Vd(t))}),nM=r(function(e,t){return f(Ns,60,f(eM,e,t))}),aM={$:"Apr"},iM={$:"Aug"},oM={$:"Dec"},uM={$:"Feb"},sM={$:"Jan"},cM={$:"Jul"},fM={$:"Jun"},lM={$:"Mar"},dM={$:"May"},hM={$:"Nov"},pM={$:"Oct"},gM={$:"Sep"},vM=function(e){var t=f(XO,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)}},yM=r(function(e,t){switch(vM(f(eM,e,t)).month){case 1:return sM;case 2:return uM;case 3:return lM;case 4:return aM;case 5:return dM;case 6:return fM;case 7:return cM;case 8:return iM;case 9:return gM;case 10:return pM;case 11:return hM;default:return oM}}),mM=r(function(e,t){return f(Ns,60,f(XO,Vd(t),1e3))}),bM={$:"Fri"},CM={$:"Mon"},EM={$:"Sat"},SM={$:"Sun"},TM={$:"Thu"},wM={$:"Tue"},IM={$:"Wed"},AM=r(function(e,t){switch(f(Ns,7,f(XO,f(eM,e,t),1440))){case 0:return TM;case 1:return bM;case 2:return EM;case 3:return SM;case 4:return CM;case 5:return wM;default:return IM}}),BM=n(function(e,t,r){return e.toAmPm(f(tM,t,r))}),kM=r(function(e,t){return vM(f(eM,e,t)).day}),NM=kM,RM=M([SM,CM,wM,IM,TM,bM,EM]),$M=r(function(e,t){return function(e){return e.a}(f($c,L(0,SM),Yl(f(gl,function(r){return R(r.b,f(AM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),RM)))))}),_M=function(e){return l(Ra,Na,0,e)},LM=r(function(e,t){return vM(f(eM,e,t)).year}),xM=function(e){return!f(Ns,4,e)&&(!!f(Ns,100,e)||!f(Ns,400,e))},PM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return xM(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}}),DM=M([sM,uM,lM,aM,dM,fM,cM,iM,gM,pM,hM,oM]),UM=r(function(e,t){return f($c,L(0,sM),Yl(f(gl,function(r){r.a;return R(r.b,f(yM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),DM))))}),OM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(UM,e,t))}),MM=r(function(e,t){var r=f(sc,f(OM,e,t)-1,DM);return _M(f(xa,PM(f(LM,e,t)),r))+f(NM,e,t)}),FM=r(function(e,t){return f(OM,e,t)/4|0}),VM=r(function(e,t){var r=Ni(t),n=e-Yo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),KM=function(e){return e?e<=12?e:e-12:12},HM=iv(315576e5),jM=r(function(e,t){return Ol(HM*f(LM,e,t))}),qM=r(function(e,t){var r=f(jM,e,t),n=f($M,e,r);return 1+((f(MM,e,t)+n)/7|0)}),GM=r(function(e,t){return Ni(f(LM,e,t))}),zM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(OM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(OM,t,r));case"MonthFixed":return f(VM,2,f(OM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(yM,t,r));case"MonthNameFull":return e.toMonthName(f(yM,t,r));case"QuarterNumber":return Ni(1+f(FM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(FM,t,r));case"DayOfMonthNumber":return Ni(f(NM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(NM,t,r));case"DayOfMonthFixed":return f(VM,2,f(NM,t,r));case"DayOfYearNumber":return Ni(f(MM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(MM,t,r));case"DayOfYearFixed":return f(VM,3,f(MM,t,r));case"DayOfWeekNumber":return Ni(f($M,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f($M,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(AM,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(AM,t,r));case"WeekOfYearNumber":return Ni(f(qM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(qM,t,r));case"WeekOfYearFixed":return f(VM,2,f(qM,t,r));case"YearNumberLastTwo":return f(nu,2,f(GM,t,r));case"YearNumber":return f(GM,t,r);case"AmPmUppercase":return ID(l(BM,e,t,r));case"AmPmLowercase":return id(l(BM,e,t,r));case"HourMilitaryNumber":return Ni(f(tM,t,r));case"HourMilitaryFixed":return f(VM,2,f(tM,t,r));case"HourNumber":return Ni(KM(f(tM,t,r)));case"HourFixed":return f(VM,2,KM(f(tM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(tM,t,r));case"HourMilitaryFromOneFixed":return f(VM,2,1+f(tM,t,r));case"MinuteNumber":return Ni(f(nM,t,r));case"MinuteFixed":return f(VM,2,f(nM,t,r));case"SecondNumber":return Ni(f(mM,t,r));case"SecondFixed":return f(VM,2,f(mM,t,r));case"MillisecondNumber":return Ni(f(rM,t,r));case"MillisecondFixed":return f(VM,3,f(rM,t,r));default:return n.a}}),YM=a(function(e,t,r,n){return f(Ri,"",f(xa,l(zM,e,r,n),t))}),WM=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),JM=function(e){return e>11?"pm":"am"},QM=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"}},XM=function(e){switch(f(Ns,100,e)){case 11:case 12:case 13:return"th";default:switch(f(Ns,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},ZM=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"}},eF=p(WM,QM,f(jo,QM,Zo(3)),ZM,f(jo,ZM,Zo(3)),JM,XM),tF=YM(eF),rF={$:"MonthNameFull"},nF=rF,aF=function(e){return{$:"Text",a:e}},iF=aF,oF={$:"YearNumber"},uF=oF,sF=n(function(e,t,n){var a=r(function(e,t){return f(PN,M([vN(18),IN(6)]),M([f(Mk,M([NN]),ul(e)),f(Mk,M([QO]),ul(t))]))}),i=tF(M([nF,iF(", "),uF])),o=f(PN,M([IN(23),mT(Vk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,JO,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+n$(n.amountReleased)+" "+IR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+n$(n.amountBurned)+" "+IR(e)+" Burned")])),M([f(Mk,M([EN]),f(YO,"View User History",WO(n.asRole)))])));return f(PN,M([oN(8),nU,aU,Gk(ER),IN(1),q$({blur:20,color:d(jR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Mk,M([mT(Vk),Gk(Xk),eR(17)]),f(p$,18,t)),f(Mk,M([mT(Vk),Gk(Xk),eR(17)]),o)]))}),cF=n(function(e,t,r){var n=l(zO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=OO(e.parameters.initiatorRole)+" Stats";return f(Mk,r?M([zL(f(Mk,M([YL(30),_N]),l(sF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(QL,a,f(ON,M([mT(Vk),IN(20),aN,lN(qO)]),f(xa,ON(M([IN(5)])),M([M([f(sR,M([pT(jk(28))]),jO),f(Mk,M([vN(24),lR,vA(VO)]),ul(l(Bs,2,P("0"),Ni(n.numReleases))))]),M([f(sR,M([pT(jk(28))]),KO),f(Mk,M([vN(24),lR,vA(MO)]),ul(l(Bs,2,P("0"),Ni(n.numAborts))))]),M([f(sR,M([pT(jk(28))]),HO),f(Mk,M([vN(24),lR,vA(FO)]),ul(l(Bs,2,P("0"),Ni(n.numBurns))))])])))))}),fF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+cl(t)}e.a;return"https://kovan.etherscan.io/address/"+cl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+cl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+cl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+cl(t)}}),lF=n(function(e,t,r){return f(cA,e,{label:ul(cl(r)),url:f(fF,t,r)})}),dF=function(e){return f(QL,"Trade Status",f(PN,M([vN(24),lR,IN(8)]),M([ul(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(lF,M([vN(12),vA(C_),Z_]),e.factory,e.creationInfo.address)])))},hF=i(function(e,t,r,n,a){return LO(M([dF(t),f(PO,t,r),UO(t),l(cF,t,n,a)]))}),pF=l(Pk,9,32,107),gF=nR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),vF=f(Mk,M([oN(4),aN,lN(AO),eR(5),Gk(l(Pk,22,0,255))]),f(sR,M([mT(jk(42))]),gF)),yF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},mF=function(e){return f(PN,M([oN(12),Gk(ER),eR(15),IN(15)]),M([f(Mk,M([vN(24),hN,IU]),ul("Fiat Payment Method")),f(kN,M([vN(18),pT(vT),Gk(Xk),q$({blur:5,color:d(jR,0,0,0,.2),offset:L(-3,3),size:0}),oN(3),eR(5)]),M([f($c,f(Mk,M([vA(xD),IU]),ul("No payment methods found.")),f(Io,ul,f(Io,function(e){return e.info},Yl(e))))]))]))},bF={$:"Active"},CF=function(e){return{$:"ExpandPhase",a:e}},EF=M([Gk(pF),vA(Xk)]),SF=r(function(e,t){return{$:"Min",a:e,b:t}}),TF=r(function(e,t){return f(SF,e,t)}),wF=function(e){return M(e?[oN(12),n_,pT(f(TF,380,vT))]:[oN(12),EN])},IF=M([Gk(Xk)]),AF=nR({description:"flame",src:"/DAIHard/static/img/flame.png"}),BF=r(function(e,t){return Fl(f(cs,Vl(e),Vl(t)))}),kF=r(function(e,t){return d(z_,x(d(jR,1,.6,.2,1),d(jR,1,.6,.2,.8),d(jR,1,.6,.2,.6)),Xk,e,t)}),NF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),RF=function(e){return{$:"ContractActionClicked",a:e}},$F={$:"Web3Connect"},_F=n(function(e,t,r){var n=Hd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(RR,e,t).$?Kk:f(ON,M([IN(8)]),function(){var e=x(t.state.phase,f(wo,t,a.address),f(Ao,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,LE,f(YO,"Remove and Refund this Trade",$E))])}break e}var r=(e.a,e.b,Vl(fb(t.parameters)));return M([f(Y_,"Deposit and Commit to Trade",l(NF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,RF,f(kF,"Abort Trade",vE)),f(Yi,RF,f(Y_,"Confirm Payment",TE)),vF])}e.a,e.c.a;return M([vF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,RF,f(Y_,"Burn it All!",SE)),f(Yi,RF,f(YO,"Release Everything",_E)),vF])}e.a,e.c.a;return M([vF])}break e;default:break e}return yr}())}return f(Y_,"Connect to Wallet",$F)}),LF={$:"Finished"},xF={$:"NotStarted"},PF=r(function(e,t){var r=L(yR(t),yR(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?xF:R(n,a)?bF:LF}),DF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),UF=r(function(e,t){return l(DF,yr,e,t)}),OF=a(function(e,t,r,n){var a=n$(f(uh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+IR(r.factory),i=n$(r.parameters.tradeAmount)+" "+IR(r.factory),o=f(ON,yr,f(UF,3,f(sR,M([pT(jk(18))]),AF))),u=f(Da,Mk(M([vA(l(lA,1,0,0))])),ul),s=R(e,r.state.phase),c=f(To,Ao(r),f(Io,function(e){return e.address},Hd(n))),d=s?Xk:_R,h=kN(M([vA(d),vN(18),hN])),p=NO(r.terms.price),g=s?l(Pk,0,226,255):l(Pk,16,7,234),v=f(Da,Mk(M([vA(g)])),ul),y=n$(r.parameters.buyerDeposit)+" "+IR(r.factory),m=r.parameters.abortPunishment,b=n$(m)+" "+IR(r.factory),C=n$(f(BF,r.parameters.buyerDeposit,m))+" "+IR(r.factory),E=n$(f(BF,r.parameters.tradeAmount,m))+" "+IR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([ul("Your "),u("burnable deposit"),ul(" of "),v(y),ul(" is now held in this contract, and your offer to buy "),v(i),ul(" for "),v(p),ul(" is now listed in the marketplace.")]),M([ul("If another user likes your offer, they can become the Seller by depositing the full "),v(i),ul(" into this contract.")]),M([ul("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),ul(" to you.")])])):f(xa,h,M([M([ul("Your offer to sell the "),v(i),ul(" held in this contract for "),v(p),ul(" is now listed in the marketplace.")]),M([ul("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),ul(" of 1/3 of the trade amount "),v("("+y+")"),ul(" into this contract.")]),M([ul("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),ul(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([ul("You must now pay the Seller "),v(p),ul(" via the Fiat Payment Method, "),f(Mk,M([hN]),ul("and then click ")),u("Confirm Payment"),ul(" before the payment window runs out. Use the chat to coordinate.")]),M([ul("If you abort the trade, or do not confirm payment before this time is up, "),v(b),ul(" (1/4 of the "),u("burnable deposit"),ul(") will be "),u("burned"),ul(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ul(" to the Seller, "),v(C),ul(" to you).")]),M([ul("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),ul(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([ul("Work and communicate with the Buyer to receive "),v(p),ul(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([ul("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),ul(" (1/4 of the "),u("burnable deposit"),ul(") will be "),u("burned"),ul(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ul(" to you, "),v(C),ul(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([ul("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),ul(" will be released to you.")]),M([ul("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),ul(" In this case the "),v(a),ul(" will be lost to both parties.")]),M([ul("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([ul("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([ul("So, have you recieved the "),v(p),ul("? If so, you can click "),v("Release Everything"),ul(".")]),M([ul("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),ul(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([ul("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([ul("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([ul("The Seller has deposited "),v(i),ul(" into this contract, and offers to sell it for "),v(p),ul(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),ul(" into this contract by clicking "),u("Deposit and Commit to Trade"),ul(".")]),M([ul("If the trade is successful, the combined "+IR(r.factory)+" balance "),v("("+a+")"),ul(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,ul(" for both parties (see Payment Window for more on this).")]),M([ul("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),ul(" within the payment window.")])])):f(xa,h,M([M([ul("The Buyer is offering to buy "),v(i),ul(" for "),v(p),ul(", and has deposited "),v(y),ul(" into this contract as a "),u("burnable deposit"),ul(". To become the Seller, deposit "),v(i),ul(" into this contract by clicking "),u("Deposit and Commit to Trade"),ul(".")]),M([ul("When you receive the "),v(p),ul(" from the Buyer, the combined "+IR(r.factory)+" balance "),v("("+a+")"),ul(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,ul(" for both parties (see Payment Window for more on this).")]),M([ul("Don't commit unless you can receive "),v(p),ul(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([ul("During this phase, the Buyer is expected to transfer "),v(p),ul(" to the Seller, as described in Fiat Payment Method, "),f(Mk,M([hN]),ul("and ")),u("Confirm the Payment "),ul(" before the payment window runs out. This would move the trade to the final phase.")]),M([ul("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),ul(" (1/4 of the "),u("burnable deposit"),ul(" amount) will be "),u("burned"),ul(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),ul(" to the Seller, "),v(C),ul(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([ul("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([ul("If the Seller can verify he has received the "),v(p),ul(", he will probably release the total balance of "),v(i),ul(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),ul(".")]),M([ul("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),ul(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(PN,M([mT(Vk),pT(Vk),eR(20),IN(30)]),M([f(ON,M([mT(Vk)]),M([f(Mk,M([vN(24),hN,vA(g),S$]),ul(T))])),f(PN,M([mT(Vk),JN,IN(13)]),w),f(Mk,M([_N]),function(){switch(f(PF,r,e).$){case"Active":return l(_F,t,r,n);case"NotStarted":return f(Mk,M([vN(20),hN,IU,vA(vR)]),ul("Phase not yet started."));default:return f(Mk,M([vN(20),hN,IU]),ul("Phase no longer active."))}}())]))}),MF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},FF=nR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),VF=nR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),KF={$:"None"},HF=KF,jF=nR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),qF=function(e){switch(e.$){case"Open":return jF;case"Committed":return FF;case"Judgment":return VF;default:return HF}},GF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),zF=a(function(e,t,r,n){return d(GF,e,t,r,n)}),YF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},WF=function(e){return function(e){return d(zF,e.red,e.green,e.blue,e.alpha)}(YF(e))},JF=function(e){return{$:"Circle",a:e}},QF=JF,XF=d(GF,0,0,0,1),ZF={$:"Flat"},eV={$:"Sharp"},tV=function(e){return{$:"Uniform",a:e}},rV=tV,nV={cap:ZF,dashPattern:yr,dashPhase:0,fill:rV(XF),join:eV,thickness:2},aV=n(function(e,t,r){return D(nV,{dashPattern:e,fill:r,thickness:t})}),iV=aV(yr),oV={$:"Transparent"},uV=oV,sV=f(iV,0,uV),cV=r(function(e,t){return{$:"Shape",a:e,b:t}}),fV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},lV=function(e){return f(Da,fV,cV(e))},dV=function(e){return lV(L(e,sV))},hV=function(e){return L(-e.a,-e.b)},pV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),gV=r(function(e,t){return f(pV,hV(e(t)),t)}),vV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},yV=r(function(e,t){return{$:"Path",a:e,b:t}}),mV=kr,bV=Nr,CV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=bV(n),i=mV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},EV=function(e){return xa(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)})},SV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(EV,e,M([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),TV=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},wV=function(e){var t=IV(e.basic),r=vV(f(xa,CV(e),t)),n=r.a,a=r.b;return{toBottom:-f($c,0,dI(a)),toLeft:-f($c,0,dI(n)),toRight:f($c,0,lI(n)),toTop:f($c,0,lI(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(SV,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(SV,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(SV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(EV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(yV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(EV,R(C,ZF)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(SV,0,E);case"Group":var S=e.a;return f(EV,0,ty(f(xa,f(jo,wV,TV),S)));default:var T=e.b;return f(EV,0,TV(wV(T)))}},AV=function(e){var t=wV(e);return t.toTop+t.toBottom},BV=function(e){var t=wV(e);return L(-t.toLeft,t.toTop)},kV=function(e){var t=wV(e);return t.toLeft+t.toRight},NV=En("http://www.w3.org/2000/svg"),RV=NV("svg"),$V=Nn("height"),_V=Nn("version"),LV=Nn("width"),xV=NV("circle"),PV=NV("ellipse"),DV=NV("foreignObject"),UV=NV("g"),OV=NV("image"),MV=NV("polygon"),FV=NV("polyline"),VV=NV("rect"),KV=Cw,HV=NV("text"),jV=Nn("id"),qV=Nn("points"),GV=Nn("r"),zV=Nn("rx"),YV=Nn("ry"),WV=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},JV=function(e){return{$:"Group",a:e}},QV=Nn("dominant-baseline"),XV=Nn("fill"),ZV=Nn("fill-opacity"),eK=Nn("font-family"),tK=Nn("font-size"),rK=Nn("font-style"),nK=Nn("font-variant"),aK=Nn("font-weight"),iK=Nn("opacity"),oK=Nn("stroke"),uK=Nn("stroke-dasharray"),sK=Nn("stroke-dashoffset"),cK=Nn("stroke-linecap"),fK=Nn("stroke-linejoin"),lK=Nn("stroke-opacity"),dK=Nn("stroke-width"),hK=Nn("text-anchor"),pK=Nn("text-decoration"),gK=Nn("transform"),vK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},yK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},mK=n(function(e,t,r){return d(GF,e,t,r,1)}),bK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return iv(1e4*e)/100};return yd(M(["rgba(",gw(i(t)),"%,",gw(i(r)),"%,",gw(i(n)),"%,",gw(function(e){return iv(1e3*e)/1e3}(a)),")"]))},CK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},EK=function(e){var t=CK(e),r=t.red,n=t.green,a=t.blue;return bK(l(mK,r,n,a))},SK=function(e){if("Uniform"===e.$){var t=e.a;return EK(t)}return"none"},TK=function(e){var t=CK(e),r=t.alpha;return gw(r)},wK=function(e){if("Uniform"===e.$){var t=e.a;return TK(t)}return"0"},IK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},AK=function(e){var t=gw(e.scale.b),r=gw(e.scale.a),n=gw(-e.rotation/2/x$*360),a=gw(-e.shift.b),i=gw(e.shift.a);return yd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},BK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([oK(SK(r.fill)),lK(wK(r.fill)),dK(gw(r.thickness)),cK(vK(r.cap)),fK(IK(r.join)),XV("none"),iK(gw(e.opacity)),gK(AK(e)),sK(Ni(r.dashPhase)),uK(yK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([XV(SK(a)),ZV(wK(a)),oK(SK(r.fill)),lK(wK(r.fill)),dK(gw(r.thickness)),cK(vK(r.cap)),fK(IK(r.join)),iK(gw(e.opacity)),gK(AK(e)),sK(Ni(r.dashPhase)),uK(yK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([XV(SK(tV(o.color))),eK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),tK(Ni(o.size)),aK(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"}}()),rK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),nK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),pK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),hK("middle"),QV("middle"),gK(AK(e))]);default:return M([gK(AK(e))])}},kK=Nn("x"),NK=Nn("y"),RK=r(function(e,t){return M([LV(gw(e)),$V(gw(t)),kK(gw(-e/2)),NK(gw(-t/2))])}),$K=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([gw(t),gw(-r)]))},e))},_K=cN,LK=r(function(e,t){return f(e,t.a,t.b)}),xK=function(e){return f(xa,LK(_K),e)},PK=function(e){e:for(;;){var t=f($c,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(FV,U(M([jV(t),qV($K(i))]),U(BK(e),xK(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(MV,U(M([jV(t),qV($K(i))]),U(BK(e),xK(e.handlers))),yr);case"Circle":var c=s.a;return f(xV,U(M([jV(t),GV(gw(c))]),U(BK(e),xK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(PV,U(M([jV(t),zV(gw(d)),YV(gw(h))]),U(BK(e),xK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(VV,U(M([jV(t),zV(gw(c)),YV(gw(c))]),U(f(RK,p,g),U(BK(e),xK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(yV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(HV,U(M([jV(t)]),U(BK(e),xK(e.handlers))),M([KV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(OV,U(M([jV(t),WV(C)]),U(f(RK,p,g),U(BK(e),xK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(DV,U(M([jV(t)]),U(f(RK,p,g),U(BK(e),xK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(UV,f(ka,jV(t),U(BK(e),xK(e.handlers))),l(Ra,r(function(e,t){return f(ka,PK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:JV(M([w,I]))});e=v;continue e}}},DK=r(function(e,t){var r=e.a,n=e.b,a=gw(r),i=gw(n);return f(VT,yr,M([f(RV,M([LV(a),$V(i),_V("1.1")]),M([PK(t)]))]))}),UK=function(e){return f(DK,L(kV(e),AV(e)),f(gV,BV,e))},OK=r(function(e,t){var r=qF(e),n=function(){switch(t.$){case"NotStarted":return l(Pk,10,33,108);case"Active":return l(Pk,0,100,170);default:return l(Pk,1,129,104)}}(),a=sx(UK(f(dV,rV(WF(n)),QF(50))));return f(Mk,M([EN,d_(f(sR,M([EN,JN,pT(jk(60))]),r))]),a)}),MK=function(e){var t=M([IU,hN,vN(20)]);switch(e.$){case"Active":return f(Mk,U(t,M([vA(mN)])),ul("Active"));case"NotStarted":return f(Mk,U(t,M([vA(vR)])),ul("Not Started"));default:return f(Mk,t,ul("Finished"))}},FK=n(function(e,t,r){var n=f(PF,t,e),a=function(){return"Active"===n.$?l(Pk,0,226,255):_R}(),i=f(Mk,M([vA(a),vN(20),hN,EN]),ul(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 Kk;switch(n.$){case"NotStarted":return d(WR,M([EN]),M([vN(22),lR]),L(_R,ER),f(kR,e,t));case"Active":var a=f(RR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(r$,M([EN]),M([vN(22),lR]),L(Xk,ER),i)}return f(PN,M([EN,IN(10)]),M([f(Mk,M([EN]),ul(MF(e))),f(YO,"Poke",LE(RE))]));default:return f(Mk,M([pT(jk(1))]),Kk)}}();return f(PN,M([eR(20),IN(10),pT(Vk)]),M([f(Mk,M([n_,EN]),i),f(Mk,M([pT(Vk),EN]),f(Mk,M([JN]),f(OK,e,n))),f(PN,M([IN(10),X_,EN]),M([f(Mk,M([EN]),MK(n)),o]))]))}),VK=o(function(e,t,r,n,a,i){var o=f(PF,r,t),u=f(Mk,M([eR(10),mT(Vk),pT(Vk)]),d(OF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Ol(0)}}(),c=l(FK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(NR,f(gb,r.state.phaseStartTime,s),i);default:Ol(0)}}(),f(Mk,M([pT(Vk),mT(jk(1)),Gk(function(){return"Active"===o.$?l(lA,0,0,1):ER}())]),Kk)),p=a?f(ON,U(wF(e),U(R(o,bF)?EF:IF,M([mT(Vk)]))),M([c,h,u])):f(ON,U(wF(e),U(R(o,bF)?EF:IF,M([aN,lN(CF(t))]))),M([c]));return!e&&R(o,bF)?f(PN,M([mT(Vk),IN(20),v$({bottom:20,left:0,right:0,top:0})]),M([p,mF(r.terms.paymentMethods)])):p}),KK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(ON,M([EN,oN(12),eR(30),IN(10),Gk(pF),vN(24),hN,vA(Xk)]),M([ul("Trade "+yF(t.state.closedReason)),vF])):e?f(PN,M([mT(Vk),IN(10)]),M([f(ON,M([mT(Vk),pT(vT),IN(20)]),M([p(VK,e,bo,t,n,R(r,bo),a),p(VK,e,yo,t,n,R(r,yo),a),p(VK,e,mo,t,n,R(r,mo),a)])),mF(t.terms.paymentMethods)])):f(PN,M([mT(Vk),pT(vT),IN(20)]),M([p(VK,e,bo,t,n,R(r,bo),a),p(VK,e,yo,t,n,R(r,yo),a),p(VK,e,mo,t,n,R(r,mo),a)]))}),HK=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(PN,M([mT(Vk),pT(Vk),IN(40)]),M([h(hF,t,i,n.wallet,r,n.showStatsModal),f(Mk,M([mT(Vk),f(tN,40,0),IN(40)]),h(KK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Mk,M([EN,JN,vN(30)]),ul("Loading trade info..."));default:return f(Mk,M([EN,JN,vN(30)]),ul("Invalid trade"))}}(),M([BO(n),_O(n)]))}),jK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),qK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(AU,yr);case"CreateModel":var n=r.a;return L(f(Yi,xy,gU(n)),yr);case"TradeModel":var a=r.a;return l(jK,Yi(Uy),xa(Yi(Uy)),d(HK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,uT,l(pO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,nT,l(p_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Mk,M([mT(Vk),pT(Vk),oN(10)]),n),a)}),GK=function(e){return{$:"DismissNotice",a:e}},zK=function(e){return f(O$,zU,YU(e))},YK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(lA,1,1,1):l(lA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Pk,100,200,255);case"Caution":return l(Pk,255,188,0);case"Error":return l(Pk,255,70,70);default:return l(Pk,200,200,200)}}(),o=f(Mk,M([_N,n_,M$(5),zK(5)]),E_(GK(t)));return f(Mk,M([Gk(i),oN(10),eR(8),mT(Vk),f$(1),s$(d(jR,0,0,0,.15)),UD]),f(PN,M([IN(4),mT(Vk)]),f(Bi,r(function(e,t){return f(kN,M([mT(Vk),vA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},WK=function(e){return R(e,yr)?yr:M([f(PN,M([WU(20),M$(20),IN(10),_N,X_,mT(jk(300)),vN(15)]),f(xa,YK,f(gl,function(e){return R(e.b.align,al)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(PN,M([zK(20),YL(100),IN(10),S$,n_,mT(jk(300)),vN(15)]),f(xa,YK,f(gl,function(e){return R(e.b.align,yB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},JK=r(function(e,t){var r=f(qK,e,t),n=r.a,a=r.b;return L(f(PN,M([XR(zk),d_(MN(t)),mT(Vk),pT(Vk),eR(30)]),M([f(Mk,M([pT(jk(50))]),Kk),n])),U(a,WK(t.userNotices)))}),QK=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),XK=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),ZK={$:"AllowHover"},eH={$:"Layout"},tH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(fA,155/255,203/255,1,1),offset:L(0,0),size:3})},rH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?tH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?ZK:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?eH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},nH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(TT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),TT);case"Text":var a=t.a;return kI(a);default:return kI("")}}),aH=n(function(e,t,r){var n=rH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?QK(n):XK(n)}();return f(nH,a,d(uA,TT,Ok,t,ET(M([r]))))}),iH=JT(5),oH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),uH={$:"SansSerif"},sH=function(e){return{$:"Typeface",a:e}},cH=Y,fH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",cH(id(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",cH(id(t)));default:var t=e.a.name;return f(Ri,"-",cH(id(t)))}}())}),lH=function(){var e=M([sH("Open Sans"),sH("Helvetica"),sH("Verdana"),uH]);return M([f(pA,qk,l(hA,"bg-color-"+gA(d(fA,1,1,1,0)),"background-color",d(fA,1,1,1,0))),f(pA,dA,l(hA,"font-color-"+gA(d(fA,0,0,0,1)),"color",d(fA,0,0,0,1))),f(pA,pN,gN(20)),f(pA,iH,f(oH,l(Ra,fH,"font-",e),e))])}(),dH=n(function(e,t,r){var n=e.options;return l(aH,n,f(ka,sA(f(Ri," ",M([BT.root,BT.any,BT.single]))),U(lH,t)),r)}),hH=dH({options:yr}),pH=function(e){return f(pA,iH,f(oH,l(Ra,fH,"ff-",e),e))},gH=uH,vH=sH,yH=function(e){return{body:M([function(){var t=f(JK,e.screenWidth,e),r=t.a,n=t.b,a=U(M([mT(Vk),pT(Vk),pH(M([vH("Soleil"),gH]))]),f(xa,d_,n));return f(hH,a,r)}()]),title:"DAIHard"}},mH=Ht,bH=mH({init:PB,onUrlChange:xk,onUrlRequest:Lk,subscriptions:_k,update:iB,view:yH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:bH(f(cu,function(e){return f(cu,function(t){return f(cu,function(r){return Fi({height:r,networkId:t,width:e})},f(Ph,"height",jC))},f(Ph,"networkId",jC))},f(Ph,"width",jC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file +var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(bp,o,function(e){return si(Cp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,kp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,Bp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=nv(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?qg(o):jg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return nv(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Gg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Yg,zg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(zo,xa(ac),f(zo,Ms,nc))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ph,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ph,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ap)}),i.addEventListener("timeout",function(){a(Np)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Cp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(wp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Yg,zg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Yg,zg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Yg,zg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{options:t,type_:e}}),po={$:"OfferType"},go=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),vo=r(function(e,t){return f(ho,po,M([l(go,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(go,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),yo={$:"Closed"},mo={$:"Committed"},bo={$:"Judgment"},Co={$:"Open"},Eo={$:"Phase"},So=a(function(e,t,r,n){return f(ho,Eo,M([l(go,"Open",e,function(e){return R(e.state.phase,Co)}),l(go,"Committed",t,function(e){return R(e.state.phase,mo)}),l(go,"Judgment",r,function(e){return R(e.state.phase,bo)}),l(go,"Closed",n,function(e){return R(e.state.phase,yo)})]))}),To={$:"Initiator"},wo={$:"Responder"},Io=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),Ao=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(To):f(Io,function(e){return R(t,e)?si(wo):ci},e.state.responder)}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),ko=r(function(e,t){return f(Bo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(Ao,e,t))}),No={$:"Role"},Ro=n(function(e,t,r){return f(ho,No,M([l(go,"Buyer",t,function(t){return R(f(ko,t,e),si(fo))}),l(go,"Seller",r,function(t){return R(f(ko,t,e),si(lo))})]))}),$o=function(e){return{orderBy:e}},_o=$o,Lo={$:"Ascending"},xo={$:"Phase"},Po=Oe,Do=Po(yr),Uo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(So,!0,!0,!0,!1),f(vo,!0,!0),l(Ro,t,!0,!0)])),tradeTable:_o(L(xo,Lo)),wallet:e},Do)}),Oo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Mo={$:"None"},Fo=Mo,Vo=function(e){return d(Oo,e,Do,Fo,yr)},Ko=function(e){return{$:"TradeTableMsg",a:e}},Ho=function(e){return d(Oo,e,Do,Fo,yr)},jo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),qo=r(function(e,t){return f(jo,e,t)}),Go=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),zo=n(function(e,t,r){return t(e(r))}),Yo=r(function(e,t){if("None"===t.$)return Mo;var r=t.a,n=t.b,a=l(Go,f(Bo,Da(e),r.onSign),f(Bo,Da(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return L(f(zo,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(zo,t.toMsg,e)}},n))},r.onMined));return f(jo,a,n)}),Wo=function(e){return{$:"AbiDecoder",a:e}},Jo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Qo=z,Xo=Fr,Zo=r(function(e,t){return e<1?t:l(Xo,e,Qo(t),t)}),eu=Zo(64),tu=n(function(e,t,r){return L(f(Jo,e,eu(t)),r)}),ru=r(function(e,t){return e<1?"":l(Xo,0,e,t)}),nu=ru(64),au=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),iu=function(e){return-e},ou=r(function(e,t){return e<1?"":l(Xo,-e,Qo(t),t)}),uu=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(ru,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(ou,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Wo(function(t){var r=t.a,n=t.b;return f(au,f(tu,r,n),e(nu(n)))})}(),su=Hr,cu=function(e){return f(su,"0x",e)||f(su,"0X",e)?f(Zo,2,e):e},fu=function(e){return e.b},lu=r(function(e,t){var r=e.a;return f(au,fu,r(function(e){return f(Jo,e,e)}(cu(t))))}),du=Xr,hu=ae,pu=Wr,gu=function(e){return f(du,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return hu(a)},pu)},vu=f(zo,lu,gu),yu=function(e){return{$:"Magnitude",a:e}},mu=function(e){return{$:"Pos",a:e}},bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Cu=function(e){return{$:"MagnitudeNotNormalised",a:e}},Eu=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 si(n)}return ci}},Su=function(e){var t=Eu(e);return"Nothing"!==t.$&&t.a<0},Tu=function(e){return{$:"Neg",a:e}},wu={$:"Zer"},Iu=function(e){return!e.b},Au=r(function(e,t){var r=t.a;if(Iu(r))return wu;switch(e.$){case"Zero":return wu;case"Positive":return mu(t);default:return Tu(t)}}),Bu=r(function(e,t){return f(bu,e,Cu(t))}),ku=function(e){return f(La,r(function(t,r){return e(t)&&Iu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Nu=Ir,Ru=-1+f(Nu,10,7),$u=Ru+1,_u=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Lu=function(e){return e<0?f(_u,Na(-1),Lu(e+$u)):L(e/$u|0,e%$u)},xu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Lu(r+e),i=a.a,o=a.b;return f(ka,o,f(xu,i,n))}{if(!(_(e,$u)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Pu=function(e){var t=e.a;return yu(ku(f(xu,0,t)))},Du=xa(iu),Uu={$:"Negative"},Ou={$:"Positive"},Mu={$:"Zero"},Fu=function(e){switch(e.$){case"Positive":return Uu;case"Negative":return Ou;default:return Mu}},Vu=function(e){for(;;){var t=e.a,r=e.b,n=Pu(r),a=n.a;if(!Su(a))return f(Au,t,yu(a));e=f(Bu,Fu(t),Du(a))}},Ku=pr,Hu=function(e){switch(f(Ku,e,0).$){case"LT":return Uu;case"GT":return Ou;default:return Mu}},ju=function(e){return e<0?-e:e},qu=function(e){return Vu(f(bu,Hu(e),Cu(M([ju(e)]))))},Gu=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(Nu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},zu=function(e){switch(e.$){case"Zer":return wu;case"Neg":var t=e.a;return mu(t);default:return e}},Yu=function(e){return{$:"MagnitudePair",a:e}},Wu=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(ka,L(a,u),f(Wu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Wu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Wu,yr,s))}return yr}),Ju=r(function(e,t){var r=e.a,n=t.a;return Yu(f(Wu,r,n))}),Qu=function(e){switch(e.$){case"Zer":return f(Bu,Mu,yr);case"Neg":var t=e.a.a;return f(Bu,Ou,Du(t));default:var t=e.a.a;return f(Bu,Ou,t)}},Xu=r(function(e,t){var r=Qu(t),n=r.b,a=Qu(e),i=a.b,o=f(Ju,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Vu(f(bu,Ou,Cu(s)))}),Zu=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(R(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 Ta}return a.b.b?ba:f(Ku,e,t)}}),es=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},ts=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(Zu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return es(d(Zu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),rs=r(function(e,t){return R(f(ts,e,t),Ta)}),ns=K,as=r(function(e,t){return!f(rs,e,t)}),is=function(e){switch(e.$){case"Zer":return yu(yr);case"Pos":default:var t=e.a;return t}},os=r(function(e,t){var r=e.a;return Pu(Cu(f(xa,ti(t),r)))}),us=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(os,yu(n),a),u=f(us,yu(i),yu(n)),s=u.a,c=f(Xu,f(Au,Ou,o),f(Au,Ou,yu(f(ka,0,s))));return is(c)}var a=r.a;return f(os,yu(n),a)}return yu(yr)}),ss=function(e){switch(e.$){case"Zer":return Mu;case"Pos":return Ou;default:return Uu}},cs=r(function(e,t){return R(e,Mu)||R(t,Mu)?Mu:R(e,t)?Ou:Uu}),fs=r(function(e,t){return f(Au,f(cs,ss(e),ss(t)),f(us,is(e),is(t)))}),ls=function(e){switch(e.$){case"Zer":return wu;case"Pos":var t=e.a;return Tu(t);default:var t=e.a;return mu(t)}},ds=r(function(e,t){return f(Xu,e,ls(t))}),hs=qu(0),ps=a(function(e,t,r,n){if(e){var a=qu(e),i=f(fs,f(fs,a,n),t),o=f(as,i,r)?L(f(fs,a,t),f(ds,r,i)):L(hs,r),u=o.a,s=o.b,c=d(ps,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Xu,u,l),h)}return L(hs,r)}),gs=Fa(f(Va,2,Ru)),vs=n(function(e,t,r){return d(ps,f(Nu,2,gs),e,t,r)}),ys=qu(1),ms=r(function(e,t){return e}),bs=n(function(e,t,r){return l(Ra,ms(e),t,f(Ai,1,r))}),Cs=function(e){return l(bs,fs(qu($u)),ys,e)},Es=n(function(e,t,r){if(e){var n=l(vs,Cs(e),t,r),a=n.a,i=n.b,o=l(Es,e-1,i,r),u=o.a,s=o.b;return L(f(Xu,a,u),s)}return l(vs,Cs(e),t,r)}),Ss=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Ts=r(function(e,t){if(R(t,hs))return ci;var r=Ti(Ss(e))-Ti(Ss(t))+1,n=l(Es,f(ei,0,r),zu(e),zu(t)),a=n.a,i=n.b;return si(L(f(Au,f(cs,ss(e),ss(t)),is(a)),f(Au,ss(e),is(i))))}),ws=f(fs,qu(2),qu(2147483648)),Is=xr,As=function(e){return f(Is,e,"")},Bs=Pn,ks=n(function(e,t,r){return e<=0?r:l(ks,e>>1,U(t,t),1&e?U(r,t):r)}),Ns=r(function(e,t){return l(ks,e,t,"")}),Rs=n(function(e,t,r){return U(f(Ns,e-Qo(r),As(t)),r)}),$s=te,_s=Ar,Ls=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},xs=r(function(e,t){for(;;){if(t<16)return f(ka,Ls(t),e);var r=f(ka,Ls(f(_s,16,t)),e),n=t/16|0;e=r,t=n}}),Ps=function(e){return $s(e<0?f(ka,P("-"),f(xs,yr,-e)):f(xs,yr,e))},Ds=function(e){var t=f(Ts,e,ws);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=Ps(Gu(a));return R(n,qu(0))?i:U(Ds(n),l(Rs,8,P("0"),i))},Us=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,yu(yr))?"0":Ds(mu(t));default:var t=e.a;return"-"+Us(f(fs,qu(-1),e))}},Os=function(e){return l(Rs,64,P("0"),e)},Ms=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(Ps(a)),c=function(e){return U(e,n)}(Os(Ps(u)));return x(a+32+(Qo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Fs=Dr,Vs=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))))}),Ks=n(function(e,t,n){return l(Fs,r(function(t,r){return l(Vs,e,yi(t),r)}),t,n)}),Hs=function(e){return $a(l(Ks,ka,yr,e))},js=function(e){return f(Ri,"",f(xa,f(zo,Ps,f(Rs,2,P("0"))),Hs(e)))},qs=function(e){return 64-f(_s,64,e)},Gs=function(e){return U(e,f(Ns,qs(Qo(e)),"0"))},zs=function(e){return L(si(Qo(e)/2|0),Gs(e))},Ys=function(e){return L(ci,Os(e))},Ws=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Js=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"}},Qs=Ur,Xs=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(Is,P("1"),r),!0);case"1":return L(f(Is,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Is,P("0"),r),!1);case"1":return L(f(Is,P("1"),r),!0);default:break e}return L(r,!0)});return l(Qs,t,L("",!1),e).a},Zs=function(e){return l(Qs,ka,yr,e)},ec=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Zo,e,t),i=f(ka,l(Xo,0,e,t),r);e=n,t=a,r=i}}),tc=r(function(e,t){return e&&""!==t?l(ec,e,t,yr):M([t])}),rc=function(e){var t=function(){var t=Zs(Us(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(zo,Xs,f(Rs,256,P("1"))))}var r=t;return L(r,f(Rs,256,P("0")))}(),r=t.a,n=t.b;return $s(f(xa,Ws,f(tc,4,n(f(Ri,"",f(xa,Js,r))))))},nc=function(e){return{$:"Hex",a:e}},ac=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Ys(t);case"UintE":var r=e.a;return Ys(Us(r));case"IntE":var n=e.a;return Ys(rc(n));case"BoolE":return Ys(e.a?"1":"0");case"DBytesE":var a=e.a.a;return zs(a);case"BytesE":var a=e.a.a;return Ys(cu(a));case"StringE":var i=e.a;return zs(js(i));case"ListE":var o=e.a;return function(e){var t=e.a;return zs(t)}(Xt()(o));default:var i=e.a;return Ys(cu(i))}};try{var ic=Xt();Xt=function(){return ic}}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 oc=Pr,uc=function(e){return 1===Qo(e)?f(oc,"0",e):e},sc=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(ka,n,r);e=i,t=o,r=u}}}),cc=r(function(e,t){return $a(l(sc,e,t,yr))}),fc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(cc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(fc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),lc=r(function(e,t){return l(fc,0,e,t)}),dc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),hc=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 Pt(e.a)}},pc={$:"LE"},gc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,pc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,pc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,pc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,pc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,pc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,pc));case"Seq":var i=e.b;return l(vc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),vc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(gc,n,t,r);e=i,t=o,r=u}}),yc=Dt,mc=r(function(e,t){return{$:"Seq",a:e,b:t}}),bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+hc(r),i=n;e=a,t=i}}),Cc=function(e){return f(mc,f(bc,0,e),e)},Ec=function(e){return{$:"U8",a:e}},Sc=Ec,Tc=r(function(e,t){return _(e,t)<0?e:t}),wc=hr,Ic=function(e){return{$:"Bytes",a:e}},Ac=Ic,Bc=function(e){return yc(Cc(f(xa,Ac,$a(e))))},kc=Pt,Nc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Rc=function(e){return{$:"Decoder",a:e}},$c=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}}),_c=r(function(e,t){return Rc(f($c,e,t))}),Lc=Rc(Yn),xc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Pc=function(e){return{$:"Done",a:e}},Dc=function(e){return{$:"Loop",a:e}},Uc=r(function(e,t){var n=t.a;return Rc(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 Rc(r(function(t,r){return L(r,e)}))},Mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Oc(Pc($a(n))):f(Uc,function(e){return Dc(L(r-1,f(ka,e,n)))},e)}),Fc=function(e){return f(xc,yr,f(Nc,f(_c,L(kc(e),yr),Mc(Lc)),e))},Vc=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))}),Kc=r(function(e,t){return l(Vc,Bs,e,t)}),Hc=f(Ai,0,4),jc=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}}),qc=xt,Gc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),zc=function(e){return f(Gc,f(zo,qc,Bs(4294967295)),e)},Yc=r(function(e,t){return 5*t+e}),Wc=4294967295>>>32-Ha,Jc=ar,Qc=n(function(e,t,r){for(;;){var n=Wc&t>>>e,a=f(Jc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Jc,Wc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Xc=function(e){return e>>>5<<5},Zc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Xc(r))>-1?f(Jc,Wc&e,i):l(Qc,n,e,a))}),ef=r(function(e,t){var r=f(Zc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),tf=n(function(e,t,r){var n=f(Yc,e,t);return f(ef,n,r)}),rf=ir,nf=a(function(e,t,r,n){var a=Wc&t>>>e,i=f(Jc,a,n);if("SubTree"===i.$){var o=i.a,u=d(nf,e-Ha,t,r,o);return l(rf,a,za(u),n)}var s=i.a,c=l(rf,Wc&t,r,s);return l(rf,a,Ga(c),n)}),af=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,Xc(n))>-1?d(Ma,n,a,i,l(rf,Wc&e,t,o)):d(Ma,n,a,d(nf,a,e,t,i),o)}),of=n(function(e,t,r){return l(af,e,t,r)}),uf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(of,a,r,n)}),sf=Dn,cf=r(function(e,t){return l(Vc,sf,e,t)}),ff=function(e){var t=l(La,r(function(t,n){var a={d0:l(tf,0,t,e.state),d1:l(tf,1,t,e.state),d2:l(tf,2,t,e.state),d3:l(tf,3,t,e.state),d4:l(tf,4,t,e.state)},i=r(function(e,r){return d(uf,e,t,f(cf,f(jc,e,a),f(Kc,zc(f(jc,f(_s,5,e+1),a)),f(jc,f(_s,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Hc);return D(e,{state:t})},lf=L(0,0),df=function(e){return{current:lf,lfsrstate:1,state:e,x:1,y:0}},hf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},pf=L(1,0),gf=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),vf=r(function(e,t){if(e){var n=f(gf,1,t);return l(Vc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),yf=r(function(e,t){var r=f(_s,32,e/32|0),n=f(gf,r,t),a=f(_s,32,e);return f(vf,a,n)}),mf=n(function(e,t,r){var n=f(Zc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(af,e,t(a),r)}),bf=n(function(e,t,r){return l(mf,e,cf(t),r)}),Cf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(bf,a,r,n)}),Ef=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Nf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Tc,n,r),i=f(xa,function(e){return f(kf,e,g)},f(Ai,0,a)),o=Bf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(lc,i.outputLen,l(v,g,yr,i.outputLen))},Lf=function(e){return{$:"KS",a:e}},xf=function(e){var t=e.a;return Lf({config:t,inputLength:0,partial:yr,state:f(ui,25,ms(lf))})},Pf=function(e){return Rc(Wn(e))},Df=yc(Cc(yr)),Uf=r(function(e,t){var n=t.a;return Rc(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(Uf,function(e){return Pf(t)},Pf(e))}),Mf=r(function(e,t){return f(xc,Df,f(Nc,f(Of,e,kc(t)-e),t))}),Ff=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=kc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+kc(e)}),0,i),a)>-1))return Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:i}));var o=Bc(i),u=f(xc,Df,f(Nc,Pf(a),o)),s=Fc(u),c=f($f,s,n.state),d=Bf(c),h=f(Mf,a,o),p=Df,g=Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Vf=r(function(e,t){return _f(f(Ff,yc(Cc(f(xa,Sc,t))),xf(e)))}),Kf=Vf(dc),Hf=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,4,Kf(f(xa,yi,Zs(e)))))))},jf=function(e){return f(su,"0x",e)||f(su,"0X",e)?e:"0x"+e},qf=function(e){var t=e.a;return jf(t)},Gf=r(function(e,t){var r=Ms(f(xa,ac,t)),n=function(e){return U(e,r)}(cu(qf(Hf(e))));return nc(n)}),zf=function(e){return{data:si(f(Gf,"poke()",yr)),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yf=r(function(e,t){return D(t,{checked:e})}),Wf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Jf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Wf,f(zo,function(e){return e.type_},Ja(r)),function(e){return D(e,{options:l(Wf,f(zo,function(e){return e.label},Ja(n)),Yf(a),e.options)})},t)}),Qf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Xf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zf={$:"Descending"},el=function(e){return"Ascending"===e.$?Zf:Lo},tl=function(e){return d(Xf,e,Do,Fo,yr)},rl=r(function(e,t){return L(t.a,e(t.b))}),nl=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Xf,t,Do,Fo,M([da(f(Qf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(rl,el,t.orderBy):L(a,Lo);return tl(D(t,{orderBy:i}));default:return tl(t)}}),al=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},il=yn,ol=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=al(zf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(qo,a,n);return d(Oo,t,Do,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Oo,t,Do,Fo,M([da(f(Qf,o,u))]));case"FiltersMsg":var s=e.a;return Ho(D(t,{filters:f(Jf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(nl,c,t.tradeTable);return d(Oo,D(t,{tradeTable:l.model}),f(il,Ko,l.cmd),f(Yo,Ko,l.chainCmd),f(xa,Ji(Ko),l.appCmds));default:return Vo(t)}}),ul={$:"BottomRight"},sl={$:"ShouldBeImpossible"},cl=lr,fl=function(e){return qi(e)},ll=r(function(e,t){f(cl,e,t);return{align:ul,label:"unexpectedError",mainParagraphs:M([M([fl(e)])]),noticeType:sl}}),dl=function(e){var t=e.a;return jf(t)},hl=ye,pl=f(zo,dl,hl),gl=f(zo,Us,f(zo,jf,hl)),vl=f(zo,qf,hl),yl=f(zo,Ps,f(zo,jf,hl)),ml=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),bl=un,Cl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},El=function(e){return Cl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(xc,bl,r))},f(ml,function(e){e.a;return!R(e.b,ci)},e)))},Sl=function(e){return El(M([L("to",f(Bo,pl,e.to)),L("from",f(Bo,pl,e.from)),L("gas",f(Bo,yl,e.gas)),L("gasPrice",f(Bo,gl,e.gasPrice)),L("value",f(Bo,gl,e.value)),L("data",f(Bo,vl,e.data)),L("nonce",f(Bo,yl,e.nonce))]))},Tl=function(e){return{$:"TxSentry",a:e}},wl=ye,Il=r(function(e,t){return Cl(M([L("ref",wl(e)),L("txParams",t)]))}),Al=function(e){return{$:"Signing",a:e}},Bl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Al(e)}}),kl={$:"Black"},Nl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Rl={$:"RBEmpty_elm_builtin"},$l={$:"Red"},_l=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(Nl,$l,t,r,h(Nl,kl,c,f,l,d),h(Nl,kl,i,o,u,s))}return h(Nl,e,i,o,h(Nl,$l,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(Nl,$l,c,f,h(Nl,kl,g,v,y,m),h(Nl,kl,t,r,d,a))}return h(Nl,e,t,r,n,a)}),Ll=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Nl,$l,e,t,Rl,Rl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ku,e,a).$){case"LT":return h(_l,n,a,i,l(Ll,e,t,o),u);case"EQ":return h(Nl,n,a,t,o,u);default:return h(_l,n,a,i,o,l(Ll,e,t,u))}}),xl=n(function(e,t,r){var n=l(Ll,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(Nl,kl,a,i,o,u)}return n}),Pl=n(function(e,t,r){var n=e.a,a=Sl(r),i=l(xl,n.ref,f(Bl,r,t),n.txs);return L(Tl(D(n,{ref:n.ref+1,txs:i})),f(il,n.tagger,n.outPort(f(Il,n.ref,a))))}),Dl=Pl,Ul=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Do,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Dl,n,i,o))}return x(ci,Do,M([f(ll,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ol=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Ml=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Fl=function(e){return{$:"Posix",a:e}},Vl=Fl,Kl={autoabortInterval:Vl(0),autorecallInterval:Vl(0),autoreleaseInterval:Vl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Hl=function(e){return{$:"TokenValue",a:e}},jl=function(e){return e.a},ql=r(function(e,t){return f(xc,hs,f(Bo,Qa,f(Ts,e,t)))}),Gl=r(function(e,t){return Hl(f(ql,jl(e),qu(t)))}),zl=function(e){return f(Gl,e,12)},Yl=function(e){return f(Gl,e,3)},Wl=Hl(qu(0)),Jl=r(function(e,t){var r=Wl;return{abortPunishment:zl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Ql=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Xl=qr,Zl=function(e){var t=Ql(f(Xl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Qo(e)-1-r;return L(U(f(ru,r,e),f(Zo,r+1,e)),n)},ed=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 yr}}),td=function(e){var t=e.a,r=f(ed,Ja(0),t);return yu(r.b?t:yr)},rd=Z,nd=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}}}),ad=n(function(e,t,r){var n=f(nd,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(lc,e,r),l(ad,e,t,n)):yr}),id=r(function(e,t){return l(ad,e,e,t)}),od=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Bo,ka(a),r)});return f(La,t,si(yr))}(Ua),ud=function(e){return f(Bo,f(Da,td,yu),od(f(xa,f(zo,$a,f(zo,$s,rd)),f(id,7,$a(e)))))},sd=Q,cd=function(e){var t=Zs(sd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,Au(Uu),ud(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Bo,Au(Ou),ud(r))}return ci;default:var r=t;return f(Bo,Au(Ou),ud(r))}},fd=function(e){var t=function(e){return!f(_s,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(xc,0,Ql(r)))}},ld=function(e){return f(fs,e,e)},dd=qu(2),hd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ys;case"Neg":return wu;default:if(R(r,ys))return f(fs,e,t);if(fd(r)){var n=e,a=ld(t),i=f(ql,r,dd);e=n,t=a,r=i;continue e}var n=f(fs,t,e),a=ld(t),i=f(ql,f(ds,r,ys),dd);e=n,t=a,r=i;continue e}}),pd=r(function(e,t){return l(hd,ys,e,t)}),gd=function(e){if(""===e)return ci;var t=Zl(e),r=t.a,n=t.b,a=cd(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(fs,o,f(pd,qu(10),qu(i)));return si(u)},vd=function(e){return f(Bo,Hl,gd(e))},yd=jr,md=function(e){for(;;){if(f(yd,".",e))return l(Xo,0,-1,e);{if(!f(yd,"0",e))return""===e?"0":e;e=l(Xo,0,-1,e)}}},bd=f(Da,f(Rs,7,P("0")),Ni),Cd=function(e){return f(Ri,"",e)},Ed=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Cd(f(ka,Ni(n),f(xa,bd,a)))}return"0"},Sd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Ed(t);default:var t=e.a;return"-"+Ed(t)}},Td=r(function(e,t){return e<1?t:l(Xo,0,-e,t)}),wd=function(e){var t=l(Rs,18,P("0"),Sd(e)),r=f(Td,18,t)+"."+f(ou,18,t);return function(e){return""===e?"0":e}(md(r))},Id=r(function(e,t){var r=wd(t),n=Ql(f(Xl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(ru,a+1+e,r):f(ru,a,r)}),Ad=r(function(e,t){if("Nothing"===e.$)return wd(jl(t));var r=e.a;return f(Id,r,jl(t))}),Bd=ee,kd=function(e){var t=Bd(f(Ad,ci,e));if("Just"===t.$){return t.a}f(cl,"Error converting tokenValue to float: string -> float failed",e);return 0},Nd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=vd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return kd(r)<1?fi("Trade amount can't be less than 1."):li(r)},Rd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=cd(e);if("Nothing"===t.$){var r=Bd(e);return fi("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 li(n)},$d=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),_d=function(e){return""===e},Ld=function(e){return _d(e)?ci:si(e)},xd=function(e){return f($d,"You must specify a fiat type.",Ld(e))},Pd=function(e){return""===e?fi("Must specify a payment method."):li(e)},Dd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ud=g(Dd,ci,ci,ci,ci,ci,ci,ci),Od=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Md=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Fd={$:"Custom"},Vd=r(function(e,t){return{info:t,type_:e}}),Kd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Hd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),jd=function(e){return e.a},qd=function(e){return p(Kd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Vd,Fd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Hd,function(e){return D(Ud,{daiAmount:si(e)})},Nd(e.daiAmount)),f(Hd,function(e){return D(Ud,{fiatAmount:si(e)})},Rd(e.fiatAmount)),f(Hd,function(e){return D(Ud,{fiatType:si(e)})},xd(e.fiatType)),f(Hd,function(e){return D(Ud,{paymentMethod:si(e)})},Pd(e.paymentMethod)),Od(d(Md,function(e){return jd(e)>0?li(e):fi(D(Ud,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Gd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},zd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Yd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Wd=function(e){var t=qd(e.inputs),r=function(){return R(e.errors,Ud)?Ud:"Ok"===t.$?Ud:t.a}();return D(e,{createParameters:l(zd,Jl,Gd(e.wallet),Yd(t)),errors:r})},Jd=r(function(e,t){return Wd(D(t,{inputs:e}))}),Qd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Xd=function(e){return d(Qd,f(Jd,Kl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:Ud,inputs:Kl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Do,Fo,yr)},Zd=a(function(e,t,r,n){return la(d(Ol,e,t,r,n))}),eh=function(e){return{$:"Address",a:e}},th=f(zo,cu,f(zo,sd,eh)),rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return th("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return th("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return th("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return th("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nh=function(e){return th("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ah=function(e){return{$:"AddressE",a:e}},ih=ah,oh=function(e){return{$:"UintE",a:e}},uh=oh,sh=n(function(e,t,r){return{data:si(f(Gf,"approve(address,uint256)",M([ih(t),uh(r)]))),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ch=function(e){return f(Gl,e,200)},fh=r(function(e,t){return Hl(f(Xu,jl(e),jl(t)))}),lh=function(e){var t=f(Gl,e.tradeAmount,200);return f(fh,e.pokeReward,f(fh,ch(e.tradeAmount),f(fh,t,function(){return"Buyer"===e.initiatorRole.$?Yl(e.tradeAmount):e.tradeAmount}())))},dh=Mi(ya),hh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ph=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gh=Xn,vh=Qn,yh=function(e){return f(vh,{caseInsensitive:!1,multiline:!1},e)},mh=Jn,bh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ch=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}}),Eh=r(function(e,t){return!f(Ch,f(Da,ns,e),t)}),Sh=Eh(Ua),Th=q,wh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ih=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Ah=f(La,Ih(ka),li(yr)),Bh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},kh=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Nu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Nu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Nu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Nu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Nu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Nu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Nu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Nu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Nu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Nu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Nu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Nu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Nu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Nu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Nu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(As(s)+" is not a valid hexadecimal character.")}}}),Nh=function(e){if(_d(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(su,"-",e)){var t=f(xc,yr,Bh(Zs(e)));return f(au,iu,l(kh,Ti(t)-1,t,0))}return l(kh,Qo(e)-1,Zs(e),0)}();return f(Hd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rh=function(e){var t=Zs(e);return function(e){return L(t,e)}(f(wh,yr,Ah(f(xa,Nh,f(_i,"",f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,20,Kf(f(xa,f(zo,Th,yi),t))))))))))},$h=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Rh(cu(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!bh(e)&&Sh(o)},_h=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-f]{40}$"))),Lh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-F]{40}$"))),xh=function(e){return'"'+e+'"'},Ph=function(e){var t=cu(e),r=f(ru,24,t),n=f(ou,40,e);return 64===Qo(t)&&f(ki,Ja(P("0")),r)?Lh(n)||_h(n)?li(eh(n)):$h(n)?li(eh(n)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):40!==Qo(t)?fi("Given address "+xh(e)+" is not the correct length."):bh(t)?Lh(t)||_h(t)?li(eh(t)):$h(t)?li(eh(t)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):fi("Given address "+xh(e)+" contains invalid hex characters.")},Dh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),Ph(nu(r)))}),Uh=r(function(e,t){var r=t.a;return Wo(function(t){var n=t.a,a=t.b;return r(f(Jo,n,f(Zo,64*e,a)))})}),Oh=Jr,Mh=r(function(e,t){return f(Oh,"data",vu(f(Uh,e,t)))}),Fh=Qr,Vh=r(function(e,t){return f(Oh,"topics",f(Fh,e,vu(t)))}),Kh=function(e){return f(Bo,f(zo,$a,f(Ra,r(function(e,t){return f(Xu,qu(e),f(fs,t,ws))}),hs)),od(f(xa,f(zo,$a,f(zo,$s,f(zo,Nh,Yd))),f(id,8,$a(e)))))},Hh=function(e){var t=Zs(sd(e));e:for(;;){if(!t.b)return ci;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(Bo,fs(qu(-1)),Kh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Bo,fs(qu(-1)),Kh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Kh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kh(a)}t.b;return ci}break e;default:break e}}var a=t;return Kh(a)},jh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f($d,"Error Decoding Uint into BigInt",Hh(jf(nu(r)))))}),qh=f(dh,f(Vh,1,Dh),f(dh,f(Mh,1,Dh),f(dh,f(Mh,0,jh),Fi(hh)))),Gh=nn,zh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Yh=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(Gh,e,Cl(M([L("data",hl(t.data)),L("topics",f(zh,vl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Wh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Jh=r(function(e,t){return f(au,function(e){return e.id},f(Wh,function(e){return f(Hd,Di,f(Yh,qh,e).returnData)},f($d,"No log found from that factoryAddress in that txReceipt",Ql(f(ml,function(t){return R(f(zo,dl,sd)(t.address),f(zo,dl,sd)(rh(e)))},t.logs)))))}),Qh=n(function(e,t,r){return{data:si(f(Gf,"allowance(address,address)",M([ih(t),ih(r)]))),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Zh=function(e){switch(e.$){case"BlockNum":var t=e.a;return hl(jf(Ps(t)));case"EarliestBlock":return hl("earliest");case"LatestBlock":return hl("latest");default:return hl("pending")}},ep=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return El(M([L("to",f(Bo,pl,t)),L("from",f(Bo,pl,r)),L("gas",f(Bo,yl,n)),L("gasPrice",f(Bo,gl,a)),L("value",f(Bo,gl,i)),L("data",f(Bo,vl,o))]))},tp=function(e){return{$:"BadBody",a:e}},rp=function(e){return{$:"BadStatus",a:e}},np=function(e){return{$:"BadUrl",a:e}},ap={$:"NetworkError"},ip={$:"Timeout"},op=rn,up=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(np(r));case"Timeout_":return fi(ip);case"NetworkError_":return fi(ap);case"BadStatus_":var n=t.a,a=t.b;return fi(rp(n.statusCode));default:var n=t.a,a=t.b,i=f(op,f(Oh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(tp(Di(u)))}}),sp=n(function(e,t,r){return Cl(M([L("id",wl(e)),L("jsonrpc",hl("2.0")),L("method",hl(t)),L("params",f(zh,Ua,r))]))}),cp=Rl,fp=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ku,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),lp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},dp=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(Nl,$l,p,g,h(Nl,kl,r,n,h(Nl,$l,i,o,u,s),v),h(Nl,kl,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(Nl,kl,r,n,h(Nl,$l,i,o,u,s),h(Nl,$l,f,l,d,m))}return e},hp=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(Nl,$l,i,o,h(Nl,kl,s,c,f,l),h(Nl,kl,r,n,d,h(Nl,$l,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Nl,kl,r,n,h(Nl,$l,i,o,C,d),h(Nl,$l,g,v,y,m))}return e},pp=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(Nl,r,u,s,c,h(Nl,$l,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 hp(t)}break e}o.a,o.d;return hp(t)}break e}return t}),gp=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(Nl,t,r,n,gp(a),u)}var s=dp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(_l,c,f,l,gp(d),p)}return Rl}return h(Nl,t,r,n,gp(a),u)}return Rl},vp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Rl;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(Nl,r,n,a,f(vp,e,i),o)}var s=dp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(_l,c,l,d,f(vp,e,p),v)}return Rl}return h(Nl,r,n,a,f(vp,e,i),o)}return f(yp,e,g(pp,e,t,r,n,a,i,o))}),yp=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(R(e,n)){var u=lp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(_l,r,s,c,i,gp(o))}return Rl}return h(_l,r,n,a,i,f(vp,e,o))}return Rl}),mp=r(function(e,t){var r=f(vp,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(Nl,kl,n,a,i,o)}return r}),bp=n(function(e,t,r){var n=t(f(fp,e,r));if("Just"===n.$){var a=n.a;return l(xl,e,a,r)}return f(mp,e,r)}),Cp=function(e){return"Just"===e.$},Ep=gn,Sp=vn,Tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),wp=function(e){return{$:"BadUrl_",a:e}},Ip=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ap={$:"NetworkError_"},Bp=function(e){return{$:"Receiving",a:e}},kp=function(e){return{$:"Sending",a:e}},Np={$:"Timeout_"},Rp=function(e){return f(ta,"application/json",f(xi,0,e))},$p=n(function(e,t,r){return Rp(l(sp,e,t,r))}),_p=f(ea,"",Ua),Lp=Te,xp=Se,Pp=function(e){if("Ok"===e.$){var t=e.a;return xp(t)}var r=e.a;return Lp(r)},Dp=function(e){return l(Zn,gr,Pp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},Up=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Dp({body:l($p,1,r,n),headers:yr,method:"POST",resolver:_p(up(a)),timeout:ci,url:t})},Op=n(function(e,t,r){return Up({decoder:t.decoder,method:"eth_call",params:M([ep(t),Zh(r)]),url:e})}),Mp={$:"LatestBlock"},Fp=r(function(e,t){return l(Op,e,t,Mp)}),Vp=function(e){return{$:"Perform",a:e}},Kp=sn,Hp=xp(gr),jp=r(function(e,t){return f(Kp,function(t){return xp(e(t))},t)}),qp=n(function(e,t,r){return f(Kp,function(t){return f(Kp,function(r){return xp(f(e,t,r))},r)},t)}),Gp=function(e){return l(La,qp(ka),xp(yr),e)},zp=r(function(e,t){var r=t.a;return Be(f(Kp,Ep(e),r))}),Yp=n(function(e,t,r){return f(jp,function(e){return gr},Gp(f(xa,zp(e),t)))}),Wp=n(function(e,t,r){return xp(gr)}),Jp=r(function(e,t){var r=t.a;return Vp(f(jp,e,r))});pn.Task=Pe(Hp,Yp,Wp,Jp);var Qp=Ue("Task"),Xp=cn,Zp=r(function(e,t){return Qp(Vp(f(Xp,f(Da,f(Da,xp,e),fi),f(Kp,f(Da,f(Da,xp,e),li),t))))}),eg=a(function(e,t,r,n){return f(Zp,n,f(Fp,Xh(eo(e)),l(Qh,nh(e),t,r)))}),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return th("0x092110996699c3E06e998d89F0f4586026e44F0F")}},rg=function(e){return{$:"BoolE",a:e}},ng=rg,ag=function(e){return{$:"StringE",a:e}},ig=ag,og=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ug=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},sg=r(function(e,t){return{paymentMethods:t,price:e}}),cg=function(e){return hl(Sd(e))},fg=function(e){return f(zh,Ua,M([hl(e.fiatType),cg(e.amount)]))},lg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},dg=function(e){return Cl(M([L("type",hl(lg(e.type_))),L("info",hl(e.info))]))},hg=function(e){var t=fg(e.price),r=f(zh,dg,e.paymentMethods);return f(xi,0,Cl(M([L("paymentmethods",r),L("price",t)])))},pg=r(function(e,t){return D(t,{value:si(e)})}),gg=function(e){return qu(jd(e))},vg=function(e){return f(ql,gg(e),qu(1e3))},yg=r(function(e,t){var r=function(){return"Token"===e.$?og:ug}();return function(){return"Native"===e.$?pg(jl(lh(t))):Ua}()(r(rh(e))(t.initiatorAddress)(tg(e))(R(t.initiatorRole,lo))(jl(t.tradeAmount))(jl(Yl(t.tradeAmount)))(jl(zl(t.tradeAmount)))(jl(t.pokeReward))(vg(t.autorecallInterval))(vg(t.autoabortInterval))(vg(t.autoreleaseInterval))(jl(ch(t.tradeAmount)))(hg(f(sg,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),mg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),bg=function(e){return{$:"CreateNeedsSig",a:e}},Cg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Eg=r(function(e,t){var r=al(f(yg,e,t)),n={onBroadcast:ci,onMined:si(L(mg(e),ci)),onSign:si(Cg(e))};return L(si(bg(e)),f(qo,n,r))}),Sg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wg=function(e){return{$:"ApproveNeedsSig",a:e}},Ig=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Bg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),kg={$:"NoOp"},Ng=function(e){return{appCmds:yr,chainCmd:Fo,cmd:Do,model:e}},Rg=function(e){return rd(Sd(e))},$g={$:"Error"},_g=r(function(e,t){f(cl,e+" fetch error",t);return{align:ul,label:"web3FetchError",mainParagraphs:M([M([fl('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:$g}}),Lg=r(function(e,t){return{align:ul,label:"web3MiningError",mainParagraphs:M([M([fl('Error mining "'+e+'" transaction: '+t)])]),noticeType:$g}}),xg={$:"Caution"},Pg=r(function(e,t){return{align:ul,label:"web3SigError",mainParagraphs:M([M([fl('Error signing "'+e+'" transaction: '+t)])]),noticeType:xg}}),Dg={$:"KovanDai"},Ug=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Dg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Og=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Mg=function(e){return f(Io,Ug,Og(e))},Fg=r(function(e,t){return 1-e(1-t)}),Vg=function(e){return f(Nu,e,5)},Kg=Fg(Vg),Hg={easing:Kg,offset:12,speed:200},jg=function(e){return{$:"External",a:e}},qg=function(e){return{$:"Internal",a:e}},Gg=function(e){return{$:"NotFound",a:e}},zg=function(e){for(;;){e=e.a}},Yg=r(function(e,t){return Qp(Vp(f(jp,e,t)))}),Wg={$:"Http"},Jg={$:"Https"},Qg=Kr,Xg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Zg=i(function(e,t,r,n,a){if(_d(a)||f(Qg,"@",a))return ci;var i=f(Xl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=rd(f(Zo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Xg,e,f(ru,o,a),s,t,r,n))}return si(p(Xg,e,a,ci,t,r,n))}),ev=a(function(e,t,r,n){if(_d(n))return ci;var a=f(Xl,"/",n);if(a.b){var i=a.a;return h(Zg,e,f(Zo,i,n),t,r,f(ru,i,n))}return h(Zg,e,"/",t,r,n)}),tv=n(function(e,t,r){if(_d(r))return ci;var n=f(Xl,"?",r);if(n.b){var a=n.a;return d(ev,e,si(f(Zo,a+1,r)),t,f(ru,a,r))}return d(ev,e,ci,t,r)}),rv=r(function(e,t){if(_d(t))return ci;var r=f(Xl,"#",t);if(r.b){var n=r.a;return l(tv,e,si(f(Zo,n+1,t)),f(ru,n,t))}return l(tv,e,ci,t)}),nv=function(e){return f(su,"http://",e)?f(rv,Wg,f(Zo,7,e)):f(su,"https://",e)?f(rv,Jg,f(Zo,8,e)):ci},av=Wt,iv=Gt(zt),ov=sa,uv=r(function(e,t){return L(e,t)}),sv=_r,cv=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=ju(r-n),o=f(ei,1,sv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),fv=r(function(e,t){var n=r(function(t,r){return Gp(f(xa,ov(0),d(cv,e.speed,e.easing,t,r-e.offset)))});return f(Kp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(qp,uv,iv,av(t)))}),lv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Gd(t.wallet),Mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(eg,a,n.address,rh(eo(a)),Sg(a));return d(Qd,t,i,Fo,yr)}return Ng(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Qd,D(t,{inputs:D(u,{userRole:o})}),Do,Fo,M([function(){return"Buyer"===o.$?d(Zd,"create offer type changed","input","sell dai",0):d(Zd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ng(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ng(f(Jd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Qd,(g?Jd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Do,Fo,g?M([d(Zd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=qd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jl,n,m);return Ng(D(t,{depositAmount:si(jl(lh(b))),txChainStatus:si(f(Ag,v,b))}))}var C=y.a;return d(Qd,D(t,{errors:C}),f(Zp,ms(kg),function(){return f(fv,D(Hg,{offset:60}),"inputError")}()),Fo,yr);case"AbortCreate":return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([d(Zd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Eg,v,b);var e=v.a,r=function(){var t=al(l(sh,nh(e),rh(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Ig,e,b))};return f(qo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(ts,a,E),ba)?L(si(wg(e)),r):f(Eg,v,b)}return L(si(wg(e)),r)}(),T=S.a,w=S.b;return d(Qd,D(t,{txChainStatus:T}),Do,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(l(Tg,a,b,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(ts,N,P),ba))return Ng($);var U=f(Eg,eo(a),b),T=U.a,w=U.b;return d(Qd,D($,{txChainStatus:T}),Do,w,yr)}return Ng($)}var O=k.a;return d(Qd,t,Do,Fo,M([pa(f(_g,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(f(Bg,v,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Qd,t,Do,Fo,M([pa(f(Lg,"create",B))]))}var F=e.a,V=e.b.a,K=f(Io,Rg,Yd(f(Jh,F,V)));if("Just"===K.$){var H=K.a;return d(Qd,t,Do,Fo,M([da(f(Qf,F,H))]))}return d(Qd,t,Do,Fo,M([pa(f(ll,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Qd,t,Do,Fo,M([ga]));case"NoOp":return Ng(t);default:var j=e.a;return d(Qd,t,Do,Fo,M([j]))}}),dv=r(function(e,t){return f(Eh,function(e){return f(Ch,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),hv=r(function(e,t){return f(Ku,jd(e),jd(t))}),pv=r(function(e,t){return R(f(hv,t.derived.phaseEndTime,e),Ta)}),gv=function(e){if(""===e)return li(ci);var t=vd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},vv=r(function(e,t){return{maxDai:t,minDai:e}}),yv=f(vv,ci,ci),mv=function(e){return l(Ih,r(function(t,r){return{dai:{max:r,min:t},fiatType:Ld(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Hd,function(e){return D(yv,{minDai:si(e)})},gv(e.minDai)),f(Hd,function(e){return D(yv,{maxDai:si(e)})},gv(e.maxDai)))},bv=r(function(e,t){var r=function(t){return f(Eh,function(e){return f(Qg,sd(e),sd(t))},e)};return f(Ch,function(e){return r(e.info)},t)}),Cv=r(function(e,t){return D(t,{paymentMethod:e})}),Ev=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Sv=r(function(e,t){return f(ts,jl(e),jl(t))}),Tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return wv(D(e,{inputs:f(Ev,r,f(Cv,"",e.inputs))}))},wv=function(e){var t=Tv(e),n=mv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(bv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(pv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(dv,t.filters,r)});return D(t,{filterFunc:s})},Iv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Av={$:"Expires"},Bv=function(e){return L(wv({errors:yv,filterFunc:pv,filters:co(M([f(vo,!0,!0),d(So,!0,!1,!1,!1)])),inputs:Iv,showCurrencyDropdown:!1,tradeTable:_o(L(Av,Lo)),wallet:e}),Do)},kv=r(function(e,t){var r=f(ml,wc(e),t.inputs.paymentMethodTerms);return wv(D(t,{inputs:f(Ev,r,t.inputs)}))}),Nv=function(e){return wv(D(e,{filterFunc:pv,inputs:Iv}))},Rv=function(e){return{$:"TradeTableMsg",a:e}},$v=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),_v=function(e){return d($v,e,Do,Fo,yr)},Lv=r(function(e,t){return D(t,{fiatType:e})}),xv=r(function(e,t){return D(t,{maxDai:e})}),Pv=r(function(e,t){return D(t,{minDai:e})}),Dv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return _v(D(t,{inputs:f(Pv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return _v(D(t,{inputs:f(xv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return _v(D(t,{inputs:f(Lv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return _v(D(t,{inputs:(n?Lv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return _v(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return _v(D(t,{inputs:f(Cv,r,t.inputs)}));case"AddSearchTerm":return _v(Tv(t));case"RemoveTerm":var a=e.a;return _v(f(kv,a,t));case"ApplyInputs":return d($v,wv(t),Do,Fo,yr);case"ResetSearch":return _v(Nv(t));case"FiltersMsg":var i=e.a;return _v(wv(D(t,{filters:f(Jf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(nl,o,t.tradeTable);return d($v,D(t,{tradeTable:u.model}),f(il,Rv,u.cmd),f(Yo,Rv,u.chainCmd),f(xa,Ji(Rv),u.appCmds));case"NoOp":return _v(t);default:var s=e.a;return d($v,t,Do,Fo,M([s]))}}),Uv=a(function(e,t,r,n){return e(Cl(M([L("title",hl(t)),L("body",function(){if("Nothing"===r.$)return bl;var e=r.a;return hl(e)}()),L("image",function(){if("Nothing"===n.$)return bl;var e=n.a;return hl(e)}())])))}),Ov=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Mv=function(e){return e.a+"="+e.b},Fv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Mv,e)):""},Vv=r(function(e,t){return"/"+(f(Ri,"/",e)+Fv(t))}),Kv=function(e){switch(e.$){case"Home":return f(Vv,M(["DAIHard"]),yr);case"Create":return f(Vv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Vv,M(["DAIHard","trade",Ov(t),Ni(r)]),yr);case"Marketplace":return f(Vv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Vv,M(["DAIHard","history",dl(n)]),yr);default:return f(Vv,yr,yr)}},Hv={$:"NotFound"},jv=function(e){return{$:"AgentHistory",a:e}},qv={$:"Create"},Gv={$:"Home"},zv={$:"Marketplace"},Yv=function(e){return{$:"Parser",a:e}},Wv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Jv=r(function(e,t){return Yv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Wv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Qv=f(Jv,"ADDRESS",f(zo,Ph,Yd)),Xv={$:"Eth"},Zv={$:"Kovan"},ey=f(Jv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Xv));case"keth":return si(Zi(Zv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Dg));case"xdai":return si(Zi(to));default:return ci}}),ty=f(Jv,"NUMBER",rd),ry=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Wv,r,n,a,i,e(o))}),ny=r(function(e,t){var r=t.a;return Yv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,ry(u),r(h(Wv,n,a,i,o,e)))})}),ay=function(e){return l(La,oo,yr,e)},iy=r(function(e,t){return ay(f(xa,e,t))}),oy=function(e){return Yv(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 R(u,e)?M([h(Wv,f(ka,u,r),s,a,i,o)]):yr}return yr})},uy=r(function(e,t){var r=e.a,n=t.a;return Yv(function(e){return f(iy,n,r(e))})}),sy=Yv(function(e){return M([e])}),cy=f(uy,oy("DAIHard"),function(e){return Yv(function(t){return f(iy,function(e){return(0,e.a)(t)},e)})}(M([f(ny,Gv,sy),f(ny,qv,oy("create")),f(ny,Qf,f(uy,oy("trade"),f(uy,ey,ty))),f(ny,zv,oy("marketplace")),f(ny,jv,f(uy,oy("history"),Qv)),f(ny,function(e){return jv(e)},f(uy,oy("history"),Qv))]))),fy=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 si(t.value)}return si(t.value)}return ci}},ly=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ly(r))}return yr}return yr},dy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ly(r)}var r=t;return ly(r)},hy=Qt,py=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),gy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=hy(n);if("Nothing"===o.$)return t;var u=o.a,s=hy(i);if("Nothing"===s.$)return t;var c=s.a;return l(bp,u,py(c),t)}return t}),vy=function(e){if("Nothing"===e.$)return cp;var t=e.a;return l(La,gy,cp,f(_i,"&",t))},yy=r(function(e,t){var r=e.a;return fy(r(h(Wv,yr,dy(t.path),vy(t.query),t.fragment,Ua)))}),my=function(e){return f(xc,Hv,f(yy,cy,e))},by=aa,Cy=r(function(e,t){return f(by,e,Kv(t))}),Ey=je("connectToWeb3",function(e){return bl}),Sy=function(e){return Cl(M([L("event",hl(e.event)),L("category",hl(e.category)),L("label",hl(e.label)),L("value",wl(e.value))]))},Ty=r(function(e,t){return Cl(M([L("address",hl(dl(e))),L("signSeedMsg",hl(t))]))}),wy=je("gTagOut",Ua),Iy=je("genPrivkey",Ua),Ay=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),By=n(function(e,t,r){return f(Io,Zc(t),f(Bo,function(e){return e.trades},f(Ay,function(t){return R(t.factory,e)},r)))}),ky=je("notifyPort",Ua),Ny=je("requestNotifyPermissionPort",function(e){return bl}),Ry=r(function(e,t){return D(t,{wallet:e})}),$y=r(function(e,t){return L(f(Jd,t.inputs,D(t,{wallet:e})),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(eg,n,r.address,rh(eo(n)),Sg(n))}return Do}())}),_y=r(function(e,t){return D(t,{wallet:e})}),Ly=function(e){return{$:"AllowanceFetched",a:e}},xy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Gd(e),Mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Mg(e),si(i.factory))?d(eg,a,n.address,i.creationInfo.address,Ly):Do}return Do}())}),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{$:"TradeModel",a:e}},Fy=function(e){return{$:"TradeMsg",a:e}},Vy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Do);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Dy(a),f(il,Uy,i));case"TradeModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(il,Fy,c));case"MarketplaceModel":var l=t.a;return L(Oy(f(_y,e,l)),Do);default:var d=t.a;return L(Py(f(Ry,e,d)),Do)}}),Ky=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Hy=function(e){return{$:"PartiallyLoadedTrade",a:e}},jy=r(function(e,t){return Hy(g(Ky,e,t,ci,ci,ci,ci,ci))}),qy=function(e){return{$:"CurrentBlockFetched",a:e}},Gy=gu(f(zo,cu,Nh)),zy=function(e){return Up({decoder:Gy,method:"eth_blockNumber",params:yr,url:e})},Yy=function(e){return f(Zp,qy,zy(e))},Wy=r(function(e,t){return{address_:e,blocknum:t}}),Jy=function(e){return Wo(function(t){return li(L(t,e))})},Qy=n(function(e,t,r){var n=t.a,a=r.a;return Wo(function(t){return f(Wh,function(t){var r=t.a,n=t.b;return f(au,rl(e(n)),a(r))},n(t))})}),Xy=r(function(e,t){return l(Qy,r(function(e,t){return e(t)}),t,e)}),Zy=vu(f(Xy,jh,f(Xy,Dh,Jy(Wy)))),em=r(function(e,t){return{data:si(f(Gf,"createdTrades(uint256)",M([uh(t)]))),decoder:Zy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tm=n(function(e,t,r){return f(Zp,r,f(Fp,Xh(e),f(em,rh(e),t)))}),rm=function(e){return{$:"CreationInfoFetched",a:e}},nm=r(function(e,t){return l(tm,e,qu(t),rm)}),am=function(e){return{$:"EventSentryMsg",a:e}},im=function(e){return{$:"BlockNumber",a:e}},om=function(e){return{$:"EventSentry",a:e}},um=function(e){return{$:"Set_elm_builtin",a:e}},sm=um(cp),cm=r(function(e,t){return L(om({blockNumber:ci,errors:yr,nodePath:t,pending:sm,ref:1,requests:cp,tagger:e,watching:sm}),f(Zp,f(zo,im,e),zy(t)))}),fm=function(e){return f(cm,am,Xh(e))},lm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},hm=dm(f(lm,ci,ci)),pm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:Co,secureCommInfo:hm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),gm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),vm=n(function(e,t,r){var n=f(nm,t,r),a=fm(t),i=a.a,o=a.b;return d(gm,l(pm,f(jy,t,r),i,e),Po(M([n,o,Yy(Xh(t))])),Fo,M([ha]))}),ym=function(e){return{$:"LoadedTrade",a:e}},mm=r(function(e,t){var r=fm(t.factory),n=r.a,a=r.b;return d(gm,l(pm,ym(t),n,e),Po(M([a,Yy(Xh(t.factory))])),Fo,M([ha]))}),bm=function(e){return{data:si(f(Gf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Cm=function(e){return{data:si(f(Gf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Em=function(e){return{data:si(f(Gf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Sm=r(function(e,t){return{data:si(f(Gf,"initiatorStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Tm=function(e){return{data:si(f(Gf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},wm=function(e){return{data:si(f(Gf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Im=r(function(e,t){return{data:si(f(Gf,"responderStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Am=r(function(e,t){return{amount:t,fiatType:e}}),Bm=f(du,function(e){var t=cd(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("Can't convert that to a BigInt")},pu),km=l(Mi,Am,f(Fh,0,pu),f(Fh,1,Bm)),Nm={$:"Bank"},Rm={$:"Cash"},$m=function(e){switch(e){case"cash":return si(Rm);case"bank":return si(Nm);case"custom":return si(Fd);default:return ci}},_m=f(du,function(e){var t=$m(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("")},pu),Lm=l(Mi,Vd,f(Oh,"type",_m),f(Oh,"info",pu)),xm=oe,Pm=function(e){var t=l(Mi,sg,f(Oh,"price",km),f(Oh,"paymentmethods",xm(Lm)));return f(op,t,e)},Dm=r(function(e,t){return{commPubkey:t,responder:e}}),Um=r(function(e,t){var n=r(function(t,r){return l(Xo,t,t+2*r,e)}),a=f(zo,Nh,au(ti(2)));return f(Wh,function(t){return f(au,function(e){return f(n,t+64,e)},Nh(l(Xo,t,t+64,e)))},a(t))}),Om=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),Mm=n(function(e,t,r){var n=l(Ra,Om(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),Fm=j,Vm=function(e){return As(Fm(e))},Km=function(e){return l(Mm,r(function(e,t){return U(t,Vm(e))}),"",e)},Hm=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f(Wh,Km,f(Wh,f(zo,xa(Nh),Ah),f(au,ml(f(zo,_d,ns)),f(au,tc(2),f(Um,t,nu(r)))))))}),jm=f(dh,f(Mh,1,Hm),f(dh,f(Mh,0,Dh),Fi(Dm))),qm=r(function(e,t){return{commPubkey:t,terms:e}}),Gm=f(dh,f(Mh,1,Hm),f(dh,f(Mh,0,Hm),Fi(qm))),zm=function(e){return{statement:e}},Ym=f(dh,f(Mh,0,Hm),Fi(zm)),Wm=function(e){return{statement:e}},Jm=f(dh,f(Mh,0,Hm),Fi(Wm)),Qm={$:"AbortedEvent"},Xm={$:"BurnedEvent"},Zm={$:"ClaimedEvent"},eb=function(e){return{$:"CommittedEvent",a:e}},tb=function(e){return{$:"InitiatedEvent",a:e}},rb=function(e){return{$:"InitiatorStatementLogEvent",a:e}},nb={$:"PokeEvent"},ab={$:"RecalledEvent"},ib={$:"ReleasedEvent"},ob=function(e){return{$:"ResponderStatementLogEvent",a:e}},ub=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),sb=function(e){return ub(e)?li(nc(cu(e))):fi("Something in here is not very hexy: "+xh(e))},cb=gu(sb),fb=f(Oh,"topics",f(Fh,0,cb)),lb=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),Kf(f(xa,yi,Zs(e))))))},db=f(du,function(e){return R(e,lb("Initiated(string,string)"))?f(Oi,tb,Gm):R(e,lb("Committed(address,string)"))?f(Oi,eb,jm):R(e,lb("Recalled()"))?Fi(ab):R(e,lb("Claimed()"))?Fi(Zm):R(e,lb("Aborted()"))?Fi(Qm):R(e,lb("Released()"))?Fi(ib):R(e,lb("Burned()"))?Fi(Xm):R(e,lb("InitiatorStatementLog(string)"))?f(Oi,rb,Ym):R(e,lb("ResponderStatementLog(string)"))?f(Oi,ob,Jm):R(e,lb("Poke()"))?Fi(nb):hu("Unrecognized topic hash")},fb),hb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},pb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},gb=function(e){return R(e.buyerDeposit,Yl(e.tradeAmount))&&R(e.abortPunishment,zl(e.tradeAmount))},vb={$:"Invalid"},yb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),mb=r(function(e,t){return Vl(jd(t)+jd(e))}),bb=function(e){var t=Bd(Sd(e.amount));if("Just"===t.$){return t.a}f(cl,"Error converting FiatValue to float--string -> float failed!",e);return 0},Cb=r(function(e,t){return(t-e)/e}),Eb=r(function(e,t){var r=bb(t),n=kd(e);return"USD"===t.fiatType?si(f(Cb,n,r)):ci}),Sb=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 Vl(0)}}();return{margin:f(Eb,e.tradeAmount,r.price),phaseEndTime:function(){return"Closed"===t.phase.$?Vl(f(Nu,2,53)-1):f(mb,t.phaseStartTime,n)}()}}),Tb=function(e){var t=x(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 ym(v(yb,e.factory,e.id,n,a,o,u,s,l(Sb,a,o,u)))}return Hy(e)},wb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(cl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return vb}}),Ib=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return vb}}),Ab=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return vb}}),Bb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return ym(D(n,{state:e}));default:return vb}}),kb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return vb}}),Nb=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}}),Rb=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,uu,f(Xy,Dh,Jy(Nb))))))))))),$b=function(e){return{data:si(f(Gf,"getParameters()",yr)),decoder:Rb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},_b=function(e){return f(Bo,function(e){return Vl(1e3*e)},rd(Sd(e)))},Lb=function(e){return Hl(e)},xb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),Pb=function(e){var t=f($d,"error converting BigInt to Time.Posix",_b(e.autoabortInterval)),r=f($d,"error converting BigInt to Time.Posix",_b(e.autoreleaseInterval)),a=f($d,"error converting BigInt to Time.Posix",_b(e.autorecallInterval));return d(xb,n(function(t,r,n){return{abortPunishment:Lb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Lb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:Lb(e.pokeReward),tradeAmount:Lb(e.tradeAmount)}}),a,t,r)},Db=n(function(e,t,r){return f(Zp,r,f(jp,Pb,f(Fp,Xh(e),$b(t))))}),Ub=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}}}}}}}}}}},Ob=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(Ub)))))))))))),Mb=function(e){return{data:si(f(Gf,"getPhaseStartInfo()",yr)),decoder:Ob,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Fb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),Vb=function(e){return h(Fb,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}}),_b(e.v6),_b(e.v7),_b(e.v8),_b(e.v9))},Kb=n(function(e,t,r){return f(Zp,r,f(jp,Vb,f(Fp,Xh(e),Mb(t))))}),Hb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),jb=vu(f(Xy,jh,f(Xy,Dh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(Hb))))))),qb=function(e){return{data:si(f(Gf,"getState()",yr)),decoder:jb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Gb={$:"Aborted"},zb={$:"Burned"},Yb={$:"NotClosed"},Wb={$:"Recalled"},Jb={$:"Released"},Qb=function(e){switch(f(xc,99,rd(Sd(e)))){case 0:return si(Yb);case 1:return si(Wb);case 2:return si(Gb);case 3:return si(Jb);case 4:return si(zb);default:return ci}},Xb=function(e){switch(f(xc,99,rd(Sd(e)))){case 1:return si(Co);case 2:return si(mo);case 3:return si(bo);case 4:return si(yo);default:return ci}},Zb=function(e){return R(e,th("0x0000000000000000000000000000000000000000"))?ci:si(e)},eC=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),tC=function(e){var t=_b(e.phaseStartTimestamp),r=Xb(e.phase),a=Qb(e.closedReason);return d(eC,n(function(t,r,n){return{balance:Lb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:Zb(e.responder)}}),r,t,a)},rC=n(function(e,t,r){return f(Zp,r,f(jp,tC,f(Fp,Xh(e),qb(t))))}),nC=i(function(e,t,r,n,a){return Po(M([l(Db,e,t,r),l(rC,e,t,n),l(Kb,e,t,a)]))}),aC=function(e){var t=Rg(e);if("Just"===t.$){return t.a}f(cl,"Warning! BigInt to Int conversion failed!",Sd(e));return 0},iC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),oC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),uC=function(e){return e.b?l(oC,e,yr,0):qa},sC=tn,cC=function(e){var t=h(sC,iC,f(Oh,"encapsulation",pu),f(Oh,"iv",pu),f(Oh,"tag",pu),f(Oh,"encrypted",pu)),r=xm(t),n=f(Gh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Zc,0,e),f(Zc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(uC(i))},fC=function(e){var t=function(e){var t=Qo(e);return t>1114111?fi("string is too long"):li(f(Is,Fm(t),e))};return f(au,Ri(""),Ah(f(xa,t,e)))},lC=function(e){var t=e.a,r=e.b;return fC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},dC=r(function(e,t){return Cl(M([L("message",hl(e)),L("pubkeyHexStrings",f(zh,hl,M([t.initiatorPubkey,t.responderPubkey])))]))}),hC=function(e){return{$:"LoadedCommInfo",a:e}},pC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),gC=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 hC(f(pC,r,n))}return dm(e)},vC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return gC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return hC(D(n,{initiatorPubkey:e}))}),yC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return gC(D(r,{responderPubkey:si(e)}))}var n=t.a;return hC(D(n,{responderPubkey:e}))}),mC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),bC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(nd,a,n),o=$s(f(lc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),CC=function(e){var t=uC(f(bC,Zs(e),yr));return l(zd,uv,h(Fb,iC,f(Zc,0,t),f(Zc,1,t),f(Zc,2,t),f(Zc,3,t)),h(Fb,iC,f(Zc,4,t),f(Zc,5,t),f(Zc,6,t),f(Zc,7,t)))},EC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),SC={$:"Aborted"},TC={$:"Burned"},wC={$:"Claimed"},IC=function(e){return{$:"Committed",a:e}},AC=function(e){return{$:"Encrypted",a:e}},BC={$:"FailedDecode"},kC={$:"Initiated"},NC={$:"Recalled"},RC={$:"Released"},$C=function(e){return{$:"StateChange",a:e}},_C=function(e){return{$:"Statement",a:e}},LC=fr,xC=cr,PC=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(LC,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(xC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),DC=or,UC=y,OC=a(function(e,t,r,n){var a=Wc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(DC,Ga(r),n);var i=za(d(OC,e-Ha,t,r,ja));return f(DC,i,n)}var o=f(Jc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(OC,e-Ha,t,r,u));return l(rf,a,i,n)}var i=za(d(OC,e-Ha,t,r,UC(o)));return l(rf,a,i,n)}),MC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(OC,c,r,e,UC(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(OC,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),FC=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(LC,32,r,e),o=f(MC,i,t);if(a<0){var u=l(xC,a,n,e);return f(MC,u,o)}return o}),VC=ur,KC=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(VC,i,t,r)}return f(ka,e,t)});return{nodeList:l(VC,i,yr,n),nodeListSize:t/32|0,tail:a}},HC=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(VC,o,t,r)}var n=e.a;return f(FC,n,t)});return f(FC,i,l(VC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(VC,o,t,r)}var n=e.a;return f(PC,n,t)});return f(ai,!0,f(PC,i,l(VC,o,KC(e),a)))}),jC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),qC=f(La,jC,yr),GC=n(function(e,t,r){var n=mC(r.trade.parameters.initiatorRole),a=f(cl,"maybeHistoryEventInfo",function(){switch(t.$){case"InitiatedEvent":return si($C(kC));case"CommittedEvent":var r=t.a;return si($C(IC(r.responder)));case"RecalledEvent":return si($C(NC));case"ClaimedEvent":return si($C(wC));case"AbortedEvent":return si($C(SC));case"ReleasedEvent":return si($C(RC));case"BurnedEvent":return si($C(TC));case"InitiatorStatementLogEvent":var r=t.a;return si(_C({blocknum:e,message:function(){var e=CC(r.statement);if("Just"===e.$){var t=e.a;return AC(t)}return BC}(),who:n(To)}));case"ResponderStatementLogEvent":var r=t.a;return si(_C({blocknum:e,message:function(){var e=CC(r.statement);if("Just"===e.$){var t=e.a;return AC(t)}return BC}(),who:n(wo)}));default:return ci}}()),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(HC,r.history,uC(qC(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Bo,EC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),qC(M([s])))}),zC=Gr,YC=function(e){var t=l(Mi,uv,f(Oh,"id",zC),f(Oh,"message",pu));return f(Hd,Di,f(Gh,t,e))},WC=function(e){return{$:"Decrypted",a:e}},JC=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),QC=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(GC,n,a,t),o=i.a,u=i.b,s=i.c;return d(JC,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(JC,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(JC,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=YC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Zc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:WC(y)}),T=D(b,{eventInfo:_C(S)}),w=l(af,v,T,t.history);return d(JC,D(t,{history:w}),!1,ci,yr)}return d(JC,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an event that is not a message!",b))]))}return d(JC,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(JC,t,!1,ci,M([pa(f(ll,"Error decoding decryption result",I))]))}}),XC=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),ZC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),eE=function(e){return{onBroadcast:ci,onMined:si(L(XC(e),ci)),onSign:si(ZC(e))}},tE=je("encryptToPubkeys",Ua),rE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),nE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),aE=function(e){return{$:"CommitMined",a:e}},iE={$:"CommitNeedsSig"},oE=function(e){return{$:"CommitSigned",a:e}},uE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?nE:rE}(),a=al(function(){return"Token"===e.factory.$?Ua:pg(jl(hb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(iE),f(qo,{onBroadcast:ci,onMined:si(L(aE,ci)),onSign:si(oE)},a))}),sE=r(function(e,t){return Cl(M([L("id",wl(e)),L("encapsulation",hl(t.encapsulatedKey)),L("iv",hl(t.iv)),L("tag",hl(t.tag)),L("encrypted",hl(t.message))]))}),cE=je("decryptMessage",Ua),fE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},lE=r(function(e,t){return Po(f(xa,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 cE(f(sE,r,s))}return Do}return Do},fE(e.history)))}),dE=function(e){if("Just"===e.$){return e.a}return ci},hE=function(e){var t=dE(l(zd,Ao,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Bo,function(e){return e.address},Gd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(lE,n,a)}return Do},pE=r(function(e,t){var n=r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(GC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}});f(cl,"HIE",e);return f(n,e,x(t,!1,yr))}),gE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),vE=i(function(e,t,r,n,a){return f(pE,n,p(gE,e,r,t,qa,a,""))}),yE=function(e){return{$:"ChatHistoryMsg",a:e}},mE=a(function(e,t,r,n){var a=x(t,Gd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(ko,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(yE),n))}(h(vE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),bE={$:"Abort"},CE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),EE=function(e){return{$:"ActionNeedsSig",a:e}},SE=function(e){return{$:"ApproveMining",a:e}},TE={$:"ApproveNeedsSig"},wE=function(e){return{$:"ApproveSigned",a:e}},IE={$:"Burn"},AE={$:"Claim"},BE=function(e){return{$:"CommitMining",a:e}},kE=function(e){return{$:"ConfirmingAction",a:e}},NE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),RE=function(e){return{$:"EventLogFetched",a:e}},$E=function(e){return{$:"ParametersFetched",a:e}},_E=function(e){return{$:"PhaseInfoFetched",a:e}},LE={$:"Poke"},xE={$:"Recall"},PE={$:"Release"},DE=function(e){return{$:"StartContractAction",a:e}},UE=function(e){return{$:"StateFetched",a:e}},OE=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"}},ME=function(e){return d(gm,e,Do,Fo,yr)},FE={align:ul,label:"cantFindTradeWillRetry",mainParagraphs:M([M([fl("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:$g},VE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(_g,e,r)}if("Nothing"===t.a.$){t.a;return f(ll,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ll,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),KE={align:ul,label:"tradeParametersNotDefault",mainParagraphs:M([M([fl("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:$g},HE=eo(Xi),jE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),qE=n(function(e,t,r){return l(bp,e,Bo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),GE=r(function(e,t){var r=t.a;return um(f(mp,e,r))}),zE=n(function(e,t,r){var n=e.a,a=f(fp,t,n.requests);if("Nothing"===a.$)return L(om(n),Do);var i=a.a,o=L(i.watchOnce,Ql(r));if("Nothing"===o.b.$){o.b;return L(om(D(n,{requests:l(qE,t,r,n.requests)})),Do)}if(o.a){var u=o.b.a;return L(om(D(n,{requests:l(qE,t,r,n.requests),watching:f(GE,t,n.watching)})),f(Yg,i.tagger,xp(u)))}return L(om(D(n,{requests:l(qE,t,r,n.requests)})),Po(f(xa,function(e){return f(Yg,i.tagger,xp(e))},r)))}),YE=_e,WE=r(function(e,t){return f(Zp,f(zo,im,t),f(Kp,function(t){return zy(e)},YE(2e3)))}),JE=ue,QE=ce,XE=Yr,ZE=n(function(e,t,r){var n=function(e){return QE(M([e,JE(r)]))};return f(du,function(a){var i=f(Gh,e,a);if("Ok"===i.$){var o=i.a,u=f(Gh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return hu(Di(c))}return Fi(r)},XE)}),eS=a(function(e,t,r,n){return f(dh,l(ZE,f(Oh,e,XE),t,r),n)}),tS=n(function(e,t,r){return f(dh,f(Oh,e,t),r)}),rS=gu(Ph),nS=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),aS=function(e){return{$:"BlockHash",a:e}},iS=function(e){return nS(e)?li(aS(cu(e))):fi("Given blockHash "+xh(e)+" is not valid.")},oS=gu(iS),uS=function(e){return{$:"TxHash",a:e}},sS=function(e){return nS(e)?li(uS(cu(e))):fi("Given txHash "+xh(e)+" is not valid.")},cS=gu(sS),fS=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}}),lS=zr,dS=l(tS,"blockNumber",Gy,l(tS,"blockHash",oS,l(tS,"transactionHash",cS,l(tS,"transactionIndex",Gy,l(tS,"logIndex",Gy,d(eS,"removed",lS,!1,l(tS,"topics",xm(cb),l(tS,"data",pu,l(tS,"address",rS,Fi(fS)))))))))),hS=function(e){return f(zh,function(e){if("Just"===e.$){var t=e.a;return hl(qf(t))}return bl},e)},pS=function(e){return Cl(M([L("fromBlock",Zh(e.fromBlock)),L("toBlock",Zh(e.toBlock)),L("address",pl(e.address)),L("topics",hS(e.topics))]))},gS=r(function(e,t){return Up({decoder:xm(dS),method:"eth_getLogs",params:M([pS(t)]),url:e})}),vS=function(e){return{$:"BlockNum",a:e}},yS=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Kp,function(r){return f(jp,vi(r),f(gS,e,D(t,{fromBlock:vS(n),toBlock:vS(a)})))},f(gS,e,t)):f(gS,e,t)}),mS=n(function(e,t,r){var n=r.a,a=r.b;return f(gS,e,D(t,{fromBlock:vS(n),toBlock:vS(a)}))}),bS=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(bS,e,t,i)),c=o;e=u,t=s,r=c}}),CS=r(function(e,t){return l(bS,xl,t,e)}),ES=r(function(e,t){var r=e.a,n=t.a;return um(f(CS,r,n))}),SS=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 Po(f(xa,function(t){return f(Zp,f(zo,jE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},qC(f(xa,function(e){return f(fp,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(om(D(r,{blockNumber:si(a)})),Po(M([f(WE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,mS)]))):L(t,f(WE,r.nodePath,r.tagger))}return L(om(D(r,{blockNumber:si(a),pending:sm,watching:f(ES,r.watching,r.pending)})),Po(M([f(WE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,yS),l(i,L(a,a),r.watching,mS)])))}var s=e.a.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),f(WE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(zE,t,c,d)}var s=e.b.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),Do)}),TS=r(function(e,t){var r=t.a;return um(l(xl,e,gr,r))}),wS=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(xl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(om(D(o,{watching:f(TS,a.ref,o.watching)})),f(Zp,f(zo,jE(a.ref),a.tagger),e),a.ref)}(l(yS,a.nodePath,n,L(s,s)))}return x(om(D(o,{pending:f(TS,a.ref,o.pending)})),Do,a.ref)}),IS=wS(!1),AS=function(e){return M([e])},BS=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(nm,r.factory,r.id):Do}}(),function(){var e=x(Gd(t.wallet),Mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Mg(t.wallet),si(a.factory))?d(eg,n,r.address,a.creationInfo.address,Ly):Do}return Do}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(mE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?hE(t):Do,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(gm,u,Po(M([l(rC,p.factory,p.creationInfo.address,UE),s,r])),Fo,o)}return ME(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return ME(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(ts,m,jl(hb(C.parameters))),ba))return ME(u);var S=l(uE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(gm,D(u,{txChainStatus:T}),Do,w,yr)}return ME(u)}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:aC(I.blocknum)},B=l(IS,RE,t.eventSentry,{address:A.address,fromBlock:vS(A.blocknum),toBlock:Mp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(wb,A,t.trade)}),$=f(xc,HE,pb(u.trade)),_=Po(M([N,h(nC,$,A.address,$E,UE,_E)]));return d(gm,u,_,Fo,yr)}if("BadBody"===g.a.$){g.a.a;return d(gm,t,Do,Fo,M([pa(FE)]))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(Bb,P,t.trade)});return d(gm,u,hE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(VE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(gb(F)){var u=D(t,{trade:f(Ib,F,t.trade)});return d(gm,u,hE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(KE)]))}var V=g.a.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Ab,H,t.trade)});return d(gm,u,hE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(VE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Yh,db,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(vC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(yC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=Pm(e.terms);if("Ok"===r.$){var n=r.a;return L(f(kb,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ll,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(yE),n))}(l(GC,q.blockNumber,Y,r))}return d(mE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?hE(u):Do;return d(gm,u,_,Fo,f(oo,f(xa,pa,qC(M([X]))),o));case"ExpandPhase":var te=e.a;return ME(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return ME(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return ME(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(gm,t,Do,Fo,M([da(jv(C.parameters.initiatorAddress))]))}return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return ME(D(t,{txChainStatus:si(f(NE,E,ie))}));case"AbortAction":return ME(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(uE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=al(l(sh,nh(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(wE)};return f(qo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(ts,i,jl(hb(C.parameters))),ba)?L(si(TE),n):l(uE,C,E.address,E.commPubkey)}return L(si(TE),n)}(),T=oe.a,w=oe.b;return d(gm,D(t,{txChainStatus:T}),Do,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,LE)||R(ue,xE)){var se=DE(ue),ce=t;e=se,t=ce;continue e}return ME(D(t,{txChainStatus:si(kE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Fo,M([pa(f(ll,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=al(Tm(n.creationInfo.address));return x(si(EE(xE)),f(qo,eE(xE),a),yr);case"Claim":var a=al(Em(n.creationInfo.address));return x(si(EE(AE)),f(qo,eE(AE),a),yr);case"Abort":var a=al(bm(n.creationInfo.address));return x(si(EE(bE)),f(qo,eE(bE),a),yr);case"Release":var a=al(wm(n.creationInfo.address));return x(si(EE(PE)),f(qo,eE(PE),a),yr);case"Burn":var a=al(Cm(n.creationInfo.address));return x(si(EE(IE)),f(qo,eE(IE),a),yr);default:var a=al(zf(n.creationInfo.address));return x(si(EE(LE)),f(qo,eE(LE),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(gm,D(t,{txChainStatus:T}),Do,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return ME(D(t,{txChainStatus:si(SE(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return ME(D(t,{txChainStatus:si(BE(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"commit",V))]));case"CommitMined":return ME(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return ME(D(t,{txChainStatus:si(f(CE,ue,he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,OE(ue),V))]));case"ActionMined":var ue=e.a;return ME(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(SS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(gm,D(t,{eventSentry:ve}),_,Fo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(QC,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?hE(t):Do,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(tE(f(dC,r,a)),ci)}return L(Do,si(f(ll,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Do,ci)}(),Te=Se.a,we=Se.b;return d(gm,Ee,Po(M([s,Te])),Fo,U(f(Qi,yE,Ce.appCmds),f(xc,yr,f(Bo,AS,f(Bo,pa,we)))))}return d(gm,t,Do,Fo,M([pa(f(ll,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Wh,lC,cC(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Ao,p,E.address);if("Nothing"===Ne.$)return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return al("Initiator"===Re.$?f(Sm,p.creationInfo.address,ke):f(Im,p.creationInfo.address,ke))}();return d(gm,t,Do,f(qo,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(gm,t,Do,Fo,M([pa(f(ll,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return ME(t)}var V=e.a.a;return d(gm,t,Do,Fo,M([pa(f(Lg,"message",V))]));default:return d(gm,t,Do,Fo,M([ga]))}}),kS=r(function(e,t){return{address:e,blocknum:t}}),NS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},RS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(wS,!0,e,t,r))}),$S=n(function(e,t,r){var n=function(e){return r(f(Yh,Gm,e).returnData)},a={address:t.address,fromBlock:vS(t.blocknum),toBlock:vS(t.blocknum),topics:M([si(lb("Initiated(string,string)"))])};return l(RS,n,e,a)}),_S=function(e){return{data:si(f(Gf,"numTrades()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},LS=r(function(e,t){return f(Zp,t,f(Fp,Xh(e),_S(rh(e))))}),xS=function(e){return{data:si(f(Gf,"phase()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},PS=n(function(e,t,r){return f(Zp,r,f(jp,Xb,f(Fp,Xh(e),xS(t))))}),DS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),US=r(function(e,t){return l(La,DS(e),yr,t)}),OS=function(e){return f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},MS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},FS=function(e){return f(MS,Ja(vb),Sa(e.trades))},VS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:FS(e),loaded:Ti(OS(e))})})},KS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),HS=r(function(e,t){var r=f(Zc,e,t.trades);if("Just"===r.$){var n=(r.a,l(af,e,vb,t.trades));return l(KS,VS(D(t,{trades:n})),Do,yr)}return l(KS,t,Do,M([pa(f(ll,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),jS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(wb,t,a),o=l(af,e,i,r.trades);return L(VS(D(r,{trades:o})),yr)}return L(r,M([f(ll,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),qS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Ib,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(af,e,ym(D(a,{state:D(i,{phase:t})})),r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),zS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Ab,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),YS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Bb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),WS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(kb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),JS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),QS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),XS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),ZS=function(e){return{$:"NumTradesFetchedAgain",a:e}},eT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),tT=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),rT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),nT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),aT=function(e){return l(KS,e,Do,yr)},iT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=aC(n),i=uC(f(xa,jy(t.factory),f(Ai,0,a-1))),o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,0,a-1)));return l(KS,D(t,{dataFetchState:l(QS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CheckForNewTrades":return l(KS,t,f(LS,t.factory,ZS),yr);case"UpdateTradePhases":var s=Po(qC(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(PS,e.factory,e.creationInfo.address,f(tT,e.factory,e.id)))},OS(t))));return l(KS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(GS,d,p,t),v=function(){var e=L(p,f(Zc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=NS(r);if("Just"===n.$){var a=n.a;return L(l(rC,c,a.address,nT(d)),yr)}return L(Do,M([pa(f(ll,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Do,yr)}e.b;return L(Do,M([pa(f(ll,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(KS,g.tradeCache,Po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(KS,t,Do,M([pa(f(VE,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=aC(n);if(_(C,E)<0){var S=t.dataFetchState,o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,C,E-1))),T=uC(f(xa,jy(t.factory),f(Ai,C,E-1)));return l(KS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(HC,t.trades,T)}),o,yr)}return aT(t)}b.b;return l(KS,t,Do,M([pa(f(ll,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(kS,w.address_,aC(w.blocknum)),A=l($S,t.eventSentry,I,XS(d)),B=A.a,k=A.b,y=Po(M([h(nC,t.factory,I.address,eT(d),nT(d),rT(d)),k])),N=l(jS,d,I,t),R=N.a,$=N.b;return l(KS,VS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(KS,t,Do,M([pa(f(_g,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(qS,d,P,t)}var U=r.a.a;return l(KS,t,Do,M([pa(f(ll,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(YS,d,O,t)}return l(KS,t,Do,M([pa(f(VE,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(zS,d,F,t)}return l(KS,t,Do,M([pa(f(VE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=Pm(V.terms);if("Ok"===K.$){var H=K.a;return l(WS,d,H,t)}var j=K.a;return f(HS,d,t)}var j=r.a;return l(KS,t,Do,M([pa(f(ll,"Error decoding initiated event",j))]));default:var q=e.a,G=f(SS,q,t.eventSentry),z=G.a,y=G.b;return l(KS,D(t,{eventSentry:z}),y,yr)}}),oT=function(e){return{$:"AgentHistoryMsg",a:e}},uT=function(e){return{$:"AppCmd",a:e}},sT={$:"BetaLandingPage"},cT={$:"ConnectToWeb3"},fT=function(e){return{$:"MarketplaceMsg",a:e}},lT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),dT=r(function(e,t){return f(kn,e,hl(t))}),hT=function(e){return f(dT,"href",tt(e))},pT=Nn("rel"),gT=dT("target"),vT=function(e){return{$:"Height",a:e}},yT=vT,mT={$:"Content"},bT=mT,CT=function(e){return{$:"Width",a:e}},ET=CT,ST=function(e){return{$:"Attr",a:e}},TT=function(e){return{$:"NodeName",a:e}},wT=function(e){return{$:"Unkeyed",a:e}},IT={$:"AsEl"},AT=IT,BT=r(function(e,t){return{$:"Field",a:e,b:t}}),kT=f(BT,0,0),NT={$:"NoNearbyChildren"},RT={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"},$T=RT.any+" "+RT.column,_T=RT.any+" "+RT.grid,LT=RT.any+" "+RT.page,xT=RT.any+" "+RT.paragraph,PT=RT.any+" "+RT.row,DT=RT.any+" "+RT.single,UT=function(e){switch(e.$){case"AsRow":return PT;case"AsColumn":return $T;case"AsEl":return DT;case"AsGrid":return _T;case"AsParagraph":return xT;default:return LT}},OT=function(e){return{$:"Keyed",a:e}},MT={$:"NoStyleSheet"},FT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),VT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),KT={$:"AsParagraph"},HT=KT,jT=Sn("div"),qT=Sn("p"),GT=Sn("s"),zT=Sn("u"),YT=dT("className"),WT=function(e){return wn(Xe(e))},JT=function(e){return Sn(Xe(e))},QT=function(e){return{$:"Flag",a:e}},XT=function(e){return{$:"Second",a:e}},ZT=function(e){return e>31?XT(1< .ctr > ."+RT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",eI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+" { flex-basis: auto !important; } "+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+Ew(RT.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"+Zw,tI=function(e){return{$:"Intermediate",a:e}},rI=r(function(e,t){return tI({closing:t,others:yr,props:yr,selector:e})}),nI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,tI({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(nI,f(rI,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(nI,f(rI,n.selector,""),v),t.others)})}});return tI(l(La,a,n,t))}),aI=U(eI,function(e){var t=function(e){return Cd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Cd(f(xa,a,t.others)))};return Cd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(nI,f(rI,r,""),n),t)}),yr,e)))}(U(Jw,Xw))),iI=l(JT,"style",yr,M([Tw(aI)])),oI=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+'"'}},uI=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}},sI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ch,uI,t.variants)}return!1},cI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),fI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),lI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(fI,"."+e+"."+t+", ."+e+" ."+t,n),f(fI,"."+e+"."+t+"> ."+RT.text+", ."+e+" ."+t+" > ."+RT.text,a)])}),dI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(lI,i,RT.sizeByCapital,a),l(lI,i,RT.fullSize,n)))}),hI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(fI,"."+r+"."+RT.sizeByCapital+", ."+r+" ."+RT.sizeByCapital,M([L("line-height","1")])),f(fI,"."+r+"."+RT.sizeByCapital+"> ."+RT.text+", ."+r+" ."+RT.sizeByCapital+" > ."+RT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),pI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},gI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Tc,t,r))}return ci},vI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),yI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(xc,e.descender,gI(t)),n=f(xc,e.baseline,gI(f(ml,function(e){return!R(e,r)},t))),a=f(xc,e.capital,pI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(vI,i,a-n,o),full:l(vI,u,a-r,s)}},mI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",mw(e.height)),L("vertical-align",mw(e.vertical)+"em"),L("font-size",mw(e.size)+"em")]))},bI=function(e){return l(Ra,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 si(L(mI(function(e){return e.full}(yI(a))),mI(function(e){return e.capital}(yI(a)))))}return t}return t}),ci,e)},CI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(US,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=bI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,hI(t),n));var i=a.a;return f(Ri,"",f(xa,f(dI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},EI=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+'" '+Ni(r)}},SI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,EI,t.variants)))}return ci},TI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},wI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+mw(r)+"px, "+mw(n)+"px, "+mw(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("+mw(o)+"px, "+mw(u)+"px, "+mw(s)+"px)",b="scale3d("+mw(f)+", "+mw(l)+", "+mw(d)+")",C="rotate3d("+mw(p)+", "+mw(g)+", "+mw(v)+", "+mw(y)+"rad)";return si(m+" "+b+" "+C)}},II=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,cI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,cI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,cI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,cI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+RT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+RT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+RT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,cI(!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,M([f(vw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Tc,1,1-c));return l(a,t,"."+u,M([f(vw,"opacity",mw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(vw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(US,SI,p)),v=M([f(vw,"font-family",f(Ri,", ",f(xa,oI,p))),f(vw,"font-feature-settings",g),f(vw,"font-variant",f(Ch,sI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(vw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(vw,s,bw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+RT.row,A="."+(RT.wrapped+I),B="."+RT.alignRight,k="."+RT.paragraph,N="."+RT.page,R="."+RT.alignLeft,$=mw(S/2)+"px",_=mw(E/2)+"px",x="."+RT.column,y="."+C,P="."+RT.any;return Cd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(vw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(vw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,U(y,k),M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,lw,F.rows))+"-cols-"+f(Ri,"-",f(xa,lw,F.columns))+"-space-x-"+lw(F.spacing.a)+"-space-y-"+lw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=wI(ne),y=hw(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,M([f(vw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=TI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(CI(s),c)}),AI=r(function(e,t){return l(JT,"style",yr,M([Tw(f(II,e,t))]))}),BI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",iI),f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)}),kI=a(function(e,t,r,n){return e?f(ka,iI,f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)):f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)}),NI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(WT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(BI,!1,e,t,r);default:var e=i.a,t=i.b;return d(BI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return jT;case"p":return qT;default:return JT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(kI,!1,e,t,n);default:var e=i.a,t=i.b;return d(kI,!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(JT,e,n,M([f(u,r,M([YT(RT.any+" "+RT.single)]))]))}}();switch(o.$){case"AsRow":return f(ow,sw,e)&&!f(ow,uw,e)?s:f(ow,tw,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerRight])))]),M([s])):f(ow,rw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(ow,iw,e)&&!f(ow,aw,e)?s:f(ow,nw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerCenterY])))]),M([s])):f(ow,ew,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerBottom])))]),M([s])):s;default:return s}}),RI=Tw,$I=function(e){return f(jT,M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthContent,RT.heightContent])))]),M([RI(e)]))},_I=function(e){return l(JT,"div",M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthFill,RT.heightFill])))]),M([Tw(e)]))},LI=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 R(e,HT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,HT),L(f(ka,L(n,f(s.html,MT,e)),i),Iu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,AT)?_I(c):$I(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 R(e,HT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,HT),L(f(ka,f(o.html,MT,e),n),Iu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,AT)?_I(u):$I(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children)),MT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children)),MT))}),xI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),PI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(BT,a|r,n)}var i=e.a;return f(BT,r,i|n)}),DI=ZT(7),UI=ZT(36),OI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(BT,r|a,n|i)}),MI=ZT(6),FI=ZT(38),VI=ZT(30),KI=ZT(29),HI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),jI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),qI=function(e){return{$:"Transform",a:e}},GI=function(e){return{$:"ChildrenBehind",a:e}},zI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),YI=function(e){return{$:"ChildrenInFront",a:e}},WI=r(function(e,t){return f(jT,M([YT(function(){switch(e.$){case"Above":return f(Ri," ",M([RT.nearby,RT.single,RT.above]));case"Below":return f(Ri," ",M([RT.nearby,RT.single,RT.below]));case"OnRight":return f(Ri," ",M([RT.nearby,RT.single,RT.onRight]));case"OnLeft":return f(Ri," ",M([RT.nearby,RT.single,RT.onLeft]));case"InFront":return f(Ri," ",M([RT.nearby,RT.single,RT.inFront]));default:return f(Ri," ",M([RT.nearby,RT.single,RT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Tw("");case"Text":var e=t.a;return $I(e);case"Unstyled":return(0,t.a)(AT);default:return f(t.a.html,MT,AT)}}()]))}),JI=n(function(e,t,r){var n=f(WI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?GI(M([n])):YI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?GI(f(ka,n,a)):f(zI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(zI,M([n]),i):YI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(zI,f(ka,n,a),i):f(zI,a,f(ka,n,i))}}),QI=r(function(e,t){switch(t.$){case"Generic":return TT(e);case"NodeName":var r=t.a;return f(HI,r,e);default:var n=t.a,a=t.b;return f(HI,n,a)}}),XI=function(e){switch(e.$){case"Left":return RT.alignedHorizontally+" "+RT.alignLeft;case"Right":return RT.alignedHorizontally+" "+RT.alignRight;default:return RT.alignedHorizontally+" "+RT.alignCenterX}},ZI=function(e){switch(e.$){case"Top":return RT.alignedVertically+" "+RT.alignTop;case"Bottom":return RT.alignedVertically+" "+RT.alignBottom;default:return RT.alignedVertically+" "+RT.alignCenterY}},eA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),tA=function(e){return{$:"Moved",a:e}},rA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return tA(x(r,0,0));case"MoveY":var n=t.a;return tA(x(0,n,0));case"MoveZ":var a=t.a;return tA(x(0,0,a));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(eA,x(0,0,0),i,x(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 tA(x(s,n,a));case"MoveY":var c=t.a;return tA(x(r,c,a));case"MoveZ":var f=t.a;return tA(x(r,n,f));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,u,x(1,1,1),i,o);default:var l=t.a;return d(eA,u,l,x(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(eA,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(eA,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(eA,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(eA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(eA,u,h,v,y);default:var m=t.a;return d(eA,u,m,p,o)}}}),nA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(kT,n,M([l(jI,n,"height",r+"px")]));case"Content":return x(f(PI,UI,kT),RT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(PI,iw,kT),RT.heightFill,yr):x(f(PI,iw,kT),RT.heightFillPortion+" height-fill-"+Ni(a),M([l(jI,RT.any+"."+RT.row+" > "+Ew("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(jI,u,"min-height",Ni(i)+"px"),c=nA(o),d=c.a,h=c.b,p=c.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(jI,u,"max-height",Ni(g)+"px"),v=nA(o),d=v.a,h=v.b,p=v.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p))}},aA=function(e){switch(e.$){case"Px":var t=e.a;return x(kT,RT.widthExact+" width-px-"+Ni(t),M([l(jI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(PI,FI,kT),RT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(PI,sw,kT),RT.widthFill,yr):x(f(PI,sw,kT),RT.widthFillPortion+" width-fill-"+Ni(r),M([l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(jI,i,"min-width",Ni(n)+"px"),u=aA(a),s=u.a,c=u.b,d=u.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(jI,i,"max-width",Ni(h)+"px"),p=aA(a),s=p.a,c=p.b,d=p.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d))}},iA=ZT(27),oA=r(function(e,t){if(R(e,iA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),uA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=hw(n);if("Nothing"===s.$)return{attributes:f(ka,YT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,YT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,qI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(oA,S,I)){var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(PI,S,r),y=f(rA,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(ow,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=RT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(PI,MI,r),y=n,m=f(ka,l(jI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+RT.widthContent,g=t,v=f(PI,FI,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+RT.widthFill,g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=aA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(ow,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(PI,DI,r),y=n,m=f(ka,l(jI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=RT.heightContent+" "+e,g=t,v=f(PI,UI,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=RT.heightFill+" "+e,g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.column+" > "+Ew("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=nA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(QI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(QI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(QI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(QI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(QI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(QI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(QI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return TT("p");case"NodeName":var e=t.a;return TT(e);default:var r=t.a,n=t.b;return f(HI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(JI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(ow,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=XI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(PI,rw,e);case"Right":return f(PI,tw,e);default:return e}}(f(PI,VI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(ow,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=ZI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(PI,nw,e);case"Bottom":return f(PI,ew,e);default:return e}}(f(PI,KI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),sA={$:"Untransformed"},cA=sA,fA=a(function(e,t,r,n){return l(LI,e,n,v(uA,UT(e),t,kT,cA,yr,yr,NT,$a(r)))}),lA=function(e){return ST(YT(e))},dA=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ST(gT("_blank")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e)))))),wT(M([n])))}),hA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),pA=n(function(e,t,r){return d(hA,e,t,r,1)}),gA=ZT(14),vA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),yA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),mA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return dw(t)+"-"+dw(r)+"-"+dw(n)+"-"+dw(a)},bA=function(e){return f(yA,gA,l(vA,"fc-"+mA(e),"color",e))},CA={align:ul,label:"cantConnectNoWeb3",mainParagraphs:M([M([fl("You need a web3 provider (such as "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(") to Connect.")]),M([fl("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:xg},EA={align:ul,label:"invalidUrl",mainParagraphs:M([M([fl("I don't understand that URL...")]),M([fl("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:$g},SA=function(e){return{$:"Active",a:e}},TA=gu(f(zo,jf,f(zo,Hh,$d("Error decoding hex to BigInt")))),wA=function(){return gu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),IA=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}}}}}}}}}}}},AA=function(e){return QE(M([f(Oi,si,e),Fi(ci)]))},BA=f(dh,AA(f(Oh,"status",wA)),f(dh,AA(f(Oh,"root",pu)),l(tS,"logsBloom",pu,l(tS,"logs",xm(dS),f(dh,AA(f(Oh,"contractAddress",rS)),l(tS,"cumulativeGasUsed",TA,l(tS,"gasUsed",TA,l(tS,"blockNumber",Gy,l(tS,"blockHash",oS,l(tS,"transactionIndex",Gy,l(tS,"transactionHash",cS,Fi(IA)))))))))))),kA=function(e){var t=e.a;return jf(t)},NA=f(zo,kA,hl),RA=r(function(e,t){return Up({decoder:BA,method:"eth_getTransactionReceipt",params:M([NA(t)]),url:e})}),$A=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),_A=r(function(e,t){return{$:"TxMined",a:e,b:t}}),LA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),xA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(Io,function(e){return e.b},f(Io,function(e){return e.onMinedTagger},f(fp,t,e))))}),PA=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}}}}}}}}}}}},DA=function(e){return QE(M([JE(ci),f(Oi,si,e)]))},UA=l(tS,"input",pu,l(tS,"gas",Gy,l(tS,"gasPrice",TA,l(tS,"value",TA,l(tS,"to",DA(rS),l(tS,"from",rS,l(tS,"transactionIndex",Gy,l(tS,"blockNumber",DA(Gy),l(tS,"blockHash",function(e){return f(du,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},cu(t))?Fi(ci):f(Oi,si,e)},pu)}(oS),l(tS,"nonce",Gy,l(tS,"hash",cS,Fi(PA)))))))))))),OA=r(function(e,t){return Up({decoder:UA,method:"eth_getTransactionByHash",params:M([NA(t)]),url:e})}),MA=r(function(e,t){return{attempts:e,sleep:t}}),FA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Xp,function(e){return a>0?f(Kp,function(e){return f(FA,f(MA,a,n),t)},YE(1e3*n)):Lp(e)},t)}),VA=r(function(e,t){return f(Kp,function(r){return f(FA,{attempts:30,sleep:1},f(OA,e,t))},YE(250))}),KA=r(function(e,t){return f(FA,{attempts:60,sleep:5},f(RA,e,t))}),HA=function(e){return{$:"Mined",a:e}},jA=function(e){return Bo(function(t){return D(t,{status:HA(e)})})},qA=function(e){return{$:"Sent",a:e}},GA=function(e){return Bo(function(t){return D(t,{status:qA(e)})})},zA=function(e){return{$:"Signed",a:e}},YA=function(e){return Bo(function(t){return D(t,{status:zA(e)})})},WA=function(e){return"Nothing"!==e.$},JA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Tl(r),Do);case"TxSigned":var n=e.a,a=e.b,i=f(fp,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(Yg,t,xp(a))}return Do}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Do;if("Just"===t.b.$){var r=t.b.a;return f(Yg,r,xp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Yg,a,xp(fi(e)))}t.a,t.b,t.c;return Do};if("Ok"===a.$){var c=a.a,d=WA(o.onBroadcastTagger)||WA(o.onMinedTagger)?f(il,r.tagger,f(Zp,LA(n),f(VA,r.nodePath,c))):Do;return L(Tl(D(r,{txs:l(bp,n,YA(c),r.txs)})),Po(M([u,d])))}var h=a.a;return L(Tl(r),Po(M([u,s(h)])))}return L(Tl(r),Do);case"TxSent":var n=e.a,p=e.b,g=f(fp,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(il,r.tagger,f(Zp,_A(n),f(KA,r.nodePath,v.hash))):Do}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Yg,t,xp(li(v)))}return Do}();return L(Tl(D(r,{txs:l(bp,n,GA(v),r.txs)})),Po(M([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(Yg,t,xp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Yg,n,xp(fi("Error with TxSent stuff")))}e.a,e.b;return Do}();return L(Tl(r),s)}return L(Tl(r),Do);case"TxMined":var n=e.a,m=e.b,b=f(fp,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Yg,a,xp(li(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 Po(M([f(il,r.tagger,f(Zp,f($A,n,s),zy(r.nodePath))),f(Yg,a,xp(li(C))),f(Yg,u.toMsg,xp(s))]))}return Do}();return L(Tl(D(r,{txs:l(bp,n,jA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Yg,r,xp(fi("TxReceipt decoding failure")))}return Do}();return L(Tl(r),S)}return L(Tl(r),Do);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(xA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Tl(r),f(Yg,B,f(Xp,function(e){return xp(D(I,{doneWatching:!0,reOrg:!0}))},f(Kp,function(e){return xp(D(I,{doneWatching:!0}))},f(RA,r.nodePath,T.txHash)))))}return L(Tl(r),Do)}if(R(w,T.lastCheckedBlock))return L(Tl(r),f(il,r.tagger,f(Zp,f($A,n,T),f(Kp,function(e){return zy(r.nodePath)},YE(2e3)))));var k=f(xA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Tl(r),Po(M([f(il,r.tagger,f(Zp,f($A,n,I),f(Kp,function(e){return zy(r.nodePath)},YE(2e3)))),f(Yg,B,xp(I))])))}return L(Tl(r),Do)}var n=e.a,h=e.c.a;return L(Tl(r),Do);default:var h=e.a;return L(Tl(r),Do)}}),QA=Jt,XA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),ZA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),eB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(ZA,"#",e.fragment,l(ZA,"?",e.query,U(f(XA,e.port_,U(t,e.host)),e.path)))},tB=r(function(e,t){return e<0?ci:Ql(f(nd,e,t))}),rB=r(function(e,t){if(e<0)return t;var r=Bh(f(nd,e,t)),n=f(lc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),nB=n(function(e,t,r){if(e<0)return r;var n=f(nd,e,r),a=f(lc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),aB=r(function(e,t){return f(nB,e,ms(t))}),iB=r(function(e,t){Kv(t);switch(t.$){case"Home":return L(D(e,{submodel:sT}),Do);case"Create":var r=Xd(e.wallet),n=f(Ul,e.txSentry,f(Yo,Uy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(uB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),Po(M([f(il,Uy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(By,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(mm,e.wallet,r)}return l(vm,e.wallet,u,s)}(),c=f(Ul,e.txSentry,f(Yo,Fy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(uB,U(f(Qi,Fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:My(r.model),txSentry:a}),Po(M([f(il,Fy,r.cmd),i]))));case"Marketplace":var d=Bv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Oy(h)}),Po(M([f(il,fT,p)])));case"AgentHistory":var g=t.a,v=f(Uo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:Py(y)}),Po(M([f(il,oT,m)])));default:return L(f(uo,EA,e),Do)}}),oB=r(function(e,t){var r=t.a,n=t.b,a=f(sB,uT(e),r),i=a.a,o=a.b;return L(i,Po(M([n,o])))}),uB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,oB,L(r,n),e)}),sB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(sB,cT,t);case"GotoRoute":var n=r.a;return L(t,f(Cy,t.key,n));case"GTag":var a=r.a;return L(t,wy(Sy(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),wy(Sy(d(Ol,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Uv,ky,o,u,s));default:return L(t,Ny(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(rB,c,t.userNotices)}),Do);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(by,t.key,eB(e))}var r=h.a;return QA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(cB,g,t);case"GotoRoute":var v=e.a;return L(t,Po(M([wy(Sy(d(Ol,"GotoRoute","navigation",Kv(v),0))),f(Cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Do);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,CA,t),Do):L(t,Ey(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Do;var t=e.a;return Iy(f(Ty,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Gh,pu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=SA(l(Ml,I,w,S)),B=f(Vy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ll,"Unexpected wallet state encounted when setting commPubkey!",ci),t),Do)}T.a;return L(f(uo,f(ll,"User pubkey set, but I can no longer find the user address!",ci),t),Do)}var N=E.a;return L(l(Pa,uo,f(ll,"error decoding commPubkey from JS",N),t),Do);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(lv,R,_),P=f(Ul,t.txSentry,f(Yo,Uy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(uB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),Po(M([f(il,Uy,x.cmd),F]))))}return L(t,Do);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(BS,K,j),q=f(Ul,t.txSentry,f(Yo,Fy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(uB,U(f(Qi,Fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:My(x.model),txSentry:O}),Po(M([f(il,Fy,x.cmd),F]))))}return L(t,Do);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Dv,G,Y);return f(uB,f(Qi,fT,x.appCmds),L(D(t,{submodel:Oy(x.model)}),f(il,fT,x.cmd)))}return L(t,Do);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(ol,W,Q),X=f(Ul,t.txSentry,f(Yo,oT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(uB,U(f(Qi,oT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Py(x.model),txSentry:O}),Po(M([f(il,oT,x.cmd),F]))))}return L(t,Do);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(_u,si,f(JA,Z,r))}return L(ci,Do)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(tB,re,t.tradeCaches);if("Nothing"===ae.$)return f(oB,pa(f(ll,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Do));var ie=ae.a,x=f(iT,ne,ie);return L(D(t,{tradeCaches:l(aB,re,x.tradeCache,t.tradeCaches)}),f(il,lT(re),x.cmd));case"NoOp":return L(t,Do);default:var N=e.a;f(cl,"test",N);return L(t,Do)}}),cB=r(function(e,t){return f(iB,t,my(e))}),fB=Ge("txIn",XE),lB=je("txOut",Ua),dB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},hB=function(e){return{$:"EventSentryMsg",a:e}},pB=function(e){var t=f(cm,hB,Xh(e)),r=t.a,n=t.b;return x({dataFetchState:l(QS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Zd,"tradeCache init","processing",dB(e),0)]))},gB=function(e){return{$:"InitialNumTradesFetched",a:e}},vB=function(e){return f(LS,e.factory,gB)},yB=function(e){var t=pB(e),r=t.a,n=t.b,a=t.c;return x(r,Po(M([n,vB(r)])),a)},mB=function(e){return{$:"TxSentryMsg",a:e}},bB={align:ul,label:"noWeb3Provider",mainParagraphs:M([M([fl("No web3 provider detected. Is "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(" or some other web3 provider installed and unlocked?")])]),noticeType:xg},CB={$:"TopLeft"},EB={align:CB,label:"screenToSmall",mainParagraphs:M([M([fl("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:xg},SB={align:ul,label:"wrongWeb3Network",mainParagraphs:M([M([fl("Make sure your wallet is set to a compatible network.")]),M([fl(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:$g},TB={$:"NoneDetected"},wB=function(e){return{$:"OnlyNetwork",a:e}},IB=function(e){return f(Bo,Xh,Mg(e))},AB={$:"ETCMain"},BB={$:"ETCTest"},kB={$:"Expanse"},NB={$:"Kovan"},RB={$:"Mainnet"},$B=function(e){return{$:"Private",a:e}},_B={$:"Rinkeby"},LB={$:"Ropsten"},xB={$:"RskMain"},PB={$:"RskTest"},DB=function(e){switch(e){case 1:return RB;case 2:return kB;case 3:return LB;case 4:return _B;case 30:return xB;case 31:return PB;case 42:return NB;case 41:return AB;case 62:return BB;default:return $B(e)}},UB=n(function(e,t,r){var n=e.a,a=e.b;return Tl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:cp})}),OB=n(function(e,t,n){var a=e.networkId?wB(DB(e.networkId)):TB,i=f(Bo,function(e){return l(UB,L(lB,fB),mB,e)},IB(a)),o=e.width<1024?si(EB):ci,u=f(xa,yB,ro),s=function(){return R(a,TB)?si(bB):"Nothing"===Mg(a).$?si(SB):ci}(),c=qC(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ay(f(Bi,r(function(e,t){return f(Qi,lT(e),t)}),g)),y=Po(f(Bi,r(function(e,t){return f(il,lT(e),t)}),p)),m=f(uB,v,f(cB,t,{key:n,screenWidth:e.width,submodel:sT,time:Vl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),Po(M([y,C])))}),MB=Oe,FB=MB(yr),VB=function(e){return FB},KB=function(e){return{$:"Refresh",a:e}},HB=r(function(e,t){return{$:"Every",a:e,b:t}}),jB=r(function(e,t){return{processes:t,taggers:e}}),qB=xp(f(jB,cp,cp)),GB=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(bS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),zB=Ne,YB=r(function(e,t){var r=e.a,n=e.b,a=f(fp,r,t);if("Nothing"===a.$)return l(xl,r,M([n]),t);var i=a.a;return l(xl,r,f(ka,n,i),t)}),WB=Be,JB=r(function(e,t){return{$:"Zone",a:e,b:t}}),QB=ca,XB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=WB(f(QB,n,f(Sp,e,n)));return f(Kp,function(t){return l(XB,e,a,l(xl,n,t,r))},i)}return xp(r)}),ZB=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 x(n,a,f(Kp,function(e){return i},zB(t)))}),u=l(Ra,YB,cp,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(xl,e,r,i),o)}),d=p(GB,s,c,o,u,i,x(yr,cp,xp(gr))),h=d.a,g=d.b,v=d.c;return f(Kp,function(e){return xp(f(jB,u,e))},f(Kp,function(t){return l(XB,e,h,g)},v))}),ek=function(e){return we(function(t){t(Se(e(Date.now())))})}(Vl),tk=n(function(e,t,r){var n=f(fp,t,r.taggers);if("Nothing"===n.$)return xp(r);var a=n.a,i=function(t){return Gp(f(xa,function(r){return f(Ep,e,r(t))},a))};return f(Kp,function(e){return xp(r)},f(Kp,i,ek))}),rk=r(function(e,t){var r=t.a,n=t.b;return f(HB,r,f(Da,e,n))});pn.Time=Pe(qB,ZB,tk,0,rk);var nk=Ue("Time"),ak=r(function(e,t){return nk(f(HB,e,t))}),ik=function(e){return f(ak,2e3,KB)},ok=function(e){return FB},uk=function(e){return{$:"DecryptionFinished",a:e}},sk=Ge("decryptionFinished",XE),ck=Ge("encryptionFinished",XE),fk=function(e){return{$:"EncryptionFinished",a:e}},lk=function(e){return{$:"Refresh",a:e}},dk=function(e){return MB(M([f(ak,3e3,lk),ck(fk),sk(function(e){return yE(uk(e))})]))},hk=yn,pk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return FB;case"CreateModel":t.a;return f(hk,Uy,ik());case"TradeModel":t.a;return f(hk,Fy,dk());case"MarketplaceModel":t.a;return f(hk,fT,ok());default:t.a;return f(hk,oT,VB())}},gk=Ge("userPubkeyResult",XE),vk=Ge("walletSentryPort",XE),yk={$:"CheckForNewTrades"},mk={$:"UpdateTradePhases"},bk=function(e){return MB(M([f(ak,5e3,function(e){return yk}),f(ak,3e3,function(e){return mk})]))},Ck=function(e){return{$:"Tick",a:e}},Ek=function(e){return{$:"UserPubkeySet",a:e}},Sk=function(e){return{$:"WalletStatus",a:e}},Tk=function(e){return f(ll,"Error decoding JS walletSentry: "+e,ci)},wk=function(e){return{$:"ErrorDecoding",a:e}},Ik=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Ak=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Oh,"ref",zC),f(Oh,"txHash",AA(cS))),Bk=function(e){var t=f(Gh,Ak,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Ik,r.ref,li(a))}return f(Ik,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return wk("Error decoding tx data")},kk=function(e){var t=e.a;return f(hk,t.tagger,t.inPort(Bk))},Nk=f(Oi,DB,zC),Rk=gu(f(zo,rd,f(zo,$d("Failure decoding stringy int"),au(DB)))),$k=QE(M([Rk,Nk])),_k=r(function(e,t){return{account:e,networkId:t}}),Lk=l(Mi,_k,f(Oh,"account",AA(rS)),f(Oh,"networkId",$k)),xk=n(function(e,t,r){var n=f(Gh,Lk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),Pk=function(e){var t=f(zo,Tk,f(zo,pa,uT));return MB(U(M([f(ak,1e3,Ck),vk(f(xk,t,Sk)),f(xc,FB,f(Bo,kk,e.txSentry)),gk(Ek),MB(f(Bi,r(function(e,t){return f(hk,lT(e),t)}),f(xa,bk,e.tradeCaches)))]),M([pk(e)])))},Dk=function(e){return{$:"LinkClicked",a:e}},Uk=function(e){return{$:"UrlChanged",a:e}},Ok=n(function(e,t,r){return d(hA,e/255,t/255,r/255,1)}),Mk=l(Ok,10,33,108),Fk={$:"Generic"},Vk=Fk,Kk=r(function(e,t){return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),e)),wT(M([t])))}),Hk=function(e){return{$:"Fill",a:e}},jk=Hk(1),qk=Hi,Gk=function(e){return{$:"Px",a:e}},zk=Gk,Yk=ZT(8),Wk=function(e){return f(yA,Yk,l(vA,"bg-"+mA(e),"background-color",e))},Jk=f(Kk,M([ET(jk),yT(zk(150)),Wk(Mk)]),qk),Qk=function(e){return{$:"GotoRoute",a:e}},Xk={$:"Active"},Zk={$:"Important"},eN={$:"Normal"},tN=l(pA,1,1,1),rN=ZT(2),nN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),aN=r(function(e,t){return R(e,t)?f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e)):f(yA,rN,h(nN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),iN=ZT(21),oN=r(function(e,t){return{$:"Class",a:e,b:t}}),uN=f(oN,iN,RT.cursorPointer),sN=ZT(17),cN=function(e){return f(yA,sN,l(jI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},fN=function(e){return{$:"Normal",a:e}},lN=An,dN=r(function(e,t){return f(lN,e,fN(t))}),hN=function(e){return f(dN,"click",Fi(e))},pN=f(Da,ST,hN),gN=ZT(13),vN=f(oN,gN,RT.textSemiBold),yN=ZT(4),mN=function(e){return{$:"FontSize",a:e}},bN=function(e){return f(yA,yN,mN(e))},CN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([cN(4),Wk(l(pA,0,0,1))]);default:return M([cN(4),Wk(l(pA,.9,0,0))])}}();return f(Kk,U(M([f(aN,23,12),bN(22),vN,bA(tN),uN,pN(t)]),n),fl(e))}),EN=l(Ok,244,0,103),SN=function(e){return{$:"AlignX",a:e}},TN={$:"CenterX"},wN=SN(TN),IN=ZT(3),AN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),BN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),kN=function(e){return f(yA,IN,l(AN,f(BN,e,e),e,e))},NN=function(e){return{$:"Describe",a:e}},RN={$:"Paragraph"},$N=r(function(e,t){return d(fA,HT,Vk,f(ka,NN(RN),f(ka,ET(jk),f(ka,kN(5),e))),wT(t))}),_N=f(oN,gN,RT.bold),LN=f(Kk,M([bN(29),bA(tN),_N,wN,uN,pN(Qk(Gv))]),f($N,yr,M([fl("DAI"),f(Kk,M([bA(EN)]),fl("Hard"))]))),xN={$:"Right"},PN=SN(xN),DN={$:"AsColumn"},UN=DN,ON=r(function(e,t){return d(fA,UN,Vk,f(ka,lA(RT.contentTop+" "+RT.contentLeft),f(ka,yT(bT),f(ka,ET(bT),e))),wT(t))}),MN={$:"AsRow"},FN=MN,VN=r(function(e,t){return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY),f(ka,ET(bT),f(ka,yT(bT),e))),wT(t))}),KN=function(e){return f(VN,M([ET(jk),kN(30),f(aN,30,17)]),M([l(CN,"Browse Offers",Qk(zv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Xk}return eN}()),l(CN,"Create a New Offer",Qk(qv),function(){return"CreateModel"===e.submodel.$?Xk:eN}()),function(){var t=Gd(e.wallet);if("Just"===t.$){var r=t.a;return l(CN,"My Trades",Qk(jv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Xk:eN}return eN}())}return l(CN,"Connect to Wallet",cT,Zk)}(),f(ON,M([PN,kN(0),f(aN,8,0)]),M([LN]))]))},HN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},jN=function(e){return ml(e)},qN=function(e){return f(ml,function(e){return gb(e.parameters)},OS(e))},GN={$:"BurnWindow"},zN={$:"FiatPrice"},YN={$:"Margin"},WN={$:"Offer"},JN={$:"PaymentWindow"},QN=function(e){return{$:"AlignY",a:e}},XN={$:"CenterY"},ZN=QN(XN),eR=ZT(20),tR=f(oN,eR,RT.clip),rR=Hk,nR=function(e){return f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e))},aR=r(function(e,t){return f(Kk,M([ET(rR(e)),yT(zk(60)),tR,Wk(tN)]),f(Kk,M([nR(12),ZN,ET(jk)]),t))}),iR=function(e){switch(e.$){case"Phase":return 1;case"Expires":return 2;case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},oR=function(e){return{$:"JustImage",a:e}},uR=oR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),sR=dT("alt"),cR=function(e){return f(dT,"src",rt(e))},fR=r(function(e,t){var r=t.src,n=t.description,a=f(ml,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(fA,AT,Vk,f(ka,lA(RT.imageContainer),e),wT(M([d(fA,AT,TT("img"),U(M([ST(cR(r)),ST(sR(n))]),a),wT(yr))])))}),lR=r(function(e,t){if("None"===t.$)return qk;var r=t.a;return f(fR,e,r)}),dR=oR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),hR=function(e){return{$:"ChangeSort",a:e}},pR=f(oN,gN,RT.textMedium),gR=function(e){return f(Kk,M([pR,bN(17)]),fl(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},vR=r(function(e,t){return f(VN,M([kN(5),uN,pN(hR(e))]),M([gR(e),function(){if("Just"===t.$){var e=t.a;return f(Kk,M([ZN]),f(lR,M([ET(zk(8))]),function(){return"Ascending"===e.$?uR:dR}()))}return qk}()]))}),yR=r(function(e,t){return f(aR,iR(t),f(vR,t,e))}),mR=r(function(e,t){return f(VN,M([ET(jk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(yR,r,t)},t))}),bR=l(Ok,150,150,150),CR=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},ER=r(function(e,t){return f(ts,e.amount,t.amount)}),SR=n(function(e,t,r){return f(e,r,t)}),TR=function(e){var t=e.a;return(R(e.b,Lo)?Ua:SR)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(TR,L(Av,Lo),e,t):l(SR,Ku,CR(e.state.phase),CR(t.state.phase))});case"Expires":return r(function(e,t){return f(hv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Sv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(ER,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(xc,ma,l(zd,r(function(e,t){return f(Ku,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(hv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(hv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},wR=l(Ok,233,237,242),IR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),AR=function(e){return f(Kk,M([ET(jk),yT(jk),tR]),f($N,M([bN(12)]),M([fl(e.info)])))},BR=function(e){return f(xc,qk,f(Bo,AR,Ql(e)))},kR=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"}},NR=function(e){return{$:"TimeLeft",a:e}},RR=function(e){return{$:"TimeUp",a:e}},$R=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 Vl(0)}}),_R=r(function(e,t){return Vl(jd(e)-jd(t))}),LR=r(function(e,t){var r=f($R,t.state.phase,t),n=f(_R,e,t.state.phaseStartTime),a=f(_R,r,n);return jd(a)>0?NR(L(a,r)):RR(r)}),xR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},PR=l(pA,0,0,0),DR=l(Ok,51,183,2),UR=function(e){var t=ju(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Qo(n));return n+(function(){if(a){return f(ru,a+1,f(Zo,1,mw(r)))}return""}()+"%")},OR=r(function(e,t){return oR({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"}()})}),MR=n(function(e,t,r){return f(lR,f(ka,yT(zk(34)),e),f(OR,t,r))}),FR=r(function(e,t){var r=UR(t);if("0%"===r)return f(Kk,M([bN(16)]),fl("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?DR:EN;return f(VN,M([kN(4)]),M([l(MR,yr,a,si(i)),f(Kk,M([bA(o),bN(16)]),fl(n))]))}),VR=oR,KR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(xl,r,n,t)}),cp,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,VR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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","₫")]))),HR=function(e){return f(xc,"",f(Bo,Qa,f(fp,e,KR)))},jR=function(e){return Qo(e)<=3?e:jR(f(Td,3,e))+","+f(ou,3,e)},qR=function(e){return jR(Sd(e))},GR=function(e){return U(HR(e.fiatType),qR(e.amount))},zR=hA,YR=function(e){var t=function(){var t=f(fp,e.fiatType,KR);if("Nothing"===t.$)return qk;var r=t.a,n=(r.a,r.b);return f(lR,M([yT(zk(26))]),n)}();return f(VN,M([kN(4)]),M([t,f(Kk,M([bA(d(zR,0,0,0,.5)),pR,ET(zk(50))]),fl(e.fiatType)),fl(GR(e))]))},WR=function(e){return jd(e)<0},JR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),QR=function(e){var t=vg(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(JR,aC(t),aC(r),aC(n),aC(a))}(f(xc,L(qu(0),qu(0)),f(Ts,n,qu(60))))}(f(xc,L(qu(0),qu(0)),f(Ts,r,qu(3600))))}(f(xc,L(qu(0),qu(0)),f(Ts,t,qu(86400))))},XR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!WR(a)){var u=r(function(e,t){return U(l(Rs,2,P("0"),Ni(e)),t)}),s=jd(a)>0?i:o,c=QR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(VN,U(M([kN(5)]),e),M([f(Kk,U(M([bA(h)]),t),fl(f(u,c.days,"d"))),f(Kk,U(M([bA(d)]),t),fl(f(u,c.hours,"h"))),f(Kk,U(M([bA(s)]),t),fl(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Vl(0);e=p,t=g,n=v,a=y}}),ZR={$:"Behind"},e$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),t$=function(e){return f(e$,ZR,e)},r$=r(function(e,t){var r=sv(200*e),n=200-r,a=f(Kk,M([ET(rR(n))]),qk),i=M([yT(zk(3)),cN(20)]),o=f(Kk,U(i,M([ET(rR(r)),Wk(t)])),qk),u=f(Kk,U(i,M([ET(jk),Wk(wR)])),qk);return f(VN,M([ET(jk),t$(u)]),M([o,a]))}),n$=l(pA,1,1,0),a$=r(function(e,t){return jd(e)/jd(t)}),i$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(a$,o,u),c=(f(Kk,M([wN]),d(XR,yr,yr,L(a,i),o)),s<.1?EN:s<.2?n$:DR);return f(ON,U(M([kN(5)]),e),M([d(XR,M([wN]),t,L(a,i),o),f(r$,1-s,c)]))}),o$=function(e){var t=wd(jl(e)),r=f(Xl,".",t);if(!r.b)return t;if(r.b.b){cl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(ru,3,t);case 1:return f(ru,4,f(xc,t,f(Bo,mw,f(Bo,function(e){return e/100},f(Bo,Ka,f(Bo,sv,f(Bo,ti(100),Bd(t))))))));default:var n=r.a;return f(xc,f(ru,n,t),f(Bo,Ni,f(Bo,sv,Bd(t))))}},u$=n(function(e,t,r){return f(aR,iR(t),function(){switch(t.$){case"Phase":return fl(xR(r.state.phase));case"Expires":if("Open"===r.state.phase.$){var n=f(LR,e,r);if("TimeLeft"===n.$){var a=n.a,i=f(a$,a.a,a.b)<.05?EN:PR;return d(i$,M([ET(jk)]),M([bN(16)]),L(i,wR),a)}var o=n.a;return d(i$,M([ET(jk)]),M([bN(16)]),L(EN,wR),L(Vl(0),o))}return qk;case"Offer":return f(VN,M([kN(5)]),M([fl(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(o$(r.parameters.tradeAmount)+" ")+kR(r.factory))]));case"FiatPrice":return YR(r.terms.price);case"Margin":var u=R(r.parameters.initiatorRole,fo);return f(xc,qk,f(Bo,FR(u),r.derived.margin));case"PaymentWindow":var s=function(){return"Seller"===r.parameters.initiatorRole.$?EN:DR}(),c=_(jd(r.parameters.autoabortInterval),216e5)<0?s:PR;return d(XR,yr,yr,L(c,wR),r.parameters.autoabortInterval);default:var s=function(){return"Seller"===r.parameters.initiatorRole.$?DR:EN}(),c=_(jd(r.parameters.autoabortInterval),216e5)<0?s:PR;return d(XR,yr,yr,L(c,wR),r.parameters.autoreleaseInterval)}}())}),s$=n(function(e,t,r){return f(ON,M([ET(jk),kN(1),Wk(wR),uN,pN(f(IR,r.factory,r.id))]),M([f(VN,M([ET(jk),kN(1)]),f(xa,function(t){return l(u$,e,t,r)},t)),f(aR,1,BR(r.terms.paymentMethods))]))}),c$=Er,f$=ZT(28),l$=function(e){return f(yA,f$,l(vA,"bc-"+mA(e),"border-color",e))},d$=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),h$=function(e){return f(yA,iA,h(d$,"b-"+Ni(e),e,e,e,e))},p$=a(function(e,t,r,n){return f(ON,M([ET(jk),h$(2),cN(8),l$(bR),kN(2),Wk(bR),tR]),f(xa,f(s$,e,r),f(c$,TR(t.orderBy),n)))}),g$=a(function(e,t,r,n){return f(ON,M([ET(jk),yT(jk),kN(5)]),M([f(mR,t.orderBy,r),d(p$,e,t,r,n)]))}),v$=n(function(e,t,r){var n=ay(f(xa,function(e){return f(jN,HN(r),qN(e))},t));return R(n,yr)?qk:f(Yi,Ko,d(g$,e,r.tradeTable,M([xo,WN,zN,YN,JN,GN]),n))}),y$=r(function(e,t){return f(Kk,M([cN(4),Wk(d(zR,0,0,1,.1)),bA(l(Ok,16,7,234)),bN(e),vN,f(aN,15,13)]),fl(dl(t)))}),m$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),b$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(yA,rN,h(nN,"p-"+Ni(t),t,t,t,t)):f(yA,rN,h(nN,d(m$,t,r,n,a),t,r,n,a))},C$=function(e){return function(){var t=Gd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?qk:f(VN,M([kN(10),b$({bottom:20,left:20,right:20,top:10})]),M([f(Kk,M([bN(24),vN]),fl("Trade History for User")),f(y$,18,e.agentAddress)]))},E$=function(e){return{$:"FiltersMsg",a:e}},S$=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},T$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),w$=xI,I$={$:"Left"},A$=SN(I$),B$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(fA,UN,TT("label"),e,wT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(fA,AT,Vk,a,wT(M([i])));switch(n.$){case"Above":return d(fA,UN,TT("label"),e,wT(M([o,r])));case"Below":return d(fA,UN,TT("label"),e,wT(M([r,o])));case"OnRight":return d(fA,FN,TT("label"),e,wT(M([r,o])));default:return d(fA,FN,TT("label"),e,wT(M([o,r])))}}),k$=function(e){return{$:"Label",a:e}},N$={$:"NoAttribute"},R$=function(e){if("HiddenLabel"===e.$){var t=e.a;return NN(k$(t))}return N$},$$=function(e){return"HiddenLabel"===e.$},_$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return hu("No key matched");var n=r.a;return Fi(n)},r=f(du,t,f(Oh,"key",pu));return ST(f(dN,"keyup",r))},L$=function(e){return f(Nn,"tabIndex",Ni(e))},x$=f(Da,ST,L$),P$={$:"LivePolite"},D$=NN(P$),U$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([$$(r)?N$:kN(6),ST(hN(i(!a))),D$,_$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),x$(0),uN,A$,ET(jk)]),e);return l(B$,o,r,d(fA,AT,Vk,M([ST(f(w$,"role","checkbox")),ST(f(w$,"aria-checked",a?"true":"false")),R$(r),ZN,yT(jk),ET(bT)]),wT(M([n(a)]))))}),O$=Br,M$=function(e){return e*O$/180},F$=ZT(26),V$=function(e){return{$:"MoveY",a:e}},K$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),H$=function(e){return f(K$,F$,V$(-e))},j$=ZT(24),q$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),G$=function(e){return f(K$,j$,f(q$,x(0,0,1),e))},z$=ZT(19),Y$=function(e){return Cd(M([e.inset?"box-inset":"box-",mw(e.offset.a)+"px",mw(e.offset.b)+"px",mw(e.blur)+"px",mw(e.size)+"px",mA(e.color)]))},W$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(yA,z$,l(jI,Y$(t),"box-shadow",Cw(t)))},J$=r(function(e,t){return f(yA,iA,h(d$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Q$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?h$(r):f(J$,n,r):f(yA,iA,h(d$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},X$=ZT(12),Z$=f(oN,X$,RT.textCenter),e_=l(pA,1,1,1),t_=function(e){return f(Kk,M([lA("focusable"),ET(zk(14)),yT(zk(14)),bA(e_),ZN,bN(9),Z$,cN(3),l$(e?l(pA,59/255,.6,252/255):l(pA,211/255,211/255,211/255)),W$({blur:1,color:e?d(zR,238/255,238/255,238/255,0):l(pA,238/255,238/255,238/255),offset:L(0,0),size:1}),Wk(e?l(pA,59/255,.6,252/255):e_),h$(e?0:1)]),e?f(Kk,M([l$(e_),yT(zk(6)),ET(zk(9)),G$(M$(-45)),wN,ZN,H$(1),Q$({bottom:2,left:2,right:0,top:0})]),qk):qk)},r_=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),n_={$:"OnRight"},a_=r_(n_),i_=r(function(e,t){return f(U$,yr,{checked:t.checked,icon:t_,label:f(a_,yr,fl(t.label)),onChange:f(T$,e,t.label)})}),o_={$:"Top"},u_=QN(o_),s_=function(e){return f(ON,M([kN(15),u_]),M([f(Kk,M([bN(28),pR]),fl(S$(e.type_))),f(ON,M([kN(5)]),f(xa,i_(e.type_),e.options))]))},c_=function(e){return f(VN,M([kN(20)]),f(xa,s_,e))},f_={$:"NoneFound"},l_={$:"AllFetched"},d_={$:"FetchingTrades"},h_={$:"QueryingNumTrades"},p_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return h_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?d_:l_}return f_},g_={$:"InFront"},v_=function(e){return f(e$,g_,e)},y_=r(function(e,t){var r=function(e){return f(Kk,M([bN(20),vN,bA(bR),wN]),fl(e))},n=f(Eh,Ja(f_),f(xa,p_,e))?M([r("No trades found.")]):f(xa,r,qC(f(xa,function(e){switch(p_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),v_(f(ON,M([kN(5),A$]),n))]),f(Kk,M([wN]),f(Yi,E$,c_(t.filters))))}),m_=n(function(e,t,r){return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),f(aN,30,20)]),M([C$(r),f(y_,t,r),l(v$,e,t,r)]))}),b_=function(e){return{$:"ShowCurrencyDropdown",a:e}},C_={$:"AbortCreate"},E_=function(e){return{$:"AppCmd",a:e}},S_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),T_=function(e){return f(xa,function(e){return M([f(Kk,M([bA(EN)]),fl("Caution! ")),fl(e)])},qC(M([R(f(hv,e.autoreleaseInterval,Vl(12e5)),ba)?si(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."}()):ci,R(f(hv,e.autoabortInterval,Vl(36e5)),ba)?si(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.'}()):ci])))},w_=l(pA,0,0,1),I_=function(e){return f(Kk,M([b$({bottom:5,left:5,right:5,top:0}),pN(e),cN(30),Wk(d(zR,1,1,1,.4)),h$(1),l$(d(zR,0,0,0,.3)),uN,bN(14)]),f(Kk,M([bA(d(zR,0,0,0,.7))]),fl("x")))},A_=Bn,B_=A_,k_=ST,N_=r(function(e,t){return f(Kk,M([t$(f(Kk,M([Wk(e),k_(f(B_,"position","fixed")),k_(f(B_,"z-index","1000")),k_(f(B_,"top","0")),k_(f(B_,"left","0")),k_(f(B_,"width","100%")),k_(f(B_,"height","100%"))]),qk)),ET(jk),yT(jk)]),t)}),R_=r(function(e,t){return{$:"Max",a:e,b:t}}),$_=r(function(e,t){return f(R_,e,t)}),__=n(function(e,t,r){return l(Pa,N_,d(zR,0,0,.3,.6),f(Kk,U(M([wN,ZN,ET(f($_,500,bT)),Wk(tN),cN(8),v_(f(Kk,M([PN,u_]),I_(r)))]),e),t))}),L_=r(function(e,t){if("Nothing"===t.$)return qk;var r=t.a;return f(Kk,U(M([cN(5),l$(l(pA,.9,0,0)),h$(1),Wk(l(pA,1,.4,.4)),nR(5),wN,ZN,ET(f($_,200,bT)),bN(14)]),e),f($N,yr,M([fl(r)])))}),x_={$:"Above"},P_=function(e){return f(e$,x_,e)},D_=r(function(e,t){return f(Kk,M([cN(4),f(aN,25,17),bN(18),vN,Wk(wR),P_(f(L_,M([H$(5)]),t))]),fl(e))}),U_=a(function(e,t,r,n){return d(hA,e/255,t/255,r/255,n)}),O_=d(U_,1,31,52,.64),M_=ZT(32),F_={$:"Active"},V_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),K_=$n,H_=r(function(e,t){switch(t.$){case"NoAttribute":return N$;case"Describe":var r=t.a;return NN(r);case"AlignX":var n=t.a;return SN(n);case"AlignY":var a=t.a;return QN(a);case"Width":var n=t.a;return CT(n);case"Height":var n=t.a;return vT(n);case"Class":var n=t.a,a=t.b;return f(oN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(yA,i,o);case"Nearby":var u=t.a,s=t.b;return f(e$,u,f(zi,e,s));case"Attr":var c=t.a;return ST(f(K_,e,c));default:var l=t.a,d=t.b;return f(K$,l,d)}}),j_=function(e){return f(H_,zg,e)},q_=r(function(e,t){var r=t.a,n=t.b,a=j_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(rA,n,o));default:return L(r,n)}}),G_=function(e){var t=l(Ra,q_,L(yr,sA),e),r=t.a,n=t.b;return f(ka,qI(n),r)},z_=function(e){return f(yA,M_,f(V_,F_,G_(e)))},Y_=ZT(33),W_={$:"Hover"},J_=function(e){return f(yA,Y_,f(V_,W_,G_(e)))},Q_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Kk,M([cN(4),uN,pN(n),f(aN,25,17),bA(t),bN(18),vN,Wk(a),z_(M([Wk(o)])),J_(M([Wk(i)]))]),fl(r))}),X_=r(function(e,t){return d(Q_,x(d(zR,1,0,0,1),d(zR,1,0,0,.8),d(zR,1,0,0,.6)),tN,e,t)}),Z_=function(e){return N_(d(zR,0,0,.3,.6))(f(ON,M([kN(10),wN,ZN,Wk(d(zR,0,0,0,.5)),cN(8),nR(20)]),f(xa,function(e){return f($N,M([wN,ZN,bN(20),vN,bA(tN),Z$]),M([e]))},e)))},eL=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+kA(t)}e.a;return"https://kovan.etherscan.io/tx/"+kA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+kA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+kA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+kA(t)}}),tL={$:"Bottom"},rL=QN(tL),nL=lA(RT.underline),aL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(fl(o$(Lb(a))),f(X_,"Yes, I definitely want to open this trade.",l(S_,r,n,a)))}return L(fl("??"),f(D_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(__,yr,f(ON,M([kN(20),nR(20),wN,yT(jk),Z$]),M([f(Kk,M([bN(26),vN,wN,ZN]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,ZN]),f(xa,$N(M([wN,bN(18),pR,bA(O_)])),U(T_(n),U(M([M([fl("You will deposit "),i,fl(" "+kR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([fl("This ususally requires two Metamask signatures. Your "+kR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Kk,M([rL,wN]),o)])),C_);case"ApproveNeedsSig":var u=e.a;return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),Z_(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","ApproveMining",0)))]),Z_(M([fl("Mining the initial approve transaction..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction on Etherscan"),url:f(eL,eo(u),s)}),fl("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),Z_(M([fl("Waiting for user signature for the create call."),fl("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","CreateMining",0)))]),Z_(M([fl("Mining the final create call..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction on Etherscan"),url:f(eL,r,s)}),fl("You will be redirected when it's mined.")])))}}),iL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return qk;var r=t.a;return f(aL,r,e)},oL=function(e){return{$:"TradeAmountChanged",a:e}},uL=dT("id"),sL=k_(uL("inputError")),cL=l(Ok,109,127,138),fL=oR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),lL=function(e){return f(lR,f(ka,yT(zk(26)),e),fL)},dL=function(e){return f(VN,M([kN(4)]),M([lL(yr),f(Kk,M([bN(24),pR,bA(cL)]),fl(kR(e)))]))},hL=function(e){return{$:"HiddenLabel",a:e}},pL=hL,gL=dT("type"),vL=function(e){return L(e,!0)},yL=function(e){return{$:"MayStopPropagation",a:e}},mL=r(function(e,t){return f(lN,e,yL(t))}),bL=r(function(e,t){return l(La,Oh,t,e)}),CL=f(bL,M(["target","value"]),pu),EL=function(e){return f(mL,"input",f(Oi,vL,f(Oi,e,CL)))},SL=ZT(0),TL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),wL=function(e){var t=function(e){return 1-e}(f(Tc,1,f(ei,0,e)));return f(yA,SL,f(TL,"transparency-"+dw(t),t))},IL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),AL=f(Da,ST,w$("autocomplete")),BL=l(pA,136/255,138/255,133/255),kL=l(pA,186/255,189/255,182/255),NL=f(aN,12,12),RL=M([NL,cN(3),l$(kL),Wk(e_),h$(1),kN(3),ET(jk)]),$L=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},_L=function(e){return f(Ch,$L,e)?N$:lA("focusable")},LL=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},xL=ye,PL=r(function(e,t){return f(kn,e,xL(t))}),DL=PL("spellcheck"),UL=f(Da,ST,DL),OL=W,ML=ZT(47),FL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(OL(e))),o=(i-1)*t+f(xc,0,f(Bo,a,r))+f(xc,0,f(Bo,a,n));return f(yA,ML,l(jI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),VL=dT("value"),KL=f(Da,ST,VL),HL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(fw,"width",n)?L(r,n):L(f(ka,e,r),f(TS,"width",n));case"Height":e.a;return f(fw,"height",n)?L(r,n):L(f(ka,e,r),f(TS,"height",n));case"Describe":e.a;return f(fw,"described",n)?L(r,n):L(f(ka,e,r),f(TS,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(fw,"align-x",n)?L(r,n):L(f(ka,e,r),f(TS,"align-x",n));case"AlignY":return f(fw,"align-y",n)?L(r,n):L(f(ka,e,r),f(TS,"align-y",n));default:return f(fw,"transform",n)?L(r,n):L(f(ka,e,r),f(TS,"transform",n))}}),L(yr,sm),e).a},jL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,HL(e))}),qL=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}},GL=f(Da,Gi,ms),zL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([ST(EL(n.onChange))]),o=U(RL,t),u=f(jL,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(ml,LL,o),c=f(jL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(jL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(jL,o,function(e){return"Nearby"===e.$})),p=f(ml,f(Da,ns,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([KL(n.text),ST(gL(a)),UL(e.spellchecked),lA(RT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return N$;var r=t.a;return AL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(qL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(IL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(IL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(xc,5,c);return x("textarea",U(M([UL(e.spellchecked),lA(RT.inputMultiline),f(xc,N$,f(Bo,AL,e.autofill)),function(){if("Nothing"===u.$)return N$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return b$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?N$:s.a?d(FL,n.text,v,u,g):N$}()]),h),M([GL(RI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(fA,AT,Vk,f(ka,ET(jk),ay(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([v_(f(Kk,f(ka,NL,U(s,U(M([bA(BL),lA(RT.noTextSelection+" "+RT.passPointerEvents),l$(d(zR,0,0,0,0)),Wk(d(zR,0,0,0,0)),yT(jk),ET(jk),wL(""===n.text?1:0)]),r))),a))])}()]))),wT(M([d(fA,AT,TT(v),ay(M([M([_L(t),R$(n.label)]),y,i])),wT(m))])));return l(B$,f(ka,f(oN,iN,RT.cursorText),f(ka,$$(n.label)?N$:kN(5),f(ka,D$,u))),n.label,b)}),YL=zL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),WL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(YL,M([ET(jk),yT(zk(40)),h$(0)]),{label:pL(r),onChange:i,placeholder:n,text:a});return f(VN,U(M([kN(5)]),e),qC(M([f(Bo,Kk(M([A$])),o),si(s),f(Bo,Kk(M([PN])),u)])))}),JL={$:"Below"},QL=function(e){return f(e$,JL,e)},XL=function(e){return f(K$,F$,V$(e))},ZL=n(function(e,t,r){return p(WL,M([ET(zk(150)),pR,bN(24),QL(f(L_,M([sL,XL(5)]),r))]),L(ci,si(f(Kk,M([pN(E_(d(Zd,"click","misclick","dai symbol in dai input",0)))]),dL(e)))),"dai input",ci,t,oL)}),ex=Kk(M([l$(wR),Q$({bottom:2,left:0,right:0,top:0})])),tx=r(function(e,t){return f(ON,M([kN(10)]),M([f(Kk,M([bN(17),vN]),fl(e)),t]))}),rx=r(function(e,t){return ex(f(tx,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(ZL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),nx=function(e){return f(xc,HE,Mg(e))},ax=function(e){var t=function(){var t=vd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+o$(f(Gl,r,100))+" "+kR(nx(e.wallet))+"."}return"There is a 1% fee."}();return f(VN,M([wN,f(aN,20,10),Wk(l(Ok,10,33,108)),cN(8),kN(5),pN(E_(d(Zd,"click","misclick","fee notify element",0)))]),M([f(Kk,M([bN(18),bA(l(Ok,0,226,255)),vN]),fl(t)),f(Kk,M([bN(17),bA(tN),pR]),fl("We only collect this fee when trades resolve successfully."))]))},ix=function(e){return{$:"FiatAmountChanged",a:e}},ox=function(e){return{$:"FiatTypeChanged",a:e}},ux=r(function(e,t){return l(bS,n(function(t,r,n){return f(e,t,r)?l(xl,t,r,n):n}),cp,t)}),sx=function(e){return f(ux,r(function(t,r){return f(Qg,e,t)}),KR)},cx=oR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),fx=function(e){return f(lR,M([yT(zk(26))]),f(xc,cx,f(Bo,fu,f(fp,e,KR))))},lx=function(e){return k_(f(mL,"click",Fi(L(e,!0))))},dx=GL,hx=function(e){return{$:"AppendProperty",a:e}},px=r(function(e,t){return hx(e+":"+t)}),gx=r(function(e,t){return f(px,e,t.value)}),vx=gx("cursor"),yx={$:"Compatible"},mx={cursor:yx,value:"default"},bx=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Cx=function(e){return{$:"PseudoClassSelector",a:e}},Ex=function(e){return bx(Cx(e))}("hover"),Sx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),Tx=Sx,wx=Tx,Ix=wx("span"),Ax=r(function(e,t){return f(kn,et(e),rt(t))}),Bx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),kx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),Nx=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),Rx=r(function(e,t){return t<>>32-e}),$x=function(e){var t=e.hash?e.seed^f(Nx,461845907,f(Rx,15,f(Nx,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(Nx,2246822507,r^r>>>16),a=f(Nx,3266489909,n^n>>>13);return(a^a>>>16)>>>0},_x=r(function(e,t){return f(Nx,5,f(Rx,13,e^f(Nx,461845907,f(Rx,15,f(Nx,3432918353,t)))))+3864292196}),Lx=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},VP=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+"]"}},KP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,VP,r)));case"UniversalSelectorSequence":var r=e.a;return Iu(r)?"*":f(Ri,"",f(xa,VP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,VP,r)))}},HP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([FP(t),KP(r)]))},jP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,KP(t),f(xa,HP,r)),i=f(Ri,"",M([f(xc,"",f(Bo,MP,n))]));return f(oc,f(Ri," ",f(ml,f(Da,ns,_d),a)),i)},qP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,jP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,OP(a),"\n",e,"}"]))}),GP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(qP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,_P,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,DP,qP(" ")),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"}},zP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(ml,f(Da,ns,_d),M([NP(t),f(Ri,"\n",f(xa,xP,r)),f(Ri,"\n",f(xa,PP,n)),f(Ri,"\n\n",f(xa,GP,a))])))},YP=function(e){return zP(kP(IP(e)))},WP=function(e){return f(Ri,"\n\n",f(xa,YP,e))},JP=function(e){return{$:"Snippet",a:e}},QP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),XP=function(e){return{$:"StyleBlockDeclaration",a:e}},ZP=r(function(e,t){var r=l(Xx,t,yr,ci);return JP(M([XP(l(QP,r,yr,e))]))}),eD=function(e){return Iu(e)?"unstyled":f(Is,P("_"),Ps(f(xx,15739,WP(AS(Px(AS(f(ZP,e,fP(yr)))))))))},tD=function(e){var t=eD(e),r=f(Ax,"className",hl(t));return l(Bx,r,e,t)},rD=a(function(e,t,r,n){return f(e,f(ka,tD(t),r),n)}),nD=function(e){return{$:"Unstyled",a:e}},aD=function(e){return nD(Tw(e))},iD=aD,oD=r(function(e,t){return f(Tn,e,Xe(t))}),uD=function(e){return En(Xe(e))},sD=r(function(e,t){var r=e.b,n=e.c;return Iu(r)?t:l(xl,n,r,t)}),cD=function(e){return e.a},fD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,sD,i,s),p=l(Ra,lD,L(yr,h),c),g=p.a,v=p.b,o=l(JT,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,sD,i,s),m=l(Ra,lD,L(yr,h),c),g=m.a,v=m.b,o=d(uD,y,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,sD,i,s),b=l(Ra,fD,L(yr,h),c),g=b.a,v=b.b,o=l(WT,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,sD,i,s),C=l(Ra,fD,L(yr,h),c),g=C.a,v=C.b,o=d(oD,y,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),lD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,sD,n,o),c=l(Ra,lD,L(yr,s),u),h=c.a,p=c.b,a=l(JT,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,sD,n,o),v=l(Ra,lD,L(yr,s),u),h=v.a,p=v.b,a=d(uD,g,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,sD,n,o),y=l(Ra,fD,L(yr,s),u),h=y.a,p=y.b,a=l(WT,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,sD,n,o),m=l(Ra,fD,L(yr,s),u),h=m.a,p=m.b,a=d(oD,g,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p)}}),dD=r(function(e,t){return h(Nl,kl,e,t,Rl,Rl)}),hD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(_d(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),pD=function(e){var t=f(hD,ci,e);if("Nothing"===t.$)return cp;var r=t.a,n=r.a,a=r.b;return f(dD,n,a)},gD=function(e){return{$:"ClassSelector",a:e}},vD=function(e){var t=e.a,r=e.b;return f(ZP,r,fP(M([gD(t)])))},yD=function(e){return WP(AS(Px(f(xa,vD,Ia(e)))))},mD=function(e){return l(JT,"style",yr,AS(Tw(yD(e))))},bD=n(function(e,t,r){var n=f(xa,cD,t),a=pD(t),i=l(Ra,lD,L(yr,a),r),o=i.a,u=i.b,s=mD(u);return l(JT,e,n,f(ka,s,$a(o)))}),CD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),ED=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(CD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),SD=r(function(e,t){return L(f(ED,"_",t),mD(e))}),TD=n(function(e,t,r){var n=f(xa,cD,t),a=pD(t),i=l(Ra,fD,L(yr,a),r),o=i.a,u=i.b,s=f(SD,u,o);return l(WT,e,n,f(ka,s,$a(o)))}),wD=a(function(e,t,r,n){var a=f(xa,cD,r),i=pD(r),o=l(Ra,fD,L(yr,i),n),u=o.a,s=o.b,c=f(SD,s,u);return d(oD,e,t,a,f(ka,c,$a(u)))}),ID=a(function(e,t,r,n){var a=f(xa,cD,r),i=pD(r),o=l(Ra,lD,L(yr,i),n),u=o.a,s=o.b,c=mD(s);return d(uD,e,t,a,f(ka,c,$a(u)))}),AD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(bD,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(ID,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(TD,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(wD,a,t,r,n)}},BD=AD,kD=function(e){return dx(BD(d(rD,Ix,M([Ex(M([vx(mx)]))]),yr,M([iD(e)]))))},ND=J,RD=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),$D=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),_D=function(e){return l(La,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 si(h(RD,n,a,i,o,u))}return ci}(),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 si(l($D,a,t,i))}return ci}())}),L(ci,ci),e)},LD=r(function(e,t){var r=_D(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),e))),wT(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?si(b$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),U(e,M([h]))))),wT(t))}var p=-s/2,g=-u/2;return d(fA,AT,Vk,e,wT(M([d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ST(f(B_,"margin",mw(p)+"px "+mw(g)+"px")),f(ka,ST(f(B_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,ST(f(B_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(yA,IN,l(AN,o,u,s)),yr))))),wT(t))])))}),xD=i(function(e,t,r,n,a){var i=f(YL,M([ET(zk(80)),yT(zk(40)),bN(24),pR,l$(wR),lx(r)]),{label:pL("currency type"),onChange:f(zo,ND,n),placeholder:ci,text:t}),o=f(fp,t,KR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return qk;r.b;return f(LD,M([ET(zk(350)),l$(PR),h$(1),Wk(tN),nR(10),wN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(VN,M([ET(zk(80)),kN(9),f(aN,0,5),lx(n(t)),J_(M([Wk(l(pA,.8,.8,1))]))]),M([f(lR,M([yT(zk(26))]),a),f(Kk,M([bN(16),vN]),kD(t))]))},Ia(sx(t))))}return qk}();return f(VN,M([kN(4),QL(u)]),M([f(Kk,M([pN(a)]),fx(t)),i]))}),PD=i(function(e,t,r,n,a){var i=E_(d(Zd,"click","misclick","currency flag",0)),o=f(Kk,M([pN(E_(d(Zd,"click","misclick","currency symbol",0)))]),fl(HR(e))),u=f(Kk,M([QL(f(L_,M([sL,XL(5)]),a))]),h(xD,r,e,b_(!0),ox,i));return p(WL,M([ET(zk(250)),pR,bN(24),QL(f(L_,M([sL,XL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,ix)}),DD=function(e){return ex(f(tx,"For fiat",h(PD,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},UD=function(e){return{$:"ChangeRole",a:e}},OD=d(U_,1,31,52,.13),MD=r(function(e,t){var r=M([bN(24),pR,uN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([bA(OD)]))):L(U(r,M([bA(OD)])),r)}(),a=n.a,i=n.b;return f(VN,M([kN(20)]),M([f(Kk,U(M([pN(UD(lo))]),i),fl("Sell "+e)),f(Kk,U(M([pN(UD(fo))]),a),fl("Buy "+e))]))}),FD=r(function(e,t){return f(tx,"Trade Type",f(MD,kR(e),t.inputs.userRole))}),VD=W$({blur:20,color:d(U_,0,0,0,.04),offset:L(0,3),size:0}),KD=f(oN,IN,RT.spaceEvenly),HD=function(e){var t=nx(e.wallet);return f(ON,M([ET(jk),kN(20),Wk(tN),cN(5),nR(20),VD]),M([f(VN,M([ET(jk),KD]),M([f(FD,t,e),f(rx,t,e),DD(e)])),ax(e)]))},jD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),qD={$:"Web3Connect"},GD=function(e){return f(Kk,M([wN]),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(X_,"Open Trade",f(jD,n,r))}t.b;return f(D_,"Unsupported Network",ci)}t.a;return f(X_,"Connect to Wallet",qD)}())},zD=function(e){return{$:"AutoabortIntervalChanged",a:e}},YD=function(e){return{$:"ChangePaymentMethodText",a:e}},WD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),JD=WD,QD=function(e){return f(JD,M([bA(d(zR,0,0,0,.2))]),function(){return fl("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")}())},XD={$:"TextArea"},ZD=r(function(e,t){return l(zL,{autofill:ci,spellchecked:t.spellcheck,type_:XD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),eU=n(function(e,t,r){var n=f(Kk,M([bN(22),vN]),fl("Payment Method")),a=f(ZD,M([ET(jk),yT(zk(150)),Wk(d(U_,155,203,255,.2)),h$(0)]),{label:pL("payment method"),onChange:YD,placeholder:""===r?si(QD(t)):ci,spellcheck:!0,text:r});return f(ON,M([kN(20),b$({bottom:15,left:45,right:45,top:0}),ET(jk),P_(f(L_,M([sL,XL(30),nR(10),bN(20),ET(zk(400))]),e))]),M([n,a]))}),tU=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."},rU=a(function(e,t,r,n){var a=l(Rs,e,P("0"),Ni(n));return f(Kk,M([bN(22),bA(t)]),fl(U(a,r)))}),nU=function(e){return jd(e)<0?Vl(0):e},aU=n(function(e,t,n){var a=r(function(e,r){return f(ON,M([kN(4)]),M([f(Kk,M([nR(4),uN,pN(n(f(mb,t,e)))]),f(lR,M([yT(zk(10))]),dR)),r,f(Kk,M([nR(4),uN,pN(n(function(e){return jd(e)?e:Vl(3e5)}(nU(f(_R,t,e)))))]),f(lR,M([yT(zk(10))]),uR))]))}),i=QR(t);return f(VN,M([KD,kN(10)]),M([f(a,Vl(864e5),d(rU,3,e," days",i.days)),f(a,Vl(36e5),d(rU,2,e," hours",i.hours)),f(a,Vl(3e5),d(rU,2,e," min",i.min))]))}),iU=o(function(e,t,r,n,a,i){var o=f(Kk,M([Wk(d(U_,155,203,255,.2)),cN(5),nR(15),P_(f(L_,M([sL]),a))]),l(aU,PR,n,i)),u=f(VN,M([kN(30)]),M([f(lR,M([yT(zk(40)),pN(E_(d(Zd,"click","misclick","symbol for "+t,0)))]),e),f(Kk,M([bN(22),vN]),fl(t))])),s=f($N,M([bN(17),pR,bA(O_)]),M([fl(r)]));return f(ON,M([ET(jk),cN(10),Wk(l(Ok,237,237,237)),kN(2)]),f(xa,Kk(M([Wk(tN),f(aN,45,18),ET(jk)])),M([u,f(VN,M([ET(jk),kN(25),Wk(tN)]),M([o,s]))])))}),oU=oR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),uU=f(oN,eR,RT.clipX),sU=f(oN,eR,RT.clipY),cU=i(function(e,t,r,n,a){return f(ON,M([kN(15),cN(8),uU,sU,Wk(tN)]),M([p(iU,oU,"Payment Window",tU(a),r,n,zD),l(eU,t,a,e)]))}),fU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},lU=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."},dU=oR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),hU=n(function(e,t,r){return f(Kk,M([cN(8),uU,sU,Wk(tN)]),p(iU,dU,"Burn/Release Window",lU(r),e,t,fU))}),pU=function(e){return{$:"AutorecallIntervalChanged",a:e}},gU=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."},vU=oR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),yU=n(function(e,t,r){return f(Kk,M([cN(8),Wk(tN),uU,sU]),p(iU,vU,"Open Window",gU(r),e,t,pU))}),mU=function(e){return f(ON,M([ET(jk),kN(20)]),M([l(yU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(cU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(hU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},bU=function(e){return f(ON,M([ET(f($_,1e3,jk)),wN,kN(20),b$({bottom:30,left:40,right:40,top:0}),pN(b_(!1)),v_(iL(e))]),M([HD(e),mU(e),GD(e.wallet)]))},CU=As(Fm(8226)),EU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),SU=r(function(e,t){return l(Ra,ka,t,e)}),TU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(SU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),wU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(SU,f(lc,e%r,t),l(TU,yr,e/r|0,t))):f(lc,e,t)}),IU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(fw,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(TS,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),AU=function(e){return d(IU,Ua,sm,e,yr)},BU=r(function(e,t){return f(Kk,M([ET(jk),v_(f(VN,M([kN(3),ET(rR(100)),ET(t),tR]),f(EU,f(Kk,M([bA(d(zR,0,0,0,.1)),bN(14)]),fl(CU)),f(xa,f(Da,Kk(M([bA(d(zR,0,0,0,.2))])),fl),f(wU,100,(e?$a:Ua)(AU(f(xa,f(zo,fu,Qa),Ia(KR)))))))))]),fl(" "))}),kU=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e))))),wT(M([n])))}),NU=lA(RT.italic),RU=function(){var e=f(Da,Kk(M([bA(l(pA,.8,.2,.2))])),fl),t=f(Da,Kk(M([_N])),fl);return f(ON,M([ET(jk),yT(jk),Wk(tN),cN(6),kN(50),W$({blur:20,color:d(U_,0,0,0,.1),offset:L(0,3),size:0}),cN(10),nR(20)]),M([f(BU,!1,jk),f(ON,M([wN,ET(f($_,700,jk)),kN(20)]),M([f($N,M([bN(70),_N,wN,Z$]),M([fl("DAI"),e("Hard")])),f(VN,M([bN(30),vN,wN,Z$,NU]),M([fl("The "),e("Global"),fl(", "),e("Unkillable"),fl(" Crypto Gateway")]))])),f(VN,M([Wk(bR),kN(2),wN,u_,ET(jk)]),M([f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([kN(60),PN]),M([f(Kk,M([bN(40),vN,wN]),fl("Want to learn more?")),f(ON,M([kN(15)]),M([f(kU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(w_),bA(tN),_N,bN(24),wN]),{label:f($N,M([Z$]),M([fl("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"}),f(kU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(w_),bA(tN),_N,bN(24),wN]),{label:f($N,M([Z$]),M([fl("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})]))]))),f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([A$,kN(60)]),M([f(Kk,M([bN(40),vN,wN]),fl("Ready to try it out?")),f(ON,M([kN(10),ET(zk(400)),wN]),M([f($N,M([bN(24),ET(jk)]),M([fl("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f($N,M([bN(24),ET(jk)]),M([fl("Then follow the links at the top of this page to browse "),t("Sell Offers"),fl(", browse "),t("Buy Offers"),fl(", or "),t("Create Your Own Offer"),fl(".")]))]))])))])),f(Kk,M([rL,ET(jk)]),f(BU,!0,jk))]))}(),$U=r(function(e,t){return f(Ay,f(zo,function(e){return e.type_},Ja(e)),t)}),_U=function(e){return{$:"ShowCurrencyDropdown",a:e}},LU=r(function(e,t){return ml(t(e))}),xU=a(function(e,t,r,n){var a=l(LU,e,n.filterFunc,ay(f(xa,qN,r)));return R(a,yr)?qk:f(Yi,Rv,d(g$,e,n.tradeTable,U(t?M([xo]):yr,M([Av,WN,zN,YN,JN,GN])),a))}),PU=function(e){return{$:"FiltersMsg",a:e}},DU={$:"ApplyInputs"},UU=PL("disabled"),OU=function(e){return{$:"MayPreventDefault",a:e}},MU=r(function(e,t){return f(lN,e,OU(t))}),FU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):hu("Not the enter key")},n=f(du,r,f(Oh,"key",pu));return ST(f(MU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),VU=function(e){return f(FU,"Enter",e)},KU={$:"Button"},HU=r(function(e,t){var r=t.onPress,n=t.label;return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY+" "+RT.seButton+" "+RT.noTextSelection),f(ka,uN,f(ka,_L(e),f(ka,NN(KU),f(ka,ST(L$(0)),function(){if("Nothing"===r.$)return f(ka,ST(UU(!0)),e);var t=r.a;return f(ka,pN(t),f(ka,VU(t),e))}()))))))),wT(M([n])))}),jU=f(HU,M([Wk(w_),nR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,ZN]),fl("Apply")),onPress:si(DU)}),qU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(yA,sN,l(jI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},GU=function(e){return f(dN,"focus",Fi(e))},zU=f(Da,ST,GU),YU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([zU(e(!0)),lx(e(!0))])}();return f(VN,U(e,M([yT(zk(40)),W$({blur:20,color:d(U_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Kk,M([Wk(wR),yT(zk(40)),qU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Kk,M([ZN,f(aN,10,0)]),r)),f(YL,U(s,U(t,M([ET(zk(100)),yT(zk(40)),l$(wR),qU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),Q$({bottom:1,left:0,right:1,top:1})]))),{label:pL(n),onChange:u,placeholder:i,text:a})]))}),WU=function(e){return{$:"MaxDaiChanged",a:e}},JU=function(e){return{$:"MinDaiChanged",a:e}},QU=r(function(e,t){return f(ON,M([ET(jk),kN(8)]),M([f(Kk,M([bN(17),pR]),fl(e)),t]))}),XU=ZT(25),ZU=function(e){return{$:"MoveX",a:e}},eO=function(e){return f(K$,XU,ZU(-e))},tO={$:"OnLeft"},rO=function(e){return f(e$,tO,e)},nO=n(function(e,t,r){var n=lL(M([ZN])),a=f(VN,M([kN(8),ZN,ET(zk(60))]),M([n,f(Kk,M([bN(16),ZN]),fl("max"))])),i=f(VN,M([kN(8),ZN,ET(zk(60))]),M([n,f(Kk,M([bN(16),ZN]),fl("min"))]));return f(QU,"Dai Range",f(ON,M([kN(5),ET(zk(200))]),M([v(YU,M([rO(f(L_,M([eO(5),ET(zk(200))]),r.minDai))]),M([zU(_U(!1))]),i,"min Dai",e,ci,ci,JU),v(YU,M([rO(f(L_,M([eO(5),ET(zk(200))]),r.maxDai))]),M([zU(_U(!1))]),a,"max Dai",t,ci,ci,WU)])))}),aO=function(e){var t=f(fp,e,KR);if("Nothing"===t.$)return fl("*");var r=t.a,n=r.b;return f(lR,M([yT(zk(26))]),n)},iO=function(e){return{$:"AppCmd",a:e}},oO=function(e){return{$:"FiatTypeInputChanged",a:e}},uO=n(function(e,t,r){var n=iO(d(Zd,"click","misclick","currency flag",0)),a=aO(t);f(VN,M([kN(8),ZN,ET(zk(60))]),M([a,f(Kk,M([bN(16),ZN]),fl("max"))])),f(VN,M([kN(8),ZN,ET(zk(60))]),M([a,f(Kk,M([bN(16),ZN]),fl("min"))]));return f(Kk,M([u_,ET(zk(120))]),f(QU,"Fiat Type",h(xD,e,t,_U(!0),oO,n)))}),sO={$:"AddSearchTerm"},cO=function(e){return{$:"PaymentMethodInputChanged",a:e}},fO=f(Oh,"keyCode",zC),lO=function(e){return f(dN,"keyup",f(du,function(t){return 13===t?Fi(e):hu(Ni(t))},fO))},dO=function(e){return f(QU,"Search Payment Methods",f(YL,M([u_,ET(zk(250)),yT(zk(40)),l$(wR),W$({blur:20,color:d(U_,233,237,242,.05),offset:L(0,3),size:0}),k_(lO(sO))]),{label:pL("payment methods search"),onChange:cO,placeholder:ci,text:e}))},hO={$:"ResetSearch"},pO=f(HU,M([Wk(w_),nR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,ZN]),fl("Reset")),onPress:si(hO)}),gO=function(e){return{$:"RemoveTerm",a:e}},vO=function(e){return f(Kk,M([nR(3),u_,uN,pN(gO(e)),bN(10),bA(EN)]),fl("x"))},yO=function(e){if(e.b){var t=e;return f(VN,M([ET(jk),nR(10),kN(10)]),f(xa,function(e){return f(VN,M([Wk(d(U_,16,7,234,.2)),cN(5),nR(4),kN(3)]),M([fl(e),vO(e)]))},t))}return qk},mO=i(function(e,t,r,n,a){var i=function(e){return f(Kk,M([bN(20),vN,bA(bR),wN]),fl(e))},o=f(Eh,Ja(f_),f(xa,p_,e))?M([i("No trades found.")]):f(xa,i,qC(f(xa,function(e){switch(p_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),v_(f(ON,M([kN(5),A$]),o))]),f(VN,M([wN,kN(50)]),M([f(Yi,PU,c_(t)),f(VN,M([ET(bT),kN(10)]),M([f(Kk,M([ET(bT),u_]),l(nO,r.minDai,r.maxDai,n)),f(Kk,M([ET(bT),u_]),l(uO,a,r.fiatType,n)),f(ON,M([ET(bT),u_,kN(5)]),M([dO(r.paymentMethod),yO(r.paymentMethodTerms)])),f(QU," ",f(ON,M([kN(5),ET(bT)]),M([jU,pO])))]))])))}),bO=n(function(e,t,r){var n=function(){return 1!==f(xc,0,f(Bo,function(e){return f(MS,function(e){return e.checked},e.options)},f($U,Eo,r.filters)))}();return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),pN(_U(!1)),nR(30)]),M([f(VN,M([ET(jk),kN(10)]),M([h(mO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),d(xU,e,n,t,r)]))}),CO=function(e){return{$:"MessageInputChanged",a:e}},EO={$:"MessageSubmit"},SO=function(e){return f(ON,M([ET(jk),kN(10)]),M([f(ZD,M([ET(jk),yT(zk(100))]),{label:pL("messageInput"),onChange:CO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(HU,M([wN,bN(24)]),{label:fl("Submit"),onPress:si(EO)})]))},TO=f(oN,eR,RT.scrollbarsY),wO=r(function(e,t){return f(Kk,M([yT(jk),ET(jk)]),f(Kk,U(M([k_(f(B_,"position","absolute")),k_(f(B_,"top","0")),k_(f(B_,"right","0")),k_(f(B_,"bottom","0")),k_(f(B_,"left","0")),TO]),e),t))}),IO=l(Ok,200,205,210),AO=n(function(e,t,r){var n=M([PN,Wk(w_),bA(tN),qU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([A$,Wk(IO),bA(PR),qU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Kk,U(M([nR(7)]),u),f($N,yr,M([fl(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(pA,0,0,1),tN,"Initiator opened the trade"));case"Recalled":return si(x(l(pA,0,0,1),tN,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(ru,8,dl(t))+"..";return si(x(l(pA,1,0,1),tN,r+" committed to the trade"));case"Aborted":return si(x(l(pA,1,0,0),tN,"Buyer aborted the trade"));case"Claimed":return si(x(l(pA,0,1,0),tN,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(pA,0,0,1),tN,"Seller released the "+kR(e)+" and closed the contract"));default:return si(x(l(pA,0,0,1),tN,"Seller burned the "+kR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return qk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Kk,M([cN(3),h$(1),l$(l(pA,1,0,1)),wN,Wk(h)]),f($N,M([bA(p)]),M([fl(g)])))}),BO=n(function(e,t,r){if(r.b){var n=r;return f(wO,M([ET(jk),yT(jk),cN(5),h$(1),l$(PR),nR(10)]),f(ON,M([ET(jk),yT(jk),kN(10)]),f(xa,f(AO,e,t),n)))}return f(Kk,M([ET(jk),yT(jk),cN(5),h$(1),l$(PR),wN,bA(l(pA,.5,.5,.5)),NU]),fl("no messages found."))}),kO=Cr,NO=function(e){return f(ON,M([ET(jk),yT(jk),kN(10),h$(1),cN(5),nR(20)]),M([l(BO,e.trade.factory,e.userRole,f(kO,function(e){return e.blocknum},Sa(e.history))),SO(e)]))},RO=function(e){return f(Kk,M([Wk(tN),cN(8),VD,ET(jk),yT(jk)]),NO(e))},$O={$:"ToggleChat"},_O=function(e){if(e.showChatHistory){var t=f(xc,qk,f(Bo,RO,e.chatHistoryModel));return f(Kk,M([yT(jk),ET(zk(500)),nR(20),PN]),l(__,M([yT(jk),ET(jk)]),f(Yi,yE,t),$O))}return qk},LO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},xO=function(e){return GR(e)+" "+e.fiatType},PO={$:"AbortAction"},DO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),UO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return qk}if("LoadedTrade"!==t.b.$)return qk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=xO(n.terms.price),u=o$(Lb(i)),s=o$(n.parameters.tradeAmount)+" "+kR(n.factory),c=function(){return"Buyer"===LO(n.parameters).$?L(f(Kk,M([pR,bA(PR)]),fl("buyer")),M([fl("pay the seller "),f(Kk,M([bA(w_)]),fl(o)),fl(" in exchange for the "),f(Kk,M([bA(w_)]),fl(s)),fl(" held in this contract.")])):L(f(Kk,M([pR,bA(PR)]),fl("seller")),M([fl("accept "),f(Kk,M([bA(w_)]),fl(o)),fl(" from the buyer in exchange for the "),f(Kk,M([bA(w_)]),fl(s)),fl(" held in this contract.")]))}(),d=c.a,h=c.b;return l(__,yr,f(ON,M([kN(20),nR(20),wN,yT(jk),Z$]),M([f(Kk,M([bN(26),vN,wN,ZN]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,ZN]),f(xa,$N(M([wN,bN(18),pR,bA(O_)])),U(M([U(M([fl("You will deposit "),f(Kk,M([bA(w_)]),fl(u+" "+kR(n.factory))),fl(", thereby becoming the "),d,fl(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([fl("(This ususally requires two Metamask signatures. Your "+kR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Kk,M([rL,wN]),f(X_,"Yes, I definitely want to commit to this trade.",l(DO,n,a,i)))])),PO);case"ApproveNeedsSig":return Z_(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return Z_(M([fl("Mining the initial approve transaction..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction on Etherscan"),url:f(eL,n.factory,p)}),fl("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return Z_(M([fl("Waiting for user signature for the final commit call."),fl("(check Metamask!)"),fl("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return Z_(M([fl("Mining the final commit transaction..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction"),url:f(eL,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(__,yr,f(ON,M([kN(20),nR(20),wN,yT(jk),Z$]),M([f(Kk,M([bN(26),vN,wN,ZN]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,ZN]),f(xa,$N(M([wN,bN(18),pR,bA(O_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([fl('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 '+kR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([fl("Aborting will incur a small penalty on both parties, and refund the rest of the "+kR(n.factory)+".")])]);case"Release":return M([M([fl("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([fl("This will destroy the "+kR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Kk,M([rL,wN]),function(e){return f(X_,e,DE(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 "+kR(n.factory)+".";default:return"I understand. Burn the "+kR(n.factory)+"."}}()))])),PO);case"ActionNeedsSig":var g=r.a;return Z_(M([fl("Waiting for user signature for the "+OE(g)+" call."),fl("(check Metamask!)")]));default:var g=r.a,p=r.b;return qk}},OO=VN(M([ET(jk),Wk(tN),cN(5),nR(20),KD,VD])),MO=function(e){return f(VN,M([kN(8)]),M([f(lR,yr,fL),f(Kk,M([bN(24),pR]),fl(o$(e)))]))},FO=r(function(e,t){var r=f(Io,Ao(e),f(Bo,function(e){return e.address},Gd(t)));return f(tx,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"}(),MO(e.parameters.tradeAmount))}),VO=function(e){return f(VN,M([kN(5)]),M([fx(e.fiatType),f(Kk,M([bN(24),pR]),fl(xO(e)))]))},KO=function(e){return f(tx,"For Fiat",VO(e.terms.price))},HO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},jO=l(Ok,250,165,22),qO=l(Ok,255,0,0),GO=l(Ok,0,255,0),zO=oR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),YO=oR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),WO=oR({description:"released",src:"/DAIHard/static/img/released.svg"}),JO={$:"ToggleStatsModal"},QO=function(e){return f(kO,Ua,e)},XO=n(function(e,t,n){var a=ay(f(xa,function(e){return f(ml,function(e){return R(f(ko,e,n),si(t))},f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(fh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(fh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wl,amountReleased:Wl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,Vl,Ql(QO(f(US,function(e){return function(e){return e?si(e):ci}(jd(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}}),ZO=r(function(e,t){return d(Q_,x(d(zR,0,0,1,1),d(zR,0,0,1,.8),d(zR,0,0,1,.6)),tN,e,t)}),eM=function(e){return{$:"ViewUserHistory",a:e}},tM=f(JB,0,yr),rM=f(oN,gN,RT.textNormalWeight),nM=r(function(e,t){return Za(e/t)}),aM=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}}),iM=r(function(e,t){var r=e.a,n=e.b;return l(aM,r,f(nM,jd(t),6e4),n)}),oM=r(function(e,t){return f(_s,24,f(nM,f(iM,e,t),60))}),uM=r(function(e,t){return f(_s,1e3,jd(t))}),sM=r(function(e,t){return f(_s,60,f(iM,e,t))}),cM={$:"Apr"},fM={$:"Aug"},lM={$:"Dec"},dM={$:"Feb"},hM={$:"Jan"},pM={$:"Jul"},gM={$:"Jun"},vM={$:"Mar"},yM={$:"May"},mM={$:"Nov"},bM={$:"Oct"},CM={$:"Sep"},EM=function(e){var t=f(nM,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)}},SM=r(function(e,t){switch(EM(f(iM,e,t)).month){case 1:return hM;case 2:return dM;case 3:return vM;case 4:return cM;case 5:return yM;case 6:return gM;case 7:return pM;case 8:return fM;case 9:return CM;case 10:return bM;case 11:return mM;default:return lM}}),TM=r(function(e,t){return f(_s,60,f(nM,jd(t),1e3))}),wM={$:"Fri"},IM={$:"Mon"},AM={$:"Sat"},BM={$:"Sun"},kM={$:"Thu"},NM={$:"Tue"},RM={$:"Wed"},$M=r(function(e,t){switch(f(_s,7,f(nM,f(iM,e,t),1440))){case 0:return kM;case 1:return wM;case 2:return AM;case 3:return BM;case 4:return IM;case 5:return NM;default:return RM}}),_M=n(function(e,t,r){return e.toAmPm(f(oM,t,r))}),LM=r(function(e,t){return EM(f(iM,e,t)).day}),xM=LM,PM=M([BM,IM,NM,RM,kM,wM,AM]),DM=r(function(e,t){return function(e){return e.a}(f(xc,L(0,BM),Ql(f(ml,function(r){return R(r.b,f($M,e,t))},f(Bi,r(function(e,t){return L(e,t)}),PM)))))}),UM=function(e){return l(Ra,Na,0,e)},OM=r(function(e,t){return EM(f(iM,e,t)).year}),MM=function(e){return!f(_s,4,e)&&(!!f(_s,100,e)||!f(_s,400,e))},FM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return MM(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}}),VM=M([hM,dM,vM,cM,yM,gM,pM,fM,CM,bM,mM,lM]),KM=r(function(e,t){return f(xc,L(0,hM),Ql(f(ml,function(r){r.a;return R(r.b,f(SM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),VM))))}),HM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(KM,e,t))}),jM=r(function(e,t){var r=f(lc,f(HM,e,t)-1,VM);return UM(f(xa,FM(f(OM,e,t)),r))+f(xM,e,t)}),qM=r(function(e,t){return f(HM,e,t)/4|0}),GM=r(function(e,t){var r=Ni(t),n=e-Qo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),zM=function(e){return e?e<=12?e:e-12:12},YM=sv(315576e5),WM=r(function(e,t){return Vl(YM*f(OM,e,t))}),JM=r(function(e,t){var r=f(WM,e,t),n=f(DM,e,r);return 1+((f(jM,e,t)+n)/7|0)}),QM=r(function(e,t){return Ni(f(OM,e,t))}),XM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(HM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(HM,t,r));case"MonthFixed":return f(GM,2,f(HM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(SM,t,r));case"MonthNameFull":return e.toMonthName(f(SM,t,r));case"QuarterNumber":return Ni(1+f(qM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(qM,t,r));case"DayOfMonthNumber":return Ni(f(xM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(xM,t,r));case"DayOfMonthFixed":return f(GM,2,f(xM,t,r));case"DayOfYearNumber":return Ni(f(jM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(jM,t,r));case"DayOfYearFixed":return f(GM,3,f(jM,t,r));case"DayOfWeekNumber":return Ni(f(DM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(DM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f($M,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f($M,t,r));case"WeekOfYearNumber":return Ni(f(JM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(JM,t,r));case"WeekOfYearFixed":return f(GM,2,f(JM,t,r));case"YearNumberLastTwo":return f(ou,2,f(QM,t,r));case"YearNumber":return f(QM,t,r);case"AmPmUppercase":return ND(l(_M,e,t,r));case"AmPmLowercase":return sd(l(_M,e,t,r));case"HourMilitaryNumber":return Ni(f(oM,t,r));case"HourMilitaryFixed":return f(GM,2,f(oM,t,r));case"HourNumber":return Ni(zM(f(oM,t,r)));case"HourFixed":return f(GM,2,zM(f(oM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(oM,t,r));case"HourMilitaryFromOneFixed":return f(GM,2,1+f(oM,t,r));case"MinuteNumber":return Ni(f(sM,t,r));case"MinuteFixed":return f(GM,2,f(sM,t,r));case"SecondNumber":return Ni(f(TM,t,r));case"SecondFixed":return f(GM,2,f(TM,t,r));case"MillisecondNumber":return Ni(f(uM,t,r));case"MillisecondFixed":return f(GM,3,f(uM,t,r));default:return n.a}}),ZM=a(function(e,t,r,n){return f(Ri,"",f(xa,l(XM,e,r,n),t))}),eF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),tF=function(e){return e>11?"pm":"am"},rF=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"}},nF=function(e){switch(f(_s,100,e)){case 11:case 12:case 13:return"th";default:switch(f(_s,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},aF=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"}},iF=p(eF,rF,f(zo,rF,ru(3)),aF,f(zo,aF,ru(3)),tF,nF),oF=ZM(iF),uF={$:"MonthNameFull"},sF=uF,cF=function(e){return{$:"Text",a:e}},fF=cF,lF={$:"YearNumber"},dF=lF,hF=n(function(e,t,n){var a=r(function(e,t){return f(ON,M([bN(18),kN(6)]),M([f(Kk,M([_N]),fl(e)),f(Kk,M([rM]),fl(t))]))}),i=oF(M([sF,fF(", "),dF])),o=f(ON,M([kN(23),ET(jk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,tM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+o$(n.amountReleased)+" "+kR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+o$(n.amountBurned)+" "+kR(e)+" Burned")])),M([f(Kk,M([wN]),f(ZO,"View User History",eM(n.asRole)))])));return f(ON,M([cN(8),uU,sU,Wk(wR),kN(1),W$({blur:20,color:d(zR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Kk,M([ET(jk),Wk(tN),nR(17)]),f(y$,18,t)),f(Kk,M([ET(jk),Wk(tN),nR(17)]),o)]))}),pF=n(function(e,t,r){var n=l(XO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=HO(e.parameters.initiatorRole)+" Stats";return f(Kk,r?M([QL(f(Kk,M([XL(30),PN]),l(hF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(tx,a,f(VN,M([ET(jk),kN(20),uN,pN(JO)]),f(xa,VN(M([kN(5)])),M([M([f(lR,M([yT(zk(28))]),WO),f(Kk,M([bN(24),pR,bA(GO)]),fl(l(Rs,2,P("0"),Ni(n.numReleases))))]),M([f(lR,M([yT(zk(28))]),zO),f(Kk,M([bN(24),pR,bA(jO)]),fl(l(Rs,2,P("0"),Ni(n.numAborts))))]),M([f(lR,M([yT(zk(28))]),YO),f(Kk,M([bN(24),pR,bA(qO)]),fl(l(Rs,2,P("0"),Ni(n.numBurns))))])])))))}),gF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+dl(t)}e.a;return"https://kovan.etherscan.io/address/"+dl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+dl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+dl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+dl(t)}}),vF=n(function(e,t,r){return f(dA,e,{label:fl(dl(r)),url:f(gF,t,r)})}),yF=function(e){return f(tx,"Trade Status",f(ON,M([bN(24),pR,kN(8)]),M([fl(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(vF,M([bN(12),bA(w_),nL]),e.factory,e.creationInfo.address)])))},mF=i(function(e,t,r,n,a){return OO(M([yF(t),f(FO,t,r),KO(t),l(pF,t,n,a)]))}),bF=l(Ok,9,32,107),CF=oR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),EF=f(Kk,M([cN(4),uN,pN($O),nR(5),Wk(l(Ok,22,0,255))]),f(lR,M([ET(zk(42))]),CF)),SF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},TF=function(e){return f(ON,M([cN(12),Wk(wR),nR(15),kN(15)]),M([f(Kk,M([bN(24),vN,NU]),fl("Fiat Payment Method")),f($N,M([bN(18),yT(bT),Wk(tN),W$({blur:5,color:d(zR,0,0,0,.2),offset:L(-3,3),size:0}),cN(3),nR(5)]),M([f(xc,f(Kk,M([bA(OD),NU]),fl("No payment methods found.")),f(Bo,fl,f(Bo,function(e){return e.info},Ql(e))))]))]))},wF={$:"Active"},IF=function(e){return{$:"ExpandPhase",a:e}},AF=M([Wk(bF),bA(tN)]),BF=r(function(e,t){return{$:"Min",a:e,b:t}}),kF=r(function(e,t){return f(BF,e,t)}),NF=function(e){return M(e?[cN(12),u_,yT(f(kF,380,bT))]:[cN(12),wN])},RF=M([Wk(tN)]),$F=oR({description:"flame",src:"/DAIHard/static/img/flame.png"}),_F=r(function(e,t){return Hl(f(ds,jl(e),jl(t)))}),LF=r(function(e,t){return d(Q_,x(d(zR,1,.6,.2,1),d(zR,1,.6,.2,.8),d(zR,1,.6,.2,.6)),tN,e,t)}),xF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),PF=function(e){return{$:"ContractActionClicked",a:e}},DF={$:"Web3Connect"},UF=n(function(e,t,r){var n=Gd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(LR,e,t).$?qk:f(VN,M([kN(8)]),function(){var e=x(t.state.phase,f(Ao,t,a.address),f(ko,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,DE,f(ZO,"Remove and Refund this Trade",xE))])}break e}var r=(e.a,e.b,jl(hb(t.parameters)));return M([f(X_,"Deposit and Commit to Trade",l(xF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,PF,f(LF,"Abort Trade",bE)),f(Yi,PF,f(X_,"Confirm Payment",AE)),EF])}e.a,e.c.a;return M([EF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,PF,f(X_,"Burn it All!",IE)),f(Yi,PF,f(ZO,"Release Everything",PE)),EF])}e.a,e.c.a;return M([EF])}break e;default:break e}return yr}())}return f(X_,"Connect to Wallet",DF)}),OF={$:"Finished"},MF={$:"NotStarted"},FF=r(function(e,t){var r=L(CR(t),CR(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?MF:R(n,a)?wF:OF}),VF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),KF=r(function(e,t){return l(VF,yr,e,t)}),HF=a(function(e,t,r,n){var a=o$(f(fh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+kR(r.factory),i=o$(r.parameters.tradeAmount)+" "+kR(r.factory),o=f(VN,yr,f(KF,3,f(lR,M([yT(zk(18))]),$F))),u=f(Da,Kk(M([bA(l(pA,1,0,0))])),fl),s=R(e,r.state.phase),c=f(Io,ko(r),f(Bo,function(e){return e.address},Gd(n))),d=s?tN:PR,h=$N(M([bA(d),bN(18),vN])),p=xO(r.terms.price),g=s?l(Ok,0,226,255):l(Ok,16,7,234),v=f(Da,Kk(M([bA(g)])),fl),y=o$(r.parameters.buyerDeposit)+" "+kR(r.factory),m=r.parameters.abortPunishment,b=o$(m)+" "+kR(r.factory),C=o$(f(_F,r.parameters.buyerDeposit,m))+" "+kR(r.factory),E=o$(f(_F,r.parameters.tradeAmount,m))+" "+kR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([fl("Your "),u("burnable deposit"),fl(" of "),v(y),fl(" is now held in this contract, and your offer to buy "),v(i),fl(" for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Seller by depositing the full "),v(i),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),fl(" to you.")])])):f(xa,h,M([M([fl("Your offer to sell the "),v(i),fl(" held in this contract for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),fl(" of 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),fl(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([fl("You must now pay the Seller "),v(p),fl(" via the Fiat Payment Method, "),f(Kk,M([vN]),fl("and then click ")),u("Confirm Payment"),fl(" before the payment window runs out. Use the chat to coordinate.")]),M([fl("If you abort the trade, or do not confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to you).")]),M([fl("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),fl(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([fl("Work and communicate with the Buyer to receive "),v(p),fl(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to you, "),v(C),fl(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),fl(" will be released to you.")]),M([fl("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),fl(" In this case the "),v(a),fl(" will be lost to both parties.")]),M([fl("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([fl("So, have you recieved the "),v(p),fl("? If so, you can click "),v("Release Everything"),fl(".")]),M([fl("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),fl(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([fl("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([fl("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([fl("The Seller has deposited "),v(i),fl(" into this contract, and offers to sell it for "),v(p),fl(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("If the trade is successful, the combined "+kR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),fl(" within the payment window.")])])):f(xa,h,M([M([fl("The Buyer is offering to buy "),v(i),fl(" for "),v(p),fl(", and has deposited "),v(y),fl(" into this contract as a "),u("burnable deposit"),fl(". To become the Seller, deposit "),v(i),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("When you receive the "),v(p),fl(" from the Buyer, the combined "+kR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can receive "),v(p),fl(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([fl("During this phase, the Buyer is expected to transfer "),v(p),fl(" to the Seller, as described in Fiat Payment Method, "),f(Kk,M([vN]),fl("and ")),u("Confirm the Payment "),fl(" before the payment window runs out. This would move the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(" amount) will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([fl("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([fl("If the Seller can verify he has received the "),v(p),fl(", he will probably release the total balance of "),v(i),fl(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),fl(".")]),M([fl("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),fl(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(ON,M([ET(jk),yT(jk),nR(20),kN(30)]),M([f(VN,M([ET(jk)]),M([f(Kk,M([bN(24),vN,bA(g),A$]),fl(T))])),f(ON,M([ET(jk),ZN,kN(13)]),w),f(Kk,M([PN]),function(){switch(f(FF,r,e).$){case"Active":return l(UF,t,r,n);case"NotStarted":return f(Kk,M([bN(20),vN,NU,bA(bR)]),fl("Phase not yet started."));default:return f(Kk,M([bN(20),vN,NU]),fl("Phase no longer active."))}}())]))}),jF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},qF=oR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),GF=oR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),zF={$:"None"},YF=zF,WF=oR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),JF=function(e){switch(e.$){case"Open":return WF;case"Committed":return qF;case"Judgment":return GF;default:return YF}},QF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),XF=a(function(e,t,r,n){return d(QF,e,t,r,n)}),ZF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},eV=function(e){return function(e){return d(XF,e.red,e.green,e.blue,e.alpha)}(ZF(e))},tV=function(e){return{$:"Circle",a:e}},rV=tV,nV=d(QF,0,0,0,1),aV={$:"Flat"},iV={$:"Sharp"},oV=function(e){return{$:"Uniform",a:e}},uV=oV,sV={cap:aV,dashPattern:yr,dashPhase:0,fill:uV(nV),join:iV,thickness:2},cV=n(function(e,t,r){return D(sV,{dashPattern:e,fill:r,thickness:t})}),fV=cV(yr),lV={$:"Transparent"},dV=lV,hV=f(fV,0,dV),pV=r(function(e,t){return{$:"Shape",a:e,b:t}}),gV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},vV=function(e){return f(Da,gV,pV(e))},yV=function(e){return vV(L(e,hV))},mV=function(e){return L(-e.a,-e.b)},bV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),CV=r(function(e,t){return f(bV,mV(e(t)),t)}),EV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},SV=r(function(e,t){return{$:"Path",a:e,b:t}}),TV=kr,wV=Nr,IV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=wV(n),i=TV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},AV=function(e){return xa(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)})},BV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(AV,e,M([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),kV=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},NV=function(e){var t=RV(e.basic),r=EV(f(xa,IV(e),t)),n=r.a,a=r.b;return{toBottom:-f(xc,0,gI(a)),toLeft:-f(xc,0,gI(n)),toRight:f(xc,0,pI(n)),toTop:f(xc,0,pI(a))}},RV=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(BV,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(BV,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(BV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(AV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(SV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(AV,R(C,aV)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(BV,0,E);case"Group":var S=e.a;return f(AV,0,ay(f(xa,f(zo,NV,kV),S)));default:var T=e.b;return f(AV,0,kV(NV(T)))}},$V=function(e){var t=NV(e);return t.toTop+t.toBottom},_V=function(e){var t=NV(e);return L(-t.toLeft,t.toTop)},LV=function(e){var t=NV(e);return t.toLeft+t.toRight},xV=En("http://www.w3.org/2000/svg"),PV=xV("svg"),DV=Nn("height"),UV=Nn("version"),OV=Nn("width"),MV=xV("circle"),FV=xV("ellipse"),VV=xV("foreignObject"),KV=xV("g"),HV=xV("image"),jV=xV("polygon"),qV=xV("polyline"),GV=xV("rect"),zV=Tw,YV=xV("text"),WV=Nn("id"),JV=Nn("points"),QV=Nn("r"),XV=Nn("rx"),ZV=Nn("ry"),eK=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},tK=function(e){return{$:"Group",a:e}},rK=Nn("dominant-baseline"),nK=Nn("fill"),aK=Nn("fill-opacity"),iK=Nn("font-family"),oK=Nn("font-size"),uK=Nn("font-style"),sK=Nn("font-variant"),cK=Nn("font-weight"),fK=Nn("opacity"),lK=Nn("stroke"),dK=Nn("stroke-dasharray"),hK=Nn("stroke-dashoffset"),pK=Nn("stroke-linecap"),gK=Nn("stroke-linejoin"),vK=Nn("stroke-opacity"),yK=Nn("stroke-width"),mK=Nn("text-anchor"),bK=Nn("text-decoration"),CK=Nn("transform"),EK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},SK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},TK=n(function(e,t,r){return d(QF,e,t,r,1)}),wK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return sv(1e4*e)/100};return Cd(M(["rgba(",mw(i(t)),"%,",mw(i(r)),"%,",mw(i(n)),"%,",mw(function(e){return sv(1e3*e)/1e3}(a)),")"]))},IK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},AK=function(e){var t=IK(e),r=t.red,n=t.green,a=t.blue;return wK(l(TK,r,n,a))},BK=function(e){if("Uniform"===e.$){var t=e.a;return AK(t)}return"none"},kK=function(e){var t=IK(e),r=t.alpha;return mw(r)},NK=function(e){if("Uniform"===e.$){var t=e.a;return kK(t)}return"0"},RK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},$K=function(e){var t=mw(e.scale.b),r=mw(e.scale.a),n=mw(-e.rotation/2/O$*360),a=mw(-e.shift.b),i=mw(e.shift.a);return Cd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},_K=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([lK(BK(r.fill)),vK(NK(r.fill)),yK(mw(r.thickness)),pK(EK(r.cap)),gK(RK(r.join)),nK("none"),fK(mw(e.opacity)),CK($K(e)),hK(Ni(r.dashPhase)),dK(SK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([nK(BK(a)),aK(NK(a)),lK(BK(r.fill)),vK(NK(r.fill)),yK(mw(r.thickness)),pK(EK(r.cap)),gK(RK(r.join)),fK(mw(e.opacity)),CK($K(e)),hK(Ni(r.dashPhase)),dK(SK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([nK(BK(oV(o.color))),iK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),oK(Ni(o.size)),cK(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"}}()),uK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),sK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),bK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),mK("middle"),rK("middle"),CK($K(e))]);default:return M([CK($K(e))])}},LK=Nn("x"),xK=Nn("y"),PK=r(function(e,t){return M([OV(mw(e)),DV(mw(t)),LK(mw(-e/2)),xK(mw(-t/2))])}),DK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([mw(t),mw(-r)]))},e))},UK=dN,OK=r(function(e,t){return f(e,t.a,t.b)}),MK=function(e){return f(xa,OK(UK),e)},FK=function(e){e:for(;;){var t=f(xc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(qV,U(M([WV(t),JV(DK(i))]),U(_K(e),MK(e.handlers))),yr);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,U(M([WV(t),JV(DK(i))]),U(_K(e),MK(e.handlers))),yr);case"Circle":var c=s.a;return f(MV,U(M([WV(t),QV(mw(c))]),U(_K(e),MK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(FV,U(M([WV(t),XV(mw(d)),ZV(mw(h))]),U(_K(e),MK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(GV,U(M([WV(t),XV(mw(c)),ZV(mw(c))]),U(f(PK,p,g),U(_K(e),MK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(SV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(YV,U(M([WV(t)]),U(_K(e),MK(e.handlers))),M([zV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(HV,U(M([WV(t),eK(C)]),U(f(PK,p,g),U(_K(e),MK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(VV,U(M([WV(t)]),U(f(PK,p,g),U(_K(e),MK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(KV,f(ka,WV(t),U(_K(e),MK(e.handlers))),l(Ra,r(function(e,t){return f(ka,FK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:tK(M([w,I]))});e=v;continue e}}},VK=r(function(e,t){var r=e.a,n=e.b,a=mw(r),i=mw(n);return f(jT,yr,M([f(PV,M([OV(a),DV(i),UV("1.1")]),M([FK(t)]))]))}),KK=function(e){return f(VK,L(LV(e),$V(e)),f(CV,_V,e))},HK=r(function(e,t){var r=JF(e),n=function(){switch(t.$){case"NotStarted":return l(Ok,10,33,108);case"Active":return l(Ok,0,100,170);default:return l(Ok,1,129,104)}}(),a=dx(KK(f(yV,uV(eV(n)),rV(50))));return f(Kk,M([wN,v_(f(lR,M([wN,ZN,yT(zk(60))]),r))]),a)}),jK=function(e){var t=M([NU,vN,bN(20)]);switch(e.$){case"Active":return f(Kk,U(t,M([bA(EN)])),fl("Active"));case"NotStarted":return f(Kk,U(t,M([bA(bR)])),fl("Not Started"));default:return f(Kk,t,fl("Finished"))}},qK=n(function(e,t,r){var n=f(FF,t,e),a=function(){return"Active"===n.$?l(Ok,0,226,255):PR}(),i=f(Kk,M([bA(a),bN(20),vN,wN]),fl(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 qk;switch(n.$){case"NotStarted":return d(XR,M([wN]),M([bN(22),pR]),L(PR,wR),f($R,e,t));case"Active":var a=f(LR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(i$,M([wN]),M([bN(22),pR]),L(tN,wR),i)}return f(ON,M([wN,kN(10)]),M([f(Kk,M([wN]),fl(jF(e))),f(ZO,"Poke",DE(LE))]));default:return f(Kk,M([yT(zk(1))]),qk)}}();return f(ON,M([nR(20),kN(10),yT(jk)]),M([f(Kk,M([u_,wN]),i),f(Kk,M([yT(jk),wN]),f(Kk,M([ZN]),f(HK,e,n))),f(ON,M([kN(10),rL,wN]),M([f(Kk,M([wN]),jK(n)),o]))]))}),GK=o(function(e,t,r,n,a,i){var o=f(FF,r,t),u=f(Kk,M([nR(10),ET(jk),yT(jk)]),d(HF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Vl(0)}}(),c=l(qK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(_R,f(mb,r.state.phaseStartTime,s),i);default:Vl(0)}}(),f(Kk,M([yT(jk),ET(zk(1)),Wk(function(){return"Active"===o.$?l(pA,0,0,1):wR}())]),qk)),p=a?f(VN,U(NF(e),U(R(o,wF)?AF:RF,M([ET(jk)]))),M([c,h,u])):f(VN,U(NF(e),U(R(o,wF)?AF:RF,M([uN,pN(IF(t))]))),M([c]));return!e&&R(o,wF)?f(ON,M([ET(jk),kN(20),b$({bottom:20,left:0,right:0,top:0})]),M([p,TF(r.terms.paymentMethods)])):p}),zK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(VN,M([wN,cN(12),nR(30),kN(10),Wk(bF),bN(24),vN,bA(tN)]),M([fl("Trade "+SF(t.state.closedReason)),EF])):e?f(ON,M([ET(jk),kN(10)]),M([f(VN,M([ET(jk),yT(bT),kN(20)]),M([p(GK,e,Co,t,n,R(r,Co),a),p(GK,e,mo,t,n,R(r,mo),a),p(GK,e,bo,t,n,R(r,bo),a)])),TF(t.terms.paymentMethods)])):f(ON,M([ET(jk),yT(bT),kN(20)]),M([p(GK,e,Co,t,n,R(r,Co),a),p(GK,e,mo,t,n,R(r,mo),a),p(GK,e,bo,t,n,R(r,bo),a)]))}),YK=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(ON,M([ET(jk),yT(jk),kN(40)]),M([h(mF,t,i,n.wallet,r,n.showStatsModal),f(Kk,M([ET(jk),f(aN,40,0),kN(40)]),h(zK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Kk,M([wN,ZN,bN(30)]),fl("Loading trade info..."));default:return f(Kk,M([wN,ZN,bN(30)]),fl("Invalid trade"))}}(),M([_O(n),UO(n)]))}),WK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),JK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(RU,yr);case"CreateModel":var n=r.a;return L(f(Yi,Uy,bU(n)),yr);case"TradeModel":var a=r.a;return l(WK,Yi(Fy),xa(Yi(Fy)),d(YK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,fT,l(bO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,oT,l(m_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Kk,M([ET(jk),yT(jk),cN(10)]),n),a)}),QK=function(e){return{$:"DismissNotice",a:e}},XK=function(e){return f(K$,XU,ZU(e))},ZK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(pA,1,1,1):l(pA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Ok,100,200,255);case"Caution":return l(Ok,255,188,0);case"Error":return l(Ok,255,70,70);default:return l(Ok,200,200,200)}}(),o=f(Kk,M([PN,u_,H$(5),XK(5)]),I_(QK(t)));return f(Kk,M([Wk(i),cN(10),nR(8),ET(jk),h$(1),l$(d(zR,0,0,0,.15)),VD]),f(ON,M([kN(4),ET(jk)]),f(Bi,r(function(e,t){return f($N,M([ET(jk),bA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},eH=function(e){return R(e,yr)?yr:M([f(ON,M([eO(20),H$(20),kN(10),PN,rL,ET(zk(300)),bN(15)]),f(xa,ZK,f(ml,function(e){return R(e.b.align,ul)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(ON,M([XK(20),XL(100),kN(10),A$,u_,ET(zk(300)),bN(15)]),f(xa,ZK,f(ml,function(e){return R(e.b.align,CB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},tH=r(function(e,t){var r=f(JK,e,t),n=r.a,a=r.b;return L(f(ON,M([t$(Jk),v_(KN(t)),ET(jk),yT(jk),nR(30)]),M([f(Kk,M([yT(zk(50))]),qk),n])),U(a,eH(t.userNotices)))}),rH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),nH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),aH={$:"AllowHover"},iH={$:"Layout"},oH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(hA,155/255,203/255,1,1),offset:L(0,0),size:3})},uH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?oH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?aH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?iH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},sH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(AT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),AT);case"Text":var a=t.a;return $I(a);default:return $I("")}}),cH=n(function(e,t,r){var n=uH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?rH(n):nH(n)}();return f(sH,a,d(fA,AT,Vk,t,wT(M([r]))))}),fH=ZT(5),lH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),dH={$:"SansSerif"},hH=function(e){return{$:"Typeface",a:e}},pH=Y,gH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",pH(sd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",pH(sd(t)));default:var t=e.a.name;return f(Ri,"-",pH(sd(t)))}}())}),vH=function(){var e=M([hH("Open Sans"),hH("Helvetica"),hH("Verdana"),dH]);return M([f(yA,Yk,l(vA,"bg-color-"+mA(d(hA,1,1,1,0)),"background-color",d(hA,1,1,1,0))),f(yA,gA,l(vA,"font-color-"+mA(d(hA,0,0,0,1)),"color",d(hA,0,0,0,1))),f(yA,yN,mN(20)),f(yA,fH,f(lH,l(Ra,gH,"font-",e),e))])}(),yH=n(function(e,t,r){var n=e.options;return l(cH,n,f(ka,lA(f(Ri," ",M([RT.root,RT.any,RT.single]))),U(vH,t)),r)}),mH=yH({options:yr}),bH=function(e){return f(yA,fH,f(lH,l(Ra,gH,"ff-",e),e))},CH=dH,EH=hH,SH=function(e){return{body:M([function(){var t=f(tH,e.screenWidth,e),r=t.a,n=t.b,a=U(M([ET(jk),yT(jk),bH(M([EH("Soleil"),CH]))]),f(xa,v_,n));return f(mH,a,r)}()]),title:"DAIHard"}},TH=Ht,wH=TH({init:OB,onUrlChange:Uk,onUrlRequest:Dk,subscriptions:Pk,update:sB,view:SH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:wH(f(du,function(e){return f(du,function(t){return f(du,function(r){return Fi({height:r,networkId:t,width:e})},f(Oh,"height",zC))},f(Oh,"networkId",zC))},f(Oh,"width",zC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file From 3dee865e52181eb51e56e2e7fccb45e3f3076f2d Mon Sep 17 00:00:00 2001 From: oglog Date: Wed, 14 Aug 2019 12:47:54 +0200 Subject: [PATCH 13/19] Include phase timeout in Phase column Also changed sorting algs --- docs/404.html | 2 +- docs/index.html | 2 +- ...ad1828.js => main-4487980d0338fc9a073c.js} | 2 +- src/Marketplace/View.elm | 35 ++++++++------- src/TradeTable/View.elm | 43 ++++++++++++++++--- 5 files changed, 58 insertions(+), 26 deletions(-) rename docs/static/js/{main-2cc6fa5c22699ead1828.js => main-4487980d0338fc9a073c.js} (70%) diff --git a/docs/404.html b/docs/404.html index 6c9a2d0..2a03a8f 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 6c9a2d0..2a03a8f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-2cc6fa5c22699ead1828.js b/docs/static/js/main-4487980d0338fc9a073c.js similarity index 70% rename from docs/static/js/main-2cc6fa5c22699ead1828.js rename to docs/static/js/main-4487980d0338fc9a073c.js index 0c3f83d..b384768 100644 --- a/docs/static/js/main-2cc6fa5c22699ead1828.js +++ b/docs/static/js/main-4487980d0338fc9a073c.js @@ -4,4 +4,4 @@ * @author Feross Aboukhadijeh * @license MIT */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(bp,o,function(e){return si(Cp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,kp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,Bp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=nv(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?qg(o):jg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return nv(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Gg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Yg,zg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(zo,xa(ac),f(zo,Ms,nc))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ph,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ph,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ap)}),i.addEventListener("timeout",function(){a(Np)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Cp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(wp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Yg,zg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Yg,zg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Yg,zg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{options:t,type_:e}}),po={$:"OfferType"},go=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),vo=r(function(e,t){return f(ho,po,M([l(go,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(go,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),yo={$:"Closed"},mo={$:"Committed"},bo={$:"Judgment"},Co={$:"Open"},Eo={$:"Phase"},So=a(function(e,t,r,n){return f(ho,Eo,M([l(go,"Open",e,function(e){return R(e.state.phase,Co)}),l(go,"Committed",t,function(e){return R(e.state.phase,mo)}),l(go,"Judgment",r,function(e){return R(e.state.phase,bo)}),l(go,"Closed",n,function(e){return R(e.state.phase,yo)})]))}),To={$:"Initiator"},wo={$:"Responder"},Io=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),Ao=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(To):f(Io,function(e){return R(t,e)?si(wo):ci},e.state.responder)}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),ko=r(function(e,t){return f(Bo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(Ao,e,t))}),No={$:"Role"},Ro=n(function(e,t,r){return f(ho,No,M([l(go,"Buyer",t,function(t){return R(f(ko,t,e),si(fo))}),l(go,"Seller",r,function(t){return R(f(ko,t,e),si(lo))})]))}),$o=function(e){return{orderBy:e}},_o=$o,Lo={$:"Ascending"},xo={$:"Phase"},Po=Oe,Do=Po(yr),Uo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(So,!0,!0,!0,!1),f(vo,!0,!0),l(Ro,t,!0,!0)])),tradeTable:_o(L(xo,Lo)),wallet:e},Do)}),Oo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Mo={$:"None"},Fo=Mo,Vo=function(e){return d(Oo,e,Do,Fo,yr)},Ko=function(e){return{$:"TradeTableMsg",a:e}},Ho=function(e){return d(Oo,e,Do,Fo,yr)},jo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),qo=r(function(e,t){return f(jo,e,t)}),Go=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),zo=n(function(e,t,r){return t(e(r))}),Yo=r(function(e,t){if("None"===t.$)return Mo;var r=t.a,n=t.b,a=l(Go,f(Bo,Da(e),r.onSign),f(Bo,Da(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return L(f(zo,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(zo,t.toMsg,e)}},n))},r.onMined));return f(jo,a,n)}),Wo=function(e){return{$:"AbiDecoder",a:e}},Jo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Qo=z,Xo=Fr,Zo=r(function(e,t){return e<1?t:l(Xo,e,Qo(t),t)}),eu=Zo(64),tu=n(function(e,t,r){return L(f(Jo,e,eu(t)),r)}),ru=r(function(e,t){return e<1?"":l(Xo,0,e,t)}),nu=ru(64),au=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),iu=function(e){return-e},ou=r(function(e,t){return e<1?"":l(Xo,-e,Qo(t),t)}),uu=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(ru,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(ou,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Wo(function(t){var r=t.a,n=t.b;return f(au,f(tu,r,n),e(nu(n)))})}(),su=Hr,cu=function(e){return f(su,"0x",e)||f(su,"0X",e)?f(Zo,2,e):e},fu=function(e){return e.b},lu=r(function(e,t){var r=e.a;return f(au,fu,r(function(e){return f(Jo,e,e)}(cu(t))))}),du=Xr,hu=ae,pu=Wr,gu=function(e){return f(du,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return hu(a)},pu)},vu=f(zo,lu,gu),yu=function(e){return{$:"Magnitude",a:e}},mu=function(e){return{$:"Pos",a:e}},bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Cu=function(e){return{$:"MagnitudeNotNormalised",a:e}},Eu=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 si(n)}return ci}},Su=function(e){var t=Eu(e);return"Nothing"!==t.$&&t.a<0},Tu=function(e){return{$:"Neg",a:e}},wu={$:"Zer"},Iu=function(e){return!e.b},Au=r(function(e,t){var r=t.a;if(Iu(r))return wu;switch(e.$){case"Zero":return wu;case"Positive":return mu(t);default:return Tu(t)}}),Bu=r(function(e,t){return f(bu,e,Cu(t))}),ku=function(e){return f(La,r(function(t,r){return e(t)&&Iu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Nu=Ir,Ru=-1+f(Nu,10,7),$u=Ru+1,_u=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Lu=function(e){return e<0?f(_u,Na(-1),Lu(e+$u)):L(e/$u|0,e%$u)},xu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Lu(r+e),i=a.a,o=a.b;return f(ka,o,f(xu,i,n))}{if(!(_(e,$u)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Pu=function(e){var t=e.a;return yu(ku(f(xu,0,t)))},Du=xa(iu),Uu={$:"Negative"},Ou={$:"Positive"},Mu={$:"Zero"},Fu=function(e){switch(e.$){case"Positive":return Uu;case"Negative":return Ou;default:return Mu}},Vu=function(e){for(;;){var t=e.a,r=e.b,n=Pu(r),a=n.a;if(!Su(a))return f(Au,t,yu(a));e=f(Bu,Fu(t),Du(a))}},Ku=pr,Hu=function(e){switch(f(Ku,e,0).$){case"LT":return Uu;case"GT":return Ou;default:return Mu}},ju=function(e){return e<0?-e:e},qu=function(e){return Vu(f(bu,Hu(e),Cu(M([ju(e)]))))},Gu=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(Nu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},zu=function(e){switch(e.$){case"Zer":return wu;case"Neg":var t=e.a;return mu(t);default:return e}},Yu=function(e){return{$:"MagnitudePair",a:e}},Wu=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(ka,L(a,u),f(Wu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Wu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Wu,yr,s))}return yr}),Ju=r(function(e,t){var r=e.a,n=t.a;return Yu(f(Wu,r,n))}),Qu=function(e){switch(e.$){case"Zer":return f(Bu,Mu,yr);case"Neg":var t=e.a.a;return f(Bu,Ou,Du(t));default:var t=e.a.a;return f(Bu,Ou,t)}},Xu=r(function(e,t){var r=Qu(t),n=r.b,a=Qu(e),i=a.b,o=f(Ju,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Vu(f(bu,Ou,Cu(s)))}),Zu=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(R(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 Ta}return a.b.b?ba:f(Ku,e,t)}}),es=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},ts=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(Zu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return es(d(Zu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),rs=r(function(e,t){return R(f(ts,e,t),Ta)}),ns=K,as=r(function(e,t){return!f(rs,e,t)}),is=function(e){switch(e.$){case"Zer":return yu(yr);case"Pos":default:var t=e.a;return t}},os=r(function(e,t){var r=e.a;return Pu(Cu(f(xa,ti(t),r)))}),us=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(os,yu(n),a),u=f(us,yu(i),yu(n)),s=u.a,c=f(Xu,f(Au,Ou,o),f(Au,Ou,yu(f(ka,0,s))));return is(c)}var a=r.a;return f(os,yu(n),a)}return yu(yr)}),ss=function(e){switch(e.$){case"Zer":return Mu;case"Pos":return Ou;default:return Uu}},cs=r(function(e,t){return R(e,Mu)||R(t,Mu)?Mu:R(e,t)?Ou:Uu}),fs=r(function(e,t){return f(Au,f(cs,ss(e),ss(t)),f(us,is(e),is(t)))}),ls=function(e){switch(e.$){case"Zer":return wu;case"Pos":var t=e.a;return Tu(t);default:var t=e.a;return mu(t)}},ds=r(function(e,t){return f(Xu,e,ls(t))}),hs=qu(0),ps=a(function(e,t,r,n){if(e){var a=qu(e),i=f(fs,f(fs,a,n),t),o=f(as,i,r)?L(f(fs,a,t),f(ds,r,i)):L(hs,r),u=o.a,s=o.b,c=d(ps,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Xu,u,l),h)}return L(hs,r)}),gs=Fa(f(Va,2,Ru)),vs=n(function(e,t,r){return d(ps,f(Nu,2,gs),e,t,r)}),ys=qu(1),ms=r(function(e,t){return e}),bs=n(function(e,t,r){return l(Ra,ms(e),t,f(Ai,1,r))}),Cs=function(e){return l(bs,fs(qu($u)),ys,e)},Es=n(function(e,t,r){if(e){var n=l(vs,Cs(e),t,r),a=n.a,i=n.b,o=l(Es,e-1,i,r),u=o.a,s=o.b;return L(f(Xu,a,u),s)}return l(vs,Cs(e),t,r)}),Ss=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Ts=r(function(e,t){if(R(t,hs))return ci;var r=Ti(Ss(e))-Ti(Ss(t))+1,n=l(Es,f(ei,0,r),zu(e),zu(t)),a=n.a,i=n.b;return si(L(f(Au,f(cs,ss(e),ss(t)),is(a)),f(Au,ss(e),is(i))))}),ws=f(fs,qu(2),qu(2147483648)),Is=xr,As=function(e){return f(Is,e,"")},Bs=Pn,ks=n(function(e,t,r){return e<=0?r:l(ks,e>>1,U(t,t),1&e?U(r,t):r)}),Ns=r(function(e,t){return l(ks,e,t,"")}),Rs=n(function(e,t,r){return U(f(Ns,e-Qo(r),As(t)),r)}),$s=te,_s=Ar,Ls=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},xs=r(function(e,t){for(;;){if(t<16)return f(ka,Ls(t),e);var r=f(ka,Ls(f(_s,16,t)),e),n=t/16|0;e=r,t=n}}),Ps=function(e){return $s(e<0?f(ka,P("-"),f(xs,yr,-e)):f(xs,yr,e))},Ds=function(e){var t=f(Ts,e,ws);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=Ps(Gu(a));return R(n,qu(0))?i:U(Ds(n),l(Rs,8,P("0"),i))},Us=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,yu(yr))?"0":Ds(mu(t));default:var t=e.a;return"-"+Us(f(fs,qu(-1),e))}},Os=function(e){return l(Rs,64,P("0"),e)},Ms=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(Ps(a)),c=function(e){return U(e,n)}(Os(Ps(u)));return x(a+32+(Qo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Fs=Dr,Vs=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))))}),Ks=n(function(e,t,n){return l(Fs,r(function(t,r){return l(Vs,e,yi(t),r)}),t,n)}),Hs=function(e){return $a(l(Ks,ka,yr,e))},js=function(e){return f(Ri,"",f(xa,f(zo,Ps,f(Rs,2,P("0"))),Hs(e)))},qs=function(e){return 64-f(_s,64,e)},Gs=function(e){return U(e,f(Ns,qs(Qo(e)),"0"))},zs=function(e){return L(si(Qo(e)/2|0),Gs(e))},Ys=function(e){return L(ci,Os(e))},Ws=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Js=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"}},Qs=Ur,Xs=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(Is,P("1"),r),!0);case"1":return L(f(Is,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Is,P("0"),r),!1);case"1":return L(f(Is,P("1"),r),!0);default:break e}return L(r,!0)});return l(Qs,t,L("",!1),e).a},Zs=function(e){return l(Qs,ka,yr,e)},ec=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Zo,e,t),i=f(ka,l(Xo,0,e,t),r);e=n,t=a,r=i}}),tc=r(function(e,t){return e&&""!==t?l(ec,e,t,yr):M([t])}),rc=function(e){var t=function(){var t=Zs(Us(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(zo,Xs,f(Rs,256,P("1"))))}var r=t;return L(r,f(Rs,256,P("0")))}(),r=t.a,n=t.b;return $s(f(xa,Ws,f(tc,4,n(f(Ri,"",f(xa,Js,r))))))},nc=function(e){return{$:"Hex",a:e}},ac=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Ys(t);case"UintE":var r=e.a;return Ys(Us(r));case"IntE":var n=e.a;return Ys(rc(n));case"BoolE":return Ys(e.a?"1":"0");case"DBytesE":var a=e.a.a;return zs(a);case"BytesE":var a=e.a.a;return Ys(cu(a));case"StringE":var i=e.a;return zs(js(i));case"ListE":var o=e.a;return function(e){var t=e.a;return zs(t)}(Xt()(o));default:var i=e.a;return Ys(cu(i))}};try{var ic=Xt();Xt=function(){return ic}}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 oc=Pr,uc=function(e){return 1===Qo(e)?f(oc,"0",e):e},sc=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(ka,n,r);e=i,t=o,r=u}}}),cc=r(function(e,t){return $a(l(sc,e,t,yr))}),fc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(cc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(fc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),lc=r(function(e,t){return l(fc,0,e,t)}),dc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),hc=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 Pt(e.a)}},pc={$:"LE"},gc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,pc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,pc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,pc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,pc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,pc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,pc));case"Seq":var i=e.b;return l(vc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),vc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(gc,n,t,r);e=i,t=o,r=u}}),yc=Dt,mc=r(function(e,t){return{$:"Seq",a:e,b:t}}),bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+hc(r),i=n;e=a,t=i}}),Cc=function(e){return f(mc,f(bc,0,e),e)},Ec=function(e){return{$:"U8",a:e}},Sc=Ec,Tc=r(function(e,t){return _(e,t)<0?e:t}),wc=hr,Ic=function(e){return{$:"Bytes",a:e}},Ac=Ic,Bc=function(e){return yc(Cc(f(xa,Ac,$a(e))))},kc=Pt,Nc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Rc=function(e){return{$:"Decoder",a:e}},$c=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}}),_c=r(function(e,t){return Rc(f($c,e,t))}),Lc=Rc(Yn),xc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Pc=function(e){return{$:"Done",a:e}},Dc=function(e){return{$:"Loop",a:e}},Uc=r(function(e,t){var n=t.a;return Rc(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 Rc(r(function(t,r){return L(r,e)}))},Mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Oc(Pc($a(n))):f(Uc,function(e){return Dc(L(r-1,f(ka,e,n)))},e)}),Fc=function(e){return f(xc,yr,f(Nc,f(_c,L(kc(e),yr),Mc(Lc)),e))},Vc=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))}),Kc=r(function(e,t){return l(Vc,Bs,e,t)}),Hc=f(Ai,0,4),jc=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}}),qc=xt,Gc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),zc=function(e){return f(Gc,f(zo,qc,Bs(4294967295)),e)},Yc=r(function(e,t){return 5*t+e}),Wc=4294967295>>>32-Ha,Jc=ar,Qc=n(function(e,t,r){for(;;){var n=Wc&t>>>e,a=f(Jc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Jc,Wc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Xc=function(e){return e>>>5<<5},Zc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Xc(r))>-1?f(Jc,Wc&e,i):l(Qc,n,e,a))}),ef=r(function(e,t){var r=f(Zc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),tf=n(function(e,t,r){var n=f(Yc,e,t);return f(ef,n,r)}),rf=ir,nf=a(function(e,t,r,n){var a=Wc&t>>>e,i=f(Jc,a,n);if("SubTree"===i.$){var o=i.a,u=d(nf,e-Ha,t,r,o);return l(rf,a,za(u),n)}var s=i.a,c=l(rf,Wc&t,r,s);return l(rf,a,Ga(c),n)}),af=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,Xc(n))>-1?d(Ma,n,a,i,l(rf,Wc&e,t,o)):d(Ma,n,a,d(nf,a,e,t,i),o)}),of=n(function(e,t,r){return l(af,e,t,r)}),uf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(of,a,r,n)}),sf=Dn,cf=r(function(e,t){return l(Vc,sf,e,t)}),ff=function(e){var t=l(La,r(function(t,n){var a={d0:l(tf,0,t,e.state),d1:l(tf,1,t,e.state),d2:l(tf,2,t,e.state),d3:l(tf,3,t,e.state),d4:l(tf,4,t,e.state)},i=r(function(e,r){return d(uf,e,t,f(cf,f(jc,e,a),f(Kc,zc(f(jc,f(_s,5,e+1),a)),f(jc,f(_s,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Hc);return D(e,{state:t})},lf=L(0,0),df=function(e){return{current:lf,lfsrstate:1,state:e,x:1,y:0}},hf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},pf=L(1,0),gf=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),vf=r(function(e,t){if(e){var n=f(gf,1,t);return l(Vc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),yf=r(function(e,t){var r=f(_s,32,e/32|0),n=f(gf,r,t),a=f(_s,32,e);return f(vf,a,n)}),mf=n(function(e,t,r){var n=f(Zc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(af,e,t(a),r)}),bf=n(function(e,t,r){return l(mf,e,cf(t),r)}),Cf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(bf,a,r,n)}),Ef=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Nf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Tc,n,r),i=f(xa,function(e){return f(kf,e,g)},f(Ai,0,a)),o=Bf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(lc,i.outputLen,l(v,g,yr,i.outputLen))},Lf=function(e){return{$:"KS",a:e}},xf=function(e){var t=e.a;return Lf({config:t,inputLength:0,partial:yr,state:f(ui,25,ms(lf))})},Pf=function(e){return Rc(Wn(e))},Df=yc(Cc(yr)),Uf=r(function(e,t){var n=t.a;return Rc(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(Uf,function(e){return Pf(t)},Pf(e))}),Mf=r(function(e,t){return f(xc,Df,f(Nc,f(Of,e,kc(t)-e),t))}),Ff=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=kc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+kc(e)}),0,i),a)>-1))return Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:i}));var o=Bc(i),u=f(xc,Df,f(Nc,Pf(a),o)),s=Fc(u),c=f($f,s,n.state),d=Bf(c),h=f(Mf,a,o),p=Df,g=Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Vf=r(function(e,t){return _f(f(Ff,yc(Cc(f(xa,Sc,t))),xf(e)))}),Kf=Vf(dc),Hf=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,4,Kf(f(xa,yi,Zs(e)))))))},jf=function(e){return f(su,"0x",e)||f(su,"0X",e)?e:"0x"+e},qf=function(e){var t=e.a;return jf(t)},Gf=r(function(e,t){var r=Ms(f(xa,ac,t)),n=function(e){return U(e,r)}(cu(qf(Hf(e))));return nc(n)}),zf=function(e){return{data:si(f(Gf,"poke()",yr)),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yf=r(function(e,t){return D(t,{checked:e})}),Wf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Jf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Wf,f(zo,function(e){return e.type_},Ja(r)),function(e){return D(e,{options:l(Wf,f(zo,function(e){return e.label},Ja(n)),Yf(a),e.options)})},t)}),Qf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Xf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zf={$:"Descending"},el=function(e){return"Ascending"===e.$?Zf:Lo},tl=function(e){return d(Xf,e,Do,Fo,yr)},rl=r(function(e,t){return L(t.a,e(t.b))}),nl=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Xf,t,Do,Fo,M([da(f(Qf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(rl,el,t.orderBy):L(a,Lo);return tl(D(t,{orderBy:i}));default:return tl(t)}}),al=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},il=yn,ol=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=al(zf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(qo,a,n);return d(Oo,t,Do,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Oo,t,Do,Fo,M([da(f(Qf,o,u))]));case"FiltersMsg":var s=e.a;return Ho(D(t,{filters:f(Jf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(nl,c,t.tradeTable);return d(Oo,D(t,{tradeTable:l.model}),f(il,Ko,l.cmd),f(Yo,Ko,l.chainCmd),f(xa,Ji(Ko),l.appCmds));default:return Vo(t)}}),ul={$:"BottomRight"},sl={$:"ShouldBeImpossible"},cl=lr,fl=function(e){return qi(e)},ll=r(function(e,t){f(cl,e,t);return{align:ul,label:"unexpectedError",mainParagraphs:M([M([fl(e)])]),noticeType:sl}}),dl=function(e){var t=e.a;return jf(t)},hl=ye,pl=f(zo,dl,hl),gl=f(zo,Us,f(zo,jf,hl)),vl=f(zo,qf,hl),yl=f(zo,Ps,f(zo,jf,hl)),ml=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),bl=un,Cl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},El=function(e){return Cl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(xc,bl,r))},f(ml,function(e){e.a;return!R(e.b,ci)},e)))},Sl=function(e){return El(M([L("to",f(Bo,pl,e.to)),L("from",f(Bo,pl,e.from)),L("gas",f(Bo,yl,e.gas)),L("gasPrice",f(Bo,gl,e.gasPrice)),L("value",f(Bo,gl,e.value)),L("data",f(Bo,vl,e.data)),L("nonce",f(Bo,yl,e.nonce))]))},Tl=function(e){return{$:"TxSentry",a:e}},wl=ye,Il=r(function(e,t){return Cl(M([L("ref",wl(e)),L("txParams",t)]))}),Al=function(e){return{$:"Signing",a:e}},Bl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Al(e)}}),kl={$:"Black"},Nl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Rl={$:"RBEmpty_elm_builtin"},$l={$:"Red"},_l=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(Nl,$l,t,r,h(Nl,kl,c,f,l,d),h(Nl,kl,i,o,u,s))}return h(Nl,e,i,o,h(Nl,$l,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(Nl,$l,c,f,h(Nl,kl,g,v,y,m),h(Nl,kl,t,r,d,a))}return h(Nl,e,t,r,n,a)}),Ll=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Nl,$l,e,t,Rl,Rl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ku,e,a).$){case"LT":return h(_l,n,a,i,l(Ll,e,t,o),u);case"EQ":return h(Nl,n,a,t,o,u);default:return h(_l,n,a,i,o,l(Ll,e,t,u))}}),xl=n(function(e,t,r){var n=l(Ll,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(Nl,kl,a,i,o,u)}return n}),Pl=n(function(e,t,r){var n=e.a,a=Sl(r),i=l(xl,n.ref,f(Bl,r,t),n.txs);return L(Tl(D(n,{ref:n.ref+1,txs:i})),f(il,n.tagger,n.outPort(f(Il,n.ref,a))))}),Dl=Pl,Ul=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Do,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Dl,n,i,o))}return x(ci,Do,M([f(ll,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ol=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Ml=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Fl=function(e){return{$:"Posix",a:e}},Vl=Fl,Kl={autoabortInterval:Vl(0),autorecallInterval:Vl(0),autoreleaseInterval:Vl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Hl=function(e){return{$:"TokenValue",a:e}},jl=function(e){return e.a},ql=r(function(e,t){return f(xc,hs,f(Bo,Qa,f(Ts,e,t)))}),Gl=r(function(e,t){return Hl(f(ql,jl(e),qu(t)))}),zl=function(e){return f(Gl,e,12)},Yl=function(e){return f(Gl,e,3)},Wl=Hl(qu(0)),Jl=r(function(e,t){var r=Wl;return{abortPunishment:zl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Ql=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Xl=qr,Zl=function(e){var t=Ql(f(Xl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Qo(e)-1-r;return L(U(f(ru,r,e),f(Zo,r+1,e)),n)},ed=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 yr}}),td=function(e){var t=e.a,r=f(ed,Ja(0),t);return yu(r.b?t:yr)},rd=Z,nd=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}}}),ad=n(function(e,t,r){var n=f(nd,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(lc,e,r),l(ad,e,t,n)):yr}),id=r(function(e,t){return l(ad,e,e,t)}),od=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Bo,ka(a),r)});return f(La,t,si(yr))}(Ua),ud=function(e){return f(Bo,f(Da,td,yu),od(f(xa,f(zo,$a,f(zo,$s,rd)),f(id,7,$a(e)))))},sd=Q,cd=function(e){var t=Zs(sd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,Au(Uu),ud(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Bo,Au(Ou),ud(r))}return ci;default:var r=t;return f(Bo,Au(Ou),ud(r))}},fd=function(e){var t=function(e){return!f(_s,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(xc,0,Ql(r)))}},ld=function(e){return f(fs,e,e)},dd=qu(2),hd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ys;case"Neg":return wu;default:if(R(r,ys))return f(fs,e,t);if(fd(r)){var n=e,a=ld(t),i=f(ql,r,dd);e=n,t=a,r=i;continue e}var n=f(fs,t,e),a=ld(t),i=f(ql,f(ds,r,ys),dd);e=n,t=a,r=i;continue e}}),pd=r(function(e,t){return l(hd,ys,e,t)}),gd=function(e){if(""===e)return ci;var t=Zl(e),r=t.a,n=t.b,a=cd(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(fs,o,f(pd,qu(10),qu(i)));return si(u)},vd=function(e){return f(Bo,Hl,gd(e))},yd=jr,md=function(e){for(;;){if(f(yd,".",e))return l(Xo,0,-1,e);{if(!f(yd,"0",e))return""===e?"0":e;e=l(Xo,0,-1,e)}}},bd=f(Da,f(Rs,7,P("0")),Ni),Cd=function(e){return f(Ri,"",e)},Ed=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Cd(f(ka,Ni(n),f(xa,bd,a)))}return"0"},Sd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Ed(t);default:var t=e.a;return"-"+Ed(t)}},Td=r(function(e,t){return e<1?t:l(Xo,0,-e,t)}),wd=function(e){var t=l(Rs,18,P("0"),Sd(e)),r=f(Td,18,t)+"."+f(ou,18,t);return function(e){return""===e?"0":e}(md(r))},Id=r(function(e,t){var r=wd(t),n=Ql(f(Xl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(ru,a+1+e,r):f(ru,a,r)}),Ad=r(function(e,t){if("Nothing"===e.$)return wd(jl(t));var r=e.a;return f(Id,r,jl(t))}),Bd=ee,kd=function(e){var t=Bd(f(Ad,ci,e));if("Just"===t.$){return t.a}f(cl,"Error converting tokenValue to float: string -> float failed",e);return 0},Nd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=vd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return kd(r)<1?fi("Trade amount can't be less than 1."):li(r)},Rd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=cd(e);if("Nothing"===t.$){var r=Bd(e);return fi("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 li(n)},$d=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),_d=function(e){return""===e},Ld=function(e){return _d(e)?ci:si(e)},xd=function(e){return f($d,"You must specify a fiat type.",Ld(e))},Pd=function(e){return""===e?fi("Must specify a payment method."):li(e)},Dd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ud=g(Dd,ci,ci,ci,ci,ci,ci,ci),Od=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Md=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Fd={$:"Custom"},Vd=r(function(e,t){return{info:t,type_:e}}),Kd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Hd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),jd=function(e){return e.a},qd=function(e){return p(Kd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Vd,Fd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Hd,function(e){return D(Ud,{daiAmount:si(e)})},Nd(e.daiAmount)),f(Hd,function(e){return D(Ud,{fiatAmount:si(e)})},Rd(e.fiatAmount)),f(Hd,function(e){return D(Ud,{fiatType:si(e)})},xd(e.fiatType)),f(Hd,function(e){return D(Ud,{paymentMethod:si(e)})},Pd(e.paymentMethod)),Od(d(Md,function(e){return jd(e)>0?li(e):fi(D(Ud,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Gd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},zd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Yd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Wd=function(e){var t=qd(e.inputs),r=function(){return R(e.errors,Ud)?Ud:"Ok"===t.$?Ud:t.a}();return D(e,{createParameters:l(zd,Jl,Gd(e.wallet),Yd(t)),errors:r})},Jd=r(function(e,t){return Wd(D(t,{inputs:e}))}),Qd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Xd=function(e){return d(Qd,f(Jd,Kl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:Ud,inputs:Kl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Do,Fo,yr)},Zd=a(function(e,t,r,n){return la(d(Ol,e,t,r,n))}),eh=function(e){return{$:"Address",a:e}},th=f(zo,cu,f(zo,sd,eh)),rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return th("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return th("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return th("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return th("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nh=function(e){return th("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ah=function(e){return{$:"AddressE",a:e}},ih=ah,oh=function(e){return{$:"UintE",a:e}},uh=oh,sh=n(function(e,t,r){return{data:si(f(Gf,"approve(address,uint256)",M([ih(t),uh(r)]))),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ch=function(e){return f(Gl,e,200)},fh=r(function(e,t){return Hl(f(Xu,jl(e),jl(t)))}),lh=function(e){var t=f(Gl,e.tradeAmount,200);return f(fh,e.pokeReward,f(fh,ch(e.tradeAmount),f(fh,t,function(){return"Buyer"===e.initiatorRole.$?Yl(e.tradeAmount):e.tradeAmount}())))},dh=Mi(ya),hh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ph=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gh=Xn,vh=Qn,yh=function(e){return f(vh,{caseInsensitive:!1,multiline:!1},e)},mh=Jn,bh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ch=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}}),Eh=r(function(e,t){return!f(Ch,f(Da,ns,e),t)}),Sh=Eh(Ua),Th=q,wh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ih=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Ah=f(La,Ih(ka),li(yr)),Bh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},kh=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Nu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Nu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Nu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Nu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Nu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Nu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Nu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Nu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Nu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Nu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Nu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Nu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Nu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Nu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Nu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(As(s)+" is not a valid hexadecimal character.")}}}),Nh=function(e){if(_d(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(su,"-",e)){var t=f(xc,yr,Bh(Zs(e)));return f(au,iu,l(kh,Ti(t)-1,t,0))}return l(kh,Qo(e)-1,Zs(e),0)}();return f(Hd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rh=function(e){var t=Zs(e);return function(e){return L(t,e)}(f(wh,yr,Ah(f(xa,Nh,f(_i,"",f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,20,Kf(f(xa,f(zo,Th,yi),t))))))))))},$h=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Rh(cu(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!bh(e)&&Sh(o)},_h=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-f]{40}$"))),Lh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-F]{40}$"))),xh=function(e){return'"'+e+'"'},Ph=function(e){var t=cu(e),r=f(ru,24,t),n=f(ou,40,e);return 64===Qo(t)&&f(ki,Ja(P("0")),r)?Lh(n)||_h(n)?li(eh(n)):$h(n)?li(eh(n)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):40!==Qo(t)?fi("Given address "+xh(e)+" is not the correct length."):bh(t)?Lh(t)||_h(t)?li(eh(t)):$h(t)?li(eh(t)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):fi("Given address "+xh(e)+" contains invalid hex characters.")},Dh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),Ph(nu(r)))}),Uh=r(function(e,t){var r=t.a;return Wo(function(t){var n=t.a,a=t.b;return r(f(Jo,n,f(Zo,64*e,a)))})}),Oh=Jr,Mh=r(function(e,t){return f(Oh,"data",vu(f(Uh,e,t)))}),Fh=Qr,Vh=r(function(e,t){return f(Oh,"topics",f(Fh,e,vu(t)))}),Kh=function(e){return f(Bo,f(zo,$a,f(Ra,r(function(e,t){return f(Xu,qu(e),f(fs,t,ws))}),hs)),od(f(xa,f(zo,$a,f(zo,$s,f(zo,Nh,Yd))),f(id,8,$a(e)))))},Hh=function(e){var t=Zs(sd(e));e:for(;;){if(!t.b)return ci;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(Bo,fs(qu(-1)),Kh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Bo,fs(qu(-1)),Kh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Kh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kh(a)}t.b;return ci}break e;default:break e}}var a=t;return Kh(a)},jh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f($d,"Error Decoding Uint into BigInt",Hh(jf(nu(r)))))}),qh=f(dh,f(Vh,1,Dh),f(dh,f(Mh,1,Dh),f(dh,f(Mh,0,jh),Fi(hh)))),Gh=nn,zh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Yh=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(Gh,e,Cl(M([L("data",hl(t.data)),L("topics",f(zh,vl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Wh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Jh=r(function(e,t){return f(au,function(e){return e.id},f(Wh,function(e){return f(Hd,Di,f(Yh,qh,e).returnData)},f($d,"No log found from that factoryAddress in that txReceipt",Ql(f(ml,function(t){return R(f(zo,dl,sd)(t.address),f(zo,dl,sd)(rh(e)))},t.logs)))))}),Qh=n(function(e,t,r){return{data:si(f(Gf,"allowance(address,address)",M([ih(t),ih(r)]))),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Zh=function(e){switch(e.$){case"BlockNum":var t=e.a;return hl(jf(Ps(t)));case"EarliestBlock":return hl("earliest");case"LatestBlock":return hl("latest");default:return hl("pending")}},ep=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return El(M([L("to",f(Bo,pl,t)),L("from",f(Bo,pl,r)),L("gas",f(Bo,yl,n)),L("gasPrice",f(Bo,gl,a)),L("value",f(Bo,gl,i)),L("data",f(Bo,vl,o))]))},tp=function(e){return{$:"BadBody",a:e}},rp=function(e){return{$:"BadStatus",a:e}},np=function(e){return{$:"BadUrl",a:e}},ap={$:"NetworkError"},ip={$:"Timeout"},op=rn,up=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(np(r));case"Timeout_":return fi(ip);case"NetworkError_":return fi(ap);case"BadStatus_":var n=t.a,a=t.b;return fi(rp(n.statusCode));default:var n=t.a,a=t.b,i=f(op,f(Oh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(tp(Di(u)))}}),sp=n(function(e,t,r){return Cl(M([L("id",wl(e)),L("jsonrpc",hl("2.0")),L("method",hl(t)),L("params",f(zh,Ua,r))]))}),cp=Rl,fp=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ku,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),lp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},dp=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(Nl,$l,p,g,h(Nl,kl,r,n,h(Nl,$l,i,o,u,s),v),h(Nl,kl,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(Nl,kl,r,n,h(Nl,$l,i,o,u,s),h(Nl,$l,f,l,d,m))}return e},hp=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(Nl,$l,i,o,h(Nl,kl,s,c,f,l),h(Nl,kl,r,n,d,h(Nl,$l,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Nl,kl,r,n,h(Nl,$l,i,o,C,d),h(Nl,$l,g,v,y,m))}return e},pp=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(Nl,r,u,s,c,h(Nl,$l,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 hp(t)}break e}o.a,o.d;return hp(t)}break e}return t}),gp=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(Nl,t,r,n,gp(a),u)}var s=dp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(_l,c,f,l,gp(d),p)}return Rl}return h(Nl,t,r,n,gp(a),u)}return Rl},vp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Rl;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(Nl,r,n,a,f(vp,e,i),o)}var s=dp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(_l,c,l,d,f(vp,e,p),v)}return Rl}return h(Nl,r,n,a,f(vp,e,i),o)}return f(yp,e,g(pp,e,t,r,n,a,i,o))}),yp=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(R(e,n)){var u=lp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(_l,r,s,c,i,gp(o))}return Rl}return h(_l,r,n,a,i,f(vp,e,o))}return Rl}),mp=r(function(e,t){var r=f(vp,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(Nl,kl,n,a,i,o)}return r}),bp=n(function(e,t,r){var n=t(f(fp,e,r));if("Just"===n.$){var a=n.a;return l(xl,e,a,r)}return f(mp,e,r)}),Cp=function(e){return"Just"===e.$},Ep=gn,Sp=vn,Tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),wp=function(e){return{$:"BadUrl_",a:e}},Ip=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ap={$:"NetworkError_"},Bp=function(e){return{$:"Receiving",a:e}},kp=function(e){return{$:"Sending",a:e}},Np={$:"Timeout_"},Rp=function(e){return f(ta,"application/json",f(xi,0,e))},$p=n(function(e,t,r){return Rp(l(sp,e,t,r))}),_p=f(ea,"",Ua),Lp=Te,xp=Se,Pp=function(e){if("Ok"===e.$){var t=e.a;return xp(t)}var r=e.a;return Lp(r)},Dp=function(e){return l(Zn,gr,Pp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},Up=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Dp({body:l($p,1,r,n),headers:yr,method:"POST",resolver:_p(up(a)),timeout:ci,url:t})},Op=n(function(e,t,r){return Up({decoder:t.decoder,method:"eth_call",params:M([ep(t),Zh(r)]),url:e})}),Mp={$:"LatestBlock"},Fp=r(function(e,t){return l(Op,e,t,Mp)}),Vp=function(e){return{$:"Perform",a:e}},Kp=sn,Hp=xp(gr),jp=r(function(e,t){return f(Kp,function(t){return xp(e(t))},t)}),qp=n(function(e,t,r){return f(Kp,function(t){return f(Kp,function(r){return xp(f(e,t,r))},r)},t)}),Gp=function(e){return l(La,qp(ka),xp(yr),e)},zp=r(function(e,t){var r=t.a;return Be(f(Kp,Ep(e),r))}),Yp=n(function(e,t,r){return f(jp,function(e){return gr},Gp(f(xa,zp(e),t)))}),Wp=n(function(e,t,r){return xp(gr)}),Jp=r(function(e,t){var r=t.a;return Vp(f(jp,e,r))});pn.Task=Pe(Hp,Yp,Wp,Jp);var Qp=Ue("Task"),Xp=cn,Zp=r(function(e,t){return Qp(Vp(f(Xp,f(Da,f(Da,xp,e),fi),f(Kp,f(Da,f(Da,xp,e),li),t))))}),eg=a(function(e,t,r,n){return f(Zp,n,f(Fp,Xh(eo(e)),l(Qh,nh(e),t,r)))}),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return th("0x092110996699c3E06e998d89F0f4586026e44F0F")}},rg=function(e){return{$:"BoolE",a:e}},ng=rg,ag=function(e){return{$:"StringE",a:e}},ig=ag,og=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ug=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},sg=r(function(e,t){return{paymentMethods:t,price:e}}),cg=function(e){return hl(Sd(e))},fg=function(e){return f(zh,Ua,M([hl(e.fiatType),cg(e.amount)]))},lg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},dg=function(e){return Cl(M([L("type",hl(lg(e.type_))),L("info",hl(e.info))]))},hg=function(e){var t=fg(e.price),r=f(zh,dg,e.paymentMethods);return f(xi,0,Cl(M([L("paymentmethods",r),L("price",t)])))},pg=r(function(e,t){return D(t,{value:si(e)})}),gg=function(e){return qu(jd(e))},vg=function(e){return f(ql,gg(e),qu(1e3))},yg=r(function(e,t){var r=function(){return"Token"===e.$?og:ug}();return function(){return"Native"===e.$?pg(jl(lh(t))):Ua}()(r(rh(e))(t.initiatorAddress)(tg(e))(R(t.initiatorRole,lo))(jl(t.tradeAmount))(jl(Yl(t.tradeAmount)))(jl(zl(t.tradeAmount)))(jl(t.pokeReward))(vg(t.autorecallInterval))(vg(t.autoabortInterval))(vg(t.autoreleaseInterval))(jl(ch(t.tradeAmount)))(hg(f(sg,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),mg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),bg=function(e){return{$:"CreateNeedsSig",a:e}},Cg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Eg=r(function(e,t){var r=al(f(yg,e,t)),n={onBroadcast:ci,onMined:si(L(mg(e),ci)),onSign:si(Cg(e))};return L(si(bg(e)),f(qo,n,r))}),Sg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wg=function(e){return{$:"ApproveNeedsSig",a:e}},Ig=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Bg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),kg={$:"NoOp"},Ng=function(e){return{appCmds:yr,chainCmd:Fo,cmd:Do,model:e}},Rg=function(e){return rd(Sd(e))},$g={$:"Error"},_g=r(function(e,t){f(cl,e+" fetch error",t);return{align:ul,label:"web3FetchError",mainParagraphs:M([M([fl('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:$g}}),Lg=r(function(e,t){return{align:ul,label:"web3MiningError",mainParagraphs:M([M([fl('Error mining "'+e+'" transaction: '+t)])]),noticeType:$g}}),xg={$:"Caution"},Pg=r(function(e,t){return{align:ul,label:"web3SigError",mainParagraphs:M([M([fl('Error signing "'+e+'" transaction: '+t)])]),noticeType:xg}}),Dg={$:"KovanDai"},Ug=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Dg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Og=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Mg=function(e){return f(Io,Ug,Og(e))},Fg=r(function(e,t){return 1-e(1-t)}),Vg=function(e){return f(Nu,e,5)},Kg=Fg(Vg),Hg={easing:Kg,offset:12,speed:200},jg=function(e){return{$:"External",a:e}},qg=function(e){return{$:"Internal",a:e}},Gg=function(e){return{$:"NotFound",a:e}},zg=function(e){for(;;){e=e.a}},Yg=r(function(e,t){return Qp(Vp(f(jp,e,t)))}),Wg={$:"Http"},Jg={$:"Https"},Qg=Kr,Xg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Zg=i(function(e,t,r,n,a){if(_d(a)||f(Qg,"@",a))return ci;var i=f(Xl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=rd(f(Zo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Xg,e,f(ru,o,a),s,t,r,n))}return si(p(Xg,e,a,ci,t,r,n))}),ev=a(function(e,t,r,n){if(_d(n))return ci;var a=f(Xl,"/",n);if(a.b){var i=a.a;return h(Zg,e,f(Zo,i,n),t,r,f(ru,i,n))}return h(Zg,e,"/",t,r,n)}),tv=n(function(e,t,r){if(_d(r))return ci;var n=f(Xl,"?",r);if(n.b){var a=n.a;return d(ev,e,si(f(Zo,a+1,r)),t,f(ru,a,r))}return d(ev,e,ci,t,r)}),rv=r(function(e,t){if(_d(t))return ci;var r=f(Xl,"#",t);if(r.b){var n=r.a;return l(tv,e,si(f(Zo,n+1,t)),f(ru,n,t))}return l(tv,e,ci,t)}),nv=function(e){return f(su,"http://",e)?f(rv,Wg,f(Zo,7,e)):f(su,"https://",e)?f(rv,Jg,f(Zo,8,e)):ci},av=Wt,iv=Gt(zt),ov=sa,uv=r(function(e,t){return L(e,t)}),sv=_r,cv=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=ju(r-n),o=f(ei,1,sv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),fv=r(function(e,t){var n=r(function(t,r){return Gp(f(xa,ov(0),d(cv,e.speed,e.easing,t,r-e.offset)))});return f(Kp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(qp,uv,iv,av(t)))}),lv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Gd(t.wallet),Mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(eg,a,n.address,rh(eo(a)),Sg(a));return d(Qd,t,i,Fo,yr)}return Ng(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Qd,D(t,{inputs:D(u,{userRole:o})}),Do,Fo,M([function(){return"Buyer"===o.$?d(Zd,"create offer type changed","input","sell dai",0):d(Zd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ng(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ng(f(Jd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Qd,(g?Jd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Do,Fo,g?M([d(Zd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=qd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jl,n,m);return Ng(D(t,{depositAmount:si(jl(lh(b))),txChainStatus:si(f(Ag,v,b))}))}var C=y.a;return d(Qd,D(t,{errors:C}),f(Zp,ms(kg),function(){return f(fv,D(Hg,{offset:60}),"inputError")}()),Fo,yr);case"AbortCreate":return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([d(Zd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Eg,v,b);var e=v.a,r=function(){var t=al(l(sh,nh(e),rh(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Ig,e,b))};return f(qo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(ts,a,E),ba)?L(si(wg(e)),r):f(Eg,v,b)}return L(si(wg(e)),r)}(),T=S.a,w=S.b;return d(Qd,D(t,{txChainStatus:T}),Do,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(l(Tg,a,b,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(ts,N,P),ba))return Ng($);var U=f(Eg,eo(a),b),T=U.a,w=U.b;return d(Qd,D($,{txChainStatus:T}),Do,w,yr)}return Ng($)}var O=k.a;return d(Qd,t,Do,Fo,M([pa(f(_g,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(f(Bg,v,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Qd,t,Do,Fo,M([pa(f(Lg,"create",B))]))}var F=e.a,V=e.b.a,K=f(Io,Rg,Yd(f(Jh,F,V)));if("Just"===K.$){var H=K.a;return d(Qd,t,Do,Fo,M([da(f(Qf,F,H))]))}return d(Qd,t,Do,Fo,M([pa(f(ll,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Qd,t,Do,Fo,M([ga]));case"NoOp":return Ng(t);default:var j=e.a;return d(Qd,t,Do,Fo,M([j]))}}),dv=r(function(e,t){return f(Eh,function(e){return f(Ch,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),hv=r(function(e,t){return f(Ku,jd(e),jd(t))}),pv=r(function(e,t){return R(f(hv,t.derived.phaseEndTime,e),Ta)}),gv=function(e){if(""===e)return li(ci);var t=vd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},vv=r(function(e,t){return{maxDai:t,minDai:e}}),yv=f(vv,ci,ci),mv=function(e){return l(Ih,r(function(t,r){return{dai:{max:r,min:t},fiatType:Ld(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Hd,function(e){return D(yv,{minDai:si(e)})},gv(e.minDai)),f(Hd,function(e){return D(yv,{maxDai:si(e)})},gv(e.maxDai)))},bv=r(function(e,t){var r=function(t){return f(Eh,function(e){return f(Qg,sd(e),sd(t))},e)};return f(Ch,function(e){return r(e.info)},t)}),Cv=r(function(e,t){return D(t,{paymentMethod:e})}),Ev=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Sv=r(function(e,t){return f(ts,jl(e),jl(t))}),Tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return wv(D(e,{inputs:f(Ev,r,f(Cv,"",e.inputs))}))},wv=function(e){var t=Tv(e),n=mv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(bv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(pv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(dv,t.filters,r)});return D(t,{filterFunc:s})},Iv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Av={$:"Expires"},Bv=function(e){return L(wv({errors:yv,filterFunc:pv,filters:co(M([f(vo,!0,!0),d(So,!0,!1,!1,!1)])),inputs:Iv,showCurrencyDropdown:!1,tradeTable:_o(L(Av,Lo)),wallet:e}),Do)},kv=r(function(e,t){var r=f(ml,wc(e),t.inputs.paymentMethodTerms);return wv(D(t,{inputs:f(Ev,r,t.inputs)}))}),Nv=function(e){return wv(D(e,{filterFunc:pv,inputs:Iv}))},Rv=function(e){return{$:"TradeTableMsg",a:e}},$v=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),_v=function(e){return d($v,e,Do,Fo,yr)},Lv=r(function(e,t){return D(t,{fiatType:e})}),xv=r(function(e,t){return D(t,{maxDai:e})}),Pv=r(function(e,t){return D(t,{minDai:e})}),Dv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return _v(D(t,{inputs:f(Pv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return _v(D(t,{inputs:f(xv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return _v(D(t,{inputs:f(Lv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return _v(D(t,{inputs:(n?Lv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return _v(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return _v(D(t,{inputs:f(Cv,r,t.inputs)}));case"AddSearchTerm":return _v(Tv(t));case"RemoveTerm":var a=e.a;return _v(f(kv,a,t));case"ApplyInputs":return d($v,wv(t),Do,Fo,yr);case"ResetSearch":return _v(Nv(t));case"FiltersMsg":var i=e.a;return _v(wv(D(t,{filters:f(Jf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(nl,o,t.tradeTable);return d($v,D(t,{tradeTable:u.model}),f(il,Rv,u.cmd),f(Yo,Rv,u.chainCmd),f(xa,Ji(Rv),u.appCmds));case"NoOp":return _v(t);default:var s=e.a;return d($v,t,Do,Fo,M([s]))}}),Uv=a(function(e,t,r,n){return e(Cl(M([L("title",hl(t)),L("body",function(){if("Nothing"===r.$)return bl;var e=r.a;return hl(e)}()),L("image",function(){if("Nothing"===n.$)return bl;var e=n.a;return hl(e)}())])))}),Ov=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Mv=function(e){return e.a+"="+e.b},Fv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Mv,e)):""},Vv=r(function(e,t){return"/"+(f(Ri,"/",e)+Fv(t))}),Kv=function(e){switch(e.$){case"Home":return f(Vv,M(["DAIHard"]),yr);case"Create":return f(Vv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Vv,M(["DAIHard","trade",Ov(t),Ni(r)]),yr);case"Marketplace":return f(Vv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Vv,M(["DAIHard","history",dl(n)]),yr);default:return f(Vv,yr,yr)}},Hv={$:"NotFound"},jv=function(e){return{$:"AgentHistory",a:e}},qv={$:"Create"},Gv={$:"Home"},zv={$:"Marketplace"},Yv=function(e){return{$:"Parser",a:e}},Wv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Jv=r(function(e,t){return Yv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Wv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Qv=f(Jv,"ADDRESS",f(zo,Ph,Yd)),Xv={$:"Eth"},Zv={$:"Kovan"},ey=f(Jv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Xv));case"keth":return si(Zi(Zv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Dg));case"xdai":return si(Zi(to));default:return ci}}),ty=f(Jv,"NUMBER",rd),ry=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Wv,r,n,a,i,e(o))}),ny=r(function(e,t){var r=t.a;return Yv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,ry(u),r(h(Wv,n,a,i,o,e)))})}),ay=function(e){return l(La,oo,yr,e)},iy=r(function(e,t){return ay(f(xa,e,t))}),oy=function(e){return Yv(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 R(u,e)?M([h(Wv,f(ka,u,r),s,a,i,o)]):yr}return yr})},uy=r(function(e,t){var r=e.a,n=t.a;return Yv(function(e){return f(iy,n,r(e))})}),sy=Yv(function(e){return M([e])}),cy=f(uy,oy("DAIHard"),function(e){return Yv(function(t){return f(iy,function(e){return(0,e.a)(t)},e)})}(M([f(ny,Gv,sy),f(ny,qv,oy("create")),f(ny,Qf,f(uy,oy("trade"),f(uy,ey,ty))),f(ny,zv,oy("marketplace")),f(ny,jv,f(uy,oy("history"),Qv)),f(ny,function(e){return jv(e)},f(uy,oy("history"),Qv))]))),fy=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 si(t.value)}return si(t.value)}return ci}},ly=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ly(r))}return yr}return yr},dy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ly(r)}var r=t;return ly(r)},hy=Qt,py=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),gy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=hy(n);if("Nothing"===o.$)return t;var u=o.a,s=hy(i);if("Nothing"===s.$)return t;var c=s.a;return l(bp,u,py(c),t)}return t}),vy=function(e){if("Nothing"===e.$)return cp;var t=e.a;return l(La,gy,cp,f(_i,"&",t))},yy=r(function(e,t){var r=e.a;return fy(r(h(Wv,yr,dy(t.path),vy(t.query),t.fragment,Ua)))}),my=function(e){return f(xc,Hv,f(yy,cy,e))},by=aa,Cy=r(function(e,t){return f(by,e,Kv(t))}),Ey=je("connectToWeb3",function(e){return bl}),Sy=function(e){return Cl(M([L("event",hl(e.event)),L("category",hl(e.category)),L("label",hl(e.label)),L("value",wl(e.value))]))},Ty=r(function(e,t){return Cl(M([L("address",hl(dl(e))),L("signSeedMsg",hl(t))]))}),wy=je("gTagOut",Ua),Iy=je("genPrivkey",Ua),Ay=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),By=n(function(e,t,r){return f(Io,Zc(t),f(Bo,function(e){return e.trades},f(Ay,function(t){return R(t.factory,e)},r)))}),ky=je("notifyPort",Ua),Ny=je("requestNotifyPermissionPort",function(e){return bl}),Ry=r(function(e,t){return D(t,{wallet:e})}),$y=r(function(e,t){return L(f(Jd,t.inputs,D(t,{wallet:e})),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(eg,n,r.address,rh(eo(n)),Sg(n))}return Do}())}),_y=r(function(e,t){return D(t,{wallet:e})}),Ly=function(e){return{$:"AllowanceFetched",a:e}},xy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Gd(e),Mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Mg(e),si(i.factory))?d(eg,a,n.address,i.creationInfo.address,Ly):Do}return Do}())}),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{$:"TradeModel",a:e}},Fy=function(e){return{$:"TradeMsg",a:e}},Vy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Do);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Dy(a),f(il,Uy,i));case"TradeModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(il,Fy,c));case"MarketplaceModel":var l=t.a;return L(Oy(f(_y,e,l)),Do);default:var d=t.a;return L(Py(f(Ry,e,d)),Do)}}),Ky=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Hy=function(e){return{$:"PartiallyLoadedTrade",a:e}},jy=r(function(e,t){return Hy(g(Ky,e,t,ci,ci,ci,ci,ci))}),qy=function(e){return{$:"CurrentBlockFetched",a:e}},Gy=gu(f(zo,cu,Nh)),zy=function(e){return Up({decoder:Gy,method:"eth_blockNumber",params:yr,url:e})},Yy=function(e){return f(Zp,qy,zy(e))},Wy=r(function(e,t){return{address_:e,blocknum:t}}),Jy=function(e){return Wo(function(t){return li(L(t,e))})},Qy=n(function(e,t,r){var n=t.a,a=r.a;return Wo(function(t){return f(Wh,function(t){var r=t.a,n=t.b;return f(au,rl(e(n)),a(r))},n(t))})}),Xy=r(function(e,t){return l(Qy,r(function(e,t){return e(t)}),t,e)}),Zy=vu(f(Xy,jh,f(Xy,Dh,Jy(Wy)))),em=r(function(e,t){return{data:si(f(Gf,"createdTrades(uint256)",M([uh(t)]))),decoder:Zy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tm=n(function(e,t,r){return f(Zp,r,f(Fp,Xh(e),f(em,rh(e),t)))}),rm=function(e){return{$:"CreationInfoFetched",a:e}},nm=r(function(e,t){return l(tm,e,qu(t),rm)}),am=function(e){return{$:"EventSentryMsg",a:e}},im=function(e){return{$:"BlockNumber",a:e}},om=function(e){return{$:"EventSentry",a:e}},um=function(e){return{$:"Set_elm_builtin",a:e}},sm=um(cp),cm=r(function(e,t){return L(om({blockNumber:ci,errors:yr,nodePath:t,pending:sm,ref:1,requests:cp,tagger:e,watching:sm}),f(Zp,f(zo,im,e),zy(t)))}),fm=function(e){return f(cm,am,Xh(e))},lm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},hm=dm(f(lm,ci,ci)),pm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:Co,secureCommInfo:hm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),gm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),vm=n(function(e,t,r){var n=f(nm,t,r),a=fm(t),i=a.a,o=a.b;return d(gm,l(pm,f(jy,t,r),i,e),Po(M([n,o,Yy(Xh(t))])),Fo,M([ha]))}),ym=function(e){return{$:"LoadedTrade",a:e}},mm=r(function(e,t){var r=fm(t.factory),n=r.a,a=r.b;return d(gm,l(pm,ym(t),n,e),Po(M([a,Yy(Xh(t.factory))])),Fo,M([ha]))}),bm=function(e){return{data:si(f(Gf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Cm=function(e){return{data:si(f(Gf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Em=function(e){return{data:si(f(Gf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Sm=r(function(e,t){return{data:si(f(Gf,"initiatorStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Tm=function(e){return{data:si(f(Gf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},wm=function(e){return{data:si(f(Gf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Im=r(function(e,t){return{data:si(f(Gf,"responderStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Am=r(function(e,t){return{amount:t,fiatType:e}}),Bm=f(du,function(e){var t=cd(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("Can't convert that to a BigInt")},pu),km=l(Mi,Am,f(Fh,0,pu),f(Fh,1,Bm)),Nm={$:"Bank"},Rm={$:"Cash"},$m=function(e){switch(e){case"cash":return si(Rm);case"bank":return si(Nm);case"custom":return si(Fd);default:return ci}},_m=f(du,function(e){var t=$m(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("")},pu),Lm=l(Mi,Vd,f(Oh,"type",_m),f(Oh,"info",pu)),xm=oe,Pm=function(e){var t=l(Mi,sg,f(Oh,"price",km),f(Oh,"paymentmethods",xm(Lm)));return f(op,t,e)},Dm=r(function(e,t){return{commPubkey:t,responder:e}}),Um=r(function(e,t){var n=r(function(t,r){return l(Xo,t,t+2*r,e)}),a=f(zo,Nh,au(ti(2)));return f(Wh,function(t){return f(au,function(e){return f(n,t+64,e)},Nh(l(Xo,t,t+64,e)))},a(t))}),Om=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),Mm=n(function(e,t,r){var n=l(Ra,Om(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),Fm=j,Vm=function(e){return As(Fm(e))},Km=function(e){return l(Mm,r(function(e,t){return U(t,Vm(e))}),"",e)},Hm=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f(Wh,Km,f(Wh,f(zo,xa(Nh),Ah),f(au,ml(f(zo,_d,ns)),f(au,tc(2),f(Um,t,nu(r)))))))}),jm=f(dh,f(Mh,1,Hm),f(dh,f(Mh,0,Dh),Fi(Dm))),qm=r(function(e,t){return{commPubkey:t,terms:e}}),Gm=f(dh,f(Mh,1,Hm),f(dh,f(Mh,0,Hm),Fi(qm))),zm=function(e){return{statement:e}},Ym=f(dh,f(Mh,0,Hm),Fi(zm)),Wm=function(e){return{statement:e}},Jm=f(dh,f(Mh,0,Hm),Fi(Wm)),Qm={$:"AbortedEvent"},Xm={$:"BurnedEvent"},Zm={$:"ClaimedEvent"},eb=function(e){return{$:"CommittedEvent",a:e}},tb=function(e){return{$:"InitiatedEvent",a:e}},rb=function(e){return{$:"InitiatorStatementLogEvent",a:e}},nb={$:"PokeEvent"},ab={$:"RecalledEvent"},ib={$:"ReleasedEvent"},ob=function(e){return{$:"ResponderStatementLogEvent",a:e}},ub=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),sb=function(e){return ub(e)?li(nc(cu(e))):fi("Something in here is not very hexy: "+xh(e))},cb=gu(sb),fb=f(Oh,"topics",f(Fh,0,cb)),lb=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),Kf(f(xa,yi,Zs(e))))))},db=f(du,function(e){return R(e,lb("Initiated(string,string)"))?f(Oi,tb,Gm):R(e,lb("Committed(address,string)"))?f(Oi,eb,jm):R(e,lb("Recalled()"))?Fi(ab):R(e,lb("Claimed()"))?Fi(Zm):R(e,lb("Aborted()"))?Fi(Qm):R(e,lb("Released()"))?Fi(ib):R(e,lb("Burned()"))?Fi(Xm):R(e,lb("InitiatorStatementLog(string)"))?f(Oi,rb,Ym):R(e,lb("ResponderStatementLog(string)"))?f(Oi,ob,Jm):R(e,lb("Poke()"))?Fi(nb):hu("Unrecognized topic hash")},fb),hb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},pb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},gb=function(e){return R(e.buyerDeposit,Yl(e.tradeAmount))&&R(e.abortPunishment,zl(e.tradeAmount))},vb={$:"Invalid"},yb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),mb=r(function(e,t){return Vl(jd(t)+jd(e))}),bb=function(e){var t=Bd(Sd(e.amount));if("Just"===t.$){return t.a}f(cl,"Error converting FiatValue to float--string -> float failed!",e);return 0},Cb=r(function(e,t){return(t-e)/e}),Eb=r(function(e,t){var r=bb(t),n=kd(e);return"USD"===t.fiatType?si(f(Cb,n,r)):ci}),Sb=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 Vl(0)}}();return{margin:f(Eb,e.tradeAmount,r.price),phaseEndTime:function(){return"Closed"===t.phase.$?Vl(f(Nu,2,53)-1):f(mb,t.phaseStartTime,n)}()}}),Tb=function(e){var t=x(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 ym(v(yb,e.factory,e.id,n,a,o,u,s,l(Sb,a,o,u)))}return Hy(e)},wb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(cl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return vb}}),Ib=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return vb}}),Ab=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return vb}}),Bb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return ym(D(n,{state:e}));default:return vb}}),kb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return vb}}),Nb=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}}),Rb=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,uu,f(Xy,Dh,Jy(Nb))))))))))),$b=function(e){return{data:si(f(Gf,"getParameters()",yr)),decoder:Rb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},_b=function(e){return f(Bo,function(e){return Vl(1e3*e)},rd(Sd(e)))},Lb=function(e){return Hl(e)},xb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),Pb=function(e){var t=f($d,"error converting BigInt to Time.Posix",_b(e.autoabortInterval)),r=f($d,"error converting BigInt to Time.Posix",_b(e.autoreleaseInterval)),a=f($d,"error converting BigInt to Time.Posix",_b(e.autorecallInterval));return d(xb,n(function(t,r,n){return{abortPunishment:Lb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Lb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:Lb(e.pokeReward),tradeAmount:Lb(e.tradeAmount)}}),a,t,r)},Db=n(function(e,t,r){return f(Zp,r,f(jp,Pb,f(Fp,Xh(e),$b(t))))}),Ub=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}}}}}}}}}}},Ob=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(Ub)))))))))))),Mb=function(e){return{data:si(f(Gf,"getPhaseStartInfo()",yr)),decoder:Ob,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Fb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),Vb=function(e){return h(Fb,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}}),_b(e.v6),_b(e.v7),_b(e.v8),_b(e.v9))},Kb=n(function(e,t,r){return f(Zp,r,f(jp,Vb,f(Fp,Xh(e),Mb(t))))}),Hb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),jb=vu(f(Xy,jh,f(Xy,Dh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(Hb))))))),qb=function(e){return{data:si(f(Gf,"getState()",yr)),decoder:jb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Gb={$:"Aborted"},zb={$:"Burned"},Yb={$:"NotClosed"},Wb={$:"Recalled"},Jb={$:"Released"},Qb=function(e){switch(f(xc,99,rd(Sd(e)))){case 0:return si(Yb);case 1:return si(Wb);case 2:return si(Gb);case 3:return si(Jb);case 4:return si(zb);default:return ci}},Xb=function(e){switch(f(xc,99,rd(Sd(e)))){case 1:return si(Co);case 2:return si(mo);case 3:return si(bo);case 4:return si(yo);default:return ci}},Zb=function(e){return R(e,th("0x0000000000000000000000000000000000000000"))?ci:si(e)},eC=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),tC=function(e){var t=_b(e.phaseStartTimestamp),r=Xb(e.phase),a=Qb(e.closedReason);return d(eC,n(function(t,r,n){return{balance:Lb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:Zb(e.responder)}}),r,t,a)},rC=n(function(e,t,r){return f(Zp,r,f(jp,tC,f(Fp,Xh(e),qb(t))))}),nC=i(function(e,t,r,n,a){return Po(M([l(Db,e,t,r),l(rC,e,t,n),l(Kb,e,t,a)]))}),aC=function(e){var t=Rg(e);if("Just"===t.$){return t.a}f(cl,"Warning! BigInt to Int conversion failed!",Sd(e));return 0},iC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),oC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),uC=function(e){return e.b?l(oC,e,yr,0):qa},sC=tn,cC=function(e){var t=h(sC,iC,f(Oh,"encapsulation",pu),f(Oh,"iv",pu),f(Oh,"tag",pu),f(Oh,"encrypted",pu)),r=xm(t),n=f(Gh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Zc,0,e),f(Zc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(uC(i))},fC=function(e){var t=function(e){var t=Qo(e);return t>1114111?fi("string is too long"):li(f(Is,Fm(t),e))};return f(au,Ri(""),Ah(f(xa,t,e)))},lC=function(e){var t=e.a,r=e.b;return fC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},dC=r(function(e,t){return Cl(M([L("message",hl(e)),L("pubkeyHexStrings",f(zh,hl,M([t.initiatorPubkey,t.responderPubkey])))]))}),hC=function(e){return{$:"LoadedCommInfo",a:e}},pC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),gC=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 hC(f(pC,r,n))}return dm(e)},vC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return gC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return hC(D(n,{initiatorPubkey:e}))}),yC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return gC(D(r,{responderPubkey:si(e)}))}var n=t.a;return hC(D(n,{responderPubkey:e}))}),mC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),bC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(nd,a,n),o=$s(f(lc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),CC=function(e){var t=uC(f(bC,Zs(e),yr));return l(zd,uv,h(Fb,iC,f(Zc,0,t),f(Zc,1,t),f(Zc,2,t),f(Zc,3,t)),h(Fb,iC,f(Zc,4,t),f(Zc,5,t),f(Zc,6,t),f(Zc,7,t)))},EC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),SC={$:"Aborted"},TC={$:"Burned"},wC={$:"Claimed"},IC=function(e){return{$:"Committed",a:e}},AC=function(e){return{$:"Encrypted",a:e}},BC={$:"FailedDecode"},kC={$:"Initiated"},NC={$:"Recalled"},RC={$:"Released"},$C=function(e){return{$:"StateChange",a:e}},_C=function(e){return{$:"Statement",a:e}},LC=fr,xC=cr,PC=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(LC,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(xC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),DC=or,UC=y,OC=a(function(e,t,r,n){var a=Wc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(DC,Ga(r),n);var i=za(d(OC,e-Ha,t,r,ja));return f(DC,i,n)}var o=f(Jc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(OC,e-Ha,t,r,u));return l(rf,a,i,n)}var i=za(d(OC,e-Ha,t,r,UC(o)));return l(rf,a,i,n)}),MC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(OC,c,r,e,UC(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(OC,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),FC=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(LC,32,r,e),o=f(MC,i,t);if(a<0){var u=l(xC,a,n,e);return f(MC,u,o)}return o}),VC=ur,KC=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(VC,i,t,r)}return f(ka,e,t)});return{nodeList:l(VC,i,yr,n),nodeListSize:t/32|0,tail:a}},HC=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(VC,o,t,r)}var n=e.a;return f(FC,n,t)});return f(FC,i,l(VC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(VC,o,t,r)}var n=e.a;return f(PC,n,t)});return f(ai,!0,f(PC,i,l(VC,o,KC(e),a)))}),jC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),qC=f(La,jC,yr),GC=n(function(e,t,r){var n=mC(r.trade.parameters.initiatorRole),a=f(cl,"maybeHistoryEventInfo",function(){switch(t.$){case"InitiatedEvent":return si($C(kC));case"CommittedEvent":var r=t.a;return si($C(IC(r.responder)));case"RecalledEvent":return si($C(NC));case"ClaimedEvent":return si($C(wC));case"AbortedEvent":return si($C(SC));case"ReleasedEvent":return si($C(RC));case"BurnedEvent":return si($C(TC));case"InitiatorStatementLogEvent":var r=t.a;return si(_C({blocknum:e,message:function(){var e=CC(r.statement);if("Just"===e.$){var t=e.a;return AC(t)}return BC}(),who:n(To)}));case"ResponderStatementLogEvent":var r=t.a;return si(_C({blocknum:e,message:function(){var e=CC(r.statement);if("Just"===e.$){var t=e.a;return AC(t)}return BC}(),who:n(wo)}));default:return ci}}()),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(HC,r.history,uC(qC(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Bo,EC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),qC(M([s])))}),zC=Gr,YC=function(e){var t=l(Mi,uv,f(Oh,"id",zC),f(Oh,"message",pu));return f(Hd,Di,f(Gh,t,e))},WC=function(e){return{$:"Decrypted",a:e}},JC=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),QC=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(GC,n,a,t),o=i.a,u=i.b,s=i.c;return d(JC,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(JC,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(JC,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=YC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Zc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:WC(y)}),T=D(b,{eventInfo:_C(S)}),w=l(af,v,T,t.history);return d(JC,D(t,{history:w}),!1,ci,yr)}return d(JC,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an event that is not a message!",b))]))}return d(JC,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(JC,t,!1,ci,M([pa(f(ll,"Error decoding decryption result",I))]))}}),XC=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),ZC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),eE=function(e){return{onBroadcast:ci,onMined:si(L(XC(e),ci)),onSign:si(ZC(e))}},tE=je("encryptToPubkeys",Ua),rE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),nE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),aE=function(e){return{$:"CommitMined",a:e}},iE={$:"CommitNeedsSig"},oE=function(e){return{$:"CommitSigned",a:e}},uE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?nE:rE}(),a=al(function(){return"Token"===e.factory.$?Ua:pg(jl(hb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(iE),f(qo,{onBroadcast:ci,onMined:si(L(aE,ci)),onSign:si(oE)},a))}),sE=r(function(e,t){return Cl(M([L("id",wl(e)),L("encapsulation",hl(t.encapsulatedKey)),L("iv",hl(t.iv)),L("tag",hl(t.tag)),L("encrypted",hl(t.message))]))}),cE=je("decryptMessage",Ua),fE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},lE=r(function(e,t){return Po(f(xa,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 cE(f(sE,r,s))}return Do}return Do},fE(e.history)))}),dE=function(e){if("Just"===e.$){return e.a}return ci},hE=function(e){var t=dE(l(zd,Ao,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Bo,function(e){return e.address},Gd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(lE,n,a)}return Do},pE=r(function(e,t){var n=r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(GC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}});f(cl,"HIE",e);return f(n,e,x(t,!1,yr))}),gE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),vE=i(function(e,t,r,n,a){return f(pE,n,p(gE,e,r,t,qa,a,""))}),yE=function(e){return{$:"ChatHistoryMsg",a:e}},mE=a(function(e,t,r,n){var a=x(t,Gd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(ko,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(yE),n))}(h(vE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),bE={$:"Abort"},CE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),EE=function(e){return{$:"ActionNeedsSig",a:e}},SE=function(e){return{$:"ApproveMining",a:e}},TE={$:"ApproveNeedsSig"},wE=function(e){return{$:"ApproveSigned",a:e}},IE={$:"Burn"},AE={$:"Claim"},BE=function(e){return{$:"CommitMining",a:e}},kE=function(e){return{$:"ConfirmingAction",a:e}},NE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),RE=function(e){return{$:"EventLogFetched",a:e}},$E=function(e){return{$:"ParametersFetched",a:e}},_E=function(e){return{$:"PhaseInfoFetched",a:e}},LE={$:"Poke"},xE={$:"Recall"},PE={$:"Release"},DE=function(e){return{$:"StartContractAction",a:e}},UE=function(e){return{$:"StateFetched",a:e}},OE=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"}},ME=function(e){return d(gm,e,Do,Fo,yr)},FE={align:ul,label:"cantFindTradeWillRetry",mainParagraphs:M([M([fl("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:$g},VE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(_g,e,r)}if("Nothing"===t.a.$){t.a;return f(ll,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ll,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),KE={align:ul,label:"tradeParametersNotDefault",mainParagraphs:M([M([fl("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:$g},HE=eo(Xi),jE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),qE=n(function(e,t,r){return l(bp,e,Bo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),GE=r(function(e,t){var r=t.a;return um(f(mp,e,r))}),zE=n(function(e,t,r){var n=e.a,a=f(fp,t,n.requests);if("Nothing"===a.$)return L(om(n),Do);var i=a.a,o=L(i.watchOnce,Ql(r));if("Nothing"===o.b.$){o.b;return L(om(D(n,{requests:l(qE,t,r,n.requests)})),Do)}if(o.a){var u=o.b.a;return L(om(D(n,{requests:l(qE,t,r,n.requests),watching:f(GE,t,n.watching)})),f(Yg,i.tagger,xp(u)))}return L(om(D(n,{requests:l(qE,t,r,n.requests)})),Po(f(xa,function(e){return f(Yg,i.tagger,xp(e))},r)))}),YE=_e,WE=r(function(e,t){return f(Zp,f(zo,im,t),f(Kp,function(t){return zy(e)},YE(2e3)))}),JE=ue,QE=ce,XE=Yr,ZE=n(function(e,t,r){var n=function(e){return QE(M([e,JE(r)]))};return f(du,function(a){var i=f(Gh,e,a);if("Ok"===i.$){var o=i.a,u=f(Gh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return hu(Di(c))}return Fi(r)},XE)}),eS=a(function(e,t,r,n){return f(dh,l(ZE,f(Oh,e,XE),t,r),n)}),tS=n(function(e,t,r){return f(dh,f(Oh,e,t),r)}),rS=gu(Ph),nS=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),aS=function(e){return{$:"BlockHash",a:e}},iS=function(e){return nS(e)?li(aS(cu(e))):fi("Given blockHash "+xh(e)+" is not valid.")},oS=gu(iS),uS=function(e){return{$:"TxHash",a:e}},sS=function(e){return nS(e)?li(uS(cu(e))):fi("Given txHash "+xh(e)+" is not valid.")},cS=gu(sS),fS=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}}),lS=zr,dS=l(tS,"blockNumber",Gy,l(tS,"blockHash",oS,l(tS,"transactionHash",cS,l(tS,"transactionIndex",Gy,l(tS,"logIndex",Gy,d(eS,"removed",lS,!1,l(tS,"topics",xm(cb),l(tS,"data",pu,l(tS,"address",rS,Fi(fS)))))))))),hS=function(e){return f(zh,function(e){if("Just"===e.$){var t=e.a;return hl(qf(t))}return bl},e)},pS=function(e){return Cl(M([L("fromBlock",Zh(e.fromBlock)),L("toBlock",Zh(e.toBlock)),L("address",pl(e.address)),L("topics",hS(e.topics))]))},gS=r(function(e,t){return Up({decoder:xm(dS),method:"eth_getLogs",params:M([pS(t)]),url:e})}),vS=function(e){return{$:"BlockNum",a:e}},yS=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Kp,function(r){return f(jp,vi(r),f(gS,e,D(t,{fromBlock:vS(n),toBlock:vS(a)})))},f(gS,e,t)):f(gS,e,t)}),mS=n(function(e,t,r){var n=r.a,a=r.b;return f(gS,e,D(t,{fromBlock:vS(n),toBlock:vS(a)}))}),bS=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(bS,e,t,i)),c=o;e=u,t=s,r=c}}),CS=r(function(e,t){return l(bS,xl,t,e)}),ES=r(function(e,t){var r=e.a,n=t.a;return um(f(CS,r,n))}),SS=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 Po(f(xa,function(t){return f(Zp,f(zo,jE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},qC(f(xa,function(e){return f(fp,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(om(D(r,{blockNumber:si(a)})),Po(M([f(WE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,mS)]))):L(t,f(WE,r.nodePath,r.tagger))}return L(om(D(r,{blockNumber:si(a),pending:sm,watching:f(ES,r.watching,r.pending)})),Po(M([f(WE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,yS),l(i,L(a,a),r.watching,mS)])))}var s=e.a.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),f(WE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(zE,t,c,d)}var s=e.b.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),Do)}),TS=r(function(e,t){var r=t.a;return um(l(xl,e,gr,r))}),wS=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(xl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(om(D(o,{watching:f(TS,a.ref,o.watching)})),f(Zp,f(zo,jE(a.ref),a.tagger),e),a.ref)}(l(yS,a.nodePath,n,L(s,s)))}return x(om(D(o,{pending:f(TS,a.ref,o.pending)})),Do,a.ref)}),IS=wS(!1),AS=function(e){return M([e])},BS=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(nm,r.factory,r.id):Do}}(),function(){var e=x(Gd(t.wallet),Mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Mg(t.wallet),si(a.factory))?d(eg,n,r.address,a.creationInfo.address,Ly):Do}return Do}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(mE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?hE(t):Do,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(gm,u,Po(M([l(rC,p.factory,p.creationInfo.address,UE),s,r])),Fo,o)}return ME(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return ME(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(ts,m,jl(hb(C.parameters))),ba))return ME(u);var S=l(uE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(gm,D(u,{txChainStatus:T}),Do,w,yr)}return ME(u)}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:aC(I.blocknum)},B=l(IS,RE,t.eventSentry,{address:A.address,fromBlock:vS(A.blocknum),toBlock:Mp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(wb,A,t.trade)}),$=f(xc,HE,pb(u.trade)),_=Po(M([N,h(nC,$,A.address,$E,UE,_E)]));return d(gm,u,_,Fo,yr)}if("BadBody"===g.a.$){g.a.a;return d(gm,t,Do,Fo,M([pa(FE)]))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(Bb,P,t.trade)});return d(gm,u,hE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(VE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(gb(F)){var u=D(t,{trade:f(Ib,F,t.trade)});return d(gm,u,hE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(KE)]))}var V=g.a.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Ab,H,t.trade)});return d(gm,u,hE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(VE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Yh,db,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(vC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(yC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=Pm(e.terms);if("Ok"===r.$){var n=r.a;return L(f(kb,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ll,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(yE),n))}(l(GC,q.blockNumber,Y,r))}return d(mE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?hE(u):Do;return d(gm,u,_,Fo,f(oo,f(xa,pa,qC(M([X]))),o));case"ExpandPhase":var te=e.a;return ME(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return ME(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return ME(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(gm,t,Do,Fo,M([da(jv(C.parameters.initiatorAddress))]))}return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return ME(D(t,{txChainStatus:si(f(NE,E,ie))}));case"AbortAction":return ME(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(uE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=al(l(sh,nh(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(wE)};return f(qo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(ts,i,jl(hb(C.parameters))),ba)?L(si(TE),n):l(uE,C,E.address,E.commPubkey)}return L(si(TE),n)}(),T=oe.a,w=oe.b;return d(gm,D(t,{txChainStatus:T}),Do,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,LE)||R(ue,xE)){var se=DE(ue),ce=t;e=se,t=ce;continue e}return ME(D(t,{txChainStatus:si(kE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Fo,M([pa(f(ll,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=al(Tm(n.creationInfo.address));return x(si(EE(xE)),f(qo,eE(xE),a),yr);case"Claim":var a=al(Em(n.creationInfo.address));return x(si(EE(AE)),f(qo,eE(AE),a),yr);case"Abort":var a=al(bm(n.creationInfo.address));return x(si(EE(bE)),f(qo,eE(bE),a),yr);case"Release":var a=al(wm(n.creationInfo.address));return x(si(EE(PE)),f(qo,eE(PE),a),yr);case"Burn":var a=al(Cm(n.creationInfo.address));return x(si(EE(IE)),f(qo,eE(IE),a),yr);default:var a=al(zf(n.creationInfo.address));return x(si(EE(LE)),f(qo,eE(LE),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(gm,D(t,{txChainStatus:T}),Do,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return ME(D(t,{txChainStatus:si(SE(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return ME(D(t,{txChainStatus:si(BE(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"commit",V))]));case"CommitMined":return ME(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return ME(D(t,{txChainStatus:si(f(CE,ue,he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,OE(ue),V))]));case"ActionMined":var ue=e.a;return ME(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(SS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(gm,D(t,{eventSentry:ve}),_,Fo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(QC,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?hE(t):Do,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(tE(f(dC,r,a)),ci)}return L(Do,si(f(ll,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Do,ci)}(),Te=Se.a,we=Se.b;return d(gm,Ee,Po(M([s,Te])),Fo,U(f(Qi,yE,Ce.appCmds),f(xc,yr,f(Bo,AS,f(Bo,pa,we)))))}return d(gm,t,Do,Fo,M([pa(f(ll,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Wh,lC,cC(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Ao,p,E.address);if("Nothing"===Ne.$)return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return al("Initiator"===Re.$?f(Sm,p.creationInfo.address,ke):f(Im,p.creationInfo.address,ke))}();return d(gm,t,Do,f(qo,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(gm,t,Do,Fo,M([pa(f(ll,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return ME(t)}var V=e.a.a;return d(gm,t,Do,Fo,M([pa(f(Lg,"message",V))]));default:return d(gm,t,Do,Fo,M([ga]))}}),kS=r(function(e,t){return{address:e,blocknum:t}}),NS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},RS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(wS,!0,e,t,r))}),$S=n(function(e,t,r){var n=function(e){return r(f(Yh,Gm,e).returnData)},a={address:t.address,fromBlock:vS(t.blocknum),toBlock:vS(t.blocknum),topics:M([si(lb("Initiated(string,string)"))])};return l(RS,n,e,a)}),_S=function(e){return{data:si(f(Gf,"numTrades()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},LS=r(function(e,t){return f(Zp,t,f(Fp,Xh(e),_S(rh(e))))}),xS=function(e){return{data:si(f(Gf,"phase()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},PS=n(function(e,t,r){return f(Zp,r,f(jp,Xb,f(Fp,Xh(e),xS(t))))}),DS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),US=r(function(e,t){return l(La,DS(e),yr,t)}),OS=function(e){return f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},MS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},FS=function(e){return f(MS,Ja(vb),Sa(e.trades))},VS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:FS(e),loaded:Ti(OS(e))})})},KS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),HS=r(function(e,t){var r=f(Zc,e,t.trades);if("Just"===r.$){var n=(r.a,l(af,e,vb,t.trades));return l(KS,VS(D(t,{trades:n})),Do,yr)}return l(KS,t,Do,M([pa(f(ll,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),jS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(wb,t,a),o=l(af,e,i,r.trades);return L(VS(D(r,{trades:o})),yr)}return L(r,M([f(ll,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),qS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Ib,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(af,e,ym(D(a,{state:D(i,{phase:t})})),r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),zS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Ab,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),YS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Bb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),WS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(kb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),JS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),QS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),XS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),ZS=function(e){return{$:"NumTradesFetchedAgain",a:e}},eT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),tT=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),rT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),nT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),aT=function(e){return l(KS,e,Do,yr)},iT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=aC(n),i=uC(f(xa,jy(t.factory),f(Ai,0,a-1))),o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,0,a-1)));return l(KS,D(t,{dataFetchState:l(QS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CheckForNewTrades":return l(KS,t,f(LS,t.factory,ZS),yr);case"UpdateTradePhases":var s=Po(qC(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(PS,e.factory,e.creationInfo.address,f(tT,e.factory,e.id)))},OS(t))));return l(KS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(GS,d,p,t),v=function(){var e=L(p,f(Zc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=NS(r);if("Just"===n.$){var a=n.a;return L(l(rC,c,a.address,nT(d)),yr)}return L(Do,M([pa(f(ll,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Do,yr)}e.b;return L(Do,M([pa(f(ll,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(KS,g.tradeCache,Po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(KS,t,Do,M([pa(f(VE,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=aC(n);if(_(C,E)<0){var S=t.dataFetchState,o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,C,E-1))),T=uC(f(xa,jy(t.factory),f(Ai,C,E-1)));return l(KS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(HC,t.trades,T)}),o,yr)}return aT(t)}b.b;return l(KS,t,Do,M([pa(f(ll,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(kS,w.address_,aC(w.blocknum)),A=l($S,t.eventSentry,I,XS(d)),B=A.a,k=A.b,y=Po(M([h(nC,t.factory,I.address,eT(d),nT(d),rT(d)),k])),N=l(jS,d,I,t),R=N.a,$=N.b;return l(KS,VS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(KS,t,Do,M([pa(f(_g,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(qS,d,P,t)}var U=r.a.a;return l(KS,t,Do,M([pa(f(ll,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(YS,d,O,t)}return l(KS,t,Do,M([pa(f(VE,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(zS,d,F,t)}return l(KS,t,Do,M([pa(f(VE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=Pm(V.terms);if("Ok"===K.$){var H=K.a;return l(WS,d,H,t)}var j=K.a;return f(HS,d,t)}var j=r.a;return l(KS,t,Do,M([pa(f(ll,"Error decoding initiated event",j))]));default:var q=e.a,G=f(SS,q,t.eventSentry),z=G.a,y=G.b;return l(KS,D(t,{eventSentry:z}),y,yr)}}),oT=function(e){return{$:"AgentHistoryMsg",a:e}},uT=function(e){return{$:"AppCmd",a:e}},sT={$:"BetaLandingPage"},cT={$:"ConnectToWeb3"},fT=function(e){return{$:"MarketplaceMsg",a:e}},lT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),dT=r(function(e,t){return f(kn,e,hl(t))}),hT=function(e){return f(dT,"href",tt(e))},pT=Nn("rel"),gT=dT("target"),vT=function(e){return{$:"Height",a:e}},yT=vT,mT={$:"Content"},bT=mT,CT=function(e){return{$:"Width",a:e}},ET=CT,ST=function(e){return{$:"Attr",a:e}},TT=function(e){return{$:"NodeName",a:e}},wT=function(e){return{$:"Unkeyed",a:e}},IT={$:"AsEl"},AT=IT,BT=r(function(e,t){return{$:"Field",a:e,b:t}}),kT=f(BT,0,0),NT={$:"NoNearbyChildren"},RT={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"},$T=RT.any+" "+RT.column,_T=RT.any+" "+RT.grid,LT=RT.any+" "+RT.page,xT=RT.any+" "+RT.paragraph,PT=RT.any+" "+RT.row,DT=RT.any+" "+RT.single,UT=function(e){switch(e.$){case"AsRow":return PT;case"AsColumn":return $T;case"AsEl":return DT;case"AsGrid":return _T;case"AsParagraph":return xT;default:return LT}},OT=function(e){return{$:"Keyed",a:e}},MT={$:"NoStyleSheet"},FT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),VT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),KT={$:"AsParagraph"},HT=KT,jT=Sn("div"),qT=Sn("p"),GT=Sn("s"),zT=Sn("u"),YT=dT("className"),WT=function(e){return wn(Xe(e))},JT=function(e){return Sn(Xe(e))},QT=function(e){return{$:"Flag",a:e}},XT=function(e){return{$:"Second",a:e}},ZT=function(e){return e>31?XT(1< .ctr > ."+RT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",eI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+" { flex-basis: auto !important; } "+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+Ew(RT.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"+Zw,tI=function(e){return{$:"Intermediate",a:e}},rI=r(function(e,t){return tI({closing:t,others:yr,props:yr,selector:e})}),nI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,tI({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(nI,f(rI,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(nI,f(rI,n.selector,""),v),t.others)})}});return tI(l(La,a,n,t))}),aI=U(eI,function(e){var t=function(e){return Cd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Cd(f(xa,a,t.others)))};return Cd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(nI,f(rI,r,""),n),t)}),yr,e)))}(U(Jw,Xw))),iI=l(JT,"style",yr,M([Tw(aI)])),oI=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+'"'}},uI=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}},sI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ch,uI,t.variants)}return!1},cI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),fI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),lI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(fI,"."+e+"."+t+", ."+e+" ."+t,n),f(fI,"."+e+"."+t+"> ."+RT.text+", ."+e+" ."+t+" > ."+RT.text,a)])}),dI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(lI,i,RT.sizeByCapital,a),l(lI,i,RT.fullSize,n)))}),hI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(fI,"."+r+"."+RT.sizeByCapital+", ."+r+" ."+RT.sizeByCapital,M([L("line-height","1")])),f(fI,"."+r+"."+RT.sizeByCapital+"> ."+RT.text+", ."+r+" ."+RT.sizeByCapital+" > ."+RT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),pI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},gI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Tc,t,r))}return ci},vI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),yI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(xc,e.descender,gI(t)),n=f(xc,e.baseline,gI(f(ml,function(e){return!R(e,r)},t))),a=f(xc,e.capital,pI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(vI,i,a-n,o),full:l(vI,u,a-r,s)}},mI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",mw(e.height)),L("vertical-align",mw(e.vertical)+"em"),L("font-size",mw(e.size)+"em")]))},bI=function(e){return l(Ra,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 si(L(mI(function(e){return e.full}(yI(a))),mI(function(e){return e.capital}(yI(a)))))}return t}return t}),ci,e)},CI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(US,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=bI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,hI(t),n));var i=a.a;return f(Ri,"",f(xa,f(dI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},EI=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+'" '+Ni(r)}},SI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,EI,t.variants)))}return ci},TI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},wI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+mw(r)+"px, "+mw(n)+"px, "+mw(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("+mw(o)+"px, "+mw(u)+"px, "+mw(s)+"px)",b="scale3d("+mw(f)+", "+mw(l)+", "+mw(d)+")",C="rotate3d("+mw(p)+", "+mw(g)+", "+mw(v)+", "+mw(y)+"rad)";return si(m+" "+b+" "+C)}},II=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,cI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,cI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,cI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,cI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+RT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+RT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+RT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,cI(!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,M([f(vw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Tc,1,1-c));return l(a,t,"."+u,M([f(vw,"opacity",mw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(vw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(US,SI,p)),v=M([f(vw,"font-family",f(Ri,", ",f(xa,oI,p))),f(vw,"font-feature-settings",g),f(vw,"font-variant",f(Ch,sI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(vw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(vw,s,bw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+RT.row,A="."+(RT.wrapped+I),B="."+RT.alignRight,k="."+RT.paragraph,N="."+RT.page,R="."+RT.alignLeft,$=mw(S/2)+"px",_=mw(E/2)+"px",x="."+RT.column,y="."+C,P="."+RT.any;return Cd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(vw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(vw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,U(y,k),M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,lw,F.rows))+"-cols-"+f(Ri,"-",f(xa,lw,F.columns))+"-space-x-"+lw(F.spacing.a)+"-space-y-"+lw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=wI(ne),y=hw(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,M([f(vw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=TI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(CI(s),c)}),AI=r(function(e,t){return l(JT,"style",yr,M([Tw(f(II,e,t))]))}),BI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",iI),f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)}),kI=a(function(e,t,r,n){return e?f(ka,iI,f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)):f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)}),NI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(WT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(BI,!1,e,t,r);default:var e=i.a,t=i.b;return d(BI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return jT;case"p":return qT;default:return JT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(kI,!1,e,t,n);default:var e=i.a,t=i.b;return d(kI,!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(JT,e,n,M([f(u,r,M([YT(RT.any+" "+RT.single)]))]))}}();switch(o.$){case"AsRow":return f(ow,sw,e)&&!f(ow,uw,e)?s:f(ow,tw,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerRight])))]),M([s])):f(ow,rw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(ow,iw,e)&&!f(ow,aw,e)?s:f(ow,nw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerCenterY])))]),M([s])):f(ow,ew,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerBottom])))]),M([s])):s;default:return s}}),RI=Tw,$I=function(e){return f(jT,M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthContent,RT.heightContent])))]),M([RI(e)]))},_I=function(e){return l(JT,"div",M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthFill,RT.heightFill])))]),M([Tw(e)]))},LI=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 R(e,HT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,HT),L(f(ka,L(n,f(s.html,MT,e)),i),Iu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,AT)?_I(c):$I(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 R(e,HT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,HT),L(f(ka,f(o.html,MT,e),n),Iu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,AT)?_I(u):$I(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children)),MT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children)),MT))}),xI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),PI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(BT,a|r,n)}var i=e.a;return f(BT,r,i|n)}),DI=ZT(7),UI=ZT(36),OI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(BT,r|a,n|i)}),MI=ZT(6),FI=ZT(38),VI=ZT(30),KI=ZT(29),HI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),jI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),qI=function(e){return{$:"Transform",a:e}},GI=function(e){return{$:"ChildrenBehind",a:e}},zI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),YI=function(e){return{$:"ChildrenInFront",a:e}},WI=r(function(e,t){return f(jT,M([YT(function(){switch(e.$){case"Above":return f(Ri," ",M([RT.nearby,RT.single,RT.above]));case"Below":return f(Ri," ",M([RT.nearby,RT.single,RT.below]));case"OnRight":return f(Ri," ",M([RT.nearby,RT.single,RT.onRight]));case"OnLeft":return f(Ri," ",M([RT.nearby,RT.single,RT.onLeft]));case"InFront":return f(Ri," ",M([RT.nearby,RT.single,RT.inFront]));default:return f(Ri," ",M([RT.nearby,RT.single,RT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Tw("");case"Text":var e=t.a;return $I(e);case"Unstyled":return(0,t.a)(AT);default:return f(t.a.html,MT,AT)}}()]))}),JI=n(function(e,t,r){var n=f(WI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?GI(M([n])):YI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?GI(f(ka,n,a)):f(zI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(zI,M([n]),i):YI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(zI,f(ka,n,a),i):f(zI,a,f(ka,n,i))}}),QI=r(function(e,t){switch(t.$){case"Generic":return TT(e);case"NodeName":var r=t.a;return f(HI,r,e);default:var n=t.a,a=t.b;return f(HI,n,a)}}),XI=function(e){switch(e.$){case"Left":return RT.alignedHorizontally+" "+RT.alignLeft;case"Right":return RT.alignedHorizontally+" "+RT.alignRight;default:return RT.alignedHorizontally+" "+RT.alignCenterX}},ZI=function(e){switch(e.$){case"Top":return RT.alignedVertically+" "+RT.alignTop;case"Bottom":return RT.alignedVertically+" "+RT.alignBottom;default:return RT.alignedVertically+" "+RT.alignCenterY}},eA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),tA=function(e){return{$:"Moved",a:e}},rA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return tA(x(r,0,0));case"MoveY":var n=t.a;return tA(x(0,n,0));case"MoveZ":var a=t.a;return tA(x(0,0,a));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(eA,x(0,0,0),i,x(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 tA(x(s,n,a));case"MoveY":var c=t.a;return tA(x(r,c,a));case"MoveZ":var f=t.a;return tA(x(r,n,f));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,u,x(1,1,1),i,o);default:var l=t.a;return d(eA,u,l,x(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(eA,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(eA,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(eA,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(eA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(eA,u,h,v,y);default:var m=t.a;return d(eA,u,m,p,o)}}}),nA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(kT,n,M([l(jI,n,"height",r+"px")]));case"Content":return x(f(PI,UI,kT),RT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(PI,iw,kT),RT.heightFill,yr):x(f(PI,iw,kT),RT.heightFillPortion+" height-fill-"+Ni(a),M([l(jI,RT.any+"."+RT.row+" > "+Ew("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(jI,u,"min-height",Ni(i)+"px"),c=nA(o),d=c.a,h=c.b,p=c.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(jI,u,"max-height",Ni(g)+"px"),v=nA(o),d=v.a,h=v.b,p=v.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p))}},aA=function(e){switch(e.$){case"Px":var t=e.a;return x(kT,RT.widthExact+" width-px-"+Ni(t),M([l(jI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(PI,FI,kT),RT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(PI,sw,kT),RT.widthFill,yr):x(f(PI,sw,kT),RT.widthFillPortion+" width-fill-"+Ni(r),M([l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(jI,i,"min-width",Ni(n)+"px"),u=aA(a),s=u.a,c=u.b,d=u.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(jI,i,"max-width",Ni(h)+"px"),p=aA(a),s=p.a,c=p.b,d=p.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d))}},iA=ZT(27),oA=r(function(e,t){if(R(e,iA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),uA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=hw(n);if("Nothing"===s.$)return{attributes:f(ka,YT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,YT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,qI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(oA,S,I)){var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(PI,S,r),y=f(rA,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(ow,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=RT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(PI,MI,r),y=n,m=f(ka,l(jI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+RT.widthContent,g=t,v=f(PI,FI,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+RT.widthFill,g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=aA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(ow,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(PI,DI,r),y=n,m=f(ka,l(jI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=RT.heightContent+" "+e,g=t,v=f(PI,UI,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=RT.heightFill+" "+e,g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.column+" > "+Ew("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=nA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(QI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(QI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(QI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(QI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(QI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(QI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(QI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return TT("p");case"NodeName":var e=t.a;return TT(e);default:var r=t.a,n=t.b;return f(HI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(JI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(ow,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=XI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(PI,rw,e);case"Right":return f(PI,tw,e);default:return e}}(f(PI,VI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(ow,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=ZI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(PI,nw,e);case"Bottom":return f(PI,ew,e);default:return e}}(f(PI,KI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),sA={$:"Untransformed"},cA=sA,fA=a(function(e,t,r,n){return l(LI,e,n,v(uA,UT(e),t,kT,cA,yr,yr,NT,$a(r)))}),lA=function(e){return ST(YT(e))},dA=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ST(gT("_blank")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e)))))),wT(M([n])))}),hA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),pA=n(function(e,t,r){return d(hA,e,t,r,1)}),gA=ZT(14),vA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),yA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),mA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return dw(t)+"-"+dw(r)+"-"+dw(n)+"-"+dw(a)},bA=function(e){return f(yA,gA,l(vA,"fc-"+mA(e),"color",e))},CA={align:ul,label:"cantConnectNoWeb3",mainParagraphs:M([M([fl("You need a web3 provider (such as "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(") to Connect.")]),M([fl("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:xg},EA={align:ul,label:"invalidUrl",mainParagraphs:M([M([fl("I don't understand that URL...")]),M([fl("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:$g},SA=function(e){return{$:"Active",a:e}},TA=gu(f(zo,jf,f(zo,Hh,$d("Error decoding hex to BigInt")))),wA=function(){return gu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),IA=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}}}}}}}}}}}},AA=function(e){return QE(M([f(Oi,si,e),Fi(ci)]))},BA=f(dh,AA(f(Oh,"status",wA)),f(dh,AA(f(Oh,"root",pu)),l(tS,"logsBloom",pu,l(tS,"logs",xm(dS),f(dh,AA(f(Oh,"contractAddress",rS)),l(tS,"cumulativeGasUsed",TA,l(tS,"gasUsed",TA,l(tS,"blockNumber",Gy,l(tS,"blockHash",oS,l(tS,"transactionIndex",Gy,l(tS,"transactionHash",cS,Fi(IA)))))))))))),kA=function(e){var t=e.a;return jf(t)},NA=f(zo,kA,hl),RA=r(function(e,t){return Up({decoder:BA,method:"eth_getTransactionReceipt",params:M([NA(t)]),url:e})}),$A=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),_A=r(function(e,t){return{$:"TxMined",a:e,b:t}}),LA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),xA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(Io,function(e){return e.b},f(Io,function(e){return e.onMinedTagger},f(fp,t,e))))}),PA=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}}}}}}}}}}}},DA=function(e){return QE(M([JE(ci),f(Oi,si,e)]))},UA=l(tS,"input",pu,l(tS,"gas",Gy,l(tS,"gasPrice",TA,l(tS,"value",TA,l(tS,"to",DA(rS),l(tS,"from",rS,l(tS,"transactionIndex",Gy,l(tS,"blockNumber",DA(Gy),l(tS,"blockHash",function(e){return f(du,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},cu(t))?Fi(ci):f(Oi,si,e)},pu)}(oS),l(tS,"nonce",Gy,l(tS,"hash",cS,Fi(PA)))))))))))),OA=r(function(e,t){return Up({decoder:UA,method:"eth_getTransactionByHash",params:M([NA(t)]),url:e})}),MA=r(function(e,t){return{attempts:e,sleep:t}}),FA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Xp,function(e){return a>0?f(Kp,function(e){return f(FA,f(MA,a,n),t)},YE(1e3*n)):Lp(e)},t)}),VA=r(function(e,t){return f(Kp,function(r){return f(FA,{attempts:30,sleep:1},f(OA,e,t))},YE(250))}),KA=r(function(e,t){return f(FA,{attempts:60,sleep:5},f(RA,e,t))}),HA=function(e){return{$:"Mined",a:e}},jA=function(e){return Bo(function(t){return D(t,{status:HA(e)})})},qA=function(e){return{$:"Sent",a:e}},GA=function(e){return Bo(function(t){return D(t,{status:qA(e)})})},zA=function(e){return{$:"Signed",a:e}},YA=function(e){return Bo(function(t){return D(t,{status:zA(e)})})},WA=function(e){return"Nothing"!==e.$},JA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Tl(r),Do);case"TxSigned":var n=e.a,a=e.b,i=f(fp,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(Yg,t,xp(a))}return Do}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Do;if("Just"===t.b.$){var r=t.b.a;return f(Yg,r,xp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Yg,a,xp(fi(e)))}t.a,t.b,t.c;return Do};if("Ok"===a.$){var c=a.a,d=WA(o.onBroadcastTagger)||WA(o.onMinedTagger)?f(il,r.tagger,f(Zp,LA(n),f(VA,r.nodePath,c))):Do;return L(Tl(D(r,{txs:l(bp,n,YA(c),r.txs)})),Po(M([u,d])))}var h=a.a;return L(Tl(r),Po(M([u,s(h)])))}return L(Tl(r),Do);case"TxSent":var n=e.a,p=e.b,g=f(fp,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(il,r.tagger,f(Zp,_A(n),f(KA,r.nodePath,v.hash))):Do}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Yg,t,xp(li(v)))}return Do}();return L(Tl(D(r,{txs:l(bp,n,GA(v),r.txs)})),Po(M([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(Yg,t,xp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Yg,n,xp(fi("Error with TxSent stuff")))}e.a,e.b;return Do}();return L(Tl(r),s)}return L(Tl(r),Do);case"TxMined":var n=e.a,m=e.b,b=f(fp,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Yg,a,xp(li(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 Po(M([f(il,r.tagger,f(Zp,f($A,n,s),zy(r.nodePath))),f(Yg,a,xp(li(C))),f(Yg,u.toMsg,xp(s))]))}return Do}();return L(Tl(D(r,{txs:l(bp,n,jA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Yg,r,xp(fi("TxReceipt decoding failure")))}return Do}();return L(Tl(r),S)}return L(Tl(r),Do);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(xA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Tl(r),f(Yg,B,f(Xp,function(e){return xp(D(I,{doneWatching:!0,reOrg:!0}))},f(Kp,function(e){return xp(D(I,{doneWatching:!0}))},f(RA,r.nodePath,T.txHash)))))}return L(Tl(r),Do)}if(R(w,T.lastCheckedBlock))return L(Tl(r),f(il,r.tagger,f(Zp,f($A,n,T),f(Kp,function(e){return zy(r.nodePath)},YE(2e3)))));var k=f(xA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Tl(r),Po(M([f(il,r.tagger,f(Zp,f($A,n,I),f(Kp,function(e){return zy(r.nodePath)},YE(2e3)))),f(Yg,B,xp(I))])))}return L(Tl(r),Do)}var n=e.a,h=e.c.a;return L(Tl(r),Do);default:var h=e.a;return L(Tl(r),Do)}}),QA=Jt,XA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),ZA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),eB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(ZA,"#",e.fragment,l(ZA,"?",e.query,U(f(XA,e.port_,U(t,e.host)),e.path)))},tB=r(function(e,t){return e<0?ci:Ql(f(nd,e,t))}),rB=r(function(e,t){if(e<0)return t;var r=Bh(f(nd,e,t)),n=f(lc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),nB=n(function(e,t,r){if(e<0)return r;var n=f(nd,e,r),a=f(lc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),aB=r(function(e,t){return f(nB,e,ms(t))}),iB=r(function(e,t){Kv(t);switch(t.$){case"Home":return L(D(e,{submodel:sT}),Do);case"Create":var r=Xd(e.wallet),n=f(Ul,e.txSentry,f(Yo,Uy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(uB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),Po(M([f(il,Uy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(By,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(mm,e.wallet,r)}return l(vm,e.wallet,u,s)}(),c=f(Ul,e.txSentry,f(Yo,Fy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(uB,U(f(Qi,Fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:My(r.model),txSentry:a}),Po(M([f(il,Fy,r.cmd),i]))));case"Marketplace":var d=Bv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Oy(h)}),Po(M([f(il,fT,p)])));case"AgentHistory":var g=t.a,v=f(Uo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:Py(y)}),Po(M([f(il,oT,m)])));default:return L(f(uo,EA,e),Do)}}),oB=r(function(e,t){var r=t.a,n=t.b,a=f(sB,uT(e),r),i=a.a,o=a.b;return L(i,Po(M([n,o])))}),uB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,oB,L(r,n),e)}),sB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(sB,cT,t);case"GotoRoute":var n=r.a;return L(t,f(Cy,t.key,n));case"GTag":var a=r.a;return L(t,wy(Sy(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),wy(Sy(d(Ol,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Uv,ky,o,u,s));default:return L(t,Ny(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(rB,c,t.userNotices)}),Do);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(by,t.key,eB(e))}var r=h.a;return QA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(cB,g,t);case"GotoRoute":var v=e.a;return L(t,Po(M([wy(Sy(d(Ol,"GotoRoute","navigation",Kv(v),0))),f(Cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Do);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,CA,t),Do):L(t,Ey(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Do;var t=e.a;return Iy(f(Ty,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Gh,pu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=SA(l(Ml,I,w,S)),B=f(Vy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ll,"Unexpected wallet state encounted when setting commPubkey!",ci),t),Do)}T.a;return L(f(uo,f(ll,"User pubkey set, but I can no longer find the user address!",ci),t),Do)}var N=E.a;return L(l(Pa,uo,f(ll,"error decoding commPubkey from JS",N),t),Do);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(lv,R,_),P=f(Ul,t.txSentry,f(Yo,Uy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(uB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),Po(M([f(il,Uy,x.cmd),F]))))}return L(t,Do);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(BS,K,j),q=f(Ul,t.txSentry,f(Yo,Fy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(uB,U(f(Qi,Fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:My(x.model),txSentry:O}),Po(M([f(il,Fy,x.cmd),F]))))}return L(t,Do);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Dv,G,Y);return f(uB,f(Qi,fT,x.appCmds),L(D(t,{submodel:Oy(x.model)}),f(il,fT,x.cmd)))}return L(t,Do);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(ol,W,Q),X=f(Ul,t.txSentry,f(Yo,oT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(uB,U(f(Qi,oT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Py(x.model),txSentry:O}),Po(M([f(il,oT,x.cmd),F]))))}return L(t,Do);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(_u,si,f(JA,Z,r))}return L(ci,Do)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(tB,re,t.tradeCaches);if("Nothing"===ae.$)return f(oB,pa(f(ll,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Do));var ie=ae.a,x=f(iT,ne,ie);return L(D(t,{tradeCaches:l(aB,re,x.tradeCache,t.tradeCaches)}),f(il,lT(re),x.cmd));case"NoOp":return L(t,Do);default:var N=e.a;f(cl,"test",N);return L(t,Do)}}),cB=r(function(e,t){return f(iB,t,my(e))}),fB=Ge("txIn",XE),lB=je("txOut",Ua),dB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},hB=function(e){return{$:"EventSentryMsg",a:e}},pB=function(e){var t=f(cm,hB,Xh(e)),r=t.a,n=t.b;return x({dataFetchState:l(QS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Zd,"tradeCache init","processing",dB(e),0)]))},gB=function(e){return{$:"InitialNumTradesFetched",a:e}},vB=function(e){return f(LS,e.factory,gB)},yB=function(e){var t=pB(e),r=t.a,n=t.b,a=t.c;return x(r,Po(M([n,vB(r)])),a)},mB=function(e){return{$:"TxSentryMsg",a:e}},bB={align:ul,label:"noWeb3Provider",mainParagraphs:M([M([fl("No web3 provider detected. Is "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(" or some other web3 provider installed and unlocked?")])]),noticeType:xg},CB={$:"TopLeft"},EB={align:CB,label:"screenToSmall",mainParagraphs:M([M([fl("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:xg},SB={align:ul,label:"wrongWeb3Network",mainParagraphs:M([M([fl("Make sure your wallet is set to a compatible network.")]),M([fl(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:$g},TB={$:"NoneDetected"},wB=function(e){return{$:"OnlyNetwork",a:e}},IB=function(e){return f(Bo,Xh,Mg(e))},AB={$:"ETCMain"},BB={$:"ETCTest"},kB={$:"Expanse"},NB={$:"Kovan"},RB={$:"Mainnet"},$B=function(e){return{$:"Private",a:e}},_B={$:"Rinkeby"},LB={$:"Ropsten"},xB={$:"RskMain"},PB={$:"RskTest"},DB=function(e){switch(e){case 1:return RB;case 2:return kB;case 3:return LB;case 4:return _B;case 30:return xB;case 31:return PB;case 42:return NB;case 41:return AB;case 62:return BB;default:return $B(e)}},UB=n(function(e,t,r){var n=e.a,a=e.b;return Tl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:cp})}),OB=n(function(e,t,n){var a=e.networkId?wB(DB(e.networkId)):TB,i=f(Bo,function(e){return l(UB,L(lB,fB),mB,e)},IB(a)),o=e.width<1024?si(EB):ci,u=f(xa,yB,ro),s=function(){return R(a,TB)?si(bB):"Nothing"===Mg(a).$?si(SB):ci}(),c=qC(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ay(f(Bi,r(function(e,t){return f(Qi,lT(e),t)}),g)),y=Po(f(Bi,r(function(e,t){return f(il,lT(e),t)}),p)),m=f(uB,v,f(cB,t,{key:n,screenWidth:e.width,submodel:sT,time:Vl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),Po(M([y,C])))}),MB=Oe,FB=MB(yr),VB=function(e){return FB},KB=function(e){return{$:"Refresh",a:e}},HB=r(function(e,t){return{$:"Every",a:e,b:t}}),jB=r(function(e,t){return{processes:t,taggers:e}}),qB=xp(f(jB,cp,cp)),GB=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(bS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),zB=Ne,YB=r(function(e,t){var r=e.a,n=e.b,a=f(fp,r,t);if("Nothing"===a.$)return l(xl,r,M([n]),t);var i=a.a;return l(xl,r,f(ka,n,i),t)}),WB=Be,JB=r(function(e,t){return{$:"Zone",a:e,b:t}}),QB=ca,XB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=WB(f(QB,n,f(Sp,e,n)));return f(Kp,function(t){return l(XB,e,a,l(xl,n,t,r))},i)}return xp(r)}),ZB=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 x(n,a,f(Kp,function(e){return i},zB(t)))}),u=l(Ra,YB,cp,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(xl,e,r,i),o)}),d=p(GB,s,c,o,u,i,x(yr,cp,xp(gr))),h=d.a,g=d.b,v=d.c;return f(Kp,function(e){return xp(f(jB,u,e))},f(Kp,function(t){return l(XB,e,h,g)},v))}),ek=function(e){return we(function(t){t(Se(e(Date.now())))})}(Vl),tk=n(function(e,t,r){var n=f(fp,t,r.taggers);if("Nothing"===n.$)return xp(r);var a=n.a,i=function(t){return Gp(f(xa,function(r){return f(Ep,e,r(t))},a))};return f(Kp,function(e){return xp(r)},f(Kp,i,ek))}),rk=r(function(e,t){var r=t.a,n=t.b;return f(HB,r,f(Da,e,n))});pn.Time=Pe(qB,ZB,tk,0,rk);var nk=Ue("Time"),ak=r(function(e,t){return nk(f(HB,e,t))}),ik=function(e){return f(ak,2e3,KB)},ok=function(e){return FB},uk=function(e){return{$:"DecryptionFinished",a:e}},sk=Ge("decryptionFinished",XE),ck=Ge("encryptionFinished",XE),fk=function(e){return{$:"EncryptionFinished",a:e}},lk=function(e){return{$:"Refresh",a:e}},dk=function(e){return MB(M([f(ak,3e3,lk),ck(fk),sk(function(e){return yE(uk(e))})]))},hk=yn,pk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return FB;case"CreateModel":t.a;return f(hk,Uy,ik());case"TradeModel":t.a;return f(hk,Fy,dk());case"MarketplaceModel":t.a;return f(hk,fT,ok());default:t.a;return f(hk,oT,VB())}},gk=Ge("userPubkeyResult",XE),vk=Ge("walletSentryPort",XE),yk={$:"CheckForNewTrades"},mk={$:"UpdateTradePhases"},bk=function(e){return MB(M([f(ak,5e3,function(e){return yk}),f(ak,3e3,function(e){return mk})]))},Ck=function(e){return{$:"Tick",a:e}},Ek=function(e){return{$:"UserPubkeySet",a:e}},Sk=function(e){return{$:"WalletStatus",a:e}},Tk=function(e){return f(ll,"Error decoding JS walletSentry: "+e,ci)},wk=function(e){return{$:"ErrorDecoding",a:e}},Ik=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Ak=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Oh,"ref",zC),f(Oh,"txHash",AA(cS))),Bk=function(e){var t=f(Gh,Ak,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Ik,r.ref,li(a))}return f(Ik,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return wk("Error decoding tx data")},kk=function(e){var t=e.a;return f(hk,t.tagger,t.inPort(Bk))},Nk=f(Oi,DB,zC),Rk=gu(f(zo,rd,f(zo,$d("Failure decoding stringy int"),au(DB)))),$k=QE(M([Rk,Nk])),_k=r(function(e,t){return{account:e,networkId:t}}),Lk=l(Mi,_k,f(Oh,"account",AA(rS)),f(Oh,"networkId",$k)),xk=n(function(e,t,r){var n=f(Gh,Lk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),Pk=function(e){var t=f(zo,Tk,f(zo,pa,uT));return MB(U(M([f(ak,1e3,Ck),vk(f(xk,t,Sk)),f(xc,FB,f(Bo,kk,e.txSentry)),gk(Ek),MB(f(Bi,r(function(e,t){return f(hk,lT(e),t)}),f(xa,bk,e.tradeCaches)))]),M([pk(e)])))},Dk=function(e){return{$:"LinkClicked",a:e}},Uk=function(e){return{$:"UrlChanged",a:e}},Ok=n(function(e,t,r){return d(hA,e/255,t/255,r/255,1)}),Mk=l(Ok,10,33,108),Fk={$:"Generic"},Vk=Fk,Kk=r(function(e,t){return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),e)),wT(M([t])))}),Hk=function(e){return{$:"Fill",a:e}},jk=Hk(1),qk=Hi,Gk=function(e){return{$:"Px",a:e}},zk=Gk,Yk=ZT(8),Wk=function(e){return f(yA,Yk,l(vA,"bg-"+mA(e),"background-color",e))},Jk=f(Kk,M([ET(jk),yT(zk(150)),Wk(Mk)]),qk),Qk=function(e){return{$:"GotoRoute",a:e}},Xk={$:"Active"},Zk={$:"Important"},eN={$:"Normal"},tN=l(pA,1,1,1),rN=ZT(2),nN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),aN=r(function(e,t){return R(e,t)?f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e)):f(yA,rN,h(nN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),iN=ZT(21),oN=r(function(e,t){return{$:"Class",a:e,b:t}}),uN=f(oN,iN,RT.cursorPointer),sN=ZT(17),cN=function(e){return f(yA,sN,l(jI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},fN=function(e){return{$:"Normal",a:e}},lN=An,dN=r(function(e,t){return f(lN,e,fN(t))}),hN=function(e){return f(dN,"click",Fi(e))},pN=f(Da,ST,hN),gN=ZT(13),vN=f(oN,gN,RT.textSemiBold),yN=ZT(4),mN=function(e){return{$:"FontSize",a:e}},bN=function(e){return f(yA,yN,mN(e))},CN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([cN(4),Wk(l(pA,0,0,1))]);default:return M([cN(4),Wk(l(pA,.9,0,0))])}}();return f(Kk,U(M([f(aN,23,12),bN(22),vN,bA(tN),uN,pN(t)]),n),fl(e))}),EN=l(Ok,244,0,103),SN=function(e){return{$:"AlignX",a:e}},TN={$:"CenterX"},wN=SN(TN),IN=ZT(3),AN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),BN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),kN=function(e){return f(yA,IN,l(AN,f(BN,e,e),e,e))},NN=function(e){return{$:"Describe",a:e}},RN={$:"Paragraph"},$N=r(function(e,t){return d(fA,HT,Vk,f(ka,NN(RN),f(ka,ET(jk),f(ka,kN(5),e))),wT(t))}),_N=f(oN,gN,RT.bold),LN=f(Kk,M([bN(29),bA(tN),_N,wN,uN,pN(Qk(Gv))]),f($N,yr,M([fl("DAI"),f(Kk,M([bA(EN)]),fl("Hard"))]))),xN={$:"Right"},PN=SN(xN),DN={$:"AsColumn"},UN=DN,ON=r(function(e,t){return d(fA,UN,Vk,f(ka,lA(RT.contentTop+" "+RT.contentLeft),f(ka,yT(bT),f(ka,ET(bT),e))),wT(t))}),MN={$:"AsRow"},FN=MN,VN=r(function(e,t){return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY),f(ka,ET(bT),f(ka,yT(bT),e))),wT(t))}),KN=function(e){return f(VN,M([ET(jk),kN(30),f(aN,30,17)]),M([l(CN,"Browse Offers",Qk(zv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Xk}return eN}()),l(CN,"Create a New Offer",Qk(qv),function(){return"CreateModel"===e.submodel.$?Xk:eN}()),function(){var t=Gd(e.wallet);if("Just"===t.$){var r=t.a;return l(CN,"My Trades",Qk(jv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Xk:eN}return eN}())}return l(CN,"Connect to Wallet",cT,Zk)}(),f(ON,M([PN,kN(0),f(aN,8,0)]),M([LN]))]))},HN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},jN=function(e){return ml(e)},qN=function(e){return f(ml,function(e){return gb(e.parameters)},OS(e))},GN={$:"BurnWindow"},zN={$:"FiatPrice"},YN={$:"Margin"},WN={$:"Offer"},JN={$:"PaymentWindow"},QN=function(e){return{$:"AlignY",a:e}},XN={$:"CenterY"},ZN=QN(XN),eR=ZT(20),tR=f(oN,eR,RT.clip),rR=Hk,nR=function(e){return f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e))},aR=r(function(e,t){return f(Kk,M([ET(rR(e)),yT(zk(60)),tR,Wk(tN)]),f(Kk,M([nR(12),ZN,ET(jk)]),t))}),iR=function(e){switch(e.$){case"Phase":return 1;case"Expires":return 2;case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},oR=function(e){return{$:"JustImage",a:e}},uR=oR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),sR=dT("alt"),cR=function(e){return f(dT,"src",rt(e))},fR=r(function(e,t){var r=t.src,n=t.description,a=f(ml,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(fA,AT,Vk,f(ka,lA(RT.imageContainer),e),wT(M([d(fA,AT,TT("img"),U(M([ST(cR(r)),ST(sR(n))]),a),wT(yr))])))}),lR=r(function(e,t){if("None"===t.$)return qk;var r=t.a;return f(fR,e,r)}),dR=oR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),hR=function(e){return{$:"ChangeSort",a:e}},pR=f(oN,gN,RT.textMedium),gR=function(e){return f(Kk,M([pR,bN(17)]),fl(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},vR=r(function(e,t){return f(VN,M([kN(5),uN,pN(hR(e))]),M([gR(e),function(){if("Just"===t.$){var e=t.a;return f(Kk,M([ZN]),f(lR,M([ET(zk(8))]),function(){return"Ascending"===e.$?uR:dR}()))}return qk}()]))}),yR=r(function(e,t){return f(aR,iR(t),f(vR,t,e))}),mR=r(function(e,t){return f(VN,M([ET(jk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(yR,r,t)},t))}),bR=l(Ok,150,150,150),CR=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},ER=r(function(e,t){return f(ts,e.amount,t.amount)}),SR=n(function(e,t,r){return f(e,r,t)}),TR=function(e){var t=e.a;return(R(e.b,Lo)?Ua:SR)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(TR,L(Av,Lo),e,t):l(SR,Ku,CR(e.state.phase),CR(t.state.phase))});case"Expires":return r(function(e,t){return f(hv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Sv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(ER,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(xc,ma,l(zd,r(function(e,t){return f(Ku,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(hv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(hv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},wR=l(Ok,233,237,242),IR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),AR=function(e){return f(Kk,M([ET(jk),yT(jk),tR]),f($N,M([bN(12)]),M([fl(e.info)])))},BR=function(e){return f(xc,qk,f(Bo,AR,Ql(e)))},kR=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"}},NR=function(e){return{$:"TimeLeft",a:e}},RR=function(e){return{$:"TimeUp",a:e}},$R=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 Vl(0)}}),_R=r(function(e,t){return Vl(jd(e)-jd(t))}),LR=r(function(e,t){var r=f($R,t.state.phase,t),n=f(_R,e,t.state.phaseStartTime),a=f(_R,r,n);return jd(a)>0?NR(L(a,r)):RR(r)}),xR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},PR=l(pA,0,0,0),DR=l(Ok,51,183,2),UR=function(e){var t=ju(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Qo(n));return n+(function(){if(a){return f(ru,a+1,f(Zo,1,mw(r)))}return""}()+"%")},OR=r(function(e,t){return oR({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"}()})}),MR=n(function(e,t,r){return f(lR,f(ka,yT(zk(34)),e),f(OR,t,r))}),FR=r(function(e,t){var r=UR(t);if("0%"===r)return f(Kk,M([bN(16)]),fl("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?DR:EN;return f(VN,M([kN(4)]),M([l(MR,yr,a,si(i)),f(Kk,M([bA(o),bN(16)]),fl(n))]))}),VR=oR,KR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(xl,r,n,t)}),cp,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,VR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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","₫")]))),HR=function(e){return f(xc,"",f(Bo,Qa,f(fp,e,KR)))},jR=function(e){return Qo(e)<=3?e:jR(f(Td,3,e))+","+f(ou,3,e)},qR=function(e){return jR(Sd(e))},GR=function(e){return U(HR(e.fiatType),qR(e.amount))},zR=hA,YR=function(e){var t=function(){var t=f(fp,e.fiatType,KR);if("Nothing"===t.$)return qk;var r=t.a,n=(r.a,r.b);return f(lR,M([yT(zk(26))]),n)}();return f(VN,M([kN(4)]),M([t,f(Kk,M([bA(d(zR,0,0,0,.5)),pR,ET(zk(50))]),fl(e.fiatType)),fl(GR(e))]))},WR=function(e){return jd(e)<0},JR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),QR=function(e){var t=vg(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(JR,aC(t),aC(r),aC(n),aC(a))}(f(xc,L(qu(0),qu(0)),f(Ts,n,qu(60))))}(f(xc,L(qu(0),qu(0)),f(Ts,r,qu(3600))))}(f(xc,L(qu(0),qu(0)),f(Ts,t,qu(86400))))},XR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!WR(a)){var u=r(function(e,t){return U(l(Rs,2,P("0"),Ni(e)),t)}),s=jd(a)>0?i:o,c=QR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(VN,U(M([kN(5)]),e),M([f(Kk,U(M([bA(h)]),t),fl(f(u,c.days,"d"))),f(Kk,U(M([bA(d)]),t),fl(f(u,c.hours,"h"))),f(Kk,U(M([bA(s)]),t),fl(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Vl(0);e=p,t=g,n=v,a=y}}),ZR={$:"Behind"},e$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),t$=function(e){return f(e$,ZR,e)},r$=r(function(e,t){var r=sv(200*e),n=200-r,a=f(Kk,M([ET(rR(n))]),qk),i=M([yT(zk(3)),cN(20)]),o=f(Kk,U(i,M([ET(rR(r)),Wk(t)])),qk),u=f(Kk,U(i,M([ET(jk),Wk(wR)])),qk);return f(VN,M([ET(jk),t$(u)]),M([o,a]))}),n$=l(pA,1,1,0),a$=r(function(e,t){return jd(e)/jd(t)}),i$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(a$,o,u),c=(f(Kk,M([wN]),d(XR,yr,yr,L(a,i),o)),s<.1?EN:s<.2?n$:DR);return f(ON,U(M([kN(5)]),e),M([d(XR,M([wN]),t,L(a,i),o),f(r$,1-s,c)]))}),o$=function(e){var t=wd(jl(e)),r=f(Xl,".",t);if(!r.b)return t;if(r.b.b){cl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(ru,3,t);case 1:return f(ru,4,f(xc,t,f(Bo,mw,f(Bo,function(e){return e/100},f(Bo,Ka,f(Bo,sv,f(Bo,ti(100),Bd(t))))))));default:var n=r.a;return f(xc,f(ru,n,t),f(Bo,Ni,f(Bo,sv,Bd(t))))}},u$=n(function(e,t,r){return f(aR,iR(t),function(){switch(t.$){case"Phase":return fl(xR(r.state.phase));case"Expires":if("Open"===r.state.phase.$){var n=f(LR,e,r);if("TimeLeft"===n.$){var a=n.a,i=f(a$,a.a,a.b)<.05?EN:PR;return d(i$,M([ET(jk)]),M([bN(16)]),L(i,wR),a)}var o=n.a;return d(i$,M([ET(jk)]),M([bN(16)]),L(EN,wR),L(Vl(0),o))}return qk;case"Offer":return f(VN,M([kN(5)]),M([fl(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(o$(r.parameters.tradeAmount)+" ")+kR(r.factory))]));case"FiatPrice":return YR(r.terms.price);case"Margin":var u=R(r.parameters.initiatorRole,fo);return f(xc,qk,f(Bo,FR(u),r.derived.margin));case"PaymentWindow":var s=function(){return"Seller"===r.parameters.initiatorRole.$?EN:DR}(),c=_(jd(r.parameters.autoabortInterval),216e5)<0?s:PR;return d(XR,yr,yr,L(c,wR),r.parameters.autoabortInterval);default:var s=function(){return"Seller"===r.parameters.initiatorRole.$?DR:EN}(),c=_(jd(r.parameters.autoabortInterval),216e5)<0?s:PR;return d(XR,yr,yr,L(c,wR),r.parameters.autoreleaseInterval)}}())}),s$=n(function(e,t,r){return f(ON,M([ET(jk),kN(1),Wk(wR),uN,pN(f(IR,r.factory,r.id))]),M([f(VN,M([ET(jk),kN(1)]),f(xa,function(t){return l(u$,e,t,r)},t)),f(aR,1,BR(r.terms.paymentMethods))]))}),c$=Er,f$=ZT(28),l$=function(e){return f(yA,f$,l(vA,"bc-"+mA(e),"border-color",e))},d$=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),h$=function(e){return f(yA,iA,h(d$,"b-"+Ni(e),e,e,e,e))},p$=a(function(e,t,r,n){return f(ON,M([ET(jk),h$(2),cN(8),l$(bR),kN(2),Wk(bR),tR]),f(xa,f(s$,e,r),f(c$,TR(t.orderBy),n)))}),g$=a(function(e,t,r,n){return f(ON,M([ET(jk),yT(jk),kN(5)]),M([f(mR,t.orderBy,r),d(p$,e,t,r,n)]))}),v$=n(function(e,t,r){var n=ay(f(xa,function(e){return f(jN,HN(r),qN(e))},t));return R(n,yr)?qk:f(Yi,Ko,d(g$,e,r.tradeTable,M([xo,WN,zN,YN,JN,GN]),n))}),y$=r(function(e,t){return f(Kk,M([cN(4),Wk(d(zR,0,0,1,.1)),bA(l(Ok,16,7,234)),bN(e),vN,f(aN,15,13)]),fl(dl(t)))}),m$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),b$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(yA,rN,h(nN,"p-"+Ni(t),t,t,t,t)):f(yA,rN,h(nN,d(m$,t,r,n,a),t,r,n,a))},C$=function(e){return function(){var t=Gd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?qk:f(VN,M([kN(10),b$({bottom:20,left:20,right:20,top:10})]),M([f(Kk,M([bN(24),vN]),fl("Trade History for User")),f(y$,18,e.agentAddress)]))},E$=function(e){return{$:"FiltersMsg",a:e}},S$=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},T$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),w$=xI,I$={$:"Left"},A$=SN(I$),B$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(fA,UN,TT("label"),e,wT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(fA,AT,Vk,a,wT(M([i])));switch(n.$){case"Above":return d(fA,UN,TT("label"),e,wT(M([o,r])));case"Below":return d(fA,UN,TT("label"),e,wT(M([r,o])));case"OnRight":return d(fA,FN,TT("label"),e,wT(M([r,o])));default:return d(fA,FN,TT("label"),e,wT(M([o,r])))}}),k$=function(e){return{$:"Label",a:e}},N$={$:"NoAttribute"},R$=function(e){if("HiddenLabel"===e.$){var t=e.a;return NN(k$(t))}return N$},$$=function(e){return"HiddenLabel"===e.$},_$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return hu("No key matched");var n=r.a;return Fi(n)},r=f(du,t,f(Oh,"key",pu));return ST(f(dN,"keyup",r))},L$=function(e){return f(Nn,"tabIndex",Ni(e))},x$=f(Da,ST,L$),P$={$:"LivePolite"},D$=NN(P$),U$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([$$(r)?N$:kN(6),ST(hN(i(!a))),D$,_$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),x$(0),uN,A$,ET(jk)]),e);return l(B$,o,r,d(fA,AT,Vk,M([ST(f(w$,"role","checkbox")),ST(f(w$,"aria-checked",a?"true":"false")),R$(r),ZN,yT(jk),ET(bT)]),wT(M([n(a)]))))}),O$=Br,M$=function(e){return e*O$/180},F$=ZT(26),V$=function(e){return{$:"MoveY",a:e}},K$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),H$=function(e){return f(K$,F$,V$(-e))},j$=ZT(24),q$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),G$=function(e){return f(K$,j$,f(q$,x(0,0,1),e))},z$=ZT(19),Y$=function(e){return Cd(M([e.inset?"box-inset":"box-",mw(e.offset.a)+"px",mw(e.offset.b)+"px",mw(e.blur)+"px",mw(e.size)+"px",mA(e.color)]))},W$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(yA,z$,l(jI,Y$(t),"box-shadow",Cw(t)))},J$=r(function(e,t){return f(yA,iA,h(d$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Q$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?h$(r):f(J$,n,r):f(yA,iA,h(d$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},X$=ZT(12),Z$=f(oN,X$,RT.textCenter),e_=l(pA,1,1,1),t_=function(e){return f(Kk,M([lA("focusable"),ET(zk(14)),yT(zk(14)),bA(e_),ZN,bN(9),Z$,cN(3),l$(e?l(pA,59/255,.6,252/255):l(pA,211/255,211/255,211/255)),W$({blur:1,color:e?d(zR,238/255,238/255,238/255,0):l(pA,238/255,238/255,238/255),offset:L(0,0),size:1}),Wk(e?l(pA,59/255,.6,252/255):e_),h$(e?0:1)]),e?f(Kk,M([l$(e_),yT(zk(6)),ET(zk(9)),G$(M$(-45)),wN,ZN,H$(1),Q$({bottom:2,left:2,right:0,top:0})]),qk):qk)},r_=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),n_={$:"OnRight"},a_=r_(n_),i_=r(function(e,t){return f(U$,yr,{checked:t.checked,icon:t_,label:f(a_,yr,fl(t.label)),onChange:f(T$,e,t.label)})}),o_={$:"Top"},u_=QN(o_),s_=function(e){return f(ON,M([kN(15),u_]),M([f(Kk,M([bN(28),pR]),fl(S$(e.type_))),f(ON,M([kN(5)]),f(xa,i_(e.type_),e.options))]))},c_=function(e){return f(VN,M([kN(20)]),f(xa,s_,e))},f_={$:"NoneFound"},l_={$:"AllFetched"},d_={$:"FetchingTrades"},h_={$:"QueryingNumTrades"},p_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return h_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?d_:l_}return f_},g_={$:"InFront"},v_=function(e){return f(e$,g_,e)},y_=r(function(e,t){var r=function(e){return f(Kk,M([bN(20),vN,bA(bR),wN]),fl(e))},n=f(Eh,Ja(f_),f(xa,p_,e))?M([r("No trades found.")]):f(xa,r,qC(f(xa,function(e){switch(p_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),v_(f(ON,M([kN(5),A$]),n))]),f(Kk,M([wN]),f(Yi,E$,c_(t.filters))))}),m_=n(function(e,t,r){return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),f(aN,30,20)]),M([C$(r),f(y_,t,r),l(v$,e,t,r)]))}),b_=function(e){return{$:"ShowCurrencyDropdown",a:e}},C_={$:"AbortCreate"},E_=function(e){return{$:"AppCmd",a:e}},S_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),T_=function(e){return f(xa,function(e){return M([f(Kk,M([bA(EN)]),fl("Caution! ")),fl(e)])},qC(M([R(f(hv,e.autoreleaseInterval,Vl(12e5)),ba)?si(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."}()):ci,R(f(hv,e.autoabortInterval,Vl(36e5)),ba)?si(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.'}()):ci])))},w_=l(pA,0,0,1),I_=function(e){return f(Kk,M([b$({bottom:5,left:5,right:5,top:0}),pN(e),cN(30),Wk(d(zR,1,1,1,.4)),h$(1),l$(d(zR,0,0,0,.3)),uN,bN(14)]),f(Kk,M([bA(d(zR,0,0,0,.7))]),fl("x")))},A_=Bn,B_=A_,k_=ST,N_=r(function(e,t){return f(Kk,M([t$(f(Kk,M([Wk(e),k_(f(B_,"position","fixed")),k_(f(B_,"z-index","1000")),k_(f(B_,"top","0")),k_(f(B_,"left","0")),k_(f(B_,"width","100%")),k_(f(B_,"height","100%"))]),qk)),ET(jk),yT(jk)]),t)}),R_=r(function(e,t){return{$:"Max",a:e,b:t}}),$_=r(function(e,t){return f(R_,e,t)}),__=n(function(e,t,r){return l(Pa,N_,d(zR,0,0,.3,.6),f(Kk,U(M([wN,ZN,ET(f($_,500,bT)),Wk(tN),cN(8),v_(f(Kk,M([PN,u_]),I_(r)))]),e),t))}),L_=r(function(e,t){if("Nothing"===t.$)return qk;var r=t.a;return f(Kk,U(M([cN(5),l$(l(pA,.9,0,0)),h$(1),Wk(l(pA,1,.4,.4)),nR(5),wN,ZN,ET(f($_,200,bT)),bN(14)]),e),f($N,yr,M([fl(r)])))}),x_={$:"Above"},P_=function(e){return f(e$,x_,e)},D_=r(function(e,t){return f(Kk,M([cN(4),f(aN,25,17),bN(18),vN,Wk(wR),P_(f(L_,M([H$(5)]),t))]),fl(e))}),U_=a(function(e,t,r,n){return d(hA,e/255,t/255,r/255,n)}),O_=d(U_,1,31,52,.64),M_=ZT(32),F_={$:"Active"},V_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),K_=$n,H_=r(function(e,t){switch(t.$){case"NoAttribute":return N$;case"Describe":var r=t.a;return NN(r);case"AlignX":var n=t.a;return SN(n);case"AlignY":var a=t.a;return QN(a);case"Width":var n=t.a;return CT(n);case"Height":var n=t.a;return vT(n);case"Class":var n=t.a,a=t.b;return f(oN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(yA,i,o);case"Nearby":var u=t.a,s=t.b;return f(e$,u,f(zi,e,s));case"Attr":var c=t.a;return ST(f(K_,e,c));default:var l=t.a,d=t.b;return f(K$,l,d)}}),j_=function(e){return f(H_,zg,e)},q_=r(function(e,t){var r=t.a,n=t.b,a=j_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(rA,n,o));default:return L(r,n)}}),G_=function(e){var t=l(Ra,q_,L(yr,sA),e),r=t.a,n=t.b;return f(ka,qI(n),r)},z_=function(e){return f(yA,M_,f(V_,F_,G_(e)))},Y_=ZT(33),W_={$:"Hover"},J_=function(e){return f(yA,Y_,f(V_,W_,G_(e)))},Q_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Kk,M([cN(4),uN,pN(n),f(aN,25,17),bA(t),bN(18),vN,Wk(a),z_(M([Wk(o)])),J_(M([Wk(i)]))]),fl(r))}),X_=r(function(e,t){return d(Q_,x(d(zR,1,0,0,1),d(zR,1,0,0,.8),d(zR,1,0,0,.6)),tN,e,t)}),Z_=function(e){return N_(d(zR,0,0,.3,.6))(f(ON,M([kN(10),wN,ZN,Wk(d(zR,0,0,0,.5)),cN(8),nR(20)]),f(xa,function(e){return f($N,M([wN,ZN,bN(20),vN,bA(tN),Z$]),M([e]))},e)))},eL=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+kA(t)}e.a;return"https://kovan.etherscan.io/tx/"+kA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+kA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+kA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+kA(t)}}),tL={$:"Bottom"},rL=QN(tL),nL=lA(RT.underline),aL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(fl(o$(Lb(a))),f(X_,"Yes, I definitely want to open this trade.",l(S_,r,n,a)))}return L(fl("??"),f(D_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(__,yr,f(ON,M([kN(20),nR(20),wN,yT(jk),Z$]),M([f(Kk,M([bN(26),vN,wN,ZN]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,ZN]),f(xa,$N(M([wN,bN(18),pR,bA(O_)])),U(T_(n),U(M([M([fl("You will deposit "),i,fl(" "+kR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([fl("This ususally requires two Metamask signatures. Your "+kR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Kk,M([rL,wN]),o)])),C_);case"ApproveNeedsSig":var u=e.a;return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),Z_(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","ApproveMining",0)))]),Z_(M([fl("Mining the initial approve transaction..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction on Etherscan"),url:f(eL,eo(u),s)}),fl("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),Z_(M([fl("Waiting for user signature for the create call."),fl("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","CreateMining",0)))]),Z_(M([fl("Mining the final create call..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction on Etherscan"),url:f(eL,r,s)}),fl("You will be redirected when it's mined.")])))}}),iL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return qk;var r=t.a;return f(aL,r,e)},oL=function(e){return{$:"TradeAmountChanged",a:e}},uL=dT("id"),sL=k_(uL("inputError")),cL=l(Ok,109,127,138),fL=oR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),lL=function(e){return f(lR,f(ka,yT(zk(26)),e),fL)},dL=function(e){return f(VN,M([kN(4)]),M([lL(yr),f(Kk,M([bN(24),pR,bA(cL)]),fl(kR(e)))]))},hL=function(e){return{$:"HiddenLabel",a:e}},pL=hL,gL=dT("type"),vL=function(e){return L(e,!0)},yL=function(e){return{$:"MayStopPropagation",a:e}},mL=r(function(e,t){return f(lN,e,yL(t))}),bL=r(function(e,t){return l(La,Oh,t,e)}),CL=f(bL,M(["target","value"]),pu),EL=function(e){return f(mL,"input",f(Oi,vL,f(Oi,e,CL)))},SL=ZT(0),TL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),wL=function(e){var t=function(e){return 1-e}(f(Tc,1,f(ei,0,e)));return f(yA,SL,f(TL,"transparency-"+dw(t),t))},IL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),AL=f(Da,ST,w$("autocomplete")),BL=l(pA,136/255,138/255,133/255),kL=l(pA,186/255,189/255,182/255),NL=f(aN,12,12),RL=M([NL,cN(3),l$(kL),Wk(e_),h$(1),kN(3),ET(jk)]),$L=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},_L=function(e){return f(Ch,$L,e)?N$:lA("focusable")},LL=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},xL=ye,PL=r(function(e,t){return f(kn,e,xL(t))}),DL=PL("spellcheck"),UL=f(Da,ST,DL),OL=W,ML=ZT(47),FL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(OL(e))),o=(i-1)*t+f(xc,0,f(Bo,a,r))+f(xc,0,f(Bo,a,n));return f(yA,ML,l(jI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),VL=dT("value"),KL=f(Da,ST,VL),HL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(fw,"width",n)?L(r,n):L(f(ka,e,r),f(TS,"width",n));case"Height":e.a;return f(fw,"height",n)?L(r,n):L(f(ka,e,r),f(TS,"height",n));case"Describe":e.a;return f(fw,"described",n)?L(r,n):L(f(ka,e,r),f(TS,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(fw,"align-x",n)?L(r,n):L(f(ka,e,r),f(TS,"align-x",n));case"AlignY":return f(fw,"align-y",n)?L(r,n):L(f(ka,e,r),f(TS,"align-y",n));default:return f(fw,"transform",n)?L(r,n):L(f(ka,e,r),f(TS,"transform",n))}}),L(yr,sm),e).a},jL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,HL(e))}),qL=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}},GL=f(Da,Gi,ms),zL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([ST(EL(n.onChange))]),o=U(RL,t),u=f(jL,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(ml,LL,o),c=f(jL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(jL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(jL,o,function(e){return"Nearby"===e.$})),p=f(ml,f(Da,ns,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([KL(n.text),ST(gL(a)),UL(e.spellchecked),lA(RT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return N$;var r=t.a;return AL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(qL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(IL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(IL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(xc,5,c);return x("textarea",U(M([UL(e.spellchecked),lA(RT.inputMultiline),f(xc,N$,f(Bo,AL,e.autofill)),function(){if("Nothing"===u.$)return N$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return b$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?N$:s.a?d(FL,n.text,v,u,g):N$}()]),h),M([GL(RI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(fA,AT,Vk,f(ka,ET(jk),ay(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([v_(f(Kk,f(ka,NL,U(s,U(M([bA(BL),lA(RT.noTextSelection+" "+RT.passPointerEvents),l$(d(zR,0,0,0,0)),Wk(d(zR,0,0,0,0)),yT(jk),ET(jk),wL(""===n.text?1:0)]),r))),a))])}()]))),wT(M([d(fA,AT,TT(v),ay(M([M([_L(t),R$(n.label)]),y,i])),wT(m))])));return l(B$,f(ka,f(oN,iN,RT.cursorText),f(ka,$$(n.label)?N$:kN(5),f(ka,D$,u))),n.label,b)}),YL=zL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),WL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(YL,M([ET(jk),yT(zk(40)),h$(0)]),{label:pL(r),onChange:i,placeholder:n,text:a});return f(VN,U(M([kN(5)]),e),qC(M([f(Bo,Kk(M([A$])),o),si(s),f(Bo,Kk(M([PN])),u)])))}),JL={$:"Below"},QL=function(e){return f(e$,JL,e)},XL=function(e){return f(K$,F$,V$(e))},ZL=n(function(e,t,r){return p(WL,M([ET(zk(150)),pR,bN(24),QL(f(L_,M([sL,XL(5)]),r))]),L(ci,si(f(Kk,M([pN(E_(d(Zd,"click","misclick","dai symbol in dai input",0)))]),dL(e)))),"dai input",ci,t,oL)}),ex=Kk(M([l$(wR),Q$({bottom:2,left:0,right:0,top:0})])),tx=r(function(e,t){return f(ON,M([kN(10)]),M([f(Kk,M([bN(17),vN]),fl(e)),t]))}),rx=r(function(e,t){return ex(f(tx,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(ZL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),nx=function(e){return f(xc,HE,Mg(e))},ax=function(e){var t=function(){var t=vd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+o$(f(Gl,r,100))+" "+kR(nx(e.wallet))+"."}return"There is a 1% fee."}();return f(VN,M([wN,f(aN,20,10),Wk(l(Ok,10,33,108)),cN(8),kN(5),pN(E_(d(Zd,"click","misclick","fee notify element",0)))]),M([f(Kk,M([bN(18),bA(l(Ok,0,226,255)),vN]),fl(t)),f(Kk,M([bN(17),bA(tN),pR]),fl("We only collect this fee when trades resolve successfully."))]))},ix=function(e){return{$:"FiatAmountChanged",a:e}},ox=function(e){return{$:"FiatTypeChanged",a:e}},ux=r(function(e,t){return l(bS,n(function(t,r,n){return f(e,t,r)?l(xl,t,r,n):n}),cp,t)}),sx=function(e){return f(ux,r(function(t,r){return f(Qg,e,t)}),KR)},cx=oR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),fx=function(e){return f(lR,M([yT(zk(26))]),f(xc,cx,f(Bo,fu,f(fp,e,KR))))},lx=function(e){return k_(f(mL,"click",Fi(L(e,!0))))},dx=GL,hx=function(e){return{$:"AppendProperty",a:e}},px=r(function(e,t){return hx(e+":"+t)}),gx=r(function(e,t){return f(px,e,t.value)}),vx=gx("cursor"),yx={$:"Compatible"},mx={cursor:yx,value:"default"},bx=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Cx=function(e){return{$:"PseudoClassSelector",a:e}},Ex=function(e){return bx(Cx(e))}("hover"),Sx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),Tx=Sx,wx=Tx,Ix=wx("span"),Ax=r(function(e,t){return f(kn,et(e),rt(t))}),Bx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),kx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),Nx=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),Rx=r(function(e,t){return t<>>32-e}),$x=function(e){var t=e.hash?e.seed^f(Nx,461845907,f(Rx,15,f(Nx,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(Nx,2246822507,r^r>>>16),a=f(Nx,3266489909,n^n>>>13);return(a^a>>>16)>>>0},_x=r(function(e,t){return f(Nx,5,f(Rx,13,e^f(Nx,461845907,f(Rx,15,f(Nx,3432918353,t)))))+3864292196}),Lx=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},VP=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+"]"}},KP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,VP,r)));case"UniversalSelectorSequence":var r=e.a;return Iu(r)?"*":f(Ri,"",f(xa,VP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,VP,r)))}},HP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([FP(t),KP(r)]))},jP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,KP(t),f(xa,HP,r)),i=f(Ri,"",M([f(xc,"",f(Bo,MP,n))]));return f(oc,f(Ri," ",f(ml,f(Da,ns,_d),a)),i)},qP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,jP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,OP(a),"\n",e,"}"]))}),GP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(qP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,_P,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,DP,qP(" ")),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"}},zP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(ml,f(Da,ns,_d),M([NP(t),f(Ri,"\n",f(xa,xP,r)),f(Ri,"\n",f(xa,PP,n)),f(Ri,"\n\n",f(xa,GP,a))])))},YP=function(e){return zP(kP(IP(e)))},WP=function(e){return f(Ri,"\n\n",f(xa,YP,e))},JP=function(e){return{$:"Snippet",a:e}},QP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),XP=function(e){return{$:"StyleBlockDeclaration",a:e}},ZP=r(function(e,t){var r=l(Xx,t,yr,ci);return JP(M([XP(l(QP,r,yr,e))]))}),eD=function(e){return Iu(e)?"unstyled":f(Is,P("_"),Ps(f(xx,15739,WP(AS(Px(AS(f(ZP,e,fP(yr)))))))))},tD=function(e){var t=eD(e),r=f(Ax,"className",hl(t));return l(Bx,r,e,t)},rD=a(function(e,t,r,n){return f(e,f(ka,tD(t),r),n)}),nD=function(e){return{$:"Unstyled",a:e}},aD=function(e){return nD(Tw(e))},iD=aD,oD=r(function(e,t){return f(Tn,e,Xe(t))}),uD=function(e){return En(Xe(e))},sD=r(function(e,t){var r=e.b,n=e.c;return Iu(r)?t:l(xl,n,r,t)}),cD=function(e){return e.a},fD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,sD,i,s),p=l(Ra,lD,L(yr,h),c),g=p.a,v=p.b,o=l(JT,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,sD,i,s),m=l(Ra,lD,L(yr,h),c),g=m.a,v=m.b,o=d(uD,y,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,sD,i,s),b=l(Ra,fD,L(yr,h),c),g=b.a,v=b.b,o=l(WT,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,sD,i,s),C=l(Ra,fD,L(yr,h),c),g=C.a,v=C.b,o=d(oD,y,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),lD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,sD,n,o),c=l(Ra,lD,L(yr,s),u),h=c.a,p=c.b,a=l(JT,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,sD,n,o),v=l(Ra,lD,L(yr,s),u),h=v.a,p=v.b,a=d(uD,g,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,sD,n,o),y=l(Ra,fD,L(yr,s),u),h=y.a,p=y.b,a=l(WT,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,sD,n,o),m=l(Ra,fD,L(yr,s),u),h=m.a,p=m.b,a=d(oD,g,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p)}}),dD=r(function(e,t){return h(Nl,kl,e,t,Rl,Rl)}),hD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(_d(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),pD=function(e){var t=f(hD,ci,e);if("Nothing"===t.$)return cp;var r=t.a,n=r.a,a=r.b;return f(dD,n,a)},gD=function(e){return{$:"ClassSelector",a:e}},vD=function(e){var t=e.a,r=e.b;return f(ZP,r,fP(M([gD(t)])))},yD=function(e){return WP(AS(Px(f(xa,vD,Ia(e)))))},mD=function(e){return l(JT,"style",yr,AS(Tw(yD(e))))},bD=n(function(e,t,r){var n=f(xa,cD,t),a=pD(t),i=l(Ra,lD,L(yr,a),r),o=i.a,u=i.b,s=mD(u);return l(JT,e,n,f(ka,s,$a(o)))}),CD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),ED=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(CD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),SD=r(function(e,t){return L(f(ED,"_",t),mD(e))}),TD=n(function(e,t,r){var n=f(xa,cD,t),a=pD(t),i=l(Ra,fD,L(yr,a),r),o=i.a,u=i.b,s=f(SD,u,o);return l(WT,e,n,f(ka,s,$a(o)))}),wD=a(function(e,t,r,n){var a=f(xa,cD,r),i=pD(r),o=l(Ra,fD,L(yr,i),n),u=o.a,s=o.b,c=f(SD,s,u);return d(oD,e,t,a,f(ka,c,$a(u)))}),ID=a(function(e,t,r,n){var a=f(xa,cD,r),i=pD(r),o=l(Ra,lD,L(yr,i),n),u=o.a,s=o.b,c=mD(s);return d(uD,e,t,a,f(ka,c,$a(u)))}),AD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(bD,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(ID,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(TD,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(wD,a,t,r,n)}},BD=AD,kD=function(e){return dx(BD(d(rD,Ix,M([Ex(M([vx(mx)]))]),yr,M([iD(e)]))))},ND=J,RD=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),$D=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),_D=function(e){return l(La,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 si(h(RD,n,a,i,o,u))}return ci}(),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 si(l($D,a,t,i))}return ci}())}),L(ci,ci),e)},LD=r(function(e,t){var r=_D(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),e))),wT(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?si(b$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),U(e,M([h]))))),wT(t))}var p=-s/2,g=-u/2;return d(fA,AT,Vk,e,wT(M([d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ST(f(B_,"margin",mw(p)+"px "+mw(g)+"px")),f(ka,ST(f(B_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,ST(f(B_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(yA,IN,l(AN,o,u,s)),yr))))),wT(t))])))}),xD=i(function(e,t,r,n,a){var i=f(YL,M([ET(zk(80)),yT(zk(40)),bN(24),pR,l$(wR),lx(r)]),{label:pL("currency type"),onChange:f(zo,ND,n),placeholder:ci,text:t}),o=f(fp,t,KR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return qk;r.b;return f(LD,M([ET(zk(350)),l$(PR),h$(1),Wk(tN),nR(10),wN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(VN,M([ET(zk(80)),kN(9),f(aN,0,5),lx(n(t)),J_(M([Wk(l(pA,.8,.8,1))]))]),M([f(lR,M([yT(zk(26))]),a),f(Kk,M([bN(16),vN]),kD(t))]))},Ia(sx(t))))}return qk}();return f(VN,M([kN(4),QL(u)]),M([f(Kk,M([pN(a)]),fx(t)),i]))}),PD=i(function(e,t,r,n,a){var i=E_(d(Zd,"click","misclick","currency flag",0)),o=f(Kk,M([pN(E_(d(Zd,"click","misclick","currency symbol",0)))]),fl(HR(e))),u=f(Kk,M([QL(f(L_,M([sL,XL(5)]),a))]),h(xD,r,e,b_(!0),ox,i));return p(WL,M([ET(zk(250)),pR,bN(24),QL(f(L_,M([sL,XL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,ix)}),DD=function(e){return ex(f(tx,"For fiat",h(PD,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},UD=function(e){return{$:"ChangeRole",a:e}},OD=d(U_,1,31,52,.13),MD=r(function(e,t){var r=M([bN(24),pR,uN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([bA(OD)]))):L(U(r,M([bA(OD)])),r)}(),a=n.a,i=n.b;return f(VN,M([kN(20)]),M([f(Kk,U(M([pN(UD(lo))]),i),fl("Sell "+e)),f(Kk,U(M([pN(UD(fo))]),a),fl("Buy "+e))]))}),FD=r(function(e,t){return f(tx,"Trade Type",f(MD,kR(e),t.inputs.userRole))}),VD=W$({blur:20,color:d(U_,0,0,0,.04),offset:L(0,3),size:0}),KD=f(oN,IN,RT.spaceEvenly),HD=function(e){var t=nx(e.wallet);return f(ON,M([ET(jk),kN(20),Wk(tN),cN(5),nR(20),VD]),M([f(VN,M([ET(jk),KD]),M([f(FD,t,e),f(rx,t,e),DD(e)])),ax(e)]))},jD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),qD={$:"Web3Connect"},GD=function(e){return f(Kk,M([wN]),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(X_,"Open Trade",f(jD,n,r))}t.b;return f(D_,"Unsupported Network",ci)}t.a;return f(X_,"Connect to Wallet",qD)}())},zD=function(e){return{$:"AutoabortIntervalChanged",a:e}},YD=function(e){return{$:"ChangePaymentMethodText",a:e}},WD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),JD=WD,QD=function(e){return f(JD,M([bA(d(zR,0,0,0,.2))]),function(){return fl("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")}())},XD={$:"TextArea"},ZD=r(function(e,t){return l(zL,{autofill:ci,spellchecked:t.spellcheck,type_:XD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),eU=n(function(e,t,r){var n=f(Kk,M([bN(22),vN]),fl("Payment Method")),a=f(ZD,M([ET(jk),yT(zk(150)),Wk(d(U_,155,203,255,.2)),h$(0)]),{label:pL("payment method"),onChange:YD,placeholder:""===r?si(QD(t)):ci,spellcheck:!0,text:r});return f(ON,M([kN(20),b$({bottom:15,left:45,right:45,top:0}),ET(jk),P_(f(L_,M([sL,XL(30),nR(10),bN(20),ET(zk(400))]),e))]),M([n,a]))}),tU=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."},rU=a(function(e,t,r,n){var a=l(Rs,e,P("0"),Ni(n));return f(Kk,M([bN(22),bA(t)]),fl(U(a,r)))}),nU=function(e){return jd(e)<0?Vl(0):e},aU=n(function(e,t,n){var a=r(function(e,r){return f(ON,M([kN(4)]),M([f(Kk,M([nR(4),uN,pN(n(f(mb,t,e)))]),f(lR,M([yT(zk(10))]),dR)),r,f(Kk,M([nR(4),uN,pN(n(function(e){return jd(e)?e:Vl(3e5)}(nU(f(_R,t,e)))))]),f(lR,M([yT(zk(10))]),uR))]))}),i=QR(t);return f(VN,M([KD,kN(10)]),M([f(a,Vl(864e5),d(rU,3,e," days",i.days)),f(a,Vl(36e5),d(rU,2,e," hours",i.hours)),f(a,Vl(3e5),d(rU,2,e," min",i.min))]))}),iU=o(function(e,t,r,n,a,i){var o=f(Kk,M([Wk(d(U_,155,203,255,.2)),cN(5),nR(15),P_(f(L_,M([sL]),a))]),l(aU,PR,n,i)),u=f(VN,M([kN(30)]),M([f(lR,M([yT(zk(40)),pN(E_(d(Zd,"click","misclick","symbol for "+t,0)))]),e),f(Kk,M([bN(22),vN]),fl(t))])),s=f($N,M([bN(17),pR,bA(O_)]),M([fl(r)]));return f(ON,M([ET(jk),cN(10),Wk(l(Ok,237,237,237)),kN(2)]),f(xa,Kk(M([Wk(tN),f(aN,45,18),ET(jk)])),M([u,f(VN,M([ET(jk),kN(25),Wk(tN)]),M([o,s]))])))}),oU=oR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),uU=f(oN,eR,RT.clipX),sU=f(oN,eR,RT.clipY),cU=i(function(e,t,r,n,a){return f(ON,M([kN(15),cN(8),uU,sU,Wk(tN)]),M([p(iU,oU,"Payment Window",tU(a),r,n,zD),l(eU,t,a,e)]))}),fU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},lU=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."},dU=oR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),hU=n(function(e,t,r){return f(Kk,M([cN(8),uU,sU,Wk(tN)]),p(iU,dU,"Burn/Release Window",lU(r),e,t,fU))}),pU=function(e){return{$:"AutorecallIntervalChanged",a:e}},gU=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."},vU=oR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),yU=n(function(e,t,r){return f(Kk,M([cN(8),Wk(tN),uU,sU]),p(iU,vU,"Open Window",gU(r),e,t,pU))}),mU=function(e){return f(ON,M([ET(jk),kN(20)]),M([l(yU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(cU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(hU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},bU=function(e){return f(ON,M([ET(f($_,1e3,jk)),wN,kN(20),b$({bottom:30,left:40,right:40,top:0}),pN(b_(!1)),v_(iL(e))]),M([HD(e),mU(e),GD(e.wallet)]))},CU=As(Fm(8226)),EU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),SU=r(function(e,t){return l(Ra,ka,t,e)}),TU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(SU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),wU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(SU,f(lc,e%r,t),l(TU,yr,e/r|0,t))):f(lc,e,t)}),IU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(fw,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(TS,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),AU=function(e){return d(IU,Ua,sm,e,yr)},BU=r(function(e,t){return f(Kk,M([ET(jk),v_(f(VN,M([kN(3),ET(rR(100)),ET(t),tR]),f(EU,f(Kk,M([bA(d(zR,0,0,0,.1)),bN(14)]),fl(CU)),f(xa,f(Da,Kk(M([bA(d(zR,0,0,0,.2))])),fl),f(wU,100,(e?$a:Ua)(AU(f(xa,f(zo,fu,Qa),Ia(KR)))))))))]),fl(" "))}),kU=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e))))),wT(M([n])))}),NU=lA(RT.italic),RU=function(){var e=f(Da,Kk(M([bA(l(pA,.8,.2,.2))])),fl),t=f(Da,Kk(M([_N])),fl);return f(ON,M([ET(jk),yT(jk),Wk(tN),cN(6),kN(50),W$({blur:20,color:d(U_,0,0,0,.1),offset:L(0,3),size:0}),cN(10),nR(20)]),M([f(BU,!1,jk),f(ON,M([wN,ET(f($_,700,jk)),kN(20)]),M([f($N,M([bN(70),_N,wN,Z$]),M([fl("DAI"),e("Hard")])),f(VN,M([bN(30),vN,wN,Z$,NU]),M([fl("The "),e("Global"),fl(", "),e("Unkillable"),fl(" Crypto Gateway")]))])),f(VN,M([Wk(bR),kN(2),wN,u_,ET(jk)]),M([f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([kN(60),PN]),M([f(Kk,M([bN(40),vN,wN]),fl("Want to learn more?")),f(ON,M([kN(15)]),M([f(kU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(w_),bA(tN),_N,bN(24),wN]),{label:f($N,M([Z$]),M([fl("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"}),f(kU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(w_),bA(tN),_N,bN(24),wN]),{label:f($N,M([Z$]),M([fl("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})]))]))),f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([A$,kN(60)]),M([f(Kk,M([bN(40),vN,wN]),fl("Ready to try it out?")),f(ON,M([kN(10),ET(zk(400)),wN]),M([f($N,M([bN(24),ET(jk)]),M([fl("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f($N,M([bN(24),ET(jk)]),M([fl("Then follow the links at the top of this page to browse "),t("Sell Offers"),fl(", browse "),t("Buy Offers"),fl(", or "),t("Create Your Own Offer"),fl(".")]))]))])))])),f(Kk,M([rL,ET(jk)]),f(BU,!0,jk))]))}(),$U=r(function(e,t){return f(Ay,f(zo,function(e){return e.type_},Ja(e)),t)}),_U=function(e){return{$:"ShowCurrencyDropdown",a:e}},LU=r(function(e,t){return ml(t(e))}),xU=a(function(e,t,r,n){var a=l(LU,e,n.filterFunc,ay(f(xa,qN,r)));return R(a,yr)?qk:f(Yi,Rv,d(g$,e,n.tradeTable,U(t?M([xo]):yr,M([Av,WN,zN,YN,JN,GN])),a))}),PU=function(e){return{$:"FiltersMsg",a:e}},DU={$:"ApplyInputs"},UU=PL("disabled"),OU=function(e){return{$:"MayPreventDefault",a:e}},MU=r(function(e,t){return f(lN,e,OU(t))}),FU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):hu("Not the enter key")},n=f(du,r,f(Oh,"key",pu));return ST(f(MU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),VU=function(e){return f(FU,"Enter",e)},KU={$:"Button"},HU=r(function(e,t){var r=t.onPress,n=t.label;return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY+" "+RT.seButton+" "+RT.noTextSelection),f(ka,uN,f(ka,_L(e),f(ka,NN(KU),f(ka,ST(L$(0)),function(){if("Nothing"===r.$)return f(ka,ST(UU(!0)),e);var t=r.a;return f(ka,pN(t),f(ka,VU(t),e))}()))))))),wT(M([n])))}),jU=f(HU,M([Wk(w_),nR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,ZN]),fl("Apply")),onPress:si(DU)}),qU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(yA,sN,l(jI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},GU=function(e){return f(dN,"focus",Fi(e))},zU=f(Da,ST,GU),YU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([zU(e(!0)),lx(e(!0))])}();return f(VN,U(e,M([yT(zk(40)),W$({blur:20,color:d(U_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Kk,M([Wk(wR),yT(zk(40)),qU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Kk,M([ZN,f(aN,10,0)]),r)),f(YL,U(s,U(t,M([ET(zk(100)),yT(zk(40)),l$(wR),qU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),Q$({bottom:1,left:0,right:1,top:1})]))),{label:pL(n),onChange:u,placeholder:i,text:a})]))}),WU=function(e){return{$:"MaxDaiChanged",a:e}},JU=function(e){return{$:"MinDaiChanged",a:e}},QU=r(function(e,t){return f(ON,M([ET(jk),kN(8)]),M([f(Kk,M([bN(17),pR]),fl(e)),t]))}),XU=ZT(25),ZU=function(e){return{$:"MoveX",a:e}},eO=function(e){return f(K$,XU,ZU(-e))},tO={$:"OnLeft"},rO=function(e){return f(e$,tO,e)},nO=n(function(e,t,r){var n=lL(M([ZN])),a=f(VN,M([kN(8),ZN,ET(zk(60))]),M([n,f(Kk,M([bN(16),ZN]),fl("max"))])),i=f(VN,M([kN(8),ZN,ET(zk(60))]),M([n,f(Kk,M([bN(16),ZN]),fl("min"))]));return f(QU,"Dai Range",f(ON,M([kN(5),ET(zk(200))]),M([v(YU,M([rO(f(L_,M([eO(5),ET(zk(200))]),r.minDai))]),M([zU(_U(!1))]),i,"min Dai",e,ci,ci,JU),v(YU,M([rO(f(L_,M([eO(5),ET(zk(200))]),r.maxDai))]),M([zU(_U(!1))]),a,"max Dai",t,ci,ci,WU)])))}),aO=function(e){var t=f(fp,e,KR);if("Nothing"===t.$)return fl("*");var r=t.a,n=r.b;return f(lR,M([yT(zk(26))]),n)},iO=function(e){return{$:"AppCmd",a:e}},oO=function(e){return{$:"FiatTypeInputChanged",a:e}},uO=n(function(e,t,r){var n=iO(d(Zd,"click","misclick","currency flag",0)),a=aO(t);f(VN,M([kN(8),ZN,ET(zk(60))]),M([a,f(Kk,M([bN(16),ZN]),fl("max"))])),f(VN,M([kN(8),ZN,ET(zk(60))]),M([a,f(Kk,M([bN(16),ZN]),fl("min"))]));return f(Kk,M([u_,ET(zk(120))]),f(QU,"Fiat Type",h(xD,e,t,_U(!0),oO,n)))}),sO={$:"AddSearchTerm"},cO=function(e){return{$:"PaymentMethodInputChanged",a:e}},fO=f(Oh,"keyCode",zC),lO=function(e){return f(dN,"keyup",f(du,function(t){return 13===t?Fi(e):hu(Ni(t))},fO))},dO=function(e){return f(QU,"Search Payment Methods",f(YL,M([u_,ET(zk(250)),yT(zk(40)),l$(wR),W$({blur:20,color:d(U_,233,237,242,.05),offset:L(0,3),size:0}),k_(lO(sO))]),{label:pL("payment methods search"),onChange:cO,placeholder:ci,text:e}))},hO={$:"ResetSearch"},pO=f(HU,M([Wk(w_),nR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,ZN]),fl("Reset")),onPress:si(hO)}),gO=function(e){return{$:"RemoveTerm",a:e}},vO=function(e){return f(Kk,M([nR(3),u_,uN,pN(gO(e)),bN(10),bA(EN)]),fl("x"))},yO=function(e){if(e.b){var t=e;return f(VN,M([ET(jk),nR(10),kN(10)]),f(xa,function(e){return f(VN,M([Wk(d(U_,16,7,234,.2)),cN(5),nR(4),kN(3)]),M([fl(e),vO(e)]))},t))}return qk},mO=i(function(e,t,r,n,a){var i=function(e){return f(Kk,M([bN(20),vN,bA(bR),wN]),fl(e))},o=f(Eh,Ja(f_),f(xa,p_,e))?M([i("No trades found.")]):f(xa,i,qC(f(xa,function(e){switch(p_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),v_(f(ON,M([kN(5),A$]),o))]),f(VN,M([wN,kN(50)]),M([f(Yi,PU,c_(t)),f(VN,M([ET(bT),kN(10)]),M([f(Kk,M([ET(bT),u_]),l(nO,r.minDai,r.maxDai,n)),f(Kk,M([ET(bT),u_]),l(uO,a,r.fiatType,n)),f(ON,M([ET(bT),u_,kN(5)]),M([dO(r.paymentMethod),yO(r.paymentMethodTerms)])),f(QU," ",f(ON,M([kN(5),ET(bT)]),M([jU,pO])))]))])))}),bO=n(function(e,t,r){var n=function(){return 1!==f(xc,0,f(Bo,function(e){return f(MS,function(e){return e.checked},e.options)},f($U,Eo,r.filters)))}();return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),pN(_U(!1)),nR(30)]),M([f(VN,M([ET(jk),kN(10)]),M([h(mO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),d(xU,e,n,t,r)]))}),CO=function(e){return{$:"MessageInputChanged",a:e}},EO={$:"MessageSubmit"},SO=function(e){return f(ON,M([ET(jk),kN(10)]),M([f(ZD,M([ET(jk),yT(zk(100))]),{label:pL("messageInput"),onChange:CO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(HU,M([wN,bN(24)]),{label:fl("Submit"),onPress:si(EO)})]))},TO=f(oN,eR,RT.scrollbarsY),wO=r(function(e,t){return f(Kk,M([yT(jk),ET(jk)]),f(Kk,U(M([k_(f(B_,"position","absolute")),k_(f(B_,"top","0")),k_(f(B_,"right","0")),k_(f(B_,"bottom","0")),k_(f(B_,"left","0")),TO]),e),t))}),IO=l(Ok,200,205,210),AO=n(function(e,t,r){var n=M([PN,Wk(w_),bA(tN),qU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([A$,Wk(IO),bA(PR),qU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Kk,U(M([nR(7)]),u),f($N,yr,M([fl(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(pA,0,0,1),tN,"Initiator opened the trade"));case"Recalled":return si(x(l(pA,0,0,1),tN,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(ru,8,dl(t))+"..";return si(x(l(pA,1,0,1),tN,r+" committed to the trade"));case"Aborted":return si(x(l(pA,1,0,0),tN,"Buyer aborted the trade"));case"Claimed":return si(x(l(pA,0,1,0),tN,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(pA,0,0,1),tN,"Seller released the "+kR(e)+" and closed the contract"));default:return si(x(l(pA,0,0,1),tN,"Seller burned the "+kR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return qk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Kk,M([cN(3),h$(1),l$(l(pA,1,0,1)),wN,Wk(h)]),f($N,M([bA(p)]),M([fl(g)])))}),BO=n(function(e,t,r){if(r.b){var n=r;return f(wO,M([ET(jk),yT(jk),cN(5),h$(1),l$(PR),nR(10)]),f(ON,M([ET(jk),yT(jk),kN(10)]),f(xa,f(AO,e,t),n)))}return f(Kk,M([ET(jk),yT(jk),cN(5),h$(1),l$(PR),wN,bA(l(pA,.5,.5,.5)),NU]),fl("no messages found."))}),kO=Cr,NO=function(e){return f(ON,M([ET(jk),yT(jk),kN(10),h$(1),cN(5),nR(20)]),M([l(BO,e.trade.factory,e.userRole,f(kO,function(e){return e.blocknum},Sa(e.history))),SO(e)]))},RO=function(e){return f(Kk,M([Wk(tN),cN(8),VD,ET(jk),yT(jk)]),NO(e))},$O={$:"ToggleChat"},_O=function(e){if(e.showChatHistory){var t=f(xc,qk,f(Bo,RO,e.chatHistoryModel));return f(Kk,M([yT(jk),ET(zk(500)),nR(20),PN]),l(__,M([yT(jk),ET(jk)]),f(Yi,yE,t),$O))}return qk},LO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},xO=function(e){return GR(e)+" "+e.fiatType},PO={$:"AbortAction"},DO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),UO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return qk}if("LoadedTrade"!==t.b.$)return qk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=xO(n.terms.price),u=o$(Lb(i)),s=o$(n.parameters.tradeAmount)+" "+kR(n.factory),c=function(){return"Buyer"===LO(n.parameters).$?L(f(Kk,M([pR,bA(PR)]),fl("buyer")),M([fl("pay the seller "),f(Kk,M([bA(w_)]),fl(o)),fl(" in exchange for the "),f(Kk,M([bA(w_)]),fl(s)),fl(" held in this contract.")])):L(f(Kk,M([pR,bA(PR)]),fl("seller")),M([fl("accept "),f(Kk,M([bA(w_)]),fl(o)),fl(" from the buyer in exchange for the "),f(Kk,M([bA(w_)]),fl(s)),fl(" held in this contract.")]))}(),d=c.a,h=c.b;return l(__,yr,f(ON,M([kN(20),nR(20),wN,yT(jk),Z$]),M([f(Kk,M([bN(26),vN,wN,ZN]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,ZN]),f(xa,$N(M([wN,bN(18),pR,bA(O_)])),U(M([U(M([fl("You will deposit "),f(Kk,M([bA(w_)]),fl(u+" "+kR(n.factory))),fl(", thereby becoming the "),d,fl(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([fl("(This ususally requires two Metamask signatures. Your "+kR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Kk,M([rL,wN]),f(X_,"Yes, I definitely want to commit to this trade.",l(DO,n,a,i)))])),PO);case"ApproveNeedsSig":return Z_(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return Z_(M([fl("Mining the initial approve transaction..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction on Etherscan"),url:f(eL,n.factory,p)}),fl("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return Z_(M([fl("Waiting for user signature for the final commit call."),fl("(check Metamask!)"),fl("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return Z_(M([fl("Mining the final commit transaction..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction"),url:f(eL,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(__,yr,f(ON,M([kN(20),nR(20),wN,yT(jk),Z$]),M([f(Kk,M([bN(26),vN,wN,ZN]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,ZN]),f(xa,$N(M([wN,bN(18),pR,bA(O_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([fl('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 '+kR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([fl("Aborting will incur a small penalty on both parties, and refund the rest of the "+kR(n.factory)+".")])]);case"Release":return M([M([fl("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([fl("This will destroy the "+kR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Kk,M([rL,wN]),function(e){return f(X_,e,DE(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 "+kR(n.factory)+".";default:return"I understand. Burn the "+kR(n.factory)+"."}}()))])),PO);case"ActionNeedsSig":var g=r.a;return Z_(M([fl("Waiting for user signature for the "+OE(g)+" call."),fl("(check Metamask!)")]));default:var g=r.a,p=r.b;return qk}},OO=VN(M([ET(jk),Wk(tN),cN(5),nR(20),KD,VD])),MO=function(e){return f(VN,M([kN(8)]),M([f(lR,yr,fL),f(Kk,M([bN(24),pR]),fl(o$(e)))]))},FO=r(function(e,t){var r=f(Io,Ao(e),f(Bo,function(e){return e.address},Gd(t)));return f(tx,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"}(),MO(e.parameters.tradeAmount))}),VO=function(e){return f(VN,M([kN(5)]),M([fx(e.fiatType),f(Kk,M([bN(24),pR]),fl(xO(e)))]))},KO=function(e){return f(tx,"For Fiat",VO(e.terms.price))},HO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},jO=l(Ok,250,165,22),qO=l(Ok,255,0,0),GO=l(Ok,0,255,0),zO=oR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),YO=oR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),WO=oR({description:"released",src:"/DAIHard/static/img/released.svg"}),JO={$:"ToggleStatsModal"},QO=function(e){return f(kO,Ua,e)},XO=n(function(e,t,n){var a=ay(f(xa,function(e){return f(ml,function(e){return R(f(ko,e,n),si(t))},f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(fh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(fh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wl,amountReleased:Wl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,Vl,Ql(QO(f(US,function(e){return function(e){return e?si(e):ci}(jd(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}}),ZO=r(function(e,t){return d(Q_,x(d(zR,0,0,1,1),d(zR,0,0,1,.8),d(zR,0,0,1,.6)),tN,e,t)}),eM=function(e){return{$:"ViewUserHistory",a:e}},tM=f(JB,0,yr),rM=f(oN,gN,RT.textNormalWeight),nM=r(function(e,t){return Za(e/t)}),aM=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}}),iM=r(function(e,t){var r=e.a,n=e.b;return l(aM,r,f(nM,jd(t),6e4),n)}),oM=r(function(e,t){return f(_s,24,f(nM,f(iM,e,t),60))}),uM=r(function(e,t){return f(_s,1e3,jd(t))}),sM=r(function(e,t){return f(_s,60,f(iM,e,t))}),cM={$:"Apr"},fM={$:"Aug"},lM={$:"Dec"},dM={$:"Feb"},hM={$:"Jan"},pM={$:"Jul"},gM={$:"Jun"},vM={$:"Mar"},yM={$:"May"},mM={$:"Nov"},bM={$:"Oct"},CM={$:"Sep"},EM=function(e){var t=f(nM,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)}},SM=r(function(e,t){switch(EM(f(iM,e,t)).month){case 1:return hM;case 2:return dM;case 3:return vM;case 4:return cM;case 5:return yM;case 6:return gM;case 7:return pM;case 8:return fM;case 9:return CM;case 10:return bM;case 11:return mM;default:return lM}}),TM=r(function(e,t){return f(_s,60,f(nM,jd(t),1e3))}),wM={$:"Fri"},IM={$:"Mon"},AM={$:"Sat"},BM={$:"Sun"},kM={$:"Thu"},NM={$:"Tue"},RM={$:"Wed"},$M=r(function(e,t){switch(f(_s,7,f(nM,f(iM,e,t),1440))){case 0:return kM;case 1:return wM;case 2:return AM;case 3:return BM;case 4:return IM;case 5:return NM;default:return RM}}),_M=n(function(e,t,r){return e.toAmPm(f(oM,t,r))}),LM=r(function(e,t){return EM(f(iM,e,t)).day}),xM=LM,PM=M([BM,IM,NM,RM,kM,wM,AM]),DM=r(function(e,t){return function(e){return e.a}(f(xc,L(0,BM),Ql(f(ml,function(r){return R(r.b,f($M,e,t))},f(Bi,r(function(e,t){return L(e,t)}),PM)))))}),UM=function(e){return l(Ra,Na,0,e)},OM=r(function(e,t){return EM(f(iM,e,t)).year}),MM=function(e){return!f(_s,4,e)&&(!!f(_s,100,e)||!f(_s,400,e))},FM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return MM(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}}),VM=M([hM,dM,vM,cM,yM,gM,pM,fM,CM,bM,mM,lM]),KM=r(function(e,t){return f(xc,L(0,hM),Ql(f(ml,function(r){r.a;return R(r.b,f(SM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),VM))))}),HM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(KM,e,t))}),jM=r(function(e,t){var r=f(lc,f(HM,e,t)-1,VM);return UM(f(xa,FM(f(OM,e,t)),r))+f(xM,e,t)}),qM=r(function(e,t){return f(HM,e,t)/4|0}),GM=r(function(e,t){var r=Ni(t),n=e-Qo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),zM=function(e){return e?e<=12?e:e-12:12},YM=sv(315576e5),WM=r(function(e,t){return Vl(YM*f(OM,e,t))}),JM=r(function(e,t){var r=f(WM,e,t),n=f(DM,e,r);return 1+((f(jM,e,t)+n)/7|0)}),QM=r(function(e,t){return Ni(f(OM,e,t))}),XM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(HM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(HM,t,r));case"MonthFixed":return f(GM,2,f(HM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(SM,t,r));case"MonthNameFull":return e.toMonthName(f(SM,t,r));case"QuarterNumber":return Ni(1+f(qM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(qM,t,r));case"DayOfMonthNumber":return Ni(f(xM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(xM,t,r));case"DayOfMonthFixed":return f(GM,2,f(xM,t,r));case"DayOfYearNumber":return Ni(f(jM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(jM,t,r));case"DayOfYearFixed":return f(GM,3,f(jM,t,r));case"DayOfWeekNumber":return Ni(f(DM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(DM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f($M,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f($M,t,r));case"WeekOfYearNumber":return Ni(f(JM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(JM,t,r));case"WeekOfYearFixed":return f(GM,2,f(JM,t,r));case"YearNumberLastTwo":return f(ou,2,f(QM,t,r));case"YearNumber":return f(QM,t,r);case"AmPmUppercase":return ND(l(_M,e,t,r));case"AmPmLowercase":return sd(l(_M,e,t,r));case"HourMilitaryNumber":return Ni(f(oM,t,r));case"HourMilitaryFixed":return f(GM,2,f(oM,t,r));case"HourNumber":return Ni(zM(f(oM,t,r)));case"HourFixed":return f(GM,2,zM(f(oM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(oM,t,r));case"HourMilitaryFromOneFixed":return f(GM,2,1+f(oM,t,r));case"MinuteNumber":return Ni(f(sM,t,r));case"MinuteFixed":return f(GM,2,f(sM,t,r));case"SecondNumber":return Ni(f(TM,t,r));case"SecondFixed":return f(GM,2,f(TM,t,r));case"MillisecondNumber":return Ni(f(uM,t,r));case"MillisecondFixed":return f(GM,3,f(uM,t,r));default:return n.a}}),ZM=a(function(e,t,r,n){return f(Ri,"",f(xa,l(XM,e,r,n),t))}),eF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),tF=function(e){return e>11?"pm":"am"},rF=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"}},nF=function(e){switch(f(_s,100,e)){case 11:case 12:case 13:return"th";default:switch(f(_s,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},aF=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"}},iF=p(eF,rF,f(zo,rF,ru(3)),aF,f(zo,aF,ru(3)),tF,nF),oF=ZM(iF),uF={$:"MonthNameFull"},sF=uF,cF=function(e){return{$:"Text",a:e}},fF=cF,lF={$:"YearNumber"},dF=lF,hF=n(function(e,t,n){var a=r(function(e,t){return f(ON,M([bN(18),kN(6)]),M([f(Kk,M([_N]),fl(e)),f(Kk,M([rM]),fl(t))]))}),i=oF(M([sF,fF(", "),dF])),o=f(ON,M([kN(23),ET(jk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,tM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+o$(n.amountReleased)+" "+kR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+o$(n.amountBurned)+" "+kR(e)+" Burned")])),M([f(Kk,M([wN]),f(ZO,"View User History",eM(n.asRole)))])));return f(ON,M([cN(8),uU,sU,Wk(wR),kN(1),W$({blur:20,color:d(zR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Kk,M([ET(jk),Wk(tN),nR(17)]),f(y$,18,t)),f(Kk,M([ET(jk),Wk(tN),nR(17)]),o)]))}),pF=n(function(e,t,r){var n=l(XO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=HO(e.parameters.initiatorRole)+" Stats";return f(Kk,r?M([QL(f(Kk,M([XL(30),PN]),l(hF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(tx,a,f(VN,M([ET(jk),kN(20),uN,pN(JO)]),f(xa,VN(M([kN(5)])),M([M([f(lR,M([yT(zk(28))]),WO),f(Kk,M([bN(24),pR,bA(GO)]),fl(l(Rs,2,P("0"),Ni(n.numReleases))))]),M([f(lR,M([yT(zk(28))]),zO),f(Kk,M([bN(24),pR,bA(jO)]),fl(l(Rs,2,P("0"),Ni(n.numAborts))))]),M([f(lR,M([yT(zk(28))]),YO),f(Kk,M([bN(24),pR,bA(qO)]),fl(l(Rs,2,P("0"),Ni(n.numBurns))))])])))))}),gF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+dl(t)}e.a;return"https://kovan.etherscan.io/address/"+dl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+dl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+dl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+dl(t)}}),vF=n(function(e,t,r){return f(dA,e,{label:fl(dl(r)),url:f(gF,t,r)})}),yF=function(e){return f(tx,"Trade Status",f(ON,M([bN(24),pR,kN(8)]),M([fl(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(vF,M([bN(12),bA(w_),nL]),e.factory,e.creationInfo.address)])))},mF=i(function(e,t,r,n,a){return OO(M([yF(t),f(FO,t,r),KO(t),l(pF,t,n,a)]))}),bF=l(Ok,9,32,107),CF=oR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),EF=f(Kk,M([cN(4),uN,pN($O),nR(5),Wk(l(Ok,22,0,255))]),f(lR,M([ET(zk(42))]),CF)),SF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},TF=function(e){return f(ON,M([cN(12),Wk(wR),nR(15),kN(15)]),M([f(Kk,M([bN(24),vN,NU]),fl("Fiat Payment Method")),f($N,M([bN(18),yT(bT),Wk(tN),W$({blur:5,color:d(zR,0,0,0,.2),offset:L(-3,3),size:0}),cN(3),nR(5)]),M([f(xc,f(Kk,M([bA(OD),NU]),fl("No payment methods found.")),f(Bo,fl,f(Bo,function(e){return e.info},Ql(e))))]))]))},wF={$:"Active"},IF=function(e){return{$:"ExpandPhase",a:e}},AF=M([Wk(bF),bA(tN)]),BF=r(function(e,t){return{$:"Min",a:e,b:t}}),kF=r(function(e,t){return f(BF,e,t)}),NF=function(e){return M(e?[cN(12),u_,yT(f(kF,380,bT))]:[cN(12),wN])},RF=M([Wk(tN)]),$F=oR({description:"flame",src:"/DAIHard/static/img/flame.png"}),_F=r(function(e,t){return Hl(f(ds,jl(e),jl(t)))}),LF=r(function(e,t){return d(Q_,x(d(zR,1,.6,.2,1),d(zR,1,.6,.2,.8),d(zR,1,.6,.2,.6)),tN,e,t)}),xF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),PF=function(e){return{$:"ContractActionClicked",a:e}},DF={$:"Web3Connect"},UF=n(function(e,t,r){var n=Gd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(LR,e,t).$?qk:f(VN,M([kN(8)]),function(){var e=x(t.state.phase,f(Ao,t,a.address),f(ko,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,DE,f(ZO,"Remove and Refund this Trade",xE))])}break e}var r=(e.a,e.b,jl(hb(t.parameters)));return M([f(X_,"Deposit and Commit to Trade",l(xF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,PF,f(LF,"Abort Trade",bE)),f(Yi,PF,f(X_,"Confirm Payment",AE)),EF])}e.a,e.c.a;return M([EF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,PF,f(X_,"Burn it All!",IE)),f(Yi,PF,f(ZO,"Release Everything",PE)),EF])}e.a,e.c.a;return M([EF])}break e;default:break e}return yr}())}return f(X_,"Connect to Wallet",DF)}),OF={$:"Finished"},MF={$:"NotStarted"},FF=r(function(e,t){var r=L(CR(t),CR(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?MF:R(n,a)?wF:OF}),VF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),KF=r(function(e,t){return l(VF,yr,e,t)}),HF=a(function(e,t,r,n){var a=o$(f(fh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+kR(r.factory),i=o$(r.parameters.tradeAmount)+" "+kR(r.factory),o=f(VN,yr,f(KF,3,f(lR,M([yT(zk(18))]),$F))),u=f(Da,Kk(M([bA(l(pA,1,0,0))])),fl),s=R(e,r.state.phase),c=f(Io,ko(r),f(Bo,function(e){return e.address},Gd(n))),d=s?tN:PR,h=$N(M([bA(d),bN(18),vN])),p=xO(r.terms.price),g=s?l(Ok,0,226,255):l(Ok,16,7,234),v=f(Da,Kk(M([bA(g)])),fl),y=o$(r.parameters.buyerDeposit)+" "+kR(r.factory),m=r.parameters.abortPunishment,b=o$(m)+" "+kR(r.factory),C=o$(f(_F,r.parameters.buyerDeposit,m))+" "+kR(r.factory),E=o$(f(_F,r.parameters.tradeAmount,m))+" "+kR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([fl("Your "),u("burnable deposit"),fl(" of "),v(y),fl(" is now held in this contract, and your offer to buy "),v(i),fl(" for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Seller by depositing the full "),v(i),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),fl(" to you.")])])):f(xa,h,M([M([fl("Your offer to sell the "),v(i),fl(" held in this contract for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),fl(" of 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),fl(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([fl("You must now pay the Seller "),v(p),fl(" via the Fiat Payment Method, "),f(Kk,M([vN]),fl("and then click ")),u("Confirm Payment"),fl(" before the payment window runs out. Use the chat to coordinate.")]),M([fl("If you abort the trade, or do not confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to you).")]),M([fl("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),fl(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([fl("Work and communicate with the Buyer to receive "),v(p),fl(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to you, "),v(C),fl(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),fl(" will be released to you.")]),M([fl("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),fl(" In this case the "),v(a),fl(" will be lost to both parties.")]),M([fl("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([fl("So, have you recieved the "),v(p),fl("? If so, you can click "),v("Release Everything"),fl(".")]),M([fl("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),fl(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([fl("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([fl("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([fl("The Seller has deposited "),v(i),fl(" into this contract, and offers to sell it for "),v(p),fl(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("If the trade is successful, the combined "+kR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),fl(" within the payment window.")])])):f(xa,h,M([M([fl("The Buyer is offering to buy "),v(i),fl(" for "),v(p),fl(", and has deposited "),v(y),fl(" into this contract as a "),u("burnable deposit"),fl(". To become the Seller, deposit "),v(i),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("When you receive the "),v(p),fl(" from the Buyer, the combined "+kR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can receive "),v(p),fl(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([fl("During this phase, the Buyer is expected to transfer "),v(p),fl(" to the Seller, as described in Fiat Payment Method, "),f(Kk,M([vN]),fl("and ")),u("Confirm the Payment "),fl(" before the payment window runs out. This would move the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(" amount) will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([fl("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([fl("If the Seller can verify he has received the "),v(p),fl(", he will probably release the total balance of "),v(i),fl(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),fl(".")]),M([fl("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),fl(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(ON,M([ET(jk),yT(jk),nR(20),kN(30)]),M([f(VN,M([ET(jk)]),M([f(Kk,M([bN(24),vN,bA(g),A$]),fl(T))])),f(ON,M([ET(jk),ZN,kN(13)]),w),f(Kk,M([PN]),function(){switch(f(FF,r,e).$){case"Active":return l(UF,t,r,n);case"NotStarted":return f(Kk,M([bN(20),vN,NU,bA(bR)]),fl("Phase not yet started."));default:return f(Kk,M([bN(20),vN,NU]),fl("Phase no longer active."))}}())]))}),jF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},qF=oR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),GF=oR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),zF={$:"None"},YF=zF,WF=oR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),JF=function(e){switch(e.$){case"Open":return WF;case"Committed":return qF;case"Judgment":return GF;default:return YF}},QF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),XF=a(function(e,t,r,n){return d(QF,e,t,r,n)}),ZF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},eV=function(e){return function(e){return d(XF,e.red,e.green,e.blue,e.alpha)}(ZF(e))},tV=function(e){return{$:"Circle",a:e}},rV=tV,nV=d(QF,0,0,0,1),aV={$:"Flat"},iV={$:"Sharp"},oV=function(e){return{$:"Uniform",a:e}},uV=oV,sV={cap:aV,dashPattern:yr,dashPhase:0,fill:uV(nV),join:iV,thickness:2},cV=n(function(e,t,r){return D(sV,{dashPattern:e,fill:r,thickness:t})}),fV=cV(yr),lV={$:"Transparent"},dV=lV,hV=f(fV,0,dV),pV=r(function(e,t){return{$:"Shape",a:e,b:t}}),gV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},vV=function(e){return f(Da,gV,pV(e))},yV=function(e){return vV(L(e,hV))},mV=function(e){return L(-e.a,-e.b)},bV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),CV=r(function(e,t){return f(bV,mV(e(t)),t)}),EV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},SV=r(function(e,t){return{$:"Path",a:e,b:t}}),TV=kr,wV=Nr,IV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=wV(n),i=TV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},AV=function(e){return xa(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)})},BV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(AV,e,M([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),kV=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},NV=function(e){var t=RV(e.basic),r=EV(f(xa,IV(e),t)),n=r.a,a=r.b;return{toBottom:-f(xc,0,gI(a)),toLeft:-f(xc,0,gI(n)),toRight:f(xc,0,pI(n)),toTop:f(xc,0,pI(a))}},RV=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(BV,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(BV,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(BV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(AV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(SV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(AV,R(C,aV)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(BV,0,E);case"Group":var S=e.a;return f(AV,0,ay(f(xa,f(zo,NV,kV),S)));default:var T=e.b;return f(AV,0,kV(NV(T)))}},$V=function(e){var t=NV(e);return t.toTop+t.toBottom},_V=function(e){var t=NV(e);return L(-t.toLeft,t.toTop)},LV=function(e){var t=NV(e);return t.toLeft+t.toRight},xV=En("http://www.w3.org/2000/svg"),PV=xV("svg"),DV=Nn("height"),UV=Nn("version"),OV=Nn("width"),MV=xV("circle"),FV=xV("ellipse"),VV=xV("foreignObject"),KV=xV("g"),HV=xV("image"),jV=xV("polygon"),qV=xV("polyline"),GV=xV("rect"),zV=Tw,YV=xV("text"),WV=Nn("id"),JV=Nn("points"),QV=Nn("r"),XV=Nn("rx"),ZV=Nn("ry"),eK=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},tK=function(e){return{$:"Group",a:e}},rK=Nn("dominant-baseline"),nK=Nn("fill"),aK=Nn("fill-opacity"),iK=Nn("font-family"),oK=Nn("font-size"),uK=Nn("font-style"),sK=Nn("font-variant"),cK=Nn("font-weight"),fK=Nn("opacity"),lK=Nn("stroke"),dK=Nn("stroke-dasharray"),hK=Nn("stroke-dashoffset"),pK=Nn("stroke-linecap"),gK=Nn("stroke-linejoin"),vK=Nn("stroke-opacity"),yK=Nn("stroke-width"),mK=Nn("text-anchor"),bK=Nn("text-decoration"),CK=Nn("transform"),EK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},SK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},TK=n(function(e,t,r){return d(QF,e,t,r,1)}),wK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return sv(1e4*e)/100};return Cd(M(["rgba(",mw(i(t)),"%,",mw(i(r)),"%,",mw(i(n)),"%,",mw(function(e){return sv(1e3*e)/1e3}(a)),")"]))},IK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},AK=function(e){var t=IK(e),r=t.red,n=t.green,a=t.blue;return wK(l(TK,r,n,a))},BK=function(e){if("Uniform"===e.$){var t=e.a;return AK(t)}return"none"},kK=function(e){var t=IK(e),r=t.alpha;return mw(r)},NK=function(e){if("Uniform"===e.$){var t=e.a;return kK(t)}return"0"},RK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},$K=function(e){var t=mw(e.scale.b),r=mw(e.scale.a),n=mw(-e.rotation/2/O$*360),a=mw(-e.shift.b),i=mw(e.shift.a);return Cd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},_K=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([lK(BK(r.fill)),vK(NK(r.fill)),yK(mw(r.thickness)),pK(EK(r.cap)),gK(RK(r.join)),nK("none"),fK(mw(e.opacity)),CK($K(e)),hK(Ni(r.dashPhase)),dK(SK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([nK(BK(a)),aK(NK(a)),lK(BK(r.fill)),vK(NK(r.fill)),yK(mw(r.thickness)),pK(EK(r.cap)),gK(RK(r.join)),fK(mw(e.opacity)),CK($K(e)),hK(Ni(r.dashPhase)),dK(SK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([nK(BK(oV(o.color))),iK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),oK(Ni(o.size)),cK(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"}}()),uK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),sK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),bK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),mK("middle"),rK("middle"),CK($K(e))]);default:return M([CK($K(e))])}},LK=Nn("x"),xK=Nn("y"),PK=r(function(e,t){return M([OV(mw(e)),DV(mw(t)),LK(mw(-e/2)),xK(mw(-t/2))])}),DK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([mw(t),mw(-r)]))},e))},UK=dN,OK=r(function(e,t){return f(e,t.a,t.b)}),MK=function(e){return f(xa,OK(UK),e)},FK=function(e){e:for(;;){var t=f(xc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(qV,U(M([WV(t),JV(DK(i))]),U(_K(e),MK(e.handlers))),yr);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,U(M([WV(t),JV(DK(i))]),U(_K(e),MK(e.handlers))),yr);case"Circle":var c=s.a;return f(MV,U(M([WV(t),QV(mw(c))]),U(_K(e),MK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(FV,U(M([WV(t),XV(mw(d)),ZV(mw(h))]),U(_K(e),MK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(GV,U(M([WV(t),XV(mw(c)),ZV(mw(c))]),U(f(PK,p,g),U(_K(e),MK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(SV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(YV,U(M([WV(t)]),U(_K(e),MK(e.handlers))),M([zV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(HV,U(M([WV(t),eK(C)]),U(f(PK,p,g),U(_K(e),MK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(VV,U(M([WV(t)]),U(f(PK,p,g),U(_K(e),MK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(KV,f(ka,WV(t),U(_K(e),MK(e.handlers))),l(Ra,r(function(e,t){return f(ka,FK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:tK(M([w,I]))});e=v;continue e}}},VK=r(function(e,t){var r=e.a,n=e.b,a=mw(r),i=mw(n);return f(jT,yr,M([f(PV,M([OV(a),DV(i),UV("1.1")]),M([FK(t)]))]))}),KK=function(e){return f(VK,L(LV(e),$V(e)),f(CV,_V,e))},HK=r(function(e,t){var r=JF(e),n=function(){switch(t.$){case"NotStarted":return l(Ok,10,33,108);case"Active":return l(Ok,0,100,170);default:return l(Ok,1,129,104)}}(),a=dx(KK(f(yV,uV(eV(n)),rV(50))));return f(Kk,M([wN,v_(f(lR,M([wN,ZN,yT(zk(60))]),r))]),a)}),jK=function(e){var t=M([NU,vN,bN(20)]);switch(e.$){case"Active":return f(Kk,U(t,M([bA(EN)])),fl("Active"));case"NotStarted":return f(Kk,U(t,M([bA(bR)])),fl("Not Started"));default:return f(Kk,t,fl("Finished"))}},qK=n(function(e,t,r){var n=f(FF,t,e),a=function(){return"Active"===n.$?l(Ok,0,226,255):PR}(),i=f(Kk,M([bA(a),bN(20),vN,wN]),fl(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 qk;switch(n.$){case"NotStarted":return d(XR,M([wN]),M([bN(22),pR]),L(PR,wR),f($R,e,t));case"Active":var a=f(LR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(i$,M([wN]),M([bN(22),pR]),L(tN,wR),i)}return f(ON,M([wN,kN(10)]),M([f(Kk,M([wN]),fl(jF(e))),f(ZO,"Poke",DE(LE))]));default:return f(Kk,M([yT(zk(1))]),qk)}}();return f(ON,M([nR(20),kN(10),yT(jk)]),M([f(Kk,M([u_,wN]),i),f(Kk,M([yT(jk),wN]),f(Kk,M([ZN]),f(HK,e,n))),f(ON,M([kN(10),rL,wN]),M([f(Kk,M([wN]),jK(n)),o]))]))}),GK=o(function(e,t,r,n,a,i){var o=f(FF,r,t),u=f(Kk,M([nR(10),ET(jk),yT(jk)]),d(HF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Vl(0)}}(),c=l(qK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(_R,f(mb,r.state.phaseStartTime,s),i);default:Vl(0)}}(),f(Kk,M([yT(jk),ET(zk(1)),Wk(function(){return"Active"===o.$?l(pA,0,0,1):wR}())]),qk)),p=a?f(VN,U(NF(e),U(R(o,wF)?AF:RF,M([ET(jk)]))),M([c,h,u])):f(VN,U(NF(e),U(R(o,wF)?AF:RF,M([uN,pN(IF(t))]))),M([c]));return!e&&R(o,wF)?f(ON,M([ET(jk),kN(20),b$({bottom:20,left:0,right:0,top:0})]),M([p,TF(r.terms.paymentMethods)])):p}),zK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(VN,M([wN,cN(12),nR(30),kN(10),Wk(bF),bN(24),vN,bA(tN)]),M([fl("Trade "+SF(t.state.closedReason)),EF])):e?f(ON,M([ET(jk),kN(10)]),M([f(VN,M([ET(jk),yT(bT),kN(20)]),M([p(GK,e,Co,t,n,R(r,Co),a),p(GK,e,mo,t,n,R(r,mo),a),p(GK,e,bo,t,n,R(r,bo),a)])),TF(t.terms.paymentMethods)])):f(ON,M([ET(jk),yT(bT),kN(20)]),M([p(GK,e,Co,t,n,R(r,Co),a),p(GK,e,mo,t,n,R(r,mo),a),p(GK,e,bo,t,n,R(r,bo),a)]))}),YK=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(ON,M([ET(jk),yT(jk),kN(40)]),M([h(mF,t,i,n.wallet,r,n.showStatsModal),f(Kk,M([ET(jk),f(aN,40,0),kN(40)]),h(zK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Kk,M([wN,ZN,bN(30)]),fl("Loading trade info..."));default:return f(Kk,M([wN,ZN,bN(30)]),fl("Invalid trade"))}}(),M([_O(n),UO(n)]))}),WK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),JK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(RU,yr);case"CreateModel":var n=r.a;return L(f(Yi,Uy,bU(n)),yr);case"TradeModel":var a=r.a;return l(WK,Yi(Fy),xa(Yi(Fy)),d(YK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,fT,l(bO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,oT,l(m_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Kk,M([ET(jk),yT(jk),cN(10)]),n),a)}),QK=function(e){return{$:"DismissNotice",a:e}},XK=function(e){return f(K$,XU,ZU(e))},ZK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(pA,1,1,1):l(pA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Ok,100,200,255);case"Caution":return l(Ok,255,188,0);case"Error":return l(Ok,255,70,70);default:return l(Ok,200,200,200)}}(),o=f(Kk,M([PN,u_,H$(5),XK(5)]),I_(QK(t)));return f(Kk,M([Wk(i),cN(10),nR(8),ET(jk),h$(1),l$(d(zR,0,0,0,.15)),VD]),f(ON,M([kN(4),ET(jk)]),f(Bi,r(function(e,t){return f($N,M([ET(jk),bA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},eH=function(e){return R(e,yr)?yr:M([f(ON,M([eO(20),H$(20),kN(10),PN,rL,ET(zk(300)),bN(15)]),f(xa,ZK,f(ml,function(e){return R(e.b.align,ul)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(ON,M([XK(20),XL(100),kN(10),A$,u_,ET(zk(300)),bN(15)]),f(xa,ZK,f(ml,function(e){return R(e.b.align,CB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},tH=r(function(e,t){var r=f(JK,e,t),n=r.a,a=r.b;return L(f(ON,M([t$(Jk),v_(KN(t)),ET(jk),yT(jk),nR(30)]),M([f(Kk,M([yT(zk(50))]),qk),n])),U(a,eH(t.userNotices)))}),rH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),nH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),aH={$:"AllowHover"},iH={$:"Layout"},oH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(hA,155/255,203/255,1,1),offset:L(0,0),size:3})},uH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?oH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?aH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?iH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},sH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(AT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),AT);case"Text":var a=t.a;return $I(a);default:return $I("")}}),cH=n(function(e,t,r){var n=uH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?rH(n):nH(n)}();return f(sH,a,d(fA,AT,Vk,t,wT(M([r]))))}),fH=ZT(5),lH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),dH={$:"SansSerif"},hH=function(e){return{$:"Typeface",a:e}},pH=Y,gH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",pH(sd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",pH(sd(t)));default:var t=e.a.name;return f(Ri,"-",pH(sd(t)))}}())}),vH=function(){var e=M([hH("Open Sans"),hH("Helvetica"),hH("Verdana"),dH]);return M([f(yA,Yk,l(vA,"bg-color-"+mA(d(hA,1,1,1,0)),"background-color",d(hA,1,1,1,0))),f(yA,gA,l(vA,"font-color-"+mA(d(hA,0,0,0,1)),"color",d(hA,0,0,0,1))),f(yA,yN,mN(20)),f(yA,fH,f(lH,l(Ra,gH,"font-",e),e))])}(),yH=n(function(e,t,r){var n=e.options;return l(cH,n,f(ka,lA(f(Ri," ",M([RT.root,RT.any,RT.single]))),U(vH,t)),r)}),mH=yH({options:yr}),bH=function(e){return f(yA,fH,f(lH,l(Ra,gH,"ff-",e),e))},CH=dH,EH=hH,SH=function(e){return{body:M([function(){var t=f(tH,e.screenWidth,e),r=t.a,n=t.b,a=U(M([ET(jk),yT(jk),bH(M([EH("Soleil"),CH]))]),f(xa,v_,n));return f(mH,a,r)}()]),title:"DAIHard"}},TH=Ht,wH=TH({init:OB,onUrlChange:Uk,onUrlRequest:Dk,subscriptions:Pk,update:sB,view:SH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:wH(f(du,function(e){return f(du,function(t){return f(du,function(r){return Fi({height:r,networkId:t,width:e})},f(Oh,"height",zC))},f(Oh,"networkId",zC))},f(Oh,"width",zC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file +var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(bp,o,function(e){return si(Cp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,kp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,Bp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=nv(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?qg(o):jg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return nv(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Gg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Yg,zg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(zo,xa(ac),f(zo,Ms,nc))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ph,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ph,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ap)}),i.addEventListener("timeout",function(){a(Np)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Cp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(wp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Yg,zg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Yg,zg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Yg,zg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{options:t,type_:e}}),po={$:"OfferType"},go=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),vo=r(function(e,t){return f(ho,po,M([l(go,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(go,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),yo={$:"Closed"},mo={$:"Committed"},bo={$:"Judgment"},Co={$:"Open"},Eo={$:"Phase"},So=a(function(e,t,r,n){return f(ho,Eo,M([l(go,"Open",e,function(e){return R(e.state.phase,Co)}),l(go,"Committed",t,function(e){return R(e.state.phase,mo)}),l(go,"Judgment",r,function(e){return R(e.state.phase,bo)}),l(go,"Closed",n,function(e){return R(e.state.phase,yo)})]))}),To={$:"Initiator"},wo={$:"Responder"},Io=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),Ao=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(To):f(Io,function(e){return R(t,e)?si(wo):ci},e.state.responder)}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),ko=r(function(e,t){return f(Bo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(Ao,e,t))}),No={$:"Role"},Ro=n(function(e,t,r){return f(ho,No,M([l(go,"Buyer",t,function(t){return R(f(ko,t,e),si(fo))}),l(go,"Seller",r,function(t){return R(f(ko,t,e),si(lo))})]))}),$o=function(e){return{orderBy:e}},_o=$o,Lo={$:"Ascending"},xo={$:"Phase"},Po=Oe,Do=Po(yr),Uo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(So,!0,!0,!0,!1),f(vo,!0,!0),l(Ro,t,!0,!0)])),tradeTable:_o(L(xo,Lo)),wallet:e},Do)}),Oo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Mo={$:"None"},Fo=Mo,Vo=function(e){return d(Oo,e,Do,Fo,yr)},Ko=function(e){return{$:"TradeTableMsg",a:e}},Ho=function(e){return d(Oo,e,Do,Fo,yr)},jo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),qo=r(function(e,t){return f(jo,e,t)}),Go=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),zo=n(function(e,t,r){return t(e(r))}),Yo=r(function(e,t){if("None"===t.$)return Mo;var r=t.a,n=t.b,a=l(Go,f(Bo,Da(e),r.onSign),f(Bo,Da(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return L(f(zo,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(zo,t.toMsg,e)}},n))},r.onMined));return f(jo,a,n)}),Wo=function(e){return{$:"AbiDecoder",a:e}},Jo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Qo=z,Xo=Fr,Zo=r(function(e,t){return e<1?t:l(Xo,e,Qo(t),t)}),eu=Zo(64),tu=n(function(e,t,r){return L(f(Jo,e,eu(t)),r)}),ru=r(function(e,t){return e<1?"":l(Xo,0,e,t)}),nu=ru(64),au=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),iu=function(e){return-e},ou=r(function(e,t){return e<1?"":l(Xo,-e,Qo(t),t)}),uu=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(ru,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(ou,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Wo(function(t){var r=t.a,n=t.b;return f(au,f(tu,r,n),e(nu(n)))})}(),su=Hr,cu=function(e){return f(su,"0x",e)||f(su,"0X",e)?f(Zo,2,e):e},fu=function(e){return e.b},lu=r(function(e,t){var r=e.a;return f(au,fu,r(function(e){return f(Jo,e,e)}(cu(t))))}),du=Xr,hu=ae,pu=Wr,gu=function(e){return f(du,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return hu(a)},pu)},vu=f(zo,lu,gu),yu=function(e){return{$:"Magnitude",a:e}},mu=function(e){return{$:"Pos",a:e}},bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Cu=function(e){return{$:"MagnitudeNotNormalised",a:e}},Eu=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 si(n)}return ci}},Su=function(e){var t=Eu(e);return"Nothing"!==t.$&&t.a<0},Tu=function(e){return{$:"Neg",a:e}},wu={$:"Zer"},Iu=function(e){return!e.b},Au=r(function(e,t){var r=t.a;if(Iu(r))return wu;switch(e.$){case"Zero":return wu;case"Positive":return mu(t);default:return Tu(t)}}),Bu=r(function(e,t){return f(bu,e,Cu(t))}),ku=function(e){return f(La,r(function(t,r){return e(t)&&Iu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Nu=Ir,Ru=-1+f(Nu,10,7),$u=Ru+1,_u=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Lu=function(e){return e<0?f(_u,Na(-1),Lu(e+$u)):L(e/$u|0,e%$u)},xu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Lu(r+e),i=a.a,o=a.b;return f(ka,o,f(xu,i,n))}{if(!(_(e,$u)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Pu=function(e){var t=e.a;return yu(ku(f(xu,0,t)))},Du=xa(iu),Uu={$:"Negative"},Ou={$:"Positive"},Mu={$:"Zero"},Fu=function(e){switch(e.$){case"Positive":return Uu;case"Negative":return Ou;default:return Mu}},Vu=function(e){for(;;){var t=e.a,r=e.b,n=Pu(r),a=n.a;if(!Su(a))return f(Au,t,yu(a));e=f(Bu,Fu(t),Du(a))}},Ku=pr,Hu=function(e){switch(f(Ku,e,0).$){case"LT":return Uu;case"GT":return Ou;default:return Mu}},ju=function(e){return e<0?-e:e},qu=function(e){return Vu(f(bu,Hu(e),Cu(M([ju(e)]))))},Gu=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(Nu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},zu=function(e){switch(e.$){case"Zer":return wu;case"Neg":var t=e.a;return mu(t);default:return e}},Yu=function(e){return{$:"MagnitudePair",a:e}},Wu=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(ka,L(a,u),f(Wu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Wu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Wu,yr,s))}return yr}),Ju=r(function(e,t){var r=e.a,n=t.a;return Yu(f(Wu,r,n))}),Qu=function(e){switch(e.$){case"Zer":return f(Bu,Mu,yr);case"Neg":var t=e.a.a;return f(Bu,Ou,Du(t));default:var t=e.a.a;return f(Bu,Ou,t)}},Xu=r(function(e,t){var r=Qu(t),n=r.b,a=Qu(e),i=a.b,o=f(Ju,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Vu(f(bu,Ou,Cu(s)))}),Zu=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(R(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 Ta}return a.b.b?ba:f(Ku,e,t)}}),es=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},ts=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(Zu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return es(d(Zu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),rs=r(function(e,t){return R(f(ts,e,t),Ta)}),ns=K,as=r(function(e,t){return!f(rs,e,t)}),is=function(e){switch(e.$){case"Zer":return yu(yr);case"Pos":default:var t=e.a;return t}},os=r(function(e,t){var r=e.a;return Pu(Cu(f(xa,ti(t),r)))}),us=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(os,yu(n),a),u=f(us,yu(i),yu(n)),s=u.a,c=f(Xu,f(Au,Ou,o),f(Au,Ou,yu(f(ka,0,s))));return is(c)}var a=r.a;return f(os,yu(n),a)}return yu(yr)}),ss=function(e){switch(e.$){case"Zer":return Mu;case"Pos":return Ou;default:return Uu}},cs=r(function(e,t){return R(e,Mu)||R(t,Mu)?Mu:R(e,t)?Ou:Uu}),fs=r(function(e,t){return f(Au,f(cs,ss(e),ss(t)),f(us,is(e),is(t)))}),ls=function(e){switch(e.$){case"Zer":return wu;case"Pos":var t=e.a;return Tu(t);default:var t=e.a;return mu(t)}},ds=r(function(e,t){return f(Xu,e,ls(t))}),hs=qu(0),ps=a(function(e,t,r,n){if(e){var a=qu(e),i=f(fs,f(fs,a,n),t),o=f(as,i,r)?L(f(fs,a,t),f(ds,r,i)):L(hs,r),u=o.a,s=o.b,c=d(ps,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Xu,u,l),h)}return L(hs,r)}),gs=Fa(f(Va,2,Ru)),vs=n(function(e,t,r){return d(ps,f(Nu,2,gs),e,t,r)}),ys=qu(1),ms=r(function(e,t){return e}),bs=n(function(e,t,r){return l(Ra,ms(e),t,f(Ai,1,r))}),Cs=function(e){return l(bs,fs(qu($u)),ys,e)},Es=n(function(e,t,r){if(e){var n=l(vs,Cs(e),t,r),a=n.a,i=n.b,o=l(Es,e-1,i,r),u=o.a,s=o.b;return L(f(Xu,a,u),s)}return l(vs,Cs(e),t,r)}),Ss=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Ts=r(function(e,t){if(R(t,hs))return ci;var r=Ti(Ss(e))-Ti(Ss(t))+1,n=l(Es,f(ei,0,r),zu(e),zu(t)),a=n.a,i=n.b;return si(L(f(Au,f(cs,ss(e),ss(t)),is(a)),f(Au,ss(e),is(i))))}),ws=f(fs,qu(2),qu(2147483648)),Is=xr,As=function(e){return f(Is,e,"")},Bs=Pn,ks=n(function(e,t,r){return e<=0?r:l(ks,e>>1,U(t,t),1&e?U(r,t):r)}),Ns=r(function(e,t){return l(ks,e,t,"")}),Rs=n(function(e,t,r){return U(f(Ns,e-Qo(r),As(t)),r)}),$s=te,_s=Ar,Ls=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},xs=r(function(e,t){for(;;){if(t<16)return f(ka,Ls(t),e);var r=f(ka,Ls(f(_s,16,t)),e),n=t/16|0;e=r,t=n}}),Ps=function(e){return $s(e<0?f(ka,P("-"),f(xs,yr,-e)):f(xs,yr,e))},Ds=function(e){var t=f(Ts,e,ws);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=Ps(Gu(a));return R(n,qu(0))?i:U(Ds(n),l(Rs,8,P("0"),i))},Us=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,yu(yr))?"0":Ds(mu(t));default:var t=e.a;return"-"+Us(f(fs,qu(-1),e))}},Os=function(e){return l(Rs,64,P("0"),e)},Ms=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(Ps(a)),c=function(e){return U(e,n)}(Os(Ps(u)));return x(a+32+(Qo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Fs=Dr,Vs=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))))}),Ks=n(function(e,t,n){return l(Fs,r(function(t,r){return l(Vs,e,yi(t),r)}),t,n)}),Hs=function(e){return $a(l(Ks,ka,yr,e))},js=function(e){return f(Ri,"",f(xa,f(zo,Ps,f(Rs,2,P("0"))),Hs(e)))},qs=function(e){return 64-f(_s,64,e)},Gs=function(e){return U(e,f(Ns,qs(Qo(e)),"0"))},zs=function(e){return L(si(Qo(e)/2|0),Gs(e))},Ys=function(e){return L(ci,Os(e))},Ws=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Js=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"}},Qs=Ur,Xs=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(Is,P("1"),r),!0);case"1":return L(f(Is,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Is,P("0"),r),!1);case"1":return L(f(Is,P("1"),r),!0);default:break e}return L(r,!0)});return l(Qs,t,L("",!1),e).a},Zs=function(e){return l(Qs,ka,yr,e)},ec=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Zo,e,t),i=f(ka,l(Xo,0,e,t),r);e=n,t=a,r=i}}),tc=r(function(e,t){return e&&""!==t?l(ec,e,t,yr):M([t])}),rc=function(e){var t=function(){var t=Zs(Us(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(zo,Xs,f(Rs,256,P("1"))))}var r=t;return L(r,f(Rs,256,P("0")))}(),r=t.a,n=t.b;return $s(f(xa,Ws,f(tc,4,n(f(Ri,"",f(xa,Js,r))))))},nc=function(e){return{$:"Hex",a:e}},ac=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Ys(t);case"UintE":var r=e.a;return Ys(Us(r));case"IntE":var n=e.a;return Ys(rc(n));case"BoolE":return Ys(e.a?"1":"0");case"DBytesE":var a=e.a.a;return zs(a);case"BytesE":var a=e.a.a;return Ys(cu(a));case"StringE":var i=e.a;return zs(js(i));case"ListE":var o=e.a;return function(e){var t=e.a;return zs(t)}(Xt()(o));default:var i=e.a;return Ys(cu(i))}};try{var ic=Xt();Xt=function(){return ic}}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 oc=Pr,uc=function(e){return 1===Qo(e)?f(oc,"0",e):e},sc=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(ka,n,r);e=i,t=o,r=u}}}),cc=r(function(e,t){return $a(l(sc,e,t,yr))}),fc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(cc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(fc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),lc=r(function(e,t){return l(fc,0,e,t)}),dc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),hc=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 Pt(e.a)}},pc={$:"LE"},gc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,pc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,pc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,pc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,pc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,pc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,pc));case"Seq":var i=e.b;return l(vc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),vc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(gc,n,t,r);e=i,t=o,r=u}}),yc=Dt,mc=r(function(e,t){return{$:"Seq",a:e,b:t}}),bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+hc(r),i=n;e=a,t=i}}),Cc=function(e){return f(mc,f(bc,0,e),e)},Ec=function(e){return{$:"U8",a:e}},Sc=Ec,Tc=r(function(e,t){return _(e,t)<0?e:t}),wc=hr,Ic=function(e){return{$:"Bytes",a:e}},Ac=Ic,Bc=function(e){return yc(Cc(f(xa,Ac,$a(e))))},kc=Pt,Nc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Rc=function(e){return{$:"Decoder",a:e}},$c=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}}),_c=r(function(e,t){return Rc(f($c,e,t))}),Lc=Rc(Yn),xc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Pc=function(e){return{$:"Done",a:e}},Dc=function(e){return{$:"Loop",a:e}},Uc=r(function(e,t){var n=t.a;return Rc(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 Rc(r(function(t,r){return L(r,e)}))},Mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Oc(Pc($a(n))):f(Uc,function(e){return Dc(L(r-1,f(ka,e,n)))},e)}),Fc=function(e){return f(xc,yr,f(Nc,f(_c,L(kc(e),yr),Mc(Lc)),e))},Vc=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))}),Kc=r(function(e,t){return l(Vc,Bs,e,t)}),Hc=f(Ai,0,4),jc=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}}),qc=xt,Gc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),zc=function(e){return f(Gc,f(zo,qc,Bs(4294967295)),e)},Yc=r(function(e,t){return 5*t+e}),Wc=4294967295>>>32-Ha,Jc=ar,Qc=n(function(e,t,r){for(;;){var n=Wc&t>>>e,a=f(Jc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Jc,Wc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Xc=function(e){return e>>>5<<5},Zc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Xc(r))>-1?f(Jc,Wc&e,i):l(Qc,n,e,a))}),ef=r(function(e,t){var r=f(Zc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),tf=n(function(e,t,r){var n=f(Yc,e,t);return f(ef,n,r)}),rf=ir,nf=a(function(e,t,r,n){var a=Wc&t>>>e,i=f(Jc,a,n);if("SubTree"===i.$){var o=i.a,u=d(nf,e-Ha,t,r,o);return l(rf,a,za(u),n)}var s=i.a,c=l(rf,Wc&t,r,s);return l(rf,a,Ga(c),n)}),af=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,Xc(n))>-1?d(Ma,n,a,i,l(rf,Wc&e,t,o)):d(Ma,n,a,d(nf,a,e,t,i),o)}),of=n(function(e,t,r){return l(af,e,t,r)}),uf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(of,a,r,n)}),sf=Dn,cf=r(function(e,t){return l(Vc,sf,e,t)}),ff=function(e){var t=l(La,r(function(t,n){var a={d0:l(tf,0,t,e.state),d1:l(tf,1,t,e.state),d2:l(tf,2,t,e.state),d3:l(tf,3,t,e.state),d4:l(tf,4,t,e.state)},i=r(function(e,r){return d(uf,e,t,f(cf,f(jc,e,a),f(Kc,zc(f(jc,f(_s,5,e+1),a)),f(jc,f(_s,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Hc);return D(e,{state:t})},lf=L(0,0),df=function(e){return{current:lf,lfsrstate:1,state:e,x:1,y:0}},hf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},pf=L(1,0),gf=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),vf=r(function(e,t){if(e){var n=f(gf,1,t);return l(Vc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),yf=r(function(e,t){var r=f(_s,32,e/32|0),n=f(gf,r,t),a=f(_s,32,e);return f(vf,a,n)}),mf=n(function(e,t,r){var n=f(Zc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(af,e,t(a),r)}),bf=n(function(e,t,r){return l(mf,e,cf(t),r)}),Cf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(bf,a,r,n)}),Ef=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Nf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Tc,n,r),i=f(xa,function(e){return f(kf,e,g)},f(Ai,0,a)),o=Bf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(lc,i.outputLen,l(v,g,yr,i.outputLen))},Lf=function(e){return{$:"KS",a:e}},xf=function(e){var t=e.a;return Lf({config:t,inputLength:0,partial:yr,state:f(ui,25,ms(lf))})},Pf=function(e){return Rc(Wn(e))},Df=yc(Cc(yr)),Uf=r(function(e,t){var n=t.a;return Rc(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(Uf,function(e){return Pf(t)},Pf(e))}),Mf=r(function(e,t){return f(xc,Df,f(Nc,f(Of,e,kc(t)-e),t))}),Ff=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=kc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+kc(e)}),0,i),a)>-1))return Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:i}));var o=Bc(i),u=f(xc,Df,f(Nc,Pf(a),o)),s=Fc(u),c=f($f,s,n.state),d=Bf(c),h=f(Mf,a,o),p=Df,g=Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Vf=r(function(e,t){return _f(f(Ff,yc(Cc(f(xa,Sc,t))),xf(e)))}),Kf=Vf(dc),Hf=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,4,Kf(f(xa,yi,Zs(e)))))))},jf=function(e){return f(su,"0x",e)||f(su,"0X",e)?e:"0x"+e},qf=function(e){var t=e.a;return jf(t)},Gf=r(function(e,t){var r=Ms(f(xa,ac,t)),n=function(e){return U(e,r)}(cu(qf(Hf(e))));return nc(n)}),zf=function(e){return{data:si(f(Gf,"poke()",yr)),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yf=r(function(e,t){return D(t,{checked:e})}),Wf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Jf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Wf,f(zo,function(e){return e.type_},Ja(r)),function(e){return D(e,{options:l(Wf,f(zo,function(e){return e.label},Ja(n)),Yf(a),e.options)})},t)}),Qf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Xf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zf={$:"Descending"},el=function(e){return"Ascending"===e.$?Zf:Lo},tl=function(e){return d(Xf,e,Do,Fo,yr)},rl=r(function(e,t){return L(t.a,e(t.b))}),nl=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Xf,t,Do,Fo,M([da(f(Qf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(rl,el,t.orderBy):L(a,Lo);return tl(D(t,{orderBy:i}));default:return tl(t)}}),al=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},il=yn,ol=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=al(zf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(qo,a,n);return d(Oo,t,Do,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Oo,t,Do,Fo,M([da(f(Qf,o,u))]));case"FiltersMsg":var s=e.a;return Ho(D(t,{filters:f(Jf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(nl,c,t.tradeTable);return d(Oo,D(t,{tradeTable:l.model}),f(il,Ko,l.cmd),f(Yo,Ko,l.chainCmd),f(xa,Ji(Ko),l.appCmds));default:return Vo(t)}}),ul={$:"BottomRight"},sl={$:"ShouldBeImpossible"},cl=lr,fl=function(e){return qi(e)},ll=r(function(e,t){f(cl,e,t);return{align:ul,label:"unexpectedError",mainParagraphs:M([M([fl(e)])]),noticeType:sl}}),dl=function(e){var t=e.a;return jf(t)},hl=ye,pl=f(zo,dl,hl),gl=f(zo,Us,f(zo,jf,hl)),vl=f(zo,qf,hl),yl=f(zo,Ps,f(zo,jf,hl)),ml=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),bl=un,Cl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},El=function(e){return Cl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(xc,bl,r))},f(ml,function(e){e.a;return!R(e.b,ci)},e)))},Sl=function(e){return El(M([L("to",f(Bo,pl,e.to)),L("from",f(Bo,pl,e.from)),L("gas",f(Bo,yl,e.gas)),L("gasPrice",f(Bo,gl,e.gasPrice)),L("value",f(Bo,gl,e.value)),L("data",f(Bo,vl,e.data)),L("nonce",f(Bo,yl,e.nonce))]))},Tl=function(e){return{$:"TxSentry",a:e}},wl=ye,Il=r(function(e,t){return Cl(M([L("ref",wl(e)),L("txParams",t)]))}),Al=function(e){return{$:"Signing",a:e}},Bl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Al(e)}}),kl={$:"Black"},Nl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Rl={$:"RBEmpty_elm_builtin"},$l={$:"Red"},_l=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(Nl,$l,t,r,h(Nl,kl,c,f,l,d),h(Nl,kl,i,o,u,s))}return h(Nl,e,i,o,h(Nl,$l,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(Nl,$l,c,f,h(Nl,kl,g,v,y,m),h(Nl,kl,t,r,d,a))}return h(Nl,e,t,r,n,a)}),Ll=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Nl,$l,e,t,Rl,Rl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ku,e,a).$){case"LT":return h(_l,n,a,i,l(Ll,e,t,o),u);case"EQ":return h(Nl,n,a,t,o,u);default:return h(_l,n,a,i,o,l(Ll,e,t,u))}}),xl=n(function(e,t,r){var n=l(Ll,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(Nl,kl,a,i,o,u)}return n}),Pl=n(function(e,t,r){var n=e.a,a=Sl(r),i=l(xl,n.ref,f(Bl,r,t),n.txs);return L(Tl(D(n,{ref:n.ref+1,txs:i})),f(il,n.tagger,n.outPort(f(Il,n.ref,a))))}),Dl=Pl,Ul=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Do,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Dl,n,i,o))}return x(ci,Do,M([f(ll,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ol=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Ml=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Fl=function(e){return{$:"Posix",a:e}},Vl=Fl,Kl={autoabortInterval:Vl(0),autorecallInterval:Vl(0),autoreleaseInterval:Vl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Hl=function(e){return{$:"TokenValue",a:e}},jl=function(e){return e.a},ql=r(function(e,t){return f(xc,hs,f(Bo,Qa,f(Ts,e,t)))}),Gl=r(function(e,t){return Hl(f(ql,jl(e),qu(t)))}),zl=function(e){return f(Gl,e,12)},Yl=function(e){return f(Gl,e,3)},Wl=Hl(qu(0)),Jl=r(function(e,t){var r=Wl;return{abortPunishment:zl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Ql=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Xl=qr,Zl=function(e){var t=Ql(f(Xl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Qo(e)-1-r;return L(U(f(ru,r,e),f(Zo,r+1,e)),n)},ed=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 yr}}),td=function(e){var t=e.a,r=f(ed,Ja(0),t);return yu(r.b?t:yr)},rd=Z,nd=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}}}),ad=n(function(e,t,r){var n=f(nd,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(lc,e,r),l(ad,e,t,n)):yr}),id=r(function(e,t){return l(ad,e,e,t)}),od=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Bo,ka(a),r)});return f(La,t,si(yr))}(Ua),ud=function(e){return f(Bo,f(Da,td,yu),od(f(xa,f(zo,$a,f(zo,$s,rd)),f(id,7,$a(e)))))},sd=Q,cd=function(e){var t=Zs(sd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,Au(Uu),ud(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Bo,Au(Ou),ud(r))}return ci;default:var r=t;return f(Bo,Au(Ou),ud(r))}},fd=function(e){var t=function(e){return!f(_s,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(xc,0,Ql(r)))}},ld=function(e){return f(fs,e,e)},dd=qu(2),hd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ys;case"Neg":return wu;default:if(R(r,ys))return f(fs,e,t);if(fd(r)){var n=e,a=ld(t),i=f(ql,r,dd);e=n,t=a,r=i;continue e}var n=f(fs,t,e),a=ld(t),i=f(ql,f(ds,r,ys),dd);e=n,t=a,r=i;continue e}}),pd=r(function(e,t){return l(hd,ys,e,t)}),gd=function(e){if(""===e)return ci;var t=Zl(e),r=t.a,n=t.b,a=cd(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(fs,o,f(pd,qu(10),qu(i)));return si(u)},vd=function(e){return f(Bo,Hl,gd(e))},yd=jr,md=function(e){for(;;){if(f(yd,".",e))return l(Xo,0,-1,e);{if(!f(yd,"0",e))return""===e?"0":e;e=l(Xo,0,-1,e)}}},bd=f(Da,f(Rs,7,P("0")),Ni),Cd=function(e){return f(Ri,"",e)},Ed=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Cd(f(ka,Ni(n),f(xa,bd,a)))}return"0"},Sd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Ed(t);default:var t=e.a;return"-"+Ed(t)}},Td=r(function(e,t){return e<1?t:l(Xo,0,-e,t)}),wd=function(e){var t=l(Rs,18,P("0"),Sd(e)),r=f(Td,18,t)+"."+f(ou,18,t);return function(e){return""===e?"0":e}(md(r))},Id=r(function(e,t){var r=wd(t),n=Ql(f(Xl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(ru,a+1+e,r):f(ru,a,r)}),Ad=r(function(e,t){if("Nothing"===e.$)return wd(jl(t));var r=e.a;return f(Id,r,jl(t))}),Bd=ee,kd=function(e){var t=Bd(f(Ad,ci,e));if("Just"===t.$){return t.a}f(cl,"Error converting tokenValue to float: string -> float failed",e);return 0},Nd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=vd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return kd(r)<1?fi("Trade amount can't be less than 1."):li(r)},Rd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=cd(e);if("Nothing"===t.$){var r=Bd(e);return fi("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 li(n)},$d=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),_d=function(e){return""===e},Ld=function(e){return _d(e)?ci:si(e)},xd=function(e){return f($d,"You must specify a fiat type.",Ld(e))},Pd=function(e){return""===e?fi("Must specify a payment method."):li(e)},Dd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ud=g(Dd,ci,ci,ci,ci,ci,ci,ci),Od=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Md=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Fd={$:"Custom"},Vd=r(function(e,t){return{info:t,type_:e}}),Kd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Hd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),jd=function(e){return e.a},qd=function(e){return p(Kd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Vd,Fd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Hd,function(e){return D(Ud,{daiAmount:si(e)})},Nd(e.daiAmount)),f(Hd,function(e){return D(Ud,{fiatAmount:si(e)})},Rd(e.fiatAmount)),f(Hd,function(e){return D(Ud,{fiatType:si(e)})},xd(e.fiatType)),f(Hd,function(e){return D(Ud,{paymentMethod:si(e)})},Pd(e.paymentMethod)),Od(d(Md,function(e){return jd(e)>0?li(e):fi(D(Ud,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Gd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},zd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Yd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Wd=function(e){var t=qd(e.inputs),r=function(){return R(e.errors,Ud)?Ud:"Ok"===t.$?Ud:t.a}();return D(e,{createParameters:l(zd,Jl,Gd(e.wallet),Yd(t)),errors:r})},Jd=r(function(e,t){return Wd(D(t,{inputs:e}))}),Qd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Xd=function(e){return d(Qd,f(Jd,Kl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:Ud,inputs:Kl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Do,Fo,yr)},Zd=a(function(e,t,r,n){return la(d(Ol,e,t,r,n))}),eh=function(e){return{$:"Address",a:e}},th=f(zo,cu,f(zo,sd,eh)),rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return th("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return th("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return th("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return th("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nh=function(e){return th("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ah=function(e){return{$:"AddressE",a:e}},ih=ah,oh=function(e){return{$:"UintE",a:e}},uh=oh,sh=n(function(e,t,r){return{data:si(f(Gf,"approve(address,uint256)",M([ih(t),uh(r)]))),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ch=function(e){return f(Gl,e,200)},fh=r(function(e,t){return Hl(f(Xu,jl(e),jl(t)))}),lh=function(e){var t=f(Gl,e.tradeAmount,200);return f(fh,e.pokeReward,f(fh,ch(e.tradeAmount),f(fh,t,function(){return"Buyer"===e.initiatorRole.$?Yl(e.tradeAmount):e.tradeAmount}())))},dh=Mi(ya),hh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ph=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gh=Xn,vh=Qn,yh=function(e){return f(vh,{caseInsensitive:!1,multiline:!1},e)},mh=Jn,bh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ch=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}}),Eh=r(function(e,t){return!f(Ch,f(Da,ns,e),t)}),Sh=Eh(Ua),Th=q,wh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ih=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Ah=f(La,Ih(ka),li(yr)),Bh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},kh=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Nu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Nu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Nu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Nu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Nu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Nu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Nu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Nu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Nu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Nu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Nu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Nu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Nu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Nu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Nu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(As(s)+" is not a valid hexadecimal character.")}}}),Nh=function(e){if(_d(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(su,"-",e)){var t=f(xc,yr,Bh(Zs(e)));return f(au,iu,l(kh,Ti(t)-1,t,0))}return l(kh,Qo(e)-1,Zs(e),0)}();return f(Hd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rh=function(e){var t=Zs(e);return function(e){return L(t,e)}(f(wh,yr,Ah(f(xa,Nh,f(_i,"",f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,20,Kf(f(xa,f(zo,Th,yi),t))))))))))},$h=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Rh(cu(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!bh(e)&&Sh(o)},_h=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-f]{40}$"))),Lh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-F]{40}$"))),xh=function(e){return'"'+e+'"'},Ph=function(e){var t=cu(e),r=f(ru,24,t),n=f(ou,40,e);return 64===Qo(t)&&f(ki,Ja(P("0")),r)?Lh(n)||_h(n)?li(eh(n)):$h(n)?li(eh(n)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):40!==Qo(t)?fi("Given address "+xh(e)+" is not the correct length."):bh(t)?Lh(t)||_h(t)?li(eh(t)):$h(t)?li(eh(t)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):fi("Given address "+xh(e)+" contains invalid hex characters.")},Dh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),Ph(nu(r)))}),Uh=r(function(e,t){var r=t.a;return Wo(function(t){var n=t.a,a=t.b;return r(f(Jo,n,f(Zo,64*e,a)))})}),Oh=Jr,Mh=r(function(e,t){return f(Oh,"data",vu(f(Uh,e,t)))}),Fh=Qr,Vh=r(function(e,t){return f(Oh,"topics",f(Fh,e,vu(t)))}),Kh=function(e){return f(Bo,f(zo,$a,f(Ra,r(function(e,t){return f(Xu,qu(e),f(fs,t,ws))}),hs)),od(f(xa,f(zo,$a,f(zo,$s,f(zo,Nh,Yd))),f(id,8,$a(e)))))},Hh=function(e){var t=Zs(sd(e));e:for(;;){if(!t.b)return ci;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(Bo,fs(qu(-1)),Kh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Bo,fs(qu(-1)),Kh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Kh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kh(a)}t.b;return ci}break e;default:break e}}var a=t;return Kh(a)},jh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f($d,"Error Decoding Uint into BigInt",Hh(jf(nu(r)))))}),qh=f(dh,f(Vh,1,Dh),f(dh,f(Mh,1,Dh),f(dh,f(Mh,0,jh),Fi(hh)))),Gh=nn,zh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Yh=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(Gh,e,Cl(M([L("data",hl(t.data)),L("topics",f(zh,vl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Wh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Jh=r(function(e,t){return f(au,function(e){return e.id},f(Wh,function(e){return f(Hd,Di,f(Yh,qh,e).returnData)},f($d,"No log found from that factoryAddress in that txReceipt",Ql(f(ml,function(t){return R(f(zo,dl,sd)(t.address),f(zo,dl,sd)(rh(e)))},t.logs)))))}),Qh=n(function(e,t,r){return{data:si(f(Gf,"allowance(address,address)",M([ih(t),ih(r)]))),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Zh=function(e){switch(e.$){case"BlockNum":var t=e.a;return hl(jf(Ps(t)));case"EarliestBlock":return hl("earliest");case"LatestBlock":return hl("latest");default:return hl("pending")}},ep=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return El(M([L("to",f(Bo,pl,t)),L("from",f(Bo,pl,r)),L("gas",f(Bo,yl,n)),L("gasPrice",f(Bo,gl,a)),L("value",f(Bo,gl,i)),L("data",f(Bo,vl,o))]))},tp=function(e){return{$:"BadBody",a:e}},rp=function(e){return{$:"BadStatus",a:e}},np=function(e){return{$:"BadUrl",a:e}},ap={$:"NetworkError"},ip={$:"Timeout"},op=rn,up=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(np(r));case"Timeout_":return fi(ip);case"NetworkError_":return fi(ap);case"BadStatus_":var n=t.a,a=t.b;return fi(rp(n.statusCode));default:var n=t.a,a=t.b,i=f(op,f(Oh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(tp(Di(u)))}}),sp=n(function(e,t,r){return Cl(M([L("id",wl(e)),L("jsonrpc",hl("2.0")),L("method",hl(t)),L("params",f(zh,Ua,r))]))}),cp=Rl,fp=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ku,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),lp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},dp=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(Nl,$l,p,g,h(Nl,kl,r,n,h(Nl,$l,i,o,u,s),v),h(Nl,kl,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(Nl,kl,r,n,h(Nl,$l,i,o,u,s),h(Nl,$l,f,l,d,m))}return e},hp=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(Nl,$l,i,o,h(Nl,kl,s,c,f,l),h(Nl,kl,r,n,d,h(Nl,$l,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Nl,kl,r,n,h(Nl,$l,i,o,C,d),h(Nl,$l,g,v,y,m))}return e},pp=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(Nl,r,u,s,c,h(Nl,$l,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 hp(t)}break e}o.a,o.d;return hp(t)}break e}return t}),gp=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(Nl,t,r,n,gp(a),u)}var s=dp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(_l,c,f,l,gp(d),p)}return Rl}return h(Nl,t,r,n,gp(a),u)}return Rl},vp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Rl;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(Nl,r,n,a,f(vp,e,i),o)}var s=dp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(_l,c,l,d,f(vp,e,p),v)}return Rl}return h(Nl,r,n,a,f(vp,e,i),o)}return f(yp,e,g(pp,e,t,r,n,a,i,o))}),yp=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(R(e,n)){var u=lp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(_l,r,s,c,i,gp(o))}return Rl}return h(_l,r,n,a,i,f(vp,e,o))}return Rl}),mp=r(function(e,t){var r=f(vp,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(Nl,kl,n,a,i,o)}return r}),bp=n(function(e,t,r){var n=t(f(fp,e,r));if("Just"===n.$){var a=n.a;return l(xl,e,a,r)}return f(mp,e,r)}),Cp=function(e){return"Just"===e.$},Ep=gn,Sp=vn,Tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),wp=function(e){return{$:"BadUrl_",a:e}},Ip=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ap={$:"NetworkError_"},Bp=function(e){return{$:"Receiving",a:e}},kp=function(e){return{$:"Sending",a:e}},Np={$:"Timeout_"},Rp=function(e){return f(ta,"application/json",f(xi,0,e))},$p=n(function(e,t,r){return Rp(l(sp,e,t,r))}),_p=f(ea,"",Ua),Lp=Te,xp=Se,Pp=function(e){if("Ok"===e.$){var t=e.a;return xp(t)}var r=e.a;return Lp(r)},Dp=function(e){return l(Zn,gr,Pp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},Up=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Dp({body:l($p,1,r,n),headers:yr,method:"POST",resolver:_p(up(a)),timeout:ci,url:t})},Op=n(function(e,t,r){return Up({decoder:t.decoder,method:"eth_call",params:M([ep(t),Zh(r)]),url:e})}),Mp={$:"LatestBlock"},Fp=r(function(e,t){return l(Op,e,t,Mp)}),Vp=function(e){return{$:"Perform",a:e}},Kp=sn,Hp=xp(gr),jp=r(function(e,t){return f(Kp,function(t){return xp(e(t))},t)}),qp=n(function(e,t,r){return f(Kp,function(t){return f(Kp,function(r){return xp(f(e,t,r))},r)},t)}),Gp=function(e){return l(La,qp(ka),xp(yr),e)},zp=r(function(e,t){var r=t.a;return Be(f(Kp,Ep(e),r))}),Yp=n(function(e,t,r){return f(jp,function(e){return gr},Gp(f(xa,zp(e),t)))}),Wp=n(function(e,t,r){return xp(gr)}),Jp=r(function(e,t){var r=t.a;return Vp(f(jp,e,r))});pn.Task=Pe(Hp,Yp,Wp,Jp);var Qp=Ue("Task"),Xp=cn,Zp=r(function(e,t){return Qp(Vp(f(Xp,f(Da,f(Da,xp,e),fi),f(Kp,f(Da,f(Da,xp,e),li),t))))}),eg=a(function(e,t,r,n){return f(Zp,n,f(Fp,Xh(eo(e)),l(Qh,nh(e),t,r)))}),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return th("0x092110996699c3E06e998d89F0f4586026e44F0F")}},rg=function(e){return{$:"BoolE",a:e}},ng=rg,ag=function(e){return{$:"StringE",a:e}},ig=ag,og=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ug=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},sg=r(function(e,t){return{paymentMethods:t,price:e}}),cg=function(e){return hl(Sd(e))},fg=function(e){return f(zh,Ua,M([hl(e.fiatType),cg(e.amount)]))},lg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},dg=function(e){return Cl(M([L("type",hl(lg(e.type_))),L("info",hl(e.info))]))},hg=function(e){var t=fg(e.price),r=f(zh,dg,e.paymentMethods);return f(xi,0,Cl(M([L("paymentmethods",r),L("price",t)])))},pg=r(function(e,t){return D(t,{value:si(e)})}),gg=function(e){return qu(jd(e))},vg=function(e){return f(ql,gg(e),qu(1e3))},yg=r(function(e,t){var r=function(){return"Token"===e.$?og:ug}();return function(){return"Native"===e.$?pg(jl(lh(t))):Ua}()(r(rh(e))(t.initiatorAddress)(tg(e))(R(t.initiatorRole,lo))(jl(t.tradeAmount))(jl(Yl(t.tradeAmount)))(jl(zl(t.tradeAmount)))(jl(t.pokeReward))(vg(t.autorecallInterval))(vg(t.autoabortInterval))(vg(t.autoreleaseInterval))(jl(ch(t.tradeAmount)))(hg(f(sg,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),mg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),bg=function(e){return{$:"CreateNeedsSig",a:e}},Cg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Eg=r(function(e,t){var r=al(f(yg,e,t)),n={onBroadcast:ci,onMined:si(L(mg(e),ci)),onSign:si(Cg(e))};return L(si(bg(e)),f(qo,n,r))}),Sg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wg=function(e){return{$:"ApproveNeedsSig",a:e}},Ig=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Bg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),kg={$:"NoOp"},Ng=function(e){return{appCmds:yr,chainCmd:Fo,cmd:Do,model:e}},Rg=function(e){return rd(Sd(e))},$g={$:"Error"},_g=r(function(e,t){f(cl,e+" fetch error",t);return{align:ul,label:"web3FetchError",mainParagraphs:M([M([fl('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:$g}}),Lg=r(function(e,t){return{align:ul,label:"web3MiningError",mainParagraphs:M([M([fl('Error mining "'+e+'" transaction: '+t)])]),noticeType:$g}}),xg={$:"Caution"},Pg=r(function(e,t){return{align:ul,label:"web3SigError",mainParagraphs:M([M([fl('Error signing "'+e+'" transaction: '+t)])]),noticeType:xg}}),Dg={$:"KovanDai"},Ug=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Dg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Og=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Mg=function(e){return f(Io,Ug,Og(e))},Fg=r(function(e,t){return 1-e(1-t)}),Vg=function(e){return f(Nu,e,5)},Kg=Fg(Vg),Hg={easing:Kg,offset:12,speed:200},jg=function(e){return{$:"External",a:e}},qg=function(e){return{$:"Internal",a:e}},Gg=function(e){return{$:"NotFound",a:e}},zg=function(e){for(;;){e=e.a}},Yg=r(function(e,t){return Qp(Vp(f(jp,e,t)))}),Wg={$:"Http"},Jg={$:"Https"},Qg=Kr,Xg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Zg=i(function(e,t,r,n,a){if(_d(a)||f(Qg,"@",a))return ci;var i=f(Xl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=rd(f(Zo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Xg,e,f(ru,o,a),s,t,r,n))}return si(p(Xg,e,a,ci,t,r,n))}),ev=a(function(e,t,r,n){if(_d(n))return ci;var a=f(Xl,"/",n);if(a.b){var i=a.a;return h(Zg,e,f(Zo,i,n),t,r,f(ru,i,n))}return h(Zg,e,"/",t,r,n)}),tv=n(function(e,t,r){if(_d(r))return ci;var n=f(Xl,"?",r);if(n.b){var a=n.a;return d(ev,e,si(f(Zo,a+1,r)),t,f(ru,a,r))}return d(ev,e,ci,t,r)}),rv=r(function(e,t){if(_d(t))return ci;var r=f(Xl,"#",t);if(r.b){var n=r.a;return l(tv,e,si(f(Zo,n+1,t)),f(ru,n,t))}return l(tv,e,ci,t)}),nv=function(e){return f(su,"http://",e)?f(rv,Wg,f(Zo,7,e)):f(su,"https://",e)?f(rv,Jg,f(Zo,8,e)):ci},av=Wt,iv=Gt(zt),ov=sa,uv=r(function(e,t){return L(e,t)}),sv=_r,cv=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=ju(r-n),o=f(ei,1,sv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),fv=r(function(e,t){var n=r(function(t,r){return Gp(f(xa,ov(0),d(cv,e.speed,e.easing,t,r-e.offset)))});return f(Kp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(qp,uv,iv,av(t)))}),lv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Gd(t.wallet),Mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(eg,a,n.address,rh(eo(a)),Sg(a));return d(Qd,t,i,Fo,yr)}return Ng(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Qd,D(t,{inputs:D(u,{userRole:o})}),Do,Fo,M([function(){return"Buyer"===o.$?d(Zd,"create offer type changed","input","sell dai",0):d(Zd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ng(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ng(f(Jd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Qd,(g?Jd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Do,Fo,g?M([d(Zd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=qd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jl,n,m);return Ng(D(t,{depositAmount:si(jl(lh(b))),txChainStatus:si(f(Ag,v,b))}))}var C=y.a;return d(Qd,D(t,{errors:C}),f(Zp,ms(kg),function(){return f(fv,D(Hg,{offset:60}),"inputError")}()),Fo,yr);case"AbortCreate":return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([d(Zd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Eg,v,b);var e=v.a,r=function(){var t=al(l(sh,nh(e),rh(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Ig,e,b))};return f(qo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(ts,a,E),ba)?L(si(wg(e)),r):f(Eg,v,b)}return L(si(wg(e)),r)}(),T=S.a,w=S.b;return d(Qd,D(t,{txChainStatus:T}),Do,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(l(Tg,a,b,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(ts,N,P),ba))return Ng($);var U=f(Eg,eo(a),b),T=U.a,w=U.b;return d(Qd,D($,{txChainStatus:T}),Do,w,yr)}return Ng($)}var O=k.a;return d(Qd,t,Do,Fo,M([pa(f(_g,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(f(Bg,v,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Qd,t,Do,Fo,M([pa(f(Lg,"create",B))]))}var F=e.a,V=e.b.a,K=f(Io,Rg,Yd(f(Jh,F,V)));if("Just"===K.$){var H=K.a;return d(Qd,t,Do,Fo,M([da(f(Qf,F,H))]))}return d(Qd,t,Do,Fo,M([pa(f(ll,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Qd,t,Do,Fo,M([ga]));case"NoOp":return Ng(t);default:var j=e.a;return d(Qd,t,Do,Fo,M([j]))}}),dv=r(function(e,t){return f(Eh,function(e){return f(Ch,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),hv=r(function(e,t){return f(Ku,jd(e),jd(t))}),pv=r(function(e,t){return R(f(hv,t.derived.phaseEndTime,e),Ta)}),gv=function(e){if(""===e)return li(ci);var t=vd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},vv=r(function(e,t){return{maxDai:t,minDai:e}}),yv=f(vv,ci,ci),mv=function(e){return l(Ih,r(function(t,r){return{dai:{max:r,min:t},fiatType:Ld(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Hd,function(e){return D(yv,{minDai:si(e)})},gv(e.minDai)),f(Hd,function(e){return D(yv,{maxDai:si(e)})},gv(e.maxDai)))},bv=r(function(e,t){var r=function(t){return f(Eh,function(e){return f(Qg,sd(e),sd(t))},e)};return f(Ch,function(e){return r(e.info)},t)}),Cv=r(function(e,t){return D(t,{paymentMethod:e})}),Ev=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Sv=r(function(e,t){return f(ts,jl(e),jl(t))}),Tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return wv(D(e,{inputs:f(Ev,r,f(Cv,"",e.inputs))}))},wv=function(e){var t=Tv(e),n=mv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(bv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(pv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(dv,t.filters,r)});return D(t,{filterFunc:s})},Iv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Av={$:"Expires"},Bv=function(e){return L(wv({errors:yv,filterFunc:pv,filters:co(M([f(vo,!0,!0),d(So,!0,!1,!1,!1)])),inputs:Iv,showCurrencyDropdown:!1,tradeTable:_o(L(Av,Lo)),wallet:e}),Do)},kv=r(function(e,t){var r=f(ml,wc(e),t.inputs.paymentMethodTerms);return wv(D(t,{inputs:f(Ev,r,t.inputs)}))}),Nv=function(e){return wv(D(e,{filterFunc:pv,inputs:Iv}))},Rv=function(e){return{$:"TradeTableMsg",a:e}},$v=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),_v=function(e){return d($v,e,Do,Fo,yr)},Lv=r(function(e,t){return D(t,{fiatType:e})}),xv=r(function(e,t){return D(t,{maxDai:e})}),Pv=r(function(e,t){return D(t,{minDai:e})}),Dv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return _v(D(t,{inputs:f(Pv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return _v(D(t,{inputs:f(xv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return _v(D(t,{inputs:f(Lv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return _v(D(t,{inputs:(n?Lv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return _v(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return _v(D(t,{inputs:f(Cv,r,t.inputs)}));case"AddSearchTerm":return _v(Tv(t));case"RemoveTerm":var a=e.a;return _v(f(kv,a,t));case"ApplyInputs":return d($v,wv(t),Do,Fo,yr);case"ResetSearch":return _v(Nv(t));case"FiltersMsg":var i=e.a;return _v(wv(D(t,{filters:f(Jf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(nl,o,t.tradeTable);return d($v,D(t,{tradeTable:u.model}),f(il,Rv,u.cmd),f(Yo,Rv,u.chainCmd),f(xa,Ji(Rv),u.appCmds));case"NoOp":return _v(t);default:var s=e.a;return d($v,t,Do,Fo,M([s]))}}),Uv=a(function(e,t,r,n){return e(Cl(M([L("title",hl(t)),L("body",function(){if("Nothing"===r.$)return bl;var e=r.a;return hl(e)}()),L("image",function(){if("Nothing"===n.$)return bl;var e=n.a;return hl(e)}())])))}),Ov=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Mv=function(e){return e.a+"="+e.b},Fv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Mv,e)):""},Vv=r(function(e,t){return"/"+(f(Ri,"/",e)+Fv(t))}),Kv=function(e){switch(e.$){case"Home":return f(Vv,M(["DAIHard"]),yr);case"Create":return f(Vv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Vv,M(["DAIHard","trade",Ov(t),Ni(r)]),yr);case"Marketplace":return f(Vv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Vv,M(["DAIHard","history",dl(n)]),yr);default:return f(Vv,yr,yr)}},Hv={$:"NotFound"},jv=function(e){return{$:"AgentHistory",a:e}},qv={$:"Create"},Gv={$:"Home"},zv={$:"Marketplace"},Yv=function(e){return{$:"Parser",a:e}},Wv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Jv=r(function(e,t){return Yv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Wv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Qv=f(Jv,"ADDRESS",f(zo,Ph,Yd)),Xv={$:"Eth"},Zv={$:"Kovan"},ey=f(Jv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Xv));case"keth":return si(Zi(Zv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Dg));case"xdai":return si(Zi(to));default:return ci}}),ty=f(Jv,"NUMBER",rd),ry=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Wv,r,n,a,i,e(o))}),ny=r(function(e,t){var r=t.a;return Yv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,ry(u),r(h(Wv,n,a,i,o,e)))})}),ay=function(e){return l(La,oo,yr,e)},iy=r(function(e,t){return ay(f(xa,e,t))}),oy=function(e){return Yv(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 R(u,e)?M([h(Wv,f(ka,u,r),s,a,i,o)]):yr}return yr})},uy=r(function(e,t){var r=e.a,n=t.a;return Yv(function(e){return f(iy,n,r(e))})}),sy=Yv(function(e){return M([e])}),cy=f(uy,oy("DAIHard"),function(e){return Yv(function(t){return f(iy,function(e){return(0,e.a)(t)},e)})}(M([f(ny,Gv,sy),f(ny,qv,oy("create")),f(ny,Qf,f(uy,oy("trade"),f(uy,ey,ty))),f(ny,zv,oy("marketplace")),f(ny,jv,f(uy,oy("history"),Qv)),f(ny,function(e){return jv(e)},f(uy,oy("history"),Qv))]))),fy=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 si(t.value)}return si(t.value)}return ci}},ly=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ly(r))}return yr}return yr},dy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ly(r)}var r=t;return ly(r)},hy=Qt,py=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),gy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=hy(n);if("Nothing"===o.$)return t;var u=o.a,s=hy(i);if("Nothing"===s.$)return t;var c=s.a;return l(bp,u,py(c),t)}return t}),vy=function(e){if("Nothing"===e.$)return cp;var t=e.a;return l(La,gy,cp,f(_i,"&",t))},yy=r(function(e,t){var r=e.a;return fy(r(h(Wv,yr,dy(t.path),vy(t.query),t.fragment,Ua)))}),my=function(e){return f(xc,Hv,f(yy,cy,e))},by=aa,Cy=r(function(e,t){return f(by,e,Kv(t))}),Ey=je("connectToWeb3",function(e){return bl}),Sy=function(e){return Cl(M([L("event",hl(e.event)),L("category",hl(e.category)),L("label",hl(e.label)),L("value",wl(e.value))]))},Ty=r(function(e,t){return Cl(M([L("address",hl(dl(e))),L("signSeedMsg",hl(t))]))}),wy=je("gTagOut",Ua),Iy=je("genPrivkey",Ua),Ay=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),By=n(function(e,t,r){return f(Io,Zc(t),f(Bo,function(e){return e.trades},f(Ay,function(t){return R(t.factory,e)},r)))}),ky=je("notifyPort",Ua),Ny=je("requestNotifyPermissionPort",function(e){return bl}),Ry=r(function(e,t){return D(t,{wallet:e})}),$y=r(function(e,t){return L(f(Jd,t.inputs,D(t,{wallet:e})),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(eg,n,r.address,rh(eo(n)),Sg(n))}return Do}())}),_y=r(function(e,t){return D(t,{wallet:e})}),Ly=function(e){return{$:"AllowanceFetched",a:e}},xy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Gd(e),Mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Mg(e),si(i.factory))?d(eg,a,n.address,i.creationInfo.address,Ly):Do}return Do}())}),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{$:"TradeModel",a:e}},Fy=function(e){return{$:"TradeMsg",a:e}},Vy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Do);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Dy(a),f(il,Uy,i));case"TradeModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(il,Fy,c));case"MarketplaceModel":var l=t.a;return L(Oy(f(_y,e,l)),Do);default:var d=t.a;return L(Py(f(Ry,e,d)),Do)}}),Ky=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Hy=function(e){return{$:"PartiallyLoadedTrade",a:e}},jy=r(function(e,t){return Hy(g(Ky,e,t,ci,ci,ci,ci,ci))}),qy=function(e){return{$:"CurrentBlockFetched",a:e}},Gy=gu(f(zo,cu,Nh)),zy=function(e){return Up({decoder:Gy,method:"eth_blockNumber",params:yr,url:e})},Yy=function(e){return f(Zp,qy,zy(e))},Wy=r(function(e,t){return{address_:e,blocknum:t}}),Jy=function(e){return Wo(function(t){return li(L(t,e))})},Qy=n(function(e,t,r){var n=t.a,a=r.a;return Wo(function(t){return f(Wh,function(t){var r=t.a,n=t.b;return f(au,rl(e(n)),a(r))},n(t))})}),Xy=r(function(e,t){return l(Qy,r(function(e,t){return e(t)}),t,e)}),Zy=vu(f(Xy,jh,f(Xy,Dh,Jy(Wy)))),em=r(function(e,t){return{data:si(f(Gf,"createdTrades(uint256)",M([uh(t)]))),decoder:Zy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tm=n(function(e,t,r){return f(Zp,r,f(Fp,Xh(e),f(em,rh(e),t)))}),rm=function(e){return{$:"CreationInfoFetched",a:e}},nm=r(function(e,t){return l(tm,e,qu(t),rm)}),am=function(e){return{$:"EventSentryMsg",a:e}},im=function(e){return{$:"BlockNumber",a:e}},om=function(e){return{$:"EventSentry",a:e}},um=function(e){return{$:"Set_elm_builtin",a:e}},sm=um(cp),cm=r(function(e,t){return L(om({blockNumber:ci,errors:yr,nodePath:t,pending:sm,ref:1,requests:cp,tagger:e,watching:sm}),f(Zp,f(zo,im,e),zy(t)))}),fm=function(e){return f(cm,am,Xh(e))},lm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},hm=dm(f(lm,ci,ci)),pm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:Co,secureCommInfo:hm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),gm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),vm=n(function(e,t,r){var n=f(nm,t,r),a=fm(t),i=a.a,o=a.b;return d(gm,l(pm,f(jy,t,r),i,e),Po(M([n,o,Yy(Xh(t))])),Fo,M([ha]))}),ym=function(e){return{$:"LoadedTrade",a:e}},mm=r(function(e,t){var r=fm(t.factory),n=r.a,a=r.b;return d(gm,l(pm,ym(t),n,e),Po(M([a,Yy(Xh(t.factory))])),Fo,M([ha]))}),bm=function(e){return{data:si(f(Gf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Cm=function(e){return{data:si(f(Gf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Em=function(e){return{data:si(f(Gf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Sm=r(function(e,t){return{data:si(f(Gf,"initiatorStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Tm=function(e){return{data:si(f(Gf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},wm=function(e){return{data:si(f(Gf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Im=r(function(e,t){return{data:si(f(Gf,"responderStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Am=r(function(e,t){return{amount:t,fiatType:e}}),Bm=f(du,function(e){var t=cd(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("Can't convert that to a BigInt")},pu),km=l(Mi,Am,f(Fh,0,pu),f(Fh,1,Bm)),Nm={$:"Bank"},Rm={$:"Cash"},$m=function(e){switch(e){case"cash":return si(Rm);case"bank":return si(Nm);case"custom":return si(Fd);default:return ci}},_m=f(du,function(e){var t=$m(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("")},pu),Lm=l(Mi,Vd,f(Oh,"type",_m),f(Oh,"info",pu)),xm=oe,Pm=function(e){var t=l(Mi,sg,f(Oh,"price",km),f(Oh,"paymentmethods",xm(Lm)));return f(op,t,e)},Dm=r(function(e,t){return{commPubkey:t,responder:e}}),Um=r(function(e,t){var n=r(function(t,r){return l(Xo,t,t+2*r,e)}),a=f(zo,Nh,au(ti(2)));return f(Wh,function(t){return f(au,function(e){return f(n,t+64,e)},Nh(l(Xo,t,t+64,e)))},a(t))}),Om=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),Mm=n(function(e,t,r){var n=l(Ra,Om(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),Fm=j,Vm=function(e){return As(Fm(e))},Km=function(e){return l(Mm,r(function(e,t){return U(t,Vm(e))}),"",e)},Hm=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f(Wh,Km,f(Wh,f(zo,xa(Nh),Ah),f(au,ml(f(zo,_d,ns)),f(au,tc(2),f(Um,t,nu(r)))))))}),jm=f(dh,f(Mh,1,Hm),f(dh,f(Mh,0,Dh),Fi(Dm))),qm=r(function(e,t){return{commPubkey:t,terms:e}}),Gm=f(dh,f(Mh,1,Hm),f(dh,f(Mh,0,Hm),Fi(qm))),zm=function(e){return{statement:e}},Ym=f(dh,f(Mh,0,Hm),Fi(zm)),Wm=function(e){return{statement:e}},Jm=f(dh,f(Mh,0,Hm),Fi(Wm)),Qm={$:"AbortedEvent"},Xm={$:"BurnedEvent"},Zm={$:"ClaimedEvent"},eb=function(e){return{$:"CommittedEvent",a:e}},tb=function(e){return{$:"InitiatedEvent",a:e}},rb=function(e){return{$:"InitiatorStatementLogEvent",a:e}},nb={$:"PokeEvent"},ab={$:"RecalledEvent"},ib={$:"ReleasedEvent"},ob=function(e){return{$:"ResponderStatementLogEvent",a:e}},ub=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),sb=function(e){return ub(e)?li(nc(cu(e))):fi("Something in here is not very hexy: "+xh(e))},cb=gu(sb),fb=f(Oh,"topics",f(Fh,0,cb)),lb=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),Kf(f(xa,yi,Zs(e))))))},db=f(du,function(e){return R(e,lb("Initiated(string,string)"))?f(Oi,tb,Gm):R(e,lb("Committed(address,string)"))?f(Oi,eb,jm):R(e,lb("Recalled()"))?Fi(ab):R(e,lb("Claimed()"))?Fi(Zm):R(e,lb("Aborted()"))?Fi(Qm):R(e,lb("Released()"))?Fi(ib):R(e,lb("Burned()"))?Fi(Xm):R(e,lb("InitiatorStatementLog(string)"))?f(Oi,rb,Ym):R(e,lb("ResponderStatementLog(string)"))?f(Oi,ob,Jm):R(e,lb("Poke()"))?Fi(nb):hu("Unrecognized topic hash")},fb),hb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},pb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},gb=function(e){return R(e.buyerDeposit,Yl(e.tradeAmount))&&R(e.abortPunishment,zl(e.tradeAmount))},vb={$:"Invalid"},yb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),mb=r(function(e,t){return Vl(jd(t)+jd(e))}),bb=function(e){var t=Bd(Sd(e.amount));if("Just"===t.$){return t.a}f(cl,"Error converting FiatValue to float--string -> float failed!",e);return 0},Cb=r(function(e,t){return(t-e)/e}),Eb=r(function(e,t){var r=bb(t),n=kd(e);return"USD"===t.fiatType?si(f(Cb,n,r)):ci}),Sb=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 Vl(0)}}();return{margin:f(Eb,e.tradeAmount,r.price),phaseEndTime:function(){return"Closed"===t.phase.$?Vl(f(Nu,2,53)-1):f(mb,t.phaseStartTime,n)}()}}),Tb=function(e){var t=x(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 ym(v(yb,e.factory,e.id,n,a,o,u,s,l(Sb,a,o,u)))}return Hy(e)},wb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(cl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return vb}}),Ib=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return vb}}),Ab=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return vb}}),Bb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return ym(D(n,{state:e}));default:return vb}}),kb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return vb}}),Nb=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}}),Rb=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,uu,f(Xy,Dh,Jy(Nb))))))))))),$b=function(e){return{data:si(f(Gf,"getParameters()",yr)),decoder:Rb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},_b=function(e){return f(Bo,function(e){return Vl(1e3*e)},rd(Sd(e)))},Lb=function(e){return Hl(e)},xb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),Pb=function(e){var t=f($d,"error converting BigInt to Time.Posix",_b(e.autoabortInterval)),r=f($d,"error converting BigInt to Time.Posix",_b(e.autoreleaseInterval)),a=f($d,"error converting BigInt to Time.Posix",_b(e.autorecallInterval));return d(xb,n(function(t,r,n){return{abortPunishment:Lb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Lb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:Lb(e.pokeReward),tradeAmount:Lb(e.tradeAmount)}}),a,t,r)},Db=n(function(e,t,r){return f(Zp,r,f(jp,Pb,f(Fp,Xh(e),$b(t))))}),Ub=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}}}}}}}}}}},Ob=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(Ub)))))))))))),Mb=function(e){return{data:si(f(Gf,"getPhaseStartInfo()",yr)),decoder:Ob,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Fb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),Vb=function(e){return h(Fb,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}}),_b(e.v6),_b(e.v7),_b(e.v8),_b(e.v9))},Kb=n(function(e,t,r){return f(Zp,r,f(jp,Vb,f(Fp,Xh(e),Mb(t))))}),Hb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),jb=vu(f(Xy,jh,f(Xy,Dh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(Hb))))))),qb=function(e){return{data:si(f(Gf,"getState()",yr)),decoder:jb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Gb={$:"Aborted"},zb={$:"Burned"},Yb={$:"NotClosed"},Wb={$:"Recalled"},Jb={$:"Released"},Qb=function(e){switch(f(xc,99,rd(Sd(e)))){case 0:return si(Yb);case 1:return si(Wb);case 2:return si(Gb);case 3:return si(Jb);case 4:return si(zb);default:return ci}},Xb=function(e){switch(f(xc,99,rd(Sd(e)))){case 1:return si(Co);case 2:return si(mo);case 3:return si(bo);case 4:return si(yo);default:return ci}},Zb=function(e){return R(e,th("0x0000000000000000000000000000000000000000"))?ci:si(e)},eC=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),tC=function(e){var t=_b(e.phaseStartTimestamp),r=Xb(e.phase),a=Qb(e.closedReason);return d(eC,n(function(t,r,n){return{balance:Lb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:Zb(e.responder)}}),r,t,a)},rC=n(function(e,t,r){return f(Zp,r,f(jp,tC,f(Fp,Xh(e),qb(t))))}),nC=i(function(e,t,r,n,a){return Po(M([l(Db,e,t,r),l(rC,e,t,n),l(Kb,e,t,a)]))}),aC=function(e){var t=Rg(e);if("Just"===t.$){return t.a}f(cl,"Warning! BigInt to Int conversion failed!",Sd(e));return 0},iC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),oC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),uC=function(e){return e.b?l(oC,e,yr,0):qa},sC=tn,cC=function(e){var t=h(sC,iC,f(Oh,"encapsulation",pu),f(Oh,"iv",pu),f(Oh,"tag",pu),f(Oh,"encrypted",pu)),r=xm(t),n=f(Gh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Zc,0,e),f(Zc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(uC(i))},fC=function(e){var t=function(e){var t=Qo(e);return t>1114111?fi("string is too long"):li(f(Is,Fm(t),e))};return f(au,Ri(""),Ah(f(xa,t,e)))},lC=function(e){var t=e.a,r=e.b;return fC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},dC=r(function(e,t){return Cl(M([L("message",hl(e)),L("pubkeyHexStrings",f(zh,hl,M([t.initiatorPubkey,t.responderPubkey])))]))}),hC=function(e){return{$:"LoadedCommInfo",a:e}},pC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),gC=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 hC(f(pC,r,n))}return dm(e)},vC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return gC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return hC(D(n,{initiatorPubkey:e}))}),yC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return gC(D(r,{responderPubkey:si(e)}))}var n=t.a;return hC(D(n,{responderPubkey:e}))}),mC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),bC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(nd,a,n),o=$s(f(lc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),CC=function(e){var t=uC(f(bC,Zs(e),yr));return l(zd,uv,h(Fb,iC,f(Zc,0,t),f(Zc,1,t),f(Zc,2,t),f(Zc,3,t)),h(Fb,iC,f(Zc,4,t),f(Zc,5,t),f(Zc,6,t),f(Zc,7,t)))},EC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),SC={$:"Aborted"},TC={$:"Burned"},wC={$:"Claimed"},IC=function(e){return{$:"Committed",a:e}},AC=function(e){return{$:"Encrypted",a:e}},BC={$:"FailedDecode"},kC={$:"Initiated"},NC={$:"Recalled"},RC={$:"Released"},$C=function(e){return{$:"StateChange",a:e}},_C=function(e){return{$:"Statement",a:e}},LC=fr,xC=cr,PC=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(LC,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(xC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),DC=or,UC=y,OC=a(function(e,t,r,n){var a=Wc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(DC,Ga(r),n);var i=za(d(OC,e-Ha,t,r,ja));return f(DC,i,n)}var o=f(Jc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(OC,e-Ha,t,r,u));return l(rf,a,i,n)}var i=za(d(OC,e-Ha,t,r,UC(o)));return l(rf,a,i,n)}),MC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(OC,c,r,e,UC(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(OC,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),FC=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(LC,32,r,e),o=f(MC,i,t);if(a<0){var u=l(xC,a,n,e);return f(MC,u,o)}return o}),VC=ur,KC=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(VC,i,t,r)}return f(ka,e,t)});return{nodeList:l(VC,i,yr,n),nodeListSize:t/32|0,tail:a}},HC=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(VC,o,t,r)}var n=e.a;return f(FC,n,t)});return f(FC,i,l(VC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(VC,o,t,r)}var n=e.a;return f(PC,n,t)});return f(ai,!0,f(PC,i,l(VC,o,KC(e),a)))}),jC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),qC=f(La,jC,yr),GC=n(function(e,t,r){var n=mC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si($C(kC));case"CommittedEvent":var r=t.a;return si($C(IC(r.responder)));case"RecalledEvent":return si($C(NC));case"ClaimedEvent":return si($C(wC));case"AbortedEvent":return si($C(SC));case"ReleasedEvent":return si($C(RC));case"BurnedEvent":return si($C(TC));case"InitiatorStatementLogEvent":var r=t.a;return si(_C({blocknum:e,message:function(){var e=CC(r.statement);if("Just"===e.$){var t=e.a;return AC(t)}return BC}(),who:n(To)}));case"ResponderStatementLogEvent":var r=t.a;return si(_C({blocknum:e,message:function(){var e=CC(r.statement);if("Just"===e.$){var t=e.a;return AC(t)}return BC}(),who:n(wo)}));default:return ci}}(),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(HC,r.history,uC(qC(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Bo,EC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),qC(M([s])))}),zC=Gr,YC=function(e){var t=l(Mi,uv,f(Oh,"id",zC),f(Oh,"message",pu));return f(Hd,Di,f(Gh,t,e))},WC=function(e){return{$:"Decrypted",a:e}},JC=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),QC=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(GC,n,a,t),o=i.a,u=i.b,s=i.c;return d(JC,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(JC,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(JC,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=YC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Zc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:WC(y)}),T=D(b,{eventInfo:_C(S)}),w=l(af,v,T,t.history);return d(JC,D(t,{history:w}),!1,ci,yr)}return d(JC,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an event that is not a message!",b))]))}return d(JC,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(JC,t,!1,ci,M([pa(f(ll,"Error decoding decryption result",I))]))}}),XC=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),ZC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),eE=function(e){return{onBroadcast:ci,onMined:si(L(XC(e),ci)),onSign:si(ZC(e))}},tE=je("encryptToPubkeys",Ua),rE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),nE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),aE=function(e){return{$:"CommitMined",a:e}},iE={$:"CommitNeedsSig"},oE=function(e){return{$:"CommitSigned",a:e}},uE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?nE:rE}(),a=al(function(){return"Token"===e.factory.$?Ua:pg(jl(hb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(iE),f(qo,{onBroadcast:ci,onMined:si(L(aE,ci)),onSign:si(oE)},a))}),sE=r(function(e,t){return Cl(M([L("id",wl(e)),L("encapsulation",hl(t.encapsulatedKey)),L("iv",hl(t.iv)),L("tag",hl(t.tag)),L("encrypted",hl(t.message))]))}),cE=je("decryptMessage",Ua),fE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},lE=r(function(e,t){return Po(f(xa,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 cE(f(sE,r,s))}return Do}return Do},fE(e.history)))}),dE=function(e){if("Just"===e.$){return e.a}return ci},hE=function(e){var t=dE(l(zd,Ao,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Bo,function(e){return e.address},Gd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(lE,n,a)}return Do},pE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(GC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),gE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),vE=i(function(e,t,r,n,a){return f(pE,n,p(gE,e,r,t,qa,a,""))}),yE=function(e){return{$:"ChatHistoryMsg",a:e}},mE=a(function(e,t,r,n){var a=x(t,Gd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(ko,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(yE),n))}(h(vE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),bE={$:"Abort"},CE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),EE=function(e){return{$:"ActionNeedsSig",a:e}},SE=function(e){return{$:"ApproveMining",a:e}},TE={$:"ApproveNeedsSig"},wE=function(e){return{$:"ApproveSigned",a:e}},IE={$:"Burn"},AE={$:"Claim"},BE=function(e){return{$:"CommitMining",a:e}},kE=function(e){return{$:"ConfirmingAction",a:e}},NE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),RE=function(e){return{$:"EventLogFetched",a:e}},$E=function(e){return{$:"ParametersFetched",a:e}},_E=function(e){return{$:"PhaseInfoFetched",a:e}},LE={$:"Poke"},xE={$:"Recall"},PE={$:"Release"},DE=function(e){return{$:"StartContractAction",a:e}},UE=function(e){return{$:"StateFetched",a:e}},OE=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"}},ME=function(e){return d(gm,e,Do,Fo,yr)},FE={align:ul,label:"cantFindTradeWillRetry",mainParagraphs:M([M([fl("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:$g},VE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(_g,e,r)}if("Nothing"===t.a.$){t.a;return f(ll,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ll,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),KE={align:ul,label:"tradeParametersNotDefault",mainParagraphs:M([M([fl("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:$g},HE=eo(Xi),jE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),qE=n(function(e,t,r){return l(bp,e,Bo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),GE=r(function(e,t){var r=t.a;return um(f(mp,e,r))}),zE=n(function(e,t,r){var n=e.a,a=f(fp,t,n.requests);if("Nothing"===a.$)return L(om(n),Do);var i=a.a,o=L(i.watchOnce,Ql(r));if("Nothing"===o.b.$){o.b;return L(om(D(n,{requests:l(qE,t,r,n.requests)})),Do)}if(o.a){var u=o.b.a;return L(om(D(n,{requests:l(qE,t,r,n.requests),watching:f(GE,t,n.watching)})),f(Yg,i.tagger,xp(u)))}return L(om(D(n,{requests:l(qE,t,r,n.requests)})),Po(f(xa,function(e){return f(Yg,i.tagger,xp(e))},r)))}),YE=_e,WE=r(function(e,t){return f(Zp,f(zo,im,t),f(Kp,function(t){return zy(e)},YE(2e3)))}),JE=ue,QE=ce,XE=Yr,ZE=n(function(e,t,r){var n=function(e){return QE(M([e,JE(r)]))};return f(du,function(a){var i=f(Gh,e,a);if("Ok"===i.$){var o=i.a,u=f(Gh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return hu(Di(c))}return Fi(r)},XE)}),eS=a(function(e,t,r,n){return f(dh,l(ZE,f(Oh,e,XE),t,r),n)}),tS=n(function(e,t,r){return f(dh,f(Oh,e,t),r)}),rS=gu(Ph),nS=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),aS=function(e){return{$:"BlockHash",a:e}},iS=function(e){return nS(e)?li(aS(cu(e))):fi("Given blockHash "+xh(e)+" is not valid.")},oS=gu(iS),uS=function(e){return{$:"TxHash",a:e}},sS=function(e){return nS(e)?li(uS(cu(e))):fi("Given txHash "+xh(e)+" is not valid.")},cS=gu(sS),fS=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}}),lS=zr,dS=l(tS,"blockNumber",Gy,l(tS,"blockHash",oS,l(tS,"transactionHash",cS,l(tS,"transactionIndex",Gy,l(tS,"logIndex",Gy,d(eS,"removed",lS,!1,l(tS,"topics",xm(cb),l(tS,"data",pu,l(tS,"address",rS,Fi(fS)))))))))),hS=function(e){return f(zh,function(e){if("Just"===e.$){var t=e.a;return hl(qf(t))}return bl},e)},pS=function(e){return Cl(M([L("fromBlock",Zh(e.fromBlock)),L("toBlock",Zh(e.toBlock)),L("address",pl(e.address)),L("topics",hS(e.topics))]))},gS=r(function(e,t){return Up({decoder:xm(dS),method:"eth_getLogs",params:M([pS(t)]),url:e})}),vS=function(e){return{$:"BlockNum",a:e}},yS=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Kp,function(r){return f(jp,vi(r),f(gS,e,D(t,{fromBlock:vS(n),toBlock:vS(a)})))},f(gS,e,t)):f(gS,e,t)}),mS=n(function(e,t,r){var n=r.a,a=r.b;return f(gS,e,D(t,{fromBlock:vS(n),toBlock:vS(a)}))}),bS=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(bS,e,t,i)),c=o;e=u,t=s,r=c}}),CS=r(function(e,t){return l(bS,xl,t,e)}),ES=r(function(e,t){var r=e.a,n=t.a;return um(f(CS,r,n))}),SS=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 Po(f(xa,function(t){return f(Zp,f(zo,jE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},qC(f(xa,function(e){return f(fp,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(om(D(r,{blockNumber:si(a)})),Po(M([f(WE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,mS)]))):L(t,f(WE,r.nodePath,r.tagger))}return L(om(D(r,{blockNumber:si(a),pending:sm,watching:f(ES,r.watching,r.pending)})),Po(M([f(WE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,yS),l(i,L(a,a),r.watching,mS)])))}var s=e.a.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),f(WE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(zE,t,c,d)}var s=e.b.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),Do)}),TS=r(function(e,t){var r=t.a;return um(l(xl,e,gr,r))}),wS=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(xl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(om(D(o,{watching:f(TS,a.ref,o.watching)})),f(Zp,f(zo,jE(a.ref),a.tagger),e),a.ref)}(l(yS,a.nodePath,n,L(s,s)))}return x(om(D(o,{pending:f(TS,a.ref,o.pending)})),Do,a.ref)}),IS=wS(!1),AS=function(e){return M([e])},BS=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(nm,r.factory,r.id):Do}}(),function(){var e=x(Gd(t.wallet),Mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Mg(t.wallet),si(a.factory))?d(eg,n,r.address,a.creationInfo.address,Ly):Do}return Do}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(mE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?hE(t):Do,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(gm,u,Po(M([l(rC,p.factory,p.creationInfo.address,UE),s,r])),Fo,o)}return ME(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return ME(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(ts,m,jl(hb(C.parameters))),ba))return ME(u);var S=l(uE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(gm,D(u,{txChainStatus:T}),Do,w,yr)}return ME(u)}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:aC(I.blocknum)},B=l(IS,RE,t.eventSentry,{address:A.address,fromBlock:vS(A.blocknum),toBlock:Mp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(wb,A,t.trade)}),$=f(xc,HE,pb(u.trade)),_=Po(M([N,h(nC,$,A.address,$E,UE,_E)]));return d(gm,u,_,Fo,yr)}if("BadBody"===g.a.$){g.a.a;return d(gm,t,Do,Fo,M([pa(FE)]))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(Bb,P,t.trade)});return d(gm,u,hE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(VE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(gb(F)){var u=D(t,{trade:f(Ib,F,t.trade)});return d(gm,u,hE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(KE)]))}var V=g.a.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Ab,H,t.trade)});return d(gm,u,hE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(VE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Yh,db,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(vC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(yC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=Pm(e.terms);if("Ok"===r.$){var n=r.a;return L(f(kb,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ll,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(yE),n))}(l(GC,q.blockNumber,Y,r))}return d(mE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?hE(u):Do;return d(gm,u,_,Fo,f(oo,f(xa,pa,qC(M([X]))),o));case"ExpandPhase":var te=e.a;return ME(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return ME(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return ME(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(gm,t,Do,Fo,M([da(jv(C.parameters.initiatorAddress))]))}return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return ME(D(t,{txChainStatus:si(f(NE,E,ie))}));case"AbortAction":return ME(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(uE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=al(l(sh,nh(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(wE)};return f(qo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(ts,i,jl(hb(C.parameters))),ba)?L(si(TE),n):l(uE,C,E.address,E.commPubkey)}return L(si(TE),n)}(),T=oe.a,w=oe.b;return d(gm,D(t,{txChainStatus:T}),Do,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,LE)||R(ue,xE)){var se=DE(ue),ce=t;e=se,t=ce;continue e}return ME(D(t,{txChainStatus:si(kE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Fo,M([pa(f(ll,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=al(Tm(n.creationInfo.address));return x(si(EE(xE)),f(qo,eE(xE),a),yr);case"Claim":var a=al(Em(n.creationInfo.address));return x(si(EE(AE)),f(qo,eE(AE),a),yr);case"Abort":var a=al(bm(n.creationInfo.address));return x(si(EE(bE)),f(qo,eE(bE),a),yr);case"Release":var a=al(wm(n.creationInfo.address));return x(si(EE(PE)),f(qo,eE(PE),a),yr);case"Burn":var a=al(Cm(n.creationInfo.address));return x(si(EE(IE)),f(qo,eE(IE),a),yr);default:var a=al(zf(n.creationInfo.address));return x(si(EE(LE)),f(qo,eE(LE),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(gm,D(t,{txChainStatus:T}),Do,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return ME(D(t,{txChainStatus:si(SE(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return ME(D(t,{txChainStatus:si(BE(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"commit",V))]));case"CommitMined":return ME(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return ME(D(t,{txChainStatus:si(f(CE,ue,he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,OE(ue),V))]));case"ActionMined":var ue=e.a;return ME(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(SS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(gm,D(t,{eventSentry:ve}),_,Fo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(QC,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?hE(t):Do,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(tE(f(dC,r,a)),ci)}return L(Do,si(f(ll,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Do,ci)}(),Te=Se.a,we=Se.b;return d(gm,Ee,Po(M([s,Te])),Fo,U(f(Qi,yE,Ce.appCmds),f(xc,yr,f(Bo,AS,f(Bo,pa,we)))))}return d(gm,t,Do,Fo,M([pa(f(ll,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Wh,lC,cC(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Ao,p,E.address);if("Nothing"===Ne.$)return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return al("Initiator"===Re.$?f(Sm,p.creationInfo.address,ke):f(Im,p.creationInfo.address,ke))}();return d(gm,t,Do,f(qo,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(gm,t,Do,Fo,M([pa(f(ll,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return ME(t)}var V=e.a.a;return d(gm,t,Do,Fo,M([pa(f(Lg,"message",V))]));default:return d(gm,t,Do,Fo,M([ga]))}}),kS=r(function(e,t){return{address:e,blocknum:t}}),NS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},RS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(wS,!0,e,t,r))}),$S=n(function(e,t,r){var n=function(e){return r(f(Yh,Gm,e).returnData)},a={address:t.address,fromBlock:vS(t.blocknum),toBlock:vS(t.blocknum),topics:M([si(lb("Initiated(string,string)"))])};return l(RS,n,e,a)}),_S=function(e){return{data:si(f(Gf,"numTrades()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},LS=r(function(e,t){return f(Zp,t,f(Fp,Xh(e),_S(rh(e))))}),xS=function(e){return{data:si(f(Gf,"phase()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},PS=n(function(e,t,r){return f(Zp,r,f(jp,Xb,f(Fp,Xh(e),xS(t))))}),DS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),US=r(function(e,t){return l(La,DS(e),yr,t)}),OS=function(e){return f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},MS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},FS=function(e){return f(MS,Ja(vb),Sa(e.trades))},VS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:FS(e),loaded:Ti(OS(e))})})},KS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),HS=r(function(e,t){var r=f(Zc,e,t.trades);if("Just"===r.$){var n=(r.a,l(af,e,vb,t.trades));return l(KS,VS(D(t,{trades:n})),Do,yr)}return l(KS,t,Do,M([pa(f(ll,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),jS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(wb,t,a),o=l(af,e,i,r.trades);return L(VS(D(r,{trades:o})),yr)}return L(r,M([f(ll,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),qS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Ib,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(af,e,ym(D(a,{state:D(i,{phase:t})})),r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),zS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Ab,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),YS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Bb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),WS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(kb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),JS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),QS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),XS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),ZS=function(e){return{$:"NumTradesFetchedAgain",a:e}},eT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),tT=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),rT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),nT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),aT=function(e){return l(KS,e,Do,yr)},iT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=aC(n),i=uC(f(xa,jy(t.factory),f(Ai,0,a-1))),o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,0,a-1)));return l(KS,D(t,{dataFetchState:l(QS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CheckForNewTrades":return l(KS,t,f(LS,t.factory,ZS),yr);case"UpdateTradePhases":var s=Po(qC(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(PS,e.factory,e.creationInfo.address,f(tT,e.factory,e.id)))},OS(t))));return l(KS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(GS,d,p,t),v=function(){var e=L(p,f(Zc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=NS(r);if("Just"===n.$){var a=n.a;return L(l(rC,c,a.address,nT(d)),yr)}return L(Do,M([pa(f(ll,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Do,yr)}e.b;return L(Do,M([pa(f(ll,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(KS,g.tradeCache,Po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(KS,t,Do,M([pa(f(VE,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=aC(n);if(_(C,E)<0){var S=t.dataFetchState,o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,C,E-1))),T=uC(f(xa,jy(t.factory),f(Ai,C,E-1)));return l(KS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(HC,t.trades,T)}),o,yr)}return aT(t)}b.b;return l(KS,t,Do,M([pa(f(ll,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(kS,w.address_,aC(w.blocknum)),A=l($S,t.eventSentry,I,XS(d)),B=A.a,k=A.b,y=Po(M([h(nC,t.factory,I.address,eT(d),nT(d),rT(d)),k])),N=l(jS,d,I,t),R=N.a,$=N.b;return l(KS,VS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(KS,t,Do,M([pa(f(_g,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(qS,d,P,t)}var U=r.a.a;return l(KS,t,Do,M([pa(f(ll,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(YS,d,O,t)}return l(KS,t,Do,M([pa(f(VE,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(zS,d,F,t)}return l(KS,t,Do,M([pa(f(VE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=Pm(V.terms);if("Ok"===K.$){var H=K.a;return l(WS,d,H,t)}var j=K.a;return f(HS,d,t)}var j=r.a;return l(KS,t,Do,M([pa(f(ll,"Error decoding initiated event",j))]));default:var q=e.a,G=f(SS,q,t.eventSentry),z=G.a,y=G.b;return l(KS,D(t,{eventSentry:z}),y,yr)}}),oT=function(e){return{$:"AgentHistoryMsg",a:e}},uT=function(e){return{$:"AppCmd",a:e}},sT={$:"BetaLandingPage"},cT={$:"ConnectToWeb3"},fT=function(e){return{$:"MarketplaceMsg",a:e}},lT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),dT=r(function(e,t){return f(kn,e,hl(t))}),hT=function(e){return f(dT,"href",tt(e))},pT=Nn("rel"),gT=dT("target"),vT=function(e){return{$:"Height",a:e}},yT=vT,mT={$:"Content"},bT=mT,CT=function(e){return{$:"Width",a:e}},ET=CT,ST=function(e){return{$:"Attr",a:e}},TT=function(e){return{$:"NodeName",a:e}},wT=function(e){return{$:"Unkeyed",a:e}},IT={$:"AsEl"},AT=IT,BT=r(function(e,t){return{$:"Field",a:e,b:t}}),kT=f(BT,0,0),NT={$:"NoNearbyChildren"},RT={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"},$T=RT.any+" "+RT.column,_T=RT.any+" "+RT.grid,LT=RT.any+" "+RT.page,xT=RT.any+" "+RT.paragraph,PT=RT.any+" "+RT.row,DT=RT.any+" "+RT.single,UT=function(e){switch(e.$){case"AsRow":return PT;case"AsColumn":return $T;case"AsEl":return DT;case"AsGrid":return _T;case"AsParagraph":return xT;default:return LT}},OT=function(e){return{$:"Keyed",a:e}},MT={$:"NoStyleSheet"},FT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),VT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),KT={$:"AsParagraph"},HT=KT,jT=Sn("div"),qT=Sn("p"),GT=Sn("s"),zT=Sn("u"),YT=dT("className"),WT=function(e){return wn(Xe(e))},JT=function(e){return Sn(Xe(e))},QT=function(e){return{$:"Flag",a:e}},XT=function(e){return{$:"Second",a:e}},ZT=function(e){return e>31?XT(1< .ctr > ."+RT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",eI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+" { flex-basis: auto !important; } "+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+Ew(RT.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"+Zw,tI=function(e){return{$:"Intermediate",a:e}},rI=r(function(e,t){return tI({closing:t,others:yr,props:yr,selector:e})}),nI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,tI({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(nI,f(rI,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(nI,f(rI,n.selector,""),v),t.others)})}});return tI(l(La,a,n,t))}),aI=U(eI,function(e){var t=function(e){return Cd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Cd(f(xa,a,t.others)))};return Cd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(nI,f(rI,r,""),n),t)}),yr,e)))}(U(Jw,Xw))),iI=l(JT,"style",yr,M([Tw(aI)])),oI=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+'"'}},uI=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}},sI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ch,uI,t.variants)}return!1},cI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),fI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),lI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(fI,"."+e+"."+t+", ."+e+" ."+t,n),f(fI,"."+e+"."+t+"> ."+RT.text+", ."+e+" ."+t+" > ."+RT.text,a)])}),dI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(lI,i,RT.sizeByCapital,a),l(lI,i,RT.fullSize,n)))}),hI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(fI,"."+r+"."+RT.sizeByCapital+", ."+r+" ."+RT.sizeByCapital,M([L("line-height","1")])),f(fI,"."+r+"."+RT.sizeByCapital+"> ."+RT.text+", ."+r+" ."+RT.sizeByCapital+" > ."+RT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),pI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},gI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Tc,t,r))}return ci},vI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),yI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(xc,e.descender,gI(t)),n=f(xc,e.baseline,gI(f(ml,function(e){return!R(e,r)},t))),a=f(xc,e.capital,pI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(vI,i,a-n,o),full:l(vI,u,a-r,s)}},mI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",mw(e.height)),L("vertical-align",mw(e.vertical)+"em"),L("font-size",mw(e.size)+"em")]))},bI=function(e){return l(Ra,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 si(L(mI(function(e){return e.full}(yI(a))),mI(function(e){return e.capital}(yI(a)))))}return t}return t}),ci,e)},CI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(US,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=bI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,hI(t),n));var i=a.a;return f(Ri,"",f(xa,f(dI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},EI=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+'" '+Ni(r)}},SI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,EI,t.variants)))}return ci},TI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},wI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+mw(r)+"px, "+mw(n)+"px, "+mw(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("+mw(o)+"px, "+mw(u)+"px, "+mw(s)+"px)",b="scale3d("+mw(f)+", "+mw(l)+", "+mw(d)+")",C="rotate3d("+mw(p)+", "+mw(g)+", "+mw(v)+", "+mw(y)+"rad)";return si(m+" "+b+" "+C)}},II=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,cI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,cI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,cI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,cI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+RT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+RT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+RT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,cI(!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,M([f(vw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Tc,1,1-c));return l(a,t,"."+u,M([f(vw,"opacity",mw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(vw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(US,SI,p)),v=M([f(vw,"font-family",f(Ri,", ",f(xa,oI,p))),f(vw,"font-feature-settings",g),f(vw,"font-variant",f(Ch,sI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(vw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(vw,s,bw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+RT.row,A="."+(RT.wrapped+I),B="."+RT.alignRight,k="."+RT.paragraph,N="."+RT.page,R="."+RT.alignLeft,$=mw(S/2)+"px",_=mw(E/2)+"px",x="."+RT.column,y="."+C,P="."+RT.any;return Cd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(vw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(vw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,U(y,k),M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,lw,F.rows))+"-cols-"+f(Ri,"-",f(xa,lw,F.columns))+"-space-x-"+lw(F.spacing.a)+"-space-y-"+lw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=wI(ne),y=hw(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,M([f(vw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=TI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(CI(s),c)}),AI=r(function(e,t){return l(JT,"style",yr,M([Tw(f(II,e,t))]))}),BI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",iI),f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)}),kI=a(function(e,t,r,n){return e?f(ka,iI,f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)):f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)}),NI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(WT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(BI,!1,e,t,r);default:var e=i.a,t=i.b;return d(BI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return jT;case"p":return qT;default:return JT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(kI,!1,e,t,n);default:var e=i.a,t=i.b;return d(kI,!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(JT,e,n,M([f(u,r,M([YT(RT.any+" "+RT.single)]))]))}}();switch(o.$){case"AsRow":return f(ow,sw,e)&&!f(ow,uw,e)?s:f(ow,tw,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerRight])))]),M([s])):f(ow,rw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(ow,iw,e)&&!f(ow,aw,e)?s:f(ow,nw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerCenterY])))]),M([s])):f(ow,ew,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerBottom])))]),M([s])):s;default:return s}}),RI=Tw,$I=function(e){return f(jT,M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthContent,RT.heightContent])))]),M([RI(e)]))},_I=function(e){return l(JT,"div",M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthFill,RT.heightFill])))]),M([Tw(e)]))},LI=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 R(e,HT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,HT),L(f(ka,L(n,f(s.html,MT,e)),i),Iu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,AT)?_I(c):$I(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 R(e,HT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,HT),L(f(ka,f(o.html,MT,e),n),Iu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,AT)?_I(u):$I(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children)),MT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children)),MT))}),xI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),PI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(BT,a|r,n)}var i=e.a;return f(BT,r,i|n)}),DI=ZT(7),UI=ZT(36),OI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(BT,r|a,n|i)}),MI=ZT(6),FI=ZT(38),VI=ZT(30),KI=ZT(29),HI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),jI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),qI=function(e){return{$:"Transform",a:e}},GI=function(e){return{$:"ChildrenBehind",a:e}},zI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),YI=function(e){return{$:"ChildrenInFront",a:e}},WI=r(function(e,t){return f(jT,M([YT(function(){switch(e.$){case"Above":return f(Ri," ",M([RT.nearby,RT.single,RT.above]));case"Below":return f(Ri," ",M([RT.nearby,RT.single,RT.below]));case"OnRight":return f(Ri," ",M([RT.nearby,RT.single,RT.onRight]));case"OnLeft":return f(Ri," ",M([RT.nearby,RT.single,RT.onLeft]));case"InFront":return f(Ri," ",M([RT.nearby,RT.single,RT.inFront]));default:return f(Ri," ",M([RT.nearby,RT.single,RT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Tw("");case"Text":var e=t.a;return $I(e);case"Unstyled":return(0,t.a)(AT);default:return f(t.a.html,MT,AT)}}()]))}),JI=n(function(e,t,r){var n=f(WI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?GI(M([n])):YI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?GI(f(ka,n,a)):f(zI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(zI,M([n]),i):YI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(zI,f(ka,n,a),i):f(zI,a,f(ka,n,i))}}),QI=r(function(e,t){switch(t.$){case"Generic":return TT(e);case"NodeName":var r=t.a;return f(HI,r,e);default:var n=t.a,a=t.b;return f(HI,n,a)}}),XI=function(e){switch(e.$){case"Left":return RT.alignedHorizontally+" "+RT.alignLeft;case"Right":return RT.alignedHorizontally+" "+RT.alignRight;default:return RT.alignedHorizontally+" "+RT.alignCenterX}},ZI=function(e){switch(e.$){case"Top":return RT.alignedVertically+" "+RT.alignTop;case"Bottom":return RT.alignedVertically+" "+RT.alignBottom;default:return RT.alignedVertically+" "+RT.alignCenterY}},eA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),tA=function(e){return{$:"Moved",a:e}},rA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return tA(x(r,0,0));case"MoveY":var n=t.a;return tA(x(0,n,0));case"MoveZ":var a=t.a;return tA(x(0,0,a));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(eA,x(0,0,0),i,x(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 tA(x(s,n,a));case"MoveY":var c=t.a;return tA(x(r,c,a));case"MoveZ":var f=t.a;return tA(x(r,n,f));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,u,x(1,1,1),i,o);default:var l=t.a;return d(eA,u,l,x(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(eA,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(eA,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(eA,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(eA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(eA,u,h,v,y);default:var m=t.a;return d(eA,u,m,p,o)}}}),nA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(kT,n,M([l(jI,n,"height",r+"px")]));case"Content":return x(f(PI,UI,kT),RT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(PI,iw,kT),RT.heightFill,yr):x(f(PI,iw,kT),RT.heightFillPortion+" height-fill-"+Ni(a),M([l(jI,RT.any+"."+RT.row+" > "+Ew("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(jI,u,"min-height",Ni(i)+"px"),c=nA(o),d=c.a,h=c.b,p=c.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(jI,u,"max-height",Ni(g)+"px"),v=nA(o),d=v.a,h=v.b,p=v.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p))}},aA=function(e){switch(e.$){case"Px":var t=e.a;return x(kT,RT.widthExact+" width-px-"+Ni(t),M([l(jI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(PI,FI,kT),RT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(PI,sw,kT),RT.widthFill,yr):x(f(PI,sw,kT),RT.widthFillPortion+" width-fill-"+Ni(r),M([l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(jI,i,"min-width",Ni(n)+"px"),u=aA(a),s=u.a,c=u.b,d=u.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(jI,i,"max-width",Ni(h)+"px"),p=aA(a),s=p.a,c=p.b,d=p.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d))}},iA=ZT(27),oA=r(function(e,t){if(R(e,iA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),uA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=hw(n);if("Nothing"===s.$)return{attributes:f(ka,YT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,YT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,qI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(oA,S,I)){var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(PI,S,r),y=f(rA,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(ow,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=RT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(PI,MI,r),y=n,m=f(ka,l(jI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+RT.widthContent,g=t,v=f(PI,FI,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+RT.widthFill,g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=aA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(ow,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(PI,DI,r),y=n,m=f(ka,l(jI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=RT.heightContent+" "+e,g=t,v=f(PI,UI,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=RT.heightFill+" "+e,g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.column+" > "+Ew("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=nA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(QI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(QI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(QI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(QI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(QI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(QI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(QI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return TT("p");case"NodeName":var e=t.a;return TT(e);default:var r=t.a,n=t.b;return f(HI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(JI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(ow,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=XI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(PI,rw,e);case"Right":return f(PI,tw,e);default:return e}}(f(PI,VI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(ow,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=ZI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(PI,nw,e);case"Bottom":return f(PI,ew,e);default:return e}}(f(PI,KI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),sA={$:"Untransformed"},cA=sA,fA=a(function(e,t,r,n){return l(LI,e,n,v(uA,UT(e),t,kT,cA,yr,yr,NT,$a(r)))}),lA=function(e){return ST(YT(e))},dA=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ST(gT("_blank")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e)))))),wT(M([n])))}),hA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),pA=n(function(e,t,r){return d(hA,e,t,r,1)}),gA=ZT(14),vA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),yA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),mA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return dw(t)+"-"+dw(r)+"-"+dw(n)+"-"+dw(a)},bA=function(e){return f(yA,gA,l(vA,"fc-"+mA(e),"color",e))},CA={align:ul,label:"cantConnectNoWeb3",mainParagraphs:M([M([fl("You need a web3 provider (such as "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(") to Connect.")]),M([fl("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:xg},EA={align:ul,label:"invalidUrl",mainParagraphs:M([M([fl("I don't understand that URL...")]),M([fl("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:$g},SA=function(e){return{$:"Active",a:e}},TA=gu(f(zo,jf,f(zo,Hh,$d("Error decoding hex to BigInt")))),wA=function(){return gu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),IA=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}}}}}}}}}}}},AA=function(e){return QE(M([f(Oi,si,e),Fi(ci)]))},BA=f(dh,AA(f(Oh,"status",wA)),f(dh,AA(f(Oh,"root",pu)),l(tS,"logsBloom",pu,l(tS,"logs",xm(dS),f(dh,AA(f(Oh,"contractAddress",rS)),l(tS,"cumulativeGasUsed",TA,l(tS,"gasUsed",TA,l(tS,"blockNumber",Gy,l(tS,"blockHash",oS,l(tS,"transactionIndex",Gy,l(tS,"transactionHash",cS,Fi(IA)))))))))))),kA=function(e){var t=e.a;return jf(t)},NA=f(zo,kA,hl),RA=r(function(e,t){return Up({decoder:BA,method:"eth_getTransactionReceipt",params:M([NA(t)]),url:e})}),$A=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),_A=r(function(e,t){return{$:"TxMined",a:e,b:t}}),LA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),xA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(Io,function(e){return e.b},f(Io,function(e){return e.onMinedTagger},f(fp,t,e))))}),PA=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}}}}}}}}}}}},DA=function(e){return QE(M([JE(ci),f(Oi,si,e)]))},UA=l(tS,"input",pu,l(tS,"gas",Gy,l(tS,"gasPrice",TA,l(tS,"value",TA,l(tS,"to",DA(rS),l(tS,"from",rS,l(tS,"transactionIndex",Gy,l(tS,"blockNumber",DA(Gy),l(tS,"blockHash",function(e){return f(du,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},cu(t))?Fi(ci):f(Oi,si,e)},pu)}(oS),l(tS,"nonce",Gy,l(tS,"hash",cS,Fi(PA)))))))))))),OA=r(function(e,t){return Up({decoder:UA,method:"eth_getTransactionByHash",params:M([NA(t)]),url:e})}),MA=r(function(e,t){return{attempts:e,sleep:t}}),FA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Xp,function(e){return a>0?f(Kp,function(e){return f(FA,f(MA,a,n),t)},YE(1e3*n)):Lp(e)},t)}),VA=r(function(e,t){return f(Kp,function(r){return f(FA,{attempts:30,sleep:1},f(OA,e,t))},YE(250))}),KA=r(function(e,t){return f(FA,{attempts:60,sleep:5},f(RA,e,t))}),HA=function(e){return{$:"Mined",a:e}},jA=function(e){return Bo(function(t){return D(t,{status:HA(e)})})},qA=function(e){return{$:"Sent",a:e}},GA=function(e){return Bo(function(t){return D(t,{status:qA(e)})})},zA=function(e){return{$:"Signed",a:e}},YA=function(e){return Bo(function(t){return D(t,{status:zA(e)})})},WA=function(e){return"Nothing"!==e.$},JA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Tl(r),Do);case"TxSigned":var n=e.a,a=e.b,i=f(fp,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(Yg,t,xp(a))}return Do}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Do;if("Just"===t.b.$){var r=t.b.a;return f(Yg,r,xp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Yg,a,xp(fi(e)))}t.a,t.b,t.c;return Do};if("Ok"===a.$){var c=a.a,d=WA(o.onBroadcastTagger)||WA(o.onMinedTagger)?f(il,r.tagger,f(Zp,LA(n),f(VA,r.nodePath,c))):Do;return L(Tl(D(r,{txs:l(bp,n,YA(c),r.txs)})),Po(M([u,d])))}var h=a.a;return L(Tl(r),Po(M([u,s(h)])))}return L(Tl(r),Do);case"TxSent":var n=e.a,p=e.b,g=f(fp,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(il,r.tagger,f(Zp,_A(n),f(KA,r.nodePath,v.hash))):Do}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Yg,t,xp(li(v)))}return Do}();return L(Tl(D(r,{txs:l(bp,n,GA(v),r.txs)})),Po(M([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(Yg,t,xp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Yg,n,xp(fi("Error with TxSent stuff")))}e.a,e.b;return Do}();return L(Tl(r),s)}return L(Tl(r),Do);case"TxMined":var n=e.a,m=e.b,b=f(fp,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Yg,a,xp(li(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 Po(M([f(il,r.tagger,f(Zp,f($A,n,s),zy(r.nodePath))),f(Yg,a,xp(li(C))),f(Yg,u.toMsg,xp(s))]))}return Do}();return L(Tl(D(r,{txs:l(bp,n,jA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Yg,r,xp(fi("TxReceipt decoding failure")))}return Do}();return L(Tl(r),S)}return L(Tl(r),Do);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(xA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Tl(r),f(Yg,B,f(Xp,function(e){return xp(D(I,{doneWatching:!0,reOrg:!0}))},f(Kp,function(e){return xp(D(I,{doneWatching:!0}))},f(RA,r.nodePath,T.txHash)))))}return L(Tl(r),Do)}if(R(w,T.lastCheckedBlock))return L(Tl(r),f(il,r.tagger,f(Zp,f($A,n,T),f(Kp,function(e){return zy(r.nodePath)},YE(2e3)))));var k=f(xA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Tl(r),Po(M([f(il,r.tagger,f(Zp,f($A,n,I),f(Kp,function(e){return zy(r.nodePath)},YE(2e3)))),f(Yg,B,xp(I))])))}return L(Tl(r),Do)}var n=e.a,h=e.c.a;return L(Tl(r),Do);default:var h=e.a;return L(Tl(r),Do)}}),QA=Jt,XA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),ZA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),eB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(ZA,"#",e.fragment,l(ZA,"?",e.query,U(f(XA,e.port_,U(t,e.host)),e.path)))},tB=r(function(e,t){return e<0?ci:Ql(f(nd,e,t))}),rB=r(function(e,t){if(e<0)return t;var r=Bh(f(nd,e,t)),n=f(lc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),nB=n(function(e,t,r){if(e<0)return r;var n=f(nd,e,r),a=f(lc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),aB=r(function(e,t){return f(nB,e,ms(t))}),iB=r(function(e,t){Kv(t);switch(t.$){case"Home":return L(D(e,{submodel:sT}),Do);case"Create":var r=Xd(e.wallet),n=f(Ul,e.txSentry,f(Yo,Uy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(uB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),Po(M([f(il,Uy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(By,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(mm,e.wallet,r)}return l(vm,e.wallet,u,s)}(),c=f(Ul,e.txSentry,f(Yo,Fy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(uB,U(f(Qi,Fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:My(r.model),txSentry:a}),Po(M([f(il,Fy,r.cmd),i]))));case"Marketplace":var d=Bv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Oy(h)}),Po(M([f(il,fT,p)])));case"AgentHistory":var g=t.a,v=f(Uo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:Py(y)}),Po(M([f(il,oT,m)])));default:return L(f(uo,EA,e),Do)}}),oB=r(function(e,t){var r=t.a,n=t.b,a=f(sB,uT(e),r),i=a.a,o=a.b;return L(i,Po(M([n,o])))}),uB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,oB,L(r,n),e)}),sB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(sB,cT,t);case"GotoRoute":var n=r.a;return L(t,f(Cy,t.key,n));case"GTag":var a=r.a;return L(t,wy(Sy(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),wy(Sy(d(Ol,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Uv,ky,o,u,s));default:return L(t,Ny(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(rB,c,t.userNotices)}),Do);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(by,t.key,eB(e))}var r=h.a;return QA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(cB,g,t);case"GotoRoute":var v=e.a;return L(t,Po(M([wy(Sy(d(Ol,"GotoRoute","navigation",Kv(v),0))),f(Cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Do);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,CA,t),Do):L(t,Ey(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Do;var t=e.a;return Iy(f(Ty,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Gh,pu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=SA(l(Ml,I,w,S)),B=f(Vy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ll,"Unexpected wallet state encounted when setting commPubkey!",ci),t),Do)}T.a;return L(f(uo,f(ll,"User pubkey set, but I can no longer find the user address!",ci),t),Do)}var N=E.a;return L(l(Pa,uo,f(ll,"error decoding commPubkey from JS",N),t),Do);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(lv,R,_),P=f(Ul,t.txSentry,f(Yo,Uy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(uB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),Po(M([f(il,Uy,x.cmd),F]))))}return L(t,Do);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(BS,K,j),q=f(Ul,t.txSentry,f(Yo,Fy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(uB,U(f(Qi,Fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:My(x.model),txSentry:O}),Po(M([f(il,Fy,x.cmd),F]))))}return L(t,Do);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Dv,G,Y);return f(uB,f(Qi,fT,x.appCmds),L(D(t,{submodel:Oy(x.model)}),f(il,fT,x.cmd)))}return L(t,Do);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(ol,W,Q),X=f(Ul,t.txSentry,f(Yo,oT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(uB,U(f(Qi,oT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Py(x.model),txSentry:O}),Po(M([f(il,oT,x.cmd),F]))))}return L(t,Do);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(_u,si,f(JA,Z,r))}return L(ci,Do)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(tB,re,t.tradeCaches);if("Nothing"===ae.$)return f(oB,pa(f(ll,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Do));var ie=ae.a,x=f(iT,ne,ie);return L(D(t,{tradeCaches:l(aB,re,x.tradeCache,t.tradeCaches)}),f(il,lT(re),x.cmd));case"NoOp":return L(t,Do);default:var N=e.a;f(cl,"test",N);return L(t,Do)}}),cB=r(function(e,t){return f(iB,t,my(e))}),fB=Ge("txIn",XE),lB=je("txOut",Ua),dB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},hB=function(e){return{$:"EventSentryMsg",a:e}},pB=function(e){var t=f(cm,hB,Xh(e)),r=t.a,n=t.b;return x({dataFetchState:l(QS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Zd,"tradeCache init","processing",dB(e),0)]))},gB=function(e){return{$:"InitialNumTradesFetched",a:e}},vB=function(e){return f(LS,e.factory,gB)},yB=function(e){var t=pB(e),r=t.a,n=t.b,a=t.c;return x(r,Po(M([n,vB(r)])),a)},mB=function(e){return{$:"TxSentryMsg",a:e}},bB={align:ul,label:"noWeb3Provider",mainParagraphs:M([M([fl("No web3 provider detected. Is "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(" or some other web3 provider installed and unlocked?")])]),noticeType:xg},CB={$:"TopLeft"},EB={align:CB,label:"screenToSmall",mainParagraphs:M([M([fl("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:xg},SB={align:ul,label:"wrongWeb3Network",mainParagraphs:M([M([fl("Make sure your wallet is set to a compatible network.")]),M([fl(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:$g},TB={$:"NoneDetected"},wB=function(e){return{$:"OnlyNetwork",a:e}},IB=function(e){return f(Bo,Xh,Mg(e))},AB={$:"ETCMain"},BB={$:"ETCTest"},kB={$:"Expanse"},NB={$:"Kovan"},RB={$:"Mainnet"},$B=function(e){return{$:"Private",a:e}},_B={$:"Rinkeby"},LB={$:"Ropsten"},xB={$:"RskMain"},PB={$:"RskTest"},DB=function(e){switch(e){case 1:return RB;case 2:return kB;case 3:return LB;case 4:return _B;case 30:return xB;case 31:return PB;case 42:return NB;case 41:return AB;case 62:return BB;default:return $B(e)}},UB=n(function(e,t,r){var n=e.a,a=e.b;return Tl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:cp})}),OB=n(function(e,t,n){var a=e.networkId?wB(DB(e.networkId)):TB,i=f(Bo,function(e){return l(UB,L(lB,fB),mB,e)},IB(a)),o=e.width<1024?si(EB):ci,u=f(xa,yB,ro),s=function(){return R(a,TB)?si(bB):"Nothing"===Mg(a).$?si(SB):ci}(),c=qC(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ay(f(Bi,r(function(e,t){return f(Qi,lT(e),t)}),g)),y=Po(f(Bi,r(function(e,t){return f(il,lT(e),t)}),p)),m=f(uB,v,f(cB,t,{key:n,screenWidth:e.width,submodel:sT,time:Vl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),Po(M([y,C])))}),MB=Oe,FB=MB(yr),VB=function(e){return FB},KB=function(e){return{$:"Refresh",a:e}},HB=r(function(e,t){return{$:"Every",a:e,b:t}}),jB=r(function(e,t){return{processes:t,taggers:e}}),qB=xp(f(jB,cp,cp)),GB=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(bS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),zB=Ne,YB=r(function(e,t){var r=e.a,n=e.b,a=f(fp,r,t);if("Nothing"===a.$)return l(xl,r,M([n]),t);var i=a.a;return l(xl,r,f(ka,n,i),t)}),WB=Be,JB=r(function(e,t){return{$:"Zone",a:e,b:t}}),QB=ca,XB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=WB(f(QB,n,f(Sp,e,n)));return f(Kp,function(t){return l(XB,e,a,l(xl,n,t,r))},i)}return xp(r)}),ZB=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 x(n,a,f(Kp,function(e){return i},zB(t)))}),u=l(Ra,YB,cp,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(xl,e,r,i),o)}),d=p(GB,s,c,o,u,i,x(yr,cp,xp(gr))),h=d.a,g=d.b,v=d.c;return f(Kp,function(e){return xp(f(jB,u,e))},f(Kp,function(t){return l(XB,e,h,g)},v))}),ek=function(e){return we(function(t){t(Se(e(Date.now())))})}(Vl),tk=n(function(e,t,r){var n=f(fp,t,r.taggers);if("Nothing"===n.$)return xp(r);var a=n.a,i=function(t){return Gp(f(xa,function(r){return f(Ep,e,r(t))},a))};return f(Kp,function(e){return xp(r)},f(Kp,i,ek))}),rk=r(function(e,t){var r=t.a,n=t.b;return f(HB,r,f(Da,e,n))});pn.Time=Pe(qB,ZB,tk,0,rk);var nk=Ue("Time"),ak=r(function(e,t){return nk(f(HB,e,t))}),ik=function(e){return f(ak,2e3,KB)},ok=function(e){return FB},uk=function(e){return{$:"DecryptionFinished",a:e}},sk=Ge("decryptionFinished",XE),ck=Ge("encryptionFinished",XE),fk=function(e){return{$:"EncryptionFinished",a:e}},lk=function(e){return{$:"Refresh",a:e}},dk=function(e){return MB(M([f(ak,3e3,lk),ck(fk),sk(function(e){return yE(uk(e))})]))},hk=yn,pk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return FB;case"CreateModel":t.a;return f(hk,Uy,ik());case"TradeModel":t.a;return f(hk,Fy,dk());case"MarketplaceModel":t.a;return f(hk,fT,ok());default:t.a;return f(hk,oT,VB())}},gk=Ge("userPubkeyResult",XE),vk=Ge("walletSentryPort",XE),yk={$:"CheckForNewTrades"},mk={$:"UpdateTradePhases"},bk=function(e){return MB(M([f(ak,5e3,function(e){return yk}),f(ak,3e3,function(e){return mk})]))},Ck=function(e){return{$:"Tick",a:e}},Ek=function(e){return{$:"UserPubkeySet",a:e}},Sk=function(e){return{$:"WalletStatus",a:e}},Tk=function(e){return f(ll,"Error decoding JS walletSentry: "+e,ci)},wk=function(e){return{$:"ErrorDecoding",a:e}},Ik=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Ak=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Oh,"ref",zC),f(Oh,"txHash",AA(cS))),Bk=function(e){var t=f(Gh,Ak,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Ik,r.ref,li(a))}return f(Ik,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return wk("Error decoding tx data")},kk=function(e){var t=e.a;return f(hk,t.tagger,t.inPort(Bk))},Nk=f(Oi,DB,zC),Rk=gu(f(zo,rd,f(zo,$d("Failure decoding stringy int"),au(DB)))),$k=QE(M([Rk,Nk])),_k=r(function(e,t){return{account:e,networkId:t}}),Lk=l(Mi,_k,f(Oh,"account",AA(rS)),f(Oh,"networkId",$k)),xk=n(function(e,t,r){var n=f(Gh,Lk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),Pk=function(e){var t=f(zo,Tk,f(zo,pa,uT));return MB(U(M([f(ak,1e3,Ck),vk(f(xk,t,Sk)),f(xc,FB,f(Bo,kk,e.txSentry)),gk(Ek),MB(f(Bi,r(function(e,t){return f(hk,lT(e),t)}),f(xa,bk,e.tradeCaches)))]),M([pk(e)])))},Dk=function(e){return{$:"LinkClicked",a:e}},Uk=function(e){return{$:"UrlChanged",a:e}},Ok=n(function(e,t,r){return d(hA,e/255,t/255,r/255,1)}),Mk=l(Ok,10,33,108),Fk={$:"Generic"},Vk=Fk,Kk=r(function(e,t){return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),e)),wT(M([t])))}),Hk=function(e){return{$:"Fill",a:e}},jk=Hk(1),qk=Hi,Gk=function(e){return{$:"Px",a:e}},zk=Gk,Yk=ZT(8),Wk=function(e){return f(yA,Yk,l(vA,"bg-"+mA(e),"background-color",e))},Jk=f(Kk,M([ET(jk),yT(zk(150)),Wk(Mk)]),qk),Qk=function(e){return{$:"GotoRoute",a:e}},Xk={$:"Active"},Zk={$:"Important"},eN={$:"Normal"},tN=l(pA,1,1,1),rN=ZT(2),nN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),aN=r(function(e,t){return R(e,t)?f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e)):f(yA,rN,h(nN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),iN=ZT(21),oN=r(function(e,t){return{$:"Class",a:e,b:t}}),uN=f(oN,iN,RT.cursorPointer),sN=ZT(17),cN=function(e){return f(yA,sN,l(jI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},fN=function(e){return{$:"Normal",a:e}},lN=An,dN=r(function(e,t){return f(lN,e,fN(t))}),hN=function(e){return f(dN,"click",Fi(e))},pN=f(Da,ST,hN),gN=ZT(13),vN=f(oN,gN,RT.textSemiBold),yN=ZT(4),mN=function(e){return{$:"FontSize",a:e}},bN=function(e){return f(yA,yN,mN(e))},CN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([cN(4),Wk(l(pA,0,0,1))]);default:return M([cN(4),Wk(l(pA,.9,0,0))])}}();return f(Kk,U(M([f(aN,23,12),bN(22),vN,bA(tN),uN,pN(t)]),n),fl(e))}),EN=l(Ok,244,0,103),SN=function(e){return{$:"AlignX",a:e}},TN={$:"CenterX"},wN=SN(TN),IN=ZT(3),AN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),BN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),kN=function(e){return f(yA,IN,l(AN,f(BN,e,e),e,e))},NN=function(e){return{$:"Describe",a:e}},RN={$:"Paragraph"},$N=r(function(e,t){return d(fA,HT,Vk,f(ka,NN(RN),f(ka,ET(jk),f(ka,kN(5),e))),wT(t))}),_N=f(oN,gN,RT.bold),LN=f(Kk,M([bN(29),bA(tN),_N,wN,uN,pN(Qk(Gv))]),f($N,yr,M([fl("DAI"),f(Kk,M([bA(EN)]),fl("Hard"))]))),xN={$:"Right"},PN=SN(xN),DN={$:"AsColumn"},UN=DN,ON=r(function(e,t){return d(fA,UN,Vk,f(ka,lA(RT.contentTop+" "+RT.contentLeft),f(ka,yT(bT),f(ka,ET(bT),e))),wT(t))}),MN={$:"AsRow"},FN=MN,VN=r(function(e,t){return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY),f(ka,ET(bT),f(ka,yT(bT),e))),wT(t))}),KN=function(e){return f(VN,M([ET(jk),kN(30),f(aN,30,17)]),M([l(CN,"Browse Offers",Qk(zv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Xk}return eN}()),l(CN,"Create a New Offer",Qk(qv),function(){return"CreateModel"===e.submodel.$?Xk:eN}()),function(){var t=Gd(e.wallet);if("Just"===t.$){var r=t.a;return l(CN,"My Trades",Qk(jv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Xk:eN}return eN}())}return l(CN,"Connect to Wallet",cT,Zk)}(),f(ON,M([PN,kN(0),f(aN,8,0)]),M([LN]))]))},HN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},jN=function(e){return ml(e)},qN=function(e){return f(ml,function(e){return gb(e.parameters)},OS(e))},GN={$:"BurnWindow"},zN={$:"FiatPrice"},YN={$:"Margin"},WN={$:"Offer"},JN={$:"PaymentWindow"},QN=function(e){return{$:"AlignY",a:e}},XN={$:"CenterY"},ZN=QN(XN),eR=ZT(20),tR=f(oN,eR,RT.clip),rR=Hk,nR=function(e){return f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e))},aR=r(function(e,t){return f(Kk,M([ET(rR(e)),yT(zk(60)),tR,Wk(tN)]),f(Kk,M([nR(12),ZN,ET(jk)]),t))}),iR=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},oR=function(e){return{$:"JustImage",a:e}},uR=oR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),sR=dT("alt"),cR=function(e){return f(dT,"src",rt(e))},fR=r(function(e,t){var r=t.src,n=t.description,a=f(ml,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(fA,AT,Vk,f(ka,lA(RT.imageContainer),e),wT(M([d(fA,AT,TT("img"),U(M([ST(cR(r)),ST(sR(n))]),a),wT(yr))])))}),lR=r(function(e,t){if("None"===t.$)return qk;var r=t.a;return f(fR,e,r)}),dR=oR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),hR=function(e){return{$:"ChangeSort",a:e}},pR=f(oN,gN,RT.textMedium),gR=function(e){return f(Kk,M([pR,bN(17)]),fl(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},vR=r(function(e,t){return f(VN,M([kN(5),uN,pN(hR(e))]),M([gR(e),function(){if("Just"===t.$){var e=t.a;return f(Kk,M([ZN]),f(lR,M([ET(zk(8))]),function(){return"Ascending"===e.$?uR:dR}()))}return qk}()]))}),yR=r(function(e,t){return f(aR,iR(t),f(vR,t,e))}),mR=r(function(e,t){return f(VN,M([ET(jk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(yR,r,t)},t))}),bR=l(Ok,150,150,150),CR=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},ER=r(function(e,t){return f(ts,e.amount,t.amount)}),SR=n(function(e,t,r){return f(e,r,t)}),TR=function(e){var t=e.a;return(R(e.b,Lo)?Ua:SR)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(TR,L(Av,Zf),e,t):f(Ku,CR(e.state.phase),CR(t.state.phase))});case"Expires":return r(function(e,t){return f(hv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Sv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(ER,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(xc,ma,l(zd,r(function(e,t){return f(Ku,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(hv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(hv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},wR=l(Ok,233,237,242),IR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),AR=function(e){return f(Kk,M([ET(jk),yT(jk),tR]),f($N,M([bN(12)]),M([fl(e.info)])))},BR=function(e){return f(xc,qk,f(Bo,AR,Ql(e)))},kR=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"}},NR=function(e){return{$:"TimeLeft",a:e}},RR=function(e){return{$:"TimeUp",a:e}},$R=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 Vl(0)}}),_R=r(function(e,t){return Vl(jd(e)-jd(t))}),LR=r(function(e,t){var r=f($R,t.state.phase,t),n=f(_R,e,t.state.phaseStartTime),a=f(_R,r,n);return jd(a)>0?NR(L(a,r)):RR(r)}),xR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},PR=l(pA,0,0,0),DR=l(Ok,51,183,2),UR=function(e){var t=ju(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Qo(n));return n+(function(){if(a){return f(ru,a+1,f(Zo,1,mw(r)))}return""}()+"%")},OR=r(function(e,t){return oR({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"}()})}),MR=n(function(e,t,r){return f(lR,f(ka,yT(zk(34)),e),f(OR,t,r))}),FR=r(function(e,t){var r=UR(t);if("0%"===r)return f(Kk,M([bN(16)]),fl("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?DR:EN;return f(VN,M([kN(4)]),M([l(MR,yr,a,si(i)),f(Kk,M([bA(o),bN(16)]),fl(n))]))}),VR=oR,KR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(xl,r,n,t)}),cp,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,VR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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","₫")]))),HR=function(e){return f(xc,"",f(Bo,Qa,f(fp,e,KR)))},jR=function(e){return Qo(e)<=3?e:jR(f(Td,3,e))+","+f(ou,3,e)},qR=function(e){return jR(Sd(e))},GR=function(e){return U(HR(e.fiatType),qR(e.amount))},zR=hA,YR=function(e){var t=function(){var t=f(fp,e.fiatType,KR);if("Nothing"===t.$)return qk;var r=t.a,n=(r.a,r.b);return f(lR,M([yT(zk(26))]),n)}();return f(VN,M([kN(4)]),M([t,f(Kk,M([bA(d(zR,0,0,0,.5)),pR,ET(zk(50))]),fl(e.fiatType)),fl(GR(e))]))},WR=function(e){return jd(e)<0},JR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),QR=function(e){var t=vg(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(JR,aC(t),aC(r),aC(n),aC(a))}(f(xc,L(qu(0),qu(0)),f(Ts,n,qu(60))))}(f(xc,L(qu(0),qu(0)),f(Ts,r,qu(3600))))}(f(xc,L(qu(0),qu(0)),f(Ts,t,qu(86400))))},XR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!WR(a)){var u=r(function(e,t){return U(l(Rs,2,P("0"),Ni(e)),t)}),s=jd(a)>0?i:o,c=QR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(VN,U(M([kN(5)]),e),M([f(Kk,U(M([bA(h)]),t),fl(f(u,c.days,"d"))),f(Kk,U(M([bA(d)]),t),fl(f(u,c.hours,"h"))),f(Kk,U(M([bA(s)]),t),fl(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Vl(0);e=p,t=g,n=v,a=y}}),ZR={$:"Behind"},e$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),t$=function(e){return f(e$,ZR,e)},r$=r(function(e,t){var r=sv(200*e),n=200-r,a=f(Kk,M([ET(rR(n))]),qk),i=M([yT(zk(3)),cN(20)]),o=f(Kk,U(i,M([ET(rR(r)),Wk(t)])),qk),u=f(Kk,U(i,M([ET(jk),Wk(wR)])),qk);return f(VN,M([ET(jk),t$(u)]),M([o,a]))}),n$=l(pA,1,1,0),a$=r(function(e,t){return jd(e)/jd(t)}),i$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(a$,o,u),c=(f(Kk,M([wN]),d(XR,yr,yr,L(a,i),o)),s<.1?EN:s<.2?n$:DR);return f(ON,U(M([kN(5)]),e),M([d(XR,M([wN]),t,L(a,i),o),f(r$,1-s,c)]))}),o$=function(e){var t=wd(jl(e)),r=f(Xl,".",t);if(!r.b)return t;if(r.b.b){cl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(ru,3,t);case 1:return f(ru,4,f(xc,t,f(Bo,mw,f(Bo,function(e){return e/100},f(Bo,Ka,f(Bo,sv,f(Bo,ti(100),Bd(t))))))));default:var n=r.a;return f(xc,f(ru,n,t),f(Bo,Ni,f(Bo,sv,Bd(t))))}},u$=n(function(e,t,r){return f(aR,iR(t),function(){switch(t.$){case"Phase":var n=xR(r.state.phase),a=L(f(LR,e,r),r.state.phase);e:for(;;){if("TimeLeft"===a.a.$){if("Closed"===a.b.$)break e;var i=a.a.a,o=f(a$,i.a,i.b)<.05?EN:PR;return f(ON,M([kN(3)]),M([fl(n),d(i$,M([ET(jk)]),M([bN(16)]),L(o,wR),i)]))}if("Closed"===a.b.$)break e;var u=a.a.a;return f(VN,M([kN(6),bA(bR)]),M([fl(n),f(Kk,M([bN(16)]),fl("(stale)"))]))}a.b;return fl(n);case"Expires":if("Open"===r.state.phase.$){var s=f(LR,e,r);if("TimeLeft"===s.$){var i=s.a,o=f(a$,i.a,i.b)<.05?EN:PR;return d(i$,M([ET(jk)]),M([bN(16)]),L(o,wR),i)}var u=s.a;return d(i$,M([ET(jk)]),M([bN(16)]),L(EN,wR),L(Vl(0),u))}return qk;case"Offer":return f(VN,M([kN(5)]),M([fl(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(o$(r.parameters.tradeAmount)+" ")+kR(r.factory))]));case"FiatPrice":return YR(r.terms.price);case"Margin":var c=R(r.parameters.initiatorRole,fo);return f(xc,qk,f(Bo,FR(c),r.derived.margin));case"PaymentWindow":var l=function(){return"Seller"===r.parameters.initiatorRole.$?EN:DR}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:PR;return d(XR,yr,yr,L(h,wR),r.parameters.autoabortInterval);default:var l=function(){return"Seller"===r.parameters.initiatorRole.$?DR:EN}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:PR;return d(XR,yr,yr,L(h,wR),r.parameters.autoreleaseInterval)}}())}),s$=n(function(e,t,r){return f(ON,M([ET(jk),kN(1),Wk(wR),uN,pN(f(IR,r.factory,r.id))]),M([f(VN,M([ET(jk),kN(1)]),f(xa,function(t){return l(u$,e,t,r)},t)),f(aR,1,BR(r.terms.paymentMethods))]))}),c$=Er,f$=ZT(28),l$=function(e){return f(yA,f$,l(vA,"bc-"+mA(e),"border-color",e))},d$=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),h$=function(e){return f(yA,iA,h(d$,"b-"+Ni(e),e,e,e,e))},p$=a(function(e,t,r,n){return f(ON,M([ET(jk),h$(2),cN(8),l$(bR),kN(2),Wk(bR),tR]),f(xa,f(s$,e,r),f(c$,TR(t.orderBy),n)))}),g$=a(function(e,t,r,n){return f(ON,M([ET(jk),yT(jk),kN(5)]),M([f(mR,t.orderBy,r),d(p$,e,t,r,n)]))}),v$=n(function(e,t,r){var n=ay(f(xa,function(e){return f(jN,HN(r),qN(e))},t));return R(n,yr)?qk:f(Yi,Ko,d(g$,e,r.tradeTable,M([xo,WN,zN,YN,JN,GN]),n))}),y$=r(function(e,t){return f(Kk,M([cN(4),Wk(d(zR,0,0,1,.1)),bA(l(Ok,16,7,234)),bN(e),vN,f(aN,15,13)]),fl(dl(t)))}),m$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),b$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(yA,rN,h(nN,"p-"+Ni(t),t,t,t,t)):f(yA,rN,h(nN,d(m$,t,r,n,a),t,r,n,a))},C$=function(e){return function(){var t=Gd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?qk:f(VN,M([kN(10),b$({bottom:20,left:20,right:20,top:10})]),M([f(Kk,M([bN(24),vN]),fl("Trade History for User")),f(y$,18,e.agentAddress)]))},E$=function(e){return{$:"FiltersMsg",a:e}},S$=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},T$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),w$=xI,I$={$:"Left"},A$=SN(I$),B$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(fA,UN,TT("label"),e,wT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(fA,AT,Vk,a,wT(M([i])));switch(n.$){case"Above":return d(fA,UN,TT("label"),e,wT(M([o,r])));case"Below":return d(fA,UN,TT("label"),e,wT(M([r,o])));case"OnRight":return d(fA,FN,TT("label"),e,wT(M([r,o])));default:return d(fA,FN,TT("label"),e,wT(M([o,r])))}}),k$=function(e){return{$:"Label",a:e}},N$={$:"NoAttribute"},R$=function(e){if("HiddenLabel"===e.$){var t=e.a;return NN(k$(t))}return N$},$$=function(e){return"HiddenLabel"===e.$},_$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return hu("No key matched");var n=r.a;return Fi(n)},r=f(du,t,f(Oh,"key",pu));return ST(f(dN,"keyup",r))},L$=function(e){return f(Nn,"tabIndex",Ni(e))},x$=f(Da,ST,L$),P$={$:"LivePolite"},D$=NN(P$),U$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([$$(r)?N$:kN(6),ST(hN(i(!a))),D$,_$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),x$(0),uN,A$,ET(jk)]),e);return l(B$,o,r,d(fA,AT,Vk,M([ST(f(w$,"role","checkbox")),ST(f(w$,"aria-checked",a?"true":"false")),R$(r),ZN,yT(jk),ET(bT)]),wT(M([n(a)]))))}),O$=Br,M$=function(e){return e*O$/180},F$=ZT(26),V$=function(e){return{$:"MoveY",a:e}},K$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),H$=function(e){return f(K$,F$,V$(-e))},j$=ZT(24),q$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),G$=function(e){return f(K$,j$,f(q$,x(0,0,1),e))},z$=ZT(19),Y$=function(e){return Cd(M([e.inset?"box-inset":"box-",mw(e.offset.a)+"px",mw(e.offset.b)+"px",mw(e.blur)+"px",mw(e.size)+"px",mA(e.color)]))},W$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(yA,z$,l(jI,Y$(t),"box-shadow",Cw(t)))},J$=r(function(e,t){return f(yA,iA,h(d$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Q$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?h$(r):f(J$,n,r):f(yA,iA,h(d$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},X$=ZT(12),Z$=f(oN,X$,RT.textCenter),e_=l(pA,1,1,1),t_=function(e){return f(Kk,M([lA("focusable"),ET(zk(14)),yT(zk(14)),bA(e_),ZN,bN(9),Z$,cN(3),l$(e?l(pA,59/255,.6,252/255):l(pA,211/255,211/255,211/255)),W$({blur:1,color:e?d(zR,238/255,238/255,238/255,0):l(pA,238/255,238/255,238/255),offset:L(0,0),size:1}),Wk(e?l(pA,59/255,.6,252/255):e_),h$(e?0:1)]),e?f(Kk,M([l$(e_),yT(zk(6)),ET(zk(9)),G$(M$(-45)),wN,ZN,H$(1),Q$({bottom:2,left:2,right:0,top:0})]),qk):qk)},r_=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),n_={$:"OnRight"},a_=r_(n_),i_=r(function(e,t){return f(U$,yr,{checked:t.checked,icon:t_,label:f(a_,yr,fl(t.label)),onChange:f(T$,e,t.label)})}),o_={$:"Top"},u_=QN(o_),s_=function(e){return f(ON,M([kN(15),u_]),M([f(Kk,M([bN(28),pR]),fl(S$(e.type_))),f(ON,M([kN(5)]),f(xa,i_(e.type_),e.options))]))},c_=function(e){return f(VN,M([kN(20)]),f(xa,s_,e))},f_={$:"NoneFound"},l_={$:"AllFetched"},d_={$:"FetchingTrades"},h_={$:"QueryingNumTrades"},p_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return h_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?d_:l_}return f_},g_={$:"InFront"},v_=function(e){return f(e$,g_,e)},y_=r(function(e,t){var r=function(e){return f(Kk,M([bN(20),vN,bA(bR),wN]),fl(e))},n=f(Eh,Ja(f_),f(xa,p_,e))?M([r("No trades found.")]):f(xa,r,qC(f(xa,function(e){switch(p_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),v_(f(ON,M([kN(5),A$]),n))]),f(Kk,M([wN]),f(Yi,E$,c_(t.filters))))}),m_=n(function(e,t,r){return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),f(aN,30,20)]),M([C$(r),f(y_,t,r),l(v$,e,t,r)]))}),b_=function(e){return{$:"ShowCurrencyDropdown",a:e}},C_={$:"AbortCreate"},E_=function(e){return{$:"AppCmd",a:e}},S_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),T_=function(e){return f(xa,function(e){return M([f(Kk,M([bA(EN)]),fl("Caution! ")),fl(e)])},qC(M([R(f(hv,e.autoreleaseInterval,Vl(12e5)),ba)?si(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."}()):ci,R(f(hv,e.autoabortInterval,Vl(36e5)),ba)?si(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.'}()):ci])))},w_=l(pA,0,0,1),I_=function(e){return f(Kk,M([b$({bottom:5,left:5,right:5,top:0}),pN(e),cN(30),Wk(d(zR,1,1,1,.4)),h$(1),l$(d(zR,0,0,0,.3)),uN,bN(14)]),f(Kk,M([bA(d(zR,0,0,0,.7))]),fl("x")))},A_=Bn,B_=A_,k_=ST,N_=r(function(e,t){return f(Kk,M([t$(f(Kk,M([Wk(e),k_(f(B_,"position","fixed")),k_(f(B_,"z-index","1000")),k_(f(B_,"top","0")),k_(f(B_,"left","0")),k_(f(B_,"width","100%")),k_(f(B_,"height","100%"))]),qk)),ET(jk),yT(jk)]),t)}),R_=r(function(e,t){return{$:"Max",a:e,b:t}}),$_=r(function(e,t){return f(R_,e,t)}),__=n(function(e,t,r){return l(Pa,N_,d(zR,0,0,.3,.6),f(Kk,U(M([wN,ZN,ET(f($_,500,bT)),Wk(tN),cN(8),v_(f(Kk,M([PN,u_]),I_(r)))]),e),t))}),L_=r(function(e,t){if("Nothing"===t.$)return qk;var r=t.a;return f(Kk,U(M([cN(5),l$(l(pA,.9,0,0)),h$(1),Wk(l(pA,1,.4,.4)),nR(5),wN,ZN,ET(f($_,200,bT)),bN(14)]),e),f($N,yr,M([fl(r)])))}),x_={$:"Above"},P_=function(e){return f(e$,x_,e)},D_=r(function(e,t){return f(Kk,M([cN(4),f(aN,25,17),bN(18),vN,Wk(wR),P_(f(L_,M([H$(5)]),t))]),fl(e))}),U_=a(function(e,t,r,n){return d(hA,e/255,t/255,r/255,n)}),O_=d(U_,1,31,52,.64),M_=ZT(32),F_={$:"Active"},V_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),K_=$n,H_=r(function(e,t){switch(t.$){case"NoAttribute":return N$;case"Describe":var r=t.a;return NN(r);case"AlignX":var n=t.a;return SN(n);case"AlignY":var a=t.a;return QN(a);case"Width":var n=t.a;return CT(n);case"Height":var n=t.a;return vT(n);case"Class":var n=t.a,a=t.b;return f(oN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(yA,i,o);case"Nearby":var u=t.a,s=t.b;return f(e$,u,f(zi,e,s));case"Attr":var c=t.a;return ST(f(K_,e,c));default:var l=t.a,d=t.b;return f(K$,l,d)}}),j_=function(e){return f(H_,zg,e)},q_=r(function(e,t){var r=t.a,n=t.b,a=j_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(rA,n,o));default:return L(r,n)}}),G_=function(e){var t=l(Ra,q_,L(yr,sA),e),r=t.a,n=t.b;return f(ka,qI(n),r)},z_=function(e){return f(yA,M_,f(V_,F_,G_(e)))},Y_=ZT(33),W_={$:"Hover"},J_=function(e){return f(yA,Y_,f(V_,W_,G_(e)))},Q_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Kk,M([cN(4),uN,pN(n),f(aN,25,17),bA(t),bN(18),vN,Wk(a),z_(M([Wk(o)])),J_(M([Wk(i)]))]),fl(r))}),X_=r(function(e,t){return d(Q_,x(d(zR,1,0,0,1),d(zR,1,0,0,.8),d(zR,1,0,0,.6)),tN,e,t)}),Z_=function(e){return N_(d(zR,0,0,.3,.6))(f(ON,M([kN(10),wN,ZN,Wk(d(zR,0,0,0,.5)),cN(8),nR(20)]),f(xa,function(e){return f($N,M([wN,ZN,bN(20),vN,bA(tN),Z$]),M([e]))},e)))},eL=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+kA(t)}e.a;return"https://kovan.etherscan.io/tx/"+kA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+kA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+kA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+kA(t)}}),tL={$:"Bottom"},rL=QN(tL),nL=lA(RT.underline),aL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(fl(o$(Lb(a))),f(X_,"Yes, I definitely want to open this trade.",l(S_,r,n,a)))}return L(fl("??"),f(D_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(__,yr,f(ON,M([kN(20),nR(20),wN,yT(jk),Z$]),M([f(Kk,M([bN(26),vN,wN,ZN]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,ZN]),f(xa,$N(M([wN,bN(18),pR,bA(O_)])),U(T_(n),U(M([M([fl("You will deposit "),i,fl(" "+kR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([fl("This ususally requires two Metamask signatures. Your "+kR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Kk,M([rL,wN]),o)])),C_);case"ApproveNeedsSig":var u=e.a;return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),Z_(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","ApproveMining",0)))]),Z_(M([fl("Mining the initial approve transaction..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction on Etherscan"),url:f(eL,eo(u),s)}),fl("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),Z_(M([fl("Waiting for user signature for the create call."),fl("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","CreateMining",0)))]),Z_(M([fl("Mining the final create call..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction on Etherscan"),url:f(eL,r,s)}),fl("You will be redirected when it's mined.")])))}}),iL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return qk;var r=t.a;return f(aL,r,e)},oL=function(e){return{$:"TradeAmountChanged",a:e}},uL=dT("id"),sL=k_(uL("inputError")),cL=l(Ok,109,127,138),fL=oR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),lL=function(e){return f(lR,f(ka,yT(zk(26)),e),fL)},dL=function(e){return f(VN,M([kN(4)]),M([lL(yr),f(Kk,M([bN(24),pR,bA(cL)]),fl(kR(e)))]))},hL=function(e){return{$:"HiddenLabel",a:e}},pL=hL,gL=dT("type"),vL=function(e){return L(e,!0)},yL=function(e){return{$:"MayStopPropagation",a:e}},mL=r(function(e,t){return f(lN,e,yL(t))}),bL=r(function(e,t){return l(La,Oh,t,e)}),CL=f(bL,M(["target","value"]),pu),EL=function(e){return f(mL,"input",f(Oi,vL,f(Oi,e,CL)))},SL=ZT(0),TL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),wL=function(e){var t=function(e){return 1-e}(f(Tc,1,f(ei,0,e)));return f(yA,SL,f(TL,"transparency-"+dw(t),t))},IL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),AL=f(Da,ST,w$("autocomplete")),BL=l(pA,136/255,138/255,133/255),kL=l(pA,186/255,189/255,182/255),NL=f(aN,12,12),RL=M([NL,cN(3),l$(kL),Wk(e_),h$(1),kN(3),ET(jk)]),$L=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},_L=function(e){return f(Ch,$L,e)?N$:lA("focusable")},LL=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},xL=ye,PL=r(function(e,t){return f(kn,e,xL(t))}),DL=PL("spellcheck"),UL=f(Da,ST,DL),OL=W,ML=ZT(47),FL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(OL(e))),o=(i-1)*t+f(xc,0,f(Bo,a,r))+f(xc,0,f(Bo,a,n));return f(yA,ML,l(jI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),VL=dT("value"),KL=f(Da,ST,VL),HL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(fw,"width",n)?L(r,n):L(f(ka,e,r),f(TS,"width",n));case"Height":e.a;return f(fw,"height",n)?L(r,n):L(f(ka,e,r),f(TS,"height",n));case"Describe":e.a;return f(fw,"described",n)?L(r,n):L(f(ka,e,r),f(TS,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(fw,"align-x",n)?L(r,n):L(f(ka,e,r),f(TS,"align-x",n));case"AlignY":return f(fw,"align-y",n)?L(r,n):L(f(ka,e,r),f(TS,"align-y",n));default:return f(fw,"transform",n)?L(r,n):L(f(ka,e,r),f(TS,"transform",n))}}),L(yr,sm),e).a},jL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,HL(e))}),qL=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}},GL=f(Da,Gi,ms),zL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([ST(EL(n.onChange))]),o=U(RL,t),u=f(jL,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(ml,LL,o),c=f(jL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(jL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(jL,o,function(e){return"Nearby"===e.$})),p=f(ml,f(Da,ns,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([KL(n.text),ST(gL(a)),UL(e.spellchecked),lA(RT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return N$;var r=t.a;return AL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(qL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(IL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(IL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(xc,5,c);return x("textarea",U(M([UL(e.spellchecked),lA(RT.inputMultiline),f(xc,N$,f(Bo,AL,e.autofill)),function(){if("Nothing"===u.$)return N$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return b$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?N$:s.a?d(FL,n.text,v,u,g):N$}()]),h),M([GL(RI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(fA,AT,Vk,f(ka,ET(jk),ay(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([v_(f(Kk,f(ka,NL,U(s,U(M([bA(BL),lA(RT.noTextSelection+" "+RT.passPointerEvents),l$(d(zR,0,0,0,0)),Wk(d(zR,0,0,0,0)),yT(jk),ET(jk),wL(""===n.text?1:0)]),r))),a))])}()]))),wT(M([d(fA,AT,TT(v),ay(M([M([_L(t),R$(n.label)]),y,i])),wT(m))])));return l(B$,f(ka,f(oN,iN,RT.cursorText),f(ka,$$(n.label)?N$:kN(5),f(ka,D$,u))),n.label,b)}),YL=zL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),WL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(YL,M([ET(jk),yT(zk(40)),h$(0)]),{label:pL(r),onChange:i,placeholder:n,text:a});return f(VN,U(M([kN(5)]),e),qC(M([f(Bo,Kk(M([A$])),o),si(s),f(Bo,Kk(M([PN])),u)])))}),JL={$:"Below"},QL=function(e){return f(e$,JL,e)},XL=function(e){return f(K$,F$,V$(e))},ZL=n(function(e,t,r){return p(WL,M([ET(zk(150)),pR,bN(24),QL(f(L_,M([sL,XL(5)]),r))]),L(ci,si(f(Kk,M([pN(E_(d(Zd,"click","misclick","dai symbol in dai input",0)))]),dL(e)))),"dai input",ci,t,oL)}),ex=Kk(M([l$(wR),Q$({bottom:2,left:0,right:0,top:0})])),tx=r(function(e,t){return f(ON,M([kN(10)]),M([f(Kk,M([bN(17),vN]),fl(e)),t]))}),rx=r(function(e,t){return ex(f(tx,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(ZL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),nx=function(e){return f(xc,HE,Mg(e))},ax=function(e){var t=function(){var t=vd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+o$(f(Gl,r,100))+" "+kR(nx(e.wallet))+"."}return"There is a 1% fee."}();return f(VN,M([wN,f(aN,20,10),Wk(l(Ok,10,33,108)),cN(8),kN(5),pN(E_(d(Zd,"click","misclick","fee notify element",0)))]),M([f(Kk,M([bN(18),bA(l(Ok,0,226,255)),vN]),fl(t)),f(Kk,M([bN(17),bA(tN),pR]),fl("We only collect this fee when trades resolve successfully."))]))},ix=function(e){return{$:"FiatAmountChanged",a:e}},ox=function(e){return{$:"FiatTypeChanged",a:e}},ux=r(function(e,t){return l(bS,n(function(t,r,n){return f(e,t,r)?l(xl,t,r,n):n}),cp,t)}),sx=function(e){return f(ux,r(function(t,r){return f(Qg,e,t)}),KR)},cx=oR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),fx=function(e){return f(lR,M([yT(zk(26))]),f(xc,cx,f(Bo,fu,f(fp,e,KR))))},lx=function(e){return k_(f(mL,"click",Fi(L(e,!0))))},dx=GL,hx=function(e){return{$:"AppendProperty",a:e}},px=r(function(e,t){return hx(e+":"+t)}),gx=r(function(e,t){return f(px,e,t.value)}),vx=gx("cursor"),yx={$:"Compatible"},mx={cursor:yx,value:"default"},bx=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Cx=function(e){return{$:"PseudoClassSelector",a:e}},Ex=function(e){return bx(Cx(e))}("hover"),Sx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),Tx=Sx,wx=Tx,Ix=wx("span"),Ax=r(function(e,t){return f(kn,et(e),rt(t))}),Bx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),kx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),Nx=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),Rx=r(function(e,t){return t<>>32-e}),$x=function(e){var t=e.hash?e.seed^f(Nx,461845907,f(Rx,15,f(Nx,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(Nx,2246822507,r^r>>>16),a=f(Nx,3266489909,n^n>>>13);return(a^a>>>16)>>>0},_x=r(function(e,t){return f(Nx,5,f(Rx,13,e^f(Nx,461845907,f(Rx,15,f(Nx,3432918353,t)))))+3864292196}),Lx=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},VP=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+"]"}},KP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,VP,r)));case"UniversalSelectorSequence":var r=e.a;return Iu(r)?"*":f(Ri,"",f(xa,VP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,VP,r)))}},HP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([FP(t),KP(r)]))},jP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,KP(t),f(xa,HP,r)),i=f(Ri,"",M([f(xc,"",f(Bo,MP,n))]));return f(oc,f(Ri," ",f(ml,f(Da,ns,_d),a)),i)},qP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,jP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,OP(a),"\n",e,"}"]))}),GP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(qP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,_P,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,DP,qP(" ")),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"}},zP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(ml,f(Da,ns,_d),M([NP(t),f(Ri,"\n",f(xa,xP,r)),f(Ri,"\n",f(xa,PP,n)),f(Ri,"\n\n",f(xa,GP,a))])))},YP=function(e){return zP(kP(IP(e)))},WP=function(e){return f(Ri,"\n\n",f(xa,YP,e))},JP=function(e){return{$:"Snippet",a:e}},QP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),XP=function(e){return{$:"StyleBlockDeclaration",a:e}},ZP=r(function(e,t){var r=l(Xx,t,yr,ci);return JP(M([XP(l(QP,r,yr,e))]))}),eD=function(e){return Iu(e)?"unstyled":f(Is,P("_"),Ps(f(xx,15739,WP(AS(Px(AS(f(ZP,e,fP(yr)))))))))},tD=function(e){var t=eD(e),r=f(Ax,"className",hl(t));return l(Bx,r,e,t)},rD=a(function(e,t,r,n){return f(e,f(ka,tD(t),r),n)}),nD=function(e){return{$:"Unstyled",a:e}},aD=function(e){return nD(Tw(e))},iD=aD,oD=r(function(e,t){return f(Tn,e,Xe(t))}),uD=function(e){return En(Xe(e))},sD=r(function(e,t){var r=e.b,n=e.c;return Iu(r)?t:l(xl,n,r,t)}),cD=function(e){return e.a},fD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,sD,i,s),p=l(Ra,lD,L(yr,h),c),g=p.a,v=p.b,o=l(JT,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,sD,i,s),m=l(Ra,lD,L(yr,h),c),g=m.a,v=m.b,o=d(uD,y,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,sD,i,s),b=l(Ra,fD,L(yr,h),c),g=b.a,v=b.b,o=l(WT,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,sD,i,s),C=l(Ra,fD,L(yr,h),c),g=C.a,v=C.b,o=d(oD,y,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),lD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,sD,n,o),c=l(Ra,lD,L(yr,s),u),h=c.a,p=c.b,a=l(JT,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,sD,n,o),v=l(Ra,lD,L(yr,s),u),h=v.a,p=v.b,a=d(uD,g,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,sD,n,o),y=l(Ra,fD,L(yr,s),u),h=y.a,p=y.b,a=l(WT,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,sD,n,o),m=l(Ra,fD,L(yr,s),u),h=m.a,p=m.b,a=d(oD,g,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p)}}),dD=r(function(e,t){return h(Nl,kl,e,t,Rl,Rl)}),hD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(_d(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),pD=function(e){var t=f(hD,ci,e);if("Nothing"===t.$)return cp;var r=t.a,n=r.a,a=r.b;return f(dD,n,a)},gD=function(e){return{$:"ClassSelector",a:e}},vD=function(e){var t=e.a,r=e.b;return f(ZP,r,fP(M([gD(t)])))},yD=function(e){return WP(AS(Px(f(xa,vD,Ia(e)))))},mD=function(e){return l(JT,"style",yr,AS(Tw(yD(e))))},bD=n(function(e,t,r){var n=f(xa,cD,t),a=pD(t),i=l(Ra,lD,L(yr,a),r),o=i.a,u=i.b,s=mD(u);return l(JT,e,n,f(ka,s,$a(o)))}),CD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),ED=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(CD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),SD=r(function(e,t){return L(f(ED,"_",t),mD(e))}),TD=n(function(e,t,r){var n=f(xa,cD,t),a=pD(t),i=l(Ra,fD,L(yr,a),r),o=i.a,u=i.b,s=f(SD,u,o);return l(WT,e,n,f(ka,s,$a(o)))}),wD=a(function(e,t,r,n){var a=f(xa,cD,r),i=pD(r),o=l(Ra,fD,L(yr,i),n),u=o.a,s=o.b,c=f(SD,s,u);return d(oD,e,t,a,f(ka,c,$a(u)))}),ID=a(function(e,t,r,n){var a=f(xa,cD,r),i=pD(r),o=l(Ra,lD,L(yr,i),n),u=o.a,s=o.b,c=mD(s);return d(uD,e,t,a,f(ka,c,$a(u)))}),AD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(bD,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(ID,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(TD,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(wD,a,t,r,n)}},BD=AD,kD=function(e){return dx(BD(d(rD,Ix,M([Ex(M([vx(mx)]))]),yr,M([iD(e)]))))},ND=J,RD=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),$D=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),_D=function(e){return l(La,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 si(h(RD,n,a,i,o,u))}return ci}(),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 si(l($D,a,t,i))}return ci}())}),L(ci,ci),e)},LD=r(function(e,t){var r=_D(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),e))),wT(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?si(b$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),U(e,M([h]))))),wT(t))}var p=-s/2,g=-u/2;return d(fA,AT,Vk,e,wT(M([d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ST(f(B_,"margin",mw(p)+"px "+mw(g)+"px")),f(ka,ST(f(B_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,ST(f(B_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(yA,IN,l(AN,o,u,s)),yr))))),wT(t))])))}),xD=i(function(e,t,r,n,a){var i=f(YL,M([ET(zk(80)),yT(zk(40)),bN(24),pR,l$(wR),lx(r)]),{label:pL("currency type"),onChange:f(zo,ND,n),placeholder:ci,text:t}),o=f(fp,t,KR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return qk;r.b;return f(LD,M([ET(zk(350)),l$(PR),h$(1),Wk(tN),nR(10),wN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(VN,M([ET(zk(80)),kN(9),f(aN,0,5),lx(n(t)),J_(M([Wk(l(pA,.8,.8,1))]))]),M([f(lR,M([yT(zk(26))]),a),f(Kk,M([bN(16),vN]),kD(t))]))},Ia(sx(t))))}return qk}();return f(VN,M([kN(4),QL(u)]),M([f(Kk,M([pN(a)]),fx(t)),i]))}),PD=i(function(e,t,r,n,a){var i=E_(d(Zd,"click","misclick","currency flag",0)),o=f(Kk,M([pN(E_(d(Zd,"click","misclick","currency symbol",0)))]),fl(HR(e))),u=f(Kk,M([QL(f(L_,M([sL,XL(5)]),a))]),h(xD,r,e,b_(!0),ox,i));return p(WL,M([ET(zk(250)),pR,bN(24),QL(f(L_,M([sL,XL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,ix)}),DD=function(e){return ex(f(tx,"For fiat",h(PD,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},UD=function(e){return{$:"ChangeRole",a:e}},OD=d(U_,1,31,52,.13),MD=r(function(e,t){var r=M([bN(24),pR,uN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([bA(OD)]))):L(U(r,M([bA(OD)])),r)}(),a=n.a,i=n.b;return f(VN,M([kN(20)]),M([f(Kk,U(M([pN(UD(lo))]),i),fl("Sell "+e)),f(Kk,U(M([pN(UD(fo))]),a),fl("Buy "+e))]))}),FD=r(function(e,t){return f(tx,"Trade Type",f(MD,kR(e),t.inputs.userRole))}),VD=W$({blur:20,color:d(U_,0,0,0,.04),offset:L(0,3),size:0}),KD=f(oN,IN,RT.spaceEvenly),HD=function(e){var t=nx(e.wallet);return f(ON,M([ET(jk),kN(20),Wk(tN),cN(5),nR(20),VD]),M([f(VN,M([ET(jk),KD]),M([f(FD,t,e),f(rx,t,e),DD(e)])),ax(e)]))},jD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),qD={$:"Web3Connect"},GD=function(e){return f(Kk,M([wN]),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(X_,"Open Trade",f(jD,n,r))}t.b;return f(D_,"Unsupported Network",ci)}t.a;return f(X_,"Connect to Wallet",qD)}())},zD=function(e){return{$:"AutoabortIntervalChanged",a:e}},YD=function(e){return{$:"ChangePaymentMethodText",a:e}},WD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),JD=WD,QD=function(e){return f(JD,M([bA(d(zR,0,0,0,.2))]),function(){return fl("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")}())},XD={$:"TextArea"},ZD=r(function(e,t){return l(zL,{autofill:ci,spellchecked:t.spellcheck,type_:XD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),eU=n(function(e,t,r){var n=f(Kk,M([bN(22),vN]),fl("Payment Method")),a=f(ZD,M([ET(jk),yT(zk(150)),Wk(d(U_,155,203,255,.2)),h$(0)]),{label:pL("payment method"),onChange:YD,placeholder:""===r?si(QD(t)):ci,spellcheck:!0,text:r});return f(ON,M([kN(20),b$({bottom:15,left:45,right:45,top:0}),ET(jk),P_(f(L_,M([sL,XL(30),nR(10),bN(20),ET(zk(400))]),e))]),M([n,a]))}),tU=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."},rU=a(function(e,t,r,n){var a=l(Rs,e,P("0"),Ni(n));return f(Kk,M([bN(22),bA(t)]),fl(U(a,r)))}),nU=function(e){return jd(e)<0?Vl(0):e},aU=n(function(e,t,n){var a=r(function(e,r){return f(ON,M([kN(4)]),M([f(Kk,M([nR(4),uN,pN(n(f(mb,t,e)))]),f(lR,M([yT(zk(10))]),dR)),r,f(Kk,M([nR(4),uN,pN(n(function(e){return jd(e)?e:Vl(3e5)}(nU(f(_R,t,e)))))]),f(lR,M([yT(zk(10))]),uR))]))}),i=QR(t);return f(VN,M([KD,kN(10)]),M([f(a,Vl(864e5),d(rU,3,e," days",i.days)),f(a,Vl(36e5),d(rU,2,e," hours",i.hours)),f(a,Vl(3e5),d(rU,2,e," min",i.min))]))}),iU=o(function(e,t,r,n,a,i){var o=f(Kk,M([Wk(d(U_,155,203,255,.2)),cN(5),nR(15),P_(f(L_,M([sL]),a))]),l(aU,PR,n,i)),u=f(VN,M([kN(30)]),M([f(lR,M([yT(zk(40)),pN(E_(d(Zd,"click","misclick","symbol for "+t,0)))]),e),f(Kk,M([bN(22),vN]),fl(t))])),s=f($N,M([bN(17),pR,bA(O_)]),M([fl(r)]));return f(ON,M([ET(jk),cN(10),Wk(l(Ok,237,237,237)),kN(2)]),f(xa,Kk(M([Wk(tN),f(aN,45,18),ET(jk)])),M([u,f(VN,M([ET(jk),kN(25),Wk(tN)]),M([o,s]))])))}),oU=oR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),uU=f(oN,eR,RT.clipX),sU=f(oN,eR,RT.clipY),cU=i(function(e,t,r,n,a){return f(ON,M([kN(15),cN(8),uU,sU,Wk(tN)]),M([p(iU,oU,"Payment Window",tU(a),r,n,zD),l(eU,t,a,e)]))}),fU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},lU=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."},dU=oR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),hU=n(function(e,t,r){return f(Kk,M([cN(8),uU,sU,Wk(tN)]),p(iU,dU,"Burn/Release Window",lU(r),e,t,fU))}),pU=function(e){return{$:"AutorecallIntervalChanged",a:e}},gU=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."},vU=oR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),yU=n(function(e,t,r){return f(Kk,M([cN(8),Wk(tN),uU,sU]),p(iU,vU,"Open Window",gU(r),e,t,pU))}),mU=function(e){return f(ON,M([ET(jk),kN(20)]),M([l(yU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(cU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(hU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},bU=function(e){return f(ON,M([ET(f($_,1e3,jk)),wN,kN(20),b$({bottom:30,left:40,right:40,top:0}),pN(b_(!1)),v_(iL(e))]),M([HD(e),mU(e),GD(e.wallet)]))},CU=As(Fm(8226)),EU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),SU=r(function(e,t){return l(Ra,ka,t,e)}),TU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(SU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),wU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(SU,f(lc,e%r,t),l(TU,yr,e/r|0,t))):f(lc,e,t)}),IU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(fw,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(TS,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),AU=function(e){return d(IU,Ua,sm,e,yr)},BU=r(function(e,t){return f(Kk,M([ET(jk),v_(f(VN,M([kN(3),ET(rR(100)),ET(t),tR]),f(EU,f(Kk,M([bA(d(zR,0,0,0,.1)),bN(14)]),fl(CU)),f(xa,f(Da,Kk(M([bA(d(zR,0,0,0,.2))])),fl),f(wU,100,(e?$a:Ua)(AU(f(xa,f(zo,fu,Qa),Ia(KR)))))))))]),fl(" "))}),kU=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e))))),wT(M([n])))}),NU=lA(RT.italic),RU=function(){var e=f(Da,Kk(M([bA(l(pA,.8,.2,.2))])),fl),t=f(Da,Kk(M([_N])),fl);return f(ON,M([ET(jk),yT(jk),Wk(tN),cN(6),kN(50),W$({blur:20,color:d(U_,0,0,0,.1),offset:L(0,3),size:0}),cN(10),nR(20)]),M([f(BU,!1,jk),f(ON,M([wN,ET(f($_,700,jk)),kN(20)]),M([f($N,M([bN(70),_N,wN,Z$]),M([fl("DAI"),e("Hard")])),f(VN,M([bN(30),vN,wN,Z$,NU]),M([fl("The "),e("Global"),fl(", "),e("Unkillable"),fl(" Crypto Gateway")]))])),f(VN,M([Wk(bR),kN(2),wN,u_,ET(jk)]),M([f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([kN(60),PN]),M([f(Kk,M([bN(40),vN,wN]),fl("Want to learn more?")),f(ON,M([kN(15)]),M([f(kU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(w_),bA(tN),_N,bN(24),wN]),{label:f($N,M([Z$]),M([fl("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"}),f(kU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(w_),bA(tN),_N,bN(24),wN]),{label:f($N,M([Z$]),M([fl("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})]))]))),f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([A$,kN(60)]),M([f(Kk,M([bN(40),vN,wN]),fl("Ready to try it out?")),f(ON,M([kN(10),ET(zk(400)),wN]),M([f($N,M([bN(24),ET(jk)]),M([fl("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f($N,M([bN(24),ET(jk)]),M([fl("Then follow the links at the top of this page to browse "),t("Sell Offers"),fl(", browse "),t("Buy Offers"),fl(", or "),t("Create Your Own Offer"),fl(".")]))]))])))])),f(Kk,M([rL,ET(jk)]),f(BU,!0,jk))]))}(),$U=r(function(e,t){return f(Ay,f(zo,function(e){return e.type_},Ja(e)),t)}),_U=function(e){return{$:"ShowCurrencyDropdown",a:e}},LU=r(function(e,t){return ml(t(e))}),xU=a(function(e,t,r,n){var a=l(LU,e,n.filterFunc,ay(f(xa,qN,r)));return R(a,yr)?qk:f(Yi,Rv,d(g$,e,n.tradeTable,M([t?Av:xo,WN,zN,YN,JN,GN]),a))}),PU=function(e){return{$:"FiltersMsg",a:e}},DU={$:"ApplyInputs"},UU=PL("disabled"),OU=function(e){return{$:"MayPreventDefault",a:e}},MU=r(function(e,t){return f(lN,e,OU(t))}),FU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):hu("Not the enter key")},n=f(du,r,f(Oh,"key",pu));return ST(f(MU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),VU=function(e){return f(FU,"Enter",e)},KU={$:"Button"},HU=r(function(e,t){var r=t.onPress,n=t.label;return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY+" "+RT.seButton+" "+RT.noTextSelection),f(ka,uN,f(ka,_L(e),f(ka,NN(KU),f(ka,ST(L$(0)),function(){if("Nothing"===r.$)return f(ka,ST(UU(!0)),e);var t=r.a;return f(ka,pN(t),f(ka,VU(t),e))}()))))))),wT(M([n])))}),jU=f(HU,M([Wk(w_),nR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,ZN]),fl("Apply")),onPress:si(DU)}),qU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(yA,sN,l(jI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},GU=function(e){return f(dN,"focus",Fi(e))},zU=f(Da,ST,GU),YU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([zU(e(!0)),lx(e(!0))])}();return f(VN,U(e,M([yT(zk(40)),W$({blur:20,color:d(U_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Kk,M([Wk(wR),yT(zk(40)),qU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Kk,M([ZN,f(aN,10,0)]),r)),f(YL,U(s,U(t,M([ET(zk(100)),yT(zk(40)),l$(wR),qU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),Q$({bottom:1,left:0,right:1,top:1})]))),{label:pL(n),onChange:u,placeholder:i,text:a})]))}),WU=function(e){return{$:"MaxDaiChanged",a:e}},JU=function(e){return{$:"MinDaiChanged",a:e}},QU=r(function(e,t){return f(ON,M([ET(jk),kN(8)]),M([f(Kk,M([bN(17),pR]),fl(e)),t]))}),XU=ZT(25),ZU=function(e){return{$:"MoveX",a:e}},eO=function(e){return f(K$,XU,ZU(-e))},tO={$:"OnLeft"},rO=function(e){return f(e$,tO,e)},nO=n(function(e,t,r){var n=lL(M([ZN])),a=f(VN,M([kN(8),ZN,ET(zk(60))]),M([n,f(Kk,M([bN(16),ZN]),fl("max"))])),i=f(VN,M([kN(8),ZN,ET(zk(60))]),M([n,f(Kk,M([bN(16),ZN]),fl("min"))]));return f(QU,"Dai Range",f(ON,M([kN(5),ET(zk(200))]),M([v(YU,M([rO(f(L_,M([eO(5),ET(zk(200))]),r.minDai))]),M([zU(_U(!1))]),i,"min Dai",e,ci,ci,JU),v(YU,M([rO(f(L_,M([eO(5),ET(zk(200))]),r.maxDai))]),M([zU(_U(!1))]),a,"max Dai",t,ci,ci,WU)])))}),aO=function(e){var t=f(fp,e,KR);if("Nothing"===t.$)return fl("*");var r=t.a,n=r.b;return f(lR,M([yT(zk(26))]),n)},iO=function(e){return{$:"AppCmd",a:e}},oO=function(e){return{$:"FiatTypeInputChanged",a:e}},uO=n(function(e,t,r){var n=iO(d(Zd,"click","misclick","currency flag",0)),a=aO(t);f(VN,M([kN(8),ZN,ET(zk(60))]),M([a,f(Kk,M([bN(16),ZN]),fl("max"))])),f(VN,M([kN(8),ZN,ET(zk(60))]),M([a,f(Kk,M([bN(16),ZN]),fl("min"))]));return f(Kk,M([u_,ET(zk(120))]),f(QU,"Fiat Type",h(xD,e,t,_U(!0),oO,n)))}),sO={$:"AddSearchTerm"},cO=function(e){return{$:"PaymentMethodInputChanged",a:e}},fO=f(Oh,"keyCode",zC),lO=function(e){return f(dN,"keyup",f(du,function(t){return 13===t?Fi(e):hu(Ni(t))},fO))},dO=function(e){return f(QU,"Search Payment Methods",f(YL,M([u_,ET(zk(250)),yT(zk(40)),l$(wR),W$({blur:20,color:d(U_,233,237,242,.05),offset:L(0,3),size:0}),k_(lO(sO))]),{label:pL("payment methods search"),onChange:cO,placeholder:ci,text:e}))},hO={$:"ResetSearch"},pO=f(HU,M([Wk(w_),nR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,ZN]),fl("Reset")),onPress:si(hO)}),gO=function(e){return{$:"RemoveTerm",a:e}},vO=function(e){return f(Kk,M([nR(3),u_,uN,pN(gO(e)),bN(10),bA(EN)]),fl("x"))},yO=function(e){if(e.b){var t=e;return f(VN,M([ET(jk),nR(10),kN(10)]),f(xa,function(e){return f(VN,M([Wk(d(U_,16,7,234,.2)),cN(5),nR(4),kN(3)]),M([fl(e),vO(e)]))},t))}return qk},mO=i(function(e,t,r,n,a){var i=function(e){return f(Kk,M([bN(20),vN,bA(bR),wN]),fl(e))},o=f(Eh,Ja(f_),f(xa,p_,e))?M([i("No trades found.")]):f(xa,i,qC(f(xa,function(e){switch(p_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),v_(f(ON,M([kN(5),A$]),o))]),f(VN,M([wN,kN(50)]),M([f(Yi,PU,c_(t)),f(VN,M([ET(bT),kN(10)]),M([f(Kk,M([ET(bT),u_]),l(nO,r.minDai,r.maxDai,n)),f(Kk,M([ET(bT),u_]),l(uO,a,r.fiatType,n)),f(ON,M([ET(bT),u_,kN(5)]),M([dO(r.paymentMethod),yO(r.paymentMethodTerms)])),f(QU," ",f(ON,M([kN(5),ET(bT)]),M([jU,pO])))]))])))}),bO=n(function(e,t,r){var n=function(){return!f(xc,0,f(Bo,function(e){return f(MS,function(e){return e.checked&&"Open"!==e.label},e.options)},f($U,Eo,r.filters)))}();return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),pN(_U(!1)),nR(30)]),M([f(VN,M([ET(jk),kN(10)]),M([h(mO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),d(xU,e,n,t,r)]))}),CO=function(e){return{$:"MessageInputChanged",a:e}},EO={$:"MessageSubmit"},SO=function(e){return f(ON,M([ET(jk),kN(10)]),M([f(ZD,M([ET(jk),yT(zk(100))]),{label:pL("messageInput"),onChange:CO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(HU,M([wN,bN(24)]),{label:fl("Submit"),onPress:si(EO)})]))},TO=f(oN,eR,RT.scrollbarsY),wO=r(function(e,t){return f(Kk,M([yT(jk),ET(jk)]),f(Kk,U(M([k_(f(B_,"position","absolute")),k_(f(B_,"top","0")),k_(f(B_,"right","0")),k_(f(B_,"bottom","0")),k_(f(B_,"left","0")),TO]),e),t))}),IO=l(Ok,200,205,210),AO=n(function(e,t,r){var n=M([PN,Wk(w_),bA(tN),qU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([A$,Wk(IO),bA(PR),qU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Kk,U(M([nR(7)]),u),f($N,yr,M([fl(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(pA,0,0,1),tN,"Initiator opened the trade"));case"Recalled":return si(x(l(pA,0,0,1),tN,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(ru,8,dl(t))+"..";return si(x(l(pA,1,0,1),tN,r+" committed to the trade"));case"Aborted":return si(x(l(pA,1,0,0),tN,"Buyer aborted the trade"));case"Claimed":return si(x(l(pA,0,1,0),tN,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(pA,0,0,1),tN,"Seller released the "+kR(e)+" and closed the contract"));default:return si(x(l(pA,0,0,1),tN,"Seller burned the "+kR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return qk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Kk,M([cN(3),h$(1),l$(l(pA,1,0,1)),wN,Wk(h)]),f($N,M([bA(p)]),M([fl(g)])))}),BO=n(function(e,t,r){if(r.b){var n=r;return f(wO,M([ET(jk),yT(jk),cN(5),h$(1),l$(PR),nR(10)]),f(ON,M([ET(jk),yT(jk),kN(10)]),f(xa,f(AO,e,t),n)))}return f(Kk,M([ET(jk),yT(jk),cN(5),h$(1),l$(PR),wN,bA(l(pA,.5,.5,.5)),NU]),fl("no messages found."))}),kO=Cr,NO=function(e){return f(ON,M([ET(jk),yT(jk),kN(10),h$(1),cN(5),nR(20)]),M([l(BO,e.trade.factory,e.userRole,f(kO,function(e){return e.blocknum},Sa(e.history))),SO(e)]))},RO=function(e){return f(Kk,M([Wk(tN),cN(8),VD,ET(jk),yT(jk)]),NO(e))},$O={$:"ToggleChat"},_O=function(e){if(e.showChatHistory){var t=f(xc,qk,f(Bo,RO,e.chatHistoryModel));return f(Kk,M([yT(jk),ET(zk(500)),nR(20),PN]),l(__,M([yT(jk),ET(jk)]),f(Yi,yE,t),$O))}return qk},LO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},xO=function(e){return GR(e)+" "+e.fiatType},PO={$:"AbortAction"},DO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),UO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return qk}if("LoadedTrade"!==t.b.$)return qk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=xO(n.terms.price),u=o$(Lb(i)),s=o$(n.parameters.tradeAmount)+" "+kR(n.factory),c=function(){return"Buyer"===LO(n.parameters).$?L(f(Kk,M([pR,bA(PR)]),fl("buyer")),M([fl("pay the seller "),f(Kk,M([bA(w_)]),fl(o)),fl(" in exchange for the "),f(Kk,M([bA(w_)]),fl(s)),fl(" held in this contract.")])):L(f(Kk,M([pR,bA(PR)]),fl("seller")),M([fl("accept "),f(Kk,M([bA(w_)]),fl(o)),fl(" from the buyer in exchange for the "),f(Kk,M([bA(w_)]),fl(s)),fl(" held in this contract.")]))}(),d=c.a,h=c.b;return l(__,yr,f(ON,M([kN(20),nR(20),wN,yT(jk),Z$]),M([f(Kk,M([bN(26),vN,wN,ZN]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,ZN]),f(xa,$N(M([wN,bN(18),pR,bA(O_)])),U(M([U(M([fl("You will deposit "),f(Kk,M([bA(w_)]),fl(u+" "+kR(n.factory))),fl(", thereby becoming the "),d,fl(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([fl("(This ususally requires two Metamask signatures. Your "+kR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Kk,M([rL,wN]),f(X_,"Yes, I definitely want to commit to this trade.",l(DO,n,a,i)))])),PO);case"ApproveNeedsSig":return Z_(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return Z_(M([fl("Mining the initial approve transaction..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction on Etherscan"),url:f(eL,n.factory,p)}),fl("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return Z_(M([fl("Waiting for user signature for the final commit call."),fl("(check Metamask!)"),fl("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return Z_(M([fl("Mining the final commit transaction..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction"),url:f(eL,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(__,yr,f(ON,M([kN(20),nR(20),wN,yT(jk),Z$]),M([f(Kk,M([bN(26),vN,wN,ZN]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,ZN]),f(xa,$N(M([wN,bN(18),pR,bA(O_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([fl('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 '+kR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([fl("Aborting will incur a small penalty on both parties, and refund the rest of the "+kR(n.factory)+".")])]);case"Release":return M([M([fl("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([fl("This will destroy the "+kR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Kk,M([rL,wN]),function(e){return f(X_,e,DE(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 "+kR(n.factory)+".";default:return"I understand. Burn the "+kR(n.factory)+"."}}()))])),PO);case"ActionNeedsSig":var g=r.a;return Z_(M([fl("Waiting for user signature for the "+OE(g)+" call."),fl("(check Metamask!)")]));default:var g=r.a,p=r.b;return qk}},OO=VN(M([ET(jk),Wk(tN),cN(5),nR(20),KD,VD])),MO=function(e){return f(VN,M([kN(8)]),M([f(lR,yr,fL),f(Kk,M([bN(24),pR]),fl(o$(e)))]))},FO=r(function(e,t){var r=f(Io,Ao(e),f(Bo,function(e){return e.address},Gd(t)));return f(tx,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"}(),MO(e.parameters.tradeAmount))}),VO=function(e){return f(VN,M([kN(5)]),M([fx(e.fiatType),f(Kk,M([bN(24),pR]),fl(xO(e)))]))},KO=function(e){return f(tx,"For Fiat",VO(e.terms.price))},HO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},jO=l(Ok,250,165,22),qO=l(Ok,255,0,0),GO=l(Ok,0,255,0),zO=oR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),YO=oR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),WO=oR({description:"released",src:"/DAIHard/static/img/released.svg"}),JO={$:"ToggleStatsModal"},QO=function(e){return f(kO,Ua,e)},XO=n(function(e,t,n){var a=ay(f(xa,function(e){return f(ml,function(e){return R(f(ko,e,n),si(t))},f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(fh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(fh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wl,amountReleased:Wl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,Vl,Ql(QO(f(US,function(e){return function(e){return e?si(e):ci}(jd(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}}),ZO=r(function(e,t){return d(Q_,x(d(zR,0,0,1,1),d(zR,0,0,1,.8),d(zR,0,0,1,.6)),tN,e,t)}),eM=function(e){return{$:"ViewUserHistory",a:e}},tM=f(JB,0,yr),rM=f(oN,gN,RT.textNormalWeight),nM=r(function(e,t){return Za(e/t)}),aM=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}}),iM=r(function(e,t){var r=e.a,n=e.b;return l(aM,r,f(nM,jd(t),6e4),n)}),oM=r(function(e,t){return f(_s,24,f(nM,f(iM,e,t),60))}),uM=r(function(e,t){return f(_s,1e3,jd(t))}),sM=r(function(e,t){return f(_s,60,f(iM,e,t))}),cM={$:"Apr"},fM={$:"Aug"},lM={$:"Dec"},dM={$:"Feb"},hM={$:"Jan"},pM={$:"Jul"},gM={$:"Jun"},vM={$:"Mar"},yM={$:"May"},mM={$:"Nov"},bM={$:"Oct"},CM={$:"Sep"},EM=function(e){var t=f(nM,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)}},SM=r(function(e,t){switch(EM(f(iM,e,t)).month){case 1:return hM;case 2:return dM;case 3:return vM;case 4:return cM;case 5:return yM;case 6:return gM;case 7:return pM;case 8:return fM;case 9:return CM;case 10:return bM;case 11:return mM;default:return lM}}),TM=r(function(e,t){return f(_s,60,f(nM,jd(t),1e3))}),wM={$:"Fri"},IM={$:"Mon"},AM={$:"Sat"},BM={$:"Sun"},kM={$:"Thu"},NM={$:"Tue"},RM={$:"Wed"},$M=r(function(e,t){switch(f(_s,7,f(nM,f(iM,e,t),1440))){case 0:return kM;case 1:return wM;case 2:return AM;case 3:return BM;case 4:return IM;case 5:return NM;default:return RM}}),_M=n(function(e,t,r){return e.toAmPm(f(oM,t,r))}),LM=r(function(e,t){return EM(f(iM,e,t)).day}),xM=LM,PM=M([BM,IM,NM,RM,kM,wM,AM]),DM=r(function(e,t){return function(e){return e.a}(f(xc,L(0,BM),Ql(f(ml,function(r){return R(r.b,f($M,e,t))},f(Bi,r(function(e,t){return L(e,t)}),PM)))))}),UM=function(e){return l(Ra,Na,0,e)},OM=r(function(e,t){return EM(f(iM,e,t)).year}),MM=function(e){return!f(_s,4,e)&&(!!f(_s,100,e)||!f(_s,400,e))},FM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return MM(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}}),VM=M([hM,dM,vM,cM,yM,gM,pM,fM,CM,bM,mM,lM]),KM=r(function(e,t){return f(xc,L(0,hM),Ql(f(ml,function(r){r.a;return R(r.b,f(SM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),VM))))}),HM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(KM,e,t))}),jM=r(function(e,t){var r=f(lc,f(HM,e,t)-1,VM);return UM(f(xa,FM(f(OM,e,t)),r))+f(xM,e,t)}),qM=r(function(e,t){return f(HM,e,t)/4|0}),GM=r(function(e,t){var r=Ni(t),n=e-Qo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),zM=function(e){return e?e<=12?e:e-12:12},YM=sv(315576e5),WM=r(function(e,t){return Vl(YM*f(OM,e,t))}),JM=r(function(e,t){var r=f(WM,e,t),n=f(DM,e,r);return 1+((f(jM,e,t)+n)/7|0)}),QM=r(function(e,t){return Ni(f(OM,e,t))}),XM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(HM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(HM,t,r));case"MonthFixed":return f(GM,2,f(HM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(SM,t,r));case"MonthNameFull":return e.toMonthName(f(SM,t,r));case"QuarterNumber":return Ni(1+f(qM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(qM,t,r));case"DayOfMonthNumber":return Ni(f(xM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(xM,t,r));case"DayOfMonthFixed":return f(GM,2,f(xM,t,r));case"DayOfYearNumber":return Ni(f(jM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(jM,t,r));case"DayOfYearFixed":return f(GM,3,f(jM,t,r));case"DayOfWeekNumber":return Ni(f(DM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(DM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f($M,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f($M,t,r));case"WeekOfYearNumber":return Ni(f(JM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(JM,t,r));case"WeekOfYearFixed":return f(GM,2,f(JM,t,r));case"YearNumberLastTwo":return f(ou,2,f(QM,t,r));case"YearNumber":return f(QM,t,r);case"AmPmUppercase":return ND(l(_M,e,t,r));case"AmPmLowercase":return sd(l(_M,e,t,r));case"HourMilitaryNumber":return Ni(f(oM,t,r));case"HourMilitaryFixed":return f(GM,2,f(oM,t,r));case"HourNumber":return Ni(zM(f(oM,t,r)));case"HourFixed":return f(GM,2,zM(f(oM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(oM,t,r));case"HourMilitaryFromOneFixed":return f(GM,2,1+f(oM,t,r));case"MinuteNumber":return Ni(f(sM,t,r));case"MinuteFixed":return f(GM,2,f(sM,t,r));case"SecondNumber":return Ni(f(TM,t,r));case"SecondFixed":return f(GM,2,f(TM,t,r));case"MillisecondNumber":return Ni(f(uM,t,r));case"MillisecondFixed":return f(GM,3,f(uM,t,r));default:return n.a}}),ZM=a(function(e,t,r,n){return f(Ri,"",f(xa,l(XM,e,r,n),t))}),eF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),tF=function(e){return e>11?"pm":"am"},rF=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"}},nF=function(e){switch(f(_s,100,e)){case 11:case 12:case 13:return"th";default:switch(f(_s,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},aF=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"}},iF=p(eF,rF,f(zo,rF,ru(3)),aF,f(zo,aF,ru(3)),tF,nF),oF=ZM(iF),uF={$:"MonthNameFull"},sF=uF,cF=function(e){return{$:"Text",a:e}},fF=cF,lF={$:"YearNumber"},dF=lF,hF=n(function(e,t,n){var a=r(function(e,t){return f(ON,M([bN(18),kN(6)]),M([f(Kk,M([_N]),fl(e)),f(Kk,M([rM]),fl(t))]))}),i=oF(M([sF,fF(", "),dF])),o=f(ON,M([kN(23),ET(jk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,tM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+o$(n.amountReleased)+" "+kR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+o$(n.amountBurned)+" "+kR(e)+" Burned")])),M([f(Kk,M([wN]),f(ZO,"View User History",eM(n.asRole)))])));return f(ON,M([cN(8),uU,sU,Wk(wR),kN(1),W$({blur:20,color:d(zR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Kk,M([ET(jk),Wk(tN),nR(17)]),f(y$,18,t)),f(Kk,M([ET(jk),Wk(tN),nR(17)]),o)]))}),pF=n(function(e,t,r){var n=l(XO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=HO(e.parameters.initiatorRole)+" Stats";return f(Kk,r?M([QL(f(Kk,M([XL(30),PN]),l(hF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(tx,a,f(VN,M([ET(jk),kN(20),uN,pN(JO)]),f(xa,VN(M([kN(5)])),M([M([f(lR,M([yT(zk(28))]),WO),f(Kk,M([bN(24),pR,bA(GO)]),fl(l(Rs,2,P("0"),Ni(n.numReleases))))]),M([f(lR,M([yT(zk(28))]),zO),f(Kk,M([bN(24),pR,bA(jO)]),fl(l(Rs,2,P("0"),Ni(n.numAborts))))]),M([f(lR,M([yT(zk(28))]),YO),f(Kk,M([bN(24),pR,bA(qO)]),fl(l(Rs,2,P("0"),Ni(n.numBurns))))])])))))}),gF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+dl(t)}e.a;return"https://kovan.etherscan.io/address/"+dl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+dl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+dl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+dl(t)}}),vF=n(function(e,t,r){return f(dA,e,{label:fl(dl(r)),url:f(gF,t,r)})}),yF=function(e){return f(tx,"Trade Status",f(ON,M([bN(24),pR,kN(8)]),M([fl(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(vF,M([bN(12),bA(w_),nL]),e.factory,e.creationInfo.address)])))},mF=i(function(e,t,r,n,a){return OO(M([yF(t),f(FO,t,r),KO(t),l(pF,t,n,a)]))}),bF=l(Ok,9,32,107),CF=oR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),EF=f(Kk,M([cN(4),uN,pN($O),nR(5),Wk(l(Ok,22,0,255))]),f(lR,M([ET(zk(42))]),CF)),SF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},TF=function(e){return f(ON,M([cN(12),Wk(wR),nR(15),kN(15)]),M([f(Kk,M([bN(24),vN,NU]),fl("Fiat Payment Method")),f($N,M([bN(18),yT(bT),Wk(tN),W$({blur:5,color:d(zR,0,0,0,.2),offset:L(-3,3),size:0}),cN(3),nR(5)]),M([f(xc,f(Kk,M([bA(OD),NU]),fl("No payment methods found.")),f(Bo,fl,f(Bo,function(e){return e.info},Ql(e))))]))]))},wF={$:"Active"},IF=function(e){return{$:"ExpandPhase",a:e}},AF=M([Wk(bF),bA(tN)]),BF=r(function(e,t){return{$:"Min",a:e,b:t}}),kF=r(function(e,t){return f(BF,e,t)}),NF=function(e){return M(e?[cN(12),u_,yT(f(kF,380,bT))]:[cN(12),wN])},RF=M([Wk(tN)]),$F=oR({description:"flame",src:"/DAIHard/static/img/flame.png"}),_F=r(function(e,t){return Hl(f(ds,jl(e),jl(t)))}),LF=r(function(e,t){return d(Q_,x(d(zR,1,.6,.2,1),d(zR,1,.6,.2,.8),d(zR,1,.6,.2,.6)),tN,e,t)}),xF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),PF=function(e){return{$:"ContractActionClicked",a:e}},DF={$:"Web3Connect"},UF=n(function(e,t,r){var n=Gd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(LR,e,t).$?qk:f(VN,M([kN(8)]),function(){var e=x(t.state.phase,f(Ao,t,a.address),f(ko,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,DE,f(ZO,"Remove and Refund this Trade",xE))])}break e}var r=(e.a,e.b,jl(hb(t.parameters)));return M([f(X_,"Deposit and Commit to Trade",l(xF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,PF,f(LF,"Abort Trade",bE)),f(Yi,PF,f(X_,"Confirm Payment",AE)),EF])}e.a,e.c.a;return M([EF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,PF,f(X_,"Burn it All!",IE)),f(Yi,PF,f(ZO,"Release Everything",PE)),EF])}e.a,e.c.a;return M([EF])}break e;default:break e}return yr}())}return f(X_,"Connect to Wallet",DF)}),OF={$:"Finished"},MF={$:"NotStarted"},FF=r(function(e,t){var r=L(CR(t),CR(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?MF:R(n,a)?wF:OF}),VF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),KF=r(function(e,t){return l(VF,yr,e,t)}),HF=a(function(e,t,r,n){var a=o$(f(fh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+kR(r.factory),i=o$(r.parameters.tradeAmount)+" "+kR(r.factory),o=f(VN,yr,f(KF,3,f(lR,M([yT(zk(18))]),$F))),u=f(Da,Kk(M([bA(l(pA,1,0,0))])),fl),s=R(e,r.state.phase),c=f(Io,ko(r),f(Bo,function(e){return e.address},Gd(n))),d=s?tN:PR,h=$N(M([bA(d),bN(18),vN])),p=xO(r.terms.price),g=s?l(Ok,0,226,255):l(Ok,16,7,234),v=f(Da,Kk(M([bA(g)])),fl),y=o$(r.parameters.buyerDeposit)+" "+kR(r.factory),m=r.parameters.abortPunishment,b=o$(m)+" "+kR(r.factory),C=o$(f(_F,r.parameters.buyerDeposit,m))+" "+kR(r.factory),E=o$(f(_F,r.parameters.tradeAmount,m))+" "+kR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([fl("Your "),u("burnable deposit"),fl(" of "),v(y),fl(" is now held in this contract, and your offer to buy "),v(i),fl(" for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Seller by depositing the full "),v(i),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),fl(" to you.")])])):f(xa,h,M([M([fl("Your offer to sell the "),v(i),fl(" held in this contract for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),fl(" of 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),fl(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([fl("You must now pay the Seller "),v(p),fl(" via the Fiat Payment Method, "),f(Kk,M([vN]),fl("and then click ")),u("Confirm Payment"),fl(" before the payment window runs out. Use the chat to coordinate.")]),M([fl("If you abort the trade, or do not confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to you).")]),M([fl("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),fl(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([fl("Work and communicate with the Buyer to receive "),v(p),fl(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to you, "),v(C),fl(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),fl(" will be released to you.")]),M([fl("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),fl(" In this case the "),v(a),fl(" will be lost to both parties.")]),M([fl("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([fl("So, have you recieved the "),v(p),fl("? If so, you can click "),v("Release Everything"),fl(".")]),M([fl("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),fl(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([fl("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([fl("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([fl("The Seller has deposited "),v(i),fl(" into this contract, and offers to sell it for "),v(p),fl(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("If the trade is successful, the combined "+kR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),fl(" within the payment window.")])])):f(xa,h,M([M([fl("The Buyer is offering to buy "),v(i),fl(" for "),v(p),fl(", and has deposited "),v(y),fl(" into this contract as a "),u("burnable deposit"),fl(". To become the Seller, deposit "),v(i),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("When you receive the "),v(p),fl(" from the Buyer, the combined "+kR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can receive "),v(p),fl(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([fl("During this phase, the Buyer is expected to transfer "),v(p),fl(" to the Seller, as described in Fiat Payment Method, "),f(Kk,M([vN]),fl("and ")),u("Confirm the Payment "),fl(" before the payment window runs out. This would move the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(" amount) will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([fl("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([fl("If the Seller can verify he has received the "),v(p),fl(", he will probably release the total balance of "),v(i),fl(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),fl(".")]),M([fl("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),fl(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(ON,M([ET(jk),yT(jk),nR(20),kN(30)]),M([f(VN,M([ET(jk)]),M([f(Kk,M([bN(24),vN,bA(g),A$]),fl(T))])),f(ON,M([ET(jk),ZN,kN(13)]),w),f(Kk,M([PN]),function(){switch(f(FF,r,e).$){case"Active":return l(UF,t,r,n);case"NotStarted":return f(Kk,M([bN(20),vN,NU,bA(bR)]),fl("Phase not yet started."));default:return f(Kk,M([bN(20),vN,NU]),fl("Phase no longer active."))}}())]))}),jF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},qF=oR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),GF=oR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),zF={$:"None"},YF=zF,WF=oR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),JF=function(e){switch(e.$){case"Open":return WF;case"Committed":return qF;case"Judgment":return GF;default:return YF}},QF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),XF=a(function(e,t,r,n){return d(QF,e,t,r,n)}),ZF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},eV=function(e){return function(e){return d(XF,e.red,e.green,e.blue,e.alpha)}(ZF(e))},tV=function(e){return{$:"Circle",a:e}},rV=tV,nV=d(QF,0,0,0,1),aV={$:"Flat"},iV={$:"Sharp"},oV=function(e){return{$:"Uniform",a:e}},uV=oV,sV={cap:aV,dashPattern:yr,dashPhase:0,fill:uV(nV),join:iV,thickness:2},cV=n(function(e,t,r){return D(sV,{dashPattern:e,fill:r,thickness:t})}),fV=cV(yr),lV={$:"Transparent"},dV=lV,hV=f(fV,0,dV),pV=r(function(e,t){return{$:"Shape",a:e,b:t}}),gV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},vV=function(e){return f(Da,gV,pV(e))},yV=function(e){return vV(L(e,hV))},mV=function(e){return L(-e.a,-e.b)},bV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),CV=r(function(e,t){return f(bV,mV(e(t)),t)}),EV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},SV=r(function(e,t){return{$:"Path",a:e,b:t}}),TV=kr,wV=Nr,IV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=wV(n),i=TV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},AV=function(e){return xa(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)})},BV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(AV,e,M([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),kV=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},NV=function(e){var t=RV(e.basic),r=EV(f(xa,IV(e),t)),n=r.a,a=r.b;return{toBottom:-f(xc,0,gI(a)),toLeft:-f(xc,0,gI(n)),toRight:f(xc,0,pI(n)),toTop:f(xc,0,pI(a))}},RV=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(BV,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(BV,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(BV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(AV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(SV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(AV,R(C,aV)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(BV,0,E);case"Group":var S=e.a;return f(AV,0,ay(f(xa,f(zo,NV,kV),S)));default:var T=e.b;return f(AV,0,kV(NV(T)))}},$V=function(e){var t=NV(e);return t.toTop+t.toBottom},_V=function(e){var t=NV(e);return L(-t.toLeft,t.toTop)},LV=function(e){var t=NV(e);return t.toLeft+t.toRight},xV=En("http://www.w3.org/2000/svg"),PV=xV("svg"),DV=Nn("height"),UV=Nn("version"),OV=Nn("width"),MV=xV("circle"),FV=xV("ellipse"),VV=xV("foreignObject"),KV=xV("g"),HV=xV("image"),jV=xV("polygon"),qV=xV("polyline"),GV=xV("rect"),zV=Tw,YV=xV("text"),WV=Nn("id"),JV=Nn("points"),QV=Nn("r"),XV=Nn("rx"),ZV=Nn("ry"),eK=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},tK=function(e){return{$:"Group",a:e}},rK=Nn("dominant-baseline"),nK=Nn("fill"),aK=Nn("fill-opacity"),iK=Nn("font-family"),oK=Nn("font-size"),uK=Nn("font-style"),sK=Nn("font-variant"),cK=Nn("font-weight"),fK=Nn("opacity"),lK=Nn("stroke"),dK=Nn("stroke-dasharray"),hK=Nn("stroke-dashoffset"),pK=Nn("stroke-linecap"),gK=Nn("stroke-linejoin"),vK=Nn("stroke-opacity"),yK=Nn("stroke-width"),mK=Nn("text-anchor"),bK=Nn("text-decoration"),CK=Nn("transform"),EK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},SK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},TK=n(function(e,t,r){return d(QF,e,t,r,1)}),wK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return sv(1e4*e)/100};return Cd(M(["rgba(",mw(i(t)),"%,",mw(i(r)),"%,",mw(i(n)),"%,",mw(function(e){return sv(1e3*e)/1e3}(a)),")"]))},IK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},AK=function(e){var t=IK(e),r=t.red,n=t.green,a=t.blue;return wK(l(TK,r,n,a))},BK=function(e){if("Uniform"===e.$){var t=e.a;return AK(t)}return"none"},kK=function(e){var t=IK(e),r=t.alpha;return mw(r)},NK=function(e){if("Uniform"===e.$){var t=e.a;return kK(t)}return"0"},RK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},$K=function(e){var t=mw(e.scale.b),r=mw(e.scale.a),n=mw(-e.rotation/2/O$*360),a=mw(-e.shift.b),i=mw(e.shift.a);return Cd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},_K=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([lK(BK(r.fill)),vK(NK(r.fill)),yK(mw(r.thickness)),pK(EK(r.cap)),gK(RK(r.join)),nK("none"),fK(mw(e.opacity)),CK($K(e)),hK(Ni(r.dashPhase)),dK(SK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([nK(BK(a)),aK(NK(a)),lK(BK(r.fill)),vK(NK(r.fill)),yK(mw(r.thickness)),pK(EK(r.cap)),gK(RK(r.join)),fK(mw(e.opacity)),CK($K(e)),hK(Ni(r.dashPhase)),dK(SK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([nK(BK(oV(o.color))),iK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),oK(Ni(o.size)),cK(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"}}()),uK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),sK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),bK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),mK("middle"),rK("middle"),CK($K(e))]);default:return M([CK($K(e))])}},LK=Nn("x"),xK=Nn("y"),PK=r(function(e,t){return M([OV(mw(e)),DV(mw(t)),LK(mw(-e/2)),xK(mw(-t/2))])}),DK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([mw(t),mw(-r)]))},e))},UK=dN,OK=r(function(e,t){return f(e,t.a,t.b)}),MK=function(e){return f(xa,OK(UK),e)},FK=function(e){e:for(;;){var t=f(xc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(qV,U(M([WV(t),JV(DK(i))]),U(_K(e),MK(e.handlers))),yr);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,U(M([WV(t),JV(DK(i))]),U(_K(e),MK(e.handlers))),yr);case"Circle":var c=s.a;return f(MV,U(M([WV(t),QV(mw(c))]),U(_K(e),MK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(FV,U(M([WV(t),XV(mw(d)),ZV(mw(h))]),U(_K(e),MK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(GV,U(M([WV(t),XV(mw(c)),ZV(mw(c))]),U(f(PK,p,g),U(_K(e),MK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(SV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(YV,U(M([WV(t)]),U(_K(e),MK(e.handlers))),M([zV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(HV,U(M([WV(t),eK(C)]),U(f(PK,p,g),U(_K(e),MK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(VV,U(M([WV(t)]),U(f(PK,p,g),U(_K(e),MK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(KV,f(ka,WV(t),U(_K(e),MK(e.handlers))),l(Ra,r(function(e,t){return f(ka,FK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:tK(M([w,I]))});e=v;continue e}}},VK=r(function(e,t){var r=e.a,n=e.b,a=mw(r),i=mw(n);return f(jT,yr,M([f(PV,M([OV(a),DV(i),UV("1.1")]),M([FK(t)]))]))}),KK=function(e){return f(VK,L(LV(e),$V(e)),f(CV,_V,e))},HK=r(function(e,t){var r=JF(e),n=function(){switch(t.$){case"NotStarted":return l(Ok,10,33,108);case"Active":return l(Ok,0,100,170);default:return l(Ok,1,129,104)}}(),a=dx(KK(f(yV,uV(eV(n)),rV(50))));return f(Kk,M([wN,v_(f(lR,M([wN,ZN,yT(zk(60))]),r))]),a)}),jK=function(e){var t=M([NU,vN,bN(20)]);switch(e.$){case"Active":return f(Kk,U(t,M([bA(EN)])),fl("Active"));case"NotStarted":return f(Kk,U(t,M([bA(bR)])),fl("Not Started"));default:return f(Kk,t,fl("Finished"))}},qK=n(function(e,t,r){var n=f(FF,t,e),a=function(){return"Active"===n.$?l(Ok,0,226,255):PR}(),i=f(Kk,M([bA(a),bN(20),vN,wN]),fl(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 qk;switch(n.$){case"NotStarted":return d(XR,M([wN]),M([bN(22),pR]),L(PR,wR),f($R,e,t));case"Active":var a=f(LR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(i$,M([wN]),M([bN(22),pR]),L(tN,wR),i)}return f(ON,M([wN,kN(10)]),M([f(Kk,M([wN]),fl(jF(e))),f(ZO,"Poke",DE(LE))]));default:return f(Kk,M([yT(zk(1))]),qk)}}();return f(ON,M([nR(20),kN(10),yT(jk)]),M([f(Kk,M([u_,wN]),i),f(Kk,M([yT(jk),wN]),f(Kk,M([ZN]),f(HK,e,n))),f(ON,M([kN(10),rL,wN]),M([f(Kk,M([wN]),jK(n)),o]))]))}),GK=o(function(e,t,r,n,a,i){var o=f(FF,r,t),u=f(Kk,M([nR(10),ET(jk),yT(jk)]),d(HF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Vl(0)}}(),c=l(qK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(_R,f(mb,r.state.phaseStartTime,s),i);default:Vl(0)}}(),f(Kk,M([yT(jk),ET(zk(1)),Wk(function(){return"Active"===o.$?l(pA,0,0,1):wR}())]),qk)),p=a?f(VN,U(NF(e),U(R(o,wF)?AF:RF,M([ET(jk)]))),M([c,h,u])):f(VN,U(NF(e),U(R(o,wF)?AF:RF,M([uN,pN(IF(t))]))),M([c]));return!e&&R(o,wF)?f(ON,M([ET(jk),kN(20),b$({bottom:20,left:0,right:0,top:0})]),M([p,TF(r.terms.paymentMethods)])):p}),zK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(VN,M([wN,cN(12),nR(30),kN(10),Wk(bF),bN(24),vN,bA(tN)]),M([fl("Trade "+SF(t.state.closedReason)),EF])):e?f(ON,M([ET(jk),kN(10)]),M([f(VN,M([ET(jk),yT(bT),kN(20)]),M([p(GK,e,Co,t,n,R(r,Co),a),p(GK,e,mo,t,n,R(r,mo),a),p(GK,e,bo,t,n,R(r,bo),a)])),TF(t.terms.paymentMethods)])):f(ON,M([ET(jk),yT(bT),kN(20)]),M([p(GK,e,Co,t,n,R(r,Co),a),p(GK,e,mo,t,n,R(r,mo),a),p(GK,e,bo,t,n,R(r,bo),a)]))}),YK=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(ON,M([ET(jk),yT(jk),kN(40)]),M([h(mF,t,i,n.wallet,r,n.showStatsModal),f(Kk,M([ET(jk),f(aN,40,0),kN(40)]),h(zK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Kk,M([wN,ZN,bN(30)]),fl("Loading trade info..."));default:return f(Kk,M([wN,ZN,bN(30)]),fl("Invalid trade"))}}(),M([_O(n),UO(n)]))}),WK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),JK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(RU,yr);case"CreateModel":var n=r.a;return L(f(Yi,Uy,bU(n)),yr);case"TradeModel":var a=r.a;return l(WK,Yi(Fy),xa(Yi(Fy)),d(YK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,fT,l(bO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,oT,l(m_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Kk,M([ET(jk),yT(jk),cN(10)]),n),a)}),QK=function(e){return{$:"DismissNotice",a:e}},XK=function(e){return f(K$,XU,ZU(e))},ZK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(pA,1,1,1):l(pA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Ok,100,200,255);case"Caution":return l(Ok,255,188,0);case"Error":return l(Ok,255,70,70);default:return l(Ok,200,200,200)}}(),o=f(Kk,M([PN,u_,H$(5),XK(5)]),I_(QK(t)));return f(Kk,M([Wk(i),cN(10),nR(8),ET(jk),h$(1),l$(d(zR,0,0,0,.15)),VD]),f(ON,M([kN(4),ET(jk)]),f(Bi,r(function(e,t){return f($N,M([ET(jk),bA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},eH=function(e){return R(e,yr)?yr:M([f(ON,M([eO(20),H$(20),kN(10),PN,rL,ET(zk(300)),bN(15)]),f(xa,ZK,f(ml,function(e){return R(e.b.align,ul)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(ON,M([XK(20),XL(100),kN(10),A$,u_,ET(zk(300)),bN(15)]),f(xa,ZK,f(ml,function(e){return R(e.b.align,CB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},tH=r(function(e,t){var r=f(JK,e,t),n=r.a,a=r.b;return L(f(ON,M([t$(Jk),v_(KN(t)),ET(jk),yT(jk),nR(30)]),M([f(Kk,M([yT(zk(50))]),qk),n])),U(a,eH(t.userNotices)))}),rH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),nH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),aH={$:"AllowHover"},iH={$:"Layout"},oH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(hA,155/255,203/255,1,1),offset:L(0,0),size:3})},uH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?oH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?aH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?iH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},sH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(AT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),AT);case"Text":var a=t.a;return $I(a);default:return $I("")}}),cH=n(function(e,t,r){var n=uH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?rH(n):nH(n)}();return f(sH,a,d(fA,AT,Vk,t,wT(M([r]))))}),fH=ZT(5),lH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),dH={$:"SansSerif"},hH=function(e){return{$:"Typeface",a:e}},pH=Y,gH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",pH(sd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",pH(sd(t)));default:var t=e.a.name;return f(Ri,"-",pH(sd(t)))}}())}),vH=function(){var e=M([hH("Open Sans"),hH("Helvetica"),hH("Verdana"),dH]);return M([f(yA,Yk,l(vA,"bg-color-"+mA(d(hA,1,1,1,0)),"background-color",d(hA,1,1,1,0))),f(yA,gA,l(vA,"font-color-"+mA(d(hA,0,0,0,1)),"color",d(hA,0,0,0,1))),f(yA,yN,mN(20)),f(yA,fH,f(lH,l(Ra,gH,"font-",e),e))])}(),yH=n(function(e,t,r){var n=e.options;return l(cH,n,f(ka,lA(f(Ri," ",M([RT.root,RT.any,RT.single]))),U(vH,t)),r)}),mH=yH({options:yr}),bH=function(e){return f(yA,fH,f(lH,l(Ra,gH,"ff-",e),e))},CH=dH,EH=hH,SH=function(e){return{body:M([function(){var t=f(tH,e.screenWidth,e),r=t.a,n=t.b,a=U(M([ET(jk),yT(jk),bH(M([EH("Soleil"),CH]))]),f(xa,v_,n));return f(mH,a,r)}()]),title:"DAIHard"}},TH=Ht,wH=TH({init:OB,onUrlChange:Uk,onUrlRequest:Dk,subscriptions:Pk,update:sB,view:SH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:wH(f(du,function(e){return f(du,function(t){return f(du,function(r){return Fi({height:r,networkId:t,width:e})},f(Oh,"height",zC))},f(Oh,"networkId",zC))},f(Oh,"width",zC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/src/Marketplace/View.elm b/src/Marketplace/View.elm index d8ecf4c..32cb299 100644 --- a/src/Marketplace/View.elm +++ b/src/Marketplace/View.elm @@ -33,20 +33,22 @@ import TradeTable.View as TradeTable root : Time.Posix -> List TradeCache -> Model -> Element Msg root time tradeCaches model = let - showPhase = + onlyOpenPhaseChecked = let - numPhasesChecked = + nonOpenPhasesChecked = model.filters |> Filters.getFilterSet Filters.Phase |> Maybe.map (\filterSet -> List.Extra.count - .checked + (\filter -> + filter.checked && filter.label /= "Open" + ) filterSet.options ) |> Maybe.withDefault 0 in - numPhasesChecked /= 1 + nonOpenPhasesChecked == 0 in Element.column [ Element.Border.rounded 5 @@ -64,7 +66,7 @@ root time tradeCaches model = ] , maybeResultsElement time - showPhase + onlyOpenPhaseChecked tradeCaches model ] @@ -194,7 +196,7 @@ removeSearchTermButton term = maybeResultsElement : Time.Posix -> Bool -> List TradeCache -> Model -> Element Msg -maybeResultsElement time showPhase tradeCaches model = +maybeResultsElement time onlyOpenTrades tradeCaches model = let visibleTrades = tradeCaches @@ -209,20 +211,17 @@ maybeResultsElement time showPhase tradeCaches model = TradeTable.view time model.tradeTable - ((if showPhase then - [ TradeTable.Phase ] + [ if onlyOpenTrades then + TradeTable.Expires else - [] - ) - ++ [ TradeTable.Expires - , TradeTable.Offer - , TradeTable.FiatPrice - , TradeTable.Margin - , TradeTable.PaymentWindow - , TradeTable.BurnWindow - ] - ) + TradeTable.Phase + , TradeTable.Offer + , TradeTable.FiatPrice + , TradeTable.Margin + , TradeTable.PaymentWindow + , TradeTable.BurnWindow + ] visibleTrades |> Element.map TradeTableMsg diff --git a/src/TradeTable/View.elm b/src/TradeTable/View.elm index e095003..2746c40 100644 --- a/src/TradeTable/View.elm +++ b/src/TradeTable/View.elm @@ -61,7 +61,7 @@ colTypePortion colType = 1 Expires -> - 2 + 1 Offer -> 1 @@ -188,8 +188,41 @@ viewTradeCell time colType trade = (colTypePortion colType) (case colType of Phase -> - Element.text <| - CTypes.phaseToString trade.state.phase + let + phaseTitle = + CTypes.phaseToString trade.state.phase + in + case ( CTypes.getCurrentPhaseTimeoutInfo time trade, trade.state.phase ) of + ( _, CTypes.Closed ) -> + Element.text phaseTitle + + ( CTypes.TimeLeft timeoutInfo, _ ) -> + let + baseIntervalColor = + if TimeHelpers.getRatio (Tuple.first timeoutInfo) (Tuple.second timeoutInfo) < 0.05 then + EH.red + + else + EH.black + in + Element.column + [ Element.spacing 3 ] + [ Element.text phaseTitle + , EH.intervalWithElapsedBar + [ Element.width Element.fill ] + [ Element.Font.size 16 ] + ( baseIntervalColor, EH.lightGray ) + timeoutInfo + ] + + ( CTypes.TimeUp totalInterval, _ ) -> + Element.row + [ Element.spacing 6 + , Element.Font.color EH.darkGray + ] + [ Element.text phaseTitle + , Element.el [ Element.Font.size 16 ] <| Element.text "(stale)" + ] Expires -> case trade.state.phase of @@ -320,10 +353,10 @@ sortByFunc ( sortCol, ordering ) = Phase -> \a b -> if a.state.phase == b.state.phase then - sortByFunc ( Expires, Ascending ) a b + sortByFunc ( Expires, Descending ) a b else - flip compare (CTypes.phaseToInt a.state.phase) (CTypes.phaseToInt b.state.phase) + compare (CTypes.phaseToInt a.state.phase) (CTypes.phaseToInt b.state.phase) Expires -> \a b -> TimeHelpers.compare a.derived.phaseEndTime b.derived.phaseEndTime From b7c75d62d434111aac70a914cc8183115c6a3f09 Mon Sep 17 00:00:00 2001 From: oglog Date: Wed, 14 Aug 2019 14:37:20 +0200 Subject: [PATCH 14/19] Filters affect AgentHistory --- src/AgentHistory/View.elm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/AgentHistory/View.elm b/src/AgentHistory/View.elm index f4216b6..ebd251d 100644 --- a/src/AgentHistory/View.elm +++ b/src/AgentHistory/View.elm @@ -12,6 +12,7 @@ import Element.Font import Element.Input import Eth.Types exposing (Address) import FiatValue exposing (FiatValue) +import Filters.Types as Filters import Filters.View as Filters import Helpers.Element as EH import Helpers.Time as TimeHelpers @@ -141,6 +142,7 @@ maybeResultsElement time tradeCaches model = (basicFilterFunc model) ) |> List.concat + |> Filters.filterTrades model.filters in if visibleTrades == [] then Element.none From f15620e99475f1d4562521815b5194b684e120e2 Mon Sep 17 00:00:00 2001 From: oglog Date: Wed, 14 Aug 2019 15:30:46 +0200 Subject: [PATCH 15/19] Fixed bug where trade loaded from cache didn't watch for events --- docs/404.html | 2 +- docs/index.html | 2 +- ...9a073c.js => main-1f1f31c3e819cf11109c.js} | 2 +- src/Trade/State.elm | 21 +++++++++++++++++-- 4 files changed, 22 insertions(+), 5 deletions(-) rename docs/static/js/{main-4487980d0338fc9a073c.js => main-1f1f31c3e819cf11109c.js} (61%) diff --git a/docs/404.html b/docs/404.html index 2a03a8f..dc6d0c7 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 2a03a8f..dc6d0c7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-4487980d0338fc9a073c.js b/docs/static/js/main-1f1f31c3e819cf11109c.js similarity index 61% rename from docs/static/js/main-4487980d0338fc9a073c.js rename to docs/static/js/main-1f1f31c3e819cf11109c.js index b384768..3fab57f 100644 --- a/docs/static/js/main-4487980d0338fc9a073c.js +++ b/docs/static/js/main-1f1f31c3e819cf11109c.js @@ -4,4 +4,4 @@ * @author Feross Aboukhadijeh * @license MIT */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(bp,o,function(e){return si(Cp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,kp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,Bp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=nv(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?qg(o):jg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return nv(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Gg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Yg,zg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(zo,xa(ac),f(zo,Ms,nc))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ph,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ph,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ap)}),i.addEventListener("timeout",function(){a(Np)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Cp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(wp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Yg,zg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Yg,zg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Yg,zg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{options:t,type_:e}}),po={$:"OfferType"},go=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),vo=r(function(e,t){return f(ho,po,M([l(go,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(go,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),yo={$:"Closed"},mo={$:"Committed"},bo={$:"Judgment"},Co={$:"Open"},Eo={$:"Phase"},So=a(function(e,t,r,n){return f(ho,Eo,M([l(go,"Open",e,function(e){return R(e.state.phase,Co)}),l(go,"Committed",t,function(e){return R(e.state.phase,mo)}),l(go,"Judgment",r,function(e){return R(e.state.phase,bo)}),l(go,"Closed",n,function(e){return R(e.state.phase,yo)})]))}),To={$:"Initiator"},wo={$:"Responder"},Io=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),Ao=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(To):f(Io,function(e){return R(t,e)?si(wo):ci},e.state.responder)}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),ko=r(function(e,t){return f(Bo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(Ao,e,t))}),No={$:"Role"},Ro=n(function(e,t,r){return f(ho,No,M([l(go,"Buyer",t,function(t){return R(f(ko,t,e),si(fo))}),l(go,"Seller",r,function(t){return R(f(ko,t,e),si(lo))})]))}),$o=function(e){return{orderBy:e}},_o=$o,Lo={$:"Ascending"},xo={$:"Phase"},Po=Oe,Do=Po(yr),Uo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(So,!0,!0,!0,!1),f(vo,!0,!0),l(Ro,t,!0,!0)])),tradeTable:_o(L(xo,Lo)),wallet:e},Do)}),Oo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Mo={$:"None"},Fo=Mo,Vo=function(e){return d(Oo,e,Do,Fo,yr)},Ko=function(e){return{$:"TradeTableMsg",a:e}},Ho=function(e){return d(Oo,e,Do,Fo,yr)},jo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),qo=r(function(e,t){return f(jo,e,t)}),Go=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),zo=n(function(e,t,r){return t(e(r))}),Yo=r(function(e,t){if("None"===t.$)return Mo;var r=t.a,n=t.b,a=l(Go,f(Bo,Da(e),r.onSign),f(Bo,Da(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return L(f(zo,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(zo,t.toMsg,e)}},n))},r.onMined));return f(jo,a,n)}),Wo=function(e){return{$:"AbiDecoder",a:e}},Jo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Qo=z,Xo=Fr,Zo=r(function(e,t){return e<1?t:l(Xo,e,Qo(t),t)}),eu=Zo(64),tu=n(function(e,t,r){return L(f(Jo,e,eu(t)),r)}),ru=r(function(e,t){return e<1?"":l(Xo,0,e,t)}),nu=ru(64),au=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),iu=function(e){return-e},ou=r(function(e,t){return e<1?"":l(Xo,-e,Qo(t),t)}),uu=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(ru,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(ou,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Wo(function(t){var r=t.a,n=t.b;return f(au,f(tu,r,n),e(nu(n)))})}(),su=Hr,cu=function(e){return f(su,"0x",e)||f(su,"0X",e)?f(Zo,2,e):e},fu=function(e){return e.b},lu=r(function(e,t){var r=e.a;return f(au,fu,r(function(e){return f(Jo,e,e)}(cu(t))))}),du=Xr,hu=ae,pu=Wr,gu=function(e){return f(du,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return hu(a)},pu)},vu=f(zo,lu,gu),yu=function(e){return{$:"Magnitude",a:e}},mu=function(e){return{$:"Pos",a:e}},bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Cu=function(e){return{$:"MagnitudeNotNormalised",a:e}},Eu=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 si(n)}return ci}},Su=function(e){var t=Eu(e);return"Nothing"!==t.$&&t.a<0},Tu=function(e){return{$:"Neg",a:e}},wu={$:"Zer"},Iu=function(e){return!e.b},Au=r(function(e,t){var r=t.a;if(Iu(r))return wu;switch(e.$){case"Zero":return wu;case"Positive":return mu(t);default:return Tu(t)}}),Bu=r(function(e,t){return f(bu,e,Cu(t))}),ku=function(e){return f(La,r(function(t,r){return e(t)&&Iu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Nu=Ir,Ru=-1+f(Nu,10,7),$u=Ru+1,_u=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Lu=function(e){return e<0?f(_u,Na(-1),Lu(e+$u)):L(e/$u|0,e%$u)},xu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Lu(r+e),i=a.a,o=a.b;return f(ka,o,f(xu,i,n))}{if(!(_(e,$u)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Pu=function(e){var t=e.a;return yu(ku(f(xu,0,t)))},Du=xa(iu),Uu={$:"Negative"},Ou={$:"Positive"},Mu={$:"Zero"},Fu=function(e){switch(e.$){case"Positive":return Uu;case"Negative":return Ou;default:return Mu}},Vu=function(e){for(;;){var t=e.a,r=e.b,n=Pu(r),a=n.a;if(!Su(a))return f(Au,t,yu(a));e=f(Bu,Fu(t),Du(a))}},Ku=pr,Hu=function(e){switch(f(Ku,e,0).$){case"LT":return Uu;case"GT":return Ou;default:return Mu}},ju=function(e){return e<0?-e:e},qu=function(e){return Vu(f(bu,Hu(e),Cu(M([ju(e)]))))},Gu=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(Nu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},zu=function(e){switch(e.$){case"Zer":return wu;case"Neg":var t=e.a;return mu(t);default:return e}},Yu=function(e){return{$:"MagnitudePair",a:e}},Wu=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(ka,L(a,u),f(Wu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Wu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Wu,yr,s))}return yr}),Ju=r(function(e,t){var r=e.a,n=t.a;return Yu(f(Wu,r,n))}),Qu=function(e){switch(e.$){case"Zer":return f(Bu,Mu,yr);case"Neg":var t=e.a.a;return f(Bu,Ou,Du(t));default:var t=e.a.a;return f(Bu,Ou,t)}},Xu=r(function(e,t){var r=Qu(t),n=r.b,a=Qu(e),i=a.b,o=f(Ju,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Vu(f(bu,Ou,Cu(s)))}),Zu=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(R(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 Ta}return a.b.b?ba:f(Ku,e,t)}}),es=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},ts=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(Zu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return es(d(Zu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),rs=r(function(e,t){return R(f(ts,e,t),Ta)}),ns=K,as=r(function(e,t){return!f(rs,e,t)}),is=function(e){switch(e.$){case"Zer":return yu(yr);case"Pos":default:var t=e.a;return t}},os=r(function(e,t){var r=e.a;return Pu(Cu(f(xa,ti(t),r)))}),us=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(os,yu(n),a),u=f(us,yu(i),yu(n)),s=u.a,c=f(Xu,f(Au,Ou,o),f(Au,Ou,yu(f(ka,0,s))));return is(c)}var a=r.a;return f(os,yu(n),a)}return yu(yr)}),ss=function(e){switch(e.$){case"Zer":return Mu;case"Pos":return Ou;default:return Uu}},cs=r(function(e,t){return R(e,Mu)||R(t,Mu)?Mu:R(e,t)?Ou:Uu}),fs=r(function(e,t){return f(Au,f(cs,ss(e),ss(t)),f(us,is(e),is(t)))}),ls=function(e){switch(e.$){case"Zer":return wu;case"Pos":var t=e.a;return Tu(t);default:var t=e.a;return mu(t)}},ds=r(function(e,t){return f(Xu,e,ls(t))}),hs=qu(0),ps=a(function(e,t,r,n){if(e){var a=qu(e),i=f(fs,f(fs,a,n),t),o=f(as,i,r)?L(f(fs,a,t),f(ds,r,i)):L(hs,r),u=o.a,s=o.b,c=d(ps,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Xu,u,l),h)}return L(hs,r)}),gs=Fa(f(Va,2,Ru)),vs=n(function(e,t,r){return d(ps,f(Nu,2,gs),e,t,r)}),ys=qu(1),ms=r(function(e,t){return e}),bs=n(function(e,t,r){return l(Ra,ms(e),t,f(Ai,1,r))}),Cs=function(e){return l(bs,fs(qu($u)),ys,e)},Es=n(function(e,t,r){if(e){var n=l(vs,Cs(e),t,r),a=n.a,i=n.b,o=l(Es,e-1,i,r),u=o.a,s=o.b;return L(f(Xu,a,u),s)}return l(vs,Cs(e),t,r)}),Ss=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Ts=r(function(e,t){if(R(t,hs))return ci;var r=Ti(Ss(e))-Ti(Ss(t))+1,n=l(Es,f(ei,0,r),zu(e),zu(t)),a=n.a,i=n.b;return si(L(f(Au,f(cs,ss(e),ss(t)),is(a)),f(Au,ss(e),is(i))))}),ws=f(fs,qu(2),qu(2147483648)),Is=xr,As=function(e){return f(Is,e,"")},Bs=Pn,ks=n(function(e,t,r){return e<=0?r:l(ks,e>>1,U(t,t),1&e?U(r,t):r)}),Ns=r(function(e,t){return l(ks,e,t,"")}),Rs=n(function(e,t,r){return U(f(Ns,e-Qo(r),As(t)),r)}),$s=te,_s=Ar,Ls=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},xs=r(function(e,t){for(;;){if(t<16)return f(ka,Ls(t),e);var r=f(ka,Ls(f(_s,16,t)),e),n=t/16|0;e=r,t=n}}),Ps=function(e){return $s(e<0?f(ka,P("-"),f(xs,yr,-e)):f(xs,yr,e))},Ds=function(e){var t=f(Ts,e,ws);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=Ps(Gu(a));return R(n,qu(0))?i:U(Ds(n),l(Rs,8,P("0"),i))},Us=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,yu(yr))?"0":Ds(mu(t));default:var t=e.a;return"-"+Us(f(fs,qu(-1),e))}},Os=function(e){return l(Rs,64,P("0"),e)},Ms=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(Ps(a)),c=function(e){return U(e,n)}(Os(Ps(u)));return x(a+32+(Qo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Fs=Dr,Vs=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))))}),Ks=n(function(e,t,n){return l(Fs,r(function(t,r){return l(Vs,e,yi(t),r)}),t,n)}),Hs=function(e){return $a(l(Ks,ka,yr,e))},js=function(e){return f(Ri,"",f(xa,f(zo,Ps,f(Rs,2,P("0"))),Hs(e)))},qs=function(e){return 64-f(_s,64,e)},Gs=function(e){return U(e,f(Ns,qs(Qo(e)),"0"))},zs=function(e){return L(si(Qo(e)/2|0),Gs(e))},Ys=function(e){return L(ci,Os(e))},Ws=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Js=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"}},Qs=Ur,Xs=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(Is,P("1"),r),!0);case"1":return L(f(Is,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Is,P("0"),r),!1);case"1":return L(f(Is,P("1"),r),!0);default:break e}return L(r,!0)});return l(Qs,t,L("",!1),e).a},Zs=function(e){return l(Qs,ka,yr,e)},ec=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Zo,e,t),i=f(ka,l(Xo,0,e,t),r);e=n,t=a,r=i}}),tc=r(function(e,t){return e&&""!==t?l(ec,e,t,yr):M([t])}),rc=function(e){var t=function(){var t=Zs(Us(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(zo,Xs,f(Rs,256,P("1"))))}var r=t;return L(r,f(Rs,256,P("0")))}(),r=t.a,n=t.b;return $s(f(xa,Ws,f(tc,4,n(f(Ri,"",f(xa,Js,r))))))},nc=function(e){return{$:"Hex",a:e}},ac=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Ys(t);case"UintE":var r=e.a;return Ys(Us(r));case"IntE":var n=e.a;return Ys(rc(n));case"BoolE":return Ys(e.a?"1":"0");case"DBytesE":var a=e.a.a;return zs(a);case"BytesE":var a=e.a.a;return Ys(cu(a));case"StringE":var i=e.a;return zs(js(i));case"ListE":var o=e.a;return function(e){var t=e.a;return zs(t)}(Xt()(o));default:var i=e.a;return Ys(cu(i))}};try{var ic=Xt();Xt=function(){return ic}}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 oc=Pr,uc=function(e){return 1===Qo(e)?f(oc,"0",e):e},sc=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(ka,n,r);e=i,t=o,r=u}}}),cc=r(function(e,t){return $a(l(sc,e,t,yr))}),fc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(cc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(fc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),lc=r(function(e,t){return l(fc,0,e,t)}),dc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),hc=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 Pt(e.a)}},pc={$:"LE"},gc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,pc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,pc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,pc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,pc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,pc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,pc));case"Seq":var i=e.b;return l(vc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),vc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(gc,n,t,r);e=i,t=o,r=u}}),yc=Dt,mc=r(function(e,t){return{$:"Seq",a:e,b:t}}),bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+hc(r),i=n;e=a,t=i}}),Cc=function(e){return f(mc,f(bc,0,e),e)},Ec=function(e){return{$:"U8",a:e}},Sc=Ec,Tc=r(function(e,t){return _(e,t)<0?e:t}),wc=hr,Ic=function(e){return{$:"Bytes",a:e}},Ac=Ic,Bc=function(e){return yc(Cc(f(xa,Ac,$a(e))))},kc=Pt,Nc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Rc=function(e){return{$:"Decoder",a:e}},$c=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}}),_c=r(function(e,t){return Rc(f($c,e,t))}),Lc=Rc(Yn),xc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Pc=function(e){return{$:"Done",a:e}},Dc=function(e){return{$:"Loop",a:e}},Uc=r(function(e,t){var n=t.a;return Rc(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 Rc(r(function(t,r){return L(r,e)}))},Mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Oc(Pc($a(n))):f(Uc,function(e){return Dc(L(r-1,f(ka,e,n)))},e)}),Fc=function(e){return f(xc,yr,f(Nc,f(_c,L(kc(e),yr),Mc(Lc)),e))},Vc=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))}),Kc=r(function(e,t){return l(Vc,Bs,e,t)}),Hc=f(Ai,0,4),jc=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}}),qc=xt,Gc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),zc=function(e){return f(Gc,f(zo,qc,Bs(4294967295)),e)},Yc=r(function(e,t){return 5*t+e}),Wc=4294967295>>>32-Ha,Jc=ar,Qc=n(function(e,t,r){for(;;){var n=Wc&t>>>e,a=f(Jc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Jc,Wc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Xc=function(e){return e>>>5<<5},Zc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Xc(r))>-1?f(Jc,Wc&e,i):l(Qc,n,e,a))}),ef=r(function(e,t){var r=f(Zc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),tf=n(function(e,t,r){var n=f(Yc,e,t);return f(ef,n,r)}),rf=ir,nf=a(function(e,t,r,n){var a=Wc&t>>>e,i=f(Jc,a,n);if("SubTree"===i.$){var o=i.a,u=d(nf,e-Ha,t,r,o);return l(rf,a,za(u),n)}var s=i.a,c=l(rf,Wc&t,r,s);return l(rf,a,Ga(c),n)}),af=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,Xc(n))>-1?d(Ma,n,a,i,l(rf,Wc&e,t,o)):d(Ma,n,a,d(nf,a,e,t,i),o)}),of=n(function(e,t,r){return l(af,e,t,r)}),uf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(of,a,r,n)}),sf=Dn,cf=r(function(e,t){return l(Vc,sf,e,t)}),ff=function(e){var t=l(La,r(function(t,n){var a={d0:l(tf,0,t,e.state),d1:l(tf,1,t,e.state),d2:l(tf,2,t,e.state),d3:l(tf,3,t,e.state),d4:l(tf,4,t,e.state)},i=r(function(e,r){return d(uf,e,t,f(cf,f(jc,e,a),f(Kc,zc(f(jc,f(_s,5,e+1),a)),f(jc,f(_s,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Hc);return D(e,{state:t})},lf=L(0,0),df=function(e){return{current:lf,lfsrstate:1,state:e,x:1,y:0}},hf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},pf=L(1,0),gf=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),vf=r(function(e,t){if(e){var n=f(gf,1,t);return l(Vc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),yf=r(function(e,t){var r=f(_s,32,e/32|0),n=f(gf,r,t),a=f(_s,32,e);return f(vf,a,n)}),mf=n(function(e,t,r){var n=f(Zc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(af,e,t(a),r)}),bf=n(function(e,t,r){return l(mf,e,cf(t),r)}),Cf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(bf,a,r,n)}),Ef=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Nf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Tc,n,r),i=f(xa,function(e){return f(kf,e,g)},f(Ai,0,a)),o=Bf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(lc,i.outputLen,l(v,g,yr,i.outputLen))},Lf=function(e){return{$:"KS",a:e}},xf=function(e){var t=e.a;return Lf({config:t,inputLength:0,partial:yr,state:f(ui,25,ms(lf))})},Pf=function(e){return Rc(Wn(e))},Df=yc(Cc(yr)),Uf=r(function(e,t){var n=t.a;return Rc(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(Uf,function(e){return Pf(t)},Pf(e))}),Mf=r(function(e,t){return f(xc,Df,f(Nc,f(Of,e,kc(t)-e),t))}),Ff=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=kc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+kc(e)}),0,i),a)>-1))return Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:i}));var o=Bc(i),u=f(xc,Df,f(Nc,Pf(a),o)),s=Fc(u),c=f($f,s,n.state),d=Bf(c),h=f(Mf,a,o),p=Df,g=Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Vf=r(function(e,t){return _f(f(Ff,yc(Cc(f(xa,Sc,t))),xf(e)))}),Kf=Vf(dc),Hf=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,4,Kf(f(xa,yi,Zs(e)))))))},jf=function(e){return f(su,"0x",e)||f(su,"0X",e)?e:"0x"+e},qf=function(e){var t=e.a;return jf(t)},Gf=r(function(e,t){var r=Ms(f(xa,ac,t)),n=function(e){return U(e,r)}(cu(qf(Hf(e))));return nc(n)}),zf=function(e){return{data:si(f(Gf,"poke()",yr)),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yf=r(function(e,t){return D(t,{checked:e})}),Wf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Jf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Wf,f(zo,function(e){return e.type_},Ja(r)),function(e){return D(e,{options:l(Wf,f(zo,function(e){return e.label},Ja(n)),Yf(a),e.options)})},t)}),Qf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Xf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zf={$:"Descending"},el=function(e){return"Ascending"===e.$?Zf:Lo},tl=function(e){return d(Xf,e,Do,Fo,yr)},rl=r(function(e,t){return L(t.a,e(t.b))}),nl=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Xf,t,Do,Fo,M([da(f(Qf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(rl,el,t.orderBy):L(a,Lo);return tl(D(t,{orderBy:i}));default:return tl(t)}}),al=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},il=yn,ol=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=al(zf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(qo,a,n);return d(Oo,t,Do,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Oo,t,Do,Fo,M([da(f(Qf,o,u))]));case"FiltersMsg":var s=e.a;return Ho(D(t,{filters:f(Jf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(nl,c,t.tradeTable);return d(Oo,D(t,{tradeTable:l.model}),f(il,Ko,l.cmd),f(Yo,Ko,l.chainCmd),f(xa,Ji(Ko),l.appCmds));default:return Vo(t)}}),ul={$:"BottomRight"},sl={$:"ShouldBeImpossible"},cl=lr,fl=function(e){return qi(e)},ll=r(function(e,t){f(cl,e,t);return{align:ul,label:"unexpectedError",mainParagraphs:M([M([fl(e)])]),noticeType:sl}}),dl=function(e){var t=e.a;return jf(t)},hl=ye,pl=f(zo,dl,hl),gl=f(zo,Us,f(zo,jf,hl)),vl=f(zo,qf,hl),yl=f(zo,Ps,f(zo,jf,hl)),ml=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),bl=un,Cl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},El=function(e){return Cl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(xc,bl,r))},f(ml,function(e){e.a;return!R(e.b,ci)},e)))},Sl=function(e){return El(M([L("to",f(Bo,pl,e.to)),L("from",f(Bo,pl,e.from)),L("gas",f(Bo,yl,e.gas)),L("gasPrice",f(Bo,gl,e.gasPrice)),L("value",f(Bo,gl,e.value)),L("data",f(Bo,vl,e.data)),L("nonce",f(Bo,yl,e.nonce))]))},Tl=function(e){return{$:"TxSentry",a:e}},wl=ye,Il=r(function(e,t){return Cl(M([L("ref",wl(e)),L("txParams",t)]))}),Al=function(e){return{$:"Signing",a:e}},Bl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Al(e)}}),kl={$:"Black"},Nl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Rl={$:"RBEmpty_elm_builtin"},$l={$:"Red"},_l=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(Nl,$l,t,r,h(Nl,kl,c,f,l,d),h(Nl,kl,i,o,u,s))}return h(Nl,e,i,o,h(Nl,$l,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(Nl,$l,c,f,h(Nl,kl,g,v,y,m),h(Nl,kl,t,r,d,a))}return h(Nl,e,t,r,n,a)}),Ll=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Nl,$l,e,t,Rl,Rl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ku,e,a).$){case"LT":return h(_l,n,a,i,l(Ll,e,t,o),u);case"EQ":return h(Nl,n,a,t,o,u);default:return h(_l,n,a,i,o,l(Ll,e,t,u))}}),xl=n(function(e,t,r){var n=l(Ll,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(Nl,kl,a,i,o,u)}return n}),Pl=n(function(e,t,r){var n=e.a,a=Sl(r),i=l(xl,n.ref,f(Bl,r,t),n.txs);return L(Tl(D(n,{ref:n.ref+1,txs:i})),f(il,n.tagger,n.outPort(f(Il,n.ref,a))))}),Dl=Pl,Ul=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Do,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Dl,n,i,o))}return x(ci,Do,M([f(ll,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ol=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Ml=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Fl=function(e){return{$:"Posix",a:e}},Vl=Fl,Kl={autoabortInterval:Vl(0),autorecallInterval:Vl(0),autoreleaseInterval:Vl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Hl=function(e){return{$:"TokenValue",a:e}},jl=function(e){return e.a},ql=r(function(e,t){return f(xc,hs,f(Bo,Qa,f(Ts,e,t)))}),Gl=r(function(e,t){return Hl(f(ql,jl(e),qu(t)))}),zl=function(e){return f(Gl,e,12)},Yl=function(e){return f(Gl,e,3)},Wl=Hl(qu(0)),Jl=r(function(e,t){var r=Wl;return{abortPunishment:zl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Ql=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Xl=qr,Zl=function(e){var t=Ql(f(Xl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Qo(e)-1-r;return L(U(f(ru,r,e),f(Zo,r+1,e)),n)},ed=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 yr}}),td=function(e){var t=e.a,r=f(ed,Ja(0),t);return yu(r.b?t:yr)},rd=Z,nd=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}}}),ad=n(function(e,t,r){var n=f(nd,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(lc,e,r),l(ad,e,t,n)):yr}),id=r(function(e,t){return l(ad,e,e,t)}),od=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Bo,ka(a),r)});return f(La,t,si(yr))}(Ua),ud=function(e){return f(Bo,f(Da,td,yu),od(f(xa,f(zo,$a,f(zo,$s,rd)),f(id,7,$a(e)))))},sd=Q,cd=function(e){var t=Zs(sd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,Au(Uu),ud(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Bo,Au(Ou),ud(r))}return ci;default:var r=t;return f(Bo,Au(Ou),ud(r))}},fd=function(e){var t=function(e){return!f(_s,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(xc,0,Ql(r)))}},ld=function(e){return f(fs,e,e)},dd=qu(2),hd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ys;case"Neg":return wu;default:if(R(r,ys))return f(fs,e,t);if(fd(r)){var n=e,a=ld(t),i=f(ql,r,dd);e=n,t=a,r=i;continue e}var n=f(fs,t,e),a=ld(t),i=f(ql,f(ds,r,ys),dd);e=n,t=a,r=i;continue e}}),pd=r(function(e,t){return l(hd,ys,e,t)}),gd=function(e){if(""===e)return ci;var t=Zl(e),r=t.a,n=t.b,a=cd(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(fs,o,f(pd,qu(10),qu(i)));return si(u)},vd=function(e){return f(Bo,Hl,gd(e))},yd=jr,md=function(e){for(;;){if(f(yd,".",e))return l(Xo,0,-1,e);{if(!f(yd,"0",e))return""===e?"0":e;e=l(Xo,0,-1,e)}}},bd=f(Da,f(Rs,7,P("0")),Ni),Cd=function(e){return f(Ri,"",e)},Ed=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Cd(f(ka,Ni(n),f(xa,bd,a)))}return"0"},Sd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Ed(t);default:var t=e.a;return"-"+Ed(t)}},Td=r(function(e,t){return e<1?t:l(Xo,0,-e,t)}),wd=function(e){var t=l(Rs,18,P("0"),Sd(e)),r=f(Td,18,t)+"."+f(ou,18,t);return function(e){return""===e?"0":e}(md(r))},Id=r(function(e,t){var r=wd(t),n=Ql(f(Xl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(ru,a+1+e,r):f(ru,a,r)}),Ad=r(function(e,t){if("Nothing"===e.$)return wd(jl(t));var r=e.a;return f(Id,r,jl(t))}),Bd=ee,kd=function(e){var t=Bd(f(Ad,ci,e));if("Just"===t.$){return t.a}f(cl,"Error converting tokenValue to float: string -> float failed",e);return 0},Nd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=vd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return kd(r)<1?fi("Trade amount can't be less than 1."):li(r)},Rd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=cd(e);if("Nothing"===t.$){var r=Bd(e);return fi("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 li(n)},$d=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),_d=function(e){return""===e},Ld=function(e){return _d(e)?ci:si(e)},xd=function(e){return f($d,"You must specify a fiat type.",Ld(e))},Pd=function(e){return""===e?fi("Must specify a payment method."):li(e)},Dd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ud=g(Dd,ci,ci,ci,ci,ci,ci,ci),Od=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Md=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Fd={$:"Custom"},Vd=r(function(e,t){return{info:t,type_:e}}),Kd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Hd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),jd=function(e){return e.a},qd=function(e){return p(Kd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Vd,Fd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Hd,function(e){return D(Ud,{daiAmount:si(e)})},Nd(e.daiAmount)),f(Hd,function(e){return D(Ud,{fiatAmount:si(e)})},Rd(e.fiatAmount)),f(Hd,function(e){return D(Ud,{fiatType:si(e)})},xd(e.fiatType)),f(Hd,function(e){return D(Ud,{paymentMethod:si(e)})},Pd(e.paymentMethod)),Od(d(Md,function(e){return jd(e)>0?li(e):fi(D(Ud,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Gd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},zd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Yd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Wd=function(e){var t=qd(e.inputs),r=function(){return R(e.errors,Ud)?Ud:"Ok"===t.$?Ud:t.a}();return D(e,{createParameters:l(zd,Jl,Gd(e.wallet),Yd(t)),errors:r})},Jd=r(function(e,t){return Wd(D(t,{inputs:e}))}),Qd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Xd=function(e){return d(Qd,f(Jd,Kl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:Ud,inputs:Kl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Do,Fo,yr)},Zd=a(function(e,t,r,n){return la(d(Ol,e,t,r,n))}),eh=function(e){return{$:"Address",a:e}},th=f(zo,cu,f(zo,sd,eh)),rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return th("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return th("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return th("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return th("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nh=function(e){return th("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ah=function(e){return{$:"AddressE",a:e}},ih=ah,oh=function(e){return{$:"UintE",a:e}},uh=oh,sh=n(function(e,t,r){return{data:si(f(Gf,"approve(address,uint256)",M([ih(t),uh(r)]))),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ch=function(e){return f(Gl,e,200)},fh=r(function(e,t){return Hl(f(Xu,jl(e),jl(t)))}),lh=function(e){var t=f(Gl,e.tradeAmount,200);return f(fh,e.pokeReward,f(fh,ch(e.tradeAmount),f(fh,t,function(){return"Buyer"===e.initiatorRole.$?Yl(e.tradeAmount):e.tradeAmount}())))},dh=Mi(ya),hh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ph=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gh=Xn,vh=Qn,yh=function(e){return f(vh,{caseInsensitive:!1,multiline:!1},e)},mh=Jn,bh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ch=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}}),Eh=r(function(e,t){return!f(Ch,f(Da,ns,e),t)}),Sh=Eh(Ua),Th=q,wh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ih=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Ah=f(La,Ih(ka),li(yr)),Bh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},kh=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Nu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Nu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Nu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Nu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Nu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Nu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Nu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Nu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Nu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Nu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Nu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Nu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Nu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Nu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Nu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(As(s)+" is not a valid hexadecimal character.")}}}),Nh=function(e){if(_d(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(su,"-",e)){var t=f(xc,yr,Bh(Zs(e)));return f(au,iu,l(kh,Ti(t)-1,t,0))}return l(kh,Qo(e)-1,Zs(e),0)}();return f(Hd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rh=function(e){var t=Zs(e);return function(e){return L(t,e)}(f(wh,yr,Ah(f(xa,Nh,f(_i,"",f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,20,Kf(f(xa,f(zo,Th,yi),t))))))))))},$h=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Rh(cu(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!bh(e)&&Sh(o)},_h=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-f]{40}$"))),Lh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-F]{40}$"))),xh=function(e){return'"'+e+'"'},Ph=function(e){var t=cu(e),r=f(ru,24,t),n=f(ou,40,e);return 64===Qo(t)&&f(ki,Ja(P("0")),r)?Lh(n)||_h(n)?li(eh(n)):$h(n)?li(eh(n)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):40!==Qo(t)?fi("Given address "+xh(e)+" is not the correct length."):bh(t)?Lh(t)||_h(t)?li(eh(t)):$h(t)?li(eh(t)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):fi("Given address "+xh(e)+" contains invalid hex characters.")},Dh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),Ph(nu(r)))}),Uh=r(function(e,t){var r=t.a;return Wo(function(t){var n=t.a,a=t.b;return r(f(Jo,n,f(Zo,64*e,a)))})}),Oh=Jr,Mh=r(function(e,t){return f(Oh,"data",vu(f(Uh,e,t)))}),Fh=Qr,Vh=r(function(e,t){return f(Oh,"topics",f(Fh,e,vu(t)))}),Kh=function(e){return f(Bo,f(zo,$a,f(Ra,r(function(e,t){return f(Xu,qu(e),f(fs,t,ws))}),hs)),od(f(xa,f(zo,$a,f(zo,$s,f(zo,Nh,Yd))),f(id,8,$a(e)))))},Hh=function(e){var t=Zs(sd(e));e:for(;;){if(!t.b)return ci;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(Bo,fs(qu(-1)),Kh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Bo,fs(qu(-1)),Kh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Kh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kh(a)}t.b;return ci}break e;default:break e}}var a=t;return Kh(a)},jh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f($d,"Error Decoding Uint into BigInt",Hh(jf(nu(r)))))}),qh=f(dh,f(Vh,1,Dh),f(dh,f(Mh,1,Dh),f(dh,f(Mh,0,jh),Fi(hh)))),Gh=nn,zh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Yh=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(Gh,e,Cl(M([L("data",hl(t.data)),L("topics",f(zh,vl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Wh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Jh=r(function(e,t){return f(au,function(e){return e.id},f(Wh,function(e){return f(Hd,Di,f(Yh,qh,e).returnData)},f($d,"No log found from that factoryAddress in that txReceipt",Ql(f(ml,function(t){return R(f(zo,dl,sd)(t.address),f(zo,dl,sd)(rh(e)))},t.logs)))))}),Qh=n(function(e,t,r){return{data:si(f(Gf,"allowance(address,address)",M([ih(t),ih(r)]))),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Zh=function(e){switch(e.$){case"BlockNum":var t=e.a;return hl(jf(Ps(t)));case"EarliestBlock":return hl("earliest");case"LatestBlock":return hl("latest");default:return hl("pending")}},ep=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return El(M([L("to",f(Bo,pl,t)),L("from",f(Bo,pl,r)),L("gas",f(Bo,yl,n)),L("gasPrice",f(Bo,gl,a)),L("value",f(Bo,gl,i)),L("data",f(Bo,vl,o))]))},tp=function(e){return{$:"BadBody",a:e}},rp=function(e){return{$:"BadStatus",a:e}},np=function(e){return{$:"BadUrl",a:e}},ap={$:"NetworkError"},ip={$:"Timeout"},op=rn,up=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(np(r));case"Timeout_":return fi(ip);case"NetworkError_":return fi(ap);case"BadStatus_":var n=t.a,a=t.b;return fi(rp(n.statusCode));default:var n=t.a,a=t.b,i=f(op,f(Oh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(tp(Di(u)))}}),sp=n(function(e,t,r){return Cl(M([L("id",wl(e)),L("jsonrpc",hl("2.0")),L("method",hl(t)),L("params",f(zh,Ua,r))]))}),cp=Rl,fp=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ku,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),lp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},dp=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(Nl,$l,p,g,h(Nl,kl,r,n,h(Nl,$l,i,o,u,s),v),h(Nl,kl,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(Nl,kl,r,n,h(Nl,$l,i,o,u,s),h(Nl,$l,f,l,d,m))}return e},hp=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(Nl,$l,i,o,h(Nl,kl,s,c,f,l),h(Nl,kl,r,n,d,h(Nl,$l,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Nl,kl,r,n,h(Nl,$l,i,o,C,d),h(Nl,$l,g,v,y,m))}return e},pp=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(Nl,r,u,s,c,h(Nl,$l,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 hp(t)}break e}o.a,o.d;return hp(t)}break e}return t}),gp=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(Nl,t,r,n,gp(a),u)}var s=dp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(_l,c,f,l,gp(d),p)}return Rl}return h(Nl,t,r,n,gp(a),u)}return Rl},vp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Rl;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(Nl,r,n,a,f(vp,e,i),o)}var s=dp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(_l,c,l,d,f(vp,e,p),v)}return Rl}return h(Nl,r,n,a,f(vp,e,i),o)}return f(yp,e,g(pp,e,t,r,n,a,i,o))}),yp=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(R(e,n)){var u=lp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(_l,r,s,c,i,gp(o))}return Rl}return h(_l,r,n,a,i,f(vp,e,o))}return Rl}),mp=r(function(e,t){var r=f(vp,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(Nl,kl,n,a,i,o)}return r}),bp=n(function(e,t,r){var n=t(f(fp,e,r));if("Just"===n.$){var a=n.a;return l(xl,e,a,r)}return f(mp,e,r)}),Cp=function(e){return"Just"===e.$},Ep=gn,Sp=vn,Tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),wp=function(e){return{$:"BadUrl_",a:e}},Ip=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ap={$:"NetworkError_"},Bp=function(e){return{$:"Receiving",a:e}},kp=function(e){return{$:"Sending",a:e}},Np={$:"Timeout_"},Rp=function(e){return f(ta,"application/json",f(xi,0,e))},$p=n(function(e,t,r){return Rp(l(sp,e,t,r))}),_p=f(ea,"",Ua),Lp=Te,xp=Se,Pp=function(e){if("Ok"===e.$){var t=e.a;return xp(t)}var r=e.a;return Lp(r)},Dp=function(e){return l(Zn,gr,Pp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},Up=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Dp({body:l($p,1,r,n),headers:yr,method:"POST",resolver:_p(up(a)),timeout:ci,url:t})},Op=n(function(e,t,r){return Up({decoder:t.decoder,method:"eth_call",params:M([ep(t),Zh(r)]),url:e})}),Mp={$:"LatestBlock"},Fp=r(function(e,t){return l(Op,e,t,Mp)}),Vp=function(e){return{$:"Perform",a:e}},Kp=sn,Hp=xp(gr),jp=r(function(e,t){return f(Kp,function(t){return xp(e(t))},t)}),qp=n(function(e,t,r){return f(Kp,function(t){return f(Kp,function(r){return xp(f(e,t,r))},r)},t)}),Gp=function(e){return l(La,qp(ka),xp(yr),e)},zp=r(function(e,t){var r=t.a;return Be(f(Kp,Ep(e),r))}),Yp=n(function(e,t,r){return f(jp,function(e){return gr},Gp(f(xa,zp(e),t)))}),Wp=n(function(e,t,r){return xp(gr)}),Jp=r(function(e,t){var r=t.a;return Vp(f(jp,e,r))});pn.Task=Pe(Hp,Yp,Wp,Jp);var Qp=Ue("Task"),Xp=cn,Zp=r(function(e,t){return Qp(Vp(f(Xp,f(Da,f(Da,xp,e),fi),f(Kp,f(Da,f(Da,xp,e),li),t))))}),eg=a(function(e,t,r,n){return f(Zp,n,f(Fp,Xh(eo(e)),l(Qh,nh(e),t,r)))}),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return th("0x092110996699c3E06e998d89F0f4586026e44F0F")}},rg=function(e){return{$:"BoolE",a:e}},ng=rg,ag=function(e){return{$:"StringE",a:e}},ig=ag,og=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ug=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},sg=r(function(e,t){return{paymentMethods:t,price:e}}),cg=function(e){return hl(Sd(e))},fg=function(e){return f(zh,Ua,M([hl(e.fiatType),cg(e.amount)]))},lg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},dg=function(e){return Cl(M([L("type",hl(lg(e.type_))),L("info",hl(e.info))]))},hg=function(e){var t=fg(e.price),r=f(zh,dg,e.paymentMethods);return f(xi,0,Cl(M([L("paymentmethods",r),L("price",t)])))},pg=r(function(e,t){return D(t,{value:si(e)})}),gg=function(e){return qu(jd(e))},vg=function(e){return f(ql,gg(e),qu(1e3))},yg=r(function(e,t){var r=function(){return"Token"===e.$?og:ug}();return function(){return"Native"===e.$?pg(jl(lh(t))):Ua}()(r(rh(e))(t.initiatorAddress)(tg(e))(R(t.initiatorRole,lo))(jl(t.tradeAmount))(jl(Yl(t.tradeAmount)))(jl(zl(t.tradeAmount)))(jl(t.pokeReward))(vg(t.autorecallInterval))(vg(t.autoabortInterval))(vg(t.autoreleaseInterval))(jl(ch(t.tradeAmount)))(hg(f(sg,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),mg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),bg=function(e){return{$:"CreateNeedsSig",a:e}},Cg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Eg=r(function(e,t){var r=al(f(yg,e,t)),n={onBroadcast:ci,onMined:si(L(mg(e),ci)),onSign:si(Cg(e))};return L(si(bg(e)),f(qo,n,r))}),Sg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wg=function(e){return{$:"ApproveNeedsSig",a:e}},Ig=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Bg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),kg={$:"NoOp"},Ng=function(e){return{appCmds:yr,chainCmd:Fo,cmd:Do,model:e}},Rg=function(e){return rd(Sd(e))},$g={$:"Error"},_g=r(function(e,t){f(cl,e+" fetch error",t);return{align:ul,label:"web3FetchError",mainParagraphs:M([M([fl('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:$g}}),Lg=r(function(e,t){return{align:ul,label:"web3MiningError",mainParagraphs:M([M([fl('Error mining "'+e+'" transaction: '+t)])]),noticeType:$g}}),xg={$:"Caution"},Pg=r(function(e,t){return{align:ul,label:"web3SigError",mainParagraphs:M([M([fl('Error signing "'+e+'" transaction: '+t)])]),noticeType:xg}}),Dg={$:"KovanDai"},Ug=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Dg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Og=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Mg=function(e){return f(Io,Ug,Og(e))},Fg=r(function(e,t){return 1-e(1-t)}),Vg=function(e){return f(Nu,e,5)},Kg=Fg(Vg),Hg={easing:Kg,offset:12,speed:200},jg=function(e){return{$:"External",a:e}},qg=function(e){return{$:"Internal",a:e}},Gg=function(e){return{$:"NotFound",a:e}},zg=function(e){for(;;){e=e.a}},Yg=r(function(e,t){return Qp(Vp(f(jp,e,t)))}),Wg={$:"Http"},Jg={$:"Https"},Qg=Kr,Xg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Zg=i(function(e,t,r,n,a){if(_d(a)||f(Qg,"@",a))return ci;var i=f(Xl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=rd(f(Zo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Xg,e,f(ru,o,a),s,t,r,n))}return si(p(Xg,e,a,ci,t,r,n))}),ev=a(function(e,t,r,n){if(_d(n))return ci;var a=f(Xl,"/",n);if(a.b){var i=a.a;return h(Zg,e,f(Zo,i,n),t,r,f(ru,i,n))}return h(Zg,e,"/",t,r,n)}),tv=n(function(e,t,r){if(_d(r))return ci;var n=f(Xl,"?",r);if(n.b){var a=n.a;return d(ev,e,si(f(Zo,a+1,r)),t,f(ru,a,r))}return d(ev,e,ci,t,r)}),rv=r(function(e,t){if(_d(t))return ci;var r=f(Xl,"#",t);if(r.b){var n=r.a;return l(tv,e,si(f(Zo,n+1,t)),f(ru,n,t))}return l(tv,e,ci,t)}),nv=function(e){return f(su,"http://",e)?f(rv,Wg,f(Zo,7,e)):f(su,"https://",e)?f(rv,Jg,f(Zo,8,e)):ci},av=Wt,iv=Gt(zt),ov=sa,uv=r(function(e,t){return L(e,t)}),sv=_r,cv=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=ju(r-n),o=f(ei,1,sv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),fv=r(function(e,t){var n=r(function(t,r){return Gp(f(xa,ov(0),d(cv,e.speed,e.easing,t,r-e.offset)))});return f(Kp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(qp,uv,iv,av(t)))}),lv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Gd(t.wallet),Mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(eg,a,n.address,rh(eo(a)),Sg(a));return d(Qd,t,i,Fo,yr)}return Ng(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Qd,D(t,{inputs:D(u,{userRole:o})}),Do,Fo,M([function(){return"Buyer"===o.$?d(Zd,"create offer type changed","input","sell dai",0):d(Zd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ng(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ng(f(Jd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Qd,(g?Jd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Do,Fo,g?M([d(Zd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=qd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jl,n,m);return Ng(D(t,{depositAmount:si(jl(lh(b))),txChainStatus:si(f(Ag,v,b))}))}var C=y.a;return d(Qd,D(t,{errors:C}),f(Zp,ms(kg),function(){return f(fv,D(Hg,{offset:60}),"inputError")}()),Fo,yr);case"AbortCreate":return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([d(Zd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Eg,v,b);var e=v.a,r=function(){var t=al(l(sh,nh(e),rh(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Ig,e,b))};return f(qo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(ts,a,E),ba)?L(si(wg(e)),r):f(Eg,v,b)}return L(si(wg(e)),r)}(),T=S.a,w=S.b;return d(Qd,D(t,{txChainStatus:T}),Do,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(l(Tg,a,b,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(ts,N,P),ba))return Ng($);var U=f(Eg,eo(a),b),T=U.a,w=U.b;return d(Qd,D($,{txChainStatus:T}),Do,w,yr)}return Ng($)}var O=k.a;return d(Qd,t,Do,Fo,M([pa(f(_g,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(f(Bg,v,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Qd,t,Do,Fo,M([pa(f(Lg,"create",B))]))}var F=e.a,V=e.b.a,K=f(Io,Rg,Yd(f(Jh,F,V)));if("Just"===K.$){var H=K.a;return d(Qd,t,Do,Fo,M([da(f(Qf,F,H))]))}return d(Qd,t,Do,Fo,M([pa(f(ll,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Qd,t,Do,Fo,M([ga]));case"NoOp":return Ng(t);default:var j=e.a;return d(Qd,t,Do,Fo,M([j]))}}),dv=r(function(e,t){return f(Eh,function(e){return f(Ch,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),hv=r(function(e,t){return f(Ku,jd(e),jd(t))}),pv=r(function(e,t){return R(f(hv,t.derived.phaseEndTime,e),Ta)}),gv=function(e){if(""===e)return li(ci);var t=vd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},vv=r(function(e,t){return{maxDai:t,minDai:e}}),yv=f(vv,ci,ci),mv=function(e){return l(Ih,r(function(t,r){return{dai:{max:r,min:t},fiatType:Ld(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Hd,function(e){return D(yv,{minDai:si(e)})},gv(e.minDai)),f(Hd,function(e){return D(yv,{maxDai:si(e)})},gv(e.maxDai)))},bv=r(function(e,t){var r=function(t){return f(Eh,function(e){return f(Qg,sd(e),sd(t))},e)};return f(Ch,function(e){return r(e.info)},t)}),Cv=r(function(e,t){return D(t,{paymentMethod:e})}),Ev=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Sv=r(function(e,t){return f(ts,jl(e),jl(t))}),Tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return wv(D(e,{inputs:f(Ev,r,f(Cv,"",e.inputs))}))},wv=function(e){var t=Tv(e),n=mv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(bv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(pv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(dv,t.filters,r)});return D(t,{filterFunc:s})},Iv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Av={$:"Expires"},Bv=function(e){return L(wv({errors:yv,filterFunc:pv,filters:co(M([f(vo,!0,!0),d(So,!0,!1,!1,!1)])),inputs:Iv,showCurrencyDropdown:!1,tradeTable:_o(L(Av,Lo)),wallet:e}),Do)},kv=r(function(e,t){var r=f(ml,wc(e),t.inputs.paymentMethodTerms);return wv(D(t,{inputs:f(Ev,r,t.inputs)}))}),Nv=function(e){return wv(D(e,{filterFunc:pv,inputs:Iv}))},Rv=function(e){return{$:"TradeTableMsg",a:e}},$v=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),_v=function(e){return d($v,e,Do,Fo,yr)},Lv=r(function(e,t){return D(t,{fiatType:e})}),xv=r(function(e,t){return D(t,{maxDai:e})}),Pv=r(function(e,t){return D(t,{minDai:e})}),Dv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return _v(D(t,{inputs:f(Pv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return _v(D(t,{inputs:f(xv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return _v(D(t,{inputs:f(Lv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return _v(D(t,{inputs:(n?Lv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return _v(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return _v(D(t,{inputs:f(Cv,r,t.inputs)}));case"AddSearchTerm":return _v(Tv(t));case"RemoveTerm":var a=e.a;return _v(f(kv,a,t));case"ApplyInputs":return d($v,wv(t),Do,Fo,yr);case"ResetSearch":return _v(Nv(t));case"FiltersMsg":var i=e.a;return _v(wv(D(t,{filters:f(Jf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(nl,o,t.tradeTable);return d($v,D(t,{tradeTable:u.model}),f(il,Rv,u.cmd),f(Yo,Rv,u.chainCmd),f(xa,Ji(Rv),u.appCmds));case"NoOp":return _v(t);default:var s=e.a;return d($v,t,Do,Fo,M([s]))}}),Uv=a(function(e,t,r,n){return e(Cl(M([L("title",hl(t)),L("body",function(){if("Nothing"===r.$)return bl;var e=r.a;return hl(e)}()),L("image",function(){if("Nothing"===n.$)return bl;var e=n.a;return hl(e)}())])))}),Ov=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Mv=function(e){return e.a+"="+e.b},Fv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Mv,e)):""},Vv=r(function(e,t){return"/"+(f(Ri,"/",e)+Fv(t))}),Kv=function(e){switch(e.$){case"Home":return f(Vv,M(["DAIHard"]),yr);case"Create":return f(Vv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Vv,M(["DAIHard","trade",Ov(t),Ni(r)]),yr);case"Marketplace":return f(Vv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Vv,M(["DAIHard","history",dl(n)]),yr);default:return f(Vv,yr,yr)}},Hv={$:"NotFound"},jv=function(e){return{$:"AgentHistory",a:e}},qv={$:"Create"},Gv={$:"Home"},zv={$:"Marketplace"},Yv=function(e){return{$:"Parser",a:e}},Wv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Jv=r(function(e,t){return Yv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Wv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Qv=f(Jv,"ADDRESS",f(zo,Ph,Yd)),Xv={$:"Eth"},Zv={$:"Kovan"},ey=f(Jv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Xv));case"keth":return si(Zi(Zv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Dg));case"xdai":return si(Zi(to));default:return ci}}),ty=f(Jv,"NUMBER",rd),ry=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Wv,r,n,a,i,e(o))}),ny=r(function(e,t){var r=t.a;return Yv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,ry(u),r(h(Wv,n,a,i,o,e)))})}),ay=function(e){return l(La,oo,yr,e)},iy=r(function(e,t){return ay(f(xa,e,t))}),oy=function(e){return Yv(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 R(u,e)?M([h(Wv,f(ka,u,r),s,a,i,o)]):yr}return yr})},uy=r(function(e,t){var r=e.a,n=t.a;return Yv(function(e){return f(iy,n,r(e))})}),sy=Yv(function(e){return M([e])}),cy=f(uy,oy("DAIHard"),function(e){return Yv(function(t){return f(iy,function(e){return(0,e.a)(t)},e)})}(M([f(ny,Gv,sy),f(ny,qv,oy("create")),f(ny,Qf,f(uy,oy("trade"),f(uy,ey,ty))),f(ny,zv,oy("marketplace")),f(ny,jv,f(uy,oy("history"),Qv)),f(ny,function(e){return jv(e)},f(uy,oy("history"),Qv))]))),fy=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 si(t.value)}return si(t.value)}return ci}},ly=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ly(r))}return yr}return yr},dy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ly(r)}var r=t;return ly(r)},hy=Qt,py=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),gy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=hy(n);if("Nothing"===o.$)return t;var u=o.a,s=hy(i);if("Nothing"===s.$)return t;var c=s.a;return l(bp,u,py(c),t)}return t}),vy=function(e){if("Nothing"===e.$)return cp;var t=e.a;return l(La,gy,cp,f(_i,"&",t))},yy=r(function(e,t){var r=e.a;return fy(r(h(Wv,yr,dy(t.path),vy(t.query),t.fragment,Ua)))}),my=function(e){return f(xc,Hv,f(yy,cy,e))},by=aa,Cy=r(function(e,t){return f(by,e,Kv(t))}),Ey=je("connectToWeb3",function(e){return bl}),Sy=function(e){return Cl(M([L("event",hl(e.event)),L("category",hl(e.category)),L("label",hl(e.label)),L("value",wl(e.value))]))},Ty=r(function(e,t){return Cl(M([L("address",hl(dl(e))),L("signSeedMsg",hl(t))]))}),wy=je("gTagOut",Ua),Iy=je("genPrivkey",Ua),Ay=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),By=n(function(e,t,r){return f(Io,Zc(t),f(Bo,function(e){return e.trades},f(Ay,function(t){return R(t.factory,e)},r)))}),ky=je("notifyPort",Ua),Ny=je("requestNotifyPermissionPort",function(e){return bl}),Ry=r(function(e,t){return D(t,{wallet:e})}),$y=r(function(e,t){return L(f(Jd,t.inputs,D(t,{wallet:e})),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(eg,n,r.address,rh(eo(n)),Sg(n))}return Do}())}),_y=r(function(e,t){return D(t,{wallet:e})}),Ly=function(e){return{$:"AllowanceFetched",a:e}},xy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Gd(e),Mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Mg(e),si(i.factory))?d(eg,a,n.address,i.creationInfo.address,Ly):Do}return Do}())}),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{$:"TradeModel",a:e}},Fy=function(e){return{$:"TradeMsg",a:e}},Vy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Do);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Dy(a),f(il,Uy,i));case"TradeModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(il,Fy,c));case"MarketplaceModel":var l=t.a;return L(Oy(f(_y,e,l)),Do);default:var d=t.a;return L(Py(f(Ry,e,d)),Do)}}),Ky=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Hy=function(e){return{$:"PartiallyLoadedTrade",a:e}},jy=r(function(e,t){return Hy(g(Ky,e,t,ci,ci,ci,ci,ci))}),qy=function(e){return{$:"CurrentBlockFetched",a:e}},Gy=gu(f(zo,cu,Nh)),zy=function(e){return Up({decoder:Gy,method:"eth_blockNumber",params:yr,url:e})},Yy=function(e){return f(Zp,qy,zy(e))},Wy=r(function(e,t){return{address_:e,blocknum:t}}),Jy=function(e){return Wo(function(t){return li(L(t,e))})},Qy=n(function(e,t,r){var n=t.a,a=r.a;return Wo(function(t){return f(Wh,function(t){var r=t.a,n=t.b;return f(au,rl(e(n)),a(r))},n(t))})}),Xy=r(function(e,t){return l(Qy,r(function(e,t){return e(t)}),t,e)}),Zy=vu(f(Xy,jh,f(Xy,Dh,Jy(Wy)))),em=r(function(e,t){return{data:si(f(Gf,"createdTrades(uint256)",M([uh(t)]))),decoder:Zy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tm=n(function(e,t,r){return f(Zp,r,f(Fp,Xh(e),f(em,rh(e),t)))}),rm=function(e){return{$:"CreationInfoFetched",a:e}},nm=r(function(e,t){return l(tm,e,qu(t),rm)}),am=function(e){return{$:"EventSentryMsg",a:e}},im=function(e){return{$:"BlockNumber",a:e}},om=function(e){return{$:"EventSentry",a:e}},um=function(e){return{$:"Set_elm_builtin",a:e}},sm=um(cp),cm=r(function(e,t){return L(om({blockNumber:ci,errors:yr,nodePath:t,pending:sm,ref:1,requests:cp,tagger:e,watching:sm}),f(Zp,f(zo,im,e),zy(t)))}),fm=function(e){return f(cm,am,Xh(e))},lm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},hm=dm(f(lm,ci,ci)),pm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:Co,secureCommInfo:hm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),gm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),vm=n(function(e,t,r){var n=f(nm,t,r),a=fm(t),i=a.a,o=a.b;return d(gm,l(pm,f(jy,t,r),i,e),Po(M([n,o,Yy(Xh(t))])),Fo,M([ha]))}),ym=function(e){return{$:"LoadedTrade",a:e}},mm=r(function(e,t){var r=fm(t.factory),n=r.a,a=r.b;return d(gm,l(pm,ym(t),n,e),Po(M([a,Yy(Xh(t.factory))])),Fo,M([ha]))}),bm=function(e){return{data:si(f(Gf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Cm=function(e){return{data:si(f(Gf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Em=function(e){return{data:si(f(Gf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Sm=r(function(e,t){return{data:si(f(Gf,"initiatorStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Tm=function(e){return{data:si(f(Gf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},wm=function(e){return{data:si(f(Gf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Im=r(function(e,t){return{data:si(f(Gf,"responderStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Am=r(function(e,t){return{amount:t,fiatType:e}}),Bm=f(du,function(e){var t=cd(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("Can't convert that to a BigInt")},pu),km=l(Mi,Am,f(Fh,0,pu),f(Fh,1,Bm)),Nm={$:"Bank"},Rm={$:"Cash"},$m=function(e){switch(e){case"cash":return si(Rm);case"bank":return si(Nm);case"custom":return si(Fd);default:return ci}},_m=f(du,function(e){var t=$m(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("")},pu),Lm=l(Mi,Vd,f(Oh,"type",_m),f(Oh,"info",pu)),xm=oe,Pm=function(e){var t=l(Mi,sg,f(Oh,"price",km),f(Oh,"paymentmethods",xm(Lm)));return f(op,t,e)},Dm=r(function(e,t){return{commPubkey:t,responder:e}}),Um=r(function(e,t){var n=r(function(t,r){return l(Xo,t,t+2*r,e)}),a=f(zo,Nh,au(ti(2)));return f(Wh,function(t){return f(au,function(e){return f(n,t+64,e)},Nh(l(Xo,t,t+64,e)))},a(t))}),Om=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),Mm=n(function(e,t,r){var n=l(Ra,Om(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),Fm=j,Vm=function(e){return As(Fm(e))},Km=function(e){return l(Mm,r(function(e,t){return U(t,Vm(e))}),"",e)},Hm=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f(Wh,Km,f(Wh,f(zo,xa(Nh),Ah),f(au,ml(f(zo,_d,ns)),f(au,tc(2),f(Um,t,nu(r)))))))}),jm=f(dh,f(Mh,1,Hm),f(dh,f(Mh,0,Dh),Fi(Dm))),qm=r(function(e,t){return{commPubkey:t,terms:e}}),Gm=f(dh,f(Mh,1,Hm),f(dh,f(Mh,0,Hm),Fi(qm))),zm=function(e){return{statement:e}},Ym=f(dh,f(Mh,0,Hm),Fi(zm)),Wm=function(e){return{statement:e}},Jm=f(dh,f(Mh,0,Hm),Fi(Wm)),Qm={$:"AbortedEvent"},Xm={$:"BurnedEvent"},Zm={$:"ClaimedEvent"},eb=function(e){return{$:"CommittedEvent",a:e}},tb=function(e){return{$:"InitiatedEvent",a:e}},rb=function(e){return{$:"InitiatorStatementLogEvent",a:e}},nb={$:"PokeEvent"},ab={$:"RecalledEvent"},ib={$:"ReleasedEvent"},ob=function(e){return{$:"ResponderStatementLogEvent",a:e}},ub=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),sb=function(e){return ub(e)?li(nc(cu(e))):fi("Something in here is not very hexy: "+xh(e))},cb=gu(sb),fb=f(Oh,"topics",f(Fh,0,cb)),lb=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),Kf(f(xa,yi,Zs(e))))))},db=f(du,function(e){return R(e,lb("Initiated(string,string)"))?f(Oi,tb,Gm):R(e,lb("Committed(address,string)"))?f(Oi,eb,jm):R(e,lb("Recalled()"))?Fi(ab):R(e,lb("Claimed()"))?Fi(Zm):R(e,lb("Aborted()"))?Fi(Qm):R(e,lb("Released()"))?Fi(ib):R(e,lb("Burned()"))?Fi(Xm):R(e,lb("InitiatorStatementLog(string)"))?f(Oi,rb,Ym):R(e,lb("ResponderStatementLog(string)"))?f(Oi,ob,Jm):R(e,lb("Poke()"))?Fi(nb):hu("Unrecognized topic hash")},fb),hb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},pb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},gb=function(e){return R(e.buyerDeposit,Yl(e.tradeAmount))&&R(e.abortPunishment,zl(e.tradeAmount))},vb={$:"Invalid"},yb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),mb=r(function(e,t){return Vl(jd(t)+jd(e))}),bb=function(e){var t=Bd(Sd(e.amount));if("Just"===t.$){return t.a}f(cl,"Error converting FiatValue to float--string -> float failed!",e);return 0},Cb=r(function(e,t){return(t-e)/e}),Eb=r(function(e,t){var r=bb(t),n=kd(e);return"USD"===t.fiatType?si(f(Cb,n,r)):ci}),Sb=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 Vl(0)}}();return{margin:f(Eb,e.tradeAmount,r.price),phaseEndTime:function(){return"Closed"===t.phase.$?Vl(f(Nu,2,53)-1):f(mb,t.phaseStartTime,n)}()}}),Tb=function(e){var t=x(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 ym(v(yb,e.factory,e.id,n,a,o,u,s,l(Sb,a,o,u)))}return Hy(e)},wb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(cl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return vb}}),Ib=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return vb}}),Ab=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return vb}}),Bb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return ym(D(n,{state:e}));default:return vb}}),kb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Tb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return vb}}),Nb=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}}),Rb=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,uu,f(Xy,Dh,Jy(Nb))))))))))),$b=function(e){return{data:si(f(Gf,"getParameters()",yr)),decoder:Rb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},_b=function(e){return f(Bo,function(e){return Vl(1e3*e)},rd(Sd(e)))},Lb=function(e){return Hl(e)},xb=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),Pb=function(e){var t=f($d,"error converting BigInt to Time.Posix",_b(e.autoabortInterval)),r=f($d,"error converting BigInt to Time.Posix",_b(e.autoreleaseInterval)),a=f($d,"error converting BigInt to Time.Posix",_b(e.autorecallInterval));return d(xb,n(function(t,r,n){return{abortPunishment:Lb(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:Lb(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:Lb(e.pokeReward),tradeAmount:Lb(e.tradeAmount)}}),a,t,r)},Db=n(function(e,t,r){return f(Zp,r,f(jp,Pb,f(Fp,Xh(e),$b(t))))}),Ub=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}}}}}}}}}}},Ob=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(Ub)))))))))))),Mb=function(e){return{data:si(f(Gf,"getPhaseStartInfo()",yr)),decoder:Ob,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Fb=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),Vb=function(e){return h(Fb,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}}),_b(e.v6),_b(e.v7),_b(e.v8),_b(e.v9))},Kb=n(function(e,t,r){return f(Zp,r,f(jp,Vb,f(Fp,Xh(e),Mb(t))))}),Hb=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),jb=vu(f(Xy,jh,f(Xy,Dh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(Hb))))))),qb=function(e){return{data:si(f(Gf,"getState()",yr)),decoder:jb,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Gb={$:"Aborted"},zb={$:"Burned"},Yb={$:"NotClosed"},Wb={$:"Recalled"},Jb={$:"Released"},Qb=function(e){switch(f(xc,99,rd(Sd(e)))){case 0:return si(Yb);case 1:return si(Wb);case 2:return si(Gb);case 3:return si(Jb);case 4:return si(zb);default:return ci}},Xb=function(e){switch(f(xc,99,rd(Sd(e)))){case 1:return si(Co);case 2:return si(mo);case 3:return si(bo);case 4:return si(yo);default:return ci}},Zb=function(e){return R(e,th("0x0000000000000000000000000000000000000000"))?ci:si(e)},eC=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),tC=function(e){var t=_b(e.phaseStartTimestamp),r=Xb(e.phase),a=Qb(e.closedReason);return d(eC,n(function(t,r,n){return{balance:Lb(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:Zb(e.responder)}}),r,t,a)},rC=n(function(e,t,r){return f(Zp,r,f(jp,tC,f(Fp,Xh(e),qb(t))))}),nC=i(function(e,t,r,n,a){return Po(M([l(Db,e,t,r),l(rC,e,t,n),l(Kb,e,t,a)]))}),aC=function(e){var t=Rg(e);if("Just"===t.$){return t.a}f(cl,"Warning! BigInt to Int conversion failed!",Sd(e));return 0},iC=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),oC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),uC=function(e){return e.b?l(oC,e,yr,0):qa},sC=tn,cC=function(e){var t=h(sC,iC,f(Oh,"encapsulation",pu),f(Oh,"iv",pu),f(Oh,"tag",pu),f(Oh,"encrypted",pu)),r=xm(t),n=f(Gh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Zc,0,e),f(Zc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(uC(i))},fC=function(e){var t=function(e){var t=Qo(e);return t>1114111?fi("string is too long"):li(f(Is,Fm(t),e))};return f(au,Ri(""),Ah(f(xa,t,e)))},lC=function(e){var t=e.a,r=e.b;return fC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},dC=r(function(e,t){return Cl(M([L("message",hl(e)),L("pubkeyHexStrings",f(zh,hl,M([t.initiatorPubkey,t.responderPubkey])))]))}),hC=function(e){return{$:"LoadedCommInfo",a:e}},pC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),gC=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 hC(f(pC,r,n))}return dm(e)},vC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return gC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return hC(D(n,{initiatorPubkey:e}))}),yC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return gC(D(r,{responderPubkey:si(e)}))}var n=t.a;return hC(D(n,{responderPubkey:e}))}),mC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),bC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(nd,a,n),o=$s(f(lc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),CC=function(e){var t=uC(f(bC,Zs(e),yr));return l(zd,uv,h(Fb,iC,f(Zc,0,t),f(Zc,1,t),f(Zc,2,t),f(Zc,3,t)),h(Fb,iC,f(Zc,4,t),f(Zc,5,t),f(Zc,6,t),f(Zc,7,t)))},EC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),SC={$:"Aborted"},TC={$:"Burned"},wC={$:"Claimed"},IC=function(e){return{$:"Committed",a:e}},AC=function(e){return{$:"Encrypted",a:e}},BC={$:"FailedDecode"},kC={$:"Initiated"},NC={$:"Recalled"},RC={$:"Released"},$C=function(e){return{$:"StateChange",a:e}},_C=function(e){return{$:"Statement",a:e}},LC=fr,xC=cr,PC=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(LC,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(xC,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),DC=or,UC=y,OC=a(function(e,t,r,n){var a=Wc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(DC,Ga(r),n);var i=za(d(OC,e-Ha,t,r,ja));return f(DC,i,n)}var o=f(Jc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(OC,e-Ha,t,r,u));return l(rf,a,i,n)}var i=za(d(OC,e-Ha,t,r,UC(o)));return l(rf,a,i,n)}),MC=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(OC,c,r,e,UC(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(OC,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),FC=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(LC,32,r,e),o=f(MC,i,t);if(a<0){var u=l(xC,a,n,e);return f(MC,u,o)}return o}),VC=ur,KC=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(VC,i,t,r)}return f(ka,e,t)});return{nodeList:l(VC,i,yr,n),nodeListSize:t/32|0,tail:a}},HC=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(VC,o,t,r)}var n=e.a;return f(FC,n,t)});return f(FC,i,l(VC,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(VC,o,t,r)}var n=e.a;return f(PC,n,t)});return f(ai,!0,f(PC,i,l(VC,o,KC(e),a)))}),jC=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),qC=f(La,jC,yr),GC=n(function(e,t,r){var n=mC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si($C(kC));case"CommittedEvent":var r=t.a;return si($C(IC(r.responder)));case"RecalledEvent":return si($C(NC));case"ClaimedEvent":return si($C(wC));case"AbortedEvent":return si($C(SC));case"ReleasedEvent":return si($C(RC));case"BurnedEvent":return si($C(TC));case"InitiatorStatementLogEvent":var r=t.a;return si(_C({blocknum:e,message:function(){var e=CC(r.statement);if("Just"===e.$){var t=e.a;return AC(t)}return BC}(),who:n(To)}));case"ResponderStatementLogEvent":var r=t.a;return si(_C({blocknum:e,message:function(){var e=CC(r.statement);if("Just"===e.$){var t=e.a;return AC(t)}return BC}(),who:n(wo)}));default:return ci}}(),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(HC,r.history,uC(qC(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Bo,EC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),qC(M([s])))}),zC=Gr,YC=function(e){var t=l(Mi,uv,f(Oh,"id",zC),f(Oh,"message",pu));return f(Hd,Di,f(Gh,t,e))},WC=function(e){return{$:"Decrypted",a:e}},JC=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),QC=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(GC,n,a,t),o=i.a,u=i.b,s=i.c;return d(JC,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(JC,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(JC,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=YC(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Zc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:WC(y)}),T=D(b,{eventInfo:_C(S)}),w=l(af,v,T,t.history);return d(JC,D(t,{history:w}),!1,ci,yr)}return d(JC,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an event that is not a message!",b))]))}return d(JC,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(JC,t,!1,ci,M([pa(f(ll,"Error decoding decryption result",I))]))}}),XC=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),ZC=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),eE=function(e){return{onBroadcast:ci,onMined:si(L(XC(e),ci)),onSign:si(ZC(e))}},tE=je("encryptToPubkeys",Ua),rE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),nE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),aE=function(e){return{$:"CommitMined",a:e}},iE={$:"CommitNeedsSig"},oE=function(e){return{$:"CommitSigned",a:e}},uE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?nE:rE}(),a=al(function(){return"Token"===e.factory.$?Ua:pg(jl(hb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(iE),f(qo,{onBroadcast:ci,onMined:si(L(aE,ci)),onSign:si(oE)},a))}),sE=r(function(e,t){return Cl(M([L("id",wl(e)),L("encapsulation",hl(t.encapsulatedKey)),L("iv",hl(t.iv)),L("tag",hl(t.tag)),L("encrypted",hl(t.message))]))}),cE=je("decryptMessage",Ua),fE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},lE=r(function(e,t){return Po(f(xa,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 cE(f(sE,r,s))}return Do}return Do},fE(e.history)))}),dE=function(e){if("Just"===e.$){return e.a}return ci},hE=function(e){var t=dE(l(zd,Ao,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Bo,function(e){return e.address},Gd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(lE,n,a)}return Do},pE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(GC,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),gE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),vE=i(function(e,t,r,n,a){return f(pE,n,p(gE,e,r,t,qa,a,""))}),yE=function(e){return{$:"ChatHistoryMsg",a:e}},mE=a(function(e,t,r,n){var a=x(t,Gd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(ko,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(yE),n))}(h(vE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),bE={$:"Abort"},CE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),EE=function(e){return{$:"ActionNeedsSig",a:e}},SE=function(e){return{$:"ApproveMining",a:e}},TE={$:"ApproveNeedsSig"},wE=function(e){return{$:"ApproveSigned",a:e}},IE={$:"Burn"},AE={$:"Claim"},BE=function(e){return{$:"CommitMining",a:e}},kE=function(e){return{$:"ConfirmingAction",a:e}},NE=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),RE=function(e){return{$:"EventLogFetched",a:e}},$E=function(e){return{$:"ParametersFetched",a:e}},_E=function(e){return{$:"PhaseInfoFetched",a:e}},LE={$:"Poke"},xE={$:"Recall"},PE={$:"Release"},DE=function(e){return{$:"StartContractAction",a:e}},UE=function(e){return{$:"StateFetched",a:e}},OE=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"}},ME=function(e){return d(gm,e,Do,Fo,yr)},FE={align:ul,label:"cantFindTradeWillRetry",mainParagraphs:M([M([fl("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:$g},VE=r(function(e,t){if("Err"===t.$){var r=t.a;return f(_g,e,r)}if("Nothing"===t.a.$){t.a;return f(ll,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ll,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),KE={align:ul,label:"tradeParametersNotDefault",mainParagraphs:M([M([fl("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:$g},HE=eo(Xi),jE=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),qE=n(function(e,t,r){return l(bp,e,Bo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),GE=r(function(e,t){var r=t.a;return um(f(mp,e,r))}),zE=n(function(e,t,r){var n=e.a,a=f(fp,t,n.requests);if("Nothing"===a.$)return L(om(n),Do);var i=a.a,o=L(i.watchOnce,Ql(r));if("Nothing"===o.b.$){o.b;return L(om(D(n,{requests:l(qE,t,r,n.requests)})),Do)}if(o.a){var u=o.b.a;return L(om(D(n,{requests:l(qE,t,r,n.requests),watching:f(GE,t,n.watching)})),f(Yg,i.tagger,xp(u)))}return L(om(D(n,{requests:l(qE,t,r,n.requests)})),Po(f(xa,function(e){return f(Yg,i.tagger,xp(e))},r)))}),YE=_e,WE=r(function(e,t){return f(Zp,f(zo,im,t),f(Kp,function(t){return zy(e)},YE(2e3)))}),JE=ue,QE=ce,XE=Yr,ZE=n(function(e,t,r){var n=function(e){return QE(M([e,JE(r)]))};return f(du,function(a){var i=f(Gh,e,a);if("Ok"===i.$){var o=i.a,u=f(Gh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return hu(Di(c))}return Fi(r)},XE)}),eS=a(function(e,t,r,n){return f(dh,l(ZE,f(Oh,e,XE),t,r),n)}),tS=n(function(e,t,r){return f(dh,f(Oh,e,t),r)}),rS=gu(Ph),nS=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),aS=function(e){return{$:"BlockHash",a:e}},iS=function(e){return nS(e)?li(aS(cu(e))):fi("Given blockHash "+xh(e)+" is not valid.")},oS=gu(iS),uS=function(e){return{$:"TxHash",a:e}},sS=function(e){return nS(e)?li(uS(cu(e))):fi("Given txHash "+xh(e)+" is not valid.")},cS=gu(sS),fS=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}}),lS=zr,dS=l(tS,"blockNumber",Gy,l(tS,"blockHash",oS,l(tS,"transactionHash",cS,l(tS,"transactionIndex",Gy,l(tS,"logIndex",Gy,d(eS,"removed",lS,!1,l(tS,"topics",xm(cb),l(tS,"data",pu,l(tS,"address",rS,Fi(fS)))))))))),hS=function(e){return f(zh,function(e){if("Just"===e.$){var t=e.a;return hl(qf(t))}return bl},e)},pS=function(e){return Cl(M([L("fromBlock",Zh(e.fromBlock)),L("toBlock",Zh(e.toBlock)),L("address",pl(e.address)),L("topics",hS(e.topics))]))},gS=r(function(e,t){return Up({decoder:xm(dS),method:"eth_getLogs",params:M([pS(t)]),url:e})}),vS=function(e){return{$:"BlockNum",a:e}},yS=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Kp,function(r){return f(jp,vi(r),f(gS,e,D(t,{fromBlock:vS(n),toBlock:vS(a)})))},f(gS,e,t)):f(gS,e,t)}),mS=n(function(e,t,r){var n=r.a,a=r.b;return f(gS,e,D(t,{fromBlock:vS(n),toBlock:vS(a)}))}),bS=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(bS,e,t,i)),c=o;e=u,t=s,r=c}}),CS=r(function(e,t){return l(bS,xl,t,e)}),ES=r(function(e,t){var r=e.a,n=t.a;return um(f(CS,r,n))}),SS=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 Po(f(xa,function(t){return f(Zp,f(zo,jE(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},qC(f(xa,function(e){return f(fp,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(om(D(r,{blockNumber:si(a)})),Po(M([f(WE,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,mS)]))):L(t,f(WE,r.nodePath,r.tagger))}return L(om(D(r,{blockNumber:si(a),pending:sm,watching:f(ES,r.watching,r.pending)})),Po(M([f(WE,r.nodePath,r.tagger),l(i,L(a,a),r.pending,yS),l(i,L(a,a),r.watching,mS)])))}var s=e.a.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),f(WE,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(zE,t,c,d)}var s=e.b.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),Do)}),TS=r(function(e,t){var r=t.a;return um(l(xl,e,gr,r))}),wS=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(xl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(om(D(o,{watching:f(TS,a.ref,o.watching)})),f(Zp,f(zo,jE(a.ref),a.tagger),e),a.ref)}(l(yS,a.nodePath,n,L(s,s)))}return x(om(D(o,{pending:f(TS,a.ref,o.pending)})),Do,a.ref)}),IS=wS(!1),AS=function(e){return M([e])},BS=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(nm,r.factory,r.id):Do}}(),function(){var e=x(Gd(t.wallet),Mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Mg(t.wallet),si(a.factory))?d(eg,n,r.address,a.creationInfo.address,Ly):Do}return Do}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(mE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?hE(t):Do,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(gm,u,Po(M([l(rC,p.factory,p.creationInfo.address,UE),s,r])),Fo,o)}return ME(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return ME(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(ts,m,jl(hb(C.parameters))),ba))return ME(u);var S=l(uE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(gm,D(u,{txChainStatus:T}),Do,w,yr)}return ME(u)}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:aC(I.blocknum)},B=l(IS,RE,t.eventSentry,{address:A.address,fromBlock:vS(A.blocknum),toBlock:Mp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(wb,A,t.trade)}),$=f(xc,HE,pb(u.trade)),_=Po(M([N,h(nC,$,A.address,$E,UE,_E)]));return d(gm,u,_,Fo,yr)}if("BadBody"===g.a.$){g.a.a;return d(gm,t,Do,Fo,M([pa(FE)]))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(Bb,P,t.trade)});return d(gm,u,hE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(VE,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(gb(F)){var u=D(t,{trade:f(Ib,F,t.trade)});return d(gm,u,hE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(KE)]))}var V=g.a.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Ab,H,t.trade)});return d(gm,u,hE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(VE,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Yh,db,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(vC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(yC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=Pm(e.terms);if("Ok"===r.$){var n=r.a;return L(f(kb,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ll,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(yE),n))}(l(GC,q.blockNumber,Y,r))}return d(mE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?hE(u):Do;return d(gm,u,_,Fo,f(oo,f(xa,pa,qC(M([X]))),o));case"ExpandPhase":var te=e.a;return ME(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return ME(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return ME(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(gm,t,Do,Fo,M([da(jv(C.parameters.initiatorAddress))]))}return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return ME(D(t,{txChainStatus:si(f(NE,E,ie))}));case"AbortAction":return ME(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(uE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=al(l(sh,nh(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(wE)};return f(qo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(ts,i,jl(hb(C.parameters))),ba)?L(si(TE),n):l(uE,C,E.address,E.commPubkey)}return L(si(TE),n)}(),T=oe.a,w=oe.b;return d(gm,D(t,{txChainStatus:T}),Do,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,LE)||R(ue,xE)){var se=DE(ue),ce=t;e=se,t=ce;continue e}return ME(D(t,{txChainStatus:si(kE(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Fo,M([pa(f(ll,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=al(Tm(n.creationInfo.address));return x(si(EE(xE)),f(qo,eE(xE),a),yr);case"Claim":var a=al(Em(n.creationInfo.address));return x(si(EE(AE)),f(qo,eE(AE),a),yr);case"Abort":var a=al(bm(n.creationInfo.address));return x(si(EE(bE)),f(qo,eE(bE),a),yr);case"Release":var a=al(wm(n.creationInfo.address));return x(si(EE(PE)),f(qo,eE(PE),a),yr);case"Burn":var a=al(Cm(n.creationInfo.address));return x(si(EE(IE)),f(qo,eE(IE),a),yr);default:var a=al(zf(n.creationInfo.address));return x(si(EE(LE)),f(qo,eE(LE),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(gm,D(t,{txChainStatus:T}),Do,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return ME(D(t,{txChainStatus:si(SE(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return ME(D(t,{txChainStatus:si(BE(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"commit",V))]));case"CommitMined":return ME(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return ME(D(t,{txChainStatus:si(f(CE,ue,he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,OE(ue),V))]));case"ActionMined":var ue=e.a;return ME(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(SS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(gm,D(t,{eventSentry:ve}),_,Fo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(QC,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?hE(t):Do,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(tE(f(dC,r,a)),ci)}return L(Do,si(f(ll,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Do,ci)}(),Te=Se.a,we=Se.b;return d(gm,Ee,Po(M([s,Te])),Fo,U(f(Qi,yE,Ce.appCmds),f(xc,yr,f(Bo,AS,f(Bo,pa,we)))))}return d(gm,t,Do,Fo,M([pa(f(ll,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Wh,lC,cC(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Ao,p,E.address);if("Nothing"===Ne.$)return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return al("Initiator"===Re.$?f(Sm,p.creationInfo.address,ke):f(Im,p.creationInfo.address,ke))}();return d(gm,t,Do,f(qo,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(gm,t,Do,Fo,M([pa(f(ll,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return ME(t)}var V=e.a.a;return d(gm,t,Do,Fo,M([pa(f(Lg,"message",V))]));default:return d(gm,t,Do,Fo,M([ga]))}}),kS=r(function(e,t){return{address:e,blocknum:t}}),NS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},RS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(wS,!0,e,t,r))}),$S=n(function(e,t,r){var n=function(e){return r(f(Yh,Gm,e).returnData)},a={address:t.address,fromBlock:vS(t.blocknum),toBlock:vS(t.blocknum),topics:M([si(lb("Initiated(string,string)"))])};return l(RS,n,e,a)}),_S=function(e){return{data:si(f(Gf,"numTrades()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},LS=r(function(e,t){return f(Zp,t,f(Fp,Xh(e),_S(rh(e))))}),xS=function(e){return{data:si(f(Gf,"phase()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},PS=n(function(e,t,r){return f(Zp,r,f(jp,Xb,f(Fp,Xh(e),xS(t))))}),DS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),US=r(function(e,t){return l(La,DS(e),yr,t)}),OS=function(e){return f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},MS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},FS=function(e){return f(MS,Ja(vb),Sa(e.trades))},VS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:FS(e),loaded:Ti(OS(e))})})},KS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),HS=r(function(e,t){var r=f(Zc,e,t.trades);if("Just"===r.$){var n=(r.a,l(af,e,vb,t.trades));return l(KS,VS(D(t,{trades:n})),Do,yr)}return l(KS,t,Do,M([pa(f(ll,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),jS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(wb,t,a),o=l(af,e,i,r.trades);return L(VS(D(r,{trades:o})),yr)}return L(r,M([f(ll,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),qS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Ib,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(af,e,ym(D(a,{state:D(i,{phase:t})})),r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),zS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Ab,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),YS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Bb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),WS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(kb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),JS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),QS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),XS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),ZS=function(e){return{$:"NumTradesFetchedAgain",a:e}},eT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),tT=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),rT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),nT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),aT=function(e){return l(KS,e,Do,yr)},iT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=aC(n),i=uC(f(xa,jy(t.factory),f(Ai,0,a-1))),o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,0,a-1)));return l(KS,D(t,{dataFetchState:l(QS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CheckForNewTrades":return l(KS,t,f(LS,t.factory,ZS),yr);case"UpdateTradePhases":var s=Po(qC(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(PS,e.factory,e.creationInfo.address,f(tT,e.factory,e.id)))},OS(t))));return l(KS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(GS,d,p,t),v=function(){var e=L(p,f(Zc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=NS(r);if("Just"===n.$){var a=n.a;return L(l(rC,c,a.address,nT(d)),yr)}return L(Do,M([pa(f(ll,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Do,yr)}e.b;return L(Do,M([pa(f(ll,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(KS,g.tradeCache,Po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(KS,t,Do,M([pa(f(VE,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=aC(n);if(_(C,E)<0){var S=t.dataFetchState,o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,C,E-1))),T=uC(f(xa,jy(t.factory),f(Ai,C,E-1)));return l(KS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(HC,t.trades,T)}),o,yr)}return aT(t)}b.b;return l(KS,t,Do,M([pa(f(ll,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(kS,w.address_,aC(w.blocknum)),A=l($S,t.eventSentry,I,XS(d)),B=A.a,k=A.b,y=Po(M([h(nC,t.factory,I.address,eT(d),nT(d),rT(d)),k])),N=l(jS,d,I,t),R=N.a,$=N.b;return l(KS,VS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(KS,t,Do,M([pa(f(_g,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(qS,d,P,t)}var U=r.a.a;return l(KS,t,Do,M([pa(f(ll,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(YS,d,O,t)}return l(KS,t,Do,M([pa(f(VE,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(zS,d,F,t)}return l(KS,t,Do,M([pa(f(VE,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=Pm(V.terms);if("Ok"===K.$){var H=K.a;return l(WS,d,H,t)}var j=K.a;return f(HS,d,t)}var j=r.a;return l(KS,t,Do,M([pa(f(ll,"Error decoding initiated event",j))]));default:var q=e.a,G=f(SS,q,t.eventSentry),z=G.a,y=G.b;return l(KS,D(t,{eventSentry:z}),y,yr)}}),oT=function(e){return{$:"AgentHistoryMsg",a:e}},uT=function(e){return{$:"AppCmd",a:e}},sT={$:"BetaLandingPage"},cT={$:"ConnectToWeb3"},fT=function(e){return{$:"MarketplaceMsg",a:e}},lT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),dT=r(function(e,t){return f(kn,e,hl(t))}),hT=function(e){return f(dT,"href",tt(e))},pT=Nn("rel"),gT=dT("target"),vT=function(e){return{$:"Height",a:e}},yT=vT,mT={$:"Content"},bT=mT,CT=function(e){return{$:"Width",a:e}},ET=CT,ST=function(e){return{$:"Attr",a:e}},TT=function(e){return{$:"NodeName",a:e}},wT=function(e){return{$:"Unkeyed",a:e}},IT={$:"AsEl"},AT=IT,BT=r(function(e,t){return{$:"Field",a:e,b:t}}),kT=f(BT,0,0),NT={$:"NoNearbyChildren"},RT={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"},$T=RT.any+" "+RT.column,_T=RT.any+" "+RT.grid,LT=RT.any+" "+RT.page,xT=RT.any+" "+RT.paragraph,PT=RT.any+" "+RT.row,DT=RT.any+" "+RT.single,UT=function(e){switch(e.$){case"AsRow":return PT;case"AsColumn":return $T;case"AsEl":return DT;case"AsGrid":return _T;case"AsParagraph":return xT;default:return LT}},OT=function(e){return{$:"Keyed",a:e}},MT={$:"NoStyleSheet"},FT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),VT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),KT={$:"AsParagraph"},HT=KT,jT=Sn("div"),qT=Sn("p"),GT=Sn("s"),zT=Sn("u"),YT=dT("className"),WT=function(e){return wn(Xe(e))},JT=function(e){return Sn(Xe(e))},QT=function(e){return{$:"Flag",a:e}},XT=function(e){return{$:"Second",a:e}},ZT=function(e){return e>31?XT(1< .ctr > ."+RT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",eI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+" { flex-basis: auto !important; } "+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+Ew(RT.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"+Zw,tI=function(e){return{$:"Intermediate",a:e}},rI=r(function(e,t){return tI({closing:t,others:yr,props:yr,selector:e})}),nI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,tI({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(nI,f(rI,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(nI,f(rI,n.selector,""),v),t.others)})}});return tI(l(La,a,n,t))}),aI=U(eI,function(e){var t=function(e){return Cd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Cd(f(xa,a,t.others)))};return Cd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(nI,f(rI,r,""),n),t)}),yr,e)))}(U(Jw,Xw))),iI=l(JT,"style",yr,M([Tw(aI)])),oI=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+'"'}},uI=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}},sI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ch,uI,t.variants)}return!1},cI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),fI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),lI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(fI,"."+e+"."+t+", ."+e+" ."+t,n),f(fI,"."+e+"."+t+"> ."+RT.text+", ."+e+" ."+t+" > ."+RT.text,a)])}),dI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(lI,i,RT.sizeByCapital,a),l(lI,i,RT.fullSize,n)))}),hI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(fI,"."+r+"."+RT.sizeByCapital+", ."+r+" ."+RT.sizeByCapital,M([L("line-height","1")])),f(fI,"."+r+"."+RT.sizeByCapital+"> ."+RT.text+", ."+r+" ."+RT.sizeByCapital+" > ."+RT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),pI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},gI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Tc,t,r))}return ci},vI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),yI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(xc,e.descender,gI(t)),n=f(xc,e.baseline,gI(f(ml,function(e){return!R(e,r)},t))),a=f(xc,e.capital,pI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(vI,i,a-n,o),full:l(vI,u,a-r,s)}},mI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",mw(e.height)),L("vertical-align",mw(e.vertical)+"em"),L("font-size",mw(e.size)+"em")]))},bI=function(e){return l(Ra,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 si(L(mI(function(e){return e.full}(yI(a))),mI(function(e){return e.capital}(yI(a)))))}return t}return t}),ci,e)},CI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(US,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=bI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,hI(t),n));var i=a.a;return f(Ri,"",f(xa,f(dI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},EI=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+'" '+Ni(r)}},SI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,EI,t.variants)))}return ci},TI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},wI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+mw(r)+"px, "+mw(n)+"px, "+mw(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("+mw(o)+"px, "+mw(u)+"px, "+mw(s)+"px)",b="scale3d("+mw(f)+", "+mw(l)+", "+mw(d)+")",C="rotate3d("+mw(p)+", "+mw(g)+", "+mw(v)+", "+mw(y)+"rad)";return si(m+" "+b+" "+C)}},II=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,cI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,cI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,cI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,cI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+RT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+RT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+RT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,cI(!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,M([f(vw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Tc,1,1-c));return l(a,t,"."+u,M([f(vw,"opacity",mw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(vw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(US,SI,p)),v=M([f(vw,"font-family",f(Ri,", ",f(xa,oI,p))),f(vw,"font-feature-settings",g),f(vw,"font-variant",f(Ch,sI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(vw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(vw,s,bw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+RT.row,A="."+(RT.wrapped+I),B="."+RT.alignRight,k="."+RT.paragraph,N="."+RT.page,R="."+RT.alignLeft,$=mw(S/2)+"px",_=mw(E/2)+"px",x="."+RT.column,y="."+C,P="."+RT.any;return Cd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(vw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(vw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,U(y,k),M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,lw,F.rows))+"-cols-"+f(Ri,"-",f(xa,lw,F.columns))+"-space-x-"+lw(F.spacing.a)+"-space-y-"+lw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=wI(ne),y=hw(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,M([f(vw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=TI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(CI(s),c)}),AI=r(function(e,t){return l(JT,"style",yr,M([Tw(f(II,e,t))]))}),BI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",iI),f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)}),kI=a(function(e,t,r,n){return e?f(ka,iI,f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)):f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)}),NI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(WT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(BI,!1,e,t,r);default:var e=i.a,t=i.b;return d(BI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return jT;case"p":return qT;default:return JT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(kI,!1,e,t,n);default:var e=i.a,t=i.b;return d(kI,!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(JT,e,n,M([f(u,r,M([YT(RT.any+" "+RT.single)]))]))}}();switch(o.$){case"AsRow":return f(ow,sw,e)&&!f(ow,uw,e)?s:f(ow,tw,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerRight])))]),M([s])):f(ow,rw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(ow,iw,e)&&!f(ow,aw,e)?s:f(ow,nw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerCenterY])))]),M([s])):f(ow,ew,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerBottom])))]),M([s])):s;default:return s}}),RI=Tw,$I=function(e){return f(jT,M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthContent,RT.heightContent])))]),M([RI(e)]))},_I=function(e){return l(JT,"div",M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthFill,RT.heightFill])))]),M([Tw(e)]))},LI=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 R(e,HT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,HT),L(f(ka,L(n,f(s.html,MT,e)),i),Iu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,AT)?_I(c):$I(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 R(e,HT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,HT),L(f(ka,f(o.html,MT,e),n),Iu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,AT)?_I(u):$I(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children)),MT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children)),MT))}),xI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),PI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(BT,a|r,n)}var i=e.a;return f(BT,r,i|n)}),DI=ZT(7),UI=ZT(36),OI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(BT,r|a,n|i)}),MI=ZT(6),FI=ZT(38),VI=ZT(30),KI=ZT(29),HI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),jI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),qI=function(e){return{$:"Transform",a:e}},GI=function(e){return{$:"ChildrenBehind",a:e}},zI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),YI=function(e){return{$:"ChildrenInFront",a:e}},WI=r(function(e,t){return f(jT,M([YT(function(){switch(e.$){case"Above":return f(Ri," ",M([RT.nearby,RT.single,RT.above]));case"Below":return f(Ri," ",M([RT.nearby,RT.single,RT.below]));case"OnRight":return f(Ri," ",M([RT.nearby,RT.single,RT.onRight]));case"OnLeft":return f(Ri," ",M([RT.nearby,RT.single,RT.onLeft]));case"InFront":return f(Ri," ",M([RT.nearby,RT.single,RT.inFront]));default:return f(Ri," ",M([RT.nearby,RT.single,RT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Tw("");case"Text":var e=t.a;return $I(e);case"Unstyled":return(0,t.a)(AT);default:return f(t.a.html,MT,AT)}}()]))}),JI=n(function(e,t,r){var n=f(WI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?GI(M([n])):YI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?GI(f(ka,n,a)):f(zI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(zI,M([n]),i):YI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(zI,f(ka,n,a),i):f(zI,a,f(ka,n,i))}}),QI=r(function(e,t){switch(t.$){case"Generic":return TT(e);case"NodeName":var r=t.a;return f(HI,r,e);default:var n=t.a,a=t.b;return f(HI,n,a)}}),XI=function(e){switch(e.$){case"Left":return RT.alignedHorizontally+" "+RT.alignLeft;case"Right":return RT.alignedHorizontally+" "+RT.alignRight;default:return RT.alignedHorizontally+" "+RT.alignCenterX}},ZI=function(e){switch(e.$){case"Top":return RT.alignedVertically+" "+RT.alignTop;case"Bottom":return RT.alignedVertically+" "+RT.alignBottom;default:return RT.alignedVertically+" "+RT.alignCenterY}},eA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),tA=function(e){return{$:"Moved",a:e}},rA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return tA(x(r,0,0));case"MoveY":var n=t.a;return tA(x(0,n,0));case"MoveZ":var a=t.a;return tA(x(0,0,a));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(eA,x(0,0,0),i,x(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 tA(x(s,n,a));case"MoveY":var c=t.a;return tA(x(r,c,a));case"MoveZ":var f=t.a;return tA(x(r,n,f));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,u,x(1,1,1),i,o);default:var l=t.a;return d(eA,u,l,x(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(eA,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(eA,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(eA,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(eA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(eA,u,h,v,y);default:var m=t.a;return d(eA,u,m,p,o)}}}),nA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(kT,n,M([l(jI,n,"height",r+"px")]));case"Content":return x(f(PI,UI,kT),RT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(PI,iw,kT),RT.heightFill,yr):x(f(PI,iw,kT),RT.heightFillPortion+" height-fill-"+Ni(a),M([l(jI,RT.any+"."+RT.row+" > "+Ew("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(jI,u,"min-height",Ni(i)+"px"),c=nA(o),d=c.a,h=c.b,p=c.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(jI,u,"max-height",Ni(g)+"px"),v=nA(o),d=v.a,h=v.b,p=v.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p))}},aA=function(e){switch(e.$){case"Px":var t=e.a;return x(kT,RT.widthExact+" width-px-"+Ni(t),M([l(jI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(PI,FI,kT),RT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(PI,sw,kT),RT.widthFill,yr):x(f(PI,sw,kT),RT.widthFillPortion+" width-fill-"+Ni(r),M([l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(jI,i,"min-width",Ni(n)+"px"),u=aA(a),s=u.a,c=u.b,d=u.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(jI,i,"max-width",Ni(h)+"px"),p=aA(a),s=p.a,c=p.b,d=p.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d))}},iA=ZT(27),oA=r(function(e,t){if(R(e,iA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),uA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=hw(n);if("Nothing"===s.$)return{attributes:f(ka,YT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,YT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,qI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(oA,S,I)){var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(PI,S,r),y=f(rA,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(ow,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=RT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(PI,MI,r),y=n,m=f(ka,l(jI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+RT.widthContent,g=t,v=f(PI,FI,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+RT.widthFill,g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=aA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(ow,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(PI,DI,r),y=n,m=f(ka,l(jI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=RT.heightContent+" "+e,g=t,v=f(PI,UI,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=RT.heightFill+" "+e,g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.column+" > "+Ew("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=nA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(QI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(QI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(QI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(QI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(QI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(QI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(QI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return TT("p");case"NodeName":var e=t.a;return TT(e);default:var r=t.a,n=t.b;return f(HI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(JI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(ow,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=XI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(PI,rw,e);case"Right":return f(PI,tw,e);default:return e}}(f(PI,VI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(ow,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=ZI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(PI,nw,e);case"Bottom":return f(PI,ew,e);default:return e}}(f(PI,KI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),sA={$:"Untransformed"},cA=sA,fA=a(function(e,t,r,n){return l(LI,e,n,v(uA,UT(e),t,kT,cA,yr,yr,NT,$a(r)))}),lA=function(e){return ST(YT(e))},dA=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ST(gT("_blank")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e)))))),wT(M([n])))}),hA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),pA=n(function(e,t,r){return d(hA,e,t,r,1)}),gA=ZT(14),vA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),yA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),mA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return dw(t)+"-"+dw(r)+"-"+dw(n)+"-"+dw(a)},bA=function(e){return f(yA,gA,l(vA,"fc-"+mA(e),"color",e))},CA={align:ul,label:"cantConnectNoWeb3",mainParagraphs:M([M([fl("You need a web3 provider (such as "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(") to Connect.")]),M([fl("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:xg},EA={align:ul,label:"invalidUrl",mainParagraphs:M([M([fl("I don't understand that URL...")]),M([fl("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:$g},SA=function(e){return{$:"Active",a:e}},TA=gu(f(zo,jf,f(zo,Hh,$d("Error decoding hex to BigInt")))),wA=function(){return gu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),IA=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}}}}}}}}}}}},AA=function(e){return QE(M([f(Oi,si,e),Fi(ci)]))},BA=f(dh,AA(f(Oh,"status",wA)),f(dh,AA(f(Oh,"root",pu)),l(tS,"logsBloom",pu,l(tS,"logs",xm(dS),f(dh,AA(f(Oh,"contractAddress",rS)),l(tS,"cumulativeGasUsed",TA,l(tS,"gasUsed",TA,l(tS,"blockNumber",Gy,l(tS,"blockHash",oS,l(tS,"transactionIndex",Gy,l(tS,"transactionHash",cS,Fi(IA)))))))))))),kA=function(e){var t=e.a;return jf(t)},NA=f(zo,kA,hl),RA=r(function(e,t){return Up({decoder:BA,method:"eth_getTransactionReceipt",params:M([NA(t)]),url:e})}),$A=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),_A=r(function(e,t){return{$:"TxMined",a:e,b:t}}),LA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),xA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(Io,function(e){return e.b},f(Io,function(e){return e.onMinedTagger},f(fp,t,e))))}),PA=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}}}}}}}}}}}},DA=function(e){return QE(M([JE(ci),f(Oi,si,e)]))},UA=l(tS,"input",pu,l(tS,"gas",Gy,l(tS,"gasPrice",TA,l(tS,"value",TA,l(tS,"to",DA(rS),l(tS,"from",rS,l(tS,"transactionIndex",Gy,l(tS,"blockNumber",DA(Gy),l(tS,"blockHash",function(e){return f(du,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},cu(t))?Fi(ci):f(Oi,si,e)},pu)}(oS),l(tS,"nonce",Gy,l(tS,"hash",cS,Fi(PA)))))))))))),OA=r(function(e,t){return Up({decoder:UA,method:"eth_getTransactionByHash",params:M([NA(t)]),url:e})}),MA=r(function(e,t){return{attempts:e,sleep:t}}),FA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Xp,function(e){return a>0?f(Kp,function(e){return f(FA,f(MA,a,n),t)},YE(1e3*n)):Lp(e)},t)}),VA=r(function(e,t){return f(Kp,function(r){return f(FA,{attempts:30,sleep:1},f(OA,e,t))},YE(250))}),KA=r(function(e,t){return f(FA,{attempts:60,sleep:5},f(RA,e,t))}),HA=function(e){return{$:"Mined",a:e}},jA=function(e){return Bo(function(t){return D(t,{status:HA(e)})})},qA=function(e){return{$:"Sent",a:e}},GA=function(e){return Bo(function(t){return D(t,{status:qA(e)})})},zA=function(e){return{$:"Signed",a:e}},YA=function(e){return Bo(function(t){return D(t,{status:zA(e)})})},WA=function(e){return"Nothing"!==e.$},JA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Tl(r),Do);case"TxSigned":var n=e.a,a=e.b,i=f(fp,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(Yg,t,xp(a))}return Do}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Do;if("Just"===t.b.$){var r=t.b.a;return f(Yg,r,xp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Yg,a,xp(fi(e)))}t.a,t.b,t.c;return Do};if("Ok"===a.$){var c=a.a,d=WA(o.onBroadcastTagger)||WA(o.onMinedTagger)?f(il,r.tagger,f(Zp,LA(n),f(VA,r.nodePath,c))):Do;return L(Tl(D(r,{txs:l(bp,n,YA(c),r.txs)})),Po(M([u,d])))}var h=a.a;return L(Tl(r),Po(M([u,s(h)])))}return L(Tl(r),Do);case"TxSent":var n=e.a,p=e.b,g=f(fp,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(il,r.tagger,f(Zp,_A(n),f(KA,r.nodePath,v.hash))):Do}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Yg,t,xp(li(v)))}return Do}();return L(Tl(D(r,{txs:l(bp,n,GA(v),r.txs)})),Po(M([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(Yg,t,xp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Yg,n,xp(fi("Error with TxSent stuff")))}e.a,e.b;return Do}();return L(Tl(r),s)}return L(Tl(r),Do);case"TxMined":var n=e.a,m=e.b,b=f(fp,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Yg,a,xp(li(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 Po(M([f(il,r.tagger,f(Zp,f($A,n,s),zy(r.nodePath))),f(Yg,a,xp(li(C))),f(Yg,u.toMsg,xp(s))]))}return Do}();return L(Tl(D(r,{txs:l(bp,n,jA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Yg,r,xp(fi("TxReceipt decoding failure")))}return Do}();return L(Tl(r),S)}return L(Tl(r),Do);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(xA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Tl(r),f(Yg,B,f(Xp,function(e){return xp(D(I,{doneWatching:!0,reOrg:!0}))},f(Kp,function(e){return xp(D(I,{doneWatching:!0}))},f(RA,r.nodePath,T.txHash)))))}return L(Tl(r),Do)}if(R(w,T.lastCheckedBlock))return L(Tl(r),f(il,r.tagger,f(Zp,f($A,n,T),f(Kp,function(e){return zy(r.nodePath)},YE(2e3)))));var k=f(xA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Tl(r),Po(M([f(il,r.tagger,f(Zp,f($A,n,I),f(Kp,function(e){return zy(r.nodePath)},YE(2e3)))),f(Yg,B,xp(I))])))}return L(Tl(r),Do)}var n=e.a,h=e.c.a;return L(Tl(r),Do);default:var h=e.a;return L(Tl(r),Do)}}),QA=Jt,XA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),ZA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),eB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(ZA,"#",e.fragment,l(ZA,"?",e.query,U(f(XA,e.port_,U(t,e.host)),e.path)))},tB=r(function(e,t){return e<0?ci:Ql(f(nd,e,t))}),rB=r(function(e,t){if(e<0)return t;var r=Bh(f(nd,e,t)),n=f(lc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),nB=n(function(e,t,r){if(e<0)return r;var n=f(nd,e,r),a=f(lc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),aB=r(function(e,t){return f(nB,e,ms(t))}),iB=r(function(e,t){Kv(t);switch(t.$){case"Home":return L(D(e,{submodel:sT}),Do);case"Create":var r=Xd(e.wallet),n=f(Ul,e.txSentry,f(Yo,Uy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(uB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),Po(M([f(il,Uy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(By,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(mm,e.wallet,r)}return l(vm,e.wallet,u,s)}(),c=f(Ul,e.txSentry,f(Yo,Fy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(uB,U(f(Qi,Fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:My(r.model),txSentry:a}),Po(M([f(il,Fy,r.cmd),i]))));case"Marketplace":var d=Bv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Oy(h)}),Po(M([f(il,fT,p)])));case"AgentHistory":var g=t.a,v=f(Uo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:Py(y)}),Po(M([f(il,oT,m)])));default:return L(f(uo,EA,e),Do)}}),oB=r(function(e,t){var r=t.a,n=t.b,a=f(sB,uT(e),r),i=a.a,o=a.b;return L(i,Po(M([n,o])))}),uB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,oB,L(r,n),e)}),sB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(sB,cT,t);case"GotoRoute":var n=r.a;return L(t,f(Cy,t.key,n));case"GTag":var a=r.a;return L(t,wy(Sy(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),wy(Sy(d(Ol,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Uv,ky,o,u,s));default:return L(t,Ny(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(rB,c,t.userNotices)}),Do);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(by,t.key,eB(e))}var r=h.a;return QA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(cB,g,t);case"GotoRoute":var v=e.a;return L(t,Po(M([wy(Sy(d(Ol,"GotoRoute","navigation",Kv(v),0))),f(Cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Do);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,CA,t),Do):L(t,Ey(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Do;var t=e.a;return Iy(f(Ty,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Gh,pu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=SA(l(Ml,I,w,S)),B=f(Vy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ll,"Unexpected wallet state encounted when setting commPubkey!",ci),t),Do)}T.a;return L(f(uo,f(ll,"User pubkey set, but I can no longer find the user address!",ci),t),Do)}var N=E.a;return L(l(Pa,uo,f(ll,"error decoding commPubkey from JS",N),t),Do);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(lv,R,_),P=f(Ul,t.txSentry,f(Yo,Uy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(uB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),Po(M([f(il,Uy,x.cmd),F]))))}return L(t,Do);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(BS,K,j),q=f(Ul,t.txSentry,f(Yo,Fy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(uB,U(f(Qi,Fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:My(x.model),txSentry:O}),Po(M([f(il,Fy,x.cmd),F]))))}return L(t,Do);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Dv,G,Y);return f(uB,f(Qi,fT,x.appCmds),L(D(t,{submodel:Oy(x.model)}),f(il,fT,x.cmd)))}return L(t,Do);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(ol,W,Q),X=f(Ul,t.txSentry,f(Yo,oT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(uB,U(f(Qi,oT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Py(x.model),txSentry:O}),Po(M([f(il,oT,x.cmd),F]))))}return L(t,Do);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(_u,si,f(JA,Z,r))}return L(ci,Do)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(tB,re,t.tradeCaches);if("Nothing"===ae.$)return f(oB,pa(f(ll,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Do));var ie=ae.a,x=f(iT,ne,ie);return L(D(t,{tradeCaches:l(aB,re,x.tradeCache,t.tradeCaches)}),f(il,lT(re),x.cmd));case"NoOp":return L(t,Do);default:var N=e.a;f(cl,"test",N);return L(t,Do)}}),cB=r(function(e,t){return f(iB,t,my(e))}),fB=Ge("txIn",XE),lB=je("txOut",Ua),dB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},hB=function(e){return{$:"EventSentryMsg",a:e}},pB=function(e){var t=f(cm,hB,Xh(e)),r=t.a,n=t.b;return x({dataFetchState:l(QS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Zd,"tradeCache init","processing",dB(e),0)]))},gB=function(e){return{$:"InitialNumTradesFetched",a:e}},vB=function(e){return f(LS,e.factory,gB)},yB=function(e){var t=pB(e),r=t.a,n=t.b,a=t.c;return x(r,Po(M([n,vB(r)])),a)},mB=function(e){return{$:"TxSentryMsg",a:e}},bB={align:ul,label:"noWeb3Provider",mainParagraphs:M([M([fl("No web3 provider detected. Is "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(" or some other web3 provider installed and unlocked?")])]),noticeType:xg},CB={$:"TopLeft"},EB={align:CB,label:"screenToSmall",mainParagraphs:M([M([fl("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:xg},SB={align:ul,label:"wrongWeb3Network",mainParagraphs:M([M([fl("Make sure your wallet is set to a compatible network.")]),M([fl(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:$g},TB={$:"NoneDetected"},wB=function(e){return{$:"OnlyNetwork",a:e}},IB=function(e){return f(Bo,Xh,Mg(e))},AB={$:"ETCMain"},BB={$:"ETCTest"},kB={$:"Expanse"},NB={$:"Kovan"},RB={$:"Mainnet"},$B=function(e){return{$:"Private",a:e}},_B={$:"Rinkeby"},LB={$:"Ropsten"},xB={$:"RskMain"},PB={$:"RskTest"},DB=function(e){switch(e){case 1:return RB;case 2:return kB;case 3:return LB;case 4:return _B;case 30:return xB;case 31:return PB;case 42:return NB;case 41:return AB;case 62:return BB;default:return $B(e)}},UB=n(function(e,t,r){var n=e.a,a=e.b;return Tl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:cp})}),OB=n(function(e,t,n){var a=e.networkId?wB(DB(e.networkId)):TB,i=f(Bo,function(e){return l(UB,L(lB,fB),mB,e)},IB(a)),o=e.width<1024?si(EB):ci,u=f(xa,yB,ro),s=function(){return R(a,TB)?si(bB):"Nothing"===Mg(a).$?si(SB):ci}(),c=qC(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ay(f(Bi,r(function(e,t){return f(Qi,lT(e),t)}),g)),y=Po(f(Bi,r(function(e,t){return f(il,lT(e),t)}),p)),m=f(uB,v,f(cB,t,{key:n,screenWidth:e.width,submodel:sT,time:Vl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),Po(M([y,C])))}),MB=Oe,FB=MB(yr),VB=function(e){return FB},KB=function(e){return{$:"Refresh",a:e}},HB=r(function(e,t){return{$:"Every",a:e,b:t}}),jB=r(function(e,t){return{processes:t,taggers:e}}),qB=xp(f(jB,cp,cp)),GB=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(bS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),zB=Ne,YB=r(function(e,t){var r=e.a,n=e.b,a=f(fp,r,t);if("Nothing"===a.$)return l(xl,r,M([n]),t);var i=a.a;return l(xl,r,f(ka,n,i),t)}),WB=Be,JB=r(function(e,t){return{$:"Zone",a:e,b:t}}),QB=ca,XB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=WB(f(QB,n,f(Sp,e,n)));return f(Kp,function(t){return l(XB,e,a,l(xl,n,t,r))},i)}return xp(r)}),ZB=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 x(n,a,f(Kp,function(e){return i},zB(t)))}),u=l(Ra,YB,cp,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(xl,e,r,i),o)}),d=p(GB,s,c,o,u,i,x(yr,cp,xp(gr))),h=d.a,g=d.b,v=d.c;return f(Kp,function(e){return xp(f(jB,u,e))},f(Kp,function(t){return l(XB,e,h,g)},v))}),ek=function(e){return we(function(t){t(Se(e(Date.now())))})}(Vl),tk=n(function(e,t,r){var n=f(fp,t,r.taggers);if("Nothing"===n.$)return xp(r);var a=n.a,i=function(t){return Gp(f(xa,function(r){return f(Ep,e,r(t))},a))};return f(Kp,function(e){return xp(r)},f(Kp,i,ek))}),rk=r(function(e,t){var r=t.a,n=t.b;return f(HB,r,f(Da,e,n))});pn.Time=Pe(qB,ZB,tk,0,rk);var nk=Ue("Time"),ak=r(function(e,t){return nk(f(HB,e,t))}),ik=function(e){return f(ak,2e3,KB)},ok=function(e){return FB},uk=function(e){return{$:"DecryptionFinished",a:e}},sk=Ge("decryptionFinished",XE),ck=Ge("encryptionFinished",XE),fk=function(e){return{$:"EncryptionFinished",a:e}},lk=function(e){return{$:"Refresh",a:e}},dk=function(e){return MB(M([f(ak,3e3,lk),ck(fk),sk(function(e){return yE(uk(e))})]))},hk=yn,pk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return FB;case"CreateModel":t.a;return f(hk,Uy,ik());case"TradeModel":t.a;return f(hk,Fy,dk());case"MarketplaceModel":t.a;return f(hk,fT,ok());default:t.a;return f(hk,oT,VB())}},gk=Ge("userPubkeyResult",XE),vk=Ge("walletSentryPort",XE),yk={$:"CheckForNewTrades"},mk={$:"UpdateTradePhases"},bk=function(e){return MB(M([f(ak,5e3,function(e){return yk}),f(ak,3e3,function(e){return mk})]))},Ck=function(e){return{$:"Tick",a:e}},Ek=function(e){return{$:"UserPubkeySet",a:e}},Sk=function(e){return{$:"WalletStatus",a:e}},Tk=function(e){return f(ll,"Error decoding JS walletSentry: "+e,ci)},wk=function(e){return{$:"ErrorDecoding",a:e}},Ik=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Ak=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Oh,"ref",zC),f(Oh,"txHash",AA(cS))),Bk=function(e){var t=f(Gh,Ak,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Ik,r.ref,li(a))}return f(Ik,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return wk("Error decoding tx data")},kk=function(e){var t=e.a;return f(hk,t.tagger,t.inPort(Bk))},Nk=f(Oi,DB,zC),Rk=gu(f(zo,rd,f(zo,$d("Failure decoding stringy int"),au(DB)))),$k=QE(M([Rk,Nk])),_k=r(function(e,t){return{account:e,networkId:t}}),Lk=l(Mi,_k,f(Oh,"account",AA(rS)),f(Oh,"networkId",$k)),xk=n(function(e,t,r){var n=f(Gh,Lk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),Pk=function(e){var t=f(zo,Tk,f(zo,pa,uT));return MB(U(M([f(ak,1e3,Ck),vk(f(xk,t,Sk)),f(xc,FB,f(Bo,kk,e.txSentry)),gk(Ek),MB(f(Bi,r(function(e,t){return f(hk,lT(e),t)}),f(xa,bk,e.tradeCaches)))]),M([pk(e)])))},Dk=function(e){return{$:"LinkClicked",a:e}},Uk=function(e){return{$:"UrlChanged",a:e}},Ok=n(function(e,t,r){return d(hA,e/255,t/255,r/255,1)}),Mk=l(Ok,10,33,108),Fk={$:"Generic"},Vk=Fk,Kk=r(function(e,t){return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),e)),wT(M([t])))}),Hk=function(e){return{$:"Fill",a:e}},jk=Hk(1),qk=Hi,Gk=function(e){return{$:"Px",a:e}},zk=Gk,Yk=ZT(8),Wk=function(e){return f(yA,Yk,l(vA,"bg-"+mA(e),"background-color",e))},Jk=f(Kk,M([ET(jk),yT(zk(150)),Wk(Mk)]),qk),Qk=function(e){return{$:"GotoRoute",a:e}},Xk={$:"Active"},Zk={$:"Important"},eN={$:"Normal"},tN=l(pA,1,1,1),rN=ZT(2),nN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),aN=r(function(e,t){return R(e,t)?f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e)):f(yA,rN,h(nN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),iN=ZT(21),oN=r(function(e,t){return{$:"Class",a:e,b:t}}),uN=f(oN,iN,RT.cursorPointer),sN=ZT(17),cN=function(e){return f(yA,sN,l(jI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},fN=function(e){return{$:"Normal",a:e}},lN=An,dN=r(function(e,t){return f(lN,e,fN(t))}),hN=function(e){return f(dN,"click",Fi(e))},pN=f(Da,ST,hN),gN=ZT(13),vN=f(oN,gN,RT.textSemiBold),yN=ZT(4),mN=function(e){return{$:"FontSize",a:e}},bN=function(e){return f(yA,yN,mN(e))},CN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([cN(4),Wk(l(pA,0,0,1))]);default:return M([cN(4),Wk(l(pA,.9,0,0))])}}();return f(Kk,U(M([f(aN,23,12),bN(22),vN,bA(tN),uN,pN(t)]),n),fl(e))}),EN=l(Ok,244,0,103),SN=function(e){return{$:"AlignX",a:e}},TN={$:"CenterX"},wN=SN(TN),IN=ZT(3),AN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),BN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),kN=function(e){return f(yA,IN,l(AN,f(BN,e,e),e,e))},NN=function(e){return{$:"Describe",a:e}},RN={$:"Paragraph"},$N=r(function(e,t){return d(fA,HT,Vk,f(ka,NN(RN),f(ka,ET(jk),f(ka,kN(5),e))),wT(t))}),_N=f(oN,gN,RT.bold),LN=f(Kk,M([bN(29),bA(tN),_N,wN,uN,pN(Qk(Gv))]),f($N,yr,M([fl("DAI"),f(Kk,M([bA(EN)]),fl("Hard"))]))),xN={$:"Right"},PN=SN(xN),DN={$:"AsColumn"},UN=DN,ON=r(function(e,t){return d(fA,UN,Vk,f(ka,lA(RT.contentTop+" "+RT.contentLeft),f(ka,yT(bT),f(ka,ET(bT),e))),wT(t))}),MN={$:"AsRow"},FN=MN,VN=r(function(e,t){return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY),f(ka,ET(bT),f(ka,yT(bT),e))),wT(t))}),KN=function(e){return f(VN,M([ET(jk),kN(30),f(aN,30,17)]),M([l(CN,"Browse Offers",Qk(zv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Xk}return eN}()),l(CN,"Create a New Offer",Qk(qv),function(){return"CreateModel"===e.submodel.$?Xk:eN}()),function(){var t=Gd(e.wallet);if("Just"===t.$){var r=t.a;return l(CN,"My Trades",Qk(jv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Xk:eN}return eN}())}return l(CN,"Connect to Wallet",cT,Zk)}(),f(ON,M([PN,kN(0),f(aN,8,0)]),M([LN]))]))},HN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},jN=function(e){return ml(e)},qN=function(e){return f(ml,function(e){return gb(e.parameters)},OS(e))},GN={$:"BurnWindow"},zN={$:"FiatPrice"},YN={$:"Margin"},WN={$:"Offer"},JN={$:"PaymentWindow"},QN=function(e){return{$:"AlignY",a:e}},XN={$:"CenterY"},ZN=QN(XN),eR=ZT(20),tR=f(oN,eR,RT.clip),rR=Hk,nR=function(e){return f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e))},aR=r(function(e,t){return f(Kk,M([ET(rR(e)),yT(zk(60)),tR,Wk(tN)]),f(Kk,M([nR(12),ZN,ET(jk)]),t))}),iR=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},oR=function(e){return{$:"JustImage",a:e}},uR=oR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),sR=dT("alt"),cR=function(e){return f(dT,"src",rt(e))},fR=r(function(e,t){var r=t.src,n=t.description,a=f(ml,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(fA,AT,Vk,f(ka,lA(RT.imageContainer),e),wT(M([d(fA,AT,TT("img"),U(M([ST(cR(r)),ST(sR(n))]),a),wT(yr))])))}),lR=r(function(e,t){if("None"===t.$)return qk;var r=t.a;return f(fR,e,r)}),dR=oR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),hR=function(e){return{$:"ChangeSort",a:e}},pR=f(oN,gN,RT.textMedium),gR=function(e){return f(Kk,M([pR,bN(17)]),fl(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},vR=r(function(e,t){return f(VN,M([kN(5),uN,pN(hR(e))]),M([gR(e),function(){if("Just"===t.$){var e=t.a;return f(Kk,M([ZN]),f(lR,M([ET(zk(8))]),function(){return"Ascending"===e.$?uR:dR}()))}return qk}()]))}),yR=r(function(e,t){return f(aR,iR(t),f(vR,t,e))}),mR=r(function(e,t){return f(VN,M([ET(jk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(yR,r,t)},t))}),bR=l(Ok,150,150,150),CR=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},ER=r(function(e,t){return f(ts,e.amount,t.amount)}),SR=n(function(e,t,r){return f(e,r,t)}),TR=function(e){var t=e.a;return(R(e.b,Lo)?Ua:SR)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(TR,L(Av,Zf),e,t):f(Ku,CR(e.state.phase),CR(t.state.phase))});case"Expires":return r(function(e,t){return f(hv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Sv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(ER,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(xc,ma,l(zd,r(function(e,t){return f(Ku,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(hv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(hv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},wR=l(Ok,233,237,242),IR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),AR=function(e){return f(Kk,M([ET(jk),yT(jk),tR]),f($N,M([bN(12)]),M([fl(e.info)])))},BR=function(e){return f(xc,qk,f(Bo,AR,Ql(e)))},kR=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"}},NR=function(e){return{$:"TimeLeft",a:e}},RR=function(e){return{$:"TimeUp",a:e}},$R=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 Vl(0)}}),_R=r(function(e,t){return Vl(jd(e)-jd(t))}),LR=r(function(e,t){var r=f($R,t.state.phase,t),n=f(_R,e,t.state.phaseStartTime),a=f(_R,r,n);return jd(a)>0?NR(L(a,r)):RR(r)}),xR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},PR=l(pA,0,0,0),DR=l(Ok,51,183,2),UR=function(e){var t=ju(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Qo(n));return n+(function(){if(a){return f(ru,a+1,f(Zo,1,mw(r)))}return""}()+"%")},OR=r(function(e,t){return oR({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"}()})}),MR=n(function(e,t,r){return f(lR,f(ka,yT(zk(34)),e),f(OR,t,r))}),FR=r(function(e,t){var r=UR(t);if("0%"===r)return f(Kk,M([bN(16)]),fl("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?DR:EN;return f(VN,M([kN(4)]),M([l(MR,yr,a,si(i)),f(Kk,M([bA(o),bN(16)]),fl(n))]))}),VR=oR,KR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(xl,r,n,t)}),cp,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,VR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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","₫")]))),HR=function(e){return f(xc,"",f(Bo,Qa,f(fp,e,KR)))},jR=function(e){return Qo(e)<=3?e:jR(f(Td,3,e))+","+f(ou,3,e)},qR=function(e){return jR(Sd(e))},GR=function(e){return U(HR(e.fiatType),qR(e.amount))},zR=hA,YR=function(e){var t=function(){var t=f(fp,e.fiatType,KR);if("Nothing"===t.$)return qk;var r=t.a,n=(r.a,r.b);return f(lR,M([yT(zk(26))]),n)}();return f(VN,M([kN(4)]),M([t,f(Kk,M([bA(d(zR,0,0,0,.5)),pR,ET(zk(50))]),fl(e.fiatType)),fl(GR(e))]))},WR=function(e){return jd(e)<0},JR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),QR=function(e){var t=vg(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(JR,aC(t),aC(r),aC(n),aC(a))}(f(xc,L(qu(0),qu(0)),f(Ts,n,qu(60))))}(f(xc,L(qu(0),qu(0)),f(Ts,r,qu(3600))))}(f(xc,L(qu(0),qu(0)),f(Ts,t,qu(86400))))},XR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!WR(a)){var u=r(function(e,t){return U(l(Rs,2,P("0"),Ni(e)),t)}),s=jd(a)>0?i:o,c=QR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(VN,U(M([kN(5)]),e),M([f(Kk,U(M([bA(h)]),t),fl(f(u,c.days,"d"))),f(Kk,U(M([bA(d)]),t),fl(f(u,c.hours,"h"))),f(Kk,U(M([bA(s)]),t),fl(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Vl(0);e=p,t=g,n=v,a=y}}),ZR={$:"Behind"},e$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),t$=function(e){return f(e$,ZR,e)},r$=r(function(e,t){var r=sv(200*e),n=200-r,a=f(Kk,M([ET(rR(n))]),qk),i=M([yT(zk(3)),cN(20)]),o=f(Kk,U(i,M([ET(rR(r)),Wk(t)])),qk),u=f(Kk,U(i,M([ET(jk),Wk(wR)])),qk);return f(VN,M([ET(jk),t$(u)]),M([o,a]))}),n$=l(pA,1,1,0),a$=r(function(e,t){return jd(e)/jd(t)}),i$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(a$,o,u),c=(f(Kk,M([wN]),d(XR,yr,yr,L(a,i),o)),s<.1?EN:s<.2?n$:DR);return f(ON,U(M([kN(5)]),e),M([d(XR,M([wN]),t,L(a,i),o),f(r$,1-s,c)]))}),o$=function(e){var t=wd(jl(e)),r=f(Xl,".",t);if(!r.b)return t;if(r.b.b){cl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(ru,3,t);case 1:return f(ru,4,f(xc,t,f(Bo,mw,f(Bo,function(e){return e/100},f(Bo,Ka,f(Bo,sv,f(Bo,ti(100),Bd(t))))))));default:var n=r.a;return f(xc,f(ru,n,t),f(Bo,Ni,f(Bo,sv,Bd(t))))}},u$=n(function(e,t,r){return f(aR,iR(t),function(){switch(t.$){case"Phase":var n=xR(r.state.phase),a=L(f(LR,e,r),r.state.phase);e:for(;;){if("TimeLeft"===a.a.$){if("Closed"===a.b.$)break e;var i=a.a.a,o=f(a$,i.a,i.b)<.05?EN:PR;return f(ON,M([kN(3)]),M([fl(n),d(i$,M([ET(jk)]),M([bN(16)]),L(o,wR),i)]))}if("Closed"===a.b.$)break e;var u=a.a.a;return f(VN,M([kN(6),bA(bR)]),M([fl(n),f(Kk,M([bN(16)]),fl("(stale)"))]))}a.b;return fl(n);case"Expires":if("Open"===r.state.phase.$){var s=f(LR,e,r);if("TimeLeft"===s.$){var i=s.a,o=f(a$,i.a,i.b)<.05?EN:PR;return d(i$,M([ET(jk)]),M([bN(16)]),L(o,wR),i)}var u=s.a;return d(i$,M([ET(jk)]),M([bN(16)]),L(EN,wR),L(Vl(0),u))}return qk;case"Offer":return f(VN,M([kN(5)]),M([fl(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(o$(r.parameters.tradeAmount)+" ")+kR(r.factory))]));case"FiatPrice":return YR(r.terms.price);case"Margin":var c=R(r.parameters.initiatorRole,fo);return f(xc,qk,f(Bo,FR(c),r.derived.margin));case"PaymentWindow":var l=function(){return"Seller"===r.parameters.initiatorRole.$?EN:DR}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:PR;return d(XR,yr,yr,L(h,wR),r.parameters.autoabortInterval);default:var l=function(){return"Seller"===r.parameters.initiatorRole.$?DR:EN}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:PR;return d(XR,yr,yr,L(h,wR),r.parameters.autoreleaseInterval)}}())}),s$=n(function(e,t,r){return f(ON,M([ET(jk),kN(1),Wk(wR),uN,pN(f(IR,r.factory,r.id))]),M([f(VN,M([ET(jk),kN(1)]),f(xa,function(t){return l(u$,e,t,r)},t)),f(aR,1,BR(r.terms.paymentMethods))]))}),c$=Er,f$=ZT(28),l$=function(e){return f(yA,f$,l(vA,"bc-"+mA(e),"border-color",e))},d$=i(function(e,t,r,n,a){return{$:"BorderWidth",a:e,b:t,c:r,d:n,e:a}}),h$=function(e){return f(yA,iA,h(d$,"b-"+Ni(e),e,e,e,e))},p$=a(function(e,t,r,n){return f(ON,M([ET(jk),h$(2),cN(8),l$(bR),kN(2),Wk(bR),tR]),f(xa,f(s$,e,r),f(c$,TR(t.orderBy),n)))}),g$=a(function(e,t,r,n){return f(ON,M([ET(jk),yT(jk),kN(5)]),M([f(mR,t.orderBy,r),d(p$,e,t,r,n)]))}),v$=n(function(e,t,r){var n=ay(f(xa,function(e){return f(jN,HN(r),qN(e))},t));return R(n,yr)?qk:f(Yi,Ko,d(g$,e,r.tradeTable,M([xo,WN,zN,YN,JN,GN]),n))}),y$=r(function(e,t){return f(Kk,M([cN(4),Wk(d(zR,0,0,1,.1)),bA(l(Ok,16,7,234)),bN(e),vN,f(aN,15,13)]),fl(dl(t)))}),m$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),b$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(yA,rN,h(nN,"p-"+Ni(t),t,t,t,t)):f(yA,rN,h(nN,d(m$,t,r,n,a),t,r,n,a))},C$=function(e){return function(){var t=Gd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?qk:f(VN,M([kN(10),b$({bottom:20,left:20,right:20,top:10})]),M([f(Kk,M([bN(24),vN]),fl("Trade History for User")),f(y$,18,e.agentAddress)]))},E$=function(e){return{$:"FiltersMsg",a:e}},S$=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},T$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),w$=xI,I$={$:"Left"},A$=SN(I$),B$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(fA,UN,TT("label"),e,wT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(fA,AT,Vk,a,wT(M([i])));switch(n.$){case"Above":return d(fA,UN,TT("label"),e,wT(M([o,r])));case"Below":return d(fA,UN,TT("label"),e,wT(M([r,o])));case"OnRight":return d(fA,FN,TT("label"),e,wT(M([r,o])));default:return d(fA,FN,TT("label"),e,wT(M([o,r])))}}),k$=function(e){return{$:"Label",a:e}},N$={$:"NoAttribute"},R$=function(e){if("HiddenLabel"===e.$){var t=e.a;return NN(k$(t))}return N$},$$=function(e){return"HiddenLabel"===e.$},_$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return hu("No key matched");var n=r.a;return Fi(n)},r=f(du,t,f(Oh,"key",pu));return ST(f(dN,"keyup",r))},L$=function(e){return f(Nn,"tabIndex",Ni(e))},x$=f(Da,ST,L$),P$={$:"LivePolite"},D$=NN(P$),U$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([$$(r)?N$:kN(6),ST(hN(i(!a))),D$,_$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),x$(0),uN,A$,ET(jk)]),e);return l(B$,o,r,d(fA,AT,Vk,M([ST(f(w$,"role","checkbox")),ST(f(w$,"aria-checked",a?"true":"false")),R$(r),ZN,yT(jk),ET(bT)]),wT(M([n(a)]))))}),O$=Br,M$=function(e){return e*O$/180},F$=ZT(26),V$=function(e){return{$:"MoveY",a:e}},K$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),H$=function(e){return f(K$,F$,V$(-e))},j$=ZT(24),q$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),G$=function(e){return f(K$,j$,f(q$,x(0,0,1),e))},z$=ZT(19),Y$=function(e){return Cd(M([e.inset?"box-inset":"box-",mw(e.offset.a)+"px",mw(e.offset.b)+"px",mw(e.blur)+"px",mw(e.size)+"px",mA(e.color)]))},W$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(yA,z$,l(jI,Y$(t),"box-shadow",Cw(t)))},J$=r(function(e,t){return f(yA,iA,h(d$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Q$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?h$(r):f(J$,n,r):f(yA,iA,h(d$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},X$=ZT(12),Z$=f(oN,X$,RT.textCenter),e_=l(pA,1,1,1),t_=function(e){return f(Kk,M([lA("focusable"),ET(zk(14)),yT(zk(14)),bA(e_),ZN,bN(9),Z$,cN(3),l$(e?l(pA,59/255,.6,252/255):l(pA,211/255,211/255,211/255)),W$({blur:1,color:e?d(zR,238/255,238/255,238/255,0):l(pA,238/255,238/255,238/255),offset:L(0,0),size:1}),Wk(e?l(pA,59/255,.6,252/255):e_),h$(e?0:1)]),e?f(Kk,M([l$(e_),yT(zk(6)),ET(zk(9)),G$(M$(-45)),wN,ZN,H$(1),Q$({bottom:2,left:2,right:0,top:0})]),qk):qk)},r_=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),n_={$:"OnRight"},a_=r_(n_),i_=r(function(e,t){return f(U$,yr,{checked:t.checked,icon:t_,label:f(a_,yr,fl(t.label)),onChange:f(T$,e,t.label)})}),o_={$:"Top"},u_=QN(o_),s_=function(e){return f(ON,M([kN(15),u_]),M([f(Kk,M([bN(28),pR]),fl(S$(e.type_))),f(ON,M([kN(5)]),f(xa,i_(e.type_),e.options))]))},c_=function(e){return f(VN,M([kN(20)]),f(xa,s_,e))},f_={$:"NoneFound"},l_={$:"AllFetched"},d_={$:"FetchingTrades"},h_={$:"QueryingNumTrades"},p_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return h_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?d_:l_}return f_},g_={$:"InFront"},v_=function(e){return f(e$,g_,e)},y_=r(function(e,t){var r=function(e){return f(Kk,M([bN(20),vN,bA(bR),wN]),fl(e))},n=f(Eh,Ja(f_),f(xa,p_,e))?M([r("No trades found.")]):f(xa,r,qC(f(xa,function(e){switch(p_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),v_(f(ON,M([kN(5),A$]),n))]),f(Kk,M([wN]),f(Yi,E$,c_(t.filters))))}),m_=n(function(e,t,r){return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),f(aN,30,20)]),M([C$(r),f(y_,t,r),l(v$,e,t,r)]))}),b_=function(e){return{$:"ShowCurrencyDropdown",a:e}},C_={$:"AbortCreate"},E_=function(e){return{$:"AppCmd",a:e}},S_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),T_=function(e){return f(xa,function(e){return M([f(Kk,M([bA(EN)]),fl("Caution! ")),fl(e)])},qC(M([R(f(hv,e.autoreleaseInterval,Vl(12e5)),ba)?si(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."}()):ci,R(f(hv,e.autoabortInterval,Vl(36e5)),ba)?si(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.'}()):ci])))},w_=l(pA,0,0,1),I_=function(e){return f(Kk,M([b$({bottom:5,left:5,right:5,top:0}),pN(e),cN(30),Wk(d(zR,1,1,1,.4)),h$(1),l$(d(zR,0,0,0,.3)),uN,bN(14)]),f(Kk,M([bA(d(zR,0,0,0,.7))]),fl("x")))},A_=Bn,B_=A_,k_=ST,N_=r(function(e,t){return f(Kk,M([t$(f(Kk,M([Wk(e),k_(f(B_,"position","fixed")),k_(f(B_,"z-index","1000")),k_(f(B_,"top","0")),k_(f(B_,"left","0")),k_(f(B_,"width","100%")),k_(f(B_,"height","100%"))]),qk)),ET(jk),yT(jk)]),t)}),R_=r(function(e,t){return{$:"Max",a:e,b:t}}),$_=r(function(e,t){return f(R_,e,t)}),__=n(function(e,t,r){return l(Pa,N_,d(zR,0,0,.3,.6),f(Kk,U(M([wN,ZN,ET(f($_,500,bT)),Wk(tN),cN(8),v_(f(Kk,M([PN,u_]),I_(r)))]),e),t))}),L_=r(function(e,t){if("Nothing"===t.$)return qk;var r=t.a;return f(Kk,U(M([cN(5),l$(l(pA,.9,0,0)),h$(1),Wk(l(pA,1,.4,.4)),nR(5),wN,ZN,ET(f($_,200,bT)),bN(14)]),e),f($N,yr,M([fl(r)])))}),x_={$:"Above"},P_=function(e){return f(e$,x_,e)},D_=r(function(e,t){return f(Kk,M([cN(4),f(aN,25,17),bN(18),vN,Wk(wR),P_(f(L_,M([H$(5)]),t))]),fl(e))}),U_=a(function(e,t,r,n){return d(hA,e/255,t/255,r/255,n)}),O_=d(U_,1,31,52,.64),M_=ZT(32),F_={$:"Active"},V_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),K_=$n,H_=r(function(e,t){switch(t.$){case"NoAttribute":return N$;case"Describe":var r=t.a;return NN(r);case"AlignX":var n=t.a;return SN(n);case"AlignY":var a=t.a;return QN(a);case"Width":var n=t.a;return CT(n);case"Height":var n=t.a;return vT(n);case"Class":var n=t.a,a=t.b;return f(oN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(yA,i,o);case"Nearby":var u=t.a,s=t.b;return f(e$,u,f(zi,e,s));case"Attr":var c=t.a;return ST(f(K_,e,c));default:var l=t.a,d=t.b;return f(K$,l,d)}}),j_=function(e){return f(H_,zg,e)},q_=r(function(e,t){var r=t.a,n=t.b,a=j_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(rA,n,o));default:return L(r,n)}}),G_=function(e){var t=l(Ra,q_,L(yr,sA),e),r=t.a,n=t.b;return f(ka,qI(n),r)},z_=function(e){return f(yA,M_,f(V_,F_,G_(e)))},Y_=ZT(33),W_={$:"Hover"},J_=function(e){return f(yA,Y_,f(V_,W_,G_(e)))},Q_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Kk,M([cN(4),uN,pN(n),f(aN,25,17),bA(t),bN(18),vN,Wk(a),z_(M([Wk(o)])),J_(M([Wk(i)]))]),fl(r))}),X_=r(function(e,t){return d(Q_,x(d(zR,1,0,0,1),d(zR,1,0,0,.8),d(zR,1,0,0,.6)),tN,e,t)}),Z_=function(e){return N_(d(zR,0,0,.3,.6))(f(ON,M([kN(10),wN,ZN,Wk(d(zR,0,0,0,.5)),cN(8),nR(20)]),f(xa,function(e){return f($N,M([wN,ZN,bN(20),vN,bA(tN),Z$]),M([e]))},e)))},eL=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+kA(t)}e.a;return"https://kovan.etherscan.io/tx/"+kA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+kA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+kA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+kA(t)}}),tL={$:"Bottom"},rL=QN(tL),nL=lA(RT.underline),aL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(fl(o$(Lb(a))),f(X_,"Yes, I definitely want to open this trade.",l(S_,r,n,a)))}return L(fl("??"),f(D_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(__,yr,f(ON,M([kN(20),nR(20),wN,yT(jk),Z$]),M([f(Kk,M([bN(26),vN,wN,ZN]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,ZN]),f(xa,$N(M([wN,bN(18),pR,bA(O_)])),U(T_(n),U(M([M([fl("You will deposit "),i,fl(" "+kR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([fl("This ususally requires two Metamask signatures. Your "+kR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Kk,M([rL,wN]),o)])),C_);case"ApproveNeedsSig":var u=e.a;return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),Z_(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","ApproveMining",0)))]),Z_(M([fl("Mining the initial approve transaction..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction on Etherscan"),url:f(eL,eo(u),s)}),fl("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),Z_(M([fl("Waiting for user signature for the create call."),fl("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Kk,M([pN(E_(d(Zd,"txChainModal clicked","misclick","CreateMining",0)))]),Z_(M([fl("Mining the final create call..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction on Etherscan"),url:f(eL,r,s)}),fl("You will be redirected when it's mined.")])))}}),iL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return qk;var r=t.a;return f(aL,r,e)},oL=function(e){return{$:"TradeAmountChanged",a:e}},uL=dT("id"),sL=k_(uL("inputError")),cL=l(Ok,109,127,138),fL=oR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),lL=function(e){return f(lR,f(ka,yT(zk(26)),e),fL)},dL=function(e){return f(VN,M([kN(4)]),M([lL(yr),f(Kk,M([bN(24),pR,bA(cL)]),fl(kR(e)))]))},hL=function(e){return{$:"HiddenLabel",a:e}},pL=hL,gL=dT("type"),vL=function(e){return L(e,!0)},yL=function(e){return{$:"MayStopPropagation",a:e}},mL=r(function(e,t){return f(lN,e,yL(t))}),bL=r(function(e,t){return l(La,Oh,t,e)}),CL=f(bL,M(["target","value"]),pu),EL=function(e){return f(mL,"input",f(Oi,vL,f(Oi,e,CL)))},SL=ZT(0),TL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),wL=function(e){var t=function(e){return 1-e}(f(Tc,1,f(ei,0,e)));return f(yA,SL,f(TL,"transparency-"+dw(t),t))},IL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),AL=f(Da,ST,w$("autocomplete")),BL=l(pA,136/255,138/255,133/255),kL=l(pA,186/255,189/255,182/255),NL=f(aN,12,12),RL=M([NL,cN(3),l$(kL),Wk(e_),h$(1),kN(3),ET(jk)]),$L=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},_L=function(e){return f(Ch,$L,e)?N$:lA("focusable")},LL=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},xL=ye,PL=r(function(e,t){return f(kn,e,xL(t))}),DL=PL("spellcheck"),UL=f(Da,ST,DL),OL=W,ML=ZT(47),FL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(OL(e))),o=(i-1)*t+f(xc,0,f(Bo,a,r))+f(xc,0,f(Bo,a,n));return f(yA,ML,l(jI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),VL=dT("value"),KL=f(Da,ST,VL),HL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(fw,"width",n)?L(r,n):L(f(ka,e,r),f(TS,"width",n));case"Height":e.a;return f(fw,"height",n)?L(r,n):L(f(ka,e,r),f(TS,"height",n));case"Describe":e.a;return f(fw,"described",n)?L(r,n):L(f(ka,e,r),f(TS,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(fw,"align-x",n)?L(r,n):L(f(ka,e,r),f(TS,"align-x",n));case"AlignY":return f(fw,"align-y",n)?L(r,n):L(f(ka,e,r),f(TS,"align-y",n));default:return f(fw,"transform",n)?L(r,n):L(f(ka,e,r),f(TS,"transform",n))}}),L(yr,sm),e).a},jL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,HL(e))}),qL=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}},GL=f(Da,Gi,ms),zL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([ST(EL(n.onChange))]),o=U(RL,t),u=f(jL,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(ml,LL,o),c=f(jL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(jL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(jL,o,function(e){return"Nearby"===e.$})),p=f(ml,f(Da,ns,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([KL(n.text),ST(gL(a)),UL(e.spellchecked),lA(RT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return N$;var r=t.a;return AL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(qL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(IL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(IL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(xc,5,c);return x("textarea",U(M([UL(e.spellchecked),lA(RT.inputMultiline),f(xc,N$,f(Bo,AL,e.autofill)),function(){if("Nothing"===u.$)return N$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return b$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?N$:s.a?d(FL,n.text,v,u,g):N$}()]),h),M([GL(RI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(fA,AT,Vk,f(ka,ET(jk),ay(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([v_(f(Kk,f(ka,NL,U(s,U(M([bA(BL),lA(RT.noTextSelection+" "+RT.passPointerEvents),l$(d(zR,0,0,0,0)),Wk(d(zR,0,0,0,0)),yT(jk),ET(jk),wL(""===n.text?1:0)]),r))),a))])}()]))),wT(M([d(fA,AT,TT(v),ay(M([M([_L(t),R$(n.label)]),y,i])),wT(m))])));return l(B$,f(ka,f(oN,iN,RT.cursorText),f(ka,$$(n.label)?N$:kN(5),f(ka,D$,u))),n.label,b)}),YL=zL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),WL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(YL,M([ET(jk),yT(zk(40)),h$(0)]),{label:pL(r),onChange:i,placeholder:n,text:a});return f(VN,U(M([kN(5)]),e),qC(M([f(Bo,Kk(M([A$])),o),si(s),f(Bo,Kk(M([PN])),u)])))}),JL={$:"Below"},QL=function(e){return f(e$,JL,e)},XL=function(e){return f(K$,F$,V$(e))},ZL=n(function(e,t,r){return p(WL,M([ET(zk(150)),pR,bN(24),QL(f(L_,M([sL,XL(5)]),r))]),L(ci,si(f(Kk,M([pN(E_(d(Zd,"click","misclick","dai symbol in dai input",0)))]),dL(e)))),"dai input",ci,t,oL)}),ex=Kk(M([l$(wR),Q$({bottom:2,left:0,right:0,top:0})])),tx=r(function(e,t){return f(ON,M([kN(10)]),M([f(Kk,M([bN(17),vN]),fl(e)),t]))}),rx=r(function(e,t){return ex(f(tx,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(ZL,e,t.inputs.daiAmount,t.errors.daiAmount)))}),nx=function(e){return f(xc,HE,Mg(e))},ax=function(e){var t=function(){var t=vd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+o$(f(Gl,r,100))+" "+kR(nx(e.wallet))+"."}return"There is a 1% fee."}();return f(VN,M([wN,f(aN,20,10),Wk(l(Ok,10,33,108)),cN(8),kN(5),pN(E_(d(Zd,"click","misclick","fee notify element",0)))]),M([f(Kk,M([bN(18),bA(l(Ok,0,226,255)),vN]),fl(t)),f(Kk,M([bN(17),bA(tN),pR]),fl("We only collect this fee when trades resolve successfully."))]))},ix=function(e){return{$:"FiatAmountChanged",a:e}},ox=function(e){return{$:"FiatTypeChanged",a:e}},ux=r(function(e,t){return l(bS,n(function(t,r,n){return f(e,t,r)?l(xl,t,r,n):n}),cp,t)}),sx=function(e){return f(ux,r(function(t,r){return f(Qg,e,t)}),KR)},cx=oR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),fx=function(e){return f(lR,M([yT(zk(26))]),f(xc,cx,f(Bo,fu,f(fp,e,KR))))},lx=function(e){return k_(f(mL,"click",Fi(L(e,!0))))},dx=GL,hx=function(e){return{$:"AppendProperty",a:e}},px=r(function(e,t){return hx(e+":"+t)}),gx=r(function(e,t){return f(px,e,t.value)}),vx=gx("cursor"),yx={$:"Compatible"},mx={cursor:yx,value:"default"},bx=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Cx=function(e){return{$:"PseudoClassSelector",a:e}},Ex=function(e){return bx(Cx(e))}("hover"),Sx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),Tx=Sx,wx=Tx,Ix=wx("span"),Ax=r(function(e,t){return f(kn,et(e),rt(t))}),Bx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),kx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),Nx=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),Rx=r(function(e,t){return t<>>32-e}),$x=function(e){var t=e.hash?e.seed^f(Nx,461845907,f(Rx,15,f(Nx,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(Nx,2246822507,r^r>>>16),a=f(Nx,3266489909,n^n>>>13);return(a^a>>>16)>>>0},_x=r(function(e,t){return f(Nx,5,f(Rx,13,e^f(Nx,461845907,f(Rx,15,f(Nx,3432918353,t)))))+3864292196}),Lx=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},VP=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+"]"}},KP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,VP,r)));case"UniversalSelectorSequence":var r=e.a;return Iu(r)?"*":f(Ri,"",f(xa,VP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,VP,r)))}},HP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([FP(t),KP(r)]))},jP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,KP(t),f(xa,HP,r)),i=f(Ri,"",M([f(xc,"",f(Bo,MP,n))]));return f(oc,f(Ri," ",f(ml,f(Da,ns,_d),a)),i)},qP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,jP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,OP(a),"\n",e,"}"]))}),GP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(qP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,_P,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,DP,qP(" ")),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"}},zP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(ml,f(Da,ns,_d),M([NP(t),f(Ri,"\n",f(xa,xP,r)),f(Ri,"\n",f(xa,PP,n)),f(Ri,"\n\n",f(xa,GP,a))])))},YP=function(e){return zP(kP(IP(e)))},WP=function(e){return f(Ri,"\n\n",f(xa,YP,e))},JP=function(e){return{$:"Snippet",a:e}},QP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),XP=function(e){return{$:"StyleBlockDeclaration",a:e}},ZP=r(function(e,t){var r=l(Xx,t,yr,ci);return JP(M([XP(l(QP,r,yr,e))]))}),eD=function(e){return Iu(e)?"unstyled":f(Is,P("_"),Ps(f(xx,15739,WP(AS(Px(AS(f(ZP,e,fP(yr)))))))))},tD=function(e){var t=eD(e),r=f(Ax,"className",hl(t));return l(Bx,r,e,t)},rD=a(function(e,t,r,n){return f(e,f(ka,tD(t),r),n)}),nD=function(e){return{$:"Unstyled",a:e}},aD=function(e){return nD(Tw(e))},iD=aD,oD=r(function(e,t){return f(Tn,e,Xe(t))}),uD=function(e){return En(Xe(e))},sD=r(function(e,t){var r=e.b,n=e.c;return Iu(r)?t:l(xl,n,r,t)}),cD=function(e){return e.a},fD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,sD,i,s),p=l(Ra,lD,L(yr,h),c),g=p.a,v=p.b,o=l(JT,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,sD,i,s),m=l(Ra,lD,L(yr,h),c),g=m.a,v=m.b,o=d(uD,y,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,sD,i,s),b=l(Ra,fD,L(yr,h),c),g=b.a,v=b.b,o=l(WT,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,sD,i,s),C=l(Ra,fD,L(yr,h),c),g=C.a,v=C.b,o=d(oD,y,u,f(xa,cD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),lD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,sD,n,o),c=l(Ra,lD,L(yr,s),u),h=c.a,p=c.b,a=l(JT,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,sD,n,o),v=l(Ra,lD,L(yr,s),u),h=v.a,p=v.b,a=d(uD,g,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,sD,n,o),y=l(Ra,fD,L(yr,s),u),h=y.a,p=y.b,a=l(WT,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,sD,n,o),m=l(Ra,fD,L(yr,s),u),h=m.a,p=m.b,a=d(oD,g,i,f(xa,cD,o),$a(h));return L(f(ka,a,r),p)}}),dD=r(function(e,t){return h(Nl,kl,e,t,Rl,Rl)}),hD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(_d(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),pD=function(e){var t=f(hD,ci,e);if("Nothing"===t.$)return cp;var r=t.a,n=r.a,a=r.b;return f(dD,n,a)},gD=function(e){return{$:"ClassSelector",a:e}},vD=function(e){var t=e.a,r=e.b;return f(ZP,r,fP(M([gD(t)])))},yD=function(e){return WP(AS(Px(f(xa,vD,Ia(e)))))},mD=function(e){return l(JT,"style",yr,AS(Tw(yD(e))))},bD=n(function(e,t,r){var n=f(xa,cD,t),a=pD(t),i=l(Ra,lD,L(yr,a),r),o=i.a,u=i.b,s=mD(u);return l(JT,e,n,f(ka,s,$a(o)))}),CD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),ED=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(CD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),SD=r(function(e,t){return L(f(ED,"_",t),mD(e))}),TD=n(function(e,t,r){var n=f(xa,cD,t),a=pD(t),i=l(Ra,fD,L(yr,a),r),o=i.a,u=i.b,s=f(SD,u,o);return l(WT,e,n,f(ka,s,$a(o)))}),wD=a(function(e,t,r,n){var a=f(xa,cD,r),i=pD(r),o=l(Ra,fD,L(yr,i),n),u=o.a,s=o.b,c=f(SD,s,u);return d(oD,e,t,a,f(ka,c,$a(u)))}),ID=a(function(e,t,r,n){var a=f(xa,cD,r),i=pD(r),o=l(Ra,lD,L(yr,i),n),u=o.a,s=o.b,c=mD(s);return d(uD,e,t,a,f(ka,c,$a(u)))}),AD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(bD,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(ID,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(TD,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(wD,a,t,r,n)}},BD=AD,kD=function(e){return dx(BD(d(rD,Ix,M([Ex(M([vx(mx)]))]),yr,M([iD(e)]))))},ND=J,RD=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),$D=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),_D=function(e){return l(La,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 si(h(RD,n,a,i,o,u))}return ci}(),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 si(l($D,a,t,i))}return ci}())}),L(ci,ci),e)},LD=r(function(e,t){var r=_D(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),e))),wT(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?si(b$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),U(e,M([h]))))),wT(t))}var p=-s/2,g=-u/2;return d(fA,AT,Vk,e,wT(M([d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ST(f(B_,"margin",mw(p)+"px "+mw(g)+"px")),f(ka,ST(f(B_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,ST(f(B_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(yA,IN,l(AN,o,u,s)),yr))))),wT(t))])))}),xD=i(function(e,t,r,n,a){var i=f(YL,M([ET(zk(80)),yT(zk(40)),bN(24),pR,l$(wR),lx(r)]),{label:pL("currency type"),onChange:f(zo,ND,n),placeholder:ci,text:t}),o=f(fp,t,KR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return qk;r.b;return f(LD,M([ET(zk(350)),l$(PR),h$(1),Wk(tN),nR(10),wN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(VN,M([ET(zk(80)),kN(9),f(aN,0,5),lx(n(t)),J_(M([Wk(l(pA,.8,.8,1))]))]),M([f(lR,M([yT(zk(26))]),a),f(Kk,M([bN(16),vN]),kD(t))]))},Ia(sx(t))))}return qk}();return f(VN,M([kN(4),QL(u)]),M([f(Kk,M([pN(a)]),fx(t)),i]))}),PD=i(function(e,t,r,n,a){var i=E_(d(Zd,"click","misclick","currency flag",0)),o=f(Kk,M([pN(E_(d(Zd,"click","misclick","currency symbol",0)))]),fl(HR(e))),u=f(Kk,M([QL(f(L_,M([sL,XL(5)]),a))]),h(xD,r,e,b_(!0),ox,i));return p(WL,M([ET(zk(250)),pR,bN(24),QL(f(L_,M([sL,XL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,ix)}),DD=function(e){return ex(f(tx,"For fiat",h(PD,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},UD=function(e){return{$:"ChangeRole",a:e}},OD=d(U_,1,31,52,.13),MD=r(function(e,t){var r=M([bN(24),pR,uN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([bA(OD)]))):L(U(r,M([bA(OD)])),r)}(),a=n.a,i=n.b;return f(VN,M([kN(20)]),M([f(Kk,U(M([pN(UD(lo))]),i),fl("Sell "+e)),f(Kk,U(M([pN(UD(fo))]),a),fl("Buy "+e))]))}),FD=r(function(e,t){return f(tx,"Trade Type",f(MD,kR(e),t.inputs.userRole))}),VD=W$({blur:20,color:d(U_,0,0,0,.04),offset:L(0,3),size:0}),KD=f(oN,IN,RT.spaceEvenly),HD=function(e){var t=nx(e.wallet);return f(ON,M([ET(jk),kN(20),Wk(tN),cN(5),nR(20),VD]),M([f(VN,M([ET(jk),KD]),M([f(FD,t,e),f(rx,t,e),DD(e)])),ax(e)]))},jD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),qD={$:"Web3Connect"},GD=function(e){return f(Kk,M([wN]),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(X_,"Open Trade",f(jD,n,r))}t.b;return f(D_,"Unsupported Network",ci)}t.a;return f(X_,"Connect to Wallet",qD)}())},zD=function(e){return{$:"AutoabortIntervalChanged",a:e}},YD=function(e){return{$:"ChangePaymentMethodText",a:e}},WD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),JD=WD,QD=function(e){return f(JD,M([bA(d(zR,0,0,0,.2))]),function(){return fl("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")}())},XD={$:"TextArea"},ZD=r(function(e,t){return l(zL,{autofill:ci,spellchecked:t.spellcheck,type_:XD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),eU=n(function(e,t,r){var n=f(Kk,M([bN(22),vN]),fl("Payment Method")),a=f(ZD,M([ET(jk),yT(zk(150)),Wk(d(U_,155,203,255,.2)),h$(0)]),{label:pL("payment method"),onChange:YD,placeholder:""===r?si(QD(t)):ci,spellcheck:!0,text:r});return f(ON,M([kN(20),b$({bottom:15,left:45,right:45,top:0}),ET(jk),P_(f(L_,M([sL,XL(30),nR(10),bN(20),ET(zk(400))]),e))]),M([n,a]))}),tU=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."},rU=a(function(e,t,r,n){var a=l(Rs,e,P("0"),Ni(n));return f(Kk,M([bN(22),bA(t)]),fl(U(a,r)))}),nU=function(e){return jd(e)<0?Vl(0):e},aU=n(function(e,t,n){var a=r(function(e,r){return f(ON,M([kN(4)]),M([f(Kk,M([nR(4),uN,pN(n(f(mb,t,e)))]),f(lR,M([yT(zk(10))]),dR)),r,f(Kk,M([nR(4),uN,pN(n(function(e){return jd(e)?e:Vl(3e5)}(nU(f(_R,t,e)))))]),f(lR,M([yT(zk(10))]),uR))]))}),i=QR(t);return f(VN,M([KD,kN(10)]),M([f(a,Vl(864e5),d(rU,3,e," days",i.days)),f(a,Vl(36e5),d(rU,2,e," hours",i.hours)),f(a,Vl(3e5),d(rU,2,e," min",i.min))]))}),iU=o(function(e,t,r,n,a,i){var o=f(Kk,M([Wk(d(U_,155,203,255,.2)),cN(5),nR(15),P_(f(L_,M([sL]),a))]),l(aU,PR,n,i)),u=f(VN,M([kN(30)]),M([f(lR,M([yT(zk(40)),pN(E_(d(Zd,"click","misclick","symbol for "+t,0)))]),e),f(Kk,M([bN(22),vN]),fl(t))])),s=f($N,M([bN(17),pR,bA(O_)]),M([fl(r)]));return f(ON,M([ET(jk),cN(10),Wk(l(Ok,237,237,237)),kN(2)]),f(xa,Kk(M([Wk(tN),f(aN,45,18),ET(jk)])),M([u,f(VN,M([ET(jk),kN(25),Wk(tN)]),M([o,s]))])))}),oU=oR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),uU=f(oN,eR,RT.clipX),sU=f(oN,eR,RT.clipY),cU=i(function(e,t,r,n,a){return f(ON,M([kN(15),cN(8),uU,sU,Wk(tN)]),M([p(iU,oU,"Payment Window",tU(a),r,n,zD),l(eU,t,a,e)]))}),fU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},lU=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."},dU=oR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),hU=n(function(e,t,r){return f(Kk,M([cN(8),uU,sU,Wk(tN)]),p(iU,dU,"Burn/Release Window",lU(r),e,t,fU))}),pU=function(e){return{$:"AutorecallIntervalChanged",a:e}},gU=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."},vU=oR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),yU=n(function(e,t,r){return f(Kk,M([cN(8),Wk(tN),uU,sU]),p(iU,vU,"Open Window",gU(r),e,t,pU))}),mU=function(e){return f(ON,M([ET(jk),kN(20)]),M([l(yU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(cU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(hU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},bU=function(e){return f(ON,M([ET(f($_,1e3,jk)),wN,kN(20),b$({bottom:30,left:40,right:40,top:0}),pN(b_(!1)),v_(iL(e))]),M([HD(e),mU(e),GD(e.wallet)]))},CU=As(Fm(8226)),EU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),SU=r(function(e,t){return l(Ra,ka,t,e)}),TU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(SU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),wU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(SU,f(lc,e%r,t),l(TU,yr,e/r|0,t))):f(lc,e,t)}),IU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(fw,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(TS,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),AU=function(e){return d(IU,Ua,sm,e,yr)},BU=r(function(e,t){return f(Kk,M([ET(jk),v_(f(VN,M([kN(3),ET(rR(100)),ET(t),tR]),f(EU,f(Kk,M([bA(d(zR,0,0,0,.1)),bN(14)]),fl(CU)),f(xa,f(Da,Kk(M([bA(d(zR,0,0,0,.2))])),fl),f(wU,100,(e?$a:Ua)(AU(f(xa,f(zo,fu,Qa),Ia(KR)))))))))]),fl(" "))}),kU=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e))))),wT(M([n])))}),NU=lA(RT.italic),RU=function(){var e=f(Da,Kk(M([bA(l(pA,.8,.2,.2))])),fl),t=f(Da,Kk(M([_N])),fl);return f(ON,M([ET(jk),yT(jk),Wk(tN),cN(6),kN(50),W$({blur:20,color:d(U_,0,0,0,.1),offset:L(0,3),size:0}),cN(10),nR(20)]),M([f(BU,!1,jk),f(ON,M([wN,ET(f($_,700,jk)),kN(20)]),M([f($N,M([bN(70),_N,wN,Z$]),M([fl("DAI"),e("Hard")])),f(VN,M([bN(30),vN,wN,Z$,NU]),M([fl("The "),e("Global"),fl(", "),e("Unkillable"),fl(" Crypto Gateway")]))])),f(VN,M([Wk(bR),kN(2),wN,u_,ET(jk)]),M([f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([kN(60),PN]),M([f(Kk,M([bN(40),vN,wN]),fl("Want to learn more?")),f(ON,M([kN(15)]),M([f(kU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(w_),bA(tN),_N,bN(24),wN]),{label:f($N,M([Z$]),M([fl("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"}),f(kU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(w_),bA(tN),_N,bN(24),wN]),{label:f($N,M([Z$]),M([fl("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})]))]))),f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([A$,kN(60)]),M([f(Kk,M([bN(40),vN,wN]),fl("Ready to try it out?")),f(ON,M([kN(10),ET(zk(400)),wN]),M([f($N,M([bN(24),ET(jk)]),M([fl("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f($N,M([bN(24),ET(jk)]),M([fl("Then follow the links at the top of this page to browse "),t("Sell Offers"),fl(", browse "),t("Buy Offers"),fl(", or "),t("Create Your Own Offer"),fl(".")]))]))])))])),f(Kk,M([rL,ET(jk)]),f(BU,!0,jk))]))}(),$U=r(function(e,t){return f(Ay,f(zo,function(e){return e.type_},Ja(e)),t)}),_U=function(e){return{$:"ShowCurrencyDropdown",a:e}},LU=r(function(e,t){return ml(t(e))}),xU=a(function(e,t,r,n){var a=l(LU,e,n.filterFunc,ay(f(xa,qN,r)));return R(a,yr)?qk:f(Yi,Rv,d(g$,e,n.tradeTable,M([t?Av:xo,WN,zN,YN,JN,GN]),a))}),PU=function(e){return{$:"FiltersMsg",a:e}},DU={$:"ApplyInputs"},UU=PL("disabled"),OU=function(e){return{$:"MayPreventDefault",a:e}},MU=r(function(e,t){return f(lN,e,OU(t))}),FU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):hu("Not the enter key")},n=f(du,r,f(Oh,"key",pu));return ST(f(MU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),VU=function(e){return f(FU,"Enter",e)},KU={$:"Button"},HU=r(function(e,t){var r=t.onPress,n=t.label;return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY+" "+RT.seButton+" "+RT.noTextSelection),f(ka,uN,f(ka,_L(e),f(ka,NN(KU),f(ka,ST(L$(0)),function(){if("Nothing"===r.$)return f(ka,ST(UU(!0)),e);var t=r.a;return f(ka,pN(t),f(ka,VU(t),e))}()))))))),wT(M([n])))}),jU=f(HU,M([Wk(w_),nR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,ZN]),fl("Apply")),onPress:si(DU)}),qU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(yA,sN,l(jI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},GU=function(e){return f(dN,"focus",Fi(e))},zU=f(Da,ST,GU),YU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([zU(e(!0)),lx(e(!0))])}();return f(VN,U(e,M([yT(zk(40)),W$({blur:20,color:d(U_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Kk,M([Wk(wR),yT(zk(40)),qU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Kk,M([ZN,f(aN,10,0)]),r)),f(YL,U(s,U(t,M([ET(zk(100)),yT(zk(40)),l$(wR),qU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),Q$({bottom:1,left:0,right:1,top:1})]))),{label:pL(n),onChange:u,placeholder:i,text:a})]))}),WU=function(e){return{$:"MaxDaiChanged",a:e}},JU=function(e){return{$:"MinDaiChanged",a:e}},QU=r(function(e,t){return f(ON,M([ET(jk),kN(8)]),M([f(Kk,M([bN(17),pR]),fl(e)),t]))}),XU=ZT(25),ZU=function(e){return{$:"MoveX",a:e}},eO=function(e){return f(K$,XU,ZU(-e))},tO={$:"OnLeft"},rO=function(e){return f(e$,tO,e)},nO=n(function(e,t,r){var n=lL(M([ZN])),a=f(VN,M([kN(8),ZN,ET(zk(60))]),M([n,f(Kk,M([bN(16),ZN]),fl("max"))])),i=f(VN,M([kN(8),ZN,ET(zk(60))]),M([n,f(Kk,M([bN(16),ZN]),fl("min"))]));return f(QU,"Dai Range",f(ON,M([kN(5),ET(zk(200))]),M([v(YU,M([rO(f(L_,M([eO(5),ET(zk(200))]),r.minDai))]),M([zU(_U(!1))]),i,"min Dai",e,ci,ci,JU),v(YU,M([rO(f(L_,M([eO(5),ET(zk(200))]),r.maxDai))]),M([zU(_U(!1))]),a,"max Dai",t,ci,ci,WU)])))}),aO=function(e){var t=f(fp,e,KR);if("Nothing"===t.$)return fl("*");var r=t.a,n=r.b;return f(lR,M([yT(zk(26))]),n)},iO=function(e){return{$:"AppCmd",a:e}},oO=function(e){return{$:"FiatTypeInputChanged",a:e}},uO=n(function(e,t,r){var n=iO(d(Zd,"click","misclick","currency flag",0)),a=aO(t);f(VN,M([kN(8),ZN,ET(zk(60))]),M([a,f(Kk,M([bN(16),ZN]),fl("max"))])),f(VN,M([kN(8),ZN,ET(zk(60))]),M([a,f(Kk,M([bN(16),ZN]),fl("min"))]));return f(Kk,M([u_,ET(zk(120))]),f(QU,"Fiat Type",h(xD,e,t,_U(!0),oO,n)))}),sO={$:"AddSearchTerm"},cO=function(e){return{$:"PaymentMethodInputChanged",a:e}},fO=f(Oh,"keyCode",zC),lO=function(e){return f(dN,"keyup",f(du,function(t){return 13===t?Fi(e):hu(Ni(t))},fO))},dO=function(e){return f(QU,"Search Payment Methods",f(YL,M([u_,ET(zk(250)),yT(zk(40)),l$(wR),W$({blur:20,color:d(U_,233,237,242,.05),offset:L(0,3),size:0}),k_(lO(sO))]),{label:pL("payment methods search"),onChange:cO,placeholder:ci,text:e}))},hO={$:"ResetSearch"},pO=f(HU,M([Wk(w_),nR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,ZN]),fl("Reset")),onPress:si(hO)}),gO=function(e){return{$:"RemoveTerm",a:e}},vO=function(e){return f(Kk,M([nR(3),u_,uN,pN(gO(e)),bN(10),bA(EN)]),fl("x"))},yO=function(e){if(e.b){var t=e;return f(VN,M([ET(jk),nR(10),kN(10)]),f(xa,function(e){return f(VN,M([Wk(d(U_,16,7,234,.2)),cN(5),nR(4),kN(3)]),M([fl(e),vO(e)]))},t))}return qk},mO=i(function(e,t,r,n,a){var i=function(e){return f(Kk,M([bN(20),vN,bA(bR),wN]),fl(e))},o=f(Eh,Ja(f_),f(xa,p_,e))?M([i("No trades found.")]):f(xa,i,qC(f(xa,function(e){switch(p_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),v_(f(ON,M([kN(5),A$]),o))]),f(VN,M([wN,kN(50)]),M([f(Yi,PU,c_(t)),f(VN,M([ET(bT),kN(10)]),M([f(Kk,M([ET(bT),u_]),l(nO,r.minDai,r.maxDai,n)),f(Kk,M([ET(bT),u_]),l(uO,a,r.fiatType,n)),f(ON,M([ET(bT),u_,kN(5)]),M([dO(r.paymentMethod),yO(r.paymentMethodTerms)])),f(QU," ",f(ON,M([kN(5),ET(bT)]),M([jU,pO])))]))])))}),bO=n(function(e,t,r){var n=function(){return!f(xc,0,f(Bo,function(e){return f(MS,function(e){return e.checked&&"Open"!==e.label},e.options)},f($U,Eo,r.filters)))}();return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),pN(_U(!1)),nR(30)]),M([f(VN,M([ET(jk),kN(10)]),M([h(mO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),d(xU,e,n,t,r)]))}),CO=function(e){return{$:"MessageInputChanged",a:e}},EO={$:"MessageSubmit"},SO=function(e){return f(ON,M([ET(jk),kN(10)]),M([f(ZD,M([ET(jk),yT(zk(100))]),{label:pL("messageInput"),onChange:CO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(HU,M([wN,bN(24)]),{label:fl("Submit"),onPress:si(EO)})]))},TO=f(oN,eR,RT.scrollbarsY),wO=r(function(e,t){return f(Kk,M([yT(jk),ET(jk)]),f(Kk,U(M([k_(f(B_,"position","absolute")),k_(f(B_,"top","0")),k_(f(B_,"right","0")),k_(f(B_,"bottom","0")),k_(f(B_,"left","0")),TO]),e),t))}),IO=l(Ok,200,205,210),AO=n(function(e,t,r){var n=M([PN,Wk(w_),bA(tN),qU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([A$,Wk(IO),bA(PR),qU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Kk,U(M([nR(7)]),u),f($N,yr,M([fl(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(pA,0,0,1),tN,"Initiator opened the trade"));case"Recalled":return si(x(l(pA,0,0,1),tN,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(ru,8,dl(t))+"..";return si(x(l(pA,1,0,1),tN,r+" committed to the trade"));case"Aborted":return si(x(l(pA,1,0,0),tN,"Buyer aborted the trade"));case"Claimed":return si(x(l(pA,0,1,0),tN,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(pA,0,0,1),tN,"Seller released the "+kR(e)+" and closed the contract"));default:return si(x(l(pA,0,0,1),tN,"Seller burned the "+kR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return qk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Kk,M([cN(3),h$(1),l$(l(pA,1,0,1)),wN,Wk(h)]),f($N,M([bA(p)]),M([fl(g)])))}),BO=n(function(e,t,r){if(r.b){var n=r;return f(wO,M([ET(jk),yT(jk),cN(5),h$(1),l$(PR),nR(10)]),f(ON,M([ET(jk),yT(jk),kN(10)]),f(xa,f(AO,e,t),n)))}return f(Kk,M([ET(jk),yT(jk),cN(5),h$(1),l$(PR),wN,bA(l(pA,.5,.5,.5)),NU]),fl("no messages found."))}),kO=Cr,NO=function(e){return f(ON,M([ET(jk),yT(jk),kN(10),h$(1),cN(5),nR(20)]),M([l(BO,e.trade.factory,e.userRole,f(kO,function(e){return e.blocknum},Sa(e.history))),SO(e)]))},RO=function(e){return f(Kk,M([Wk(tN),cN(8),VD,ET(jk),yT(jk)]),NO(e))},$O={$:"ToggleChat"},_O=function(e){if(e.showChatHistory){var t=f(xc,qk,f(Bo,RO,e.chatHistoryModel));return f(Kk,M([yT(jk),ET(zk(500)),nR(20),PN]),l(__,M([yT(jk),ET(jk)]),f(Yi,yE,t),$O))}return qk},LO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},xO=function(e){return GR(e)+" "+e.fiatType},PO={$:"AbortAction"},DO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),UO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return qk}if("LoadedTrade"!==t.b.$)return qk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=xO(n.terms.price),u=o$(Lb(i)),s=o$(n.parameters.tradeAmount)+" "+kR(n.factory),c=function(){return"Buyer"===LO(n.parameters).$?L(f(Kk,M([pR,bA(PR)]),fl("buyer")),M([fl("pay the seller "),f(Kk,M([bA(w_)]),fl(o)),fl(" in exchange for the "),f(Kk,M([bA(w_)]),fl(s)),fl(" held in this contract.")])):L(f(Kk,M([pR,bA(PR)]),fl("seller")),M([fl("accept "),f(Kk,M([bA(w_)]),fl(o)),fl(" from the buyer in exchange for the "),f(Kk,M([bA(w_)]),fl(s)),fl(" held in this contract.")]))}(),d=c.a,h=c.b;return l(__,yr,f(ON,M([kN(20),nR(20),wN,yT(jk),Z$]),M([f(Kk,M([bN(26),vN,wN,ZN]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,ZN]),f(xa,$N(M([wN,bN(18),pR,bA(O_)])),U(M([U(M([fl("You will deposit "),f(Kk,M([bA(w_)]),fl(u+" "+kR(n.factory))),fl(", thereby becoming the "),d,fl(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([fl("(This ususally requires two Metamask signatures. Your "+kR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Kk,M([rL,wN]),f(X_,"Yes, I definitely want to commit to this trade.",l(DO,n,a,i)))])),PO);case"ApproveNeedsSig":return Z_(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return Z_(M([fl("Mining the initial approve transaction..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction on Etherscan"),url:f(eL,n.factory,p)}),fl("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return Z_(M([fl("Waiting for user signature for the final commit call."),fl("(check Metamask!)"),fl("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return Z_(M([fl("Mining the final commit transaction..."),f(dA,M([nL,bA(w_)]),{label:fl("See the transaction"),url:f(eL,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(__,yr,f(ON,M([kN(20),nR(20),wN,yT(jk),Z$]),M([f(Kk,M([bN(26),vN,wN,ZN]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,ZN]),f(xa,$N(M([wN,bN(18),pR,bA(O_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([fl('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 '+kR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([fl("Aborting will incur a small penalty on both parties, and refund the rest of the "+kR(n.factory)+".")])]);case"Release":return M([M([fl("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([fl("This will destroy the "+kR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Kk,M([rL,wN]),function(e){return f(X_,e,DE(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 "+kR(n.factory)+".";default:return"I understand. Burn the "+kR(n.factory)+"."}}()))])),PO);case"ActionNeedsSig":var g=r.a;return Z_(M([fl("Waiting for user signature for the "+OE(g)+" call."),fl("(check Metamask!)")]));default:var g=r.a,p=r.b;return qk}},OO=VN(M([ET(jk),Wk(tN),cN(5),nR(20),KD,VD])),MO=function(e){return f(VN,M([kN(8)]),M([f(lR,yr,fL),f(Kk,M([bN(24),pR]),fl(o$(e)))]))},FO=r(function(e,t){var r=f(Io,Ao(e),f(Bo,function(e){return e.address},Gd(t)));return f(tx,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"}(),MO(e.parameters.tradeAmount))}),VO=function(e){return f(VN,M([kN(5)]),M([fx(e.fiatType),f(Kk,M([bN(24),pR]),fl(xO(e)))]))},KO=function(e){return f(tx,"For Fiat",VO(e.terms.price))},HO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},jO=l(Ok,250,165,22),qO=l(Ok,255,0,0),GO=l(Ok,0,255,0),zO=oR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),YO=oR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),WO=oR({description:"released",src:"/DAIHard/static/img/released.svg"}),JO={$:"ToggleStatsModal"},QO=function(e){return f(kO,Ua,e)},XO=n(function(e,t,n){var a=ay(f(xa,function(e){return f(ml,function(e){return R(f(ko,e,n),si(t))},f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(fh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(fh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wl,amountReleased:Wl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,Vl,Ql(QO(f(US,function(e){return function(e){return e?si(e):ci}(jd(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}}),ZO=r(function(e,t){return d(Q_,x(d(zR,0,0,1,1),d(zR,0,0,1,.8),d(zR,0,0,1,.6)),tN,e,t)}),eM=function(e){return{$:"ViewUserHistory",a:e}},tM=f(JB,0,yr),rM=f(oN,gN,RT.textNormalWeight),nM=r(function(e,t){return Za(e/t)}),aM=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}}),iM=r(function(e,t){var r=e.a,n=e.b;return l(aM,r,f(nM,jd(t),6e4),n)}),oM=r(function(e,t){return f(_s,24,f(nM,f(iM,e,t),60))}),uM=r(function(e,t){return f(_s,1e3,jd(t))}),sM=r(function(e,t){return f(_s,60,f(iM,e,t))}),cM={$:"Apr"},fM={$:"Aug"},lM={$:"Dec"},dM={$:"Feb"},hM={$:"Jan"},pM={$:"Jul"},gM={$:"Jun"},vM={$:"Mar"},yM={$:"May"},mM={$:"Nov"},bM={$:"Oct"},CM={$:"Sep"},EM=function(e){var t=f(nM,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)}},SM=r(function(e,t){switch(EM(f(iM,e,t)).month){case 1:return hM;case 2:return dM;case 3:return vM;case 4:return cM;case 5:return yM;case 6:return gM;case 7:return pM;case 8:return fM;case 9:return CM;case 10:return bM;case 11:return mM;default:return lM}}),TM=r(function(e,t){return f(_s,60,f(nM,jd(t),1e3))}),wM={$:"Fri"},IM={$:"Mon"},AM={$:"Sat"},BM={$:"Sun"},kM={$:"Thu"},NM={$:"Tue"},RM={$:"Wed"},$M=r(function(e,t){switch(f(_s,7,f(nM,f(iM,e,t),1440))){case 0:return kM;case 1:return wM;case 2:return AM;case 3:return BM;case 4:return IM;case 5:return NM;default:return RM}}),_M=n(function(e,t,r){return e.toAmPm(f(oM,t,r))}),LM=r(function(e,t){return EM(f(iM,e,t)).day}),xM=LM,PM=M([BM,IM,NM,RM,kM,wM,AM]),DM=r(function(e,t){return function(e){return e.a}(f(xc,L(0,BM),Ql(f(ml,function(r){return R(r.b,f($M,e,t))},f(Bi,r(function(e,t){return L(e,t)}),PM)))))}),UM=function(e){return l(Ra,Na,0,e)},OM=r(function(e,t){return EM(f(iM,e,t)).year}),MM=function(e){return!f(_s,4,e)&&(!!f(_s,100,e)||!f(_s,400,e))},FM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return MM(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}}),VM=M([hM,dM,vM,cM,yM,gM,pM,fM,CM,bM,mM,lM]),KM=r(function(e,t){return f(xc,L(0,hM),Ql(f(ml,function(r){r.a;return R(r.b,f(SM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),VM))))}),HM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(KM,e,t))}),jM=r(function(e,t){var r=f(lc,f(HM,e,t)-1,VM);return UM(f(xa,FM(f(OM,e,t)),r))+f(xM,e,t)}),qM=r(function(e,t){return f(HM,e,t)/4|0}),GM=r(function(e,t){var r=Ni(t),n=e-Qo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),zM=function(e){return e?e<=12?e:e-12:12},YM=sv(315576e5),WM=r(function(e,t){return Vl(YM*f(OM,e,t))}),JM=r(function(e,t){var r=f(WM,e,t),n=f(DM,e,r);return 1+((f(jM,e,t)+n)/7|0)}),QM=r(function(e,t){return Ni(f(OM,e,t))}),XM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(HM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(HM,t,r));case"MonthFixed":return f(GM,2,f(HM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(SM,t,r));case"MonthNameFull":return e.toMonthName(f(SM,t,r));case"QuarterNumber":return Ni(1+f(qM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(qM,t,r));case"DayOfMonthNumber":return Ni(f(xM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(xM,t,r));case"DayOfMonthFixed":return f(GM,2,f(xM,t,r));case"DayOfYearNumber":return Ni(f(jM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(jM,t,r));case"DayOfYearFixed":return f(GM,3,f(jM,t,r));case"DayOfWeekNumber":return Ni(f(DM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(DM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f($M,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f($M,t,r));case"WeekOfYearNumber":return Ni(f(JM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(JM,t,r));case"WeekOfYearFixed":return f(GM,2,f(JM,t,r));case"YearNumberLastTwo":return f(ou,2,f(QM,t,r));case"YearNumber":return f(QM,t,r);case"AmPmUppercase":return ND(l(_M,e,t,r));case"AmPmLowercase":return sd(l(_M,e,t,r));case"HourMilitaryNumber":return Ni(f(oM,t,r));case"HourMilitaryFixed":return f(GM,2,f(oM,t,r));case"HourNumber":return Ni(zM(f(oM,t,r)));case"HourFixed":return f(GM,2,zM(f(oM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(oM,t,r));case"HourMilitaryFromOneFixed":return f(GM,2,1+f(oM,t,r));case"MinuteNumber":return Ni(f(sM,t,r));case"MinuteFixed":return f(GM,2,f(sM,t,r));case"SecondNumber":return Ni(f(TM,t,r));case"SecondFixed":return f(GM,2,f(TM,t,r));case"MillisecondNumber":return Ni(f(uM,t,r));case"MillisecondFixed":return f(GM,3,f(uM,t,r));default:return n.a}}),ZM=a(function(e,t,r,n){return f(Ri,"",f(xa,l(XM,e,r,n),t))}),eF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),tF=function(e){return e>11?"pm":"am"},rF=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"}},nF=function(e){switch(f(_s,100,e)){case 11:case 12:case 13:return"th";default:switch(f(_s,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},aF=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"}},iF=p(eF,rF,f(zo,rF,ru(3)),aF,f(zo,aF,ru(3)),tF,nF),oF=ZM(iF),uF={$:"MonthNameFull"},sF=uF,cF=function(e){return{$:"Text",a:e}},fF=cF,lF={$:"YearNumber"},dF=lF,hF=n(function(e,t,n){var a=r(function(e,t){return f(ON,M([bN(18),kN(6)]),M([f(Kk,M([_N]),fl(e)),f(Kk,M([rM]),fl(t))]))}),i=oF(M([sF,fF(", "),dF])),o=f(ON,M([kN(23),ET(jk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,tM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+o$(n.amountReleased)+" "+kR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+o$(n.amountBurned)+" "+kR(e)+" Burned")])),M([f(Kk,M([wN]),f(ZO,"View User History",eM(n.asRole)))])));return f(ON,M([cN(8),uU,sU,Wk(wR),kN(1),W$({blur:20,color:d(zR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Kk,M([ET(jk),Wk(tN),nR(17)]),f(y$,18,t)),f(Kk,M([ET(jk),Wk(tN),nR(17)]),o)]))}),pF=n(function(e,t,r){var n=l(XO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=HO(e.parameters.initiatorRole)+" Stats";return f(Kk,r?M([QL(f(Kk,M([XL(30),PN]),l(hF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(tx,a,f(VN,M([ET(jk),kN(20),uN,pN(JO)]),f(xa,VN(M([kN(5)])),M([M([f(lR,M([yT(zk(28))]),WO),f(Kk,M([bN(24),pR,bA(GO)]),fl(l(Rs,2,P("0"),Ni(n.numReleases))))]),M([f(lR,M([yT(zk(28))]),zO),f(Kk,M([bN(24),pR,bA(jO)]),fl(l(Rs,2,P("0"),Ni(n.numAborts))))]),M([f(lR,M([yT(zk(28))]),YO),f(Kk,M([bN(24),pR,bA(qO)]),fl(l(Rs,2,P("0"),Ni(n.numBurns))))])])))))}),gF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+dl(t)}e.a;return"https://kovan.etherscan.io/address/"+dl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+dl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+dl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+dl(t)}}),vF=n(function(e,t,r){return f(dA,e,{label:fl(dl(r)),url:f(gF,t,r)})}),yF=function(e){return f(tx,"Trade Status",f(ON,M([bN(24),pR,kN(8)]),M([fl(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(vF,M([bN(12),bA(w_),nL]),e.factory,e.creationInfo.address)])))},mF=i(function(e,t,r,n,a){return OO(M([yF(t),f(FO,t,r),KO(t),l(pF,t,n,a)]))}),bF=l(Ok,9,32,107),CF=oR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),EF=f(Kk,M([cN(4),uN,pN($O),nR(5),Wk(l(Ok,22,0,255))]),f(lR,M([ET(zk(42))]),CF)),SF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},TF=function(e){return f(ON,M([cN(12),Wk(wR),nR(15),kN(15)]),M([f(Kk,M([bN(24),vN,NU]),fl("Fiat Payment Method")),f($N,M([bN(18),yT(bT),Wk(tN),W$({blur:5,color:d(zR,0,0,0,.2),offset:L(-3,3),size:0}),cN(3),nR(5)]),M([f(xc,f(Kk,M([bA(OD),NU]),fl("No payment methods found.")),f(Bo,fl,f(Bo,function(e){return e.info},Ql(e))))]))]))},wF={$:"Active"},IF=function(e){return{$:"ExpandPhase",a:e}},AF=M([Wk(bF),bA(tN)]),BF=r(function(e,t){return{$:"Min",a:e,b:t}}),kF=r(function(e,t){return f(BF,e,t)}),NF=function(e){return M(e?[cN(12),u_,yT(f(kF,380,bT))]:[cN(12),wN])},RF=M([Wk(tN)]),$F=oR({description:"flame",src:"/DAIHard/static/img/flame.png"}),_F=r(function(e,t){return Hl(f(ds,jl(e),jl(t)))}),LF=r(function(e,t){return d(Q_,x(d(zR,1,.6,.2,1),d(zR,1,.6,.2,.8),d(zR,1,.6,.2,.6)),tN,e,t)}),xF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),PF=function(e){return{$:"ContractActionClicked",a:e}},DF={$:"Web3Connect"},UF=n(function(e,t,r){var n=Gd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(LR,e,t).$?qk:f(VN,M([kN(8)]),function(){var e=x(t.state.phase,f(Ao,t,a.address),f(ko,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,DE,f(ZO,"Remove and Refund this Trade",xE))])}break e}var r=(e.a,e.b,jl(hb(t.parameters)));return M([f(X_,"Deposit and Commit to Trade",l(xF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,PF,f(LF,"Abort Trade",bE)),f(Yi,PF,f(X_,"Confirm Payment",AE)),EF])}e.a,e.c.a;return M([EF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,PF,f(X_,"Burn it All!",IE)),f(Yi,PF,f(ZO,"Release Everything",PE)),EF])}e.a,e.c.a;return M([EF])}break e;default:break e}return yr}())}return f(X_,"Connect to Wallet",DF)}),OF={$:"Finished"},MF={$:"NotStarted"},FF=r(function(e,t){var r=L(CR(t),CR(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?MF:R(n,a)?wF:OF}),VF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),KF=r(function(e,t){return l(VF,yr,e,t)}),HF=a(function(e,t,r,n){var a=o$(f(fh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+kR(r.factory),i=o$(r.parameters.tradeAmount)+" "+kR(r.factory),o=f(VN,yr,f(KF,3,f(lR,M([yT(zk(18))]),$F))),u=f(Da,Kk(M([bA(l(pA,1,0,0))])),fl),s=R(e,r.state.phase),c=f(Io,ko(r),f(Bo,function(e){return e.address},Gd(n))),d=s?tN:PR,h=$N(M([bA(d),bN(18),vN])),p=xO(r.terms.price),g=s?l(Ok,0,226,255):l(Ok,16,7,234),v=f(Da,Kk(M([bA(g)])),fl),y=o$(r.parameters.buyerDeposit)+" "+kR(r.factory),m=r.parameters.abortPunishment,b=o$(m)+" "+kR(r.factory),C=o$(f(_F,r.parameters.buyerDeposit,m))+" "+kR(r.factory),E=o$(f(_F,r.parameters.tradeAmount,m))+" "+kR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([fl("Your "),u("burnable deposit"),fl(" of "),v(y),fl(" is now held in this contract, and your offer to buy "),v(i),fl(" for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Seller by depositing the full "),v(i),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),fl(" to you.")])])):f(xa,h,M([M([fl("Your offer to sell the "),v(i),fl(" held in this contract for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),fl(" of 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),fl(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([fl("You must now pay the Seller "),v(p),fl(" via the Fiat Payment Method, "),f(Kk,M([vN]),fl("and then click ")),u("Confirm Payment"),fl(" before the payment window runs out. Use the chat to coordinate.")]),M([fl("If you abort the trade, or do not confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to you).")]),M([fl("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),fl(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([fl("Work and communicate with the Buyer to receive "),v(p),fl(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to you, "),v(C),fl(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),fl(" will be released to you.")]),M([fl("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),fl(" In this case the "),v(a),fl(" will be lost to both parties.")]),M([fl("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([fl("So, have you recieved the "),v(p),fl("? If so, you can click "),v("Release Everything"),fl(".")]),M([fl("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),fl(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([fl("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([fl("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([fl("The Seller has deposited "),v(i),fl(" into this contract, and offers to sell it for "),v(p),fl(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("If the trade is successful, the combined "+kR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),fl(" within the payment window.")])])):f(xa,h,M([M([fl("The Buyer is offering to buy "),v(i),fl(" for "),v(p),fl(", and has deposited "),v(y),fl(" into this contract as a "),u("burnable deposit"),fl(". To become the Seller, deposit "),v(i),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("When you receive the "),v(p),fl(" from the Buyer, the combined "+kR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can receive "),v(p),fl(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([fl("During this phase, the Buyer is expected to transfer "),v(p),fl(" to the Seller, as described in Fiat Payment Method, "),f(Kk,M([vN]),fl("and ")),u("Confirm the Payment "),fl(" before the payment window runs out. This would move the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(" amount) will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([fl("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([fl("If the Seller can verify he has received the "),v(p),fl(", he will probably release the total balance of "),v(i),fl(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),fl(".")]),M([fl("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),fl(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(ON,M([ET(jk),yT(jk),nR(20),kN(30)]),M([f(VN,M([ET(jk)]),M([f(Kk,M([bN(24),vN,bA(g),A$]),fl(T))])),f(ON,M([ET(jk),ZN,kN(13)]),w),f(Kk,M([PN]),function(){switch(f(FF,r,e).$){case"Active":return l(UF,t,r,n);case"NotStarted":return f(Kk,M([bN(20),vN,NU,bA(bR)]),fl("Phase not yet started."));default:return f(Kk,M([bN(20),vN,NU]),fl("Phase no longer active."))}}())]))}),jF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},qF=oR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),GF=oR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),zF={$:"None"},YF=zF,WF=oR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),JF=function(e){switch(e.$){case"Open":return WF;case"Committed":return qF;case"Judgment":return GF;default:return YF}},QF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),XF=a(function(e,t,r,n){return d(QF,e,t,r,n)}),ZF=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},eV=function(e){return function(e){return d(XF,e.red,e.green,e.blue,e.alpha)}(ZF(e))},tV=function(e){return{$:"Circle",a:e}},rV=tV,nV=d(QF,0,0,0,1),aV={$:"Flat"},iV={$:"Sharp"},oV=function(e){return{$:"Uniform",a:e}},uV=oV,sV={cap:aV,dashPattern:yr,dashPhase:0,fill:uV(nV),join:iV,thickness:2},cV=n(function(e,t,r){return D(sV,{dashPattern:e,fill:r,thickness:t})}),fV=cV(yr),lV={$:"Transparent"},dV=lV,hV=f(fV,0,dV),pV=r(function(e,t){return{$:"Shape",a:e,b:t}}),gV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},vV=function(e){return f(Da,gV,pV(e))},yV=function(e){return vV(L(e,hV))},mV=function(e){return L(-e.a,-e.b)},bV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),CV=r(function(e,t){return f(bV,mV(e(t)),t)}),EV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},SV=r(function(e,t){return{$:"Path",a:e,b:t}}),TV=kr,wV=Nr,IV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=wV(n),i=TV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},AV=function(e){return xa(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)})},BV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(AV,e,M([L(-i,-a),L(i,-a),L(i,a),L(-i,a)]))}),kV=function(e){var t=e.toTop,r=e.toBottom,n=e.toRight,a=e.toLeft;return M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},NV=function(e){var t=RV(e.basic),r=EV(f(xa,IV(e),t)),n=r.a,a=r.b;return{toBottom:-f(xc,0,gI(a)),toLeft:-f(xc,0,gI(n)),toRight:f(xc,0,pI(n)),toTop:f(xc,0,pI(a))}},RV=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(BV,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(BV,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(BV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(AV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(SV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(AV,R(C,aV)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(BV,0,E);case"Group":var S=e.a;return f(AV,0,ay(f(xa,f(zo,NV,kV),S)));default:var T=e.b;return f(AV,0,kV(NV(T)))}},$V=function(e){var t=NV(e);return t.toTop+t.toBottom},_V=function(e){var t=NV(e);return L(-t.toLeft,t.toTop)},LV=function(e){var t=NV(e);return t.toLeft+t.toRight},xV=En("http://www.w3.org/2000/svg"),PV=xV("svg"),DV=Nn("height"),UV=Nn("version"),OV=Nn("width"),MV=xV("circle"),FV=xV("ellipse"),VV=xV("foreignObject"),KV=xV("g"),HV=xV("image"),jV=xV("polygon"),qV=xV("polyline"),GV=xV("rect"),zV=Tw,YV=xV("text"),WV=Nn("id"),JV=Nn("points"),QV=Nn("r"),XV=Nn("rx"),ZV=Nn("ry"),eK=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},tK=function(e){return{$:"Group",a:e}},rK=Nn("dominant-baseline"),nK=Nn("fill"),aK=Nn("fill-opacity"),iK=Nn("font-family"),oK=Nn("font-size"),uK=Nn("font-style"),sK=Nn("font-variant"),cK=Nn("font-weight"),fK=Nn("opacity"),lK=Nn("stroke"),dK=Nn("stroke-dasharray"),hK=Nn("stroke-dashoffset"),pK=Nn("stroke-linecap"),gK=Nn("stroke-linejoin"),vK=Nn("stroke-opacity"),yK=Nn("stroke-width"),mK=Nn("text-anchor"),bK=Nn("text-decoration"),CK=Nn("transform"),EK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},SK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},TK=n(function(e,t,r){return d(QF,e,t,r,1)}),wK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return sv(1e4*e)/100};return Cd(M(["rgba(",mw(i(t)),"%,",mw(i(r)),"%,",mw(i(n)),"%,",mw(function(e){return sv(1e3*e)/1e3}(a)),")"]))},IK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},AK=function(e){var t=IK(e),r=t.red,n=t.green,a=t.blue;return wK(l(TK,r,n,a))},BK=function(e){if("Uniform"===e.$){var t=e.a;return AK(t)}return"none"},kK=function(e){var t=IK(e),r=t.alpha;return mw(r)},NK=function(e){if("Uniform"===e.$){var t=e.a;return kK(t)}return"0"},RK=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},$K=function(e){var t=mw(e.scale.b),r=mw(e.scale.a),n=mw(-e.rotation/2/O$*360),a=mw(-e.shift.b),i=mw(e.shift.a);return Cd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},_K=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([lK(BK(r.fill)),vK(NK(r.fill)),yK(mw(r.thickness)),pK(EK(r.cap)),gK(RK(r.join)),nK("none"),fK(mw(e.opacity)),CK($K(e)),hK(Ni(r.dashPhase)),dK(SK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([nK(BK(a)),aK(NK(a)),lK(BK(r.fill)),vK(NK(r.fill)),yK(mw(r.thickness)),pK(EK(r.cap)),gK(RK(r.join)),fK(mw(e.opacity)),CK($K(e)),hK(Ni(r.dashPhase)),dK(SK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([nK(BK(oV(o.color))),iK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),oK(Ni(o.size)),cK(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"}}()),uK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),sK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),bK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),mK("middle"),rK("middle"),CK($K(e))]);default:return M([CK($K(e))])}},LK=Nn("x"),xK=Nn("y"),PK=r(function(e,t){return M([OV(mw(e)),DV(mw(t)),LK(mw(-e/2)),xK(mw(-t/2))])}),DK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([mw(t),mw(-r)]))},e))},UK=dN,OK=r(function(e,t){return f(e,t.a,t.b)}),MK=function(e){return f(xa,OK(UK),e)},FK=function(e){e:for(;;){var t=f(xc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(qV,U(M([WV(t),JV(DK(i))]),U(_K(e),MK(e.handlers))),yr);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,U(M([WV(t),JV(DK(i))]),U(_K(e),MK(e.handlers))),yr);case"Circle":var c=s.a;return f(MV,U(M([WV(t),QV(mw(c))]),U(_K(e),MK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(FV,U(M([WV(t),XV(mw(d)),ZV(mw(h))]),U(_K(e),MK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(GV,U(M([WV(t),XV(mw(c)),ZV(mw(c))]),U(f(PK,p,g),U(_K(e),MK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(SV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(YV,U(M([WV(t)]),U(_K(e),MK(e.handlers))),M([zV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(HV,U(M([WV(t),eK(C)]),U(f(PK,p,g),U(_K(e),MK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(VV,U(M([WV(t)]),U(f(PK,p,g),U(_K(e),MK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(KV,f(ka,WV(t),U(_K(e),MK(e.handlers))),l(Ra,r(function(e,t){return f(ka,FK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:tK(M([w,I]))});e=v;continue e}}},VK=r(function(e,t){var r=e.a,n=e.b,a=mw(r),i=mw(n);return f(jT,yr,M([f(PV,M([OV(a),DV(i),UV("1.1")]),M([FK(t)]))]))}),KK=function(e){return f(VK,L(LV(e),$V(e)),f(CV,_V,e))},HK=r(function(e,t){var r=JF(e),n=function(){switch(t.$){case"NotStarted":return l(Ok,10,33,108);case"Active":return l(Ok,0,100,170);default:return l(Ok,1,129,104)}}(),a=dx(KK(f(yV,uV(eV(n)),rV(50))));return f(Kk,M([wN,v_(f(lR,M([wN,ZN,yT(zk(60))]),r))]),a)}),jK=function(e){var t=M([NU,vN,bN(20)]);switch(e.$){case"Active":return f(Kk,U(t,M([bA(EN)])),fl("Active"));case"NotStarted":return f(Kk,U(t,M([bA(bR)])),fl("Not Started"));default:return f(Kk,t,fl("Finished"))}},qK=n(function(e,t,r){var n=f(FF,t,e),a=function(){return"Active"===n.$?l(Ok,0,226,255):PR}(),i=f(Kk,M([bA(a),bN(20),vN,wN]),fl(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 qk;switch(n.$){case"NotStarted":return d(XR,M([wN]),M([bN(22),pR]),L(PR,wR),f($R,e,t));case"Active":var a=f(LR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(i$,M([wN]),M([bN(22),pR]),L(tN,wR),i)}return f(ON,M([wN,kN(10)]),M([f(Kk,M([wN]),fl(jF(e))),f(ZO,"Poke",DE(LE))]));default:return f(Kk,M([yT(zk(1))]),qk)}}();return f(ON,M([nR(20),kN(10),yT(jk)]),M([f(Kk,M([u_,wN]),i),f(Kk,M([yT(jk),wN]),f(Kk,M([ZN]),f(HK,e,n))),f(ON,M([kN(10),rL,wN]),M([f(Kk,M([wN]),jK(n)),o]))]))}),GK=o(function(e,t,r,n,a,i){var o=f(FF,r,t),u=f(Kk,M([nR(10),ET(jk),yT(jk)]),d(HF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Vl(0)}}(),c=l(qK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(_R,f(mb,r.state.phaseStartTime,s),i);default:Vl(0)}}(),f(Kk,M([yT(jk),ET(zk(1)),Wk(function(){return"Active"===o.$?l(pA,0,0,1):wR}())]),qk)),p=a?f(VN,U(NF(e),U(R(o,wF)?AF:RF,M([ET(jk)]))),M([c,h,u])):f(VN,U(NF(e),U(R(o,wF)?AF:RF,M([uN,pN(IF(t))]))),M([c]));return!e&&R(o,wF)?f(ON,M([ET(jk),kN(20),b$({bottom:20,left:0,right:0,top:0})]),M([p,TF(r.terms.paymentMethods)])):p}),zK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(VN,M([wN,cN(12),nR(30),kN(10),Wk(bF),bN(24),vN,bA(tN)]),M([fl("Trade "+SF(t.state.closedReason)),EF])):e?f(ON,M([ET(jk),kN(10)]),M([f(VN,M([ET(jk),yT(bT),kN(20)]),M([p(GK,e,Co,t,n,R(r,Co),a),p(GK,e,mo,t,n,R(r,mo),a),p(GK,e,bo,t,n,R(r,bo),a)])),TF(t.terms.paymentMethods)])):f(ON,M([ET(jk),yT(bT),kN(20)]),M([p(GK,e,Co,t,n,R(r,Co),a),p(GK,e,mo,t,n,R(r,mo),a),p(GK,e,bo,t,n,R(r,bo),a)]))}),YK=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(ON,M([ET(jk),yT(jk),kN(40)]),M([h(mF,t,i,n.wallet,r,n.showStatsModal),f(Kk,M([ET(jk),f(aN,40,0),kN(40)]),h(zK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Kk,M([wN,ZN,bN(30)]),fl("Loading trade info..."));default:return f(Kk,M([wN,ZN,bN(30)]),fl("Invalid trade"))}}(),M([_O(n),UO(n)]))}),WK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),JK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L(RU,yr);case"CreateModel":var n=r.a;return L(f(Yi,Uy,bU(n)),yr);case"TradeModel":var a=r.a;return l(WK,Yi(Fy),xa(Yi(Fy)),d(YK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,fT,l(bO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,oT,l(m_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Kk,M([ET(jk),yT(jk),cN(10)]),n),a)}),QK=function(e){return{$:"DismissNotice",a:e}},XK=function(e){return f(K$,XU,ZU(e))},ZK=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(pA,1,1,1):l(pA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Ok,100,200,255);case"Caution":return l(Ok,255,188,0);case"Error":return l(Ok,255,70,70);default:return l(Ok,200,200,200)}}(),o=f(Kk,M([PN,u_,H$(5),XK(5)]),I_(QK(t)));return f(Kk,M([Wk(i),cN(10),nR(8),ET(jk),h$(1),l$(d(zR,0,0,0,.15)),VD]),f(ON,M([kN(4),ET(jk)]),f(Bi,r(function(e,t){return f($N,M([ET(jk),bA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},eH=function(e){return R(e,yr)?yr:M([f(ON,M([eO(20),H$(20),kN(10),PN,rL,ET(zk(300)),bN(15)]),f(xa,ZK,f(ml,function(e){return R(e.b.align,ul)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(ON,M([XK(20),XL(100),kN(10),A$,u_,ET(zk(300)),bN(15)]),f(xa,ZK,f(ml,function(e){return R(e.b.align,CB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},tH=r(function(e,t){var r=f(JK,e,t),n=r.a,a=r.b;return L(f(ON,M([t$(Jk),v_(KN(t)),ET(jk),yT(jk),nR(30)]),M([f(Kk,M([yT(zk(50))]),qk),n])),U(a,eH(t.userNotices)))}),rH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),nH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),aH={$:"AllowHover"},iH={$:"Layout"},oH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(hA,155/255,203/255,1,1),offset:L(0,0),size:3})},uH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?oH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?aH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?iH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},sH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(AT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),AT);case"Text":var a=t.a;return $I(a);default:return $I("")}}),cH=n(function(e,t,r){var n=uH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?rH(n):nH(n)}();return f(sH,a,d(fA,AT,Vk,t,wT(M([r]))))}),fH=ZT(5),lH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),dH={$:"SansSerif"},hH=function(e){return{$:"Typeface",a:e}},pH=Y,gH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",pH(sd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",pH(sd(t)));default:var t=e.a.name;return f(Ri,"-",pH(sd(t)))}}())}),vH=function(){var e=M([hH("Open Sans"),hH("Helvetica"),hH("Verdana"),dH]);return M([f(yA,Yk,l(vA,"bg-color-"+mA(d(hA,1,1,1,0)),"background-color",d(hA,1,1,1,0))),f(yA,gA,l(vA,"font-color-"+mA(d(hA,0,0,0,1)),"color",d(hA,0,0,0,1))),f(yA,yN,mN(20)),f(yA,fH,f(lH,l(Ra,gH,"font-",e),e))])}(),yH=n(function(e,t,r){var n=e.options;return l(cH,n,f(ka,lA(f(Ri," ",M([RT.root,RT.any,RT.single]))),U(vH,t)),r)}),mH=yH({options:yr}),bH=function(e){return f(yA,fH,f(lH,l(Ra,gH,"ff-",e),e))},CH=dH,EH=hH,SH=function(e){return{body:M([function(){var t=f(tH,e.screenWidth,e),r=t.a,n=t.b,a=U(M([ET(jk),yT(jk),bH(M([EH("Soleil"),CH]))]),f(xa,v_,n));return f(mH,a,r)}()]),title:"DAIHard"}},TH=Ht,wH=TH({init:OB,onUrlChange:Uk,onUrlRequest:Dk,subscriptions:Pk,update:sB,view:SH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:wH(f(du,function(e){return f(du,function(t){return f(du,function(r){return Fi({height:r,networkId:t,width:e})},f(Oh,"height",zC))},f(Oh,"networkId",zC))},f(Oh,"width",zC)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file +var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(bp,o,function(e){return si(Cp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,kp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,Bp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=nv(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?qg(o):jg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return nv(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Gg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Yg,zg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(zo,xa(ac),f(zo,Ms,nc))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ph,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ph,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ap)}),i.addEventListener("timeout",function(){a(Np)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Cp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(wp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Yg,zg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Yg,zg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Yg,zg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{options:t,type_:e}}),po={$:"OfferType"},go=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),vo=r(function(e,t){return f(ho,po,M([l(go,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(go,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),yo={$:"Closed"},mo={$:"Committed"},bo={$:"Judgment"},Co={$:"Open"},Eo={$:"Phase"},So=a(function(e,t,r,n){return f(ho,Eo,M([l(go,"Open",e,function(e){return R(e.state.phase,Co)}),l(go,"Committed",t,function(e){return R(e.state.phase,mo)}),l(go,"Judgment",r,function(e){return R(e.state.phase,bo)}),l(go,"Closed",n,function(e){return R(e.state.phase,yo)})]))}),To={$:"Initiator"},wo={$:"Responder"},Io=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),Ao=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(To):f(Io,function(e){return R(t,e)?si(wo):ci},e.state.responder)}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),ko=r(function(e,t){return f(Bo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(Ao,e,t))}),No={$:"Role"},Ro=n(function(e,t,r){return f(ho,No,M([l(go,"Buyer",t,function(t){return R(f(ko,t,e),si(fo))}),l(go,"Seller",r,function(t){return R(f(ko,t,e),si(lo))})]))}),$o=function(e){return{orderBy:e}},_o=$o,Lo={$:"Ascending"},xo={$:"Phase"},Po=Oe,Do=Po(yr),Uo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(So,!0,!0,!0,!1),f(vo,!0,!0),l(Ro,t,!0,!0)])),tradeTable:_o(L(xo,Lo)),wallet:e},Do)}),Oo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Mo={$:"None"},Fo=Mo,Vo=function(e){return d(Oo,e,Do,Fo,yr)},Ko=function(e){return{$:"TradeTableMsg",a:e}},Ho=function(e){return d(Oo,e,Do,Fo,yr)},jo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),qo=r(function(e,t){return f(jo,e,t)}),Go=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),zo=n(function(e,t,r){return t(e(r))}),Yo=r(function(e,t){if("None"===t.$)return Mo;var r=t.a,n=t.b,a=l(Go,f(Bo,Da(e),r.onSign),f(Bo,Da(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return L(f(zo,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(zo,t.toMsg,e)}},n))},r.onMined));return f(jo,a,n)}),Wo=function(e){return{$:"AbiDecoder",a:e}},Jo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Qo=z,Xo=Fr,Zo=r(function(e,t){return e<1?t:l(Xo,e,Qo(t),t)}),eu=Zo(64),tu=n(function(e,t,r){return L(f(Jo,e,eu(t)),r)}),ru=r(function(e,t){return e<1?"":l(Xo,0,e,t)}),nu=ru(64),au=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),iu=function(e){return-e},ou=r(function(e,t){return e<1?"":l(Xo,-e,Qo(t),t)}),uu=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(ru,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(ou,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Wo(function(t){var r=t.a,n=t.b;return f(au,f(tu,r,n),e(nu(n)))})}(),su=Hr,cu=function(e){return f(su,"0x",e)||f(su,"0X",e)?f(Zo,2,e):e},fu=function(e){return e.b},lu=r(function(e,t){var r=e.a;return f(au,fu,r(function(e){return f(Jo,e,e)}(cu(t))))}),du=Xr,hu=ae,pu=Wr,gu=function(e){return f(du,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return hu(a)},pu)},vu=f(zo,lu,gu),yu=function(e){return{$:"Magnitude",a:e}},mu=function(e){return{$:"Pos",a:e}},bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Cu=function(e){return{$:"MagnitudeNotNormalised",a:e}},Eu=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 si(n)}return ci}},Su=function(e){var t=Eu(e);return"Nothing"!==t.$&&t.a<0},Tu=function(e){return{$:"Neg",a:e}},wu={$:"Zer"},Iu=function(e){return!e.b},Au=r(function(e,t){var r=t.a;if(Iu(r))return wu;switch(e.$){case"Zero":return wu;case"Positive":return mu(t);default:return Tu(t)}}),Bu=r(function(e,t){return f(bu,e,Cu(t))}),ku=function(e){return f(La,r(function(t,r){return e(t)&&Iu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Nu=Ir,Ru=-1+f(Nu,10,7),$u=Ru+1,_u=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Lu=function(e){return e<0?f(_u,Na(-1),Lu(e+$u)):L(e/$u|0,e%$u)},xu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Lu(r+e),i=a.a,o=a.b;return f(ka,o,f(xu,i,n))}{if(!(_(e,$u)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Pu=function(e){var t=e.a;return yu(ku(f(xu,0,t)))},Du=xa(iu),Uu={$:"Negative"},Ou={$:"Positive"},Mu={$:"Zero"},Fu=function(e){switch(e.$){case"Positive":return Uu;case"Negative":return Ou;default:return Mu}},Vu=function(e){for(;;){var t=e.a,r=e.b,n=Pu(r),a=n.a;if(!Su(a))return f(Au,t,yu(a));e=f(Bu,Fu(t),Du(a))}},Ku=pr,Hu=function(e){switch(f(Ku,e,0).$){case"LT":return Uu;case"GT":return Ou;default:return Mu}},ju=function(e){return e<0?-e:e},qu=function(e){return Vu(f(bu,Hu(e),Cu(M([ju(e)]))))},Gu=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(Nu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},zu=function(e){switch(e.$){case"Zer":return wu;case"Neg":var t=e.a;return mu(t);default:return e}},Yu=function(e){return{$:"MagnitudePair",a:e}},Wu=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(ka,L(a,u),f(Wu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Wu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Wu,yr,s))}return yr}),Ju=r(function(e,t){var r=e.a,n=t.a;return Yu(f(Wu,r,n))}),Qu=function(e){switch(e.$){case"Zer":return f(Bu,Mu,yr);case"Neg":var t=e.a.a;return f(Bu,Ou,Du(t));default:var t=e.a.a;return f(Bu,Ou,t)}},Xu=r(function(e,t){var r=Qu(t),n=r.b,a=Qu(e),i=a.b,o=f(Ju,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Vu(f(bu,Ou,Cu(s)))}),Zu=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(R(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 Ta}return a.b.b?ba:f(Ku,e,t)}}),es=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},ts=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(Zu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return es(d(Zu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),rs=r(function(e,t){return R(f(ts,e,t),Ta)}),ns=K,as=r(function(e,t){return!f(rs,e,t)}),is=function(e){switch(e.$){case"Zer":return yu(yr);case"Pos":default:var t=e.a;return t}},os=r(function(e,t){var r=e.a;return Pu(Cu(f(xa,ti(t),r)))}),us=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(os,yu(n),a),u=f(us,yu(i),yu(n)),s=u.a,c=f(Xu,f(Au,Ou,o),f(Au,Ou,yu(f(ka,0,s))));return is(c)}var a=r.a;return f(os,yu(n),a)}return yu(yr)}),ss=function(e){switch(e.$){case"Zer":return Mu;case"Pos":return Ou;default:return Uu}},cs=r(function(e,t){return R(e,Mu)||R(t,Mu)?Mu:R(e,t)?Ou:Uu}),fs=r(function(e,t){return f(Au,f(cs,ss(e),ss(t)),f(us,is(e),is(t)))}),ls=function(e){switch(e.$){case"Zer":return wu;case"Pos":var t=e.a;return Tu(t);default:var t=e.a;return mu(t)}},ds=r(function(e,t){return f(Xu,e,ls(t))}),hs=qu(0),ps=a(function(e,t,r,n){if(e){var a=qu(e),i=f(fs,f(fs,a,n),t),o=f(as,i,r)?L(f(fs,a,t),f(ds,r,i)):L(hs,r),u=o.a,s=o.b,c=d(ps,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Xu,u,l),h)}return L(hs,r)}),gs=Fa(f(Va,2,Ru)),vs=n(function(e,t,r){return d(ps,f(Nu,2,gs),e,t,r)}),ys=qu(1),ms=r(function(e,t){return e}),bs=n(function(e,t,r){return l(Ra,ms(e),t,f(Ai,1,r))}),Cs=function(e){return l(bs,fs(qu($u)),ys,e)},Es=n(function(e,t,r){if(e){var n=l(vs,Cs(e),t,r),a=n.a,i=n.b,o=l(Es,e-1,i,r),u=o.a,s=o.b;return L(f(Xu,a,u),s)}return l(vs,Cs(e),t,r)}),Ss=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Ts=r(function(e,t){if(R(t,hs))return ci;var r=Ti(Ss(e))-Ti(Ss(t))+1,n=l(Es,f(ei,0,r),zu(e),zu(t)),a=n.a,i=n.b;return si(L(f(Au,f(cs,ss(e),ss(t)),is(a)),f(Au,ss(e),is(i))))}),ws=f(fs,qu(2),qu(2147483648)),Is=xr,As=function(e){return f(Is,e,"")},Bs=Pn,ks=n(function(e,t,r){return e<=0?r:l(ks,e>>1,U(t,t),1&e?U(r,t):r)}),Ns=r(function(e,t){return l(ks,e,t,"")}),Rs=n(function(e,t,r){return U(f(Ns,e-Qo(r),As(t)),r)}),$s=te,_s=Ar,Ls=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},xs=r(function(e,t){for(;;){if(t<16)return f(ka,Ls(t),e);var r=f(ka,Ls(f(_s,16,t)),e),n=t/16|0;e=r,t=n}}),Ps=function(e){return $s(e<0?f(ka,P("-"),f(xs,yr,-e)):f(xs,yr,e))},Ds=function(e){var t=f(Ts,e,ws);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=Ps(Gu(a));return R(n,qu(0))?i:U(Ds(n),l(Rs,8,P("0"),i))},Us=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,yu(yr))?"0":Ds(mu(t));default:var t=e.a;return"-"+Us(f(fs,qu(-1),e))}},Os=function(e){return l(Rs,64,P("0"),e)},Ms=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(Ps(a)),c=function(e){return U(e,n)}(Os(Ps(u)));return x(a+32+(Qo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Fs=Dr,Vs=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))))}),Ks=n(function(e,t,n){return l(Fs,r(function(t,r){return l(Vs,e,yi(t),r)}),t,n)}),Hs=function(e){return $a(l(Ks,ka,yr,e))},js=function(e){return f(Ri,"",f(xa,f(zo,Ps,f(Rs,2,P("0"))),Hs(e)))},qs=function(e){return 64-f(_s,64,e)},Gs=function(e){return U(e,f(Ns,qs(Qo(e)),"0"))},zs=function(e){return L(si(Qo(e)/2|0),Gs(e))},Ys=function(e){return L(ci,Os(e))},Ws=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Js=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"}},Qs=Ur,Xs=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(Is,P("1"),r),!0);case"1":return L(f(Is,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Is,P("0"),r),!1);case"1":return L(f(Is,P("1"),r),!0);default:break e}return L(r,!0)});return l(Qs,t,L("",!1),e).a},Zs=function(e){return l(Qs,ka,yr,e)},ec=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Zo,e,t),i=f(ka,l(Xo,0,e,t),r);e=n,t=a,r=i}}),tc=r(function(e,t){return e&&""!==t?l(ec,e,t,yr):M([t])}),rc=function(e){var t=function(){var t=Zs(Us(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(zo,Xs,f(Rs,256,P("1"))))}var r=t;return L(r,f(Rs,256,P("0")))}(),r=t.a,n=t.b;return $s(f(xa,Ws,f(tc,4,n(f(Ri,"",f(xa,Js,r))))))},nc=function(e){return{$:"Hex",a:e}},ac=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Ys(t);case"UintE":var r=e.a;return Ys(Us(r));case"IntE":var n=e.a;return Ys(rc(n));case"BoolE":return Ys(e.a?"1":"0");case"DBytesE":var a=e.a.a;return zs(a);case"BytesE":var a=e.a.a;return Ys(cu(a));case"StringE":var i=e.a;return zs(js(i));case"ListE":var o=e.a;return function(e){var t=e.a;return zs(t)}(Xt()(o));default:var i=e.a;return Ys(cu(i))}};try{var ic=Xt();Xt=function(){return ic}}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 oc=Pr,uc=function(e){return 1===Qo(e)?f(oc,"0",e):e},sc=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(ka,n,r);e=i,t=o,r=u}}}),cc=r(function(e,t){return $a(l(sc,e,t,yr))}),fc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(cc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(fc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),lc=r(function(e,t){return l(fc,0,e,t)}),dc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),hc=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 Pt(e.a)}},pc={$:"LE"},gc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,pc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,pc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,pc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,pc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,pc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,pc));case"Seq":var i=e.b;return l(vc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),vc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(gc,n,t,r);e=i,t=o,r=u}}),yc=Dt,mc=r(function(e,t){return{$:"Seq",a:e,b:t}}),bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+hc(r),i=n;e=a,t=i}}),Cc=function(e){return f(mc,f(bc,0,e),e)},Ec=function(e){return{$:"U8",a:e}},Sc=Ec,Tc=r(function(e,t){return _(e,t)<0?e:t}),wc=hr,Ic=function(e){return{$:"Bytes",a:e}},Ac=Ic,Bc=function(e){return yc(Cc(f(xa,Ac,$a(e))))},kc=Pt,Nc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Rc=function(e){return{$:"Decoder",a:e}},$c=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}}),_c=r(function(e,t){return Rc(f($c,e,t))}),Lc=Rc(Yn),xc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Pc=function(e){return{$:"Done",a:e}},Dc=function(e){return{$:"Loop",a:e}},Uc=r(function(e,t){var n=t.a;return Rc(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 Rc(r(function(t,r){return L(r,e)}))},Mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Oc(Pc($a(n))):f(Uc,function(e){return Dc(L(r-1,f(ka,e,n)))},e)}),Fc=function(e){return f(xc,yr,f(Nc,f(_c,L(kc(e),yr),Mc(Lc)),e))},Vc=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))}),Kc=r(function(e,t){return l(Vc,Bs,e,t)}),Hc=f(Ai,0,4),jc=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}}),qc=xt,Gc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),zc=function(e){return f(Gc,f(zo,qc,Bs(4294967295)),e)},Yc=r(function(e,t){return 5*t+e}),Wc=4294967295>>>32-Ha,Jc=ar,Qc=n(function(e,t,r){for(;;){var n=Wc&t>>>e,a=f(Jc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Jc,Wc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Xc=function(e){return e>>>5<<5},Zc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Xc(r))>-1?f(Jc,Wc&e,i):l(Qc,n,e,a))}),ef=r(function(e,t){var r=f(Zc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),tf=n(function(e,t,r){var n=f(Yc,e,t);return f(ef,n,r)}),rf=ir,nf=a(function(e,t,r,n){var a=Wc&t>>>e,i=f(Jc,a,n);if("SubTree"===i.$){var o=i.a,u=d(nf,e-Ha,t,r,o);return l(rf,a,za(u),n)}var s=i.a,c=l(rf,Wc&t,r,s);return l(rf,a,Ga(c),n)}),af=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,Xc(n))>-1?d(Ma,n,a,i,l(rf,Wc&e,t,o)):d(Ma,n,a,d(nf,a,e,t,i),o)}),of=n(function(e,t,r){return l(af,e,t,r)}),uf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(of,a,r,n)}),sf=Dn,cf=r(function(e,t){return l(Vc,sf,e,t)}),ff=function(e){var t=l(La,r(function(t,n){var a={d0:l(tf,0,t,e.state),d1:l(tf,1,t,e.state),d2:l(tf,2,t,e.state),d3:l(tf,3,t,e.state),d4:l(tf,4,t,e.state)},i=r(function(e,r){return d(uf,e,t,f(cf,f(jc,e,a),f(Kc,zc(f(jc,f(_s,5,e+1),a)),f(jc,f(_s,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Hc);return D(e,{state:t})},lf=L(0,0),df=function(e){return{current:lf,lfsrstate:1,state:e,x:1,y:0}},hf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},pf=L(1,0),gf=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),vf=r(function(e,t){if(e){var n=f(gf,1,t);return l(Vc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),yf=r(function(e,t){var r=f(_s,32,e/32|0),n=f(gf,r,t),a=f(_s,32,e);return f(vf,a,n)}),mf=n(function(e,t,r){var n=f(Zc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(af,e,t(a),r)}),bf=n(function(e,t,r){return l(mf,e,cf(t),r)}),Cf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(bf,a,r,n)}),Ef=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Nf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Tc,n,r),i=f(xa,function(e){return f(kf,e,g)},f(Ai,0,a)),o=Bf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(lc,i.outputLen,l(v,g,yr,i.outputLen))},Lf=function(e){return{$:"KS",a:e}},xf=function(e){var t=e.a;return Lf({config:t,inputLength:0,partial:yr,state:f(ui,25,ms(lf))})},Pf=function(e){return Rc(Wn(e))},Df=yc(Cc(yr)),Uf=r(function(e,t){var n=t.a;return Rc(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(Uf,function(e){return Pf(t)},Pf(e))}),Mf=r(function(e,t){return f(xc,Df,f(Nc,f(Of,e,kc(t)-e),t))}),Ff=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=kc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+kc(e)}),0,i),a)>-1))return Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:i}));var o=Bc(i),u=f(xc,Df,f(Nc,Pf(a),o)),s=Fc(u),c=f($f,s,n.state),d=Bf(c),h=f(Mf,a,o),p=Df,g=Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Vf=r(function(e,t){return _f(f(Ff,yc(Cc(f(xa,Sc,t))),xf(e)))}),Kf=Vf(dc),Hf=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,4,Kf(f(xa,yi,Zs(e)))))))},jf=function(e){return f(su,"0x",e)||f(su,"0X",e)?e:"0x"+e},qf=function(e){var t=e.a;return jf(t)},Gf=r(function(e,t){var r=Ms(f(xa,ac,t)),n=function(e){return U(e,r)}(cu(qf(Hf(e))));return nc(n)}),zf=function(e){return{data:si(f(Gf,"poke()",yr)),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yf=r(function(e,t){return D(t,{checked:e})}),Wf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Jf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Wf,f(zo,function(e){return e.type_},Ja(r)),function(e){return D(e,{options:l(Wf,f(zo,function(e){return e.label},Ja(n)),Yf(a),e.options)})},t)}),Qf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Xf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zf={$:"Descending"},el=function(e){return"Ascending"===e.$?Zf:Lo},tl=function(e){return d(Xf,e,Do,Fo,yr)},rl=r(function(e,t){return L(t.a,e(t.b))}),nl=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Xf,t,Do,Fo,M([da(f(Qf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(rl,el,t.orderBy):L(a,Lo);return tl(D(t,{orderBy:i}));default:return tl(t)}}),al=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},il=yn,ol=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=al(zf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(qo,a,n);return d(Oo,t,Do,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Oo,t,Do,Fo,M([da(f(Qf,o,u))]));case"FiltersMsg":var s=e.a;return Ho(D(t,{filters:f(Jf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(nl,c,t.tradeTable);return d(Oo,D(t,{tradeTable:l.model}),f(il,Ko,l.cmd),f(Yo,Ko,l.chainCmd),f(xa,Ji(Ko),l.appCmds));default:return Vo(t)}}),ul={$:"BottomRight"},sl={$:"ShouldBeImpossible"},cl=lr,fl=function(e){return qi(e)},ll=r(function(e,t){f(cl,e,t);return{align:ul,label:"unexpectedError",mainParagraphs:M([M([fl(e)])]),noticeType:sl}}),dl=function(e){var t=e.a;return jf(t)},hl=ye,pl=f(zo,dl,hl),gl=f(zo,Us,f(zo,jf,hl)),vl=f(zo,qf,hl),yl=f(zo,Ps,f(zo,jf,hl)),ml=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),bl=un,Cl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},El=function(e){return Cl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(xc,bl,r))},f(ml,function(e){e.a;return!R(e.b,ci)},e)))},Sl=function(e){return El(M([L("to",f(Bo,pl,e.to)),L("from",f(Bo,pl,e.from)),L("gas",f(Bo,yl,e.gas)),L("gasPrice",f(Bo,gl,e.gasPrice)),L("value",f(Bo,gl,e.value)),L("data",f(Bo,vl,e.data)),L("nonce",f(Bo,yl,e.nonce))]))},Tl=function(e){return{$:"TxSentry",a:e}},wl=ye,Il=r(function(e,t){return Cl(M([L("ref",wl(e)),L("txParams",t)]))}),Al=function(e){return{$:"Signing",a:e}},Bl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Al(e)}}),kl={$:"Black"},Nl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Rl={$:"RBEmpty_elm_builtin"},$l={$:"Red"},_l=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(Nl,$l,t,r,h(Nl,kl,c,f,l,d),h(Nl,kl,i,o,u,s))}return h(Nl,e,i,o,h(Nl,$l,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(Nl,$l,c,f,h(Nl,kl,g,v,y,m),h(Nl,kl,t,r,d,a))}return h(Nl,e,t,r,n,a)}),Ll=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Nl,$l,e,t,Rl,Rl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ku,e,a).$){case"LT":return h(_l,n,a,i,l(Ll,e,t,o),u);case"EQ":return h(Nl,n,a,t,o,u);default:return h(_l,n,a,i,o,l(Ll,e,t,u))}}),xl=n(function(e,t,r){var n=l(Ll,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(Nl,kl,a,i,o,u)}return n}),Pl=n(function(e,t,r){var n=e.a,a=Sl(r),i=l(xl,n.ref,f(Bl,r,t),n.txs);return L(Tl(D(n,{ref:n.ref+1,txs:i})),f(il,n.tagger,n.outPort(f(Il,n.ref,a))))}),Dl=Pl,Ul=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Do,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Dl,n,i,o))}return x(ci,Do,M([f(ll,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ol=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Ml=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Fl=function(e){return{$:"Posix",a:e}},Vl=Fl,Kl={autoabortInterval:Vl(0),autorecallInterval:Vl(0),autoreleaseInterval:Vl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Hl=function(e){return{$:"TokenValue",a:e}},jl=function(e){return e.a},ql=r(function(e,t){return f(xc,hs,f(Bo,Qa,f(Ts,e,t)))}),Gl=r(function(e,t){return Hl(f(ql,jl(e),qu(t)))}),zl=function(e){return f(Gl,e,12)},Yl=function(e){return f(Gl,e,3)},Wl=Hl(qu(0)),Jl=r(function(e,t){var r=Wl;return{abortPunishment:zl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Ql=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Xl=qr,Zl=function(e){var t=Ql(f(Xl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Qo(e)-1-r;return L(U(f(ru,r,e),f(Zo,r+1,e)),n)},ed=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 yr}}),td=function(e){var t=e.a,r=f(ed,Ja(0),t);return yu(r.b?t:yr)},rd=Z,nd=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}}}),ad=n(function(e,t,r){var n=f(nd,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(lc,e,r),l(ad,e,t,n)):yr}),id=r(function(e,t){return l(ad,e,e,t)}),od=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Bo,ka(a),r)});return f(La,t,si(yr))}(Ua),ud=function(e){return f(Bo,f(Da,td,yu),od(f(xa,f(zo,$a,f(zo,$s,rd)),f(id,7,$a(e)))))},sd=Q,cd=function(e){var t=Zs(sd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,Au(Uu),ud(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Bo,Au(Ou),ud(r))}return ci;default:var r=t;return f(Bo,Au(Ou),ud(r))}},fd=function(e){var t=function(e){return!f(_s,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(xc,0,Ql(r)))}},ld=function(e){return f(fs,e,e)},dd=qu(2),hd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ys;case"Neg":return wu;default:if(R(r,ys))return f(fs,e,t);if(fd(r)){var n=e,a=ld(t),i=f(ql,r,dd);e=n,t=a,r=i;continue e}var n=f(fs,t,e),a=ld(t),i=f(ql,f(ds,r,ys),dd);e=n,t=a,r=i;continue e}}),pd=r(function(e,t){return l(hd,ys,e,t)}),gd=function(e){if(""===e)return ci;var t=Zl(e),r=t.a,n=t.b,a=cd(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(fs,o,f(pd,qu(10),qu(i)));return si(u)},vd=function(e){return f(Bo,Hl,gd(e))},yd=jr,md=function(e){for(;;){if(f(yd,".",e))return l(Xo,0,-1,e);{if(!f(yd,"0",e))return""===e?"0":e;e=l(Xo,0,-1,e)}}},bd=f(Da,f(Rs,7,P("0")),Ni),Cd=function(e){return f(Ri,"",e)},Ed=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Cd(f(ka,Ni(n),f(xa,bd,a)))}return"0"},Sd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Ed(t);default:var t=e.a;return"-"+Ed(t)}},Td=r(function(e,t){return e<1?t:l(Xo,0,-e,t)}),wd=function(e){var t=l(Rs,18,P("0"),Sd(e)),r=f(Td,18,t)+"."+f(ou,18,t);return function(e){return""===e?"0":e}(md(r))},Id=r(function(e,t){var r=wd(t),n=Ql(f(Xl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(ru,a+1+e,r):f(ru,a,r)}),Ad=r(function(e,t){if("Nothing"===e.$)return wd(jl(t));var r=e.a;return f(Id,r,jl(t))}),Bd=ee,kd=function(e){var t=Bd(f(Ad,ci,e));if("Just"===t.$){return t.a}f(cl,"Error converting tokenValue to float: string -> float failed",e);return 0},Nd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=vd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return kd(r)<1?fi("Trade amount can't be less than 1."):li(r)},Rd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=cd(e);if("Nothing"===t.$){var r=Bd(e);return fi("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 li(n)},$d=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),_d=function(e){return""===e},Ld=function(e){return _d(e)?ci:si(e)},xd=function(e){return f($d,"You must specify a fiat type.",Ld(e))},Pd=function(e){return""===e?fi("Must specify a payment method."):li(e)},Dd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ud=g(Dd,ci,ci,ci,ci,ci,ci,ci),Od=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Md=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Fd={$:"Custom"},Vd=r(function(e,t){return{info:t,type_:e}}),Kd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Hd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),jd=function(e){return e.a},qd=function(e){return p(Kd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Vd,Fd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Hd,function(e){return D(Ud,{daiAmount:si(e)})},Nd(e.daiAmount)),f(Hd,function(e){return D(Ud,{fiatAmount:si(e)})},Rd(e.fiatAmount)),f(Hd,function(e){return D(Ud,{fiatType:si(e)})},xd(e.fiatType)),f(Hd,function(e){return D(Ud,{paymentMethod:si(e)})},Pd(e.paymentMethod)),Od(d(Md,function(e){return jd(e)>0?li(e):fi(D(Ud,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Gd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},zd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Yd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Wd=function(e){var t=qd(e.inputs),r=function(){return R(e.errors,Ud)?Ud:"Ok"===t.$?Ud:t.a}();return D(e,{createParameters:l(zd,Jl,Gd(e.wallet),Yd(t)),errors:r})},Jd=r(function(e,t){return Wd(D(t,{inputs:e}))}),Qd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Xd=function(e){return d(Qd,f(Jd,Kl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:Ud,inputs:Kl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Do,Fo,yr)},Zd=a(function(e,t,r,n){return la(d(Ol,e,t,r,n))}),eh=function(e){return{$:"Address",a:e}},th=f(zo,cu,f(zo,sd,eh)),rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return th("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return th("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return th("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return th("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nh=function(e){return th("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ah=function(e){return{$:"AddressE",a:e}},ih=ah,oh=function(e){return{$:"UintE",a:e}},uh=oh,sh=n(function(e,t,r){return{data:si(f(Gf,"approve(address,uint256)",M([ih(t),uh(r)]))),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ch=function(e){return f(Gl,e,200)},fh=r(function(e,t){return Hl(f(Xu,jl(e),jl(t)))}),lh=function(e){var t=f(Gl,e.tradeAmount,200);return f(fh,e.pokeReward,f(fh,ch(e.tradeAmount),f(fh,t,function(){return"Buyer"===e.initiatorRole.$?Yl(e.tradeAmount):e.tradeAmount}())))},dh=Mi(ya),hh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ph=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gh=Xn,vh=Qn,yh=function(e){return f(vh,{caseInsensitive:!1,multiline:!1},e)},mh=Jn,bh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ch=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}}),Eh=r(function(e,t){return!f(Ch,f(Da,ns,e),t)}),Sh=Eh(Ua),Th=q,wh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ih=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Ah=f(La,Ih(ka),li(yr)),Bh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},kh=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Nu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Nu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Nu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Nu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Nu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Nu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Nu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Nu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Nu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Nu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Nu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Nu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Nu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Nu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Nu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(As(s)+" is not a valid hexadecimal character.")}}}),Nh=function(e){if(_d(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(su,"-",e)){var t=f(xc,yr,Bh(Zs(e)));return f(au,iu,l(kh,Ti(t)-1,t,0))}return l(kh,Qo(e)-1,Zs(e),0)}();return f(Hd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rh=function(e){var t=Zs(e);return function(e){return L(t,e)}(f(wh,yr,Ah(f(xa,Nh,f(_i,"",f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,20,Kf(f(xa,f(zo,Th,yi),t))))))))))},$h=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Rh(cu(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!bh(e)&&Sh(o)},_h=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-f]{40}$"))),Lh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-F]{40}$"))),xh=function(e){return'"'+e+'"'},Ph=function(e){var t=cu(e),r=f(ru,24,t),n=f(ou,40,e);return 64===Qo(t)&&f(ki,Ja(P("0")),r)?Lh(n)||_h(n)?li(eh(n)):$h(n)?li(eh(n)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):40!==Qo(t)?fi("Given address "+xh(e)+" is not the correct length."):bh(t)?Lh(t)||_h(t)?li(eh(t)):$h(t)?li(eh(t)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):fi("Given address "+xh(e)+" contains invalid hex characters.")},Dh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),Ph(nu(r)))}),Uh=r(function(e,t){var r=t.a;return Wo(function(t){var n=t.a,a=t.b;return r(f(Jo,n,f(Zo,64*e,a)))})}),Oh=Jr,Mh=r(function(e,t){return f(Oh,"data",vu(f(Uh,e,t)))}),Fh=Qr,Vh=r(function(e,t){return f(Oh,"topics",f(Fh,e,vu(t)))}),Kh=function(e){return f(Bo,f(zo,$a,f(Ra,r(function(e,t){return f(Xu,qu(e),f(fs,t,ws))}),hs)),od(f(xa,f(zo,$a,f(zo,$s,f(zo,Nh,Yd))),f(id,8,$a(e)))))},Hh=function(e){var t=Zs(sd(e));e:for(;;){if(!t.b)return ci;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(Bo,fs(qu(-1)),Kh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Bo,fs(qu(-1)),Kh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Kh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kh(a)}t.b;return ci}break e;default:break e}}var a=t;return Kh(a)},jh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f($d,"Error Decoding Uint into BigInt",Hh(jf(nu(r)))))}),qh=f(dh,f(Vh,1,Dh),f(dh,f(Mh,1,Dh),f(dh,f(Mh,0,jh),Fi(hh)))),Gh=nn,zh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Yh=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(Gh,e,Cl(M([L("data",hl(t.data)),L("topics",f(zh,vl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Wh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Jh=r(function(e,t){return f(au,function(e){return e.id},f(Wh,function(e){return f(Hd,Di,f(Yh,qh,e).returnData)},f($d,"No log found from that factoryAddress in that txReceipt",Ql(f(ml,function(t){return R(f(zo,dl,sd)(t.address),f(zo,dl,sd)(rh(e)))},t.logs)))))}),Qh=n(function(e,t,r){return{data:si(f(Gf,"allowance(address,address)",M([ih(t),ih(r)]))),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Zh=function(e){switch(e.$){case"BlockNum":var t=e.a;return hl(jf(Ps(t)));case"EarliestBlock":return hl("earliest");case"LatestBlock":return hl("latest");default:return hl("pending")}},ep=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return El(M([L("to",f(Bo,pl,t)),L("from",f(Bo,pl,r)),L("gas",f(Bo,yl,n)),L("gasPrice",f(Bo,gl,a)),L("value",f(Bo,gl,i)),L("data",f(Bo,vl,o))]))},tp=function(e){return{$:"BadBody",a:e}},rp=function(e){return{$:"BadStatus",a:e}},np=function(e){return{$:"BadUrl",a:e}},ap={$:"NetworkError"},ip={$:"Timeout"},op=rn,up=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(np(r));case"Timeout_":return fi(ip);case"NetworkError_":return fi(ap);case"BadStatus_":var n=t.a,a=t.b;return fi(rp(n.statusCode));default:var n=t.a,a=t.b,i=f(op,f(Oh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(tp(Di(u)))}}),sp=n(function(e,t,r){return Cl(M([L("id",wl(e)),L("jsonrpc",hl("2.0")),L("method",hl(t)),L("params",f(zh,Ua,r))]))}),cp=Rl,fp=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ku,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),lp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},dp=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(Nl,$l,p,g,h(Nl,kl,r,n,h(Nl,$l,i,o,u,s),v),h(Nl,kl,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(Nl,kl,r,n,h(Nl,$l,i,o,u,s),h(Nl,$l,f,l,d,m))}return e},hp=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(Nl,$l,i,o,h(Nl,kl,s,c,f,l),h(Nl,kl,r,n,d,h(Nl,$l,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Nl,kl,r,n,h(Nl,$l,i,o,C,d),h(Nl,$l,g,v,y,m))}return e},pp=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(Nl,r,u,s,c,h(Nl,$l,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 hp(t)}break e}o.a,o.d;return hp(t)}break e}return t}),gp=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(Nl,t,r,n,gp(a),u)}var s=dp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(_l,c,f,l,gp(d),p)}return Rl}return h(Nl,t,r,n,gp(a),u)}return Rl},vp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Rl;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(Nl,r,n,a,f(vp,e,i),o)}var s=dp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(_l,c,l,d,f(vp,e,p),v)}return Rl}return h(Nl,r,n,a,f(vp,e,i),o)}return f(yp,e,g(pp,e,t,r,n,a,i,o))}),yp=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(R(e,n)){var u=lp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(_l,r,s,c,i,gp(o))}return Rl}return h(_l,r,n,a,i,f(vp,e,o))}return Rl}),mp=r(function(e,t){var r=f(vp,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(Nl,kl,n,a,i,o)}return r}),bp=n(function(e,t,r){var n=t(f(fp,e,r));if("Just"===n.$){var a=n.a;return l(xl,e,a,r)}return f(mp,e,r)}),Cp=function(e){return"Just"===e.$},Ep=gn,Sp=vn,Tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),wp=function(e){return{$:"BadUrl_",a:e}},Ip=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ap={$:"NetworkError_"},Bp=function(e){return{$:"Receiving",a:e}},kp=function(e){return{$:"Sending",a:e}},Np={$:"Timeout_"},Rp=function(e){return f(ta,"application/json",f(xi,0,e))},$p=n(function(e,t,r){return Rp(l(sp,e,t,r))}),_p=f(ea,"",Ua),Lp=Te,xp=Se,Pp=function(e){if("Ok"===e.$){var t=e.a;return xp(t)}var r=e.a;return Lp(r)},Dp=function(e){return l(Zn,gr,Pp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},Up=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Dp({body:l($p,1,r,n),headers:yr,method:"POST",resolver:_p(up(a)),timeout:ci,url:t})},Op=n(function(e,t,r){return Up({decoder:t.decoder,method:"eth_call",params:M([ep(t),Zh(r)]),url:e})}),Mp={$:"LatestBlock"},Fp=r(function(e,t){return l(Op,e,t,Mp)}),Vp=function(e){return{$:"Perform",a:e}},Kp=sn,Hp=xp(gr),jp=r(function(e,t){return f(Kp,function(t){return xp(e(t))},t)}),qp=n(function(e,t,r){return f(Kp,function(t){return f(Kp,function(r){return xp(f(e,t,r))},r)},t)}),Gp=function(e){return l(La,qp(ka),xp(yr),e)},zp=r(function(e,t){var r=t.a;return Be(f(Kp,Ep(e),r))}),Yp=n(function(e,t,r){return f(jp,function(e){return gr},Gp(f(xa,zp(e),t)))}),Wp=n(function(e,t,r){return xp(gr)}),Jp=r(function(e,t){var r=t.a;return Vp(f(jp,e,r))});pn.Task=Pe(Hp,Yp,Wp,Jp);var Qp=Ue("Task"),Xp=cn,Zp=r(function(e,t){return Qp(Vp(f(Xp,f(Da,f(Da,xp,e),fi),f(Kp,f(Da,f(Da,xp,e),li),t))))}),eg=a(function(e,t,r,n){return f(Zp,n,f(Fp,Xh(eo(e)),l(Qh,nh(e),t,r)))}),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return th("0x092110996699c3E06e998d89F0f4586026e44F0F")}},rg=function(e){return{$:"BoolE",a:e}},ng=rg,ag=function(e){return{$:"StringE",a:e}},ig=ag,og=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ug=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},sg=r(function(e,t){return{paymentMethods:t,price:e}}),cg=function(e){return hl(Sd(e))},fg=function(e){return f(zh,Ua,M([hl(e.fiatType),cg(e.amount)]))},lg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},dg=function(e){return Cl(M([L("type",hl(lg(e.type_))),L("info",hl(e.info))]))},hg=function(e){var t=fg(e.price),r=f(zh,dg,e.paymentMethods);return f(xi,0,Cl(M([L("paymentmethods",r),L("price",t)])))},pg=r(function(e,t){return D(t,{value:si(e)})}),gg=function(e){return qu(jd(e))},vg=function(e){return f(ql,gg(e),qu(1e3))},yg=r(function(e,t){var r=function(){return"Token"===e.$?og:ug}();return function(){return"Native"===e.$?pg(jl(lh(t))):Ua}()(r(rh(e))(t.initiatorAddress)(tg(e))(R(t.initiatorRole,lo))(jl(t.tradeAmount))(jl(Yl(t.tradeAmount)))(jl(zl(t.tradeAmount)))(jl(t.pokeReward))(vg(t.autorecallInterval))(vg(t.autoabortInterval))(vg(t.autoreleaseInterval))(jl(ch(t.tradeAmount)))(hg(f(sg,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),mg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),bg=function(e){return{$:"CreateNeedsSig",a:e}},Cg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Eg=r(function(e,t){var r=al(f(yg,e,t)),n={onBroadcast:ci,onMined:si(L(mg(e),ci)),onSign:si(Cg(e))};return L(si(bg(e)),f(qo,n,r))}),Sg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wg=function(e){return{$:"ApproveNeedsSig",a:e}},Ig=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Bg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),kg={$:"NoOp"},Ng=function(e){return{appCmds:yr,chainCmd:Fo,cmd:Do,model:e}},Rg=function(e){return rd(Sd(e))},$g={$:"Error"},_g=r(function(e,t){f(cl,e+" fetch error",t);return{align:ul,label:"web3FetchError",mainParagraphs:M([M([fl('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:$g}}),Lg=r(function(e,t){return{align:ul,label:"web3MiningError",mainParagraphs:M([M([fl('Error mining "'+e+'" transaction: '+t)])]),noticeType:$g}}),xg={$:"Caution"},Pg=r(function(e,t){return{align:ul,label:"web3SigError",mainParagraphs:M([M([fl('Error signing "'+e+'" transaction: '+t)])]),noticeType:xg}}),Dg={$:"KovanDai"},Ug=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Dg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Og=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Mg=function(e){return f(Io,Ug,Og(e))},Fg=r(function(e,t){return 1-e(1-t)}),Vg=function(e){return f(Nu,e,5)},Kg=Fg(Vg),Hg={easing:Kg,offset:12,speed:200},jg=function(e){return{$:"External",a:e}},qg=function(e){return{$:"Internal",a:e}},Gg=function(e){return{$:"NotFound",a:e}},zg=function(e){for(;;){e=e.a}},Yg=r(function(e,t){return Qp(Vp(f(jp,e,t)))}),Wg={$:"Http"},Jg={$:"Https"},Qg=Kr,Xg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Zg=i(function(e,t,r,n,a){if(_d(a)||f(Qg,"@",a))return ci;var i=f(Xl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=rd(f(Zo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Xg,e,f(ru,o,a),s,t,r,n))}return si(p(Xg,e,a,ci,t,r,n))}),ev=a(function(e,t,r,n){if(_d(n))return ci;var a=f(Xl,"/",n);if(a.b){var i=a.a;return h(Zg,e,f(Zo,i,n),t,r,f(ru,i,n))}return h(Zg,e,"/",t,r,n)}),tv=n(function(e,t,r){if(_d(r))return ci;var n=f(Xl,"?",r);if(n.b){var a=n.a;return d(ev,e,si(f(Zo,a+1,r)),t,f(ru,a,r))}return d(ev,e,ci,t,r)}),rv=r(function(e,t){if(_d(t))return ci;var r=f(Xl,"#",t);if(r.b){var n=r.a;return l(tv,e,si(f(Zo,n+1,t)),f(ru,n,t))}return l(tv,e,ci,t)}),nv=function(e){return f(su,"http://",e)?f(rv,Wg,f(Zo,7,e)):f(su,"https://",e)?f(rv,Jg,f(Zo,8,e)):ci},av=Wt,iv=Gt(zt),ov=sa,uv=r(function(e,t){return L(e,t)}),sv=_r,cv=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=ju(r-n),o=f(ei,1,sv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),fv=r(function(e,t){var n=r(function(t,r){return Gp(f(xa,ov(0),d(cv,e.speed,e.easing,t,r-e.offset)))});return f(Kp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(qp,uv,iv,av(t)))}),lv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Gd(t.wallet),Mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(eg,a,n.address,rh(eo(a)),Sg(a));return d(Qd,t,i,Fo,yr)}return Ng(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Qd,D(t,{inputs:D(u,{userRole:o})}),Do,Fo,M([function(){return"Buyer"===o.$?d(Zd,"create offer type changed","input","sell dai",0):d(Zd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ng(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ng(f(Jd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Qd,(g?Jd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Do,Fo,g?M([d(Zd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=qd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jl,n,m);return Ng(D(t,{depositAmount:si(jl(lh(b))),txChainStatus:si(f(Ag,v,b))}))}var C=y.a;return d(Qd,D(t,{errors:C}),f(Zp,ms(kg),function(){return f(fv,D(Hg,{offset:60}),"inputError")}()),Fo,yr);case"AbortCreate":return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([d(Zd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Eg,v,b);var e=v.a,r=function(){var t=al(l(sh,nh(e),rh(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Ig,e,b))};return f(qo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(ts,a,E),ba)?L(si(wg(e)),r):f(Eg,v,b)}return L(si(wg(e)),r)}(),T=S.a,w=S.b;return d(Qd,D(t,{txChainStatus:T}),Do,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(l(Tg,a,b,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(ts,N,P),ba))return Ng($);var U=f(Eg,eo(a),b),T=U.a,w=U.b;return d(Qd,D($,{txChainStatus:T}),Do,w,yr)}return Ng($)}var O=k.a;return d(Qd,t,Do,Fo,M([pa(f(_g,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(f(Bg,v,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Qd,t,Do,Fo,M([pa(f(Lg,"create",B))]))}var F=e.a,V=e.b.a,K=f(Io,Rg,Yd(f(Jh,F,V)));if("Just"===K.$){var H=K.a;return d(Qd,t,Do,Fo,M([da(f(Qf,F,H))]))}return d(Qd,t,Do,Fo,M([pa(f(ll,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Qd,t,Do,Fo,M([ga]));case"NoOp":return Ng(t);default:var j=e.a;return d(Qd,t,Do,Fo,M([j]))}}),dv=r(function(e,t){return f(Eh,function(e){return f(Ch,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),hv=r(function(e,t){return f(Ku,jd(e),jd(t))}),pv=r(function(e,t){return R(f(hv,t.derived.phaseEndTime,e),Ta)}),gv=function(e){if(""===e)return li(ci);var t=vd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},vv=r(function(e,t){return{maxDai:t,minDai:e}}),yv=f(vv,ci,ci),mv=function(e){return l(Ih,r(function(t,r){return{dai:{max:r,min:t},fiatType:Ld(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Hd,function(e){return D(yv,{minDai:si(e)})},gv(e.minDai)),f(Hd,function(e){return D(yv,{maxDai:si(e)})},gv(e.maxDai)))},bv=r(function(e,t){var r=function(t){return f(Eh,function(e){return f(Qg,sd(e),sd(t))},e)};return f(Ch,function(e){return r(e.info)},t)}),Cv=r(function(e,t){return D(t,{paymentMethod:e})}),Ev=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Sv=r(function(e,t){return f(ts,jl(e),jl(t))}),Tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return wv(D(e,{inputs:f(Ev,r,f(Cv,"",e.inputs))}))},wv=function(e){var t=Tv(e),n=mv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(bv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(pv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(dv,t.filters,r)});return D(t,{filterFunc:s})},Iv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Av={$:"Expires"},Bv=function(e){return L(wv({errors:yv,filterFunc:pv,filters:co(M([f(vo,!0,!0),d(So,!0,!1,!1,!1)])),inputs:Iv,showCurrencyDropdown:!1,tradeTable:_o(L(Av,Lo)),wallet:e}),Do)},kv=r(function(e,t){var r=f(ml,wc(e),t.inputs.paymentMethodTerms);return wv(D(t,{inputs:f(Ev,r,t.inputs)}))}),Nv=function(e){return wv(D(e,{filterFunc:pv,inputs:Iv}))},Rv=function(e){return{$:"TradeTableMsg",a:e}},$v=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),_v=function(e){return d($v,e,Do,Fo,yr)},Lv=r(function(e,t){return D(t,{fiatType:e})}),xv=r(function(e,t){return D(t,{maxDai:e})}),Pv=r(function(e,t){return D(t,{minDai:e})}),Dv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return _v(D(t,{inputs:f(Pv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return _v(D(t,{inputs:f(xv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return _v(D(t,{inputs:f(Lv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return _v(D(t,{inputs:(n?Lv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return _v(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return _v(D(t,{inputs:f(Cv,r,t.inputs)}));case"AddSearchTerm":return _v(Tv(t));case"RemoveTerm":var a=e.a;return _v(f(kv,a,t));case"ApplyInputs":return d($v,wv(t),Do,Fo,yr);case"ResetSearch":return _v(Nv(t));case"FiltersMsg":var i=e.a;return _v(wv(D(t,{filters:f(Jf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(nl,o,t.tradeTable);return d($v,D(t,{tradeTable:u.model}),f(il,Rv,u.cmd),f(Yo,Rv,u.chainCmd),f(xa,Ji(Rv),u.appCmds));case"NoOp":return _v(t);default:var s=e.a;return d($v,t,Do,Fo,M([s]))}}),Uv=a(function(e,t,r,n){return e(Cl(M([L("title",hl(t)),L("body",function(){if("Nothing"===r.$)return bl;var e=r.a;return hl(e)}()),L("image",function(){if("Nothing"===n.$)return bl;var e=n.a;return hl(e)}())])))}),Ov=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Mv=function(e){return e.a+"="+e.b},Fv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Mv,e)):""},Vv=r(function(e,t){return"/"+(f(Ri,"/",e)+Fv(t))}),Kv=function(e){switch(e.$){case"Home":return f(Vv,M(["DAIHard"]),yr);case"Create":return f(Vv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Vv,M(["DAIHard","trade",Ov(t),Ni(r)]),yr);case"Marketplace":return f(Vv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Vv,M(["DAIHard","history",dl(n)]),yr);default:return f(Vv,yr,yr)}},Hv={$:"NotFound"},jv=function(e){return{$:"AgentHistory",a:e}},qv={$:"Create"},Gv={$:"Home"},zv={$:"Marketplace"},Yv=function(e){return{$:"Parser",a:e}},Wv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Jv=r(function(e,t){return Yv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Wv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Qv=f(Jv,"ADDRESS",f(zo,Ph,Yd)),Xv={$:"Eth"},Zv={$:"Kovan"},ey=f(Jv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Xv));case"keth":return si(Zi(Zv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Dg));case"xdai":return si(Zi(to));default:return ci}}),ty=f(Jv,"NUMBER",rd),ry=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Wv,r,n,a,i,e(o))}),ny=r(function(e,t){var r=t.a;return Yv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,ry(u),r(h(Wv,n,a,i,o,e)))})}),ay=function(e){return l(La,oo,yr,e)},iy=r(function(e,t){return ay(f(xa,e,t))}),oy=function(e){return Yv(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 R(u,e)?M([h(Wv,f(ka,u,r),s,a,i,o)]):yr}return yr})},uy=r(function(e,t){var r=e.a,n=t.a;return Yv(function(e){return f(iy,n,r(e))})}),sy=Yv(function(e){return M([e])}),cy=f(uy,oy("DAIHard"),function(e){return Yv(function(t){return f(iy,function(e){return(0,e.a)(t)},e)})}(M([f(ny,Gv,sy),f(ny,qv,oy("create")),f(ny,Qf,f(uy,oy("trade"),f(uy,ey,ty))),f(ny,zv,oy("marketplace")),f(ny,jv,f(uy,oy("history"),Qv)),f(ny,function(e){return jv(e)},f(uy,oy("history"),Qv))]))),fy=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 si(t.value)}return si(t.value)}return ci}},ly=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ly(r))}return yr}return yr},dy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ly(r)}var r=t;return ly(r)},hy=Qt,py=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),gy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=hy(n);if("Nothing"===o.$)return t;var u=o.a,s=hy(i);if("Nothing"===s.$)return t;var c=s.a;return l(bp,u,py(c),t)}return t}),vy=function(e){if("Nothing"===e.$)return cp;var t=e.a;return l(La,gy,cp,f(_i,"&",t))},yy=r(function(e,t){var r=e.a;return fy(r(h(Wv,yr,dy(t.path),vy(t.query),t.fragment,Ua)))}),my=function(e){return f(xc,Hv,f(yy,cy,e))},by=aa,Cy=r(function(e,t){return f(by,e,Kv(t))}),Ey=je("connectToWeb3",function(e){return bl}),Sy=function(e){return Cl(M([L("event",hl(e.event)),L("category",hl(e.category)),L("label",hl(e.label)),L("value",wl(e.value))]))},Ty=r(function(e,t){return Cl(M([L("address",hl(dl(e))),L("signSeedMsg",hl(t))]))}),wy=je("gTagOut",Ua),Iy=je("genPrivkey",Ua),Ay=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),By=n(function(e,t,r){return f(Io,Zc(t),f(Bo,function(e){return e.trades},f(Ay,function(t){return R(t.factory,e)},r)))}),ky=je("notifyPort",Ua),Ny=je("requestNotifyPermissionPort",function(e){return bl}),Ry=r(function(e,t){return D(t,{wallet:e})}),$y=r(function(e,t){return L(f(Jd,t.inputs,D(t,{wallet:e})),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(eg,n,r.address,rh(eo(n)),Sg(n))}return Do}())}),_y=r(function(e,t){return D(t,{wallet:e})}),Ly=function(e){return{$:"AllowanceFetched",a:e}},xy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Gd(e),Mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Mg(e),si(i.factory))?d(eg,a,n.address,i.creationInfo.address,Ly):Do}return Do}())}),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{$:"TradeModel",a:e}},Fy=function(e){return{$:"TradeMsg",a:e}},Vy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Do);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Dy(a),f(il,Uy,i));case"TradeModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(il,Fy,c));case"MarketplaceModel":var l=t.a;return L(Oy(f(_y,e,l)),Do);default:var d=t.a;return L(Py(f(Ry,e,d)),Do)}}),Ky=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Hy=function(e){return{$:"PartiallyLoadedTrade",a:e}},jy=r(function(e,t){return Hy(g(Ky,e,t,ci,ci,ci,ci,ci))}),qy=function(e){return{$:"CurrentBlockFetched",a:e}},Gy=gu(f(zo,cu,Nh)),zy=function(e){return Up({decoder:Gy,method:"eth_blockNumber",params:yr,url:e})},Yy=function(e){return f(Zp,qy,zy(e))},Wy=r(function(e,t){return{address_:e,blocknum:t}}),Jy=function(e){return Wo(function(t){return li(L(t,e))})},Qy=n(function(e,t,r){var n=t.a,a=r.a;return Wo(function(t){return f(Wh,function(t){var r=t.a,n=t.b;return f(au,rl(e(n)),a(r))},n(t))})}),Xy=r(function(e,t){return l(Qy,r(function(e,t){return e(t)}),t,e)}),Zy=vu(f(Xy,jh,f(Xy,Dh,Jy(Wy)))),em=r(function(e,t){return{data:si(f(Gf,"createdTrades(uint256)",M([uh(t)]))),decoder:Zy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tm=n(function(e,t,r){return f(Zp,r,f(Fp,Xh(e),f(em,rh(e),t)))}),rm=function(e){return{$:"CreationInfoFetched",a:e}},nm=r(function(e,t){return l(tm,e,qu(t),rm)}),am=function(e){return{$:"EventSentryMsg",a:e}},im=function(e){return{$:"BlockNumber",a:e}},om=function(e){return{$:"EventSentry",a:e}},um=function(e){return{$:"Set_elm_builtin",a:e}},sm=um(cp),cm=r(function(e,t){return L(om({blockNumber:ci,errors:yr,nodePath:t,pending:sm,ref:1,requests:cp,tagger:e,watching:sm}),f(Zp,f(zo,im,e),zy(t)))}),fm=function(e){return f(cm,am,Xh(e))},lm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},hm=dm(f(lm,ci,ci)),pm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:Co,secureCommInfo:hm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),gm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),vm=n(function(e,t,r){var n=f(nm,t,r),a=fm(t),i=a.a,o=a.b;return d(gm,l(pm,f(jy,t,r),i,e),Po(M([n,o,Yy(Xh(t))])),Fo,M([ha]))}),ym=function(e){return{$:"LoadedTrade",a:e}},mm=function(e){return{$:"EventLogFetched",a:e}},bm=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),Cm=ue,Em=ce,Sm=Yr,Tm=n(function(e,t,r){var n=function(e){return Em(M([e,Cm(r)]))};return f(du,function(a){var i=f(Gh,e,a);if("Ok"===i.$){var o=i.a,u=f(Gh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return hu(Di(c))}return Fi(r)},Sm)}),wm=a(function(e,t,r,n){return f(dh,l(Tm,f(Oh,e,Sm),t,r),n)}),Im=n(function(e,t,r){return f(dh,f(Oh,e,t),r)}),Am=gu(Ph),Bm=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),km=function(e){return{$:"BlockHash",a:e}},Nm=function(e){return Bm(e)?li(km(cu(e))):fi("Given blockHash "+xh(e)+" is not valid.")},Rm=gu(Nm),$m=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),_m=function(e){return $m(e)?li(nc(cu(e))):fi("Something in here is not very hexy: "+xh(e))},Lm=gu(_m),xm=function(e){return{$:"TxHash",a:e}},Pm=function(e){return Bm(e)?li(xm(cu(e))):fi("Given txHash "+xh(e)+" is not valid.")},Dm=gu(Pm),Um=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}}),Om=zr,Mm=oe,Fm=l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionHash",Dm,l(Im,"transactionIndex",Gy,l(Im,"logIndex",Gy,d(wm,"removed",Om,!1,l(Im,"topics",Mm(Lm),l(Im,"data",pu,l(Im,"address",Am,Fi(Um)))))))))),Vm=function(e){return f(zh,function(e){if("Just"===e.$){var t=e.a;return hl(qf(t))}return bl},e)},Km=function(e){return Cl(M([L("fromBlock",Zh(e.fromBlock)),L("toBlock",Zh(e.toBlock)),L("address",pl(e.address)),L("topics",Vm(e.topics))]))},Hm=r(function(e,t){return Up({decoder:Mm(Fm),method:"eth_getLogs",params:M([Km(t)]),url:e})}),jm=function(e){return{$:"BlockNum",a:e}},qm=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Kp,function(r){return f(jp,vi(r),f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)})))},f(Hm,e,t)):f(Hm,e,t)}),Gm=r(function(e,t){var r=t.a;return um(l(xl,e,gr,r))}),zm=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(xl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(om(D(o,{watching:f(Gm,a.ref,o.watching)})),f(Zp,f(zo,bm(a.ref),a.tagger),e),a.ref)}(l(qm,a.nodePath,n,L(s,s)))}return x(om(D(o,{pending:f(Gm,a.ref,o.pending)})),Do,a.ref)}),Ym=zm(!1),Wm=r(function(e,t){var r=function(){var e=fm(t.factory),r=e.a,n=e.b;return function(e){var t=e.a,r=e.b,a=e.c;return x(t,Po(M([n,r])),a)}(l(Ym,mm,r,{address:t.creationInfo.address,fromBlock:jm(t.creationInfo.blocknum),toBlock:Mp,topics:yr}))}(),n=r.a,a=r.b;return d(gm,l(pm,ym(t),n,e),Po(M([a,Yy(Xh(t.factory))])),Fo,M([ha]))}),Jm=function(e){return{data:si(f(Gf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Qm=function(e){return{data:si(f(Gf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Xm=function(e){return{data:si(f(Gf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Zm=r(function(e,t){return{data:si(f(Gf,"initiatorStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),eb=function(e){return{data:si(f(Gf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},tb=function(e){return{data:si(f(Gf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},rb=r(function(e,t){return{data:si(f(Gf,"responderStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),nb=r(function(e,t){return{amount:t,fiatType:e}}),ab=f(du,function(e){var t=cd(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("Can't convert that to a BigInt")},pu),ib=l(Mi,nb,f(Fh,0,pu),f(Fh,1,ab)),ob={$:"Bank"},ub={$:"Cash"},sb=function(e){switch(e){case"cash":return si(ub);case"bank":return si(ob);case"custom":return si(Fd);default:return ci}},cb=f(du,function(e){var t=sb(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("")},pu),fb=l(Mi,Vd,f(Oh,"type",cb),f(Oh,"info",pu)),lb=function(e){var t=l(Mi,sg,f(Oh,"price",ib),f(Oh,"paymentmethods",Mm(fb)));return f(op,t,e)},db=r(function(e,t){return{commPubkey:t,responder:e}}),hb=r(function(e,t){var n=r(function(t,r){return l(Xo,t,t+2*r,e)}),a=f(zo,Nh,au(ti(2)));return f(Wh,function(t){return f(au,function(e){return f(n,t+64,e)},Nh(l(Xo,t,t+64,e)))},a(t))}),pb=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),gb=n(function(e,t,r){var n=l(Ra,pb(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),vb=j,yb=function(e){return As(vb(e))},mb=function(e){return l(gb,r(function(e,t){return U(t,yb(e))}),"",e)},bb=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f(Wh,mb,f(Wh,f(zo,xa(Nh),Ah),f(au,ml(f(zo,_d,ns)),f(au,tc(2),f(hb,t,nu(r)))))))}),Cb=f(dh,f(Mh,1,bb),f(dh,f(Mh,0,Dh),Fi(db))),Eb=r(function(e,t){return{commPubkey:t,terms:e}}),Sb=f(dh,f(Mh,1,bb),f(dh,f(Mh,0,bb),Fi(Eb))),Tb=function(e){return{statement:e}},wb=f(dh,f(Mh,0,bb),Fi(Tb)),Ib=function(e){return{statement:e}},Ab=f(dh,f(Mh,0,bb),Fi(Ib)),Bb={$:"AbortedEvent"},kb={$:"BurnedEvent"},Nb={$:"ClaimedEvent"},Rb=function(e){return{$:"CommittedEvent",a:e}},$b=function(e){return{$:"InitiatedEvent",a:e}},_b=function(e){return{$:"InitiatorStatementLogEvent",a:e}},Lb={$:"PokeEvent"},xb={$:"RecalledEvent"},Pb={$:"ReleasedEvent"},Db=function(e){return{$:"ResponderStatementLogEvent",a:e}},Ub=f(Oh,"topics",f(Fh,0,Lm)),Ob=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),Kf(f(xa,yi,Zs(e))))))},Mb=f(du,function(e){return R(e,Ob("Initiated(string,string)"))?f(Oi,$b,Sb):R(e,Ob("Committed(address,string)"))?f(Oi,Rb,Cb):R(e,Ob("Recalled()"))?Fi(xb):R(e,Ob("Claimed()"))?Fi(Nb):R(e,Ob("Aborted()"))?Fi(Bb):R(e,Ob("Released()"))?Fi(Pb):R(e,Ob("Burned()"))?Fi(kb):R(e,Ob("InitiatorStatementLog(string)"))?f(Oi,_b,wb):R(e,Ob("ResponderStatementLog(string)"))?f(Oi,Db,Ab):R(e,Ob("Poke()"))?Fi(Lb):hu("Unrecognized topic hash")},Ub),Fb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},Vb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},Kb=function(e){return R(e.buyerDeposit,Yl(e.tradeAmount))&&R(e.abortPunishment,zl(e.tradeAmount))},Hb={$:"Invalid"},jb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),qb=r(function(e,t){return Vl(jd(t)+jd(e))}),Gb=function(e){var t=Bd(Sd(e.amount));if("Just"===t.$){return t.a}f(cl,"Error converting FiatValue to float--string -> float failed!",e);return 0},zb=r(function(e,t){return(t-e)/e}),Yb=r(function(e,t){var r=Gb(t),n=kd(e);return"USD"===t.fiatType?si(f(zb,n,r)):ci}),Wb=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 Vl(0)}}();return{margin:f(Yb,e.tradeAmount,r.price),phaseEndTime:function(){return"Closed"===t.phase.$?Vl(f(Nu,2,53)-1):f(qb,t.phaseStartTime,n)}()}}),Jb=function(e){var t=x(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 ym(v(jb,e.factory,e.id,n,a,o,u,s,l(Wb,a,o,u)))}return Hy(e)},Qb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(cl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Hb}}),Xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Hb}}),Zb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Hb}}),eC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return ym(D(n,{state:e}));default:return Hb}}),tC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Hb}}),rC=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}}),nC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,uu,f(Xy,Dh,Jy(rC))))))))))),aC=function(e){return{data:si(f(Gf,"getParameters()",yr)),decoder:nC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},iC=function(e){return f(Bo,function(e){return Vl(1e3*e)},rd(Sd(e)))},oC=function(e){return Hl(e)},uC=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),sC=function(e){var t=f($d,"error converting BigInt to Time.Posix",iC(e.autoabortInterval)),r=f($d,"error converting BigInt to Time.Posix",iC(e.autoreleaseInterval)),a=f($d,"error converting BigInt to Time.Posix",iC(e.autorecallInterval));return d(uC,n(function(t,r,n){return{abortPunishment:oC(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:oC(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:oC(e.pokeReward),tradeAmount:oC(e.tradeAmount)}}),a,t,r)},cC=n(function(e,t,r){return f(Zp,r,f(jp,sC,f(Fp,Xh(e),aC(t))))}),fC=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}}}}}}}}}}},lC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(fC)))))))))))),dC=function(e){return{data:si(f(Gf,"getPhaseStartInfo()",yr)),decoder:lC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},hC=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),pC=function(e){return h(hC,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}}),iC(e.v6),iC(e.v7),iC(e.v8),iC(e.v9))},gC=n(function(e,t,r){return f(Zp,r,f(jp,pC,f(Fp,Xh(e),dC(t))))}),vC=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),yC=vu(f(Xy,jh,f(Xy,Dh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(vC))))))),mC=function(e){return{data:si(f(Gf,"getState()",yr)),decoder:yC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},bC={$:"Aborted"},CC={$:"Burned"},EC={$:"NotClosed"},SC={$:"Recalled"},TC={$:"Released"},wC=function(e){switch(f(xc,99,rd(Sd(e)))){case 0:return si(EC);case 1:return si(SC);case 2:return si(bC);case 3:return si(TC);case 4:return si(CC);default:return ci}},IC=function(e){switch(f(xc,99,rd(Sd(e)))){case 1:return si(Co);case 2:return si(mo);case 3:return si(bo);case 4:return si(yo);default:return ci}},AC=function(e){return R(e,th("0x0000000000000000000000000000000000000000"))?ci:si(e)},BC=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),kC=function(e){var t=iC(e.phaseStartTimestamp),r=IC(e.phase),a=wC(e.closedReason);return d(BC,n(function(t,r,n){return{balance:oC(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:AC(e.responder)}}),r,t,a)},NC=n(function(e,t,r){return f(Zp,r,f(jp,kC,f(Fp,Xh(e),mC(t))))}),RC=i(function(e,t,r,n,a){return Po(M([l(cC,e,t,r),l(NC,e,t,n),l(gC,e,t,a)]))}),$C=function(e){var t=Rg(e);if("Just"===t.$){return t.a}f(cl,"Warning! BigInt to Int conversion failed!",Sd(e));return 0},_C=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),LC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),xC=function(e){return e.b?l(LC,e,yr,0):qa},PC=tn,DC=function(e){var t=h(PC,_C,f(Oh,"encapsulation",pu),f(Oh,"iv",pu),f(Oh,"tag",pu),f(Oh,"encrypted",pu)),r=Mm(t),n=f(Gh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Zc,0,e),f(Zc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(xC(i))},UC=function(e){var t=function(e){var t=Qo(e);return t>1114111?fi("string is too long"):li(f(Is,vb(t),e))};return f(au,Ri(""),Ah(f(xa,t,e)))},OC=function(e){var t=e.a,r=e.b;return UC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},MC=r(function(e,t){return Cl(M([L("message",hl(e)),L("pubkeyHexStrings",f(zh,hl,M([t.initiatorPubkey,t.responderPubkey])))]))}),FC=function(e){return{$:"LoadedCommInfo",a:e}},VC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),KC=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 FC(f(VC,r,n))}return dm(e)},HC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return FC(D(n,{initiatorPubkey:e}))}),jC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{responderPubkey:si(e)}))}var n=t.a;return FC(D(n,{responderPubkey:e}))}),qC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),GC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(nd,a,n),o=$s(f(lc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),zC=function(e){var t=xC(f(GC,Zs(e),yr));return l(zd,uv,h(hC,_C,f(Zc,0,t),f(Zc,1,t),f(Zc,2,t),f(Zc,3,t)),h(hC,_C,f(Zc,4,t),f(Zc,5,t),f(Zc,6,t),f(Zc,7,t)))},YC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),WC={$:"Aborted"},JC={$:"Burned"},QC={$:"Claimed"},XC=function(e){return{$:"Committed",a:e}},ZC=function(e){return{$:"Encrypted",a:e}},eE={$:"FailedDecode"},tE={$:"Initiated"},rE={$:"Recalled"},nE={$:"Released"},aE=function(e){return{$:"StateChange",a:e}},iE=function(e){return{$:"Statement",a:e}},oE=fr,uE=cr,sE=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(oE,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(uE,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),cE=or,fE=y,lE=a(function(e,t,r,n){var a=Wc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(cE,Ga(r),n);var i=za(d(lE,e-Ha,t,r,ja));return f(cE,i,n)}var o=f(Jc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(lE,e-Ha,t,r,u));return l(rf,a,i,n)}var i=za(d(lE,e-Ha,t,r,fE(o)));return l(rf,a,i,n)}),dE=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(lE,c,r,e,fE(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(lE,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),hE=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(oE,32,r,e),o=f(dE,i,t);if(a<0){var u=l(uE,a,n,e);return f(dE,u,o)}return o}),pE=ur,gE=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(pE,i,t,r)}return f(ka,e,t)});return{nodeList:l(pE,i,yr,n),nodeListSize:t/32|0,tail:a}},vE=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(pE,o,t,r)}var n=e.a;return f(hE,n,t)});return f(hE,i,l(pE,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(pE,o,t,r)}var n=e.a;return f(sE,n,t)});return f(ai,!0,f(sE,i,l(pE,o,gE(e),a)))}),yE=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),mE=f(La,yE,yr),bE=n(function(e,t,r){var n=qC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(aE(tE));case"CommittedEvent":var r=t.a;return si(aE(XC(r.responder)));case"RecalledEvent":return si(aE(rE));case"ClaimedEvent":return si(aE(QC));case"AbortedEvent":return si(aE(WC));case"ReleasedEvent":return si(aE(nE));case"BurnedEvent":return si(aE(JC));case"InitiatorStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(To)}));case"ResponderStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(wo)}));default:return ci}}(),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(vE,r.history,xC(mE(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Bo,YC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),mE(M([s])))}),CE=Gr,EE=function(e){var t=l(Mi,uv,f(Oh,"id",CE),f(Oh,"message",pu));return f(Hd,Di,f(Gh,t,e))},SE=function(e){return{$:"Decrypted",a:e}},TE=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),wE=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(bE,n,a,t),o=i.a,u=i.b,s=i.c;return d(TE,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(TE,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(TE,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=EE(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Zc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:SE(y)}),T=D(b,{eventInfo:iE(S)}),w=l(af,v,T,t.history);return d(TE,D(t,{history:w}),!1,ci,yr)}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an event that is not a message!",b))]))}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(TE,t,!1,ci,M([pa(f(ll,"Error decoding decryption result",I))]))}}),IE=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),AE=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),BE=function(e){return{onBroadcast:ci,onMined:si(L(IE(e),ci)),onSign:si(AE(e))}},kE=je("encryptToPubkeys",Ua),NE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),RE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),$E=function(e){return{$:"CommitMined",a:e}},_E={$:"CommitNeedsSig"},LE=function(e){return{$:"CommitSigned",a:e}},xE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?RE:NE}(),a=al(function(){return"Token"===e.factory.$?Ua:pg(jl(Fb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(_E),f(qo,{onBroadcast:ci,onMined:si(L($E,ci)),onSign:si(LE)},a))}),PE=r(function(e,t){return Cl(M([L("id",wl(e)),L("encapsulation",hl(t.encapsulatedKey)),L("iv",hl(t.iv)),L("tag",hl(t.tag)),L("encrypted",hl(t.message))]))}),DE=je("decryptMessage",Ua),UE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},OE=r(function(e,t){return Po(f(xa,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 DE(f(PE,r,s))}return Do}return Do},UE(e.history)))}),ME=function(e){if("Just"===e.$){return e.a}return ci},FE=function(e){var t=ME(l(zd,Ao,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Bo,function(e){return e.address},Gd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(OE,n,a)}return Do},VE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(bE,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),KE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),HE=i(function(e,t,r,n,a){return f(VE,n,p(KE,e,r,t,qa,a,""))}),jE=function(e){return{$:"ChatHistoryMsg",a:e}},qE=a(function(e,t,r,n){var a=x(t,Gd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(ko,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(jE),n))}(h(HE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),GE={$:"Abort"},zE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),YE=function(e){return{$:"ActionNeedsSig",a:e}},WE=function(e){return{$:"ApproveMining",a:e}},JE={$:"ApproveNeedsSig"},QE=function(e){return{$:"ApproveSigned",a:e}},XE={$:"Burn"},ZE={$:"Claim"},eS=function(e){return{$:"CommitMining",a:e}},tS=function(e){return{$:"ConfirmingAction",a:e}},rS=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),nS=function(e){return{$:"ParametersFetched",a:e}},aS=function(e){return{$:"PhaseInfoFetched",a:e}},iS={$:"Poke"},oS={$:"Recall"},uS={$:"Release"},sS=function(e){return{$:"StartContractAction",a:e}},cS=function(e){return{$:"StateFetched",a:e}},fS=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"}},lS=function(e){return d(gm,e,Do,Fo,yr)},dS={align:ul,label:"cantFindTradeWillRetry",mainParagraphs:M([M([fl("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:$g},hS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(_g,e,r)}if("Nothing"===t.a.$){t.a;return f(ll,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ll,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),pS={align:ul,label:"tradeParametersNotDefault",mainParagraphs:M([M([fl("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:$g},gS=eo(Xi),vS=n(function(e,t,r){return l(bp,e,Bo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),yS=r(function(e,t){var r=t.a;return um(f(mp,e,r))}),mS=n(function(e,t,r){var n=e.a,a=f(fp,t,n.requests);if("Nothing"===a.$)return L(om(n),Do);var i=a.a,o=L(i.watchOnce,Ql(r));if("Nothing"===o.b.$){o.b;return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Do)}if(o.a){var u=o.b.a;return L(om(D(n,{requests:l(vS,t,r,n.requests),watching:f(yS,t,n.watching)})),f(Yg,i.tagger,xp(u)))}return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Po(f(xa,function(e){return f(Yg,i.tagger,xp(e))},r)))}),bS=_e,CS=r(function(e,t){return f(Zp,f(zo,im,t),f(Kp,function(t){return zy(e)},bS(2e3)))}),ES=n(function(e,t,r){var n=r.a,a=r.b;return f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)}))}),SS=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(SS,e,t,i)),c=o;e=u,t=s,r=c}}),TS=r(function(e,t){return l(SS,xl,t,e)}),wS=r(function(e,t){var r=e.a,n=t.a;return um(f(TS,r,n))}),IS=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 Po(f(xa,function(t){return f(Zp,f(zo,bm(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},mE(f(xa,function(e){return f(fp,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(om(D(r,{blockNumber:si(a)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,ES)]))):L(t,f(CS,r.nodePath,r.tagger))}return L(om(D(r,{blockNumber:si(a),pending:sm,watching:f(wS,r.watching,r.pending)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(a,a),r.pending,qm),l(i,L(a,a),r.watching,ES)])))}var s=e.a.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),f(CS,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(mS,t,c,d)}var s=e.b.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),Do)}),AS=function(e){return M([e])},BS=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(nm,r.factory,r.id):Do}}(),function(){var e=x(Gd(t.wallet),Mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Mg(t.wallet),si(a.factory))?d(eg,n,r.address,a.creationInfo.address,Ly):Do}return Do}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(qE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?FE(t):Do,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(gm,u,Po(M([l(NC,p.factory,p.creationInfo.address,cS),s,r])),Fo,o)}return lS(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return lS(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(ts,m,jl(Fb(C.parameters))),ba))return lS(u);var S=l(xE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(gm,D(u,{txChainStatus:T}),Do,w,yr)}return lS(u)}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:$C(I.blocknum)},B=l(Ym,mm,t.eventSentry,{address:A.address,fromBlock:jm(A.blocknum),toBlock:Mp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(Qb,A,t.trade)}),$=f(xc,gS,Vb(u.trade)),_=Po(M([N,h(RC,$,A.address,nS,cS,aS)]));return d(gm,u,_,Fo,yr)}if("BadBody"===g.a.$){g.a.a;return d(gm,t,Do,Fo,M([pa(dS)]))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(eC,P,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(Kb(F)){var u=D(t,{trade:f(Xb,F,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(pS)]))}var V=g.a.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Zb,H,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Yh,Mb,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(HC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(jC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=lb(e.terms);if("Ok"===r.$){var n=r.a;return L(f(tC,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ll,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(jE),n))}(l(bE,q.blockNumber,Y,r))}return d(qE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?FE(u):Do;return d(gm,u,_,Fo,f(oo,f(xa,pa,mE(M([X]))),o));case"ExpandPhase":var te=e.a;return lS(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return lS(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return lS(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(gm,t,Do,Fo,M([da(jv(C.parameters.initiatorAddress))]))}return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return lS(D(t,{txChainStatus:si(f(rS,E,ie))}));case"AbortAction":return lS(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(xE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=al(l(sh,nh(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(QE)};return f(qo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(ts,i,jl(Fb(C.parameters))),ba)?L(si(JE),n):l(xE,C,E.address,E.commPubkey)}return L(si(JE),n)}(),T=oe.a,w=oe.b;return d(gm,D(t,{txChainStatus:T}),Do,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,iS)||R(ue,oS)){var se=sS(ue),ce=t;e=se,t=ce;continue e}return lS(D(t,{txChainStatus:si(tS(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Fo,M([pa(f(ll,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=al(eb(n.creationInfo.address));return x(si(YE(oS)),f(qo,BE(oS),a),yr);case"Claim":var a=al(Xm(n.creationInfo.address));return x(si(YE(ZE)),f(qo,BE(ZE),a),yr);case"Abort":var a=al(Jm(n.creationInfo.address));return x(si(YE(GE)),f(qo,BE(GE),a),yr);case"Release":var a=al(tb(n.creationInfo.address));return x(si(YE(uS)),f(qo,BE(uS),a),yr);case"Burn":var a=al(Qm(n.creationInfo.address));return x(si(YE(XE)),f(qo,BE(XE),a),yr);default:var a=al(zf(n.creationInfo.address));return x(si(YE(iS)),f(qo,BE(iS),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(gm,D(t,{txChainStatus:T}),Do,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return lS(D(t,{txChainStatus:si(WE(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return lS(D(t,{txChainStatus:si(eS(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"commit",V))]));case"CommitMined":return lS(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return lS(D(t,{txChainStatus:si(f(zE,ue,he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,fS(ue),V))]));case"ActionMined":var ue=e.a;return lS(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(IS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(gm,D(t,{eventSentry:ve}),_,Fo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(wE,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?FE(t):Do,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(kE(f(MC,r,a)),ci)}return L(Do,si(f(ll,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Do,ci)}(),Te=Se.a,we=Se.b;return d(gm,Ee,Po(M([s,Te])),Fo,U(f(Qi,jE,Ce.appCmds),f(xc,yr,f(Bo,AS,f(Bo,pa,we)))))}return d(gm,t,Do,Fo,M([pa(f(ll,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Wh,OC,DC(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Ao,p,E.address);if("Nothing"===Ne.$)return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return al("Initiator"===Re.$?f(Zm,p.creationInfo.address,ke):f(rb,p.creationInfo.address,ke))}();return d(gm,t,Do,f(qo,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(gm,t,Do,Fo,M([pa(f(ll,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return lS(t)}var V=e.a.a;return d(gm,t,Do,Fo,M([pa(f(Lg,"message",V))]));default:return d(gm,t,Do,Fo,M([ga]))}}),kS=r(function(e,t){return{address:e,blocknum:t}}),NS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},RS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(zm,!0,e,t,r))}),$S=n(function(e,t,r){var n=function(e){return r(f(Yh,Sb,e).returnData)},a={address:t.address,fromBlock:jm(t.blocknum),toBlock:jm(t.blocknum),topics:M([si(Ob("Initiated(string,string)"))])};return l(RS,n,e,a)}),_S=function(e){return{data:si(f(Gf,"numTrades()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},LS=r(function(e,t){return f(Zp,t,f(Fp,Xh(e),_S(rh(e))))}),xS=function(e){return{data:si(f(Gf,"phase()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},PS=n(function(e,t,r){return f(Zp,r,f(jp,IC,f(Fp,Xh(e),xS(t))))}),DS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),US=r(function(e,t){return l(La,DS(e),yr,t)}),OS=function(e){return f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},MS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},FS=function(e){return f(MS,Ja(Hb),Sa(e.trades))},VS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:FS(e),loaded:Ti(OS(e))})})},KS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),HS=r(function(e,t){var r=f(Zc,e,t.trades);if("Just"===r.$){var n=(r.a,l(af,e,Hb,t.trades));return l(KS,VS(D(t,{trades:n})),Do,yr)}return l(KS,t,Do,M([pa(f(ll,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),jS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Qb,t,a),o=l(af,e,i,r.trades);return L(VS(D(r,{trades:o})),yr)}return L(r,M([f(ll,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),qS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Xb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(af,e,ym(D(a,{state:D(i,{phase:t})})),r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),zS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Zb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),YS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(eC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),WS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),JS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),QS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),XS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),ZS=function(e){return{$:"NumTradesFetchedAgain",a:e}},eT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),tT=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),rT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),nT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),aT=function(e){return l(KS,e,Do,yr)},iT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=$C(n),i=xC(f(xa,jy(t.factory),f(Ai,0,a-1))),o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,0,a-1)));return l(KS,D(t,{dataFetchState:l(QS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CheckForNewTrades":return l(KS,t,f(LS,t.factory,ZS),yr);case"UpdateTradePhases":var s=Po(mE(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(PS,e.factory,e.creationInfo.address,f(tT,e.factory,e.id)))},OS(t))));return l(KS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(GS,d,p,t),v=function(){var e=L(p,f(Zc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=NS(r);if("Just"===n.$){var a=n.a;return L(l(NC,c,a.address,nT(d)),yr)}return L(Do,M([pa(f(ll,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Do,yr)}e.b;return L(Do,M([pa(f(ll,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(KS,g.tradeCache,Po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(KS,t,Do,M([pa(f(hS,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=$C(n);if(_(C,E)<0){var S=t.dataFetchState,o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,C,E-1))),T=xC(f(xa,jy(t.factory),f(Ai,C,E-1)));return l(KS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(vE,t.trades,T)}),o,yr)}return aT(t)}b.b;return l(KS,t,Do,M([pa(f(ll,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(kS,w.address_,$C(w.blocknum)),A=l($S,t.eventSentry,I,XS(d)),B=A.a,k=A.b,y=Po(M([h(RC,t.factory,I.address,eT(d),nT(d),rT(d)),k])),N=l(jS,d,I,t),R=N.a,$=N.b;return l(KS,VS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(KS,t,Do,M([pa(f(_g,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(qS,d,P,t)}var U=r.a.a;return l(KS,t,Do,M([pa(f(ll,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(YS,d,O,t)}return l(KS,t,Do,M([pa(f(hS,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(zS,d,F,t)}return l(KS,t,Do,M([pa(f(hS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=lb(V.terms);if("Ok"===K.$){var H=K.a;return l(WS,d,H,t)}var j=K.a;return f(HS,d,t)}var j=r.a;return l(KS,t,Do,M([pa(f(ll,"Error decoding initiated event",j))]));default:var q=e.a,G=f(IS,q,t.eventSentry),z=G.a,y=G.b;return l(KS,D(t,{eventSentry:z}),y,yr)}}),oT=function(e){return{$:"AgentHistoryMsg",a:e}},uT=function(e){return{$:"AppCmd",a:e}},sT={$:"BetaLandingPage"},cT={$:"ConnectToWeb3"},fT=function(e){return{$:"MarketplaceMsg",a:e}},lT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),dT=r(function(e,t){return f(kn,e,hl(t))}),hT=function(e){return f(dT,"href",tt(e))},pT=Nn("rel"),gT=dT("target"),vT=function(e){return{$:"Height",a:e}},yT=vT,mT={$:"Content"},bT=mT,CT=function(e){return{$:"Width",a:e}},ET=CT,ST=function(e){return{$:"Attr",a:e}},TT=function(e){return{$:"NodeName",a:e}},wT=function(e){return{$:"Unkeyed",a:e}},IT={$:"AsEl"},AT=IT,BT=r(function(e,t){return{$:"Field",a:e,b:t}}),kT=f(BT,0,0),NT={$:"NoNearbyChildren"},RT={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"},$T=RT.any+" "+RT.column,_T=RT.any+" "+RT.grid,LT=RT.any+" "+RT.page,xT=RT.any+" "+RT.paragraph,PT=RT.any+" "+RT.row,DT=RT.any+" "+RT.single,UT=function(e){switch(e.$){case"AsRow":return PT;case"AsColumn":return $T;case"AsEl":return DT;case"AsGrid":return _T;case"AsParagraph":return xT;default:return LT}},OT=function(e){return{$:"Keyed",a:e}},MT={$:"NoStyleSheet"},FT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),VT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),KT={$:"AsParagraph"},HT=KT,jT=Sn("div"),qT=Sn("p"),GT=Sn("s"),zT=Sn("u"),YT=dT("className"),WT=function(e){return wn(Xe(e))},JT=function(e){return Sn(Xe(e))},QT=function(e){return{$:"Flag",a:e}},XT=function(e){return{$:"Second",a:e}},ZT=function(e){return e>31?XT(1< .ctr > ."+RT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",eI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+" { flex-basis: auto !important; } "+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+Ew(RT.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"+Zw,tI=function(e){return{$:"Intermediate",a:e}},rI=r(function(e,t){return tI({closing:t,others:yr,props:yr,selector:e})}),nI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,tI({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(nI,f(rI,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(nI,f(rI,n.selector,""),v),t.others)})}});return tI(l(La,a,n,t))}),aI=U(eI,function(e){var t=function(e){return Cd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Cd(f(xa,a,t.others)))};return Cd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(nI,f(rI,r,""),n),t)}),yr,e)))}(U(Jw,Xw))),iI=l(JT,"style",yr,M([Tw(aI)])),oI=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+'"'}},uI=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}},sI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ch,uI,t.variants)}return!1},cI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),fI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),lI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(fI,"."+e+"."+t+", ."+e+" ."+t,n),f(fI,"."+e+"."+t+"> ."+RT.text+", ."+e+" ."+t+" > ."+RT.text,a)])}),dI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(lI,i,RT.sizeByCapital,a),l(lI,i,RT.fullSize,n)))}),hI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(fI,"."+r+"."+RT.sizeByCapital+", ."+r+" ."+RT.sizeByCapital,M([L("line-height","1")])),f(fI,"."+r+"."+RT.sizeByCapital+"> ."+RT.text+", ."+r+" ."+RT.sizeByCapital+" > ."+RT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),pI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},gI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Tc,t,r))}return ci},vI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),yI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(xc,e.descender,gI(t)),n=f(xc,e.baseline,gI(f(ml,function(e){return!R(e,r)},t))),a=f(xc,e.capital,pI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(vI,i,a-n,o),full:l(vI,u,a-r,s)}},mI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",mw(e.height)),L("vertical-align",mw(e.vertical)+"em"),L("font-size",mw(e.size)+"em")]))},bI=function(e){return l(Ra,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 si(L(mI(function(e){return e.full}(yI(a))),mI(function(e){return e.capital}(yI(a)))))}return t}return t}),ci,e)},CI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(US,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=bI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,hI(t),n));var i=a.a;return f(Ri,"",f(xa,f(dI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},EI=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+'" '+Ni(r)}},SI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,EI,t.variants)))}return ci},TI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},wI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+mw(r)+"px, "+mw(n)+"px, "+mw(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("+mw(o)+"px, "+mw(u)+"px, "+mw(s)+"px)",b="scale3d("+mw(f)+", "+mw(l)+", "+mw(d)+")",C="rotate3d("+mw(p)+", "+mw(g)+", "+mw(v)+", "+mw(y)+"rad)";return si(m+" "+b+" "+C)}},II=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,cI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,cI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,cI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,cI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+RT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+RT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+RT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,cI(!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,M([f(vw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Tc,1,1-c));return l(a,t,"."+u,M([f(vw,"opacity",mw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(vw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(US,SI,p)),v=M([f(vw,"font-family",f(Ri,", ",f(xa,oI,p))),f(vw,"font-feature-settings",g),f(vw,"font-variant",f(Ch,sI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(vw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(vw,s,bw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+RT.row,A="."+(RT.wrapped+I),B="."+RT.alignRight,k="."+RT.paragraph,N="."+RT.page,R="."+RT.alignLeft,$=mw(S/2)+"px",_=mw(E/2)+"px",x="."+RT.column,y="."+C,P="."+RT.any;return Cd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(vw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(vw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,U(y,k),M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,lw,F.rows))+"-cols-"+f(Ri,"-",f(xa,lw,F.columns))+"-space-x-"+lw(F.spacing.a)+"-space-y-"+lw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=wI(ne),y=hw(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,M([f(vw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=TI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(CI(s),c)}),AI=r(function(e,t){return l(JT,"style",yr,M([Tw(f(II,e,t))]))}),BI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",iI),f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)}),kI=a(function(e,t,r,n){return e?f(ka,iI,f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)):f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)}),NI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(WT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(BI,!1,e,t,r);default:var e=i.a,t=i.b;return d(BI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return jT;case"p":return qT;default:return JT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(kI,!1,e,t,n);default:var e=i.a,t=i.b;return d(kI,!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(JT,e,n,M([f(u,r,M([YT(RT.any+" "+RT.single)]))]))}}();switch(o.$){case"AsRow":return f(ow,sw,e)&&!f(ow,uw,e)?s:f(ow,tw,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerRight])))]),M([s])):f(ow,rw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(ow,iw,e)&&!f(ow,aw,e)?s:f(ow,nw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerCenterY])))]),M([s])):f(ow,ew,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerBottom])))]),M([s])):s;default:return s}}),RI=Tw,$I=function(e){return f(jT,M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthContent,RT.heightContent])))]),M([RI(e)]))},_I=function(e){return l(JT,"div",M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthFill,RT.heightFill])))]),M([Tw(e)]))},LI=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 R(e,HT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,HT),L(f(ka,L(n,f(s.html,MT,e)),i),Iu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,AT)?_I(c):$I(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 R(e,HT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,HT),L(f(ka,f(o.html,MT,e),n),Iu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,AT)?_I(u):$I(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children)),MT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children)),MT))}),xI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),PI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(BT,a|r,n)}var i=e.a;return f(BT,r,i|n)}),DI=ZT(7),UI=ZT(36),OI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(BT,r|a,n|i)}),MI=ZT(6),FI=ZT(38),VI=ZT(30),KI=ZT(29),HI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),jI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),qI=function(e){return{$:"Transform",a:e}},GI=function(e){return{$:"ChildrenBehind",a:e}},zI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),YI=function(e){return{$:"ChildrenInFront",a:e}},WI=r(function(e,t){return f(jT,M([YT(function(){switch(e.$){case"Above":return f(Ri," ",M([RT.nearby,RT.single,RT.above]));case"Below":return f(Ri," ",M([RT.nearby,RT.single,RT.below]));case"OnRight":return f(Ri," ",M([RT.nearby,RT.single,RT.onRight]));case"OnLeft":return f(Ri," ",M([RT.nearby,RT.single,RT.onLeft]));case"InFront":return f(Ri," ",M([RT.nearby,RT.single,RT.inFront]));default:return f(Ri," ",M([RT.nearby,RT.single,RT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Tw("");case"Text":var e=t.a;return $I(e);case"Unstyled":return(0,t.a)(AT);default:return f(t.a.html,MT,AT)}}()]))}),JI=n(function(e,t,r){var n=f(WI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?GI(M([n])):YI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?GI(f(ka,n,a)):f(zI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(zI,M([n]),i):YI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(zI,f(ka,n,a),i):f(zI,a,f(ka,n,i))}}),QI=r(function(e,t){switch(t.$){case"Generic":return TT(e);case"NodeName":var r=t.a;return f(HI,r,e);default:var n=t.a,a=t.b;return f(HI,n,a)}}),XI=function(e){switch(e.$){case"Left":return RT.alignedHorizontally+" "+RT.alignLeft;case"Right":return RT.alignedHorizontally+" "+RT.alignRight;default:return RT.alignedHorizontally+" "+RT.alignCenterX}},ZI=function(e){switch(e.$){case"Top":return RT.alignedVertically+" "+RT.alignTop;case"Bottom":return RT.alignedVertically+" "+RT.alignBottom;default:return RT.alignedVertically+" "+RT.alignCenterY}},eA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),tA=function(e){return{$:"Moved",a:e}},rA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return tA(x(r,0,0));case"MoveY":var n=t.a;return tA(x(0,n,0));case"MoveZ":var a=t.a;return tA(x(0,0,a));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(eA,x(0,0,0),i,x(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 tA(x(s,n,a));case"MoveY":var c=t.a;return tA(x(r,c,a));case"MoveZ":var f=t.a;return tA(x(r,n,f));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,u,x(1,1,1),i,o);default:var l=t.a;return d(eA,u,l,x(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(eA,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(eA,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(eA,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(eA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(eA,u,h,v,y);default:var m=t.a;return d(eA,u,m,p,o)}}}),nA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(kT,n,M([l(jI,n,"height",r+"px")]));case"Content":return x(f(PI,UI,kT),RT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(PI,iw,kT),RT.heightFill,yr):x(f(PI,iw,kT),RT.heightFillPortion+" height-fill-"+Ni(a),M([l(jI,RT.any+"."+RT.row+" > "+Ew("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(jI,u,"min-height",Ni(i)+"px"),c=nA(o),d=c.a,h=c.b,p=c.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(jI,u,"max-height",Ni(g)+"px"),v=nA(o),d=v.a,h=v.b,p=v.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p))}},aA=function(e){switch(e.$){case"Px":var t=e.a;return x(kT,RT.widthExact+" width-px-"+Ni(t),M([l(jI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(PI,FI,kT),RT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(PI,sw,kT),RT.widthFill,yr):x(f(PI,sw,kT),RT.widthFillPortion+" width-fill-"+Ni(r),M([l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(jI,i,"min-width",Ni(n)+"px"),u=aA(a),s=u.a,c=u.b,d=u.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(jI,i,"max-width",Ni(h)+"px"),p=aA(a),s=p.a,c=p.b,d=p.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d))}},iA=ZT(27),oA=r(function(e,t){if(R(e,iA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),uA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=hw(n);if("Nothing"===s.$)return{attributes:f(ka,YT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,YT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,qI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(oA,S,I)){var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(PI,S,r),y=f(rA,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(ow,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=RT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(PI,MI,r),y=n,m=f(ka,l(jI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+RT.widthContent,g=t,v=f(PI,FI,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+RT.widthFill,g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=aA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(ow,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(PI,DI,r),y=n,m=f(ka,l(jI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=RT.heightContent+" "+e,g=t,v=f(PI,UI,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=RT.heightFill+" "+e,g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.column+" > "+Ew("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=nA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(QI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(QI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(QI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(QI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(QI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(QI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(QI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return TT("p");case"NodeName":var e=t.a;return TT(e);default:var r=t.a,n=t.b;return f(HI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(JI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(ow,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=XI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(PI,rw,e);case"Right":return f(PI,tw,e);default:return e}}(f(PI,VI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(ow,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=ZI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(PI,nw,e);case"Bottom":return f(PI,ew,e);default:return e}}(f(PI,KI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),sA={$:"Untransformed"},cA=sA,fA=a(function(e,t,r,n){return l(LI,e,n,v(uA,UT(e),t,kT,cA,yr,yr,NT,$a(r)))}),lA=function(e){return ST(YT(e))},dA=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ST(gT("_blank")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e)))))),wT(M([n])))}),hA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),pA=n(function(e,t,r){return d(hA,e,t,r,1)}),gA=ZT(14),vA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),yA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),mA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return dw(t)+"-"+dw(r)+"-"+dw(n)+"-"+dw(a)},bA=function(e){return f(yA,gA,l(vA,"fc-"+mA(e),"color",e))},CA={align:ul,label:"cantConnectNoWeb3",mainParagraphs:M([M([fl("You need a web3 provider (such as "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(") to Connect.")]),M([fl("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:xg},EA={align:ul,label:"invalidUrl",mainParagraphs:M([M([fl("I don't understand that URL...")]),M([fl("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:$g},SA=function(e){return{$:"Active",a:e}},TA=gu(f(zo,jf,f(zo,Hh,$d("Error decoding hex to BigInt")))),wA=function(){return gu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),IA=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}}}}}}}}}}}},AA=function(e){return Em(M([f(Oi,si,e),Fi(ci)]))},BA=f(dh,AA(f(Oh,"status",wA)),f(dh,AA(f(Oh,"root",pu)),l(Im,"logsBloom",pu,l(Im,"logs",Mm(Fm),f(dh,AA(f(Oh,"contractAddress",Am)),l(Im,"cumulativeGasUsed",TA,l(Im,"gasUsed",TA,l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionIndex",Gy,l(Im,"transactionHash",Dm,Fi(IA)))))))))))),kA=function(e){var t=e.a;return jf(t)},NA=f(zo,kA,hl),RA=r(function(e,t){return Up({decoder:BA,method:"eth_getTransactionReceipt",params:M([NA(t)]),url:e})}),$A=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),_A=r(function(e,t){return{$:"TxMined",a:e,b:t}}),LA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),xA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(Io,function(e){return e.b},f(Io,function(e){return e.onMinedTagger},f(fp,t,e))))}),PA=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}}}}}}}}}}}},DA=function(e){return Em(M([Cm(ci),f(Oi,si,e)]))},UA=l(Im,"input",pu,l(Im,"gas",Gy,l(Im,"gasPrice",TA,l(Im,"value",TA,l(Im,"to",DA(Am),l(Im,"from",Am,l(Im,"transactionIndex",Gy,l(Im,"blockNumber",DA(Gy),l(Im,"blockHash",function(e){return f(du,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},cu(t))?Fi(ci):f(Oi,si,e)},pu)}(Rm),l(Im,"nonce",Gy,l(Im,"hash",Dm,Fi(PA)))))))))))),OA=r(function(e,t){return Up({decoder:UA,method:"eth_getTransactionByHash",params:M([NA(t)]),url:e})}),MA=r(function(e,t){return{attempts:e,sleep:t}}),FA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Xp,function(e){return a>0?f(Kp,function(e){return f(FA,f(MA,a,n),t)},bS(1e3*n)):Lp(e)},t)}),VA=r(function(e,t){return f(Kp,function(r){return f(FA,{attempts:30,sleep:1},f(OA,e,t))},bS(250))}),KA=r(function(e,t){return f(FA,{attempts:60,sleep:5},f(RA,e,t))}),HA=function(e){return{$:"Mined",a:e}},jA=function(e){return Bo(function(t){return D(t,{status:HA(e)})})},qA=function(e){return{$:"Sent",a:e}},GA=function(e){return Bo(function(t){return D(t,{status:qA(e)})})},zA=function(e){return{$:"Signed",a:e}},YA=function(e){return Bo(function(t){return D(t,{status:zA(e)})})},WA=function(e){return"Nothing"!==e.$},JA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Tl(r),Do);case"TxSigned":var n=e.a,a=e.b,i=f(fp,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(Yg,t,xp(a))}return Do}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Do;if("Just"===t.b.$){var r=t.b.a;return f(Yg,r,xp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Yg,a,xp(fi(e)))}t.a,t.b,t.c;return Do};if("Ok"===a.$){var c=a.a,d=WA(o.onBroadcastTagger)||WA(o.onMinedTagger)?f(il,r.tagger,f(Zp,LA(n),f(VA,r.nodePath,c))):Do;return L(Tl(D(r,{txs:l(bp,n,YA(c),r.txs)})),Po(M([u,d])))}var h=a.a;return L(Tl(r),Po(M([u,s(h)])))}return L(Tl(r),Do);case"TxSent":var n=e.a,p=e.b,g=f(fp,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(il,r.tagger,f(Zp,_A(n),f(KA,r.nodePath,v.hash))):Do}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Yg,t,xp(li(v)))}return Do}();return L(Tl(D(r,{txs:l(bp,n,GA(v),r.txs)})),Po(M([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(Yg,t,xp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Yg,n,xp(fi("Error with TxSent stuff")))}e.a,e.b;return Do}();return L(Tl(r),s)}return L(Tl(r),Do);case"TxMined":var n=e.a,m=e.b,b=f(fp,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Yg,a,xp(li(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 Po(M([f(il,r.tagger,f(Zp,f($A,n,s),zy(r.nodePath))),f(Yg,a,xp(li(C))),f(Yg,u.toMsg,xp(s))]))}return Do}();return L(Tl(D(r,{txs:l(bp,n,jA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Yg,r,xp(fi("TxReceipt decoding failure")))}return Do}();return L(Tl(r),S)}return L(Tl(r),Do);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(xA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Tl(r),f(Yg,B,f(Xp,function(e){return xp(D(I,{doneWatching:!0,reOrg:!0}))},f(Kp,function(e){return xp(D(I,{doneWatching:!0}))},f(RA,r.nodePath,T.txHash)))))}return L(Tl(r),Do)}if(R(w,T.lastCheckedBlock))return L(Tl(r),f(il,r.tagger,f(Zp,f($A,n,T),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))));var k=f(xA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Tl(r),Po(M([f(il,r.tagger,f(Zp,f($A,n,I),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))),f(Yg,B,xp(I))])))}return L(Tl(r),Do)}var n=e.a,h=e.c.a;return L(Tl(r),Do);default:var h=e.a;return L(Tl(r),Do)}}),QA=Jt,XA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),ZA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),eB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(ZA,"#",e.fragment,l(ZA,"?",e.query,U(f(XA,e.port_,U(t,e.host)),e.path)))},tB=r(function(e,t){return e<0?ci:Ql(f(nd,e,t))}),rB=r(function(e,t){if(e<0)return t;var r=Bh(f(nd,e,t)),n=f(lc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),nB=n(function(e,t,r){if(e<0)return r;var n=f(nd,e,r),a=f(lc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),aB=r(function(e,t){return f(nB,e,ms(t))}),iB=r(function(e,t){Kv(t);switch(t.$){case"Home":return L(D(e,{submodel:sT}),Do);case"Create":var r=Xd(e.wallet),n=f(Ul,e.txSentry,f(Yo,Uy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(uB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),Po(M([f(il,Uy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(By,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(Wm,e.wallet,r)}return l(vm,e.wallet,u,s)}(),c=f(Ul,e.txSentry,f(Yo,Fy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(uB,U(f(Qi,Fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:My(r.model),txSentry:a}),Po(M([f(il,Fy,r.cmd),i]))));case"Marketplace":var d=Bv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Oy(h)}),Po(M([f(il,fT,p)])));case"AgentHistory":var g=t.a,v=f(Uo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:Py(y)}),Po(M([f(il,oT,m)])));default:return L(f(uo,EA,e),Do)}}),oB=r(function(e,t){var r=t.a,n=t.b,a=f(sB,uT(e),r),i=a.a,o=a.b;return L(i,Po(M([n,o])))}),uB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,oB,L(r,n),e)}),sB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(sB,cT,t);case"GotoRoute":var n=r.a;return L(t,f(Cy,t.key,n));case"GTag":var a=r.a;return L(t,wy(Sy(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),wy(Sy(d(Ol,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Uv,ky,o,u,s));default:return L(t,Ny(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(rB,c,t.userNotices)}),Do);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(by,t.key,eB(e))}var r=h.a;return QA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(cB,g,t);case"GotoRoute":var v=e.a;return L(t,Po(M([wy(Sy(d(Ol,"GotoRoute","navigation",Kv(v),0))),f(Cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Do);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,CA,t),Do):L(t,Ey(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Do;var t=e.a;return Iy(f(Ty,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Gh,pu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=SA(l(Ml,I,w,S)),B=f(Vy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ll,"Unexpected wallet state encounted when setting commPubkey!",ci),t),Do)}T.a;return L(f(uo,f(ll,"User pubkey set, but I can no longer find the user address!",ci),t),Do)}var N=E.a;return L(l(Pa,uo,f(ll,"error decoding commPubkey from JS",N),t),Do);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(lv,R,_),P=f(Ul,t.txSentry,f(Yo,Uy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(uB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),Po(M([f(il,Uy,x.cmd),F]))))}return L(t,Do);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(BS,K,j),q=f(Ul,t.txSentry,f(Yo,Fy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(uB,U(f(Qi,Fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:My(x.model),txSentry:O}),Po(M([f(il,Fy,x.cmd),F]))))}return L(t,Do);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Dv,G,Y);return f(uB,f(Qi,fT,x.appCmds),L(D(t,{submodel:Oy(x.model)}),f(il,fT,x.cmd)))}return L(t,Do);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(ol,W,Q),X=f(Ul,t.txSentry,f(Yo,oT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(uB,U(f(Qi,oT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Py(x.model),txSentry:O}),Po(M([f(il,oT,x.cmd),F]))))}return L(t,Do);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(_u,si,f(JA,Z,r))}return L(ci,Do)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(tB,re,t.tradeCaches);if("Nothing"===ae.$)return f(oB,pa(f(ll,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Do));var ie=ae.a,x=f(iT,ne,ie);return L(D(t,{tradeCaches:l(aB,re,x.tradeCache,t.tradeCaches)}),f(il,lT(re),x.cmd));case"NoOp":return L(t,Do);default:var N=e.a;f(cl,"test",N);return L(t,Do)}}),cB=r(function(e,t){return f(iB,t,my(e))}),fB=Ge("txIn",Sm),lB=je("txOut",Ua),dB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},hB=function(e){return{$:"EventSentryMsg",a:e}},pB=function(e){var t=f(cm,hB,Xh(e)),r=t.a,n=t.b;return x({dataFetchState:l(QS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Zd,"tradeCache init","processing",dB(e),0)]))},gB=function(e){return{$:"InitialNumTradesFetched",a:e}},vB=function(e){return f(LS,e.factory,gB)},yB=function(e){var t=pB(e),r=t.a,n=t.b,a=t.c;return x(r,Po(M([n,vB(r)])),a)},mB=function(e){return{$:"TxSentryMsg",a:e}},bB={align:ul,label:"noWeb3Provider",mainParagraphs:M([M([fl("No web3 provider detected. Is "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(" or some other web3 provider installed and unlocked?")])]),noticeType:xg},CB={$:"TopLeft"},EB={align:CB,label:"screenToSmall",mainParagraphs:M([M([fl("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:xg},SB={align:ul,label:"wrongWeb3Network",mainParagraphs:M([M([fl("Make sure your wallet is set to a compatible network.")]),M([fl(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:$g},TB={$:"NoneDetected"},wB=function(e){return{$:"OnlyNetwork",a:e}},IB=function(e){return f(Bo,Xh,Mg(e))},AB={$:"ETCMain"},BB={$:"ETCTest"},kB={$:"Expanse"},NB={$:"Kovan"},RB={$:"Mainnet"},$B=function(e){return{$:"Private",a:e}},_B={$:"Rinkeby"},LB={$:"Ropsten"},xB={$:"RskMain"},PB={$:"RskTest"},DB=function(e){switch(e){case 1:return RB;case 2:return kB;case 3:return LB;case 4:return _B;case 30:return xB;case 31:return PB;case 42:return NB;case 41:return AB;case 62:return BB;default:return $B(e)}},UB=n(function(e,t,r){var n=e.a,a=e.b;return Tl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:cp})}),OB=n(function(e,t,n){var a=e.networkId?wB(DB(e.networkId)):TB,i=f(Bo,function(e){return l(UB,L(lB,fB),mB,e)},IB(a)),o=e.width<1024?si(EB):ci,u=f(xa,yB,ro),s=function(){return R(a,TB)?si(bB):"Nothing"===Mg(a).$?si(SB):ci}(),c=mE(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ay(f(Bi,r(function(e,t){return f(Qi,lT(e),t)}),g)),y=Po(f(Bi,r(function(e,t){return f(il,lT(e),t)}),p)),m=f(uB,v,f(cB,t,{key:n,screenWidth:e.width,submodel:sT,time:Vl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),Po(M([y,C])))}),MB=Oe,FB=MB(yr),VB=function(e){return FB},KB=function(e){return{$:"Refresh",a:e}},HB=r(function(e,t){return{$:"Every",a:e,b:t}}),jB=r(function(e,t){return{processes:t,taggers:e}}),qB=xp(f(jB,cp,cp)),GB=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(SS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),zB=Ne,YB=r(function(e,t){var r=e.a,n=e.b,a=f(fp,r,t);if("Nothing"===a.$)return l(xl,r,M([n]),t);var i=a.a;return l(xl,r,f(ka,n,i),t)}),WB=Be,JB=r(function(e,t){return{$:"Zone",a:e,b:t}}),QB=ca,XB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=WB(f(QB,n,f(Sp,e,n)));return f(Kp,function(t){return l(XB,e,a,l(xl,n,t,r))},i)}return xp(r)}),ZB=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 x(n,a,f(Kp,function(e){return i},zB(t)))}),u=l(Ra,YB,cp,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(xl,e,r,i),o)}),d=p(GB,s,c,o,u,i,x(yr,cp,xp(gr))),h=d.a,g=d.b,v=d.c;return f(Kp,function(e){return xp(f(jB,u,e))},f(Kp,function(t){return l(XB,e,h,g)},v))}),ek=function(e){return we(function(t){t(Se(e(Date.now())))})}(Vl),tk=n(function(e,t,r){var n=f(fp,t,r.taggers);if("Nothing"===n.$)return xp(r);var a=n.a,i=function(t){return Gp(f(xa,function(r){return f(Ep,e,r(t))},a))};return f(Kp,function(e){return xp(r)},f(Kp,i,ek))}),rk=r(function(e,t){var r=t.a,n=t.b;return f(HB,r,f(Da,e,n))});pn.Time=Pe(qB,ZB,tk,0,rk);var nk=Ue("Time"),ak=r(function(e,t){return nk(f(HB,e,t))}),ik=function(e){return f(ak,2e3,KB)},ok=function(e){return FB},uk=function(e){return{$:"DecryptionFinished",a:e}},sk=Ge("decryptionFinished",Sm),ck=Ge("encryptionFinished",Sm),fk=function(e){return{$:"EncryptionFinished",a:e}},lk=function(e){return{$:"Refresh",a:e}},dk=function(e){return MB(M([f(ak,3e3,lk),ck(fk),sk(function(e){return jE(uk(e))})]))},hk=yn,pk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return FB;case"CreateModel":t.a;return f(hk,Uy,ik());case"TradeModel":t.a;return f(hk,Fy,dk());case"MarketplaceModel":t.a;return f(hk,fT,ok());default:t.a;return f(hk,oT,VB())}},gk=Ge("userPubkeyResult",Sm),vk=Ge("walletSentryPort",Sm),yk={$:"CheckForNewTrades"},mk={$:"UpdateTradePhases"},bk=function(e){return MB(M([f(ak,5e3,function(e){return yk}),f(ak,3e3,function(e){return mk})]))},Ck=function(e){return{$:"Tick",a:e}},Ek=function(e){return{$:"UserPubkeySet",a:e}},Sk=function(e){return{$:"WalletStatus",a:e}},Tk=function(e){return f(ll,"Error decoding JS walletSentry: "+e,ci)},wk=function(e){return{$:"ErrorDecoding",a:e}},Ik=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Ak=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Oh,"ref",CE),f(Oh,"txHash",AA(Dm))),Bk=function(e){var t=f(Gh,Ak,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Ik,r.ref,li(a))}return f(Ik,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return wk("Error decoding tx data")},kk=function(e){var t=e.a;return f(hk,t.tagger,t.inPort(Bk))},Nk=f(Oi,DB,CE),Rk=gu(f(zo,rd,f(zo,$d("Failure decoding stringy int"),au(DB)))),$k=Em(M([Rk,Nk])),_k=r(function(e,t){return{account:e,networkId:t}}),Lk=l(Mi,_k,f(Oh,"account",AA(Am)),f(Oh,"networkId",$k)),xk=n(function(e,t,r){var n=f(Gh,Lk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),Pk=function(e){var t=f(zo,Tk,f(zo,pa,uT));return MB(U(M([f(ak,1e3,Ck),vk(f(xk,t,Sk)),f(xc,FB,f(Bo,kk,e.txSentry)),gk(Ek),MB(f(Bi,r(function(e,t){return f(hk,lT(e),t)}),f(xa,bk,e.tradeCaches)))]),M([pk(e)])))},Dk=function(e){return{$:"LinkClicked",a:e}},Uk=function(e){return{$:"UrlChanged",a:e}},Ok=n(function(e,t,r){return d(hA,e/255,t/255,r/255,1)}),Mk=l(Ok,10,33,108),Fk={$:"Generic"},Vk=Fk,Kk=r(function(e,t){return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),e)),wT(M([t])))}),Hk=function(e){return{$:"Fill",a:e}},jk=Hk(1),qk=Hi,Gk=function(e){return{$:"Px",a:e}},zk=Gk,Yk=ZT(8),Wk=function(e){return f(yA,Yk,l(vA,"bg-"+mA(e),"background-color",e))},Jk=f(Kk,M([ET(jk),yT(zk(150)),Wk(Mk)]),qk),Qk=function(e){return{$:"GotoRoute",a:e}},Xk={$:"Active"},Zk={$:"Important"},eN={$:"Normal"},tN=l(pA,1,1,1),rN=ZT(2),nN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),aN=r(function(e,t){return R(e,t)?f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e)):f(yA,rN,h(nN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),iN=ZT(21),oN=r(function(e,t){return{$:"Class",a:e,b:t}}),uN=f(oN,iN,RT.cursorPointer),sN=ZT(17),cN=function(e){return f(yA,sN,l(jI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},fN=function(e){return{$:"Normal",a:e}},lN=An,dN=r(function(e,t){return f(lN,e,fN(t))}),hN=function(e){return f(dN,"click",Fi(e))},pN=f(Da,ST,hN),gN=ZT(13),vN=f(oN,gN,RT.textSemiBold),yN=ZT(4),mN=function(e){return{$:"FontSize",a:e}},bN=function(e){return f(yA,yN,mN(e))},CN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([cN(4),Wk(l(pA,0,0,1))]);default:return M([cN(4),Wk(l(pA,.9,0,0))])}}();return f(Kk,U(M([f(aN,23,12),bN(22),vN,bA(tN),uN,pN(t)]),n),fl(e))}),EN=l(Ok,244,0,103),SN=function(e){return{$:"AlignX",a:e}},TN={$:"CenterX"},wN=SN(TN),IN=ZT(3),AN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),BN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),kN=function(e){return f(yA,IN,l(AN,f(BN,e,e),e,e))},NN=function(e){return{$:"Describe",a:e}},RN={$:"Paragraph"},$N=r(function(e,t){return d(fA,HT,Vk,f(ka,NN(RN),f(ka,ET(jk),f(ka,kN(5),e))),wT(t))}),_N=f(oN,gN,RT.bold),LN=f(Kk,M([bN(29),bA(tN),_N,wN,uN,pN(Qk(Gv))]),f($N,yr,M([fl("DAI"),f(Kk,M([bA(EN)]),fl("Hard"))]))),xN={$:"Right"},PN=SN(xN),DN={$:"AsColumn"},UN=DN,ON=r(function(e,t){return d(fA,UN,Vk,f(ka,lA(RT.contentTop+" "+RT.contentLeft),f(ka,yT(bT),f(ka,ET(bT),e))),wT(t))}),MN={$:"AsRow"},FN=MN,VN=r(function(e,t){return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY),f(ka,ET(bT),f(ka,yT(bT),e))),wT(t))}),KN=function(e){return f(VN,M([ET(jk),kN(30),f(aN,30,17)]),M([l(CN,"Browse Offers",Qk(zv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Xk}return eN}()),l(CN,"Create a New Offer",Qk(qv),function(){return"CreateModel"===e.submodel.$?Xk:eN}()),function(){var t=Gd(e.wallet);if("Just"===t.$){var r=t.a;return l(CN,"My Trades",Qk(jv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Xk:eN}return eN}())}return l(CN,"Connect to Wallet",cT,Zk)}(),f(ON,M([PN,kN(0),f(aN,8,0)]),M([LN]))]))},HN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},jN=function(e){return ml(e)},qN=r(function(e,t){return f(ml,dv(e),t)}),GN=function(e){return f(ml,function(e){return Kb(e.parameters)},OS(e))},zN={$:"BurnWindow"},YN={$:"FiatPrice"},WN={$:"Margin"},JN={$:"Offer"},QN={$:"PaymentWindow"},XN=function(e){return{$:"AlignY",a:e}},ZN={$:"CenterY"},eR=XN(ZN),tR=ZT(20),rR=f(oN,tR,RT.clip),nR=Hk,aR=function(e){return f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e))},iR=r(function(e,t){return f(Kk,M([ET(nR(e)),yT(zk(60)),rR,Wk(tN)]),f(Kk,M([aR(12),eR,ET(jk)]),t))}),oR=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},uR=function(e){return{$:"JustImage",a:e}},sR=uR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),cR=dT("alt"),fR=function(e){return f(dT,"src",rt(e))},lR=r(function(e,t){var r=t.src,n=t.description,a=f(ml,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(fA,AT,Vk,f(ka,lA(RT.imageContainer),e),wT(M([d(fA,AT,TT("img"),U(M([ST(fR(r)),ST(cR(n))]),a),wT(yr))])))}),dR=r(function(e,t){if("None"===t.$)return qk;var r=t.a;return f(lR,e,r)}),hR=uR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),pR=function(e){return{$:"ChangeSort",a:e}},gR=f(oN,gN,RT.textMedium),vR=function(e){return f(Kk,M([gR,bN(17)]),fl(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},yR=r(function(e,t){return f(VN,M([kN(5),uN,pN(pR(e))]),M([vR(e),function(){if("Just"===t.$){var e=t.a;return f(Kk,M([eR]),f(dR,M([ET(zk(8))]),function(){return"Ascending"===e.$?sR:hR}()))}return qk}()]))}),mR=r(function(e,t){return f(iR,oR(t),f(yR,t,e))}),bR=r(function(e,t){return f(VN,M([ET(jk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(mR,r,t)},t))}),CR=l(Ok,150,150,150),ER=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},SR=r(function(e,t){return f(ts,e.amount,t.amount)}),TR=n(function(e,t,r){return f(e,r,t)}),wR=function(e){var t=e.a;return(R(e.b,Lo)?Ua:TR)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(wR,L(Av,Zf),e,t):f(Ku,ER(e.state.phase),ER(t.state.phase))});case"Expires":return r(function(e,t){return f(hv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Sv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(SR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(xc,ma,l(zd,r(function(e,t){return f(Ku,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(hv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(hv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},IR=l(Ok,233,237,242),AR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),BR=function(e){return f(Kk,M([ET(jk),yT(jk),rR]),f($N,M([bN(12)]),M([fl(e.info)])))},kR=function(e){return f(xc,qk,f(Bo,BR,Ql(e)))},NR=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"}},RR=function(e){return{$:"TimeLeft",a:e}},$R=function(e){return{$:"TimeUp",a:e}},_R=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 Vl(0)}}),LR=r(function(e,t){return Vl(jd(e)-jd(t))}),xR=r(function(e,t){var r=f(_R,t.state.phase,t),n=f(LR,e,t.state.phaseStartTime),a=f(LR,r,n);return jd(a)>0?RR(L(a,r)):$R(r)}),PR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},DR=l(pA,0,0,0),UR=l(Ok,51,183,2),OR=function(e){var t=ju(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Qo(n));return n+(function(){if(a){return f(ru,a+1,f(Zo,1,mw(r)))}return""}()+"%")},MR=r(function(e,t){return uR({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"}()})}),FR=n(function(e,t,r){return f(dR,f(ka,yT(zk(34)),e),f(MR,t,r))}),VR=r(function(e,t){var r=OR(t);if("0%"===r)return f(Kk,M([bN(16)]),fl("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?UR:EN;return f(VN,M([kN(4)]),M([l(FR,yr,a,si(i)),f(Kk,M([bA(o),bN(16)]),fl(n))]))}),KR=uR,HR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(xl,r,n,t)}),cp,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,KR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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(xc,"",f(Bo,Qa,f(fp,e,HR)))},qR=function(e){return Qo(e)<=3?e:qR(f(Td,3,e))+","+f(ou,3,e)},GR=function(e){return qR(Sd(e))},zR=function(e){return U(jR(e.fiatType),GR(e.amount))},YR=hA,WR=function(e){var t=function(){var t=f(fp,e.fiatType,HR);if("Nothing"===t.$)return qk;var r=t.a,n=(r.a,r.b);return f(dR,M([yT(zk(26))]),n)}();return f(VN,M([kN(4)]),M([t,f(Kk,M([bA(d(YR,0,0,0,.5)),gR,ET(zk(50))]),fl(e.fiatType)),fl(zR(e))]))},JR=function(e){return jd(e)<0},QR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),XR=function(e){var t=vg(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(QR,$C(t),$C(r),$C(n),$C(a))}(f(xc,L(qu(0),qu(0)),f(Ts,n,qu(60))))}(f(xc,L(qu(0),qu(0)),f(Ts,r,qu(3600))))}(f(xc,L(qu(0),qu(0)),f(Ts,t,qu(86400))))},ZR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!JR(a)){var u=r(function(e,t){return U(l(Rs,2,P("0"),Ni(e)),t)}),s=jd(a)>0?i:o,c=XR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(VN,U(M([kN(5)]),e),M([f(Kk,U(M([bA(h)]),t),fl(f(u,c.days,"d"))),f(Kk,U(M([bA(d)]),t),fl(f(u,c.hours,"h"))),f(Kk,U(M([bA(s)]),t),fl(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Vl(0);e=p,t=g,n=v,a=y}}),e$={$:"Behind"},t$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),r$=function(e){return f(t$,e$,e)},n$=r(function(e,t){var r=sv(200*e),n=200-r,a=f(Kk,M([ET(nR(n))]),qk),i=M([yT(zk(3)),cN(20)]),o=f(Kk,U(i,M([ET(nR(r)),Wk(t)])),qk),u=f(Kk,U(i,M([ET(jk),Wk(IR)])),qk);return f(VN,M([ET(jk),r$(u)]),M([o,a]))}),a$=l(pA,1,1,0),i$=r(function(e,t){return jd(e)/jd(t)}),o$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(i$,o,u),c=(f(Kk,M([wN]),d(ZR,yr,yr,L(a,i),o)),s<.1?EN:s<.2?a$:UR);return f(ON,U(M([kN(5)]),e),M([d(ZR,M([wN]),t,L(a,i),o),f(n$,1-s,c)]))}),u$=function(e){var t=wd(jl(e)),r=f(Xl,".",t);if(!r.b)return t;if(r.b.b){cl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(ru,3,t);case 1:return f(ru,4,f(xc,t,f(Bo,mw,f(Bo,function(e){return e/100},f(Bo,Ka,f(Bo,sv,f(Bo,ti(100),Bd(t))))))));default:var n=r.a;return f(xc,f(ru,n,t),f(Bo,Ni,f(Bo,sv,Bd(t))))}},s$=n(function(e,t,r){return f(iR,oR(t),function(){switch(t.$){case"Phase":var n=PR(r.state.phase),a=L(f(xR,e,r),r.state.phase);e:for(;;){if("TimeLeft"===a.a.$){if("Closed"===a.b.$)break e;var i=a.a.a,o=f(i$,i.a,i.b)<.05?EN:DR;return f(ON,M([kN(3)]),M([fl(n),d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)]))}if("Closed"===a.b.$)break e;var u=a.a.a;return f(VN,M([kN(6),bA(CR)]),M([fl(n),f(Kk,M([bN(16)]),fl("(stale)"))]))}a.b;return fl(n);case"Expires":if("Open"===r.state.phase.$){var s=f(xR,e,r);if("TimeLeft"===s.$){var i=s.a,o=f(i$,i.a,i.b)<.05?EN:DR;return d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)}var u=s.a;return d(o$,M([ET(jk)]),M([bN(16)]),L(EN,IR),L(Vl(0),u))}return qk;case"Offer":return f(VN,M([kN(5)]),M([fl(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(u$(r.parameters.tradeAmount)+" ")+NR(r.factory))]));case"FiatPrice":return WR(r.terms.price);case"Margin":var c=R(r.parameters.initiatorRole,fo);return f(xc,qk,f(Bo,VR(c),r.derived.margin));case"PaymentWindow":var l=function(){return"Seller"===r.parameters.initiatorRole.$?EN:UR}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoabortInterval);default:var l=function(){return"Seller"===r.parameters.initiatorRole.$?UR:EN}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoreleaseInterval)}}())}),c$=n(function(e,t,r){return f(ON,M([ET(jk),kN(1),Wk(IR),uN,pN(f(AR,r.factory,r.id))]),M([f(VN,M([ET(jk),kN(1)]),f(xa,function(t){return l(s$,e,t,r)},t)),f(iR,1,kR(r.terms.paymentMethods))]))}),f$=Er,l$=ZT(28),d$=function(e){return f(yA,l$,l(vA,"bc-"+mA(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(yA,iA,h(h$,"b-"+Ni(e),e,e,e,e))},g$=a(function(e,t,r,n){return f(ON,M([ET(jk),p$(2),cN(8),d$(CR),kN(2),Wk(CR),rR]),f(xa,f(c$,e,r),f(f$,wR(t.orderBy),n)))}),v$=a(function(e,t,r,n){return f(ON,M([ET(jk),yT(jk),kN(5)]),M([f(bR,t.orderBy,r),d(g$,e,t,r,n)]))}),y$=n(function(e,t,r){var n=f(qN,r.filters,ay(f(xa,function(e){return f(jN,HN(r),GN(e))},t)));return R(n,yr)?qk:f(Yi,Ko,d(v$,e,r.tradeTable,M([xo,JN,YN,WN,QN,zN]),n))}),m$=r(function(e,t){return f(Kk,M([cN(4),Wk(d(YR,0,0,1,.1)),bA(l(Ok,16,7,234)),bN(e),vN,f(aN,15,13)]),fl(dl(t)))}),b$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),C$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(yA,rN,h(nN,"p-"+Ni(t),t,t,t,t)):f(yA,rN,h(nN,d(b$,t,r,n,a),t,r,n,a))},E$=function(e){return function(){var t=Gd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?qk:f(VN,M([kN(10),C$({bottom:20,left:20,right:20,top:10})]),M([f(Kk,M([bN(24),vN]),fl("Trade History for User")),f(m$,18,e.agentAddress)]))},S$=function(e){return{$:"FiltersMsg",a:e}},T$=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},w$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),I$=xI,A$={$:"Left"},B$=SN(A$),k$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(fA,UN,TT("label"),e,wT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(fA,AT,Vk,a,wT(M([i])));switch(n.$){case"Above":return d(fA,UN,TT("label"),e,wT(M([o,r])));case"Below":return d(fA,UN,TT("label"),e,wT(M([r,o])));case"OnRight":return d(fA,FN,TT("label"),e,wT(M([r,o])));default:return d(fA,FN,TT("label"),e,wT(M([o,r])))}}),N$=function(e){return{$:"Label",a:e}},R$={$:"NoAttribute"},$$=function(e){if("HiddenLabel"===e.$){var t=e.a;return NN(N$(t))}return R$},_$=function(e){return"HiddenLabel"===e.$},L$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return hu("No key matched");var n=r.a;return Fi(n)},r=f(du,t,f(Oh,"key",pu));return ST(f(dN,"keyup",r))},x$=function(e){return f(Nn,"tabIndex",Ni(e))},P$=f(Da,ST,x$),D$={$:"LivePolite"},U$=NN(D$),O$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([_$(r)?R$:kN(6),ST(hN(i(!a))),U$,L$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),P$(0),uN,B$,ET(jk)]),e);return l(k$,o,r,d(fA,AT,Vk,M([ST(f(I$,"role","checkbox")),ST(f(I$,"aria-checked",a?"true":"false")),$$(r),eR,yT(jk),ET(bT)]),wT(M([n(a)]))))}),M$=Br,F$=function(e){return e*M$/180},V$=ZT(26),K$=function(e){return{$:"MoveY",a:e}},H$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),j$=function(e){return f(H$,V$,K$(-e))},q$=ZT(24),G$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),z$=function(e){return f(H$,q$,f(G$,x(0,0,1),e))},Y$=ZT(19),W$=function(e){return Cd(M([e.inset?"box-inset":"box-",mw(e.offset.a)+"px",mw(e.offset.b)+"px",mw(e.blur)+"px",mw(e.size)+"px",mA(e.color)]))},J$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(yA,Y$,l(jI,W$(t),"box-shadow",Cw(t)))},Q$=r(function(e,t){return f(yA,iA,h(h$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),X$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?p$(r):f(Q$,n,r):f(yA,iA,h(h$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},Z$=ZT(12),e_=f(oN,Z$,RT.textCenter),t_=l(pA,1,1,1),r_=function(e){return f(Kk,M([lA("focusable"),ET(zk(14)),yT(zk(14)),bA(t_),eR,bN(9),e_,cN(3),d$(e?l(pA,59/255,.6,252/255):l(pA,211/255,211/255,211/255)),J$({blur:1,color:e?d(YR,238/255,238/255,238/255,0):l(pA,238/255,238/255,238/255),offset:L(0,0),size:1}),Wk(e?l(pA,59/255,.6,252/255):t_),p$(e?0:1)]),e?f(Kk,M([d$(t_),yT(zk(6)),ET(zk(9)),z$(F$(-45)),wN,eR,j$(1),X$({bottom:2,left:2,right:0,top:0})]),qk):qk)},n_=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),a_={$:"OnRight"},i_=n_(a_),o_=r(function(e,t){return f(O$,yr,{checked:t.checked,icon:r_,label:f(i_,yr,fl(t.label)),onChange:f(w$,e,t.label)})}),u_={$:"Top"},s_=XN(u_),c_=function(e){return f(ON,M([kN(15),s_]),M([f(Kk,M([bN(28),gR]),fl(T$(e.type_))),f(ON,M([kN(5)]),f(xa,o_(e.type_),e.options))]))},f_=function(e){return f(VN,M([kN(20)]),f(xa,c_,e))},l_={$:"NoneFound"},d_={$:"AllFetched"},h_={$:"FetchingTrades"},p_={$:"QueryingNumTrades"},g_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return p_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?h_:d_}return l_},v_={$:"InFront"},y_=function(e){return f(t$,v_,e)},m_=r(function(e,t){var r=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},n=f(Eh,Ja(l_),f(xa,g_,e))?M([r("No trades found.")]):f(xa,r,mE(f(xa,function(e){switch(g_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),y_(f(ON,M([kN(5),B$]),n))]),f(Kk,M([wN]),f(Yi,S$,f_(t.filters))))}),b_=n(function(e,t,r){return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),f(aN,30,20)]),M([E$(r),f(m_,t,r),l(y$,e,t,r)]))}),C_=function(e){return{$:"ShowCurrencyDropdown",a:e}},E_={$:"AbortCreate"},S_=function(e){return{$:"AppCmd",a:e}},T_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),w_=function(e){return f(xa,function(e){return M([f(Kk,M([bA(EN)]),fl("Caution! ")),fl(e)])},mE(M([R(f(hv,e.autoreleaseInterval,Vl(12e5)),ba)?si(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."}()):ci,R(f(hv,e.autoabortInterval,Vl(36e5)),ba)?si(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.'}()):ci])))},I_=l(pA,0,0,1),A_=function(e){return f(Kk,M([C$({bottom:5,left:5,right:5,top:0}),pN(e),cN(30),Wk(d(YR,1,1,1,.4)),p$(1),d$(d(YR,0,0,0,.3)),uN,bN(14)]),f(Kk,M([bA(d(YR,0,0,0,.7))]),fl("x")))},B_=Bn,k_=B_,N_=ST,R_=r(function(e,t){return f(Kk,M([r$(f(Kk,M([Wk(e),N_(f(k_,"position","fixed")),N_(f(k_,"z-index","1000")),N_(f(k_,"top","0")),N_(f(k_,"left","0")),N_(f(k_,"width","100%")),N_(f(k_,"height","100%"))]),qk)),ET(jk),yT(jk)]),t)}),$_=r(function(e,t){return{$:"Max",a:e,b:t}}),__=r(function(e,t){return f($_,e,t)}),L_=n(function(e,t,r){return l(Pa,R_,d(YR,0,0,.3,.6),f(Kk,U(M([wN,eR,ET(f(__,500,bT)),Wk(tN),cN(8),y_(f(Kk,M([PN,s_]),A_(r)))]),e),t))}),x_=r(function(e,t){if("Nothing"===t.$)return qk;var r=t.a;return f(Kk,U(M([cN(5),d$(l(pA,.9,0,0)),p$(1),Wk(l(pA,1,.4,.4)),aR(5),wN,eR,ET(f(__,200,bT)),bN(14)]),e),f($N,yr,M([fl(r)])))}),P_={$:"Above"},D_=function(e){return f(t$,P_,e)},U_=r(function(e,t){return f(Kk,M([cN(4),f(aN,25,17),bN(18),vN,Wk(IR),D_(f(x_,M([j$(5)]),t))]),fl(e))}),O_=a(function(e,t,r,n){return d(hA,e/255,t/255,r/255,n)}),M_=d(O_,1,31,52,.64),F_=ZT(32),V_={$:"Active"},K_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),H_=$n,j_=r(function(e,t){switch(t.$){case"NoAttribute":return R$;case"Describe":var r=t.a;return NN(r);case"AlignX":var n=t.a;return SN(n);case"AlignY":var a=t.a;return XN(a);case"Width":var n=t.a;return CT(n);case"Height":var n=t.a;return vT(n);case"Class":var n=t.a,a=t.b;return f(oN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(yA,i,o);case"Nearby":var u=t.a,s=t.b;return f(t$,u,f(zi,e,s));case"Attr":var c=t.a;return ST(f(H_,e,c));default:var l=t.a,d=t.b;return f(H$,l,d)}}),q_=function(e){return f(j_,zg,e)},G_=r(function(e,t){var r=t.a,n=t.b,a=q_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(rA,n,o));default:return L(r,n)}}),z_=function(e){var t=l(Ra,G_,L(yr,sA),e),r=t.a,n=t.b;return f(ka,qI(n),r)},Y_=function(e){return f(yA,F_,f(K_,V_,z_(e)))},W_=ZT(33),J_={$:"Hover"},Q_=function(e){return f(yA,W_,f(K_,J_,z_(e)))},X_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Kk,M([cN(4),uN,pN(n),f(aN,25,17),bA(t),bN(18),vN,Wk(a),Y_(M([Wk(o)])),Q_(M([Wk(i)]))]),fl(r))}),Z_=r(function(e,t){return d(X_,x(d(YR,1,0,0,1),d(YR,1,0,0,.8),d(YR,1,0,0,.6)),tN,e,t)}),eL=function(e){return R_(d(YR,0,0,.3,.6))(f(ON,M([kN(10),wN,eR,Wk(d(YR,0,0,0,.5)),cN(8),aR(20)]),f(xa,function(e){return f($N,M([wN,eR,bN(20),vN,bA(tN),e_]),M([e]))},e)))},tL=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+kA(t)}e.a;return"https://kovan.etherscan.io/tx/"+kA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+kA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+kA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+kA(t)}}),rL={$:"Bottom"},nL=XN(rL),aL=lA(RT.underline),iL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(fl(u$(oC(a))),f(Z_,"Yes, I definitely want to open this trade.",l(T_,r,n,a)))}return L(fl("??"),f(U_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(L_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),e_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(M_)])),U(w_(n),U(M([M([fl("You will deposit "),i,fl(" "+NR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([fl("This ususally requires two Metamask signatures. Your "+NR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Kk,M([nL,wN]),o)])),E_);case"ApproveNeedsSig":var u=e.a;return f(Kk,M([pN(S_(d(Zd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),eL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Kk,M([pN(S_(d(Zd,"txChainModal clicked","misclick","ApproveMining",0)))]),eL(M([fl("Mining the initial approve transaction..."),f(dA,M([aL,bA(I_)]),{label:fl("See the transaction on Etherscan"),url:f(tL,eo(u),s)}),fl("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Kk,M([pN(S_(d(Zd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),eL(M([fl("Waiting for user signature for the create call."),fl("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Kk,M([pN(S_(d(Zd,"txChainModal clicked","misclick","CreateMining",0)))]),eL(M([fl("Mining the final create call..."),f(dA,M([aL,bA(I_)]),{label:fl("See the transaction on Etherscan"),url:f(tL,r,s)}),fl("You will be redirected when it's mined.")])))}}),oL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return qk;var r=t.a;return f(iL,r,e)},uL=function(e){return{$:"TradeAmountChanged",a:e}},sL=dT("id"),cL=N_(sL("inputError")),fL=l(Ok,109,127,138),lL=uR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),dL=function(e){return f(dR,f(ka,yT(zk(26)),e),lL)},hL=function(e){return f(VN,M([kN(4)]),M([dL(yr),f(Kk,M([bN(24),gR,bA(fL)]),fl(NR(e)))]))},pL=function(e){return{$:"HiddenLabel",a:e}},gL=pL,vL=dT("type"),yL=function(e){return L(e,!0)},mL=function(e){return{$:"MayStopPropagation",a:e}},bL=r(function(e,t){return f(lN,e,mL(t))}),CL=r(function(e,t){return l(La,Oh,t,e)}),EL=f(CL,M(["target","value"]),pu),SL=function(e){return f(bL,"input",f(Oi,yL,f(Oi,e,EL)))},TL=ZT(0),wL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),IL=function(e){var t=function(e){return 1-e}(f(Tc,1,f(ei,0,e)));return f(yA,TL,f(wL,"transparency-"+dw(t),t))},AL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),BL=f(Da,ST,I$("autocomplete")),kL=l(pA,136/255,138/255,133/255),NL=l(pA,186/255,189/255,182/255),RL=f(aN,12,12),$L=M([RL,cN(3),d$(NL),Wk(t_),p$(1),kN(3),ET(jk)]),_L=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},LL=function(e){return f(Ch,_L,e)?R$:lA("focusable")},xL=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},PL=ye,DL=r(function(e,t){return f(kn,e,PL(t))}),UL=DL("spellcheck"),OL=f(Da,ST,UL),ML=W,FL=ZT(47),VL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(ML(e))),o=(i-1)*t+f(xc,0,f(Bo,a,r))+f(xc,0,f(Bo,a,n));return f(yA,FL,l(jI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),KL=dT("value"),HL=f(Da,ST,KL),jL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(fw,"width",n)?L(r,n):L(f(ka,e,r),f(Gm,"width",n));case"Height":e.a;return f(fw,"height",n)?L(r,n):L(f(ka,e,r),f(Gm,"height",n));case"Describe":e.a;return f(fw,"described",n)?L(r,n):L(f(ka,e,r),f(Gm,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(fw,"align-x",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-x",n));case"AlignY":return f(fw,"align-y",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-y",n));default:return f(fw,"transform",n)?L(r,n):L(f(ka,e,r),f(Gm,"transform",n))}}),L(yr,sm),e).a},qL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,jL(e))}),GL=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}},zL=f(Da,Gi,ms),YL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([ST(SL(n.onChange))]),o=U($L,t),u=f(qL,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(ml,xL,o),c=f(qL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(qL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(qL,o,function(e){return"Nearby"===e.$})),p=f(ml,f(Da,ns,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([HL(n.text),ST(vL(a)),OL(e.spellchecked),lA(RT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return R$;var r=t.a;return BL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(GL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(AL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(AL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(xc,5,c);return x("textarea",U(M([OL(e.spellchecked),lA(RT.inputMultiline),f(xc,R$,f(Bo,BL,e.autofill)),function(){if("Nothing"===u.$)return R$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return C$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?R$:s.a?d(VL,n.text,v,u,g):R$}()]),h),M([zL(RI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(fA,AT,Vk,f(ka,ET(jk),ay(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([y_(f(Kk,f(ka,RL,U(s,U(M([bA(kL),lA(RT.noTextSelection+" "+RT.passPointerEvents),d$(d(YR,0,0,0,0)),Wk(d(YR,0,0,0,0)),yT(jk),ET(jk),IL(""===n.text?1:0)]),r))),a))])}()]))),wT(M([d(fA,AT,TT(v),ay(M([M([LL(t),$$(n.label)]),y,i])),wT(m))])));return l(k$,f(ka,f(oN,iN,RT.cursorText),f(ka,_$(n.label)?R$:kN(5),f(ka,U$,u))),n.label,b)}),WL=YL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),JL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(WL,M([ET(jk),yT(zk(40)),p$(0)]),{label:gL(r),onChange:i,placeholder:n,text:a});return f(VN,U(M([kN(5)]),e),mE(M([f(Bo,Kk(M([B$])),o),si(s),f(Bo,Kk(M([PN])),u)])))}),QL={$:"Below"},XL=function(e){return f(t$,QL,e)},ZL=function(e){return f(H$,V$,K$(e))},ex=n(function(e,t,r){return p(JL,M([ET(zk(150)),gR,bN(24),XL(f(x_,M([cL,ZL(5)]),r))]),L(ci,si(f(Kk,M([pN(S_(d(Zd,"click","misclick","dai symbol in dai input",0)))]),hL(e)))),"dai input",ci,t,uL)}),tx=Kk(M([d$(IR),X$({bottom:2,left:0,right:0,top:0})])),rx=r(function(e,t){return f(ON,M([kN(10)]),M([f(Kk,M([bN(17),vN]),fl(e)),t]))}),nx=r(function(e,t){return tx(f(rx,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(ex,e,t.inputs.daiAmount,t.errors.daiAmount)))}),ax=function(e){return f(xc,gS,Mg(e))},ix=function(e){var t=function(){var t=vd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+u$(f(Gl,r,100))+" "+NR(ax(e.wallet))+"."}return"There is a 1% fee."}();return f(VN,M([wN,f(aN,20,10),Wk(l(Ok,10,33,108)),cN(8),kN(5),pN(S_(d(Zd,"click","misclick","fee notify element",0)))]),M([f(Kk,M([bN(18),bA(l(Ok,0,226,255)),vN]),fl(t)),f(Kk,M([bN(17),bA(tN),gR]),fl("We only collect this fee when trades resolve successfully."))]))},ox=function(e){return{$:"FiatAmountChanged",a:e}},ux=function(e){return{$:"FiatTypeChanged",a:e}},sx=r(function(e,t){return l(SS,n(function(t,r,n){return f(e,t,r)?l(xl,t,r,n):n}),cp,t)}),cx=function(e){return f(sx,r(function(t,r){return f(Qg,e,t)}),HR)},fx=uR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),lx=function(e){return f(dR,M([yT(zk(26))]),f(xc,fx,f(Bo,fu,f(fp,e,HR))))},dx=function(e){return N_(f(bL,"click",Fi(L(e,!0))))},hx=zL,px=function(e){return{$:"AppendProperty",a:e}},gx=r(function(e,t){return px(e+":"+t)}),vx=r(function(e,t){return f(gx,e,t.value)}),yx=vx("cursor"),mx={$:"Compatible"},bx={cursor:mx,value:"default"},Cx=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Ex=function(e){return{$:"PseudoClassSelector",a:e}},Sx=function(e){return Cx(Ex(e))}("hover"),Tx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),wx=Tx,Ix=wx,Ax=Ix("span"),Bx=r(function(e,t){return f(kn,et(e),rt(t))}),kx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),Nx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),Rx=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),$x=r(function(e,t){return t<>>32-e}),_x=function(e){var t=e.hash?e.seed^f(Rx,461845907,f($x,15,f(Rx,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(Rx,2246822507,r^r>>>16),a=f(Rx,3266489909,n^n>>>13);return(a^a>>>16)>>>0},Lx=r(function(e,t){return f(Rx,5,f($x,13,e^f(Rx,461845907,f($x,15,f(Rx,3432918353,t)))))+3864292196}),xx=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},KP=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+"]"}},HP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,KP,r)));case"UniversalSelectorSequence":var r=e.a;return Iu(r)?"*":f(Ri,"",f(xa,KP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,KP,r)))}},jP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([VP(t),HP(r)]))},qP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,HP(t),f(xa,jP,r)),i=f(Ri,"",M([f(xc,"",f(Bo,FP,n))]));return f(oc,f(Ri," ",f(ml,f(Da,ns,_d),a)),i)},GP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,qP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,MP(a),"\n",e,"}"]))}),zP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(GP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,LP,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,UP,GP(" ")),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"}},YP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(ml,f(Da,ns,_d),M([RP(t),f(Ri,"\n",f(xa,PP,r)),f(Ri,"\n",f(xa,DP,n)),f(Ri,"\n\n",f(xa,zP,a))])))},WP=function(e){return YP(NP(AP(e)))},JP=function(e){return f(Ri,"\n\n",f(xa,WP,e))},QP=function(e){return{$:"Snippet",a:e}},XP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),ZP=function(e){return{$:"StyleBlockDeclaration",a:e}},eD=r(function(e,t){var r=l(Zx,t,yr,ci);return QP(M([ZP(l(XP,r,yr,e))]))}),tD=function(e){return Iu(e)?"unstyled":f(Is,P("_"),Ps(f(Px,15739,JP(AS(Dx(AS(f(eD,e,lP(yr)))))))))},rD=function(e){var t=tD(e),r=f(Bx,"className",hl(t));return l(kx,r,e,t)},nD=a(function(e,t,r,n){return f(e,f(ka,rD(t),r),n)}),aD=function(e){return{$:"Unstyled",a:e}},iD=function(e){return aD(Tw(e))},oD=iD,uD=r(function(e,t){return f(Tn,e,Xe(t))}),sD=function(e){return En(Xe(e))},cD=r(function(e,t){var r=e.b,n=e.c;return Iu(r)?t:l(xl,n,r,t)}),fD=function(e){return e.a},lD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,cD,i,s),p=l(Ra,dD,L(yr,h),c),g=p.a,v=p.b,o=l(JT,u,f(xa,fD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,cD,i,s),m=l(Ra,dD,L(yr,h),c),g=m.a,v=m.b,o=d(sD,y,u,f(xa,fD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,cD,i,s),b=l(Ra,lD,L(yr,h),c),g=b.a,v=b.b,o=l(WT,u,f(xa,fD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,cD,i,s),C=l(Ra,lD,L(yr,h),c),g=C.a,v=C.b,o=d(uD,y,u,f(xa,fD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),dD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,cD,n,o),c=l(Ra,dD,L(yr,s),u),h=c.a,p=c.b,a=l(JT,i,f(xa,fD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,cD,n,o),v=l(Ra,dD,L(yr,s),u),h=v.a,p=v.b,a=d(sD,g,i,f(xa,fD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,cD,n,o),y=l(Ra,lD,L(yr,s),u),h=y.a,p=y.b,a=l(WT,i,f(xa,fD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,cD,n,o),m=l(Ra,lD,L(yr,s),u),h=m.a,p=m.b,a=d(uD,g,i,f(xa,fD,o),$a(h));return L(f(ka,a,r),p)}}),hD=r(function(e,t){return h(Nl,kl,e,t,Rl,Rl)}),pD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(_d(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),gD=function(e){var t=f(pD,ci,e);if("Nothing"===t.$)return cp;var r=t.a,n=r.a,a=r.b;return f(hD,n,a)},vD=function(e){return{$:"ClassSelector",a:e}},yD=function(e){var t=e.a,r=e.b;return f(eD,r,lP(M([vD(t)])))},mD=function(e){return JP(AS(Dx(f(xa,yD,Ia(e)))))},bD=function(e){return l(JT,"style",yr,AS(Tw(mD(e))))},CD=n(function(e,t,r){var n=f(xa,fD,t),a=gD(t),i=l(Ra,dD,L(yr,a),r),o=i.a,u=i.b,s=bD(u);return l(JT,e,n,f(ka,s,$a(o)))}),ED=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),SD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(ED,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),TD=r(function(e,t){return L(f(SD,"_",t),bD(e))}),wD=n(function(e,t,r){var n=f(xa,fD,t),a=gD(t),i=l(Ra,lD,L(yr,a),r),o=i.a,u=i.b,s=f(TD,u,o);return l(WT,e,n,f(ka,s,$a(o)))}),ID=a(function(e,t,r,n){var a=f(xa,fD,r),i=gD(r),o=l(Ra,lD,L(yr,i),n),u=o.a,s=o.b,c=f(TD,s,u);return d(uD,e,t,a,f(ka,c,$a(u)))}),AD=a(function(e,t,r,n){var a=f(xa,fD,r),i=gD(r),o=l(Ra,dD,L(yr,i),n),u=o.a,s=o.b,c=bD(s);return d(sD,e,t,a,f(ka,c,$a(u)))}),BD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(CD,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(AD,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(wD,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(ID,a,t,r,n)}},kD=BD,ND=function(e){return hx(kD(d(nD,Ax,M([Sx(M([yx(bx)]))]),yr,M([oD(e)]))))},RD=J,$D=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),_D=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),LD=function(e){return l(La,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 si(h($D,n,a,i,o,u))}return ci}(),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 si(l(_D,a,t,i))}return ci}())}),L(ci,ci),e)},xD=r(function(e,t){var r=LD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),e))),wT(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?si(C$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),U(e,M([h]))))),wT(t))}var p=-s/2,g=-u/2;return d(fA,AT,Vk,e,wT(M([d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ST(f(k_,"margin",mw(p)+"px "+mw(g)+"px")),f(ka,ST(f(k_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,ST(f(k_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(yA,IN,l(AN,o,u,s)),yr))))),wT(t))])))}),PD=i(function(e,t,r,n,a){var i=f(WL,M([ET(zk(80)),yT(zk(40)),bN(24),gR,d$(IR),dx(r)]),{label:gL("currency type"),onChange:f(zo,RD,n),placeholder:ci,text:t}),o=f(fp,t,HR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return qk;r.b;return f(xD,M([ET(zk(350)),d$(DR),p$(1),Wk(tN),aR(10),wN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(VN,M([ET(zk(80)),kN(9),f(aN,0,5),dx(n(t)),Q_(M([Wk(l(pA,.8,.8,1))]))]),M([f(dR,M([yT(zk(26))]),a),f(Kk,M([bN(16),vN]),ND(t))]))},Ia(cx(t))))}return qk}();return f(VN,M([kN(4),XL(u)]),M([f(Kk,M([pN(a)]),lx(t)),i]))}),DD=i(function(e,t,r,n,a){var i=S_(d(Zd,"click","misclick","currency flag",0)),o=f(Kk,M([pN(S_(d(Zd,"click","misclick","currency symbol",0)))]),fl(jR(e))),u=f(Kk,M([XL(f(x_,M([cL,ZL(5)]),a))]),h(PD,r,e,C_(!0),ux,i));return p(JL,M([ET(zk(250)),gR,bN(24),XL(f(x_,M([cL,ZL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,ox)}),UD=function(e){return tx(f(rx,"For fiat",h(DD,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},OD=function(e){return{$:"ChangeRole",a:e}},MD=d(O_,1,31,52,.13),FD=r(function(e,t){var r=M([bN(24),gR,uN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([bA(MD)]))):L(U(r,M([bA(MD)])),r)}(),a=n.a,i=n.b;return f(VN,M([kN(20)]),M([f(Kk,U(M([pN(OD(lo))]),i),fl("Sell "+e)),f(Kk,U(M([pN(OD(fo))]),a),fl("Buy "+e))]))}),VD=r(function(e,t){return f(rx,"Trade Type",f(FD,NR(e),t.inputs.userRole))}),KD=J$({blur:20,color:d(O_,0,0,0,.04),offset:L(0,3),size:0}),HD=f(oN,IN,RT.spaceEvenly),jD=function(e){var t=ax(e.wallet);return f(ON,M([ET(jk),kN(20),Wk(tN),cN(5),aR(20),KD]),M([f(VN,M([ET(jk),HD]),M([f(VD,t,e),f(nx,t,e),UD(e)])),ix(e)]))},qD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),GD={$:"Web3Connect"},zD=function(e){return f(Kk,M([wN]),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(Z_,"Open Trade",f(qD,n,r))}t.b;return f(U_,"Unsupported Network",ci)}t.a;return f(Z_,"Connect to Wallet",GD)}())},YD=function(e){return{$:"AutoabortIntervalChanged",a:e}},WD=function(e){return{$:"ChangePaymentMethodText",a:e}},JD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),QD=JD,XD=function(e){return f(QD,M([bA(d(YR,0,0,0,.2))]),function(){return fl("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")}())},ZD={$:"TextArea"},eU=r(function(e,t){return l(YL,{autofill:ci,spellchecked:t.spellcheck,type_:ZD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),tU=n(function(e,t,r){var n=f(Kk,M([bN(22),vN]),fl("Payment Method")),a=f(eU,M([ET(jk),yT(zk(150)),Wk(d(O_,155,203,255,.2)),p$(0)]),{label:gL("payment method"),onChange:WD,placeholder:""===r?si(XD(t)):ci,spellcheck:!0,text:r});return f(ON,M([kN(20),C$({bottom:15,left:45,right:45,top:0}),ET(jk),D_(f(x_,M([cL,ZL(30),aR(10),bN(20),ET(zk(400))]),e))]),M([n,a]))}),rU=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."},nU=a(function(e,t,r,n){var a=l(Rs,e,P("0"),Ni(n));return f(Kk,M([bN(22),bA(t)]),fl(U(a,r)))}),aU=function(e){return jd(e)<0?Vl(0):e},iU=n(function(e,t,n){var a=r(function(e,r){return f(ON,M([kN(4)]),M([f(Kk,M([aR(4),uN,pN(n(f(qb,t,e)))]),f(dR,M([yT(zk(10))]),hR)),r,f(Kk,M([aR(4),uN,pN(n(function(e){return jd(e)?e:Vl(3e5)}(aU(f(LR,t,e)))))]),f(dR,M([yT(zk(10))]),sR))]))}),i=XR(t);return f(VN,M([HD,kN(10)]),M([f(a,Vl(864e5),d(nU,3,e," days",i.days)),f(a,Vl(36e5),d(nU,2,e," hours",i.hours)),f(a,Vl(3e5),d(nU,2,e," min",i.min))]))}),oU=o(function(e,t,r,n,a,i){var o=f(Kk,M([Wk(d(O_,155,203,255,.2)),cN(5),aR(15),D_(f(x_,M([cL]),a))]),l(iU,DR,n,i)),u=f(VN,M([kN(30)]),M([f(dR,M([yT(zk(40)),pN(S_(d(Zd,"click","misclick","symbol for "+t,0)))]),e),f(Kk,M([bN(22),vN]),fl(t))])),s=f($N,M([bN(17),gR,bA(M_)]),M([fl(r)]));return f(ON,M([ET(jk),cN(10),Wk(l(Ok,237,237,237)),kN(2)]),f(xa,Kk(M([Wk(tN),f(aN,45,18),ET(jk)])),M([u,f(VN,M([ET(jk),kN(25),Wk(tN)]),M([o,s]))])))}),uU=uR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),sU=f(oN,tR,RT.clipX),cU=f(oN,tR,RT.clipY),fU=i(function(e,t,r,n,a){return f(ON,M([kN(15),cN(8),sU,cU,Wk(tN)]),M([p(oU,uU,"Payment Window",rU(a),r,n,YD),l(tU,t,a,e)]))}),lU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},dU=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."},hU=uR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),pU=n(function(e,t,r){return f(Kk,M([cN(8),sU,cU,Wk(tN)]),p(oU,hU,"Burn/Release Window",dU(r),e,t,lU))}),gU=function(e){return{$:"AutorecallIntervalChanged",a:e}},vU=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."},yU=uR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),mU=n(function(e,t,r){return f(Kk,M([cN(8),Wk(tN),sU,cU]),p(oU,yU,"Open Window",vU(r),e,t,gU))}),bU=function(e){return f(ON,M([ET(jk),kN(20)]),M([l(mU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(fU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(pU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},CU=function(e){return f(ON,M([ET(f(__,1e3,jk)),wN,kN(20),C$({bottom:30,left:40,right:40,top:0}),pN(C_(!1)),y_(oL(e))]),M([jD(e),bU(e),zD(e.wallet)]))},EU=As(vb(8226)),SU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),TU=r(function(e,t){return l(Ra,ka,t,e)}),wU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(TU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),IU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(TU,f(lc,e%r,t),l(wU,yr,e/r|0,t))):f(lc,e,t)}),AU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(fw,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(Gm,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),BU=function(e){return d(AU,Ua,sm,e,yr)},kU=r(function(e,t){return f(Kk,M([ET(jk),y_(f(VN,M([kN(3),ET(nR(100)),ET(t),rR]),f(SU,f(Kk,M([bA(d(YR,0,0,0,.1)),bN(14)]),fl(EU)),f(xa,f(Da,Kk(M([bA(d(YR,0,0,0,.2))])),fl),f(IU,100,(e?$a:Ua)(BU(f(xa,f(zo,fu,Qa),Ia(HR)))))))))]),fl(" "))}),NU=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e))))),wT(M([n])))}),RU=lA(RT.italic),$U=function(){var e=f(Da,Kk(M([bA(l(pA,.8,.2,.2))])),fl),t=f(Da,Kk(M([_N])),fl);return f(ON,M([ET(jk),yT(jk),Wk(tN),cN(6),kN(50),J$({blur:20,color:d(O_,0,0,0,.1),offset:L(0,3),size:0}),cN(10),aR(20)]),M([f(kU,!1,jk),f(ON,M([wN,ET(f(__,700,jk)),kN(20)]),M([f($N,M([bN(70),_N,wN,e_]),M([fl("DAI"),e("Hard")])),f(VN,M([bN(30),vN,wN,e_,RU]),M([fl("The "),e("Global"),fl(", "),e("Unkillable"),fl(" Crypto Gateway")]))])),f(VN,M([Wk(CR),kN(2),wN,s_,ET(jk)]),M([f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([kN(60),PN]),M([f(Kk,M([bN(40),vN,wN]),fl("Want to learn more?")),f(ON,M([kN(15)]),M([f(NU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(I_),bA(tN),_N,bN(24),wN]),{label:f($N,M([e_]),M([fl("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"}),f(NU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(I_),bA(tN),_N,bN(24),wN]),{label:f($N,M([e_]),M([fl("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})]))]))),f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([B$,kN(60)]),M([f(Kk,M([bN(40),vN,wN]),fl("Ready to try it out?")),f(ON,M([kN(10),ET(zk(400)),wN]),M([f($N,M([bN(24),ET(jk)]),M([fl("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f($N,M([bN(24),ET(jk)]),M([fl("Then follow the links at the top of this page to browse "),t("Sell Offers"),fl(", browse "),t("Buy Offers"),fl(", or "),t("Create Your Own Offer"),fl(".")]))]))])))])),f(Kk,M([nL,ET(jk)]),f(kU,!0,jk))]))}(),_U=r(function(e,t){return f(Ay,f(zo,function(e){return e.type_},Ja(e)),t)}),LU=function(e){return{$:"ShowCurrencyDropdown",a:e}},xU=r(function(e,t){return ml(t(e))}),PU=a(function(e,t,r,n){var a=l(xU,e,n.filterFunc,ay(f(xa,GN,r)));return R(a,yr)?qk:f(Yi,Rv,d(v$,e,n.tradeTable,M([t?Av:xo,JN,YN,WN,QN,zN]),a))}),DU=function(e){return{$:"FiltersMsg",a:e}},UU={$:"ApplyInputs"},OU=DL("disabled"),MU=function(e){return{$:"MayPreventDefault",a:e}},FU=r(function(e,t){return f(lN,e,MU(t))}),VU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):hu("Not the enter key")},n=f(du,r,f(Oh,"key",pu));return ST(f(FU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),KU=function(e){return f(VU,"Enter",e)},HU={$:"Button"},jU=r(function(e,t){var r=t.onPress,n=t.label;return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY+" "+RT.seButton+" "+RT.noTextSelection),f(ka,uN,f(ka,LL(e),f(ka,NN(HU),f(ka,ST(x$(0)),function(){if("Nothing"===r.$)return f(ka,ST(OU(!0)),e);var t=r.a;return f(ka,pN(t),f(ka,KU(t),e))}()))))))),wT(M([n])))}),qU=f(jU,M([Wk(I_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Apply")),onPress:si(UU)}),GU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(yA,sN,l(jI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},zU=function(e){return f(dN,"focus",Fi(e))},YU=f(Da,ST,zU),WU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([YU(e(!0)),dx(e(!0))])}();return f(VN,U(e,M([yT(zk(40)),J$({blur:20,color:d(O_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Kk,M([Wk(IR),yT(zk(40)),GU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Kk,M([eR,f(aN,10,0)]),r)),f(WL,U(s,U(t,M([ET(zk(100)),yT(zk(40)),d$(IR),GU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),X$({bottom:1,left:0,right:1,top:1})]))),{label:gL(n),onChange:u,placeholder:i,text:a})]))}),JU=function(e){return{$:"MaxDaiChanged",a:e}},QU=function(e){return{$:"MinDaiChanged",a:e}},XU=r(function(e,t){return f(ON,M([ET(jk),kN(8)]),M([f(Kk,M([bN(17),gR]),fl(e)),t]))}),ZU=ZT(25),eO=function(e){return{$:"MoveX",a:e}},tO=function(e){return f(H$,ZU,eO(-e))},rO={$:"OnLeft"},nO=function(e){return f(t$,rO,e)},aO=n(function(e,t,r){var n=dL(M([eR])),a=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("max"))])),i=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("min"))]));return f(XU,"Dai Range",f(ON,M([kN(5),ET(zk(200))]),M([v(WU,M([nO(f(x_,M([tO(5),ET(zk(200))]),r.minDai))]),M([YU(LU(!1))]),i,"min Dai",e,ci,ci,QU),v(WU,M([nO(f(x_,M([tO(5),ET(zk(200))]),r.maxDai))]),M([YU(LU(!1))]),a,"max Dai",t,ci,ci,JU)])))}),iO=function(e){var t=f(fp,e,HR);if("Nothing"===t.$)return fl("*");var r=t.a,n=r.b;return f(dR,M([yT(zk(26))]),n)},oO=function(e){return{$:"AppCmd",a:e}},uO=function(e){return{$:"FiatTypeInputChanged",a:e}},sO=n(function(e,t,r){var n=oO(d(Zd,"click","misclick","currency flag",0)),a=iO(t);f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("max"))])),f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("min"))]));return f(Kk,M([s_,ET(zk(120))]),f(XU,"Fiat Type",h(PD,e,t,LU(!0),uO,n)))}),cO={$:"AddSearchTerm"},fO=function(e){return{$:"PaymentMethodInputChanged",a:e}},lO=f(Oh,"keyCode",CE),dO=function(e){return f(dN,"keyup",f(du,function(t){return 13===t?Fi(e):hu(Ni(t))},lO))},hO=function(e){return f(XU,"Search Payment Methods",f(WL,M([s_,ET(zk(250)),yT(zk(40)),d$(IR),J$({blur:20,color:d(O_,233,237,242,.05),offset:L(0,3),size:0}),N_(dO(cO))]),{label:gL("payment methods search"),onChange:fO,placeholder:ci,text:e}))},pO={$:"ResetSearch"},gO=f(jU,M([Wk(I_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Reset")),onPress:si(pO)}),vO=function(e){return{$:"RemoveTerm",a:e}},yO=function(e){return f(Kk,M([aR(3),s_,uN,pN(vO(e)),bN(10),bA(EN)]),fl("x"))},mO=function(e){if(e.b){var t=e;return f(VN,M([ET(jk),aR(10),kN(10)]),f(xa,function(e){return f(VN,M([Wk(d(O_,16,7,234,.2)),cN(5),aR(4),kN(3)]),M([fl(e),yO(e)]))},t))}return qk},bO=i(function(e,t,r,n,a){var i=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},o=f(Eh,Ja(l_),f(xa,g_,e))?M([i("No trades found.")]):f(xa,i,mE(f(xa,function(e){switch(g_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),y_(f(ON,M([kN(5),B$]),o))]),f(VN,M([wN,kN(50)]),M([f(Yi,DU,f_(t)),f(VN,M([ET(bT),kN(10)]),M([f(Kk,M([ET(bT),s_]),l(aO,r.minDai,r.maxDai,n)),f(Kk,M([ET(bT),s_]),l(sO,a,r.fiatType,n)),f(ON,M([ET(bT),s_,kN(5)]),M([hO(r.paymentMethod),mO(r.paymentMethodTerms)])),f(XU," ",f(ON,M([kN(5),ET(bT)]),M([qU,gO])))]))])))}),CO=n(function(e,t,r){var n=function(){return!f(xc,0,f(Bo,function(e){return f(MS,function(e){return e.checked&&"Open"!==e.label},e.options)},f(_U,Eo,r.filters)))}();return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),pN(LU(!1)),aR(30)]),M([f(VN,M([ET(jk),kN(10)]),M([h(bO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),d(PU,e,n,t,r)]))}),EO=function(e){return{$:"MessageInputChanged",a:e}},SO={$:"MessageSubmit"},TO=function(e){return f(ON,M([ET(jk),kN(10)]),M([f(eU,M([ET(jk),yT(zk(100))]),{label:gL("messageInput"),onChange:EO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(jU,M([wN,bN(24)]),{label:fl("Submit"),onPress:si(SO)})]))},wO=f(oN,tR,RT.scrollbarsY),IO=r(function(e,t){return f(Kk,M([yT(jk),ET(jk)]),f(Kk,U(M([N_(f(k_,"position","absolute")),N_(f(k_,"top","0")),N_(f(k_,"right","0")),N_(f(k_,"bottom","0")),N_(f(k_,"left","0")),wO]),e),t))}),AO=l(Ok,200,205,210),BO=n(function(e,t,r){var n=M([PN,Wk(I_),bA(tN),GU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([B$,Wk(AO),bA(DR),GU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Kk,U(M([aR(7)]),u),f($N,yr,M([fl(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(pA,0,0,1),tN,"Initiator opened the trade"));case"Recalled":return si(x(l(pA,0,0,1),tN,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(ru,8,dl(t))+"..";return si(x(l(pA,1,0,1),tN,r+" committed to the trade"));case"Aborted":return si(x(l(pA,1,0,0),tN,"Buyer aborted the trade"));case"Claimed":return si(x(l(pA,0,1,0),tN,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(pA,0,0,1),tN,"Seller released the "+NR(e)+" and closed the contract"));default:return si(x(l(pA,0,0,1),tN,"Seller burned the "+NR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return qk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Kk,M([cN(3),p$(1),d$(l(pA,1,0,1)),wN,Wk(h)]),f($N,M([bA(p)]),M([fl(g)])))}),kO=n(function(e,t,r){if(r.b){var n=r;return f(IO,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),aR(10)]),f(ON,M([ET(jk),yT(jk),kN(10)]),f(xa,f(BO,e,t),n)))}return f(Kk,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),wN,bA(l(pA,.5,.5,.5)),RU]),fl("no messages found."))}),NO=Cr,RO=function(e){return f(ON,M([ET(jk),yT(jk),kN(10),p$(1),cN(5),aR(20)]),M([l(kO,e.trade.factory,e.userRole,f(NO,function(e){return e.blocknum},Sa(e.history))),TO(e)]))},$O=function(e){return f(Kk,M([Wk(tN),cN(8),KD,ET(jk),yT(jk)]),RO(e))},_O={$:"ToggleChat"},LO=function(e){if(e.showChatHistory){var t=f(xc,qk,f(Bo,$O,e.chatHistoryModel));return f(Kk,M([yT(jk),ET(zk(500)),aR(20),PN]),l(L_,M([yT(jk),ET(jk)]),f(Yi,jE,t),_O))}return qk},xO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},PO=function(e){return zR(e)+" "+e.fiatType},DO={$:"AbortAction"},UO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),OO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return qk}if("LoadedTrade"!==t.b.$)return qk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=PO(n.terms.price),u=u$(oC(i)),s=u$(n.parameters.tradeAmount)+" "+NR(n.factory),c=function(){return"Buyer"===xO(n.parameters).$?L(f(Kk,M([gR,bA(DR)]),fl("buyer")),M([fl("pay the seller "),f(Kk,M([bA(I_)]),fl(o)),fl(" in exchange for the "),f(Kk,M([bA(I_)]),fl(s)),fl(" held in this contract.")])):L(f(Kk,M([gR,bA(DR)]),fl("seller")),M([fl("accept "),f(Kk,M([bA(I_)]),fl(o)),fl(" from the buyer in exchange for the "),f(Kk,M([bA(I_)]),fl(s)),fl(" held in this contract.")]))}(),d=c.a,h=c.b;return l(L_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),e_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(M_)])),U(M([U(M([fl("You will deposit "),f(Kk,M([bA(I_)]),fl(u+" "+NR(n.factory))),fl(", thereby becoming the "),d,fl(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([fl("(This ususally requires two Metamask signatures. Your "+NR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Kk,M([nL,wN]),f(Z_,"Yes, I definitely want to commit to this trade.",l(UO,n,a,i)))])),DO);case"ApproveNeedsSig":return eL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return eL(M([fl("Mining the initial approve transaction..."),f(dA,M([aL,bA(I_)]),{label:fl("See the transaction on Etherscan"),url:f(tL,n.factory,p)}),fl("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return eL(M([fl("Waiting for user signature for the final commit call."),fl("(check Metamask!)"),fl("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return eL(M([fl("Mining the final commit transaction..."),f(dA,M([aL,bA(I_)]),{label:fl("See the transaction"),url:f(tL,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(L_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),e_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(M_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([fl('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 '+NR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([fl("Aborting will incur a small penalty on both parties, and refund the rest of the "+NR(n.factory)+".")])]);case"Release":return M([M([fl("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([fl("This will destroy the "+NR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Kk,M([nL,wN]),function(e){return f(Z_,e,sS(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 "+NR(n.factory)+".";default:return"I understand. Burn the "+NR(n.factory)+"."}}()))])),DO);case"ActionNeedsSig":var g=r.a;return eL(M([fl("Waiting for user signature for the "+fS(g)+" call."),fl("(check Metamask!)")]));default:var g=r.a,p=r.b;return qk}},MO=VN(M([ET(jk),Wk(tN),cN(5),aR(20),HD,KD])),FO=function(e){return f(VN,M([kN(8)]),M([f(dR,yr,lL),f(Kk,M([bN(24),gR]),fl(u$(e)))]))},VO=r(function(e,t){var r=f(Io,Ao(e),f(Bo,function(e){return e.address},Gd(t)));return f(rx,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"}(),FO(e.parameters.tradeAmount))}),KO=function(e){return f(VN,M([kN(5)]),M([lx(e.fiatType),f(Kk,M([bN(24),gR]),fl(PO(e)))]))},HO=function(e){return f(rx,"For Fiat",KO(e.terms.price))},jO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},qO=l(Ok,250,165,22),GO=l(Ok,255,0,0),zO=l(Ok,0,255,0),YO=uR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),WO=uR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),JO=uR({description:"released",src:"/DAIHard/static/img/released.svg"}),QO={$:"ToggleStatsModal"},XO=function(e){return f(NO,Ua,e)},ZO=n(function(e,t,n){var a=ay(f(xa,function(e){return f(ml,function(e){return R(f(ko,e,n),si(t))},f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(fh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(fh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wl,amountReleased:Wl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,Vl,Ql(XO(f(US,function(e){return function(e){return e?si(e):ci}(jd(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}}),eM=r(function(e,t){return d(X_,x(d(YR,0,0,1,1),d(YR,0,0,1,.8),d(YR,0,0,1,.6)),tN,e,t)}),tM=function(e){return{$:"ViewUserHistory",a:e}},rM=f(JB,0,yr),nM=f(oN,gN,RT.textNormalWeight),aM=r(function(e,t){return Za(e/t)}),iM=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}}),oM=r(function(e,t){var r=e.a,n=e.b;return l(iM,r,f(aM,jd(t),6e4),n)}),uM=r(function(e,t){return f(_s,24,f(aM,f(oM,e,t),60))}),sM=r(function(e,t){return f(_s,1e3,jd(t))}),cM=r(function(e,t){return f(_s,60,f(oM,e,t))}),fM={$:"Apr"},lM={$:"Aug"},dM={$:"Dec"},hM={$:"Feb"},pM={$:"Jan"},gM={$:"Jul"},vM={$:"Jun"},yM={$:"Mar"},mM={$:"May"},bM={$:"Nov"},CM={$:"Oct"},EM={$:"Sep"},SM=function(e){var t=f(aM,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)}},TM=r(function(e,t){switch(SM(f(oM,e,t)).month){case 1:return pM;case 2:return hM;case 3:return yM;case 4:return fM;case 5:return mM;case 6:return vM;case 7:return gM;case 8:return lM;case 9:return EM;case 10:return CM;case 11:return bM;default:return dM}}),wM=r(function(e,t){return f(_s,60,f(aM,jd(t),1e3))}),IM={$:"Fri"},AM={$:"Mon"},BM={$:"Sat"},kM={$:"Sun"},NM={$:"Thu"},RM={$:"Tue"},$M={$:"Wed"},_M=r(function(e,t){switch(f(_s,7,f(aM,f(oM,e,t),1440))){case 0:return NM;case 1:return IM;case 2:return BM;case 3:return kM;case 4:return AM;case 5:return RM;default:return $M}}),LM=n(function(e,t,r){return e.toAmPm(f(uM,t,r))}),xM=r(function(e,t){return SM(f(oM,e,t)).day}),PM=xM,DM=M([kM,AM,RM,$M,NM,IM,BM]),UM=r(function(e,t){return function(e){return e.a}(f(xc,L(0,kM),Ql(f(ml,function(r){return R(r.b,f(_M,e,t))},f(Bi,r(function(e,t){return L(e,t)}),DM)))))}),OM=function(e){return l(Ra,Na,0,e)},MM=r(function(e,t){return SM(f(oM,e,t)).year}),FM=function(e){return!f(_s,4,e)&&(!!f(_s,100,e)||!f(_s,400,e))},VM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return FM(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}}),KM=M([pM,hM,yM,fM,mM,vM,gM,lM,EM,CM,bM,dM]),HM=r(function(e,t){return f(xc,L(0,pM),Ql(f(ml,function(r){r.a;return R(r.b,f(TM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),KM))))}),jM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(HM,e,t))}),qM=r(function(e,t){var r=f(lc,f(jM,e,t)-1,KM);return OM(f(xa,VM(f(MM,e,t)),r))+f(PM,e,t)}),GM=r(function(e,t){return f(jM,e,t)/4|0}),zM=r(function(e,t){var r=Ni(t),n=e-Qo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),YM=function(e){return e?e<=12?e:e-12:12},WM=sv(315576e5),JM=r(function(e,t){return Vl(WM*f(MM,e,t))}),QM=r(function(e,t){var r=f(JM,e,t),n=f(UM,e,r);return 1+((f(qM,e,t)+n)/7|0)}),XM=r(function(e,t){return Ni(f(MM,e,t))}),ZM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(jM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(jM,t,r));case"MonthFixed":return f(zM,2,f(jM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(TM,t,r));case"MonthNameFull":return e.toMonthName(f(TM,t,r));case"QuarterNumber":return Ni(1+f(GM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(GM,t,r));case"DayOfMonthNumber":return Ni(f(PM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(PM,t,r));case"DayOfMonthFixed":return f(zM,2,f(PM,t,r));case"DayOfYearNumber":return Ni(f(qM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(qM,t,r));case"DayOfYearFixed":return f(zM,3,f(qM,t,r));case"DayOfWeekNumber":return Ni(f(UM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(UM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(_M,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(_M,t,r));case"WeekOfYearNumber":return Ni(f(QM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(QM,t,r));case"WeekOfYearFixed":return f(zM,2,f(QM,t,r));case"YearNumberLastTwo":return f(ou,2,f(XM,t,r));case"YearNumber":return f(XM,t,r);case"AmPmUppercase":return RD(l(LM,e,t,r));case"AmPmLowercase":return sd(l(LM,e,t,r));case"HourMilitaryNumber":return Ni(f(uM,t,r));case"HourMilitaryFixed":return f(zM,2,f(uM,t,r));case"HourNumber":return Ni(YM(f(uM,t,r)));case"HourFixed":return f(zM,2,YM(f(uM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(uM,t,r));case"HourMilitaryFromOneFixed":return f(zM,2,1+f(uM,t,r));case"MinuteNumber":return Ni(f(cM,t,r));case"MinuteFixed":return f(zM,2,f(cM,t,r));case"SecondNumber":return Ni(f(wM,t,r));case"SecondFixed":return f(zM,2,f(wM,t,r));case"MillisecondNumber":return Ni(f(sM,t,r));case"MillisecondFixed":return f(zM,3,f(sM,t,r));default:return n.a}}),eF=a(function(e,t,r,n){return f(Ri,"",f(xa,l(ZM,e,r,n),t))}),tF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),rF=function(e){return e>11?"pm":"am"},nF=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"}},aF=function(e){switch(f(_s,100,e)){case 11:case 12:case 13:return"th";default:switch(f(_s,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},iF=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"}},oF=p(tF,nF,f(zo,nF,ru(3)),iF,f(zo,iF,ru(3)),rF,aF),uF=eF(oF),sF={$:"MonthNameFull"},cF=sF,fF=function(e){return{$:"Text",a:e}},lF=fF,dF={$:"YearNumber"},hF=dF,pF=n(function(e,t,n){var a=r(function(e,t){return f(ON,M([bN(18),kN(6)]),M([f(Kk,M([_N]),fl(e)),f(Kk,M([nM]),fl(t))]))}),i=uF(M([cF,lF(", "),hF])),o=f(ON,M([kN(23),ET(jk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,rM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+u$(n.amountReleased)+" "+NR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+u$(n.amountBurned)+" "+NR(e)+" Burned")])),M([f(Kk,M([wN]),f(eM,"View User History",tM(n.asRole)))])));return f(ON,M([cN(8),sU,cU,Wk(IR),kN(1),J$({blur:20,color:d(YR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Kk,M([ET(jk),Wk(tN),aR(17)]),f(m$,18,t)),f(Kk,M([ET(jk),Wk(tN),aR(17)]),o)]))}),gF=n(function(e,t,r){var n=l(ZO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=jO(e.parameters.initiatorRole)+" Stats";return f(Kk,r?M([XL(f(Kk,M([ZL(30),PN]),l(pF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(rx,a,f(VN,M([ET(jk),kN(20),uN,pN(QO)]),f(xa,VN(M([kN(5)])),M([M([f(dR,M([yT(zk(28))]),JO),f(Kk,M([bN(24),gR,bA(zO)]),fl(l(Rs,2,P("0"),Ni(n.numReleases))))]),M([f(dR,M([yT(zk(28))]),YO),f(Kk,M([bN(24),gR,bA(qO)]),fl(l(Rs,2,P("0"),Ni(n.numAborts))))]),M([f(dR,M([yT(zk(28))]),WO),f(Kk,M([bN(24),gR,bA(GO)]),fl(l(Rs,2,P("0"),Ni(n.numBurns))))])])))))}),vF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+dl(t)}e.a;return"https://kovan.etherscan.io/address/"+dl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+dl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+dl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+dl(t)}}),yF=n(function(e,t,r){return f(dA,e,{label:fl(dl(r)),url:f(vF,t,r)})}),mF=function(e){return f(rx,"Trade Status",f(ON,M([bN(24),gR,kN(8)]),M([fl(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(yF,M([bN(12),bA(I_),aL]),e.factory,e.creationInfo.address)])))},bF=i(function(e,t,r,n,a){return MO(M([mF(t),f(VO,t,r),HO(t),l(gF,t,n,a)]))}),CF=l(Ok,9,32,107),EF=uR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),SF=f(Kk,M([cN(4),uN,pN(_O),aR(5),Wk(l(Ok,22,0,255))]),f(dR,M([ET(zk(42))]),EF)),TF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},wF=function(e){return f(ON,M([cN(12),Wk(IR),aR(15),kN(15)]),M([f(Kk,M([bN(24),vN,RU]),fl("Fiat Payment Method")),f($N,M([bN(18),yT(bT),Wk(tN),J$({blur:5,color:d(YR,0,0,0,.2),offset:L(-3,3),size:0}),cN(3),aR(5)]),M([f(xc,f(Kk,M([bA(MD),RU]),fl("No payment methods found.")),f(Bo,fl,f(Bo,function(e){return e.info},Ql(e))))]))]))},IF={$:"Active"},AF=function(e){return{$:"ExpandPhase",a:e}},BF=M([Wk(CF),bA(tN)]),kF=r(function(e,t){return{$:"Min",a:e,b:t}}),NF=r(function(e,t){return f(kF,e,t)}),RF=function(e){return M(e?[cN(12),s_,yT(f(NF,380,bT))]:[cN(12),wN])},$F=M([Wk(tN)]),_F=uR({description:"flame",src:"/DAIHard/static/img/flame.png"}),LF=r(function(e,t){return Hl(f(ds,jl(e),jl(t)))}),xF=r(function(e,t){return d(X_,x(d(YR,1,.6,.2,1),d(YR,1,.6,.2,.8),d(YR,1,.6,.2,.6)),tN,e,t)}),PF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),DF=function(e){return{$:"ContractActionClicked",a:e}},UF={$:"Web3Connect"},OF=n(function(e,t,r){var n=Gd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(xR,e,t).$?qk:f(VN,M([kN(8)]),function(){var e=x(t.state.phase,f(Ao,t,a.address),f(ko,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,sS,f(eM,"Remove and Refund this Trade",oS))])}break e}var r=(e.a,e.b,jl(Fb(t.parameters)));return M([f(Z_,"Deposit and Commit to Trade",l(PF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(xF,"Abort Trade",GE)),f(Yi,DF,f(Z_,"Confirm Payment",ZE)),SF])}e.a,e.c.a;return M([SF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(Z_,"Burn it All!",XE)),f(Yi,DF,f(eM,"Release Everything",uS)),SF])}e.a,e.c.a;return M([SF])}break e;default:break e}return yr}())}return f(Z_,"Connect to Wallet",UF)}),MF={$:"Finished"},FF={$:"NotStarted"},VF=r(function(e,t){var r=L(ER(t),ER(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?FF:R(n,a)?IF:MF}),KF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),HF=r(function(e,t){return l(KF,yr,e,t)}),jF=a(function(e,t,r,n){var a=u$(f(fh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+NR(r.factory),i=u$(r.parameters.tradeAmount)+" "+NR(r.factory),o=f(VN,yr,f(HF,3,f(dR,M([yT(zk(18))]),_F))),u=f(Da,Kk(M([bA(l(pA,1,0,0))])),fl),s=R(e,r.state.phase),c=f(Io,ko(r),f(Bo,function(e){return e.address},Gd(n))),d=s?tN:DR,h=$N(M([bA(d),bN(18),vN])),p=PO(r.terms.price),g=s?l(Ok,0,226,255):l(Ok,16,7,234),v=f(Da,Kk(M([bA(g)])),fl),y=u$(r.parameters.buyerDeposit)+" "+NR(r.factory),m=r.parameters.abortPunishment,b=u$(m)+" "+NR(r.factory),C=u$(f(LF,r.parameters.buyerDeposit,m))+" "+NR(r.factory),E=u$(f(LF,r.parameters.tradeAmount,m))+" "+NR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([fl("Your "),u("burnable deposit"),fl(" of "),v(y),fl(" is now held in this contract, and your offer to buy "),v(i),fl(" for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Seller by depositing the full "),v(i),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),fl(" to you.")])])):f(xa,h,M([M([fl("Your offer to sell the "),v(i),fl(" held in this contract for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),fl(" of 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),fl(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([fl("You must now pay the Seller "),v(p),fl(" via the Fiat Payment Method, "),f(Kk,M([vN]),fl("and then click ")),u("Confirm Payment"),fl(" before the payment window runs out. Use the chat to coordinate.")]),M([fl("If you abort the trade, or do not confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to you).")]),M([fl("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),fl(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([fl("Work and communicate with the Buyer to receive "),v(p),fl(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to you, "),v(C),fl(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),fl(" will be released to you.")]),M([fl("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),fl(" In this case the "),v(a),fl(" will be lost to both parties.")]),M([fl("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([fl("So, have you recieved the "),v(p),fl("? If so, you can click "),v("Release Everything"),fl(".")]),M([fl("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),fl(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([fl("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([fl("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([fl("The Seller has deposited "),v(i),fl(" into this contract, and offers to sell it for "),v(p),fl(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("If the trade is successful, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),fl(" within the payment window.")])])):f(xa,h,M([M([fl("The Buyer is offering to buy "),v(i),fl(" for "),v(p),fl(", and has deposited "),v(y),fl(" into this contract as a "),u("burnable deposit"),fl(". To become the Seller, deposit "),v(i),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("When you receive the "),v(p),fl(" from the Buyer, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can receive "),v(p),fl(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([fl("During this phase, the Buyer is expected to transfer "),v(p),fl(" to the Seller, as described in Fiat Payment Method, "),f(Kk,M([vN]),fl("and ")),u("Confirm the Payment "),fl(" before the payment window runs out. This would move the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(" amount) will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([fl("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([fl("If the Seller can verify he has received the "),v(p),fl(", he will probably release the total balance of "),v(i),fl(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),fl(".")]),M([fl("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),fl(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(ON,M([ET(jk),yT(jk),aR(20),kN(30)]),M([f(VN,M([ET(jk)]),M([f(Kk,M([bN(24),vN,bA(g),B$]),fl(T))])),f(ON,M([ET(jk),eR,kN(13)]),w),f(Kk,M([PN]),function(){switch(f(VF,r,e).$){case"Active":return l(OF,t,r,n);case"NotStarted":return f(Kk,M([bN(20),vN,RU,bA(CR)]),fl("Phase not yet started."));default:return f(Kk,M([bN(20),vN,RU]),fl("Phase no longer active."))}}())]))}),qF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},GF=uR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),zF=uR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),YF={$:"None"},WF=YF,JF=uR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),QF=function(e){switch(e.$){case"Open":return JF;case"Committed":return GF;case"Judgment":return zF;default:return WF}},XF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),ZF=a(function(e,t,r,n){return d(XF,e,t,r,n)}),eV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},tV=function(e){return function(e){return d(ZF,e.red,e.green,e.blue,e.alpha)}(eV(e))},rV=function(e){return{$:"Circle",a:e}},nV=rV,aV=d(XF,0,0,0,1),iV={$:"Flat"},oV={$:"Sharp"},uV=function(e){return{$:"Uniform",a:e}},sV=uV,cV={cap:iV,dashPattern:yr,dashPhase:0,fill:sV(aV),join:oV,thickness:2},fV=n(function(e,t,r){return D(cV,{dashPattern:e,fill:r,thickness:t})}),lV=fV(yr),dV={$:"Transparent"},hV=dV,pV=f(lV,0,hV),gV=r(function(e,t){return{$:"Shape",a:e,b:t}}),vV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},yV=function(e){return f(Da,vV,gV(e))},mV=function(e){return yV(L(e,pV))},bV=function(e){return L(-e.a,-e.b)},CV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),EV=r(function(e,t){return f(CV,bV(e(t)),t)}),SV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},TV=r(function(e,t){return{$:"Path",a:e,b:t}}),wV=kr,IV=Nr,AV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=IV(n),i=wV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},BV=function(e){return xa(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)})},kV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(BV,e,M([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 M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},RV=function(e){var t=$V(e.basic),r=SV(f(xa,AV(e),t)),n=r.a,a=r.b;return{toBottom:-f(xc,0,gI(a)),toLeft:-f(xc,0,gI(n)),toRight:f(xc,0,pI(n)),toTop:f(xc,0,pI(a))}},$V=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(kV,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(kV,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(kV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(BV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(TV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(BV,R(C,iV)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(kV,0,E);case"Group":var S=e.a;return f(BV,0,ay(f(xa,f(zo,RV,NV),S)));default:var T=e.b;return f(BV,0,NV(RV(T)))}},_V=function(e){var t=RV(e);return t.toTop+t.toBottom},LV=function(e){var t=RV(e);return L(-t.toLeft,t.toTop)},xV=function(e){var t=RV(e);return t.toLeft+t.toRight},PV=En("http://www.w3.org/2000/svg"),DV=PV("svg"),UV=Nn("height"),OV=Nn("version"),MV=Nn("width"),FV=PV("circle"),VV=PV("ellipse"),KV=PV("foreignObject"),HV=PV("g"),jV=PV("image"),qV=PV("polygon"),GV=PV("polyline"),zV=PV("rect"),YV=Tw,WV=PV("text"),JV=Nn("id"),QV=Nn("points"),XV=Nn("r"),ZV=Nn("rx"),eK=Nn("ry"),tK=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},rK=function(e){return{$:"Group",a:e}},nK=Nn("dominant-baseline"),aK=Nn("fill"),iK=Nn("fill-opacity"),oK=Nn("font-family"),uK=Nn("font-size"),sK=Nn("font-style"),cK=Nn("font-variant"),fK=Nn("font-weight"),lK=Nn("opacity"),dK=Nn("stroke"),hK=Nn("stroke-dasharray"),pK=Nn("stroke-dashoffset"),gK=Nn("stroke-linecap"),vK=Nn("stroke-linejoin"),yK=Nn("stroke-opacity"),mK=Nn("stroke-width"),bK=Nn("text-anchor"),CK=Nn("text-decoration"),EK=Nn("transform"),SK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},TK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},wK=n(function(e,t,r){return d(XF,e,t,r,1)}),IK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return sv(1e4*e)/100};return Cd(M(["rgba(",mw(i(t)),"%,",mw(i(r)),"%,",mw(i(n)),"%,",mw(function(e){return sv(1e3*e)/1e3}(a)),")"]))},AK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},BK=function(e){var t=AK(e),r=t.red,n=t.green,a=t.blue;return IK(l(wK,r,n,a))},kK=function(e){if("Uniform"===e.$){var t=e.a;return BK(t)}return"none"},NK=function(e){var t=AK(e),r=t.alpha;return mw(r)},RK=function(e){if("Uniform"===e.$){var t=e.a;return NK(t)}return"0"},$K=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},_K=function(e){var t=mw(e.scale.b),r=mw(e.scale.a),n=mw(-e.rotation/2/M$*360),a=mw(-e.shift.b),i=mw(e.shift.a);return Cd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},LK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),aK("none"),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([aK(kK(a)),iK(RK(a)),dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([aK(kK(uV(o.color))),oK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),uK(Ni(o.size)),fK(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"}}()),sK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),cK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),CK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),bK("middle"),nK("middle"),EK(_K(e))]);default:return M([EK(_K(e))])}},xK=Nn("x"),PK=Nn("y"),DK=r(function(e,t){return M([MV(mw(e)),UV(mw(t)),xK(mw(-e/2)),PK(mw(-t/2))])}),UK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([mw(t),mw(-r)]))},e))},OK=dN,MK=r(function(e,t){return f(e,t.a,t.b)}),FK=function(e){return f(xa,MK(OK),e)},VK=function(e){e:for(;;){var t=f(xc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(GV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(qV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Circle":var c=s.a;return f(FV,U(M([JV(t),XV(mw(c))]),U(LK(e),FK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(VV,U(M([JV(t),ZV(mw(d)),eK(mw(h))]),U(LK(e),FK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(zV,U(M([JV(t),ZV(mw(c)),eK(mw(c))]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(TV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(WV,U(M([JV(t)]),U(LK(e),FK(e.handlers))),M([YV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(jV,U(M([JV(t),tK(C)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(KV,U(M([JV(t)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(HV,f(ka,JV(t),U(LK(e),FK(e.handlers))),l(Ra,r(function(e,t){return f(ka,VK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:rK(M([w,I]))});e=v;continue e}}},KK=r(function(e,t){var r=e.a,n=e.b,a=mw(r),i=mw(n);return f(jT,yr,M([f(DV,M([MV(a),UV(i),OV("1.1")]),M([VK(t)]))]))}),HK=function(e){return f(KK,L(xV(e),_V(e)),f(EV,LV,e))},jK=r(function(e,t){var r=QF(e),n=function(){switch(t.$){case"NotStarted":return l(Ok,10,33,108);case"Active":return l(Ok,0,100,170);default:return l(Ok,1,129,104)}}(),a=hx(HK(f(mV,sV(tV(n)),nV(50))));return f(Kk,M([wN,y_(f(dR,M([wN,eR,yT(zk(60))]),r))]),a)}),qK=function(e){var t=M([RU,vN,bN(20)]);switch(e.$){case"Active":return f(Kk,U(t,M([bA(EN)])),fl("Active"));case"NotStarted":return f(Kk,U(t,M([bA(CR)])),fl("Not Started"));default:return f(Kk,t,fl("Finished"))}},GK=n(function(e,t,r){var n=f(VF,t,e),a=function(){return"Active"===n.$?l(Ok,0,226,255):DR}(),i=f(Kk,M([bA(a),bN(20),vN,wN]),fl(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 qk;switch(n.$){case"NotStarted":return d(ZR,M([wN]),M([bN(22),gR]),L(DR,IR),f(_R,e,t));case"Active":var a=f(xR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(o$,M([wN]),M([bN(22),gR]),L(tN,IR),i)}return f(ON,M([wN,kN(10)]),M([f(Kk,M([wN]),fl(qF(e))),f(eM,"Poke",sS(iS))]));default:return f(Kk,M([yT(zk(1))]),qk)}}();return f(ON,M([aR(20),kN(10),yT(jk)]),M([f(Kk,M([s_,wN]),i),f(Kk,M([yT(jk),wN]),f(Kk,M([eR]),f(jK,e,n))),f(ON,M([kN(10),nL,wN]),M([f(Kk,M([wN]),qK(n)),o]))]))}),zK=o(function(e,t,r,n,a,i){var o=f(VF,r,t),u=f(Kk,M([aR(10),ET(jk),yT(jk)]),d(jF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Vl(0)}}(),c=l(GK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(LR,f(qb,r.state.phaseStartTime,s),i);default:Vl(0)}}(),f(Kk,M([yT(jk),ET(zk(1)),Wk(function(){return"Active"===o.$?l(pA,0,0,1):IR}())]),qk)),p=a?f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([ET(jk)]))),M([c,h,u])):f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([uN,pN(AF(t))]))),M([c]));return!e&&R(o,IF)?f(ON,M([ET(jk),kN(20),C$({bottom:20,left:0,right:0,top:0})]),M([p,wF(r.terms.paymentMethods)])):p}),YK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(VN,M([wN,cN(12),aR(30),kN(10),Wk(CF),bN(24),vN,bA(tN)]),M([fl("Trade "+TF(t.state.closedReason)),SF])):e?f(ON,M([ET(jk),kN(10)]),M([f(VN,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)])),wF(t.terms.paymentMethods)])):f(ON,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)]))}),WK=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(ON,M([ET(jk),yT(jk),kN(40)]),M([h(bF,t,i,n.wallet,r,n.showStatsModal),f(Kk,M([ET(jk),f(aN,40,0),kN(40)]),h(YK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Kk,M([wN,eR,bN(30)]),fl("Loading trade info..."));default:return f(Kk,M([wN,eR,bN(30)]),fl("Invalid trade"))}}(),M([LO(n),OO(n)]))}),JK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),QK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L($U,yr);case"CreateModel":var n=r.a;return L(f(Yi,Uy,CU(n)),yr);case"TradeModel":var a=r.a;return l(JK,Yi(Fy),xa(Yi(Fy)),d(WK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,fT,l(CO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,oT,l(b_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Kk,M([ET(jk),yT(jk),cN(10)]),n),a)}),XK=function(e){return{$:"DismissNotice",a:e}},ZK=function(e){return f(H$,ZU,eO(e))},eH=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(pA,1,1,1):l(pA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Ok,100,200,255);case"Caution":return l(Ok,255,188,0);case"Error":return l(Ok,255,70,70);default:return l(Ok,200,200,200)}}(),o=f(Kk,M([PN,s_,j$(5),ZK(5)]),A_(XK(t)));return f(Kk,M([Wk(i),cN(10),aR(8),ET(jk),p$(1),d$(d(YR,0,0,0,.15)),KD]),f(ON,M([kN(4),ET(jk)]),f(Bi,r(function(e,t){return f($N,M([ET(jk),bA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},tH=function(e){return R(e,yr)?yr:M([f(ON,M([tO(20),j$(20),kN(10),PN,nL,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,ul)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(ON,M([ZK(20),ZL(100),kN(10),B$,s_,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,CB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},rH=r(function(e,t){var r=f(QK,e,t),n=r.a,a=r.b;return L(f(ON,M([r$(Jk),y_(KN(t)),ET(jk),yT(jk),aR(30)]),M([f(Kk,M([yT(zk(50))]),qk),n])),U(a,tH(t.userNotices)))}),nH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),aH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),iH={$:"AllowHover"},oH={$:"Layout"},uH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(hA,155/255,203/255,1,1),offset:L(0,0),size:3})},sH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?uH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?iH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?oH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},cH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(AT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),AT);case"Text":var a=t.a;return $I(a);default:return $I("")}}),fH=n(function(e,t,r){var n=sH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?nH(n):aH(n)}();return f(cH,a,d(fA,AT,Vk,t,wT(M([r]))))}),lH=ZT(5),dH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),hH={$:"SansSerif"},pH=function(e){return{$:"Typeface",a:e}},gH=Y,vH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",gH(sd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",gH(sd(t)));default:var t=e.a.name;return f(Ri,"-",gH(sd(t)))}}())}),yH=function(){var e=M([pH("Open Sans"),pH("Helvetica"),pH("Verdana"),hH]);return M([f(yA,Yk,l(vA,"bg-color-"+mA(d(hA,1,1,1,0)),"background-color",d(hA,1,1,1,0))),f(yA,gA,l(vA,"font-color-"+mA(d(hA,0,0,0,1)),"color",d(hA,0,0,0,1))),f(yA,yN,mN(20)),f(yA,lH,f(dH,l(Ra,vH,"font-",e),e))])}(),mH=n(function(e,t,r){var n=e.options;return l(fH,n,f(ka,lA(f(Ri," ",M([RT.root,RT.any,RT.single]))),U(yH,t)),r)}),bH=mH({options:yr}),CH=function(e){return f(yA,lH,f(dH,l(Ra,vH,"ff-",e),e))},EH=hH,SH=pH,TH=function(e){return{body:M([function(){var t=f(rH,e.screenWidth,e),r=t.a,n=t.b,a=U(M([ET(jk),yT(jk),CH(M([SH("Soleil"),EH]))]),f(xa,y_,n));return f(bH,a,r)}()]),title:"DAIHard"}},wH=Ht,IH=wH({init:OB,onUrlChange:Uk,onUrlRequest:Dk,subscriptions:Pk,update:sB,view:TH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:IH(f(du,function(e){return f(du,function(t){return f(du,function(r){return Fi({height:r,networkId:t,width:e})},f(Oh,"height",CE))},f(Oh,"networkId",CE))},f(Oh,"width",CE)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/src/Trade/State.elm b/src/Trade/State.elm index 6f6d64e..cc2b450 100644 --- a/src/Trade/State.elm +++ b/src/Trade/State.elm @@ -62,8 +62,25 @@ init wallet factory tradeId = initFromCached : Wallet.State -> CTypes.FullTradeInfo -> UpdateResult initFromCached wallet trade = let - ( eventSentry, eventSentryCmd ) = - initEventSentry trade.factory + ( eventSentry, eventSentryCmd, _ ) = + let + ( initialSentry, initialCmd ) = + initEventSentry trade.factory + in + EventSentry.watch + EventLogFetched + initialSentry + { address = trade.creationInfo.address + , fromBlock = Eth.Types.BlockNum trade.creationInfo.blocknum + , toBlock = Eth.Types.LatestBlock + , topics = [] + } + |> (\( a, b, c ) -> + ( a + , Cmd.batch [ initialCmd, b ] + , c + ) + ) in UpdateResult (initModel (CTypes.LoadedTrade trade) eventSentry wallet) From 2ca67f34f78af5e3869a2bbc5dd41674c62461b5 Mon Sep 17 00:00:00 2001 From: oglog Date: Wed, 14 Aug 2019 15:48:59 +0200 Subject: [PATCH 16/19] Added another status message in case of no visible trades --- docs/404.html | 2 +- docs/index.html | 2 +- ...11109c.js => main-c8df61b4d62b7f34fc5f.js} | 2 +- src/AgentHistory/View.elm | 30 ++++++++++++++++--- src/Marketplace/View.elm | 28 +++++++++++++++-- 5 files changed, 54 insertions(+), 10 deletions(-) rename docs/static/js/{main-1f1f31c3e819cf11109c.js => main-c8df61b4d62b7f34fc5f.js} (78%) diff --git a/docs/404.html b/docs/404.html index dc6d0c7..bd7299e 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 dc6d0c7..bd7299e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-1f1f31c3e819cf11109c.js b/docs/static/js/main-c8df61b4d62b7f34fc5f.js similarity index 78% rename from docs/static/js/main-1f1f31c3e819cf11109c.js rename to docs/static/js/main-c8df61b4d62b7f34fc5f.js index 3fab57f..d4d31fa 100644 --- a/docs/static/js/main-1f1f31c3e819cf11109c.js +++ b/docs/static/js/main-c8df61b4d62b7f34fc5f.js @@ -4,4 +4,4 @@ * @author Feross Aboukhadijeh * @license MIT */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(bp,o,function(e){return si(Cp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,kp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,Bp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=nv(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?qg(o):jg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return nv(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Gg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Yg,zg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(zo,xa(ac),f(zo,Ms,nc))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ph,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ph,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ap)}),i.addEventListener("timeout",function(){a(Np)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Cp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(wp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Yg,zg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Yg,zg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Yg,zg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{options:t,type_:e}}),po={$:"OfferType"},go=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),vo=r(function(e,t){return f(ho,po,M([l(go,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(go,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),yo={$:"Closed"},mo={$:"Committed"},bo={$:"Judgment"},Co={$:"Open"},Eo={$:"Phase"},So=a(function(e,t,r,n){return f(ho,Eo,M([l(go,"Open",e,function(e){return R(e.state.phase,Co)}),l(go,"Committed",t,function(e){return R(e.state.phase,mo)}),l(go,"Judgment",r,function(e){return R(e.state.phase,bo)}),l(go,"Closed",n,function(e){return R(e.state.phase,yo)})]))}),To={$:"Initiator"},wo={$:"Responder"},Io=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),Ao=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(To):f(Io,function(e){return R(t,e)?si(wo):ci},e.state.responder)}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),ko=r(function(e,t){return f(Bo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(Ao,e,t))}),No={$:"Role"},Ro=n(function(e,t,r){return f(ho,No,M([l(go,"Buyer",t,function(t){return R(f(ko,t,e),si(fo))}),l(go,"Seller",r,function(t){return R(f(ko,t,e),si(lo))})]))}),$o=function(e){return{orderBy:e}},_o=$o,Lo={$:"Ascending"},xo={$:"Phase"},Po=Oe,Do=Po(yr),Uo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(So,!0,!0,!0,!1),f(vo,!0,!0),l(Ro,t,!0,!0)])),tradeTable:_o(L(xo,Lo)),wallet:e},Do)}),Oo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Mo={$:"None"},Fo=Mo,Vo=function(e){return d(Oo,e,Do,Fo,yr)},Ko=function(e){return{$:"TradeTableMsg",a:e}},Ho=function(e){return d(Oo,e,Do,Fo,yr)},jo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),qo=r(function(e,t){return f(jo,e,t)}),Go=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),zo=n(function(e,t,r){return t(e(r))}),Yo=r(function(e,t){if("None"===t.$)return Mo;var r=t.a,n=t.b,a=l(Go,f(Bo,Da(e),r.onSign),f(Bo,Da(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return L(f(zo,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(zo,t.toMsg,e)}},n))},r.onMined));return f(jo,a,n)}),Wo=function(e){return{$:"AbiDecoder",a:e}},Jo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Qo=z,Xo=Fr,Zo=r(function(e,t){return e<1?t:l(Xo,e,Qo(t),t)}),eu=Zo(64),tu=n(function(e,t,r){return L(f(Jo,e,eu(t)),r)}),ru=r(function(e,t){return e<1?"":l(Xo,0,e,t)}),nu=ru(64),au=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),iu=function(e){return-e},ou=r(function(e,t){return e<1?"":l(Xo,-e,Qo(t),t)}),uu=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(ru,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(ou,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Wo(function(t){var r=t.a,n=t.b;return f(au,f(tu,r,n),e(nu(n)))})}(),su=Hr,cu=function(e){return f(su,"0x",e)||f(su,"0X",e)?f(Zo,2,e):e},fu=function(e){return e.b},lu=r(function(e,t){var r=e.a;return f(au,fu,r(function(e){return f(Jo,e,e)}(cu(t))))}),du=Xr,hu=ae,pu=Wr,gu=function(e){return f(du,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return hu(a)},pu)},vu=f(zo,lu,gu),yu=function(e){return{$:"Magnitude",a:e}},mu=function(e){return{$:"Pos",a:e}},bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Cu=function(e){return{$:"MagnitudeNotNormalised",a:e}},Eu=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 si(n)}return ci}},Su=function(e){var t=Eu(e);return"Nothing"!==t.$&&t.a<0},Tu=function(e){return{$:"Neg",a:e}},wu={$:"Zer"},Iu=function(e){return!e.b},Au=r(function(e,t){var r=t.a;if(Iu(r))return wu;switch(e.$){case"Zero":return wu;case"Positive":return mu(t);default:return Tu(t)}}),Bu=r(function(e,t){return f(bu,e,Cu(t))}),ku=function(e){return f(La,r(function(t,r){return e(t)&&Iu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Nu=Ir,Ru=-1+f(Nu,10,7),$u=Ru+1,_u=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Lu=function(e){return e<0?f(_u,Na(-1),Lu(e+$u)):L(e/$u|0,e%$u)},xu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Lu(r+e),i=a.a,o=a.b;return f(ka,o,f(xu,i,n))}{if(!(_(e,$u)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Pu=function(e){var t=e.a;return yu(ku(f(xu,0,t)))},Du=xa(iu),Uu={$:"Negative"},Ou={$:"Positive"},Mu={$:"Zero"},Fu=function(e){switch(e.$){case"Positive":return Uu;case"Negative":return Ou;default:return Mu}},Vu=function(e){for(;;){var t=e.a,r=e.b,n=Pu(r),a=n.a;if(!Su(a))return f(Au,t,yu(a));e=f(Bu,Fu(t),Du(a))}},Ku=pr,Hu=function(e){switch(f(Ku,e,0).$){case"LT":return Uu;case"GT":return Ou;default:return Mu}},ju=function(e){return e<0?-e:e},qu=function(e){return Vu(f(bu,Hu(e),Cu(M([ju(e)]))))},Gu=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(Nu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},zu=function(e){switch(e.$){case"Zer":return wu;case"Neg":var t=e.a;return mu(t);default:return e}},Yu=function(e){return{$:"MagnitudePair",a:e}},Wu=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(ka,L(a,u),f(Wu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Wu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Wu,yr,s))}return yr}),Ju=r(function(e,t){var r=e.a,n=t.a;return Yu(f(Wu,r,n))}),Qu=function(e){switch(e.$){case"Zer":return f(Bu,Mu,yr);case"Neg":var t=e.a.a;return f(Bu,Ou,Du(t));default:var t=e.a.a;return f(Bu,Ou,t)}},Xu=r(function(e,t){var r=Qu(t),n=r.b,a=Qu(e),i=a.b,o=f(Ju,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Vu(f(bu,Ou,Cu(s)))}),Zu=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(R(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 Ta}return a.b.b?ba:f(Ku,e,t)}}),es=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},ts=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(Zu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return es(d(Zu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),rs=r(function(e,t){return R(f(ts,e,t),Ta)}),ns=K,as=r(function(e,t){return!f(rs,e,t)}),is=function(e){switch(e.$){case"Zer":return yu(yr);case"Pos":default:var t=e.a;return t}},os=r(function(e,t){var r=e.a;return Pu(Cu(f(xa,ti(t),r)))}),us=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(os,yu(n),a),u=f(us,yu(i),yu(n)),s=u.a,c=f(Xu,f(Au,Ou,o),f(Au,Ou,yu(f(ka,0,s))));return is(c)}var a=r.a;return f(os,yu(n),a)}return yu(yr)}),ss=function(e){switch(e.$){case"Zer":return Mu;case"Pos":return Ou;default:return Uu}},cs=r(function(e,t){return R(e,Mu)||R(t,Mu)?Mu:R(e,t)?Ou:Uu}),fs=r(function(e,t){return f(Au,f(cs,ss(e),ss(t)),f(us,is(e),is(t)))}),ls=function(e){switch(e.$){case"Zer":return wu;case"Pos":var t=e.a;return Tu(t);default:var t=e.a;return mu(t)}},ds=r(function(e,t){return f(Xu,e,ls(t))}),hs=qu(0),ps=a(function(e,t,r,n){if(e){var a=qu(e),i=f(fs,f(fs,a,n),t),o=f(as,i,r)?L(f(fs,a,t),f(ds,r,i)):L(hs,r),u=o.a,s=o.b,c=d(ps,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Xu,u,l),h)}return L(hs,r)}),gs=Fa(f(Va,2,Ru)),vs=n(function(e,t,r){return d(ps,f(Nu,2,gs),e,t,r)}),ys=qu(1),ms=r(function(e,t){return e}),bs=n(function(e,t,r){return l(Ra,ms(e),t,f(Ai,1,r))}),Cs=function(e){return l(bs,fs(qu($u)),ys,e)},Es=n(function(e,t,r){if(e){var n=l(vs,Cs(e),t,r),a=n.a,i=n.b,o=l(Es,e-1,i,r),u=o.a,s=o.b;return L(f(Xu,a,u),s)}return l(vs,Cs(e),t,r)}),Ss=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Ts=r(function(e,t){if(R(t,hs))return ci;var r=Ti(Ss(e))-Ti(Ss(t))+1,n=l(Es,f(ei,0,r),zu(e),zu(t)),a=n.a,i=n.b;return si(L(f(Au,f(cs,ss(e),ss(t)),is(a)),f(Au,ss(e),is(i))))}),ws=f(fs,qu(2),qu(2147483648)),Is=xr,As=function(e){return f(Is,e,"")},Bs=Pn,ks=n(function(e,t,r){return e<=0?r:l(ks,e>>1,U(t,t),1&e?U(r,t):r)}),Ns=r(function(e,t){return l(ks,e,t,"")}),Rs=n(function(e,t,r){return U(f(Ns,e-Qo(r),As(t)),r)}),$s=te,_s=Ar,Ls=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},xs=r(function(e,t){for(;;){if(t<16)return f(ka,Ls(t),e);var r=f(ka,Ls(f(_s,16,t)),e),n=t/16|0;e=r,t=n}}),Ps=function(e){return $s(e<0?f(ka,P("-"),f(xs,yr,-e)):f(xs,yr,e))},Ds=function(e){var t=f(Ts,e,ws);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=Ps(Gu(a));return R(n,qu(0))?i:U(Ds(n),l(Rs,8,P("0"),i))},Us=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,yu(yr))?"0":Ds(mu(t));default:var t=e.a;return"-"+Us(f(fs,qu(-1),e))}},Os=function(e){return l(Rs,64,P("0"),e)},Ms=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(Ps(a)),c=function(e){return U(e,n)}(Os(Ps(u)));return x(a+32+(Qo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Fs=Dr,Vs=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))))}),Ks=n(function(e,t,n){return l(Fs,r(function(t,r){return l(Vs,e,yi(t),r)}),t,n)}),Hs=function(e){return $a(l(Ks,ka,yr,e))},js=function(e){return f(Ri,"",f(xa,f(zo,Ps,f(Rs,2,P("0"))),Hs(e)))},qs=function(e){return 64-f(_s,64,e)},Gs=function(e){return U(e,f(Ns,qs(Qo(e)),"0"))},zs=function(e){return L(si(Qo(e)/2|0),Gs(e))},Ys=function(e){return L(ci,Os(e))},Ws=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Js=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"}},Qs=Ur,Xs=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(Is,P("1"),r),!0);case"1":return L(f(Is,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Is,P("0"),r),!1);case"1":return L(f(Is,P("1"),r),!0);default:break e}return L(r,!0)});return l(Qs,t,L("",!1),e).a},Zs=function(e){return l(Qs,ka,yr,e)},ec=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Zo,e,t),i=f(ka,l(Xo,0,e,t),r);e=n,t=a,r=i}}),tc=r(function(e,t){return e&&""!==t?l(ec,e,t,yr):M([t])}),rc=function(e){var t=function(){var t=Zs(Us(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(zo,Xs,f(Rs,256,P("1"))))}var r=t;return L(r,f(Rs,256,P("0")))}(),r=t.a,n=t.b;return $s(f(xa,Ws,f(tc,4,n(f(Ri,"",f(xa,Js,r))))))},nc=function(e){return{$:"Hex",a:e}},ac=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Ys(t);case"UintE":var r=e.a;return Ys(Us(r));case"IntE":var n=e.a;return Ys(rc(n));case"BoolE":return Ys(e.a?"1":"0");case"DBytesE":var a=e.a.a;return zs(a);case"BytesE":var a=e.a.a;return Ys(cu(a));case"StringE":var i=e.a;return zs(js(i));case"ListE":var o=e.a;return function(e){var t=e.a;return zs(t)}(Xt()(o));default:var i=e.a;return Ys(cu(i))}};try{var ic=Xt();Xt=function(){return ic}}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 oc=Pr,uc=function(e){return 1===Qo(e)?f(oc,"0",e):e},sc=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(ka,n,r);e=i,t=o,r=u}}}),cc=r(function(e,t){return $a(l(sc,e,t,yr))}),fc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(cc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(fc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),lc=r(function(e,t){return l(fc,0,e,t)}),dc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),hc=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 Pt(e.a)}},pc={$:"LE"},gc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,pc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,pc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,pc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,pc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,pc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,pc));case"Seq":var i=e.b;return l(vc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),vc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(gc,n,t,r);e=i,t=o,r=u}}),yc=Dt,mc=r(function(e,t){return{$:"Seq",a:e,b:t}}),bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+hc(r),i=n;e=a,t=i}}),Cc=function(e){return f(mc,f(bc,0,e),e)},Ec=function(e){return{$:"U8",a:e}},Sc=Ec,Tc=r(function(e,t){return _(e,t)<0?e:t}),wc=hr,Ic=function(e){return{$:"Bytes",a:e}},Ac=Ic,Bc=function(e){return yc(Cc(f(xa,Ac,$a(e))))},kc=Pt,Nc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Rc=function(e){return{$:"Decoder",a:e}},$c=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}}),_c=r(function(e,t){return Rc(f($c,e,t))}),Lc=Rc(Yn),xc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Pc=function(e){return{$:"Done",a:e}},Dc=function(e){return{$:"Loop",a:e}},Uc=r(function(e,t){var n=t.a;return Rc(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 Rc(r(function(t,r){return L(r,e)}))},Mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Oc(Pc($a(n))):f(Uc,function(e){return Dc(L(r-1,f(ka,e,n)))},e)}),Fc=function(e){return f(xc,yr,f(Nc,f(_c,L(kc(e),yr),Mc(Lc)),e))},Vc=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))}),Kc=r(function(e,t){return l(Vc,Bs,e,t)}),Hc=f(Ai,0,4),jc=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}}),qc=xt,Gc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),zc=function(e){return f(Gc,f(zo,qc,Bs(4294967295)),e)},Yc=r(function(e,t){return 5*t+e}),Wc=4294967295>>>32-Ha,Jc=ar,Qc=n(function(e,t,r){for(;;){var n=Wc&t>>>e,a=f(Jc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Jc,Wc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Xc=function(e){return e>>>5<<5},Zc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Xc(r))>-1?f(Jc,Wc&e,i):l(Qc,n,e,a))}),ef=r(function(e,t){var r=f(Zc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),tf=n(function(e,t,r){var n=f(Yc,e,t);return f(ef,n,r)}),rf=ir,nf=a(function(e,t,r,n){var a=Wc&t>>>e,i=f(Jc,a,n);if("SubTree"===i.$){var o=i.a,u=d(nf,e-Ha,t,r,o);return l(rf,a,za(u),n)}var s=i.a,c=l(rf,Wc&t,r,s);return l(rf,a,Ga(c),n)}),af=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,Xc(n))>-1?d(Ma,n,a,i,l(rf,Wc&e,t,o)):d(Ma,n,a,d(nf,a,e,t,i),o)}),of=n(function(e,t,r){return l(af,e,t,r)}),uf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(of,a,r,n)}),sf=Dn,cf=r(function(e,t){return l(Vc,sf,e,t)}),ff=function(e){var t=l(La,r(function(t,n){var a={d0:l(tf,0,t,e.state),d1:l(tf,1,t,e.state),d2:l(tf,2,t,e.state),d3:l(tf,3,t,e.state),d4:l(tf,4,t,e.state)},i=r(function(e,r){return d(uf,e,t,f(cf,f(jc,e,a),f(Kc,zc(f(jc,f(_s,5,e+1),a)),f(jc,f(_s,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Hc);return D(e,{state:t})},lf=L(0,0),df=function(e){return{current:lf,lfsrstate:1,state:e,x:1,y:0}},hf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},pf=L(1,0),gf=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),vf=r(function(e,t){if(e){var n=f(gf,1,t);return l(Vc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),yf=r(function(e,t){var r=f(_s,32,e/32|0),n=f(gf,r,t),a=f(_s,32,e);return f(vf,a,n)}),mf=n(function(e,t,r){var n=f(Zc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(af,e,t(a),r)}),bf=n(function(e,t,r){return l(mf,e,cf(t),r)}),Cf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(bf,a,r,n)}),Ef=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Nf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Tc,n,r),i=f(xa,function(e){return f(kf,e,g)},f(Ai,0,a)),o=Bf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(lc,i.outputLen,l(v,g,yr,i.outputLen))},Lf=function(e){return{$:"KS",a:e}},xf=function(e){var t=e.a;return Lf({config:t,inputLength:0,partial:yr,state:f(ui,25,ms(lf))})},Pf=function(e){return Rc(Wn(e))},Df=yc(Cc(yr)),Uf=r(function(e,t){var n=t.a;return Rc(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(Uf,function(e){return Pf(t)},Pf(e))}),Mf=r(function(e,t){return f(xc,Df,f(Nc,f(Of,e,kc(t)-e),t))}),Ff=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=kc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+kc(e)}),0,i),a)>-1))return Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:i}));var o=Bc(i),u=f(xc,Df,f(Nc,Pf(a),o)),s=Fc(u),c=f($f,s,n.state),d=Bf(c),h=f(Mf,a,o),p=Df,g=Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Vf=r(function(e,t){return _f(f(Ff,yc(Cc(f(xa,Sc,t))),xf(e)))}),Kf=Vf(dc),Hf=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,4,Kf(f(xa,yi,Zs(e)))))))},jf=function(e){return f(su,"0x",e)||f(su,"0X",e)?e:"0x"+e},qf=function(e){var t=e.a;return jf(t)},Gf=r(function(e,t){var r=Ms(f(xa,ac,t)),n=function(e){return U(e,r)}(cu(qf(Hf(e))));return nc(n)}),zf=function(e){return{data:si(f(Gf,"poke()",yr)),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yf=r(function(e,t){return D(t,{checked:e})}),Wf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Jf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Wf,f(zo,function(e){return e.type_},Ja(r)),function(e){return D(e,{options:l(Wf,f(zo,function(e){return e.label},Ja(n)),Yf(a),e.options)})},t)}),Qf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Xf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zf={$:"Descending"},el=function(e){return"Ascending"===e.$?Zf:Lo},tl=function(e){return d(Xf,e,Do,Fo,yr)},rl=r(function(e,t){return L(t.a,e(t.b))}),nl=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Xf,t,Do,Fo,M([da(f(Qf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(rl,el,t.orderBy):L(a,Lo);return tl(D(t,{orderBy:i}));default:return tl(t)}}),al=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},il=yn,ol=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=al(zf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(qo,a,n);return d(Oo,t,Do,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Oo,t,Do,Fo,M([da(f(Qf,o,u))]));case"FiltersMsg":var s=e.a;return Ho(D(t,{filters:f(Jf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(nl,c,t.tradeTable);return d(Oo,D(t,{tradeTable:l.model}),f(il,Ko,l.cmd),f(Yo,Ko,l.chainCmd),f(xa,Ji(Ko),l.appCmds));default:return Vo(t)}}),ul={$:"BottomRight"},sl={$:"ShouldBeImpossible"},cl=lr,fl=function(e){return qi(e)},ll=r(function(e,t){f(cl,e,t);return{align:ul,label:"unexpectedError",mainParagraphs:M([M([fl(e)])]),noticeType:sl}}),dl=function(e){var t=e.a;return jf(t)},hl=ye,pl=f(zo,dl,hl),gl=f(zo,Us,f(zo,jf,hl)),vl=f(zo,qf,hl),yl=f(zo,Ps,f(zo,jf,hl)),ml=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),bl=un,Cl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},El=function(e){return Cl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(xc,bl,r))},f(ml,function(e){e.a;return!R(e.b,ci)},e)))},Sl=function(e){return El(M([L("to",f(Bo,pl,e.to)),L("from",f(Bo,pl,e.from)),L("gas",f(Bo,yl,e.gas)),L("gasPrice",f(Bo,gl,e.gasPrice)),L("value",f(Bo,gl,e.value)),L("data",f(Bo,vl,e.data)),L("nonce",f(Bo,yl,e.nonce))]))},Tl=function(e){return{$:"TxSentry",a:e}},wl=ye,Il=r(function(e,t){return Cl(M([L("ref",wl(e)),L("txParams",t)]))}),Al=function(e){return{$:"Signing",a:e}},Bl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Al(e)}}),kl={$:"Black"},Nl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Rl={$:"RBEmpty_elm_builtin"},$l={$:"Red"},_l=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(Nl,$l,t,r,h(Nl,kl,c,f,l,d),h(Nl,kl,i,o,u,s))}return h(Nl,e,i,o,h(Nl,$l,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(Nl,$l,c,f,h(Nl,kl,g,v,y,m),h(Nl,kl,t,r,d,a))}return h(Nl,e,t,r,n,a)}),Ll=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Nl,$l,e,t,Rl,Rl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ku,e,a).$){case"LT":return h(_l,n,a,i,l(Ll,e,t,o),u);case"EQ":return h(Nl,n,a,t,o,u);default:return h(_l,n,a,i,o,l(Ll,e,t,u))}}),xl=n(function(e,t,r){var n=l(Ll,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(Nl,kl,a,i,o,u)}return n}),Pl=n(function(e,t,r){var n=e.a,a=Sl(r),i=l(xl,n.ref,f(Bl,r,t),n.txs);return L(Tl(D(n,{ref:n.ref+1,txs:i})),f(il,n.tagger,n.outPort(f(Il,n.ref,a))))}),Dl=Pl,Ul=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Do,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Dl,n,i,o))}return x(ci,Do,M([f(ll,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ol=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Ml=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Fl=function(e){return{$:"Posix",a:e}},Vl=Fl,Kl={autoabortInterval:Vl(0),autorecallInterval:Vl(0),autoreleaseInterval:Vl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Hl=function(e){return{$:"TokenValue",a:e}},jl=function(e){return e.a},ql=r(function(e,t){return f(xc,hs,f(Bo,Qa,f(Ts,e,t)))}),Gl=r(function(e,t){return Hl(f(ql,jl(e),qu(t)))}),zl=function(e){return f(Gl,e,12)},Yl=function(e){return f(Gl,e,3)},Wl=Hl(qu(0)),Jl=r(function(e,t){var r=Wl;return{abortPunishment:zl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Ql=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Xl=qr,Zl=function(e){var t=Ql(f(Xl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Qo(e)-1-r;return L(U(f(ru,r,e),f(Zo,r+1,e)),n)},ed=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 yr}}),td=function(e){var t=e.a,r=f(ed,Ja(0),t);return yu(r.b?t:yr)},rd=Z,nd=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}}}),ad=n(function(e,t,r){var n=f(nd,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(lc,e,r),l(ad,e,t,n)):yr}),id=r(function(e,t){return l(ad,e,e,t)}),od=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Bo,ka(a),r)});return f(La,t,si(yr))}(Ua),ud=function(e){return f(Bo,f(Da,td,yu),od(f(xa,f(zo,$a,f(zo,$s,rd)),f(id,7,$a(e)))))},sd=Q,cd=function(e){var t=Zs(sd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,Au(Uu),ud(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Bo,Au(Ou),ud(r))}return ci;default:var r=t;return f(Bo,Au(Ou),ud(r))}},fd=function(e){var t=function(e){return!f(_s,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(xc,0,Ql(r)))}},ld=function(e){return f(fs,e,e)},dd=qu(2),hd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ys;case"Neg":return wu;default:if(R(r,ys))return f(fs,e,t);if(fd(r)){var n=e,a=ld(t),i=f(ql,r,dd);e=n,t=a,r=i;continue e}var n=f(fs,t,e),a=ld(t),i=f(ql,f(ds,r,ys),dd);e=n,t=a,r=i;continue e}}),pd=r(function(e,t){return l(hd,ys,e,t)}),gd=function(e){if(""===e)return ci;var t=Zl(e),r=t.a,n=t.b,a=cd(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(fs,o,f(pd,qu(10),qu(i)));return si(u)},vd=function(e){return f(Bo,Hl,gd(e))},yd=jr,md=function(e){for(;;){if(f(yd,".",e))return l(Xo,0,-1,e);{if(!f(yd,"0",e))return""===e?"0":e;e=l(Xo,0,-1,e)}}},bd=f(Da,f(Rs,7,P("0")),Ni),Cd=function(e){return f(Ri,"",e)},Ed=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Cd(f(ka,Ni(n),f(xa,bd,a)))}return"0"},Sd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Ed(t);default:var t=e.a;return"-"+Ed(t)}},Td=r(function(e,t){return e<1?t:l(Xo,0,-e,t)}),wd=function(e){var t=l(Rs,18,P("0"),Sd(e)),r=f(Td,18,t)+"."+f(ou,18,t);return function(e){return""===e?"0":e}(md(r))},Id=r(function(e,t){var r=wd(t),n=Ql(f(Xl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(ru,a+1+e,r):f(ru,a,r)}),Ad=r(function(e,t){if("Nothing"===e.$)return wd(jl(t));var r=e.a;return f(Id,r,jl(t))}),Bd=ee,kd=function(e){var t=Bd(f(Ad,ci,e));if("Just"===t.$){return t.a}f(cl,"Error converting tokenValue to float: string -> float failed",e);return 0},Nd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=vd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return kd(r)<1?fi("Trade amount can't be less than 1."):li(r)},Rd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=cd(e);if("Nothing"===t.$){var r=Bd(e);return fi("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 li(n)},$d=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),_d=function(e){return""===e},Ld=function(e){return _d(e)?ci:si(e)},xd=function(e){return f($d,"You must specify a fiat type.",Ld(e))},Pd=function(e){return""===e?fi("Must specify a payment method."):li(e)},Dd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ud=g(Dd,ci,ci,ci,ci,ci,ci,ci),Od=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Md=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Fd={$:"Custom"},Vd=r(function(e,t){return{info:t,type_:e}}),Kd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Hd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),jd=function(e){return e.a},qd=function(e){return p(Kd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Vd,Fd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Hd,function(e){return D(Ud,{daiAmount:si(e)})},Nd(e.daiAmount)),f(Hd,function(e){return D(Ud,{fiatAmount:si(e)})},Rd(e.fiatAmount)),f(Hd,function(e){return D(Ud,{fiatType:si(e)})},xd(e.fiatType)),f(Hd,function(e){return D(Ud,{paymentMethod:si(e)})},Pd(e.paymentMethod)),Od(d(Md,function(e){return jd(e)>0?li(e):fi(D(Ud,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Gd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},zd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Yd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Wd=function(e){var t=qd(e.inputs),r=function(){return R(e.errors,Ud)?Ud:"Ok"===t.$?Ud:t.a}();return D(e,{createParameters:l(zd,Jl,Gd(e.wallet),Yd(t)),errors:r})},Jd=r(function(e,t){return Wd(D(t,{inputs:e}))}),Qd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Xd=function(e){return d(Qd,f(Jd,Kl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:Ud,inputs:Kl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Do,Fo,yr)},Zd=a(function(e,t,r,n){return la(d(Ol,e,t,r,n))}),eh=function(e){return{$:"Address",a:e}},th=f(zo,cu,f(zo,sd,eh)),rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return th("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return th("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return th("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return th("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nh=function(e){return th("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ah=function(e){return{$:"AddressE",a:e}},ih=ah,oh=function(e){return{$:"UintE",a:e}},uh=oh,sh=n(function(e,t,r){return{data:si(f(Gf,"approve(address,uint256)",M([ih(t),uh(r)]))),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ch=function(e){return f(Gl,e,200)},fh=r(function(e,t){return Hl(f(Xu,jl(e),jl(t)))}),lh=function(e){var t=f(Gl,e.tradeAmount,200);return f(fh,e.pokeReward,f(fh,ch(e.tradeAmount),f(fh,t,function(){return"Buyer"===e.initiatorRole.$?Yl(e.tradeAmount):e.tradeAmount}())))},dh=Mi(ya),hh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ph=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gh=Xn,vh=Qn,yh=function(e){return f(vh,{caseInsensitive:!1,multiline:!1},e)},mh=Jn,bh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ch=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}}),Eh=r(function(e,t){return!f(Ch,f(Da,ns,e),t)}),Sh=Eh(Ua),Th=q,wh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ih=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Ah=f(La,Ih(ka),li(yr)),Bh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},kh=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Nu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Nu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Nu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Nu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Nu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Nu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Nu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Nu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Nu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Nu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Nu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Nu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Nu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Nu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Nu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(As(s)+" is not a valid hexadecimal character.")}}}),Nh=function(e){if(_d(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(su,"-",e)){var t=f(xc,yr,Bh(Zs(e)));return f(au,iu,l(kh,Ti(t)-1,t,0))}return l(kh,Qo(e)-1,Zs(e),0)}();return f(Hd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rh=function(e){var t=Zs(e);return function(e){return L(t,e)}(f(wh,yr,Ah(f(xa,Nh,f(_i,"",f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,20,Kf(f(xa,f(zo,Th,yi),t))))))))))},$h=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Rh(cu(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!bh(e)&&Sh(o)},_h=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-f]{40}$"))),Lh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-F]{40}$"))),xh=function(e){return'"'+e+'"'},Ph=function(e){var t=cu(e),r=f(ru,24,t),n=f(ou,40,e);return 64===Qo(t)&&f(ki,Ja(P("0")),r)?Lh(n)||_h(n)?li(eh(n)):$h(n)?li(eh(n)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):40!==Qo(t)?fi("Given address "+xh(e)+" is not the correct length."):bh(t)?Lh(t)||_h(t)?li(eh(t)):$h(t)?li(eh(t)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):fi("Given address "+xh(e)+" contains invalid hex characters.")},Dh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),Ph(nu(r)))}),Uh=r(function(e,t){var r=t.a;return Wo(function(t){var n=t.a,a=t.b;return r(f(Jo,n,f(Zo,64*e,a)))})}),Oh=Jr,Mh=r(function(e,t){return f(Oh,"data",vu(f(Uh,e,t)))}),Fh=Qr,Vh=r(function(e,t){return f(Oh,"topics",f(Fh,e,vu(t)))}),Kh=function(e){return f(Bo,f(zo,$a,f(Ra,r(function(e,t){return f(Xu,qu(e),f(fs,t,ws))}),hs)),od(f(xa,f(zo,$a,f(zo,$s,f(zo,Nh,Yd))),f(id,8,$a(e)))))},Hh=function(e){var t=Zs(sd(e));e:for(;;){if(!t.b)return ci;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(Bo,fs(qu(-1)),Kh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Bo,fs(qu(-1)),Kh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Kh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kh(a)}t.b;return ci}break e;default:break e}}var a=t;return Kh(a)},jh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f($d,"Error Decoding Uint into BigInt",Hh(jf(nu(r)))))}),qh=f(dh,f(Vh,1,Dh),f(dh,f(Mh,1,Dh),f(dh,f(Mh,0,jh),Fi(hh)))),Gh=nn,zh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Yh=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(Gh,e,Cl(M([L("data",hl(t.data)),L("topics",f(zh,vl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Wh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Jh=r(function(e,t){return f(au,function(e){return e.id},f(Wh,function(e){return f(Hd,Di,f(Yh,qh,e).returnData)},f($d,"No log found from that factoryAddress in that txReceipt",Ql(f(ml,function(t){return R(f(zo,dl,sd)(t.address),f(zo,dl,sd)(rh(e)))},t.logs)))))}),Qh=n(function(e,t,r){return{data:si(f(Gf,"allowance(address,address)",M([ih(t),ih(r)]))),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Zh=function(e){switch(e.$){case"BlockNum":var t=e.a;return hl(jf(Ps(t)));case"EarliestBlock":return hl("earliest");case"LatestBlock":return hl("latest");default:return hl("pending")}},ep=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return El(M([L("to",f(Bo,pl,t)),L("from",f(Bo,pl,r)),L("gas",f(Bo,yl,n)),L("gasPrice",f(Bo,gl,a)),L("value",f(Bo,gl,i)),L("data",f(Bo,vl,o))]))},tp=function(e){return{$:"BadBody",a:e}},rp=function(e){return{$:"BadStatus",a:e}},np=function(e){return{$:"BadUrl",a:e}},ap={$:"NetworkError"},ip={$:"Timeout"},op=rn,up=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(np(r));case"Timeout_":return fi(ip);case"NetworkError_":return fi(ap);case"BadStatus_":var n=t.a,a=t.b;return fi(rp(n.statusCode));default:var n=t.a,a=t.b,i=f(op,f(Oh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(tp(Di(u)))}}),sp=n(function(e,t,r){return Cl(M([L("id",wl(e)),L("jsonrpc",hl("2.0")),L("method",hl(t)),L("params",f(zh,Ua,r))]))}),cp=Rl,fp=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ku,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),lp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},dp=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(Nl,$l,p,g,h(Nl,kl,r,n,h(Nl,$l,i,o,u,s),v),h(Nl,kl,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(Nl,kl,r,n,h(Nl,$l,i,o,u,s),h(Nl,$l,f,l,d,m))}return e},hp=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(Nl,$l,i,o,h(Nl,kl,s,c,f,l),h(Nl,kl,r,n,d,h(Nl,$l,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Nl,kl,r,n,h(Nl,$l,i,o,C,d),h(Nl,$l,g,v,y,m))}return e},pp=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(Nl,r,u,s,c,h(Nl,$l,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 hp(t)}break e}o.a,o.d;return hp(t)}break e}return t}),gp=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(Nl,t,r,n,gp(a),u)}var s=dp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(_l,c,f,l,gp(d),p)}return Rl}return h(Nl,t,r,n,gp(a),u)}return Rl},vp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Rl;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(Nl,r,n,a,f(vp,e,i),o)}var s=dp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(_l,c,l,d,f(vp,e,p),v)}return Rl}return h(Nl,r,n,a,f(vp,e,i),o)}return f(yp,e,g(pp,e,t,r,n,a,i,o))}),yp=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(R(e,n)){var u=lp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(_l,r,s,c,i,gp(o))}return Rl}return h(_l,r,n,a,i,f(vp,e,o))}return Rl}),mp=r(function(e,t){var r=f(vp,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(Nl,kl,n,a,i,o)}return r}),bp=n(function(e,t,r){var n=t(f(fp,e,r));if("Just"===n.$){var a=n.a;return l(xl,e,a,r)}return f(mp,e,r)}),Cp=function(e){return"Just"===e.$},Ep=gn,Sp=vn,Tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),wp=function(e){return{$:"BadUrl_",a:e}},Ip=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ap={$:"NetworkError_"},Bp=function(e){return{$:"Receiving",a:e}},kp=function(e){return{$:"Sending",a:e}},Np={$:"Timeout_"},Rp=function(e){return f(ta,"application/json",f(xi,0,e))},$p=n(function(e,t,r){return Rp(l(sp,e,t,r))}),_p=f(ea,"",Ua),Lp=Te,xp=Se,Pp=function(e){if("Ok"===e.$){var t=e.a;return xp(t)}var r=e.a;return Lp(r)},Dp=function(e){return l(Zn,gr,Pp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},Up=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Dp({body:l($p,1,r,n),headers:yr,method:"POST",resolver:_p(up(a)),timeout:ci,url:t})},Op=n(function(e,t,r){return Up({decoder:t.decoder,method:"eth_call",params:M([ep(t),Zh(r)]),url:e})}),Mp={$:"LatestBlock"},Fp=r(function(e,t){return l(Op,e,t,Mp)}),Vp=function(e){return{$:"Perform",a:e}},Kp=sn,Hp=xp(gr),jp=r(function(e,t){return f(Kp,function(t){return xp(e(t))},t)}),qp=n(function(e,t,r){return f(Kp,function(t){return f(Kp,function(r){return xp(f(e,t,r))},r)},t)}),Gp=function(e){return l(La,qp(ka),xp(yr),e)},zp=r(function(e,t){var r=t.a;return Be(f(Kp,Ep(e),r))}),Yp=n(function(e,t,r){return f(jp,function(e){return gr},Gp(f(xa,zp(e),t)))}),Wp=n(function(e,t,r){return xp(gr)}),Jp=r(function(e,t){var r=t.a;return Vp(f(jp,e,r))});pn.Task=Pe(Hp,Yp,Wp,Jp);var Qp=Ue("Task"),Xp=cn,Zp=r(function(e,t){return Qp(Vp(f(Xp,f(Da,f(Da,xp,e),fi),f(Kp,f(Da,f(Da,xp,e),li),t))))}),eg=a(function(e,t,r,n){return f(Zp,n,f(Fp,Xh(eo(e)),l(Qh,nh(e),t,r)))}),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return th("0x092110996699c3E06e998d89F0f4586026e44F0F")}},rg=function(e){return{$:"BoolE",a:e}},ng=rg,ag=function(e){return{$:"StringE",a:e}},ig=ag,og=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ug=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},sg=r(function(e,t){return{paymentMethods:t,price:e}}),cg=function(e){return hl(Sd(e))},fg=function(e){return f(zh,Ua,M([hl(e.fiatType),cg(e.amount)]))},lg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},dg=function(e){return Cl(M([L("type",hl(lg(e.type_))),L("info",hl(e.info))]))},hg=function(e){var t=fg(e.price),r=f(zh,dg,e.paymentMethods);return f(xi,0,Cl(M([L("paymentmethods",r),L("price",t)])))},pg=r(function(e,t){return D(t,{value:si(e)})}),gg=function(e){return qu(jd(e))},vg=function(e){return f(ql,gg(e),qu(1e3))},yg=r(function(e,t){var r=function(){return"Token"===e.$?og:ug}();return function(){return"Native"===e.$?pg(jl(lh(t))):Ua}()(r(rh(e))(t.initiatorAddress)(tg(e))(R(t.initiatorRole,lo))(jl(t.tradeAmount))(jl(Yl(t.tradeAmount)))(jl(zl(t.tradeAmount)))(jl(t.pokeReward))(vg(t.autorecallInterval))(vg(t.autoabortInterval))(vg(t.autoreleaseInterval))(jl(ch(t.tradeAmount)))(hg(f(sg,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),mg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),bg=function(e){return{$:"CreateNeedsSig",a:e}},Cg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Eg=r(function(e,t){var r=al(f(yg,e,t)),n={onBroadcast:ci,onMined:si(L(mg(e),ci)),onSign:si(Cg(e))};return L(si(bg(e)),f(qo,n,r))}),Sg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wg=function(e){return{$:"ApproveNeedsSig",a:e}},Ig=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Bg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),kg={$:"NoOp"},Ng=function(e){return{appCmds:yr,chainCmd:Fo,cmd:Do,model:e}},Rg=function(e){return rd(Sd(e))},$g={$:"Error"},_g=r(function(e,t){f(cl,e+" fetch error",t);return{align:ul,label:"web3FetchError",mainParagraphs:M([M([fl('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:$g}}),Lg=r(function(e,t){return{align:ul,label:"web3MiningError",mainParagraphs:M([M([fl('Error mining "'+e+'" transaction: '+t)])]),noticeType:$g}}),xg={$:"Caution"},Pg=r(function(e,t){return{align:ul,label:"web3SigError",mainParagraphs:M([M([fl('Error signing "'+e+'" transaction: '+t)])]),noticeType:xg}}),Dg={$:"KovanDai"},Ug=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Dg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Og=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Mg=function(e){return f(Io,Ug,Og(e))},Fg=r(function(e,t){return 1-e(1-t)}),Vg=function(e){return f(Nu,e,5)},Kg=Fg(Vg),Hg={easing:Kg,offset:12,speed:200},jg=function(e){return{$:"External",a:e}},qg=function(e){return{$:"Internal",a:e}},Gg=function(e){return{$:"NotFound",a:e}},zg=function(e){for(;;){e=e.a}},Yg=r(function(e,t){return Qp(Vp(f(jp,e,t)))}),Wg={$:"Http"},Jg={$:"Https"},Qg=Kr,Xg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Zg=i(function(e,t,r,n,a){if(_d(a)||f(Qg,"@",a))return ci;var i=f(Xl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=rd(f(Zo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Xg,e,f(ru,o,a),s,t,r,n))}return si(p(Xg,e,a,ci,t,r,n))}),ev=a(function(e,t,r,n){if(_d(n))return ci;var a=f(Xl,"/",n);if(a.b){var i=a.a;return h(Zg,e,f(Zo,i,n),t,r,f(ru,i,n))}return h(Zg,e,"/",t,r,n)}),tv=n(function(e,t,r){if(_d(r))return ci;var n=f(Xl,"?",r);if(n.b){var a=n.a;return d(ev,e,si(f(Zo,a+1,r)),t,f(ru,a,r))}return d(ev,e,ci,t,r)}),rv=r(function(e,t){if(_d(t))return ci;var r=f(Xl,"#",t);if(r.b){var n=r.a;return l(tv,e,si(f(Zo,n+1,t)),f(ru,n,t))}return l(tv,e,ci,t)}),nv=function(e){return f(su,"http://",e)?f(rv,Wg,f(Zo,7,e)):f(su,"https://",e)?f(rv,Jg,f(Zo,8,e)):ci},av=Wt,iv=Gt(zt),ov=sa,uv=r(function(e,t){return L(e,t)}),sv=_r,cv=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=ju(r-n),o=f(ei,1,sv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),fv=r(function(e,t){var n=r(function(t,r){return Gp(f(xa,ov(0),d(cv,e.speed,e.easing,t,r-e.offset)))});return f(Kp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(qp,uv,iv,av(t)))}),lv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Gd(t.wallet),Mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(eg,a,n.address,rh(eo(a)),Sg(a));return d(Qd,t,i,Fo,yr)}return Ng(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Qd,D(t,{inputs:D(u,{userRole:o})}),Do,Fo,M([function(){return"Buyer"===o.$?d(Zd,"create offer type changed","input","sell dai",0):d(Zd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ng(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ng(f(Jd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Qd,(g?Jd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Do,Fo,g?M([d(Zd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=qd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jl,n,m);return Ng(D(t,{depositAmount:si(jl(lh(b))),txChainStatus:si(f(Ag,v,b))}))}var C=y.a;return d(Qd,D(t,{errors:C}),f(Zp,ms(kg),function(){return f(fv,D(Hg,{offset:60}),"inputError")}()),Fo,yr);case"AbortCreate":return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([d(Zd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Eg,v,b);var e=v.a,r=function(){var t=al(l(sh,nh(e),rh(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Ig,e,b))};return f(qo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(ts,a,E),ba)?L(si(wg(e)),r):f(Eg,v,b)}return L(si(wg(e)),r)}(),T=S.a,w=S.b;return d(Qd,D(t,{txChainStatus:T}),Do,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(l(Tg,a,b,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(ts,N,P),ba))return Ng($);var U=f(Eg,eo(a),b),T=U.a,w=U.b;return d(Qd,D($,{txChainStatus:T}),Do,w,yr)}return Ng($)}var O=k.a;return d(Qd,t,Do,Fo,M([pa(f(_g,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(f(Bg,v,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Qd,t,Do,Fo,M([pa(f(Lg,"create",B))]))}var F=e.a,V=e.b.a,K=f(Io,Rg,Yd(f(Jh,F,V)));if("Just"===K.$){var H=K.a;return d(Qd,t,Do,Fo,M([da(f(Qf,F,H))]))}return d(Qd,t,Do,Fo,M([pa(f(ll,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Qd,t,Do,Fo,M([ga]));case"NoOp":return Ng(t);default:var j=e.a;return d(Qd,t,Do,Fo,M([j]))}}),dv=r(function(e,t){return f(Eh,function(e){return f(Ch,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),hv=r(function(e,t){return f(Ku,jd(e),jd(t))}),pv=r(function(e,t){return R(f(hv,t.derived.phaseEndTime,e),Ta)}),gv=function(e){if(""===e)return li(ci);var t=vd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},vv=r(function(e,t){return{maxDai:t,minDai:e}}),yv=f(vv,ci,ci),mv=function(e){return l(Ih,r(function(t,r){return{dai:{max:r,min:t},fiatType:Ld(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Hd,function(e){return D(yv,{minDai:si(e)})},gv(e.minDai)),f(Hd,function(e){return D(yv,{maxDai:si(e)})},gv(e.maxDai)))},bv=r(function(e,t){var r=function(t){return f(Eh,function(e){return f(Qg,sd(e),sd(t))},e)};return f(Ch,function(e){return r(e.info)},t)}),Cv=r(function(e,t){return D(t,{paymentMethod:e})}),Ev=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Sv=r(function(e,t){return f(ts,jl(e),jl(t))}),Tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return wv(D(e,{inputs:f(Ev,r,f(Cv,"",e.inputs))}))},wv=function(e){var t=Tv(e),n=mv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(bv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(pv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(dv,t.filters,r)});return D(t,{filterFunc:s})},Iv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Av={$:"Expires"},Bv=function(e){return L(wv({errors:yv,filterFunc:pv,filters:co(M([f(vo,!0,!0),d(So,!0,!1,!1,!1)])),inputs:Iv,showCurrencyDropdown:!1,tradeTable:_o(L(Av,Lo)),wallet:e}),Do)},kv=r(function(e,t){var r=f(ml,wc(e),t.inputs.paymentMethodTerms);return wv(D(t,{inputs:f(Ev,r,t.inputs)}))}),Nv=function(e){return wv(D(e,{filterFunc:pv,inputs:Iv}))},Rv=function(e){return{$:"TradeTableMsg",a:e}},$v=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),_v=function(e){return d($v,e,Do,Fo,yr)},Lv=r(function(e,t){return D(t,{fiatType:e})}),xv=r(function(e,t){return D(t,{maxDai:e})}),Pv=r(function(e,t){return D(t,{minDai:e})}),Dv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return _v(D(t,{inputs:f(Pv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return _v(D(t,{inputs:f(xv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return _v(D(t,{inputs:f(Lv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return _v(D(t,{inputs:(n?Lv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return _v(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return _v(D(t,{inputs:f(Cv,r,t.inputs)}));case"AddSearchTerm":return _v(Tv(t));case"RemoveTerm":var a=e.a;return _v(f(kv,a,t));case"ApplyInputs":return d($v,wv(t),Do,Fo,yr);case"ResetSearch":return _v(Nv(t));case"FiltersMsg":var i=e.a;return _v(wv(D(t,{filters:f(Jf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(nl,o,t.tradeTable);return d($v,D(t,{tradeTable:u.model}),f(il,Rv,u.cmd),f(Yo,Rv,u.chainCmd),f(xa,Ji(Rv),u.appCmds));case"NoOp":return _v(t);default:var s=e.a;return d($v,t,Do,Fo,M([s]))}}),Uv=a(function(e,t,r,n){return e(Cl(M([L("title",hl(t)),L("body",function(){if("Nothing"===r.$)return bl;var e=r.a;return hl(e)}()),L("image",function(){if("Nothing"===n.$)return bl;var e=n.a;return hl(e)}())])))}),Ov=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Mv=function(e){return e.a+"="+e.b},Fv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Mv,e)):""},Vv=r(function(e,t){return"/"+(f(Ri,"/",e)+Fv(t))}),Kv=function(e){switch(e.$){case"Home":return f(Vv,M(["DAIHard"]),yr);case"Create":return f(Vv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Vv,M(["DAIHard","trade",Ov(t),Ni(r)]),yr);case"Marketplace":return f(Vv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Vv,M(["DAIHard","history",dl(n)]),yr);default:return f(Vv,yr,yr)}},Hv={$:"NotFound"},jv=function(e){return{$:"AgentHistory",a:e}},qv={$:"Create"},Gv={$:"Home"},zv={$:"Marketplace"},Yv=function(e){return{$:"Parser",a:e}},Wv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Jv=r(function(e,t){return Yv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Wv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Qv=f(Jv,"ADDRESS",f(zo,Ph,Yd)),Xv={$:"Eth"},Zv={$:"Kovan"},ey=f(Jv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Xv));case"keth":return si(Zi(Zv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Dg));case"xdai":return si(Zi(to));default:return ci}}),ty=f(Jv,"NUMBER",rd),ry=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Wv,r,n,a,i,e(o))}),ny=r(function(e,t){var r=t.a;return Yv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,ry(u),r(h(Wv,n,a,i,o,e)))})}),ay=function(e){return l(La,oo,yr,e)},iy=r(function(e,t){return ay(f(xa,e,t))}),oy=function(e){return Yv(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 R(u,e)?M([h(Wv,f(ka,u,r),s,a,i,o)]):yr}return yr})},uy=r(function(e,t){var r=e.a,n=t.a;return Yv(function(e){return f(iy,n,r(e))})}),sy=Yv(function(e){return M([e])}),cy=f(uy,oy("DAIHard"),function(e){return Yv(function(t){return f(iy,function(e){return(0,e.a)(t)},e)})}(M([f(ny,Gv,sy),f(ny,qv,oy("create")),f(ny,Qf,f(uy,oy("trade"),f(uy,ey,ty))),f(ny,zv,oy("marketplace")),f(ny,jv,f(uy,oy("history"),Qv)),f(ny,function(e){return jv(e)},f(uy,oy("history"),Qv))]))),fy=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 si(t.value)}return si(t.value)}return ci}},ly=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ly(r))}return yr}return yr},dy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ly(r)}var r=t;return ly(r)},hy=Qt,py=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),gy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=hy(n);if("Nothing"===o.$)return t;var u=o.a,s=hy(i);if("Nothing"===s.$)return t;var c=s.a;return l(bp,u,py(c),t)}return t}),vy=function(e){if("Nothing"===e.$)return cp;var t=e.a;return l(La,gy,cp,f(_i,"&",t))},yy=r(function(e,t){var r=e.a;return fy(r(h(Wv,yr,dy(t.path),vy(t.query),t.fragment,Ua)))}),my=function(e){return f(xc,Hv,f(yy,cy,e))},by=aa,Cy=r(function(e,t){return f(by,e,Kv(t))}),Ey=je("connectToWeb3",function(e){return bl}),Sy=function(e){return Cl(M([L("event",hl(e.event)),L("category",hl(e.category)),L("label",hl(e.label)),L("value",wl(e.value))]))},Ty=r(function(e,t){return Cl(M([L("address",hl(dl(e))),L("signSeedMsg",hl(t))]))}),wy=je("gTagOut",Ua),Iy=je("genPrivkey",Ua),Ay=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),By=n(function(e,t,r){return f(Io,Zc(t),f(Bo,function(e){return e.trades},f(Ay,function(t){return R(t.factory,e)},r)))}),ky=je("notifyPort",Ua),Ny=je("requestNotifyPermissionPort",function(e){return bl}),Ry=r(function(e,t){return D(t,{wallet:e})}),$y=r(function(e,t){return L(f(Jd,t.inputs,D(t,{wallet:e})),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(eg,n,r.address,rh(eo(n)),Sg(n))}return Do}())}),_y=r(function(e,t){return D(t,{wallet:e})}),Ly=function(e){return{$:"AllowanceFetched",a:e}},xy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Gd(e),Mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Mg(e),si(i.factory))?d(eg,a,n.address,i.creationInfo.address,Ly):Do}return Do}())}),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{$:"TradeModel",a:e}},Fy=function(e){return{$:"TradeMsg",a:e}},Vy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Do);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Dy(a),f(il,Uy,i));case"TradeModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(il,Fy,c));case"MarketplaceModel":var l=t.a;return L(Oy(f(_y,e,l)),Do);default:var d=t.a;return L(Py(f(Ry,e,d)),Do)}}),Ky=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Hy=function(e){return{$:"PartiallyLoadedTrade",a:e}},jy=r(function(e,t){return Hy(g(Ky,e,t,ci,ci,ci,ci,ci))}),qy=function(e){return{$:"CurrentBlockFetched",a:e}},Gy=gu(f(zo,cu,Nh)),zy=function(e){return Up({decoder:Gy,method:"eth_blockNumber",params:yr,url:e})},Yy=function(e){return f(Zp,qy,zy(e))},Wy=r(function(e,t){return{address_:e,blocknum:t}}),Jy=function(e){return Wo(function(t){return li(L(t,e))})},Qy=n(function(e,t,r){var n=t.a,a=r.a;return Wo(function(t){return f(Wh,function(t){var r=t.a,n=t.b;return f(au,rl(e(n)),a(r))},n(t))})}),Xy=r(function(e,t){return l(Qy,r(function(e,t){return e(t)}),t,e)}),Zy=vu(f(Xy,jh,f(Xy,Dh,Jy(Wy)))),em=r(function(e,t){return{data:si(f(Gf,"createdTrades(uint256)",M([uh(t)]))),decoder:Zy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tm=n(function(e,t,r){return f(Zp,r,f(Fp,Xh(e),f(em,rh(e),t)))}),rm=function(e){return{$:"CreationInfoFetched",a:e}},nm=r(function(e,t){return l(tm,e,qu(t),rm)}),am=function(e){return{$:"EventSentryMsg",a:e}},im=function(e){return{$:"BlockNumber",a:e}},om=function(e){return{$:"EventSentry",a:e}},um=function(e){return{$:"Set_elm_builtin",a:e}},sm=um(cp),cm=r(function(e,t){return L(om({blockNumber:ci,errors:yr,nodePath:t,pending:sm,ref:1,requests:cp,tagger:e,watching:sm}),f(Zp,f(zo,im,e),zy(t)))}),fm=function(e){return f(cm,am,Xh(e))},lm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},hm=dm(f(lm,ci,ci)),pm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:Co,secureCommInfo:hm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),gm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),vm=n(function(e,t,r){var n=f(nm,t,r),a=fm(t),i=a.a,o=a.b;return d(gm,l(pm,f(jy,t,r),i,e),Po(M([n,o,Yy(Xh(t))])),Fo,M([ha]))}),ym=function(e){return{$:"LoadedTrade",a:e}},mm=function(e){return{$:"EventLogFetched",a:e}},bm=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),Cm=ue,Em=ce,Sm=Yr,Tm=n(function(e,t,r){var n=function(e){return Em(M([e,Cm(r)]))};return f(du,function(a){var i=f(Gh,e,a);if("Ok"===i.$){var o=i.a,u=f(Gh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return hu(Di(c))}return Fi(r)},Sm)}),wm=a(function(e,t,r,n){return f(dh,l(Tm,f(Oh,e,Sm),t,r),n)}),Im=n(function(e,t,r){return f(dh,f(Oh,e,t),r)}),Am=gu(Ph),Bm=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),km=function(e){return{$:"BlockHash",a:e}},Nm=function(e){return Bm(e)?li(km(cu(e))):fi("Given blockHash "+xh(e)+" is not valid.")},Rm=gu(Nm),$m=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),_m=function(e){return $m(e)?li(nc(cu(e))):fi("Something in here is not very hexy: "+xh(e))},Lm=gu(_m),xm=function(e){return{$:"TxHash",a:e}},Pm=function(e){return Bm(e)?li(xm(cu(e))):fi("Given txHash "+xh(e)+" is not valid.")},Dm=gu(Pm),Um=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}}),Om=zr,Mm=oe,Fm=l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionHash",Dm,l(Im,"transactionIndex",Gy,l(Im,"logIndex",Gy,d(wm,"removed",Om,!1,l(Im,"topics",Mm(Lm),l(Im,"data",pu,l(Im,"address",Am,Fi(Um)))))))))),Vm=function(e){return f(zh,function(e){if("Just"===e.$){var t=e.a;return hl(qf(t))}return bl},e)},Km=function(e){return Cl(M([L("fromBlock",Zh(e.fromBlock)),L("toBlock",Zh(e.toBlock)),L("address",pl(e.address)),L("topics",Vm(e.topics))]))},Hm=r(function(e,t){return Up({decoder:Mm(Fm),method:"eth_getLogs",params:M([Km(t)]),url:e})}),jm=function(e){return{$:"BlockNum",a:e}},qm=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Kp,function(r){return f(jp,vi(r),f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)})))},f(Hm,e,t)):f(Hm,e,t)}),Gm=r(function(e,t){var r=t.a;return um(l(xl,e,gr,r))}),zm=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(xl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(om(D(o,{watching:f(Gm,a.ref,o.watching)})),f(Zp,f(zo,bm(a.ref),a.tagger),e),a.ref)}(l(qm,a.nodePath,n,L(s,s)))}return x(om(D(o,{pending:f(Gm,a.ref,o.pending)})),Do,a.ref)}),Ym=zm(!1),Wm=r(function(e,t){var r=function(){var e=fm(t.factory),r=e.a,n=e.b;return function(e){var t=e.a,r=e.b,a=e.c;return x(t,Po(M([n,r])),a)}(l(Ym,mm,r,{address:t.creationInfo.address,fromBlock:jm(t.creationInfo.blocknum),toBlock:Mp,topics:yr}))}(),n=r.a,a=r.b;return d(gm,l(pm,ym(t),n,e),Po(M([a,Yy(Xh(t.factory))])),Fo,M([ha]))}),Jm=function(e){return{data:si(f(Gf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Qm=function(e){return{data:si(f(Gf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Xm=function(e){return{data:si(f(Gf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Zm=r(function(e,t){return{data:si(f(Gf,"initiatorStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),eb=function(e){return{data:si(f(Gf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},tb=function(e){return{data:si(f(Gf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},rb=r(function(e,t){return{data:si(f(Gf,"responderStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),nb=r(function(e,t){return{amount:t,fiatType:e}}),ab=f(du,function(e){var t=cd(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("Can't convert that to a BigInt")},pu),ib=l(Mi,nb,f(Fh,0,pu),f(Fh,1,ab)),ob={$:"Bank"},ub={$:"Cash"},sb=function(e){switch(e){case"cash":return si(ub);case"bank":return si(ob);case"custom":return si(Fd);default:return ci}},cb=f(du,function(e){var t=sb(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("")},pu),fb=l(Mi,Vd,f(Oh,"type",cb),f(Oh,"info",pu)),lb=function(e){var t=l(Mi,sg,f(Oh,"price",ib),f(Oh,"paymentmethods",Mm(fb)));return f(op,t,e)},db=r(function(e,t){return{commPubkey:t,responder:e}}),hb=r(function(e,t){var n=r(function(t,r){return l(Xo,t,t+2*r,e)}),a=f(zo,Nh,au(ti(2)));return f(Wh,function(t){return f(au,function(e){return f(n,t+64,e)},Nh(l(Xo,t,t+64,e)))},a(t))}),pb=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),gb=n(function(e,t,r){var n=l(Ra,pb(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),vb=j,yb=function(e){return As(vb(e))},mb=function(e){return l(gb,r(function(e,t){return U(t,yb(e))}),"",e)},bb=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f(Wh,mb,f(Wh,f(zo,xa(Nh),Ah),f(au,ml(f(zo,_d,ns)),f(au,tc(2),f(hb,t,nu(r)))))))}),Cb=f(dh,f(Mh,1,bb),f(dh,f(Mh,0,Dh),Fi(db))),Eb=r(function(e,t){return{commPubkey:t,terms:e}}),Sb=f(dh,f(Mh,1,bb),f(dh,f(Mh,0,bb),Fi(Eb))),Tb=function(e){return{statement:e}},wb=f(dh,f(Mh,0,bb),Fi(Tb)),Ib=function(e){return{statement:e}},Ab=f(dh,f(Mh,0,bb),Fi(Ib)),Bb={$:"AbortedEvent"},kb={$:"BurnedEvent"},Nb={$:"ClaimedEvent"},Rb=function(e){return{$:"CommittedEvent",a:e}},$b=function(e){return{$:"InitiatedEvent",a:e}},_b=function(e){return{$:"InitiatorStatementLogEvent",a:e}},Lb={$:"PokeEvent"},xb={$:"RecalledEvent"},Pb={$:"ReleasedEvent"},Db=function(e){return{$:"ResponderStatementLogEvent",a:e}},Ub=f(Oh,"topics",f(Fh,0,Lm)),Ob=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),Kf(f(xa,yi,Zs(e))))))},Mb=f(du,function(e){return R(e,Ob("Initiated(string,string)"))?f(Oi,$b,Sb):R(e,Ob("Committed(address,string)"))?f(Oi,Rb,Cb):R(e,Ob("Recalled()"))?Fi(xb):R(e,Ob("Claimed()"))?Fi(Nb):R(e,Ob("Aborted()"))?Fi(Bb):R(e,Ob("Released()"))?Fi(Pb):R(e,Ob("Burned()"))?Fi(kb):R(e,Ob("InitiatorStatementLog(string)"))?f(Oi,_b,wb):R(e,Ob("ResponderStatementLog(string)"))?f(Oi,Db,Ab):R(e,Ob("Poke()"))?Fi(Lb):hu("Unrecognized topic hash")},Ub),Fb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},Vb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},Kb=function(e){return R(e.buyerDeposit,Yl(e.tradeAmount))&&R(e.abortPunishment,zl(e.tradeAmount))},Hb={$:"Invalid"},jb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),qb=r(function(e,t){return Vl(jd(t)+jd(e))}),Gb=function(e){var t=Bd(Sd(e.amount));if("Just"===t.$){return t.a}f(cl,"Error converting FiatValue to float--string -> float failed!",e);return 0},zb=r(function(e,t){return(t-e)/e}),Yb=r(function(e,t){var r=Gb(t),n=kd(e);return"USD"===t.fiatType?si(f(zb,n,r)):ci}),Wb=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 Vl(0)}}();return{margin:f(Yb,e.tradeAmount,r.price),phaseEndTime:function(){return"Closed"===t.phase.$?Vl(f(Nu,2,53)-1):f(qb,t.phaseStartTime,n)}()}}),Jb=function(e){var t=x(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 ym(v(jb,e.factory,e.id,n,a,o,u,s,l(Wb,a,o,u)))}return Hy(e)},Qb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(cl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Hb}}),Xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Hb}}),Zb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Hb}}),eC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return ym(D(n,{state:e}));default:return Hb}}),tC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Hb}}),rC=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}}),nC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,uu,f(Xy,Dh,Jy(rC))))))))))),aC=function(e){return{data:si(f(Gf,"getParameters()",yr)),decoder:nC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},iC=function(e){return f(Bo,function(e){return Vl(1e3*e)},rd(Sd(e)))},oC=function(e){return Hl(e)},uC=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),sC=function(e){var t=f($d,"error converting BigInt to Time.Posix",iC(e.autoabortInterval)),r=f($d,"error converting BigInt to Time.Posix",iC(e.autoreleaseInterval)),a=f($d,"error converting BigInt to Time.Posix",iC(e.autorecallInterval));return d(uC,n(function(t,r,n){return{abortPunishment:oC(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:oC(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:oC(e.pokeReward),tradeAmount:oC(e.tradeAmount)}}),a,t,r)},cC=n(function(e,t,r){return f(Zp,r,f(jp,sC,f(Fp,Xh(e),aC(t))))}),fC=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}}}}}}}}}}},lC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(fC)))))))))))),dC=function(e){return{data:si(f(Gf,"getPhaseStartInfo()",yr)),decoder:lC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},hC=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),pC=function(e){return h(hC,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}}),iC(e.v6),iC(e.v7),iC(e.v8),iC(e.v9))},gC=n(function(e,t,r){return f(Zp,r,f(jp,pC,f(Fp,Xh(e),dC(t))))}),vC=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),yC=vu(f(Xy,jh,f(Xy,Dh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(vC))))))),mC=function(e){return{data:si(f(Gf,"getState()",yr)),decoder:yC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},bC={$:"Aborted"},CC={$:"Burned"},EC={$:"NotClosed"},SC={$:"Recalled"},TC={$:"Released"},wC=function(e){switch(f(xc,99,rd(Sd(e)))){case 0:return si(EC);case 1:return si(SC);case 2:return si(bC);case 3:return si(TC);case 4:return si(CC);default:return ci}},IC=function(e){switch(f(xc,99,rd(Sd(e)))){case 1:return si(Co);case 2:return si(mo);case 3:return si(bo);case 4:return si(yo);default:return ci}},AC=function(e){return R(e,th("0x0000000000000000000000000000000000000000"))?ci:si(e)},BC=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),kC=function(e){var t=iC(e.phaseStartTimestamp),r=IC(e.phase),a=wC(e.closedReason);return d(BC,n(function(t,r,n){return{balance:oC(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:AC(e.responder)}}),r,t,a)},NC=n(function(e,t,r){return f(Zp,r,f(jp,kC,f(Fp,Xh(e),mC(t))))}),RC=i(function(e,t,r,n,a){return Po(M([l(cC,e,t,r),l(NC,e,t,n),l(gC,e,t,a)]))}),$C=function(e){var t=Rg(e);if("Just"===t.$){return t.a}f(cl,"Warning! BigInt to Int conversion failed!",Sd(e));return 0},_C=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),LC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),xC=function(e){return e.b?l(LC,e,yr,0):qa},PC=tn,DC=function(e){var t=h(PC,_C,f(Oh,"encapsulation",pu),f(Oh,"iv",pu),f(Oh,"tag",pu),f(Oh,"encrypted",pu)),r=Mm(t),n=f(Gh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Zc,0,e),f(Zc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(xC(i))},UC=function(e){var t=function(e){var t=Qo(e);return t>1114111?fi("string is too long"):li(f(Is,vb(t),e))};return f(au,Ri(""),Ah(f(xa,t,e)))},OC=function(e){var t=e.a,r=e.b;return UC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},MC=r(function(e,t){return Cl(M([L("message",hl(e)),L("pubkeyHexStrings",f(zh,hl,M([t.initiatorPubkey,t.responderPubkey])))]))}),FC=function(e){return{$:"LoadedCommInfo",a:e}},VC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),KC=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 FC(f(VC,r,n))}return dm(e)},HC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return FC(D(n,{initiatorPubkey:e}))}),jC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{responderPubkey:si(e)}))}var n=t.a;return FC(D(n,{responderPubkey:e}))}),qC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),GC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(nd,a,n),o=$s(f(lc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),zC=function(e){var t=xC(f(GC,Zs(e),yr));return l(zd,uv,h(hC,_C,f(Zc,0,t),f(Zc,1,t),f(Zc,2,t),f(Zc,3,t)),h(hC,_C,f(Zc,4,t),f(Zc,5,t),f(Zc,6,t),f(Zc,7,t)))},YC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),WC={$:"Aborted"},JC={$:"Burned"},QC={$:"Claimed"},XC=function(e){return{$:"Committed",a:e}},ZC=function(e){return{$:"Encrypted",a:e}},eE={$:"FailedDecode"},tE={$:"Initiated"},rE={$:"Recalled"},nE={$:"Released"},aE=function(e){return{$:"StateChange",a:e}},iE=function(e){return{$:"Statement",a:e}},oE=fr,uE=cr,sE=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(oE,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(uE,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),cE=or,fE=y,lE=a(function(e,t,r,n){var a=Wc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(cE,Ga(r),n);var i=za(d(lE,e-Ha,t,r,ja));return f(cE,i,n)}var o=f(Jc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(lE,e-Ha,t,r,u));return l(rf,a,i,n)}var i=za(d(lE,e-Ha,t,r,fE(o)));return l(rf,a,i,n)}),dE=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(lE,c,r,e,fE(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(lE,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),hE=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(oE,32,r,e),o=f(dE,i,t);if(a<0){var u=l(uE,a,n,e);return f(dE,u,o)}return o}),pE=ur,gE=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(pE,i,t,r)}return f(ka,e,t)});return{nodeList:l(pE,i,yr,n),nodeListSize:t/32|0,tail:a}},vE=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(pE,o,t,r)}var n=e.a;return f(hE,n,t)});return f(hE,i,l(pE,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(pE,o,t,r)}var n=e.a;return f(sE,n,t)});return f(ai,!0,f(sE,i,l(pE,o,gE(e),a)))}),yE=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),mE=f(La,yE,yr),bE=n(function(e,t,r){var n=qC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(aE(tE));case"CommittedEvent":var r=t.a;return si(aE(XC(r.responder)));case"RecalledEvent":return si(aE(rE));case"ClaimedEvent":return si(aE(QC));case"AbortedEvent":return si(aE(WC));case"ReleasedEvent":return si(aE(nE));case"BurnedEvent":return si(aE(JC));case"InitiatorStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(To)}));case"ResponderStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(wo)}));default:return ci}}(),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(vE,r.history,xC(mE(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Bo,YC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),mE(M([s])))}),CE=Gr,EE=function(e){var t=l(Mi,uv,f(Oh,"id",CE),f(Oh,"message",pu));return f(Hd,Di,f(Gh,t,e))},SE=function(e){return{$:"Decrypted",a:e}},TE=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),wE=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(bE,n,a,t),o=i.a,u=i.b,s=i.c;return d(TE,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(TE,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(TE,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=EE(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Zc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:SE(y)}),T=D(b,{eventInfo:iE(S)}),w=l(af,v,T,t.history);return d(TE,D(t,{history:w}),!1,ci,yr)}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an event that is not a message!",b))]))}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(TE,t,!1,ci,M([pa(f(ll,"Error decoding decryption result",I))]))}}),IE=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),AE=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),BE=function(e){return{onBroadcast:ci,onMined:si(L(IE(e),ci)),onSign:si(AE(e))}},kE=je("encryptToPubkeys",Ua),NE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),RE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),$E=function(e){return{$:"CommitMined",a:e}},_E={$:"CommitNeedsSig"},LE=function(e){return{$:"CommitSigned",a:e}},xE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?RE:NE}(),a=al(function(){return"Token"===e.factory.$?Ua:pg(jl(Fb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(_E),f(qo,{onBroadcast:ci,onMined:si(L($E,ci)),onSign:si(LE)},a))}),PE=r(function(e,t){return Cl(M([L("id",wl(e)),L("encapsulation",hl(t.encapsulatedKey)),L("iv",hl(t.iv)),L("tag",hl(t.tag)),L("encrypted",hl(t.message))]))}),DE=je("decryptMessage",Ua),UE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},OE=r(function(e,t){return Po(f(xa,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 DE(f(PE,r,s))}return Do}return Do},UE(e.history)))}),ME=function(e){if("Just"===e.$){return e.a}return ci},FE=function(e){var t=ME(l(zd,Ao,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Bo,function(e){return e.address},Gd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(OE,n,a)}return Do},VE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(bE,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),KE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),HE=i(function(e,t,r,n,a){return f(VE,n,p(KE,e,r,t,qa,a,""))}),jE=function(e){return{$:"ChatHistoryMsg",a:e}},qE=a(function(e,t,r,n){var a=x(t,Gd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(ko,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(jE),n))}(h(HE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),GE={$:"Abort"},zE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),YE=function(e){return{$:"ActionNeedsSig",a:e}},WE=function(e){return{$:"ApproveMining",a:e}},JE={$:"ApproveNeedsSig"},QE=function(e){return{$:"ApproveSigned",a:e}},XE={$:"Burn"},ZE={$:"Claim"},eS=function(e){return{$:"CommitMining",a:e}},tS=function(e){return{$:"ConfirmingAction",a:e}},rS=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),nS=function(e){return{$:"ParametersFetched",a:e}},aS=function(e){return{$:"PhaseInfoFetched",a:e}},iS={$:"Poke"},oS={$:"Recall"},uS={$:"Release"},sS=function(e){return{$:"StartContractAction",a:e}},cS=function(e){return{$:"StateFetched",a:e}},fS=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"}},lS=function(e){return d(gm,e,Do,Fo,yr)},dS={align:ul,label:"cantFindTradeWillRetry",mainParagraphs:M([M([fl("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:$g},hS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(_g,e,r)}if("Nothing"===t.a.$){t.a;return f(ll,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ll,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),pS={align:ul,label:"tradeParametersNotDefault",mainParagraphs:M([M([fl("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:$g},gS=eo(Xi),vS=n(function(e,t,r){return l(bp,e,Bo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),yS=r(function(e,t){var r=t.a;return um(f(mp,e,r))}),mS=n(function(e,t,r){var n=e.a,a=f(fp,t,n.requests);if("Nothing"===a.$)return L(om(n),Do);var i=a.a,o=L(i.watchOnce,Ql(r));if("Nothing"===o.b.$){o.b;return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Do)}if(o.a){var u=o.b.a;return L(om(D(n,{requests:l(vS,t,r,n.requests),watching:f(yS,t,n.watching)})),f(Yg,i.tagger,xp(u)))}return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Po(f(xa,function(e){return f(Yg,i.tagger,xp(e))},r)))}),bS=_e,CS=r(function(e,t){return f(Zp,f(zo,im,t),f(Kp,function(t){return zy(e)},bS(2e3)))}),ES=n(function(e,t,r){var n=r.a,a=r.b;return f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)}))}),SS=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(SS,e,t,i)),c=o;e=u,t=s,r=c}}),TS=r(function(e,t){return l(SS,xl,t,e)}),wS=r(function(e,t){var r=e.a,n=t.a;return um(f(TS,r,n))}),IS=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 Po(f(xa,function(t){return f(Zp,f(zo,bm(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},mE(f(xa,function(e){return f(fp,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(om(D(r,{blockNumber:si(a)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,ES)]))):L(t,f(CS,r.nodePath,r.tagger))}return L(om(D(r,{blockNumber:si(a),pending:sm,watching:f(wS,r.watching,r.pending)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(a,a),r.pending,qm),l(i,L(a,a),r.watching,ES)])))}var s=e.a.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),f(CS,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(mS,t,c,d)}var s=e.b.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),Do)}),AS=function(e){return M([e])},BS=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(nm,r.factory,r.id):Do}}(),function(){var e=x(Gd(t.wallet),Mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Mg(t.wallet),si(a.factory))?d(eg,n,r.address,a.creationInfo.address,Ly):Do}return Do}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(qE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?FE(t):Do,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(gm,u,Po(M([l(NC,p.factory,p.creationInfo.address,cS),s,r])),Fo,o)}return lS(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return lS(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(ts,m,jl(Fb(C.parameters))),ba))return lS(u);var S=l(xE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(gm,D(u,{txChainStatus:T}),Do,w,yr)}return lS(u)}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:$C(I.blocknum)},B=l(Ym,mm,t.eventSentry,{address:A.address,fromBlock:jm(A.blocknum),toBlock:Mp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(Qb,A,t.trade)}),$=f(xc,gS,Vb(u.trade)),_=Po(M([N,h(RC,$,A.address,nS,cS,aS)]));return d(gm,u,_,Fo,yr)}if("BadBody"===g.a.$){g.a.a;return d(gm,t,Do,Fo,M([pa(dS)]))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(eC,P,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(Kb(F)){var u=D(t,{trade:f(Xb,F,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(pS)]))}var V=g.a.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Zb,H,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Yh,Mb,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(HC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(jC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=lb(e.terms);if("Ok"===r.$){var n=r.a;return L(f(tC,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ll,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(jE),n))}(l(bE,q.blockNumber,Y,r))}return d(qE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?FE(u):Do;return d(gm,u,_,Fo,f(oo,f(xa,pa,mE(M([X]))),o));case"ExpandPhase":var te=e.a;return lS(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return lS(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return lS(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(gm,t,Do,Fo,M([da(jv(C.parameters.initiatorAddress))]))}return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return lS(D(t,{txChainStatus:si(f(rS,E,ie))}));case"AbortAction":return lS(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(xE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=al(l(sh,nh(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(QE)};return f(qo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(ts,i,jl(Fb(C.parameters))),ba)?L(si(JE),n):l(xE,C,E.address,E.commPubkey)}return L(si(JE),n)}(),T=oe.a,w=oe.b;return d(gm,D(t,{txChainStatus:T}),Do,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,iS)||R(ue,oS)){var se=sS(ue),ce=t;e=se,t=ce;continue e}return lS(D(t,{txChainStatus:si(tS(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Fo,M([pa(f(ll,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=al(eb(n.creationInfo.address));return x(si(YE(oS)),f(qo,BE(oS),a),yr);case"Claim":var a=al(Xm(n.creationInfo.address));return x(si(YE(ZE)),f(qo,BE(ZE),a),yr);case"Abort":var a=al(Jm(n.creationInfo.address));return x(si(YE(GE)),f(qo,BE(GE),a),yr);case"Release":var a=al(tb(n.creationInfo.address));return x(si(YE(uS)),f(qo,BE(uS),a),yr);case"Burn":var a=al(Qm(n.creationInfo.address));return x(si(YE(XE)),f(qo,BE(XE),a),yr);default:var a=al(zf(n.creationInfo.address));return x(si(YE(iS)),f(qo,BE(iS),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(gm,D(t,{txChainStatus:T}),Do,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return lS(D(t,{txChainStatus:si(WE(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return lS(D(t,{txChainStatus:si(eS(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"commit",V))]));case"CommitMined":return lS(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return lS(D(t,{txChainStatus:si(f(zE,ue,he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,fS(ue),V))]));case"ActionMined":var ue=e.a;return lS(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(IS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(gm,D(t,{eventSentry:ve}),_,Fo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(wE,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?FE(t):Do,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(kE(f(MC,r,a)),ci)}return L(Do,si(f(ll,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Do,ci)}(),Te=Se.a,we=Se.b;return d(gm,Ee,Po(M([s,Te])),Fo,U(f(Qi,jE,Ce.appCmds),f(xc,yr,f(Bo,AS,f(Bo,pa,we)))))}return d(gm,t,Do,Fo,M([pa(f(ll,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Wh,OC,DC(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Ao,p,E.address);if("Nothing"===Ne.$)return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return al("Initiator"===Re.$?f(Zm,p.creationInfo.address,ke):f(rb,p.creationInfo.address,ke))}();return d(gm,t,Do,f(qo,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(gm,t,Do,Fo,M([pa(f(ll,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return lS(t)}var V=e.a.a;return d(gm,t,Do,Fo,M([pa(f(Lg,"message",V))]));default:return d(gm,t,Do,Fo,M([ga]))}}),kS=r(function(e,t){return{address:e,blocknum:t}}),NS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},RS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(zm,!0,e,t,r))}),$S=n(function(e,t,r){var n=function(e){return r(f(Yh,Sb,e).returnData)},a={address:t.address,fromBlock:jm(t.blocknum),toBlock:jm(t.blocknum),topics:M([si(Ob("Initiated(string,string)"))])};return l(RS,n,e,a)}),_S=function(e){return{data:si(f(Gf,"numTrades()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},LS=r(function(e,t){return f(Zp,t,f(Fp,Xh(e),_S(rh(e))))}),xS=function(e){return{data:si(f(Gf,"phase()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},PS=n(function(e,t,r){return f(Zp,r,f(jp,IC,f(Fp,Xh(e),xS(t))))}),DS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),US=r(function(e,t){return l(La,DS(e),yr,t)}),OS=function(e){return f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},MS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},FS=function(e){return f(MS,Ja(Hb),Sa(e.trades))},VS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:FS(e),loaded:Ti(OS(e))})})},KS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),HS=r(function(e,t){var r=f(Zc,e,t.trades);if("Just"===r.$){var n=(r.a,l(af,e,Hb,t.trades));return l(KS,VS(D(t,{trades:n})),Do,yr)}return l(KS,t,Do,M([pa(f(ll,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),jS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Qb,t,a),o=l(af,e,i,r.trades);return L(VS(D(r,{trades:o})),yr)}return L(r,M([f(ll,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),qS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Xb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(af,e,ym(D(a,{state:D(i,{phase:t})})),r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),zS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Zb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),YS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(eC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),WS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),JS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),QS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),XS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),ZS=function(e){return{$:"NumTradesFetchedAgain",a:e}},eT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),tT=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),rT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),nT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),aT=function(e){return l(KS,e,Do,yr)},iT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=$C(n),i=xC(f(xa,jy(t.factory),f(Ai,0,a-1))),o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,0,a-1)));return l(KS,D(t,{dataFetchState:l(QS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CheckForNewTrades":return l(KS,t,f(LS,t.factory,ZS),yr);case"UpdateTradePhases":var s=Po(mE(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(PS,e.factory,e.creationInfo.address,f(tT,e.factory,e.id)))},OS(t))));return l(KS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(GS,d,p,t),v=function(){var e=L(p,f(Zc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=NS(r);if("Just"===n.$){var a=n.a;return L(l(NC,c,a.address,nT(d)),yr)}return L(Do,M([pa(f(ll,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Do,yr)}e.b;return L(Do,M([pa(f(ll,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(KS,g.tradeCache,Po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(KS,t,Do,M([pa(f(hS,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=$C(n);if(_(C,E)<0){var S=t.dataFetchState,o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,C,E-1))),T=xC(f(xa,jy(t.factory),f(Ai,C,E-1)));return l(KS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(vE,t.trades,T)}),o,yr)}return aT(t)}b.b;return l(KS,t,Do,M([pa(f(ll,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(kS,w.address_,$C(w.blocknum)),A=l($S,t.eventSentry,I,XS(d)),B=A.a,k=A.b,y=Po(M([h(RC,t.factory,I.address,eT(d),nT(d),rT(d)),k])),N=l(jS,d,I,t),R=N.a,$=N.b;return l(KS,VS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(KS,t,Do,M([pa(f(_g,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(qS,d,P,t)}var U=r.a.a;return l(KS,t,Do,M([pa(f(ll,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(YS,d,O,t)}return l(KS,t,Do,M([pa(f(hS,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(zS,d,F,t)}return l(KS,t,Do,M([pa(f(hS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=lb(V.terms);if("Ok"===K.$){var H=K.a;return l(WS,d,H,t)}var j=K.a;return f(HS,d,t)}var j=r.a;return l(KS,t,Do,M([pa(f(ll,"Error decoding initiated event",j))]));default:var q=e.a,G=f(IS,q,t.eventSentry),z=G.a,y=G.b;return l(KS,D(t,{eventSentry:z}),y,yr)}}),oT=function(e){return{$:"AgentHistoryMsg",a:e}},uT=function(e){return{$:"AppCmd",a:e}},sT={$:"BetaLandingPage"},cT={$:"ConnectToWeb3"},fT=function(e){return{$:"MarketplaceMsg",a:e}},lT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),dT=r(function(e,t){return f(kn,e,hl(t))}),hT=function(e){return f(dT,"href",tt(e))},pT=Nn("rel"),gT=dT("target"),vT=function(e){return{$:"Height",a:e}},yT=vT,mT={$:"Content"},bT=mT,CT=function(e){return{$:"Width",a:e}},ET=CT,ST=function(e){return{$:"Attr",a:e}},TT=function(e){return{$:"NodeName",a:e}},wT=function(e){return{$:"Unkeyed",a:e}},IT={$:"AsEl"},AT=IT,BT=r(function(e,t){return{$:"Field",a:e,b:t}}),kT=f(BT,0,0),NT={$:"NoNearbyChildren"},RT={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"},$T=RT.any+" "+RT.column,_T=RT.any+" "+RT.grid,LT=RT.any+" "+RT.page,xT=RT.any+" "+RT.paragraph,PT=RT.any+" "+RT.row,DT=RT.any+" "+RT.single,UT=function(e){switch(e.$){case"AsRow":return PT;case"AsColumn":return $T;case"AsEl":return DT;case"AsGrid":return _T;case"AsParagraph":return xT;default:return LT}},OT=function(e){return{$:"Keyed",a:e}},MT={$:"NoStyleSheet"},FT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),VT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),KT={$:"AsParagraph"},HT=KT,jT=Sn("div"),qT=Sn("p"),GT=Sn("s"),zT=Sn("u"),YT=dT("className"),WT=function(e){return wn(Xe(e))},JT=function(e){return Sn(Xe(e))},QT=function(e){return{$:"Flag",a:e}},XT=function(e){return{$:"Second",a:e}},ZT=function(e){return e>31?XT(1< .ctr > ."+RT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",eI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+" { flex-basis: auto !important; } "+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+Ew(RT.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"+Zw,tI=function(e){return{$:"Intermediate",a:e}},rI=r(function(e,t){return tI({closing:t,others:yr,props:yr,selector:e})}),nI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,tI({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(nI,f(rI,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(nI,f(rI,n.selector,""),v),t.others)})}});return tI(l(La,a,n,t))}),aI=U(eI,function(e){var t=function(e){return Cd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Cd(f(xa,a,t.others)))};return Cd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(nI,f(rI,r,""),n),t)}),yr,e)))}(U(Jw,Xw))),iI=l(JT,"style",yr,M([Tw(aI)])),oI=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+'"'}},uI=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}},sI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ch,uI,t.variants)}return!1},cI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),fI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),lI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(fI,"."+e+"."+t+", ."+e+" ."+t,n),f(fI,"."+e+"."+t+"> ."+RT.text+", ."+e+" ."+t+" > ."+RT.text,a)])}),dI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(lI,i,RT.sizeByCapital,a),l(lI,i,RT.fullSize,n)))}),hI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(fI,"."+r+"."+RT.sizeByCapital+", ."+r+" ."+RT.sizeByCapital,M([L("line-height","1")])),f(fI,"."+r+"."+RT.sizeByCapital+"> ."+RT.text+", ."+r+" ."+RT.sizeByCapital+" > ."+RT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),pI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},gI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Tc,t,r))}return ci},vI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),yI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(xc,e.descender,gI(t)),n=f(xc,e.baseline,gI(f(ml,function(e){return!R(e,r)},t))),a=f(xc,e.capital,pI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(vI,i,a-n,o),full:l(vI,u,a-r,s)}},mI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",mw(e.height)),L("vertical-align",mw(e.vertical)+"em"),L("font-size",mw(e.size)+"em")]))},bI=function(e){return l(Ra,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 si(L(mI(function(e){return e.full}(yI(a))),mI(function(e){return e.capital}(yI(a)))))}return t}return t}),ci,e)},CI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(US,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=bI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,hI(t),n));var i=a.a;return f(Ri,"",f(xa,f(dI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},EI=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+'" '+Ni(r)}},SI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,EI,t.variants)))}return ci},TI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},wI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+mw(r)+"px, "+mw(n)+"px, "+mw(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("+mw(o)+"px, "+mw(u)+"px, "+mw(s)+"px)",b="scale3d("+mw(f)+", "+mw(l)+", "+mw(d)+")",C="rotate3d("+mw(p)+", "+mw(g)+", "+mw(v)+", "+mw(y)+"rad)";return si(m+" "+b+" "+C)}},II=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,cI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,cI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,cI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,cI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+RT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+RT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+RT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,cI(!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,M([f(vw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Tc,1,1-c));return l(a,t,"."+u,M([f(vw,"opacity",mw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(vw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(US,SI,p)),v=M([f(vw,"font-family",f(Ri,", ",f(xa,oI,p))),f(vw,"font-feature-settings",g),f(vw,"font-variant",f(Ch,sI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(vw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(vw,s,bw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+RT.row,A="."+(RT.wrapped+I),B="."+RT.alignRight,k="."+RT.paragraph,N="."+RT.page,R="."+RT.alignLeft,$=mw(S/2)+"px",_=mw(E/2)+"px",x="."+RT.column,y="."+C,P="."+RT.any;return Cd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(vw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(vw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,U(y,k),M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,lw,F.rows))+"-cols-"+f(Ri,"-",f(xa,lw,F.columns))+"-space-x-"+lw(F.spacing.a)+"-space-y-"+lw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=wI(ne),y=hw(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,M([f(vw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=TI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(CI(s),c)}),AI=r(function(e,t){return l(JT,"style",yr,M([Tw(f(II,e,t))]))}),BI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",iI),f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)}),kI=a(function(e,t,r,n){return e?f(ka,iI,f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)):f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)}),NI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(WT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(BI,!1,e,t,r);default:var e=i.a,t=i.b;return d(BI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return jT;case"p":return qT;default:return JT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(kI,!1,e,t,n);default:var e=i.a,t=i.b;return d(kI,!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(JT,e,n,M([f(u,r,M([YT(RT.any+" "+RT.single)]))]))}}();switch(o.$){case"AsRow":return f(ow,sw,e)&&!f(ow,uw,e)?s:f(ow,tw,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerRight])))]),M([s])):f(ow,rw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(ow,iw,e)&&!f(ow,aw,e)?s:f(ow,nw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerCenterY])))]),M([s])):f(ow,ew,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerBottom])))]),M([s])):s;default:return s}}),RI=Tw,$I=function(e){return f(jT,M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthContent,RT.heightContent])))]),M([RI(e)]))},_I=function(e){return l(JT,"div",M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthFill,RT.heightFill])))]),M([Tw(e)]))},LI=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 R(e,HT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,HT),L(f(ka,L(n,f(s.html,MT,e)),i),Iu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,AT)?_I(c):$I(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 R(e,HT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,HT),L(f(ka,f(o.html,MT,e),n),Iu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,AT)?_I(u):$I(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children)),MT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children)),MT))}),xI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),PI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(BT,a|r,n)}var i=e.a;return f(BT,r,i|n)}),DI=ZT(7),UI=ZT(36),OI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(BT,r|a,n|i)}),MI=ZT(6),FI=ZT(38),VI=ZT(30),KI=ZT(29),HI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),jI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),qI=function(e){return{$:"Transform",a:e}},GI=function(e){return{$:"ChildrenBehind",a:e}},zI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),YI=function(e){return{$:"ChildrenInFront",a:e}},WI=r(function(e,t){return f(jT,M([YT(function(){switch(e.$){case"Above":return f(Ri," ",M([RT.nearby,RT.single,RT.above]));case"Below":return f(Ri," ",M([RT.nearby,RT.single,RT.below]));case"OnRight":return f(Ri," ",M([RT.nearby,RT.single,RT.onRight]));case"OnLeft":return f(Ri," ",M([RT.nearby,RT.single,RT.onLeft]));case"InFront":return f(Ri," ",M([RT.nearby,RT.single,RT.inFront]));default:return f(Ri," ",M([RT.nearby,RT.single,RT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Tw("");case"Text":var e=t.a;return $I(e);case"Unstyled":return(0,t.a)(AT);default:return f(t.a.html,MT,AT)}}()]))}),JI=n(function(e,t,r){var n=f(WI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?GI(M([n])):YI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?GI(f(ka,n,a)):f(zI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(zI,M([n]),i):YI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(zI,f(ka,n,a),i):f(zI,a,f(ka,n,i))}}),QI=r(function(e,t){switch(t.$){case"Generic":return TT(e);case"NodeName":var r=t.a;return f(HI,r,e);default:var n=t.a,a=t.b;return f(HI,n,a)}}),XI=function(e){switch(e.$){case"Left":return RT.alignedHorizontally+" "+RT.alignLeft;case"Right":return RT.alignedHorizontally+" "+RT.alignRight;default:return RT.alignedHorizontally+" "+RT.alignCenterX}},ZI=function(e){switch(e.$){case"Top":return RT.alignedVertically+" "+RT.alignTop;case"Bottom":return RT.alignedVertically+" "+RT.alignBottom;default:return RT.alignedVertically+" "+RT.alignCenterY}},eA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),tA=function(e){return{$:"Moved",a:e}},rA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return tA(x(r,0,0));case"MoveY":var n=t.a;return tA(x(0,n,0));case"MoveZ":var a=t.a;return tA(x(0,0,a));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(eA,x(0,0,0),i,x(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 tA(x(s,n,a));case"MoveY":var c=t.a;return tA(x(r,c,a));case"MoveZ":var f=t.a;return tA(x(r,n,f));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,u,x(1,1,1),i,o);default:var l=t.a;return d(eA,u,l,x(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(eA,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(eA,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(eA,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(eA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(eA,u,h,v,y);default:var m=t.a;return d(eA,u,m,p,o)}}}),nA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(kT,n,M([l(jI,n,"height",r+"px")]));case"Content":return x(f(PI,UI,kT),RT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(PI,iw,kT),RT.heightFill,yr):x(f(PI,iw,kT),RT.heightFillPortion+" height-fill-"+Ni(a),M([l(jI,RT.any+"."+RT.row+" > "+Ew("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(jI,u,"min-height",Ni(i)+"px"),c=nA(o),d=c.a,h=c.b,p=c.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(jI,u,"max-height",Ni(g)+"px"),v=nA(o),d=v.a,h=v.b,p=v.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p))}},aA=function(e){switch(e.$){case"Px":var t=e.a;return x(kT,RT.widthExact+" width-px-"+Ni(t),M([l(jI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(PI,FI,kT),RT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(PI,sw,kT),RT.widthFill,yr):x(f(PI,sw,kT),RT.widthFillPortion+" width-fill-"+Ni(r),M([l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(jI,i,"min-width",Ni(n)+"px"),u=aA(a),s=u.a,c=u.b,d=u.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(jI,i,"max-width",Ni(h)+"px"),p=aA(a),s=p.a,c=p.b,d=p.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d))}},iA=ZT(27),oA=r(function(e,t){if(R(e,iA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),uA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=hw(n);if("Nothing"===s.$)return{attributes:f(ka,YT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,YT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,qI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(oA,S,I)){var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(PI,S,r),y=f(rA,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(ow,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=RT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(PI,MI,r),y=n,m=f(ka,l(jI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+RT.widthContent,g=t,v=f(PI,FI,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+RT.widthFill,g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=aA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(ow,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(PI,DI,r),y=n,m=f(ka,l(jI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=RT.heightContent+" "+e,g=t,v=f(PI,UI,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=RT.heightFill+" "+e,g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.column+" > "+Ew("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=nA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(QI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(QI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(QI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(QI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(QI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(QI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(QI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return TT("p");case"NodeName":var e=t.a;return TT(e);default:var r=t.a,n=t.b;return f(HI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(JI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(ow,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=XI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(PI,rw,e);case"Right":return f(PI,tw,e);default:return e}}(f(PI,VI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(ow,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=ZI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(PI,nw,e);case"Bottom":return f(PI,ew,e);default:return e}}(f(PI,KI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),sA={$:"Untransformed"},cA=sA,fA=a(function(e,t,r,n){return l(LI,e,n,v(uA,UT(e),t,kT,cA,yr,yr,NT,$a(r)))}),lA=function(e){return ST(YT(e))},dA=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ST(gT("_blank")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e)))))),wT(M([n])))}),hA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),pA=n(function(e,t,r){return d(hA,e,t,r,1)}),gA=ZT(14),vA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),yA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),mA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return dw(t)+"-"+dw(r)+"-"+dw(n)+"-"+dw(a)},bA=function(e){return f(yA,gA,l(vA,"fc-"+mA(e),"color",e))},CA={align:ul,label:"cantConnectNoWeb3",mainParagraphs:M([M([fl("You need a web3 provider (such as "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(") to Connect.")]),M([fl("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:xg},EA={align:ul,label:"invalidUrl",mainParagraphs:M([M([fl("I don't understand that URL...")]),M([fl("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:$g},SA=function(e){return{$:"Active",a:e}},TA=gu(f(zo,jf,f(zo,Hh,$d("Error decoding hex to BigInt")))),wA=function(){return gu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),IA=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}}}}}}}}}}}},AA=function(e){return Em(M([f(Oi,si,e),Fi(ci)]))},BA=f(dh,AA(f(Oh,"status",wA)),f(dh,AA(f(Oh,"root",pu)),l(Im,"logsBloom",pu,l(Im,"logs",Mm(Fm),f(dh,AA(f(Oh,"contractAddress",Am)),l(Im,"cumulativeGasUsed",TA,l(Im,"gasUsed",TA,l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionIndex",Gy,l(Im,"transactionHash",Dm,Fi(IA)))))))))))),kA=function(e){var t=e.a;return jf(t)},NA=f(zo,kA,hl),RA=r(function(e,t){return Up({decoder:BA,method:"eth_getTransactionReceipt",params:M([NA(t)]),url:e})}),$A=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),_A=r(function(e,t){return{$:"TxMined",a:e,b:t}}),LA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),xA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(Io,function(e){return e.b},f(Io,function(e){return e.onMinedTagger},f(fp,t,e))))}),PA=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}}}}}}}}}}}},DA=function(e){return Em(M([Cm(ci),f(Oi,si,e)]))},UA=l(Im,"input",pu,l(Im,"gas",Gy,l(Im,"gasPrice",TA,l(Im,"value",TA,l(Im,"to",DA(Am),l(Im,"from",Am,l(Im,"transactionIndex",Gy,l(Im,"blockNumber",DA(Gy),l(Im,"blockHash",function(e){return f(du,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},cu(t))?Fi(ci):f(Oi,si,e)},pu)}(Rm),l(Im,"nonce",Gy,l(Im,"hash",Dm,Fi(PA)))))))))))),OA=r(function(e,t){return Up({decoder:UA,method:"eth_getTransactionByHash",params:M([NA(t)]),url:e})}),MA=r(function(e,t){return{attempts:e,sleep:t}}),FA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Xp,function(e){return a>0?f(Kp,function(e){return f(FA,f(MA,a,n),t)},bS(1e3*n)):Lp(e)},t)}),VA=r(function(e,t){return f(Kp,function(r){return f(FA,{attempts:30,sleep:1},f(OA,e,t))},bS(250))}),KA=r(function(e,t){return f(FA,{attempts:60,sleep:5},f(RA,e,t))}),HA=function(e){return{$:"Mined",a:e}},jA=function(e){return Bo(function(t){return D(t,{status:HA(e)})})},qA=function(e){return{$:"Sent",a:e}},GA=function(e){return Bo(function(t){return D(t,{status:qA(e)})})},zA=function(e){return{$:"Signed",a:e}},YA=function(e){return Bo(function(t){return D(t,{status:zA(e)})})},WA=function(e){return"Nothing"!==e.$},JA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Tl(r),Do);case"TxSigned":var n=e.a,a=e.b,i=f(fp,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(Yg,t,xp(a))}return Do}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Do;if("Just"===t.b.$){var r=t.b.a;return f(Yg,r,xp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Yg,a,xp(fi(e)))}t.a,t.b,t.c;return Do};if("Ok"===a.$){var c=a.a,d=WA(o.onBroadcastTagger)||WA(o.onMinedTagger)?f(il,r.tagger,f(Zp,LA(n),f(VA,r.nodePath,c))):Do;return L(Tl(D(r,{txs:l(bp,n,YA(c),r.txs)})),Po(M([u,d])))}var h=a.a;return L(Tl(r),Po(M([u,s(h)])))}return L(Tl(r),Do);case"TxSent":var n=e.a,p=e.b,g=f(fp,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(il,r.tagger,f(Zp,_A(n),f(KA,r.nodePath,v.hash))):Do}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Yg,t,xp(li(v)))}return Do}();return L(Tl(D(r,{txs:l(bp,n,GA(v),r.txs)})),Po(M([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(Yg,t,xp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Yg,n,xp(fi("Error with TxSent stuff")))}e.a,e.b;return Do}();return L(Tl(r),s)}return L(Tl(r),Do);case"TxMined":var n=e.a,m=e.b,b=f(fp,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Yg,a,xp(li(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 Po(M([f(il,r.tagger,f(Zp,f($A,n,s),zy(r.nodePath))),f(Yg,a,xp(li(C))),f(Yg,u.toMsg,xp(s))]))}return Do}();return L(Tl(D(r,{txs:l(bp,n,jA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Yg,r,xp(fi("TxReceipt decoding failure")))}return Do}();return L(Tl(r),S)}return L(Tl(r),Do);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(xA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Tl(r),f(Yg,B,f(Xp,function(e){return xp(D(I,{doneWatching:!0,reOrg:!0}))},f(Kp,function(e){return xp(D(I,{doneWatching:!0}))},f(RA,r.nodePath,T.txHash)))))}return L(Tl(r),Do)}if(R(w,T.lastCheckedBlock))return L(Tl(r),f(il,r.tagger,f(Zp,f($A,n,T),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))));var k=f(xA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Tl(r),Po(M([f(il,r.tagger,f(Zp,f($A,n,I),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))),f(Yg,B,xp(I))])))}return L(Tl(r),Do)}var n=e.a,h=e.c.a;return L(Tl(r),Do);default:var h=e.a;return L(Tl(r),Do)}}),QA=Jt,XA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),ZA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),eB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(ZA,"#",e.fragment,l(ZA,"?",e.query,U(f(XA,e.port_,U(t,e.host)),e.path)))},tB=r(function(e,t){return e<0?ci:Ql(f(nd,e,t))}),rB=r(function(e,t){if(e<0)return t;var r=Bh(f(nd,e,t)),n=f(lc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),nB=n(function(e,t,r){if(e<0)return r;var n=f(nd,e,r),a=f(lc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),aB=r(function(e,t){return f(nB,e,ms(t))}),iB=r(function(e,t){Kv(t);switch(t.$){case"Home":return L(D(e,{submodel:sT}),Do);case"Create":var r=Xd(e.wallet),n=f(Ul,e.txSentry,f(Yo,Uy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(uB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),Po(M([f(il,Uy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(By,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(Wm,e.wallet,r)}return l(vm,e.wallet,u,s)}(),c=f(Ul,e.txSentry,f(Yo,Fy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(uB,U(f(Qi,Fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:My(r.model),txSentry:a}),Po(M([f(il,Fy,r.cmd),i]))));case"Marketplace":var d=Bv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Oy(h)}),Po(M([f(il,fT,p)])));case"AgentHistory":var g=t.a,v=f(Uo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:Py(y)}),Po(M([f(il,oT,m)])));default:return L(f(uo,EA,e),Do)}}),oB=r(function(e,t){var r=t.a,n=t.b,a=f(sB,uT(e),r),i=a.a,o=a.b;return L(i,Po(M([n,o])))}),uB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,oB,L(r,n),e)}),sB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(sB,cT,t);case"GotoRoute":var n=r.a;return L(t,f(Cy,t.key,n));case"GTag":var a=r.a;return L(t,wy(Sy(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),wy(Sy(d(Ol,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Uv,ky,o,u,s));default:return L(t,Ny(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(rB,c,t.userNotices)}),Do);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(by,t.key,eB(e))}var r=h.a;return QA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(cB,g,t);case"GotoRoute":var v=e.a;return L(t,Po(M([wy(Sy(d(Ol,"GotoRoute","navigation",Kv(v),0))),f(Cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Do);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,CA,t),Do):L(t,Ey(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Do;var t=e.a;return Iy(f(Ty,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Gh,pu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=SA(l(Ml,I,w,S)),B=f(Vy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ll,"Unexpected wallet state encounted when setting commPubkey!",ci),t),Do)}T.a;return L(f(uo,f(ll,"User pubkey set, but I can no longer find the user address!",ci),t),Do)}var N=E.a;return L(l(Pa,uo,f(ll,"error decoding commPubkey from JS",N),t),Do);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(lv,R,_),P=f(Ul,t.txSentry,f(Yo,Uy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(uB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),Po(M([f(il,Uy,x.cmd),F]))))}return L(t,Do);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(BS,K,j),q=f(Ul,t.txSentry,f(Yo,Fy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(uB,U(f(Qi,Fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:My(x.model),txSentry:O}),Po(M([f(il,Fy,x.cmd),F]))))}return L(t,Do);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Dv,G,Y);return f(uB,f(Qi,fT,x.appCmds),L(D(t,{submodel:Oy(x.model)}),f(il,fT,x.cmd)))}return L(t,Do);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(ol,W,Q),X=f(Ul,t.txSentry,f(Yo,oT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(uB,U(f(Qi,oT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Py(x.model),txSentry:O}),Po(M([f(il,oT,x.cmd),F]))))}return L(t,Do);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(_u,si,f(JA,Z,r))}return L(ci,Do)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(tB,re,t.tradeCaches);if("Nothing"===ae.$)return f(oB,pa(f(ll,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Do));var ie=ae.a,x=f(iT,ne,ie);return L(D(t,{tradeCaches:l(aB,re,x.tradeCache,t.tradeCaches)}),f(il,lT(re),x.cmd));case"NoOp":return L(t,Do);default:var N=e.a;f(cl,"test",N);return L(t,Do)}}),cB=r(function(e,t){return f(iB,t,my(e))}),fB=Ge("txIn",Sm),lB=je("txOut",Ua),dB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},hB=function(e){return{$:"EventSentryMsg",a:e}},pB=function(e){var t=f(cm,hB,Xh(e)),r=t.a,n=t.b;return x({dataFetchState:l(QS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Zd,"tradeCache init","processing",dB(e),0)]))},gB=function(e){return{$:"InitialNumTradesFetched",a:e}},vB=function(e){return f(LS,e.factory,gB)},yB=function(e){var t=pB(e),r=t.a,n=t.b,a=t.c;return x(r,Po(M([n,vB(r)])),a)},mB=function(e){return{$:"TxSentryMsg",a:e}},bB={align:ul,label:"noWeb3Provider",mainParagraphs:M([M([fl("No web3 provider detected. Is "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(" or some other web3 provider installed and unlocked?")])]),noticeType:xg},CB={$:"TopLeft"},EB={align:CB,label:"screenToSmall",mainParagraphs:M([M([fl("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:xg},SB={align:ul,label:"wrongWeb3Network",mainParagraphs:M([M([fl("Make sure your wallet is set to a compatible network.")]),M([fl(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:$g},TB={$:"NoneDetected"},wB=function(e){return{$:"OnlyNetwork",a:e}},IB=function(e){return f(Bo,Xh,Mg(e))},AB={$:"ETCMain"},BB={$:"ETCTest"},kB={$:"Expanse"},NB={$:"Kovan"},RB={$:"Mainnet"},$B=function(e){return{$:"Private",a:e}},_B={$:"Rinkeby"},LB={$:"Ropsten"},xB={$:"RskMain"},PB={$:"RskTest"},DB=function(e){switch(e){case 1:return RB;case 2:return kB;case 3:return LB;case 4:return _B;case 30:return xB;case 31:return PB;case 42:return NB;case 41:return AB;case 62:return BB;default:return $B(e)}},UB=n(function(e,t,r){var n=e.a,a=e.b;return Tl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:cp})}),OB=n(function(e,t,n){var a=e.networkId?wB(DB(e.networkId)):TB,i=f(Bo,function(e){return l(UB,L(lB,fB),mB,e)},IB(a)),o=e.width<1024?si(EB):ci,u=f(xa,yB,ro),s=function(){return R(a,TB)?si(bB):"Nothing"===Mg(a).$?si(SB):ci}(),c=mE(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ay(f(Bi,r(function(e,t){return f(Qi,lT(e),t)}),g)),y=Po(f(Bi,r(function(e,t){return f(il,lT(e),t)}),p)),m=f(uB,v,f(cB,t,{key:n,screenWidth:e.width,submodel:sT,time:Vl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),Po(M([y,C])))}),MB=Oe,FB=MB(yr),VB=function(e){return FB},KB=function(e){return{$:"Refresh",a:e}},HB=r(function(e,t){return{$:"Every",a:e,b:t}}),jB=r(function(e,t){return{processes:t,taggers:e}}),qB=xp(f(jB,cp,cp)),GB=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(SS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),zB=Ne,YB=r(function(e,t){var r=e.a,n=e.b,a=f(fp,r,t);if("Nothing"===a.$)return l(xl,r,M([n]),t);var i=a.a;return l(xl,r,f(ka,n,i),t)}),WB=Be,JB=r(function(e,t){return{$:"Zone",a:e,b:t}}),QB=ca,XB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=WB(f(QB,n,f(Sp,e,n)));return f(Kp,function(t){return l(XB,e,a,l(xl,n,t,r))},i)}return xp(r)}),ZB=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 x(n,a,f(Kp,function(e){return i},zB(t)))}),u=l(Ra,YB,cp,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(xl,e,r,i),o)}),d=p(GB,s,c,o,u,i,x(yr,cp,xp(gr))),h=d.a,g=d.b,v=d.c;return f(Kp,function(e){return xp(f(jB,u,e))},f(Kp,function(t){return l(XB,e,h,g)},v))}),ek=function(e){return we(function(t){t(Se(e(Date.now())))})}(Vl),tk=n(function(e,t,r){var n=f(fp,t,r.taggers);if("Nothing"===n.$)return xp(r);var a=n.a,i=function(t){return Gp(f(xa,function(r){return f(Ep,e,r(t))},a))};return f(Kp,function(e){return xp(r)},f(Kp,i,ek))}),rk=r(function(e,t){var r=t.a,n=t.b;return f(HB,r,f(Da,e,n))});pn.Time=Pe(qB,ZB,tk,0,rk);var nk=Ue("Time"),ak=r(function(e,t){return nk(f(HB,e,t))}),ik=function(e){return f(ak,2e3,KB)},ok=function(e){return FB},uk=function(e){return{$:"DecryptionFinished",a:e}},sk=Ge("decryptionFinished",Sm),ck=Ge("encryptionFinished",Sm),fk=function(e){return{$:"EncryptionFinished",a:e}},lk=function(e){return{$:"Refresh",a:e}},dk=function(e){return MB(M([f(ak,3e3,lk),ck(fk),sk(function(e){return jE(uk(e))})]))},hk=yn,pk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return FB;case"CreateModel":t.a;return f(hk,Uy,ik());case"TradeModel":t.a;return f(hk,Fy,dk());case"MarketplaceModel":t.a;return f(hk,fT,ok());default:t.a;return f(hk,oT,VB())}},gk=Ge("userPubkeyResult",Sm),vk=Ge("walletSentryPort",Sm),yk={$:"CheckForNewTrades"},mk={$:"UpdateTradePhases"},bk=function(e){return MB(M([f(ak,5e3,function(e){return yk}),f(ak,3e3,function(e){return mk})]))},Ck=function(e){return{$:"Tick",a:e}},Ek=function(e){return{$:"UserPubkeySet",a:e}},Sk=function(e){return{$:"WalletStatus",a:e}},Tk=function(e){return f(ll,"Error decoding JS walletSentry: "+e,ci)},wk=function(e){return{$:"ErrorDecoding",a:e}},Ik=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Ak=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Oh,"ref",CE),f(Oh,"txHash",AA(Dm))),Bk=function(e){var t=f(Gh,Ak,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Ik,r.ref,li(a))}return f(Ik,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return wk("Error decoding tx data")},kk=function(e){var t=e.a;return f(hk,t.tagger,t.inPort(Bk))},Nk=f(Oi,DB,CE),Rk=gu(f(zo,rd,f(zo,$d("Failure decoding stringy int"),au(DB)))),$k=Em(M([Rk,Nk])),_k=r(function(e,t){return{account:e,networkId:t}}),Lk=l(Mi,_k,f(Oh,"account",AA(Am)),f(Oh,"networkId",$k)),xk=n(function(e,t,r){var n=f(Gh,Lk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),Pk=function(e){var t=f(zo,Tk,f(zo,pa,uT));return MB(U(M([f(ak,1e3,Ck),vk(f(xk,t,Sk)),f(xc,FB,f(Bo,kk,e.txSentry)),gk(Ek),MB(f(Bi,r(function(e,t){return f(hk,lT(e),t)}),f(xa,bk,e.tradeCaches)))]),M([pk(e)])))},Dk=function(e){return{$:"LinkClicked",a:e}},Uk=function(e){return{$:"UrlChanged",a:e}},Ok=n(function(e,t,r){return d(hA,e/255,t/255,r/255,1)}),Mk=l(Ok,10,33,108),Fk={$:"Generic"},Vk=Fk,Kk=r(function(e,t){return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),e)),wT(M([t])))}),Hk=function(e){return{$:"Fill",a:e}},jk=Hk(1),qk=Hi,Gk=function(e){return{$:"Px",a:e}},zk=Gk,Yk=ZT(8),Wk=function(e){return f(yA,Yk,l(vA,"bg-"+mA(e),"background-color",e))},Jk=f(Kk,M([ET(jk),yT(zk(150)),Wk(Mk)]),qk),Qk=function(e){return{$:"GotoRoute",a:e}},Xk={$:"Active"},Zk={$:"Important"},eN={$:"Normal"},tN=l(pA,1,1,1),rN=ZT(2),nN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),aN=r(function(e,t){return R(e,t)?f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e)):f(yA,rN,h(nN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),iN=ZT(21),oN=r(function(e,t){return{$:"Class",a:e,b:t}}),uN=f(oN,iN,RT.cursorPointer),sN=ZT(17),cN=function(e){return f(yA,sN,l(jI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},fN=function(e){return{$:"Normal",a:e}},lN=An,dN=r(function(e,t){return f(lN,e,fN(t))}),hN=function(e){return f(dN,"click",Fi(e))},pN=f(Da,ST,hN),gN=ZT(13),vN=f(oN,gN,RT.textSemiBold),yN=ZT(4),mN=function(e){return{$:"FontSize",a:e}},bN=function(e){return f(yA,yN,mN(e))},CN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([cN(4),Wk(l(pA,0,0,1))]);default:return M([cN(4),Wk(l(pA,.9,0,0))])}}();return f(Kk,U(M([f(aN,23,12),bN(22),vN,bA(tN),uN,pN(t)]),n),fl(e))}),EN=l(Ok,244,0,103),SN=function(e){return{$:"AlignX",a:e}},TN={$:"CenterX"},wN=SN(TN),IN=ZT(3),AN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),BN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),kN=function(e){return f(yA,IN,l(AN,f(BN,e,e),e,e))},NN=function(e){return{$:"Describe",a:e}},RN={$:"Paragraph"},$N=r(function(e,t){return d(fA,HT,Vk,f(ka,NN(RN),f(ka,ET(jk),f(ka,kN(5),e))),wT(t))}),_N=f(oN,gN,RT.bold),LN=f(Kk,M([bN(29),bA(tN),_N,wN,uN,pN(Qk(Gv))]),f($N,yr,M([fl("DAI"),f(Kk,M([bA(EN)]),fl("Hard"))]))),xN={$:"Right"},PN=SN(xN),DN={$:"AsColumn"},UN=DN,ON=r(function(e,t){return d(fA,UN,Vk,f(ka,lA(RT.contentTop+" "+RT.contentLeft),f(ka,yT(bT),f(ka,ET(bT),e))),wT(t))}),MN={$:"AsRow"},FN=MN,VN=r(function(e,t){return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY),f(ka,ET(bT),f(ka,yT(bT),e))),wT(t))}),KN=function(e){return f(VN,M([ET(jk),kN(30),f(aN,30,17)]),M([l(CN,"Browse Offers",Qk(zv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Xk}return eN}()),l(CN,"Create a New Offer",Qk(qv),function(){return"CreateModel"===e.submodel.$?Xk:eN}()),function(){var t=Gd(e.wallet);if("Just"===t.$){var r=t.a;return l(CN,"My Trades",Qk(jv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Xk:eN}return eN}())}return l(CN,"Connect to Wallet",cT,Zk)}(),f(ON,M([PN,kN(0),f(aN,8,0)]),M([LN]))]))},HN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},jN=function(e){return ml(e)},qN=r(function(e,t){return f(ml,dv(e),t)}),GN=function(e){return f(ml,function(e){return Kb(e.parameters)},OS(e))},zN={$:"BurnWindow"},YN={$:"FiatPrice"},WN={$:"Margin"},JN={$:"Offer"},QN={$:"PaymentWindow"},XN=function(e){return{$:"AlignY",a:e}},ZN={$:"CenterY"},eR=XN(ZN),tR=ZT(20),rR=f(oN,tR,RT.clip),nR=Hk,aR=function(e){return f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e))},iR=r(function(e,t){return f(Kk,M([ET(nR(e)),yT(zk(60)),rR,Wk(tN)]),f(Kk,M([aR(12),eR,ET(jk)]),t))}),oR=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},uR=function(e){return{$:"JustImage",a:e}},sR=uR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),cR=dT("alt"),fR=function(e){return f(dT,"src",rt(e))},lR=r(function(e,t){var r=t.src,n=t.description,a=f(ml,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(fA,AT,Vk,f(ka,lA(RT.imageContainer),e),wT(M([d(fA,AT,TT("img"),U(M([ST(fR(r)),ST(cR(n))]),a),wT(yr))])))}),dR=r(function(e,t){if("None"===t.$)return qk;var r=t.a;return f(lR,e,r)}),hR=uR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),pR=function(e){return{$:"ChangeSort",a:e}},gR=f(oN,gN,RT.textMedium),vR=function(e){return f(Kk,M([gR,bN(17)]),fl(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},yR=r(function(e,t){return f(VN,M([kN(5),uN,pN(pR(e))]),M([vR(e),function(){if("Just"===t.$){var e=t.a;return f(Kk,M([eR]),f(dR,M([ET(zk(8))]),function(){return"Ascending"===e.$?sR:hR}()))}return qk}()]))}),mR=r(function(e,t){return f(iR,oR(t),f(yR,t,e))}),bR=r(function(e,t){return f(VN,M([ET(jk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(mR,r,t)},t))}),CR=l(Ok,150,150,150),ER=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},SR=r(function(e,t){return f(ts,e.amount,t.amount)}),TR=n(function(e,t,r){return f(e,r,t)}),wR=function(e){var t=e.a;return(R(e.b,Lo)?Ua:TR)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(wR,L(Av,Zf),e,t):f(Ku,ER(e.state.phase),ER(t.state.phase))});case"Expires":return r(function(e,t){return f(hv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Sv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(SR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(xc,ma,l(zd,r(function(e,t){return f(Ku,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(hv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(hv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},IR=l(Ok,233,237,242),AR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),BR=function(e){return f(Kk,M([ET(jk),yT(jk),rR]),f($N,M([bN(12)]),M([fl(e.info)])))},kR=function(e){return f(xc,qk,f(Bo,BR,Ql(e)))},NR=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"}},RR=function(e){return{$:"TimeLeft",a:e}},$R=function(e){return{$:"TimeUp",a:e}},_R=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 Vl(0)}}),LR=r(function(e,t){return Vl(jd(e)-jd(t))}),xR=r(function(e,t){var r=f(_R,t.state.phase,t),n=f(LR,e,t.state.phaseStartTime),a=f(LR,r,n);return jd(a)>0?RR(L(a,r)):$R(r)}),PR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},DR=l(pA,0,0,0),UR=l(Ok,51,183,2),OR=function(e){var t=ju(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Qo(n));return n+(function(){if(a){return f(ru,a+1,f(Zo,1,mw(r)))}return""}()+"%")},MR=r(function(e,t){return uR({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"}()})}),FR=n(function(e,t,r){return f(dR,f(ka,yT(zk(34)),e),f(MR,t,r))}),VR=r(function(e,t){var r=OR(t);if("0%"===r)return f(Kk,M([bN(16)]),fl("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?UR:EN;return f(VN,M([kN(4)]),M([l(FR,yr,a,si(i)),f(Kk,M([bA(o),bN(16)]),fl(n))]))}),KR=uR,HR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(xl,r,n,t)}),cp,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,KR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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(xc,"",f(Bo,Qa,f(fp,e,HR)))},qR=function(e){return Qo(e)<=3?e:qR(f(Td,3,e))+","+f(ou,3,e)},GR=function(e){return qR(Sd(e))},zR=function(e){return U(jR(e.fiatType),GR(e.amount))},YR=hA,WR=function(e){var t=function(){var t=f(fp,e.fiatType,HR);if("Nothing"===t.$)return qk;var r=t.a,n=(r.a,r.b);return f(dR,M([yT(zk(26))]),n)}();return f(VN,M([kN(4)]),M([t,f(Kk,M([bA(d(YR,0,0,0,.5)),gR,ET(zk(50))]),fl(e.fiatType)),fl(zR(e))]))},JR=function(e){return jd(e)<0},QR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),XR=function(e){var t=vg(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(QR,$C(t),$C(r),$C(n),$C(a))}(f(xc,L(qu(0),qu(0)),f(Ts,n,qu(60))))}(f(xc,L(qu(0),qu(0)),f(Ts,r,qu(3600))))}(f(xc,L(qu(0),qu(0)),f(Ts,t,qu(86400))))},ZR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!JR(a)){var u=r(function(e,t){return U(l(Rs,2,P("0"),Ni(e)),t)}),s=jd(a)>0?i:o,c=XR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(VN,U(M([kN(5)]),e),M([f(Kk,U(M([bA(h)]),t),fl(f(u,c.days,"d"))),f(Kk,U(M([bA(d)]),t),fl(f(u,c.hours,"h"))),f(Kk,U(M([bA(s)]),t),fl(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Vl(0);e=p,t=g,n=v,a=y}}),e$={$:"Behind"},t$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),r$=function(e){return f(t$,e$,e)},n$=r(function(e,t){var r=sv(200*e),n=200-r,a=f(Kk,M([ET(nR(n))]),qk),i=M([yT(zk(3)),cN(20)]),o=f(Kk,U(i,M([ET(nR(r)),Wk(t)])),qk),u=f(Kk,U(i,M([ET(jk),Wk(IR)])),qk);return f(VN,M([ET(jk),r$(u)]),M([o,a]))}),a$=l(pA,1,1,0),i$=r(function(e,t){return jd(e)/jd(t)}),o$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(i$,o,u),c=(f(Kk,M([wN]),d(ZR,yr,yr,L(a,i),o)),s<.1?EN:s<.2?a$:UR);return f(ON,U(M([kN(5)]),e),M([d(ZR,M([wN]),t,L(a,i),o),f(n$,1-s,c)]))}),u$=function(e){var t=wd(jl(e)),r=f(Xl,".",t);if(!r.b)return t;if(r.b.b){cl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(ru,3,t);case 1:return f(ru,4,f(xc,t,f(Bo,mw,f(Bo,function(e){return e/100},f(Bo,Ka,f(Bo,sv,f(Bo,ti(100),Bd(t))))))));default:var n=r.a;return f(xc,f(ru,n,t),f(Bo,Ni,f(Bo,sv,Bd(t))))}},s$=n(function(e,t,r){return f(iR,oR(t),function(){switch(t.$){case"Phase":var n=PR(r.state.phase),a=L(f(xR,e,r),r.state.phase);e:for(;;){if("TimeLeft"===a.a.$){if("Closed"===a.b.$)break e;var i=a.a.a,o=f(i$,i.a,i.b)<.05?EN:DR;return f(ON,M([kN(3)]),M([fl(n),d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)]))}if("Closed"===a.b.$)break e;var u=a.a.a;return f(VN,M([kN(6),bA(CR)]),M([fl(n),f(Kk,M([bN(16)]),fl("(stale)"))]))}a.b;return fl(n);case"Expires":if("Open"===r.state.phase.$){var s=f(xR,e,r);if("TimeLeft"===s.$){var i=s.a,o=f(i$,i.a,i.b)<.05?EN:DR;return d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)}var u=s.a;return d(o$,M([ET(jk)]),M([bN(16)]),L(EN,IR),L(Vl(0),u))}return qk;case"Offer":return f(VN,M([kN(5)]),M([fl(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(u$(r.parameters.tradeAmount)+" ")+NR(r.factory))]));case"FiatPrice":return WR(r.terms.price);case"Margin":var c=R(r.parameters.initiatorRole,fo);return f(xc,qk,f(Bo,VR(c),r.derived.margin));case"PaymentWindow":var l=function(){return"Seller"===r.parameters.initiatorRole.$?EN:UR}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoabortInterval);default:var l=function(){return"Seller"===r.parameters.initiatorRole.$?UR:EN}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoreleaseInterval)}}())}),c$=n(function(e,t,r){return f(ON,M([ET(jk),kN(1),Wk(IR),uN,pN(f(AR,r.factory,r.id))]),M([f(VN,M([ET(jk),kN(1)]),f(xa,function(t){return l(s$,e,t,r)},t)),f(iR,1,kR(r.terms.paymentMethods))]))}),f$=Er,l$=ZT(28),d$=function(e){return f(yA,l$,l(vA,"bc-"+mA(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(yA,iA,h(h$,"b-"+Ni(e),e,e,e,e))},g$=a(function(e,t,r,n){return f(ON,M([ET(jk),p$(2),cN(8),d$(CR),kN(2),Wk(CR),rR]),f(xa,f(c$,e,r),f(f$,wR(t.orderBy),n)))}),v$=a(function(e,t,r,n){return f(ON,M([ET(jk),yT(jk),kN(5)]),M([f(bR,t.orderBy,r),d(g$,e,t,r,n)]))}),y$=n(function(e,t,r){var n=f(qN,r.filters,ay(f(xa,function(e){return f(jN,HN(r),GN(e))},t)));return R(n,yr)?qk:f(Yi,Ko,d(v$,e,r.tradeTable,M([xo,JN,YN,WN,QN,zN]),n))}),m$=r(function(e,t){return f(Kk,M([cN(4),Wk(d(YR,0,0,1,.1)),bA(l(Ok,16,7,234)),bN(e),vN,f(aN,15,13)]),fl(dl(t)))}),b$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),C$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(yA,rN,h(nN,"p-"+Ni(t),t,t,t,t)):f(yA,rN,h(nN,d(b$,t,r,n,a),t,r,n,a))},E$=function(e){return function(){var t=Gd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?qk:f(VN,M([kN(10),C$({bottom:20,left:20,right:20,top:10})]),M([f(Kk,M([bN(24),vN]),fl("Trade History for User")),f(m$,18,e.agentAddress)]))},S$=function(e){return{$:"FiltersMsg",a:e}},T$=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},w$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),I$=xI,A$={$:"Left"},B$=SN(A$),k$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(fA,UN,TT("label"),e,wT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(fA,AT,Vk,a,wT(M([i])));switch(n.$){case"Above":return d(fA,UN,TT("label"),e,wT(M([o,r])));case"Below":return d(fA,UN,TT("label"),e,wT(M([r,o])));case"OnRight":return d(fA,FN,TT("label"),e,wT(M([r,o])));default:return d(fA,FN,TT("label"),e,wT(M([o,r])))}}),N$=function(e){return{$:"Label",a:e}},R$={$:"NoAttribute"},$$=function(e){if("HiddenLabel"===e.$){var t=e.a;return NN(N$(t))}return R$},_$=function(e){return"HiddenLabel"===e.$},L$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return hu("No key matched");var n=r.a;return Fi(n)},r=f(du,t,f(Oh,"key",pu));return ST(f(dN,"keyup",r))},x$=function(e){return f(Nn,"tabIndex",Ni(e))},P$=f(Da,ST,x$),D$={$:"LivePolite"},U$=NN(D$),O$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([_$(r)?R$:kN(6),ST(hN(i(!a))),U$,L$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),P$(0),uN,B$,ET(jk)]),e);return l(k$,o,r,d(fA,AT,Vk,M([ST(f(I$,"role","checkbox")),ST(f(I$,"aria-checked",a?"true":"false")),$$(r),eR,yT(jk),ET(bT)]),wT(M([n(a)]))))}),M$=Br,F$=function(e){return e*M$/180},V$=ZT(26),K$=function(e){return{$:"MoveY",a:e}},H$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),j$=function(e){return f(H$,V$,K$(-e))},q$=ZT(24),G$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),z$=function(e){return f(H$,q$,f(G$,x(0,0,1),e))},Y$=ZT(19),W$=function(e){return Cd(M([e.inset?"box-inset":"box-",mw(e.offset.a)+"px",mw(e.offset.b)+"px",mw(e.blur)+"px",mw(e.size)+"px",mA(e.color)]))},J$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(yA,Y$,l(jI,W$(t),"box-shadow",Cw(t)))},Q$=r(function(e,t){return f(yA,iA,h(h$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),X$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?p$(r):f(Q$,n,r):f(yA,iA,h(h$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},Z$=ZT(12),e_=f(oN,Z$,RT.textCenter),t_=l(pA,1,1,1),r_=function(e){return f(Kk,M([lA("focusable"),ET(zk(14)),yT(zk(14)),bA(t_),eR,bN(9),e_,cN(3),d$(e?l(pA,59/255,.6,252/255):l(pA,211/255,211/255,211/255)),J$({blur:1,color:e?d(YR,238/255,238/255,238/255,0):l(pA,238/255,238/255,238/255),offset:L(0,0),size:1}),Wk(e?l(pA,59/255,.6,252/255):t_),p$(e?0:1)]),e?f(Kk,M([d$(t_),yT(zk(6)),ET(zk(9)),z$(F$(-45)),wN,eR,j$(1),X$({bottom:2,left:2,right:0,top:0})]),qk):qk)},n_=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),a_={$:"OnRight"},i_=n_(a_),o_=r(function(e,t){return f(O$,yr,{checked:t.checked,icon:r_,label:f(i_,yr,fl(t.label)),onChange:f(w$,e,t.label)})}),u_={$:"Top"},s_=XN(u_),c_=function(e){return f(ON,M([kN(15),s_]),M([f(Kk,M([bN(28),gR]),fl(T$(e.type_))),f(ON,M([kN(5)]),f(xa,o_(e.type_),e.options))]))},f_=function(e){return f(VN,M([kN(20)]),f(xa,c_,e))},l_={$:"NoneFound"},d_={$:"AllFetched"},h_={$:"FetchingTrades"},p_={$:"QueryingNumTrades"},g_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return p_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?h_:d_}return l_},v_={$:"InFront"},y_=function(e){return f(t$,v_,e)},m_=r(function(e,t){var r=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},n=f(Eh,Ja(l_),f(xa,g_,e))?M([r("No trades found.")]):f(xa,r,mE(f(xa,function(e){switch(g_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),y_(f(ON,M([kN(5),B$]),n))]),f(Kk,M([wN]),f(Yi,S$,f_(t.filters))))}),b_=n(function(e,t,r){return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),f(aN,30,20)]),M([E$(r),f(m_,t,r),l(y$,e,t,r)]))}),C_=function(e){return{$:"ShowCurrencyDropdown",a:e}},E_={$:"AbortCreate"},S_=function(e){return{$:"AppCmd",a:e}},T_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),w_=function(e){return f(xa,function(e){return M([f(Kk,M([bA(EN)]),fl("Caution! ")),fl(e)])},mE(M([R(f(hv,e.autoreleaseInterval,Vl(12e5)),ba)?si(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."}()):ci,R(f(hv,e.autoabortInterval,Vl(36e5)),ba)?si(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.'}()):ci])))},I_=l(pA,0,0,1),A_=function(e){return f(Kk,M([C$({bottom:5,left:5,right:5,top:0}),pN(e),cN(30),Wk(d(YR,1,1,1,.4)),p$(1),d$(d(YR,0,0,0,.3)),uN,bN(14)]),f(Kk,M([bA(d(YR,0,0,0,.7))]),fl("x")))},B_=Bn,k_=B_,N_=ST,R_=r(function(e,t){return f(Kk,M([r$(f(Kk,M([Wk(e),N_(f(k_,"position","fixed")),N_(f(k_,"z-index","1000")),N_(f(k_,"top","0")),N_(f(k_,"left","0")),N_(f(k_,"width","100%")),N_(f(k_,"height","100%"))]),qk)),ET(jk),yT(jk)]),t)}),$_=r(function(e,t){return{$:"Max",a:e,b:t}}),__=r(function(e,t){return f($_,e,t)}),L_=n(function(e,t,r){return l(Pa,R_,d(YR,0,0,.3,.6),f(Kk,U(M([wN,eR,ET(f(__,500,bT)),Wk(tN),cN(8),y_(f(Kk,M([PN,s_]),A_(r)))]),e),t))}),x_=r(function(e,t){if("Nothing"===t.$)return qk;var r=t.a;return f(Kk,U(M([cN(5),d$(l(pA,.9,0,0)),p$(1),Wk(l(pA,1,.4,.4)),aR(5),wN,eR,ET(f(__,200,bT)),bN(14)]),e),f($N,yr,M([fl(r)])))}),P_={$:"Above"},D_=function(e){return f(t$,P_,e)},U_=r(function(e,t){return f(Kk,M([cN(4),f(aN,25,17),bN(18),vN,Wk(IR),D_(f(x_,M([j$(5)]),t))]),fl(e))}),O_=a(function(e,t,r,n){return d(hA,e/255,t/255,r/255,n)}),M_=d(O_,1,31,52,.64),F_=ZT(32),V_={$:"Active"},K_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),H_=$n,j_=r(function(e,t){switch(t.$){case"NoAttribute":return R$;case"Describe":var r=t.a;return NN(r);case"AlignX":var n=t.a;return SN(n);case"AlignY":var a=t.a;return XN(a);case"Width":var n=t.a;return CT(n);case"Height":var n=t.a;return vT(n);case"Class":var n=t.a,a=t.b;return f(oN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(yA,i,o);case"Nearby":var u=t.a,s=t.b;return f(t$,u,f(zi,e,s));case"Attr":var c=t.a;return ST(f(H_,e,c));default:var l=t.a,d=t.b;return f(H$,l,d)}}),q_=function(e){return f(j_,zg,e)},G_=r(function(e,t){var r=t.a,n=t.b,a=q_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(rA,n,o));default:return L(r,n)}}),z_=function(e){var t=l(Ra,G_,L(yr,sA),e),r=t.a,n=t.b;return f(ka,qI(n),r)},Y_=function(e){return f(yA,F_,f(K_,V_,z_(e)))},W_=ZT(33),J_={$:"Hover"},Q_=function(e){return f(yA,W_,f(K_,J_,z_(e)))},X_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Kk,M([cN(4),uN,pN(n),f(aN,25,17),bA(t),bN(18),vN,Wk(a),Y_(M([Wk(o)])),Q_(M([Wk(i)]))]),fl(r))}),Z_=r(function(e,t){return d(X_,x(d(YR,1,0,0,1),d(YR,1,0,0,.8),d(YR,1,0,0,.6)),tN,e,t)}),eL=function(e){return R_(d(YR,0,0,.3,.6))(f(ON,M([kN(10),wN,eR,Wk(d(YR,0,0,0,.5)),cN(8),aR(20)]),f(xa,function(e){return f($N,M([wN,eR,bN(20),vN,bA(tN),e_]),M([e]))},e)))},tL=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+kA(t)}e.a;return"https://kovan.etherscan.io/tx/"+kA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+kA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+kA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+kA(t)}}),rL={$:"Bottom"},nL=XN(rL),aL=lA(RT.underline),iL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(fl(u$(oC(a))),f(Z_,"Yes, I definitely want to open this trade.",l(T_,r,n,a)))}return L(fl("??"),f(U_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(L_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),e_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(M_)])),U(w_(n),U(M([M([fl("You will deposit "),i,fl(" "+NR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([fl("This ususally requires two Metamask signatures. Your "+NR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Kk,M([nL,wN]),o)])),E_);case"ApproveNeedsSig":var u=e.a;return f(Kk,M([pN(S_(d(Zd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),eL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Kk,M([pN(S_(d(Zd,"txChainModal clicked","misclick","ApproveMining",0)))]),eL(M([fl("Mining the initial approve transaction..."),f(dA,M([aL,bA(I_)]),{label:fl("See the transaction on Etherscan"),url:f(tL,eo(u),s)}),fl("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Kk,M([pN(S_(d(Zd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),eL(M([fl("Waiting for user signature for the create call."),fl("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Kk,M([pN(S_(d(Zd,"txChainModal clicked","misclick","CreateMining",0)))]),eL(M([fl("Mining the final create call..."),f(dA,M([aL,bA(I_)]),{label:fl("See the transaction on Etherscan"),url:f(tL,r,s)}),fl("You will be redirected when it's mined.")])))}}),oL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return qk;var r=t.a;return f(iL,r,e)},uL=function(e){return{$:"TradeAmountChanged",a:e}},sL=dT("id"),cL=N_(sL("inputError")),fL=l(Ok,109,127,138),lL=uR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),dL=function(e){return f(dR,f(ka,yT(zk(26)),e),lL)},hL=function(e){return f(VN,M([kN(4)]),M([dL(yr),f(Kk,M([bN(24),gR,bA(fL)]),fl(NR(e)))]))},pL=function(e){return{$:"HiddenLabel",a:e}},gL=pL,vL=dT("type"),yL=function(e){return L(e,!0)},mL=function(e){return{$:"MayStopPropagation",a:e}},bL=r(function(e,t){return f(lN,e,mL(t))}),CL=r(function(e,t){return l(La,Oh,t,e)}),EL=f(CL,M(["target","value"]),pu),SL=function(e){return f(bL,"input",f(Oi,yL,f(Oi,e,EL)))},TL=ZT(0),wL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),IL=function(e){var t=function(e){return 1-e}(f(Tc,1,f(ei,0,e)));return f(yA,TL,f(wL,"transparency-"+dw(t),t))},AL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),BL=f(Da,ST,I$("autocomplete")),kL=l(pA,136/255,138/255,133/255),NL=l(pA,186/255,189/255,182/255),RL=f(aN,12,12),$L=M([RL,cN(3),d$(NL),Wk(t_),p$(1),kN(3),ET(jk)]),_L=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},LL=function(e){return f(Ch,_L,e)?R$:lA("focusable")},xL=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},PL=ye,DL=r(function(e,t){return f(kn,e,PL(t))}),UL=DL("spellcheck"),OL=f(Da,ST,UL),ML=W,FL=ZT(47),VL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(ML(e))),o=(i-1)*t+f(xc,0,f(Bo,a,r))+f(xc,0,f(Bo,a,n));return f(yA,FL,l(jI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),KL=dT("value"),HL=f(Da,ST,KL),jL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(fw,"width",n)?L(r,n):L(f(ka,e,r),f(Gm,"width",n));case"Height":e.a;return f(fw,"height",n)?L(r,n):L(f(ka,e,r),f(Gm,"height",n));case"Describe":e.a;return f(fw,"described",n)?L(r,n):L(f(ka,e,r),f(Gm,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(fw,"align-x",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-x",n));case"AlignY":return f(fw,"align-y",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-y",n));default:return f(fw,"transform",n)?L(r,n):L(f(ka,e,r),f(Gm,"transform",n))}}),L(yr,sm),e).a},qL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,jL(e))}),GL=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}},zL=f(Da,Gi,ms),YL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([ST(SL(n.onChange))]),o=U($L,t),u=f(qL,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(ml,xL,o),c=f(qL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(qL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(qL,o,function(e){return"Nearby"===e.$})),p=f(ml,f(Da,ns,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([HL(n.text),ST(vL(a)),OL(e.spellchecked),lA(RT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return R$;var r=t.a;return BL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(GL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(AL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(AL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(xc,5,c);return x("textarea",U(M([OL(e.spellchecked),lA(RT.inputMultiline),f(xc,R$,f(Bo,BL,e.autofill)),function(){if("Nothing"===u.$)return R$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return C$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?R$:s.a?d(VL,n.text,v,u,g):R$}()]),h),M([zL(RI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(fA,AT,Vk,f(ka,ET(jk),ay(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([y_(f(Kk,f(ka,RL,U(s,U(M([bA(kL),lA(RT.noTextSelection+" "+RT.passPointerEvents),d$(d(YR,0,0,0,0)),Wk(d(YR,0,0,0,0)),yT(jk),ET(jk),IL(""===n.text?1:0)]),r))),a))])}()]))),wT(M([d(fA,AT,TT(v),ay(M([M([LL(t),$$(n.label)]),y,i])),wT(m))])));return l(k$,f(ka,f(oN,iN,RT.cursorText),f(ka,_$(n.label)?R$:kN(5),f(ka,U$,u))),n.label,b)}),WL=YL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),JL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(WL,M([ET(jk),yT(zk(40)),p$(0)]),{label:gL(r),onChange:i,placeholder:n,text:a});return f(VN,U(M([kN(5)]),e),mE(M([f(Bo,Kk(M([B$])),o),si(s),f(Bo,Kk(M([PN])),u)])))}),QL={$:"Below"},XL=function(e){return f(t$,QL,e)},ZL=function(e){return f(H$,V$,K$(e))},ex=n(function(e,t,r){return p(JL,M([ET(zk(150)),gR,bN(24),XL(f(x_,M([cL,ZL(5)]),r))]),L(ci,si(f(Kk,M([pN(S_(d(Zd,"click","misclick","dai symbol in dai input",0)))]),hL(e)))),"dai input",ci,t,uL)}),tx=Kk(M([d$(IR),X$({bottom:2,left:0,right:0,top:0})])),rx=r(function(e,t){return f(ON,M([kN(10)]),M([f(Kk,M([bN(17),vN]),fl(e)),t]))}),nx=r(function(e,t){return tx(f(rx,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(ex,e,t.inputs.daiAmount,t.errors.daiAmount)))}),ax=function(e){return f(xc,gS,Mg(e))},ix=function(e){var t=function(){var t=vd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+u$(f(Gl,r,100))+" "+NR(ax(e.wallet))+"."}return"There is a 1% fee."}();return f(VN,M([wN,f(aN,20,10),Wk(l(Ok,10,33,108)),cN(8),kN(5),pN(S_(d(Zd,"click","misclick","fee notify element",0)))]),M([f(Kk,M([bN(18),bA(l(Ok,0,226,255)),vN]),fl(t)),f(Kk,M([bN(17),bA(tN),gR]),fl("We only collect this fee when trades resolve successfully."))]))},ox=function(e){return{$:"FiatAmountChanged",a:e}},ux=function(e){return{$:"FiatTypeChanged",a:e}},sx=r(function(e,t){return l(SS,n(function(t,r,n){return f(e,t,r)?l(xl,t,r,n):n}),cp,t)}),cx=function(e){return f(sx,r(function(t,r){return f(Qg,e,t)}),HR)},fx=uR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),lx=function(e){return f(dR,M([yT(zk(26))]),f(xc,fx,f(Bo,fu,f(fp,e,HR))))},dx=function(e){return N_(f(bL,"click",Fi(L(e,!0))))},hx=zL,px=function(e){return{$:"AppendProperty",a:e}},gx=r(function(e,t){return px(e+":"+t)}),vx=r(function(e,t){return f(gx,e,t.value)}),yx=vx("cursor"),mx={$:"Compatible"},bx={cursor:mx,value:"default"},Cx=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Ex=function(e){return{$:"PseudoClassSelector",a:e}},Sx=function(e){return Cx(Ex(e))}("hover"),Tx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),wx=Tx,Ix=wx,Ax=Ix("span"),Bx=r(function(e,t){return f(kn,et(e),rt(t))}),kx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),Nx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),Rx=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),$x=r(function(e,t){return t<>>32-e}),_x=function(e){var t=e.hash?e.seed^f(Rx,461845907,f($x,15,f(Rx,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f(Rx,2246822507,r^r>>>16),a=f(Rx,3266489909,n^n>>>13);return(a^a>>>16)>>>0},Lx=r(function(e,t){return f(Rx,5,f($x,13,e^f(Rx,461845907,f($x,15,f(Rx,3432918353,t)))))+3864292196}),xx=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},KP=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+"]"}},HP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,KP,r)));case"UniversalSelectorSequence":var r=e.a;return Iu(r)?"*":f(Ri,"",f(xa,KP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,KP,r)))}},jP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([VP(t),HP(r)]))},qP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,HP(t),f(xa,jP,r)),i=f(Ri,"",M([f(xc,"",f(Bo,FP,n))]));return f(oc,f(Ri," ",f(ml,f(Da,ns,_d),a)),i)},GP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,qP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,MP(a),"\n",e,"}"]))}),zP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(GP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,LP,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,UP,GP(" ")),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"}},YP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(ml,f(Da,ns,_d),M([RP(t),f(Ri,"\n",f(xa,PP,r)),f(Ri,"\n",f(xa,DP,n)),f(Ri,"\n\n",f(xa,zP,a))])))},WP=function(e){return YP(NP(AP(e)))},JP=function(e){return f(Ri,"\n\n",f(xa,WP,e))},QP=function(e){return{$:"Snippet",a:e}},XP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),ZP=function(e){return{$:"StyleBlockDeclaration",a:e}},eD=r(function(e,t){var r=l(Zx,t,yr,ci);return QP(M([ZP(l(XP,r,yr,e))]))}),tD=function(e){return Iu(e)?"unstyled":f(Is,P("_"),Ps(f(Px,15739,JP(AS(Dx(AS(f(eD,e,lP(yr)))))))))},rD=function(e){var t=tD(e),r=f(Bx,"className",hl(t));return l(kx,r,e,t)},nD=a(function(e,t,r,n){return f(e,f(ka,rD(t),r),n)}),aD=function(e){return{$:"Unstyled",a:e}},iD=function(e){return aD(Tw(e))},oD=iD,uD=r(function(e,t){return f(Tn,e,Xe(t))}),sD=function(e){return En(Xe(e))},cD=r(function(e,t){var r=e.b,n=e.c;return Iu(r)?t:l(xl,n,r,t)}),fD=function(e){return e.a},lD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,cD,i,s),p=l(Ra,dD,L(yr,h),c),g=p.a,v=p.b,o=l(JT,u,f(xa,fD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,cD,i,s),m=l(Ra,dD,L(yr,h),c),g=m.a,v=m.b,o=d(sD,y,u,f(xa,fD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,cD,i,s),b=l(Ra,lD,L(yr,h),c),g=b.a,v=b.b,o=l(WT,u,f(xa,fD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,cD,i,s),C=l(Ra,lD,L(yr,h),c),g=C.a,v=C.b,o=d(uD,y,u,f(xa,fD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),dD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,cD,n,o),c=l(Ra,dD,L(yr,s),u),h=c.a,p=c.b,a=l(JT,i,f(xa,fD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,cD,n,o),v=l(Ra,dD,L(yr,s),u),h=v.a,p=v.b,a=d(sD,g,i,f(xa,fD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,cD,n,o),y=l(Ra,lD,L(yr,s),u),h=y.a,p=y.b,a=l(WT,i,f(xa,fD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,cD,n,o),m=l(Ra,lD,L(yr,s),u),h=m.a,p=m.b,a=d(uD,g,i,f(xa,fD,o),$a(h));return L(f(ka,a,r),p)}}),hD=r(function(e,t){return h(Nl,kl,e,t,Rl,Rl)}),pD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(_d(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),gD=function(e){var t=f(pD,ci,e);if("Nothing"===t.$)return cp;var r=t.a,n=r.a,a=r.b;return f(hD,n,a)},vD=function(e){return{$:"ClassSelector",a:e}},yD=function(e){var t=e.a,r=e.b;return f(eD,r,lP(M([vD(t)])))},mD=function(e){return JP(AS(Dx(f(xa,yD,Ia(e)))))},bD=function(e){return l(JT,"style",yr,AS(Tw(mD(e))))},CD=n(function(e,t,r){var n=f(xa,fD,t),a=gD(t),i=l(Ra,dD,L(yr,a),r),o=i.a,u=i.b,s=bD(u);return l(JT,e,n,f(ka,s,$a(o)))}),ED=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),SD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(ED,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),TD=r(function(e,t){return L(f(SD,"_",t),bD(e))}),wD=n(function(e,t,r){var n=f(xa,fD,t),a=gD(t),i=l(Ra,lD,L(yr,a),r),o=i.a,u=i.b,s=f(TD,u,o);return l(WT,e,n,f(ka,s,$a(o)))}),ID=a(function(e,t,r,n){var a=f(xa,fD,r),i=gD(r),o=l(Ra,lD,L(yr,i),n),u=o.a,s=o.b,c=f(TD,s,u);return d(uD,e,t,a,f(ka,c,$a(u)))}),AD=a(function(e,t,r,n){var a=f(xa,fD,r),i=gD(r),o=l(Ra,dD,L(yr,i),n),u=o.a,s=o.b,c=bD(s);return d(sD,e,t,a,f(ka,c,$a(u)))}),BD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(CD,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(AD,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(wD,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(ID,a,t,r,n)}},kD=BD,ND=function(e){return hx(kD(d(nD,Ax,M([Sx(M([yx(bx)]))]),yr,M([oD(e)]))))},RD=J,$D=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),_D=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),LD=function(e){return l(La,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 si(h($D,n,a,i,o,u))}return ci}(),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 si(l(_D,a,t,i))}return ci}())}),L(ci,ci),e)},xD=r(function(e,t){var r=LD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),e))),wT(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?si(C$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),U(e,M([h]))))),wT(t))}var p=-s/2,g=-u/2;return d(fA,AT,Vk,e,wT(M([d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ST(f(k_,"margin",mw(p)+"px "+mw(g)+"px")),f(ka,ST(f(k_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,ST(f(k_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(yA,IN,l(AN,o,u,s)),yr))))),wT(t))])))}),PD=i(function(e,t,r,n,a){var i=f(WL,M([ET(zk(80)),yT(zk(40)),bN(24),gR,d$(IR),dx(r)]),{label:gL("currency type"),onChange:f(zo,RD,n),placeholder:ci,text:t}),o=f(fp,t,HR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return qk;r.b;return f(xD,M([ET(zk(350)),d$(DR),p$(1),Wk(tN),aR(10),wN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(VN,M([ET(zk(80)),kN(9),f(aN,0,5),dx(n(t)),Q_(M([Wk(l(pA,.8,.8,1))]))]),M([f(dR,M([yT(zk(26))]),a),f(Kk,M([bN(16),vN]),ND(t))]))},Ia(cx(t))))}return qk}();return f(VN,M([kN(4),XL(u)]),M([f(Kk,M([pN(a)]),lx(t)),i]))}),DD=i(function(e,t,r,n,a){var i=S_(d(Zd,"click","misclick","currency flag",0)),o=f(Kk,M([pN(S_(d(Zd,"click","misclick","currency symbol",0)))]),fl(jR(e))),u=f(Kk,M([XL(f(x_,M([cL,ZL(5)]),a))]),h(PD,r,e,C_(!0),ux,i));return p(JL,M([ET(zk(250)),gR,bN(24),XL(f(x_,M([cL,ZL(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,ox)}),UD=function(e){return tx(f(rx,"For fiat",h(DD,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},OD=function(e){return{$:"ChangeRole",a:e}},MD=d(O_,1,31,52,.13),FD=r(function(e,t){var r=M([bN(24),gR,uN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([bA(MD)]))):L(U(r,M([bA(MD)])),r)}(),a=n.a,i=n.b;return f(VN,M([kN(20)]),M([f(Kk,U(M([pN(OD(lo))]),i),fl("Sell "+e)),f(Kk,U(M([pN(OD(fo))]),a),fl("Buy "+e))]))}),VD=r(function(e,t){return f(rx,"Trade Type",f(FD,NR(e),t.inputs.userRole))}),KD=J$({blur:20,color:d(O_,0,0,0,.04),offset:L(0,3),size:0}),HD=f(oN,IN,RT.spaceEvenly),jD=function(e){var t=ax(e.wallet);return f(ON,M([ET(jk),kN(20),Wk(tN),cN(5),aR(20),KD]),M([f(VN,M([ET(jk),HD]),M([f(VD,t,e),f(nx,t,e),UD(e)])),ix(e)]))},qD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),GD={$:"Web3Connect"},zD=function(e){return f(Kk,M([wN]),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(Z_,"Open Trade",f(qD,n,r))}t.b;return f(U_,"Unsupported Network",ci)}t.a;return f(Z_,"Connect to Wallet",GD)}())},YD=function(e){return{$:"AutoabortIntervalChanged",a:e}},WD=function(e){return{$:"ChangePaymentMethodText",a:e}},JD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),QD=JD,XD=function(e){return f(QD,M([bA(d(YR,0,0,0,.2))]),function(){return fl("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")}())},ZD={$:"TextArea"},eU=r(function(e,t){return l(YL,{autofill:ci,spellchecked:t.spellcheck,type_:ZD},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),tU=n(function(e,t,r){var n=f(Kk,M([bN(22),vN]),fl("Payment Method")),a=f(eU,M([ET(jk),yT(zk(150)),Wk(d(O_,155,203,255,.2)),p$(0)]),{label:gL("payment method"),onChange:WD,placeholder:""===r?si(XD(t)):ci,spellcheck:!0,text:r});return f(ON,M([kN(20),C$({bottom:15,left:45,right:45,top:0}),ET(jk),D_(f(x_,M([cL,ZL(30),aR(10),bN(20),ET(zk(400))]),e))]),M([n,a]))}),rU=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."},nU=a(function(e,t,r,n){var a=l(Rs,e,P("0"),Ni(n));return f(Kk,M([bN(22),bA(t)]),fl(U(a,r)))}),aU=function(e){return jd(e)<0?Vl(0):e},iU=n(function(e,t,n){var a=r(function(e,r){return f(ON,M([kN(4)]),M([f(Kk,M([aR(4),uN,pN(n(f(qb,t,e)))]),f(dR,M([yT(zk(10))]),hR)),r,f(Kk,M([aR(4),uN,pN(n(function(e){return jd(e)?e:Vl(3e5)}(aU(f(LR,t,e)))))]),f(dR,M([yT(zk(10))]),sR))]))}),i=XR(t);return f(VN,M([HD,kN(10)]),M([f(a,Vl(864e5),d(nU,3,e," days",i.days)),f(a,Vl(36e5),d(nU,2,e," hours",i.hours)),f(a,Vl(3e5),d(nU,2,e," min",i.min))]))}),oU=o(function(e,t,r,n,a,i){var o=f(Kk,M([Wk(d(O_,155,203,255,.2)),cN(5),aR(15),D_(f(x_,M([cL]),a))]),l(iU,DR,n,i)),u=f(VN,M([kN(30)]),M([f(dR,M([yT(zk(40)),pN(S_(d(Zd,"click","misclick","symbol for "+t,0)))]),e),f(Kk,M([bN(22),vN]),fl(t))])),s=f($N,M([bN(17),gR,bA(M_)]),M([fl(r)]));return f(ON,M([ET(jk),cN(10),Wk(l(Ok,237,237,237)),kN(2)]),f(xa,Kk(M([Wk(tN),f(aN,45,18),ET(jk)])),M([u,f(VN,M([ET(jk),kN(25),Wk(tN)]),M([o,s]))])))}),uU=uR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),sU=f(oN,tR,RT.clipX),cU=f(oN,tR,RT.clipY),fU=i(function(e,t,r,n,a){return f(ON,M([kN(15),cN(8),sU,cU,Wk(tN)]),M([p(oU,uU,"Payment Window",rU(a),r,n,YD),l(tU,t,a,e)]))}),lU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},dU=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."},hU=uR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),pU=n(function(e,t,r){return f(Kk,M([cN(8),sU,cU,Wk(tN)]),p(oU,hU,"Burn/Release Window",dU(r),e,t,lU))}),gU=function(e){return{$:"AutorecallIntervalChanged",a:e}},vU=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."},yU=uR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),mU=n(function(e,t,r){return f(Kk,M([cN(8),Wk(tN),sU,cU]),p(oU,yU,"Open Window",vU(r),e,t,gU))}),bU=function(e){return f(ON,M([ET(jk),kN(20)]),M([l(mU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(fU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(pU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},CU=function(e){return f(ON,M([ET(f(__,1e3,jk)),wN,kN(20),C$({bottom:30,left:40,right:40,top:0}),pN(C_(!1)),y_(oL(e))]),M([jD(e),bU(e),zD(e.wallet)]))},EU=As(vb(8226)),SU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),TU=r(function(e,t){return l(Ra,ka,t,e)}),wU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(TU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),IU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(TU,f(lc,e%r,t),l(wU,yr,e/r|0,t))):f(lc,e,t)}),AU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(fw,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(Gm,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),BU=function(e){return d(AU,Ua,sm,e,yr)},kU=r(function(e,t){return f(Kk,M([ET(jk),y_(f(VN,M([kN(3),ET(nR(100)),ET(t),rR]),f(SU,f(Kk,M([bA(d(YR,0,0,0,.1)),bN(14)]),fl(EU)),f(xa,f(Da,Kk(M([bA(d(YR,0,0,0,.2))])),fl),f(IU,100,(e?$a:Ua)(BU(f(xa,f(zo,fu,Qa),Ia(HR)))))))))]),fl(" "))}),NU=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e))))),wT(M([n])))}),RU=lA(RT.italic),$U=function(){var e=f(Da,Kk(M([bA(l(pA,.8,.2,.2))])),fl),t=f(Da,Kk(M([_N])),fl);return f(ON,M([ET(jk),yT(jk),Wk(tN),cN(6),kN(50),J$({blur:20,color:d(O_,0,0,0,.1),offset:L(0,3),size:0}),cN(10),aR(20)]),M([f(kU,!1,jk),f(ON,M([wN,ET(f(__,700,jk)),kN(20)]),M([f($N,M([bN(70),_N,wN,e_]),M([fl("DAI"),e("Hard")])),f(VN,M([bN(30),vN,wN,e_,RU]),M([fl("The "),e("Global"),fl(", "),e("Unkillable"),fl(" Crypto Gateway")]))])),f(VN,M([Wk(CR),kN(2),wN,s_,ET(jk)]),M([f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([kN(60),PN]),M([f(Kk,M([bN(40),vN,wN]),fl("Want to learn more?")),f(ON,M([kN(15)]),M([f(NU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(I_),bA(tN),_N,bN(24),wN]),{label:f($N,M([e_]),M([fl("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"}),f(NU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(I_),bA(tN),_N,bN(24),wN]),{label:f($N,M([e_]),M([fl("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})]))]))),f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([B$,kN(60)]),M([f(Kk,M([bN(40),vN,wN]),fl("Ready to try it out?")),f(ON,M([kN(10),ET(zk(400)),wN]),M([f($N,M([bN(24),ET(jk)]),M([fl("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f($N,M([bN(24),ET(jk)]),M([fl("Then follow the links at the top of this page to browse "),t("Sell Offers"),fl(", browse "),t("Buy Offers"),fl(", or "),t("Create Your Own Offer"),fl(".")]))]))])))])),f(Kk,M([nL,ET(jk)]),f(kU,!0,jk))]))}(),_U=r(function(e,t){return f(Ay,f(zo,function(e){return e.type_},Ja(e)),t)}),LU=function(e){return{$:"ShowCurrencyDropdown",a:e}},xU=r(function(e,t){return ml(t(e))}),PU=a(function(e,t,r,n){var a=l(xU,e,n.filterFunc,ay(f(xa,GN,r)));return R(a,yr)?qk:f(Yi,Rv,d(v$,e,n.tradeTable,M([t?Av:xo,JN,YN,WN,QN,zN]),a))}),DU=function(e){return{$:"FiltersMsg",a:e}},UU={$:"ApplyInputs"},OU=DL("disabled"),MU=function(e){return{$:"MayPreventDefault",a:e}},FU=r(function(e,t){return f(lN,e,MU(t))}),VU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):hu("Not the enter key")},n=f(du,r,f(Oh,"key",pu));return ST(f(FU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),KU=function(e){return f(VU,"Enter",e)},HU={$:"Button"},jU=r(function(e,t){var r=t.onPress,n=t.label;return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY+" "+RT.seButton+" "+RT.noTextSelection),f(ka,uN,f(ka,LL(e),f(ka,NN(HU),f(ka,ST(x$(0)),function(){if("Nothing"===r.$)return f(ka,ST(OU(!0)),e);var t=r.a;return f(ka,pN(t),f(ka,KU(t),e))}()))))))),wT(M([n])))}),qU=f(jU,M([Wk(I_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Apply")),onPress:si(UU)}),GU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(yA,sN,l(jI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},zU=function(e){return f(dN,"focus",Fi(e))},YU=f(Da,ST,zU),WU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([YU(e(!0)),dx(e(!0))])}();return f(VN,U(e,M([yT(zk(40)),J$({blur:20,color:d(O_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Kk,M([Wk(IR),yT(zk(40)),GU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Kk,M([eR,f(aN,10,0)]),r)),f(WL,U(s,U(t,M([ET(zk(100)),yT(zk(40)),d$(IR),GU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),X$({bottom:1,left:0,right:1,top:1})]))),{label:gL(n),onChange:u,placeholder:i,text:a})]))}),JU=function(e){return{$:"MaxDaiChanged",a:e}},QU=function(e){return{$:"MinDaiChanged",a:e}},XU=r(function(e,t){return f(ON,M([ET(jk),kN(8)]),M([f(Kk,M([bN(17),gR]),fl(e)),t]))}),ZU=ZT(25),eO=function(e){return{$:"MoveX",a:e}},tO=function(e){return f(H$,ZU,eO(-e))},rO={$:"OnLeft"},nO=function(e){return f(t$,rO,e)},aO=n(function(e,t,r){var n=dL(M([eR])),a=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("max"))])),i=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("min"))]));return f(XU,"Dai Range",f(ON,M([kN(5),ET(zk(200))]),M([v(WU,M([nO(f(x_,M([tO(5),ET(zk(200))]),r.minDai))]),M([YU(LU(!1))]),i,"min Dai",e,ci,ci,QU),v(WU,M([nO(f(x_,M([tO(5),ET(zk(200))]),r.maxDai))]),M([YU(LU(!1))]),a,"max Dai",t,ci,ci,JU)])))}),iO=function(e){var t=f(fp,e,HR);if("Nothing"===t.$)return fl("*");var r=t.a,n=r.b;return f(dR,M([yT(zk(26))]),n)},oO=function(e){return{$:"AppCmd",a:e}},uO=function(e){return{$:"FiatTypeInputChanged",a:e}},sO=n(function(e,t,r){var n=oO(d(Zd,"click","misclick","currency flag",0)),a=iO(t);f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("max"))])),f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("min"))]));return f(Kk,M([s_,ET(zk(120))]),f(XU,"Fiat Type",h(PD,e,t,LU(!0),uO,n)))}),cO={$:"AddSearchTerm"},fO=function(e){return{$:"PaymentMethodInputChanged",a:e}},lO=f(Oh,"keyCode",CE),dO=function(e){return f(dN,"keyup",f(du,function(t){return 13===t?Fi(e):hu(Ni(t))},lO))},hO=function(e){return f(XU,"Search Payment Methods",f(WL,M([s_,ET(zk(250)),yT(zk(40)),d$(IR),J$({blur:20,color:d(O_,233,237,242,.05),offset:L(0,3),size:0}),N_(dO(cO))]),{label:gL("payment methods search"),onChange:fO,placeholder:ci,text:e}))},pO={$:"ResetSearch"},gO=f(jU,M([Wk(I_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Reset")),onPress:si(pO)}),vO=function(e){return{$:"RemoveTerm",a:e}},yO=function(e){return f(Kk,M([aR(3),s_,uN,pN(vO(e)),bN(10),bA(EN)]),fl("x"))},mO=function(e){if(e.b){var t=e;return f(VN,M([ET(jk),aR(10),kN(10)]),f(xa,function(e){return f(VN,M([Wk(d(O_,16,7,234,.2)),cN(5),aR(4),kN(3)]),M([fl(e),yO(e)]))},t))}return qk},bO=i(function(e,t,r,n,a){var i=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},o=f(Eh,Ja(l_),f(xa,g_,e))?M([i("No trades found.")]):f(xa,i,mE(f(xa,function(e){switch(g_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),y_(f(ON,M([kN(5),B$]),o))]),f(VN,M([wN,kN(50)]),M([f(Yi,DU,f_(t)),f(VN,M([ET(bT),kN(10)]),M([f(Kk,M([ET(bT),s_]),l(aO,r.minDai,r.maxDai,n)),f(Kk,M([ET(bT),s_]),l(sO,a,r.fiatType,n)),f(ON,M([ET(bT),s_,kN(5)]),M([hO(r.paymentMethod),mO(r.paymentMethodTerms)])),f(XU," ",f(ON,M([kN(5),ET(bT)]),M([qU,gO])))]))])))}),CO=n(function(e,t,r){var n=function(){return!f(xc,0,f(Bo,function(e){return f(MS,function(e){return e.checked&&"Open"!==e.label},e.options)},f(_U,Eo,r.filters)))}();return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),pN(LU(!1)),aR(30)]),M([f(VN,M([ET(jk),kN(10)]),M([h(bO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),d(PU,e,n,t,r)]))}),EO=function(e){return{$:"MessageInputChanged",a:e}},SO={$:"MessageSubmit"},TO=function(e){return f(ON,M([ET(jk),kN(10)]),M([f(eU,M([ET(jk),yT(zk(100))]),{label:gL("messageInput"),onChange:EO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(jU,M([wN,bN(24)]),{label:fl("Submit"),onPress:si(SO)})]))},wO=f(oN,tR,RT.scrollbarsY),IO=r(function(e,t){return f(Kk,M([yT(jk),ET(jk)]),f(Kk,U(M([N_(f(k_,"position","absolute")),N_(f(k_,"top","0")),N_(f(k_,"right","0")),N_(f(k_,"bottom","0")),N_(f(k_,"left","0")),wO]),e),t))}),AO=l(Ok,200,205,210),BO=n(function(e,t,r){var n=M([PN,Wk(I_),bA(tN),GU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([B$,Wk(AO),bA(DR),GU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Kk,U(M([aR(7)]),u),f($N,yr,M([fl(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(pA,0,0,1),tN,"Initiator opened the trade"));case"Recalled":return si(x(l(pA,0,0,1),tN,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(ru,8,dl(t))+"..";return si(x(l(pA,1,0,1),tN,r+" committed to the trade"));case"Aborted":return si(x(l(pA,1,0,0),tN,"Buyer aborted the trade"));case"Claimed":return si(x(l(pA,0,1,0),tN,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(pA,0,0,1),tN,"Seller released the "+NR(e)+" and closed the contract"));default:return si(x(l(pA,0,0,1),tN,"Seller burned the "+NR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return qk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Kk,M([cN(3),p$(1),d$(l(pA,1,0,1)),wN,Wk(h)]),f($N,M([bA(p)]),M([fl(g)])))}),kO=n(function(e,t,r){if(r.b){var n=r;return f(IO,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),aR(10)]),f(ON,M([ET(jk),yT(jk),kN(10)]),f(xa,f(BO,e,t),n)))}return f(Kk,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),wN,bA(l(pA,.5,.5,.5)),RU]),fl("no messages found."))}),NO=Cr,RO=function(e){return f(ON,M([ET(jk),yT(jk),kN(10),p$(1),cN(5),aR(20)]),M([l(kO,e.trade.factory,e.userRole,f(NO,function(e){return e.blocknum},Sa(e.history))),TO(e)]))},$O=function(e){return f(Kk,M([Wk(tN),cN(8),KD,ET(jk),yT(jk)]),RO(e))},_O={$:"ToggleChat"},LO=function(e){if(e.showChatHistory){var t=f(xc,qk,f(Bo,$O,e.chatHistoryModel));return f(Kk,M([yT(jk),ET(zk(500)),aR(20),PN]),l(L_,M([yT(jk),ET(jk)]),f(Yi,jE,t),_O))}return qk},xO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},PO=function(e){return zR(e)+" "+e.fiatType},DO={$:"AbortAction"},UO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),OO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return qk}if("LoadedTrade"!==t.b.$)return qk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=PO(n.terms.price),u=u$(oC(i)),s=u$(n.parameters.tradeAmount)+" "+NR(n.factory),c=function(){return"Buyer"===xO(n.parameters).$?L(f(Kk,M([gR,bA(DR)]),fl("buyer")),M([fl("pay the seller "),f(Kk,M([bA(I_)]),fl(o)),fl(" in exchange for the "),f(Kk,M([bA(I_)]),fl(s)),fl(" held in this contract.")])):L(f(Kk,M([gR,bA(DR)]),fl("seller")),M([fl("accept "),f(Kk,M([bA(I_)]),fl(o)),fl(" from the buyer in exchange for the "),f(Kk,M([bA(I_)]),fl(s)),fl(" held in this contract.")]))}(),d=c.a,h=c.b;return l(L_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),e_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(M_)])),U(M([U(M([fl("You will deposit "),f(Kk,M([bA(I_)]),fl(u+" "+NR(n.factory))),fl(", thereby becoming the "),d,fl(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([fl("(This ususally requires two Metamask signatures. Your "+NR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Kk,M([nL,wN]),f(Z_,"Yes, I definitely want to commit to this trade.",l(UO,n,a,i)))])),DO);case"ApproveNeedsSig":return eL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return eL(M([fl("Mining the initial approve transaction..."),f(dA,M([aL,bA(I_)]),{label:fl("See the transaction on Etherscan"),url:f(tL,n.factory,p)}),fl("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return eL(M([fl("Waiting for user signature for the final commit call."),fl("(check Metamask!)"),fl("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return eL(M([fl("Mining the final commit transaction..."),f(dA,M([aL,bA(I_)]),{label:fl("See the transaction"),url:f(tL,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(L_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),e_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(M_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([fl('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 '+NR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([fl("Aborting will incur a small penalty on both parties, and refund the rest of the "+NR(n.factory)+".")])]);case"Release":return M([M([fl("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([fl("This will destroy the "+NR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Kk,M([nL,wN]),function(e){return f(Z_,e,sS(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 "+NR(n.factory)+".";default:return"I understand. Burn the "+NR(n.factory)+"."}}()))])),DO);case"ActionNeedsSig":var g=r.a;return eL(M([fl("Waiting for user signature for the "+fS(g)+" call."),fl("(check Metamask!)")]));default:var g=r.a,p=r.b;return qk}},MO=VN(M([ET(jk),Wk(tN),cN(5),aR(20),HD,KD])),FO=function(e){return f(VN,M([kN(8)]),M([f(dR,yr,lL),f(Kk,M([bN(24),gR]),fl(u$(e)))]))},VO=r(function(e,t){var r=f(Io,Ao(e),f(Bo,function(e){return e.address},Gd(t)));return f(rx,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"}(),FO(e.parameters.tradeAmount))}),KO=function(e){return f(VN,M([kN(5)]),M([lx(e.fiatType),f(Kk,M([bN(24),gR]),fl(PO(e)))]))},HO=function(e){return f(rx,"For Fiat",KO(e.terms.price))},jO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},qO=l(Ok,250,165,22),GO=l(Ok,255,0,0),zO=l(Ok,0,255,0),YO=uR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),WO=uR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),JO=uR({description:"released",src:"/DAIHard/static/img/released.svg"}),QO={$:"ToggleStatsModal"},XO=function(e){return f(NO,Ua,e)},ZO=n(function(e,t,n){var a=ay(f(xa,function(e){return f(ml,function(e){return R(f(ko,e,n),si(t))},f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(fh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(fh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wl,amountReleased:Wl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,Vl,Ql(XO(f(US,function(e){return function(e){return e?si(e):ci}(jd(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}}),eM=r(function(e,t){return d(X_,x(d(YR,0,0,1,1),d(YR,0,0,1,.8),d(YR,0,0,1,.6)),tN,e,t)}),tM=function(e){return{$:"ViewUserHistory",a:e}},rM=f(JB,0,yr),nM=f(oN,gN,RT.textNormalWeight),aM=r(function(e,t){return Za(e/t)}),iM=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}}),oM=r(function(e,t){var r=e.a,n=e.b;return l(iM,r,f(aM,jd(t),6e4),n)}),uM=r(function(e,t){return f(_s,24,f(aM,f(oM,e,t),60))}),sM=r(function(e,t){return f(_s,1e3,jd(t))}),cM=r(function(e,t){return f(_s,60,f(oM,e,t))}),fM={$:"Apr"},lM={$:"Aug"},dM={$:"Dec"},hM={$:"Feb"},pM={$:"Jan"},gM={$:"Jul"},vM={$:"Jun"},yM={$:"Mar"},mM={$:"May"},bM={$:"Nov"},CM={$:"Oct"},EM={$:"Sep"},SM=function(e){var t=f(aM,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)}},TM=r(function(e,t){switch(SM(f(oM,e,t)).month){case 1:return pM;case 2:return hM;case 3:return yM;case 4:return fM;case 5:return mM;case 6:return vM;case 7:return gM;case 8:return lM;case 9:return EM;case 10:return CM;case 11:return bM;default:return dM}}),wM=r(function(e,t){return f(_s,60,f(aM,jd(t),1e3))}),IM={$:"Fri"},AM={$:"Mon"},BM={$:"Sat"},kM={$:"Sun"},NM={$:"Thu"},RM={$:"Tue"},$M={$:"Wed"},_M=r(function(e,t){switch(f(_s,7,f(aM,f(oM,e,t),1440))){case 0:return NM;case 1:return IM;case 2:return BM;case 3:return kM;case 4:return AM;case 5:return RM;default:return $M}}),LM=n(function(e,t,r){return e.toAmPm(f(uM,t,r))}),xM=r(function(e,t){return SM(f(oM,e,t)).day}),PM=xM,DM=M([kM,AM,RM,$M,NM,IM,BM]),UM=r(function(e,t){return function(e){return e.a}(f(xc,L(0,kM),Ql(f(ml,function(r){return R(r.b,f(_M,e,t))},f(Bi,r(function(e,t){return L(e,t)}),DM)))))}),OM=function(e){return l(Ra,Na,0,e)},MM=r(function(e,t){return SM(f(oM,e,t)).year}),FM=function(e){return!f(_s,4,e)&&(!!f(_s,100,e)||!f(_s,400,e))},VM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return FM(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}}),KM=M([pM,hM,yM,fM,mM,vM,gM,lM,EM,CM,bM,dM]),HM=r(function(e,t){return f(xc,L(0,pM),Ql(f(ml,function(r){r.a;return R(r.b,f(TM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),KM))))}),jM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(HM,e,t))}),qM=r(function(e,t){var r=f(lc,f(jM,e,t)-1,KM);return OM(f(xa,VM(f(MM,e,t)),r))+f(PM,e,t)}),GM=r(function(e,t){return f(jM,e,t)/4|0}),zM=r(function(e,t){var r=Ni(t),n=e-Qo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),YM=function(e){return e?e<=12?e:e-12:12},WM=sv(315576e5),JM=r(function(e,t){return Vl(WM*f(MM,e,t))}),QM=r(function(e,t){var r=f(JM,e,t),n=f(UM,e,r);return 1+((f(qM,e,t)+n)/7|0)}),XM=r(function(e,t){return Ni(f(MM,e,t))}),ZM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(jM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(jM,t,r));case"MonthFixed":return f(zM,2,f(jM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(TM,t,r));case"MonthNameFull":return e.toMonthName(f(TM,t,r));case"QuarterNumber":return Ni(1+f(GM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(GM,t,r));case"DayOfMonthNumber":return Ni(f(PM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(PM,t,r));case"DayOfMonthFixed":return f(zM,2,f(PM,t,r));case"DayOfYearNumber":return Ni(f(qM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(qM,t,r));case"DayOfYearFixed":return f(zM,3,f(qM,t,r));case"DayOfWeekNumber":return Ni(f(UM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(UM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(_M,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(_M,t,r));case"WeekOfYearNumber":return Ni(f(QM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(QM,t,r));case"WeekOfYearFixed":return f(zM,2,f(QM,t,r));case"YearNumberLastTwo":return f(ou,2,f(XM,t,r));case"YearNumber":return f(XM,t,r);case"AmPmUppercase":return RD(l(LM,e,t,r));case"AmPmLowercase":return sd(l(LM,e,t,r));case"HourMilitaryNumber":return Ni(f(uM,t,r));case"HourMilitaryFixed":return f(zM,2,f(uM,t,r));case"HourNumber":return Ni(YM(f(uM,t,r)));case"HourFixed":return f(zM,2,YM(f(uM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(uM,t,r));case"HourMilitaryFromOneFixed":return f(zM,2,1+f(uM,t,r));case"MinuteNumber":return Ni(f(cM,t,r));case"MinuteFixed":return f(zM,2,f(cM,t,r));case"SecondNumber":return Ni(f(wM,t,r));case"SecondFixed":return f(zM,2,f(wM,t,r));case"MillisecondNumber":return Ni(f(sM,t,r));case"MillisecondFixed":return f(zM,3,f(sM,t,r));default:return n.a}}),eF=a(function(e,t,r,n){return f(Ri,"",f(xa,l(ZM,e,r,n),t))}),tF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),rF=function(e){return e>11?"pm":"am"},nF=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"}},aF=function(e){switch(f(_s,100,e)){case 11:case 12:case 13:return"th";default:switch(f(_s,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},iF=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"}},oF=p(tF,nF,f(zo,nF,ru(3)),iF,f(zo,iF,ru(3)),rF,aF),uF=eF(oF),sF={$:"MonthNameFull"},cF=sF,fF=function(e){return{$:"Text",a:e}},lF=fF,dF={$:"YearNumber"},hF=dF,pF=n(function(e,t,n){var a=r(function(e,t){return f(ON,M([bN(18),kN(6)]),M([f(Kk,M([_N]),fl(e)),f(Kk,M([nM]),fl(t))]))}),i=uF(M([cF,lF(", "),hF])),o=f(ON,M([kN(23),ET(jk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,rM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+u$(n.amountReleased)+" "+NR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+u$(n.amountBurned)+" "+NR(e)+" Burned")])),M([f(Kk,M([wN]),f(eM,"View User History",tM(n.asRole)))])));return f(ON,M([cN(8),sU,cU,Wk(IR),kN(1),J$({blur:20,color:d(YR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Kk,M([ET(jk),Wk(tN),aR(17)]),f(m$,18,t)),f(Kk,M([ET(jk),Wk(tN),aR(17)]),o)]))}),gF=n(function(e,t,r){var n=l(ZO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=jO(e.parameters.initiatorRole)+" Stats";return f(Kk,r?M([XL(f(Kk,M([ZL(30),PN]),l(pF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(rx,a,f(VN,M([ET(jk),kN(20),uN,pN(QO)]),f(xa,VN(M([kN(5)])),M([M([f(dR,M([yT(zk(28))]),JO),f(Kk,M([bN(24),gR,bA(zO)]),fl(l(Rs,2,P("0"),Ni(n.numReleases))))]),M([f(dR,M([yT(zk(28))]),YO),f(Kk,M([bN(24),gR,bA(qO)]),fl(l(Rs,2,P("0"),Ni(n.numAborts))))]),M([f(dR,M([yT(zk(28))]),WO),f(Kk,M([bN(24),gR,bA(GO)]),fl(l(Rs,2,P("0"),Ni(n.numBurns))))])])))))}),vF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+dl(t)}e.a;return"https://kovan.etherscan.io/address/"+dl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+dl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+dl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+dl(t)}}),yF=n(function(e,t,r){return f(dA,e,{label:fl(dl(r)),url:f(vF,t,r)})}),mF=function(e){return f(rx,"Trade Status",f(ON,M([bN(24),gR,kN(8)]),M([fl(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(yF,M([bN(12),bA(I_),aL]),e.factory,e.creationInfo.address)])))},bF=i(function(e,t,r,n,a){return MO(M([mF(t),f(VO,t,r),HO(t),l(gF,t,n,a)]))}),CF=l(Ok,9,32,107),EF=uR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),SF=f(Kk,M([cN(4),uN,pN(_O),aR(5),Wk(l(Ok,22,0,255))]),f(dR,M([ET(zk(42))]),EF)),TF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},wF=function(e){return f(ON,M([cN(12),Wk(IR),aR(15),kN(15)]),M([f(Kk,M([bN(24),vN,RU]),fl("Fiat Payment Method")),f($N,M([bN(18),yT(bT),Wk(tN),J$({blur:5,color:d(YR,0,0,0,.2),offset:L(-3,3),size:0}),cN(3),aR(5)]),M([f(xc,f(Kk,M([bA(MD),RU]),fl("No payment methods found.")),f(Bo,fl,f(Bo,function(e){return e.info},Ql(e))))]))]))},IF={$:"Active"},AF=function(e){return{$:"ExpandPhase",a:e}},BF=M([Wk(CF),bA(tN)]),kF=r(function(e,t){return{$:"Min",a:e,b:t}}),NF=r(function(e,t){return f(kF,e,t)}),RF=function(e){return M(e?[cN(12),s_,yT(f(NF,380,bT))]:[cN(12),wN])},$F=M([Wk(tN)]),_F=uR({description:"flame",src:"/DAIHard/static/img/flame.png"}),LF=r(function(e,t){return Hl(f(ds,jl(e),jl(t)))}),xF=r(function(e,t){return d(X_,x(d(YR,1,.6,.2,1),d(YR,1,.6,.2,.8),d(YR,1,.6,.2,.6)),tN,e,t)}),PF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),DF=function(e){return{$:"ContractActionClicked",a:e}},UF={$:"Web3Connect"},OF=n(function(e,t,r){var n=Gd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(xR,e,t).$?qk:f(VN,M([kN(8)]),function(){var e=x(t.state.phase,f(Ao,t,a.address),f(ko,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,sS,f(eM,"Remove and Refund this Trade",oS))])}break e}var r=(e.a,e.b,jl(Fb(t.parameters)));return M([f(Z_,"Deposit and Commit to Trade",l(PF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(xF,"Abort Trade",GE)),f(Yi,DF,f(Z_,"Confirm Payment",ZE)),SF])}e.a,e.c.a;return M([SF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(Z_,"Burn it All!",XE)),f(Yi,DF,f(eM,"Release Everything",uS)),SF])}e.a,e.c.a;return M([SF])}break e;default:break e}return yr}())}return f(Z_,"Connect to Wallet",UF)}),MF={$:"Finished"},FF={$:"NotStarted"},VF=r(function(e,t){var r=L(ER(t),ER(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?FF:R(n,a)?IF:MF}),KF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),HF=r(function(e,t){return l(KF,yr,e,t)}),jF=a(function(e,t,r,n){var a=u$(f(fh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+NR(r.factory),i=u$(r.parameters.tradeAmount)+" "+NR(r.factory),o=f(VN,yr,f(HF,3,f(dR,M([yT(zk(18))]),_F))),u=f(Da,Kk(M([bA(l(pA,1,0,0))])),fl),s=R(e,r.state.phase),c=f(Io,ko(r),f(Bo,function(e){return e.address},Gd(n))),d=s?tN:DR,h=$N(M([bA(d),bN(18),vN])),p=PO(r.terms.price),g=s?l(Ok,0,226,255):l(Ok,16,7,234),v=f(Da,Kk(M([bA(g)])),fl),y=u$(r.parameters.buyerDeposit)+" "+NR(r.factory),m=r.parameters.abortPunishment,b=u$(m)+" "+NR(r.factory),C=u$(f(LF,r.parameters.buyerDeposit,m))+" "+NR(r.factory),E=u$(f(LF,r.parameters.tradeAmount,m))+" "+NR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([fl("Your "),u("burnable deposit"),fl(" of "),v(y),fl(" is now held in this contract, and your offer to buy "),v(i),fl(" for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Seller by depositing the full "),v(i),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),fl(" to you.")])])):f(xa,h,M([M([fl("Your offer to sell the "),v(i),fl(" held in this contract for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),fl(" of 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),fl(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([fl("You must now pay the Seller "),v(p),fl(" via the Fiat Payment Method, "),f(Kk,M([vN]),fl("and then click ")),u("Confirm Payment"),fl(" before the payment window runs out. Use the chat to coordinate.")]),M([fl("If you abort the trade, or do not confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to you).")]),M([fl("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),fl(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([fl("Work and communicate with the Buyer to receive "),v(p),fl(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to you, "),v(C),fl(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),fl(" will be released to you.")]),M([fl("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),fl(" In this case the "),v(a),fl(" will be lost to both parties.")]),M([fl("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([fl("So, have you recieved the "),v(p),fl("? If so, you can click "),v("Release Everything"),fl(".")]),M([fl("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),fl(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([fl("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([fl("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([fl("The Seller has deposited "),v(i),fl(" into this contract, and offers to sell it for "),v(p),fl(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("If the trade is successful, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),fl(" within the payment window.")])])):f(xa,h,M([M([fl("The Buyer is offering to buy "),v(i),fl(" for "),v(p),fl(", and has deposited "),v(y),fl(" into this contract as a "),u("burnable deposit"),fl(". To become the Seller, deposit "),v(i),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("When you receive the "),v(p),fl(" from the Buyer, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can receive "),v(p),fl(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([fl("During this phase, the Buyer is expected to transfer "),v(p),fl(" to the Seller, as described in Fiat Payment Method, "),f(Kk,M([vN]),fl("and ")),u("Confirm the Payment "),fl(" before the payment window runs out. This would move the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(" amount) will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([fl("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([fl("If the Seller can verify he has received the "),v(p),fl(", he will probably release the total balance of "),v(i),fl(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),fl(".")]),M([fl("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),fl(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(ON,M([ET(jk),yT(jk),aR(20),kN(30)]),M([f(VN,M([ET(jk)]),M([f(Kk,M([bN(24),vN,bA(g),B$]),fl(T))])),f(ON,M([ET(jk),eR,kN(13)]),w),f(Kk,M([PN]),function(){switch(f(VF,r,e).$){case"Active":return l(OF,t,r,n);case"NotStarted":return f(Kk,M([bN(20),vN,RU,bA(CR)]),fl("Phase not yet started."));default:return f(Kk,M([bN(20),vN,RU]),fl("Phase no longer active."))}}())]))}),qF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},GF=uR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),zF=uR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),YF={$:"None"},WF=YF,JF=uR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),QF=function(e){switch(e.$){case"Open":return JF;case"Committed":return GF;case"Judgment":return zF;default:return WF}},XF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),ZF=a(function(e,t,r,n){return d(XF,e,t,r,n)}),eV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},tV=function(e){return function(e){return d(ZF,e.red,e.green,e.blue,e.alpha)}(eV(e))},rV=function(e){return{$:"Circle",a:e}},nV=rV,aV=d(XF,0,0,0,1),iV={$:"Flat"},oV={$:"Sharp"},uV=function(e){return{$:"Uniform",a:e}},sV=uV,cV={cap:iV,dashPattern:yr,dashPhase:0,fill:sV(aV),join:oV,thickness:2},fV=n(function(e,t,r){return D(cV,{dashPattern:e,fill:r,thickness:t})}),lV=fV(yr),dV={$:"Transparent"},hV=dV,pV=f(lV,0,hV),gV=r(function(e,t){return{$:"Shape",a:e,b:t}}),vV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},yV=function(e){return f(Da,vV,gV(e))},mV=function(e){return yV(L(e,pV))},bV=function(e){return L(-e.a,-e.b)},CV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),EV=r(function(e,t){return f(CV,bV(e(t)),t)}),SV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},TV=r(function(e,t){return{$:"Path",a:e,b:t}}),wV=kr,IV=Nr,AV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=IV(n),i=wV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},BV=function(e){return xa(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)})},kV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(BV,e,M([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 M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},RV=function(e){var t=$V(e.basic),r=SV(f(xa,AV(e),t)),n=r.a,a=r.b;return{toBottom:-f(xc,0,gI(a)),toLeft:-f(xc,0,gI(n)),toRight:f(xc,0,pI(n)),toTop:f(xc,0,pI(a))}},$V=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(kV,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(kV,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(kV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(BV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(TV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(BV,R(C,iV)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(kV,0,E);case"Group":var S=e.a;return f(BV,0,ay(f(xa,f(zo,RV,NV),S)));default:var T=e.b;return f(BV,0,NV(RV(T)))}},_V=function(e){var t=RV(e);return t.toTop+t.toBottom},LV=function(e){var t=RV(e);return L(-t.toLeft,t.toTop)},xV=function(e){var t=RV(e);return t.toLeft+t.toRight},PV=En("http://www.w3.org/2000/svg"),DV=PV("svg"),UV=Nn("height"),OV=Nn("version"),MV=Nn("width"),FV=PV("circle"),VV=PV("ellipse"),KV=PV("foreignObject"),HV=PV("g"),jV=PV("image"),qV=PV("polygon"),GV=PV("polyline"),zV=PV("rect"),YV=Tw,WV=PV("text"),JV=Nn("id"),QV=Nn("points"),XV=Nn("r"),ZV=Nn("rx"),eK=Nn("ry"),tK=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},rK=function(e){return{$:"Group",a:e}},nK=Nn("dominant-baseline"),aK=Nn("fill"),iK=Nn("fill-opacity"),oK=Nn("font-family"),uK=Nn("font-size"),sK=Nn("font-style"),cK=Nn("font-variant"),fK=Nn("font-weight"),lK=Nn("opacity"),dK=Nn("stroke"),hK=Nn("stroke-dasharray"),pK=Nn("stroke-dashoffset"),gK=Nn("stroke-linecap"),vK=Nn("stroke-linejoin"),yK=Nn("stroke-opacity"),mK=Nn("stroke-width"),bK=Nn("text-anchor"),CK=Nn("text-decoration"),EK=Nn("transform"),SK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},TK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},wK=n(function(e,t,r){return d(XF,e,t,r,1)}),IK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return sv(1e4*e)/100};return Cd(M(["rgba(",mw(i(t)),"%,",mw(i(r)),"%,",mw(i(n)),"%,",mw(function(e){return sv(1e3*e)/1e3}(a)),")"]))},AK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},BK=function(e){var t=AK(e),r=t.red,n=t.green,a=t.blue;return IK(l(wK,r,n,a))},kK=function(e){if("Uniform"===e.$){var t=e.a;return BK(t)}return"none"},NK=function(e){var t=AK(e),r=t.alpha;return mw(r)},RK=function(e){if("Uniform"===e.$){var t=e.a;return NK(t)}return"0"},$K=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},_K=function(e){var t=mw(e.scale.b),r=mw(e.scale.a),n=mw(-e.rotation/2/M$*360),a=mw(-e.shift.b),i=mw(e.shift.a);return Cd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},LK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),aK("none"),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([aK(kK(a)),iK(RK(a)),dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([aK(kK(uV(o.color))),oK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),uK(Ni(o.size)),fK(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"}}()),sK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),cK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),CK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),bK("middle"),nK("middle"),EK(_K(e))]);default:return M([EK(_K(e))])}},xK=Nn("x"),PK=Nn("y"),DK=r(function(e,t){return M([MV(mw(e)),UV(mw(t)),xK(mw(-e/2)),PK(mw(-t/2))])}),UK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([mw(t),mw(-r)]))},e))},OK=dN,MK=r(function(e,t){return f(e,t.a,t.b)}),FK=function(e){return f(xa,MK(OK),e)},VK=function(e){e:for(;;){var t=f(xc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(GV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(qV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Circle":var c=s.a;return f(FV,U(M([JV(t),XV(mw(c))]),U(LK(e),FK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(VV,U(M([JV(t),ZV(mw(d)),eK(mw(h))]),U(LK(e),FK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(zV,U(M([JV(t),ZV(mw(c)),eK(mw(c))]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(TV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(WV,U(M([JV(t)]),U(LK(e),FK(e.handlers))),M([YV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(jV,U(M([JV(t),tK(C)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(KV,U(M([JV(t)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(HV,f(ka,JV(t),U(LK(e),FK(e.handlers))),l(Ra,r(function(e,t){return f(ka,VK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:rK(M([w,I]))});e=v;continue e}}},KK=r(function(e,t){var r=e.a,n=e.b,a=mw(r),i=mw(n);return f(jT,yr,M([f(DV,M([MV(a),UV(i),OV("1.1")]),M([VK(t)]))]))}),HK=function(e){return f(KK,L(xV(e),_V(e)),f(EV,LV,e))},jK=r(function(e,t){var r=QF(e),n=function(){switch(t.$){case"NotStarted":return l(Ok,10,33,108);case"Active":return l(Ok,0,100,170);default:return l(Ok,1,129,104)}}(),a=hx(HK(f(mV,sV(tV(n)),nV(50))));return f(Kk,M([wN,y_(f(dR,M([wN,eR,yT(zk(60))]),r))]),a)}),qK=function(e){var t=M([RU,vN,bN(20)]);switch(e.$){case"Active":return f(Kk,U(t,M([bA(EN)])),fl("Active"));case"NotStarted":return f(Kk,U(t,M([bA(CR)])),fl("Not Started"));default:return f(Kk,t,fl("Finished"))}},GK=n(function(e,t,r){var n=f(VF,t,e),a=function(){return"Active"===n.$?l(Ok,0,226,255):DR}(),i=f(Kk,M([bA(a),bN(20),vN,wN]),fl(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 qk;switch(n.$){case"NotStarted":return d(ZR,M([wN]),M([bN(22),gR]),L(DR,IR),f(_R,e,t));case"Active":var a=f(xR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(o$,M([wN]),M([bN(22),gR]),L(tN,IR),i)}return f(ON,M([wN,kN(10)]),M([f(Kk,M([wN]),fl(qF(e))),f(eM,"Poke",sS(iS))]));default:return f(Kk,M([yT(zk(1))]),qk)}}();return f(ON,M([aR(20),kN(10),yT(jk)]),M([f(Kk,M([s_,wN]),i),f(Kk,M([yT(jk),wN]),f(Kk,M([eR]),f(jK,e,n))),f(ON,M([kN(10),nL,wN]),M([f(Kk,M([wN]),qK(n)),o]))]))}),zK=o(function(e,t,r,n,a,i){var o=f(VF,r,t),u=f(Kk,M([aR(10),ET(jk),yT(jk)]),d(jF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Vl(0)}}(),c=l(GK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(LR,f(qb,r.state.phaseStartTime,s),i);default:Vl(0)}}(),f(Kk,M([yT(jk),ET(zk(1)),Wk(function(){return"Active"===o.$?l(pA,0,0,1):IR}())]),qk)),p=a?f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([ET(jk)]))),M([c,h,u])):f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([uN,pN(AF(t))]))),M([c]));return!e&&R(o,IF)?f(ON,M([ET(jk),kN(20),C$({bottom:20,left:0,right:0,top:0})]),M([p,wF(r.terms.paymentMethods)])):p}),YK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(VN,M([wN,cN(12),aR(30),kN(10),Wk(CF),bN(24),vN,bA(tN)]),M([fl("Trade "+TF(t.state.closedReason)),SF])):e?f(ON,M([ET(jk),kN(10)]),M([f(VN,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)])),wF(t.terms.paymentMethods)])):f(ON,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)]))}),WK=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(ON,M([ET(jk),yT(jk),kN(40)]),M([h(bF,t,i,n.wallet,r,n.showStatsModal),f(Kk,M([ET(jk),f(aN,40,0),kN(40)]),h(YK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Kk,M([wN,eR,bN(30)]),fl("Loading trade info..."));default:return f(Kk,M([wN,eR,bN(30)]),fl("Invalid trade"))}}(),M([LO(n),OO(n)]))}),JK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),QK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L($U,yr);case"CreateModel":var n=r.a;return L(f(Yi,Uy,CU(n)),yr);case"TradeModel":var a=r.a;return l(JK,Yi(Fy),xa(Yi(Fy)),d(WK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,fT,l(CO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,oT,l(b_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Kk,M([ET(jk),yT(jk),cN(10)]),n),a)}),XK=function(e){return{$:"DismissNotice",a:e}},ZK=function(e){return f(H$,ZU,eO(e))},eH=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(pA,1,1,1):l(pA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Ok,100,200,255);case"Caution":return l(Ok,255,188,0);case"Error":return l(Ok,255,70,70);default:return l(Ok,200,200,200)}}(),o=f(Kk,M([PN,s_,j$(5),ZK(5)]),A_(XK(t)));return f(Kk,M([Wk(i),cN(10),aR(8),ET(jk),p$(1),d$(d(YR,0,0,0,.15)),KD]),f(ON,M([kN(4),ET(jk)]),f(Bi,r(function(e,t){return f($N,M([ET(jk),bA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},tH=function(e){return R(e,yr)?yr:M([f(ON,M([tO(20),j$(20),kN(10),PN,nL,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,ul)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(ON,M([ZK(20),ZL(100),kN(10),B$,s_,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,CB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},rH=r(function(e,t){var r=f(QK,e,t),n=r.a,a=r.b;return L(f(ON,M([r$(Jk),y_(KN(t)),ET(jk),yT(jk),aR(30)]),M([f(Kk,M([yT(zk(50))]),qk),n])),U(a,tH(t.userNotices)))}),nH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),aH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),iH={$:"AllowHover"},oH={$:"Layout"},uH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(hA,155/255,203/255,1,1),offset:L(0,0),size:3})},sH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?uH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?iH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?oH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},cH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(AT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),AT);case"Text":var a=t.a;return $I(a);default:return $I("")}}),fH=n(function(e,t,r){var n=sH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?nH(n):aH(n)}();return f(cH,a,d(fA,AT,Vk,t,wT(M([r]))))}),lH=ZT(5),dH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),hH={$:"SansSerif"},pH=function(e){return{$:"Typeface",a:e}},gH=Y,vH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",gH(sd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",gH(sd(t)));default:var t=e.a.name;return f(Ri,"-",gH(sd(t)))}}())}),yH=function(){var e=M([pH("Open Sans"),pH("Helvetica"),pH("Verdana"),hH]);return M([f(yA,Yk,l(vA,"bg-color-"+mA(d(hA,1,1,1,0)),"background-color",d(hA,1,1,1,0))),f(yA,gA,l(vA,"font-color-"+mA(d(hA,0,0,0,1)),"color",d(hA,0,0,0,1))),f(yA,yN,mN(20)),f(yA,lH,f(dH,l(Ra,vH,"font-",e),e))])}(),mH=n(function(e,t,r){var n=e.options;return l(fH,n,f(ka,lA(f(Ri," ",M([RT.root,RT.any,RT.single]))),U(yH,t)),r)}),bH=mH({options:yr}),CH=function(e){return f(yA,lH,f(dH,l(Ra,vH,"ff-",e),e))},EH=hH,SH=pH,TH=function(e){return{body:M([function(){var t=f(rH,e.screenWidth,e),r=t.a,n=t.b,a=U(M([ET(jk),yT(jk),CH(M([SH("Soleil"),EH]))]),f(xa,y_,n));return f(bH,a,r)}()]),title:"DAIHard"}},wH=Ht,IH=wH({init:OB,onUrlChange:Uk,onUrlRequest:Dk,subscriptions:Pk,update:sB,view:TH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:IH(f(du,function(e){return f(du,function(t){return f(du,function(r){return Fi({height:r,networkId:t,width:e})},f(Oh,"height",CE))},f(Oh,"networkId",CE))},f(Oh,"width",CE)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file +var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(bp,o,function(e){return si(Cp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,kp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,Bp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=nv(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?qg(o):jg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return nv(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Gg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Yg,zg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(zo,xa(ac),f(zo,Ms,nc))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ph,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ph,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ap)}),i.addEventListener("timeout",function(){a(Np)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Cp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(wp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Yg,zg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Yg,zg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Yg,zg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{options:t,type_:e}}),po={$:"OfferType"},go=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),vo=r(function(e,t){return f(ho,po,M([l(go,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(go,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),yo={$:"Closed"},mo={$:"Committed"},bo={$:"Judgment"},Co={$:"Open"},Eo={$:"Phase"},So=a(function(e,t,r,n){return f(ho,Eo,M([l(go,"Open",e,function(e){return R(e.state.phase,Co)}),l(go,"Committed",t,function(e){return R(e.state.phase,mo)}),l(go,"Judgment",r,function(e){return R(e.state.phase,bo)}),l(go,"Closed",n,function(e){return R(e.state.phase,yo)})]))}),To={$:"Initiator"},wo={$:"Responder"},Io=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),Ao=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(To):f(Io,function(e){return R(t,e)?si(wo):ci},e.state.responder)}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),ko=r(function(e,t){return f(Bo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(Ao,e,t))}),No={$:"Role"},Ro=n(function(e,t,r){return f(ho,No,M([l(go,"Buyer",t,function(t){return R(f(ko,t,e),si(fo))}),l(go,"Seller",r,function(t){return R(f(ko,t,e),si(lo))})]))}),$o=function(e){return{orderBy:e}},_o=$o,Lo={$:"Ascending"},xo={$:"Phase"},Po=Oe,Do=Po(yr),Uo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(So,!0,!0,!0,!1),f(vo,!0,!0),l(Ro,t,!0,!0)])),tradeTable:_o(L(xo,Lo)),wallet:e},Do)}),Oo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Mo={$:"None"},Fo=Mo,Vo=function(e){return d(Oo,e,Do,Fo,yr)},Ko=function(e){return{$:"TradeTableMsg",a:e}},Ho=function(e){return d(Oo,e,Do,Fo,yr)},jo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),qo=r(function(e,t){return f(jo,e,t)}),Go=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),zo=n(function(e,t,r){return t(e(r))}),Yo=r(function(e,t){if("None"===t.$)return Mo;var r=t.a,n=t.b,a=l(Go,f(Bo,Da(e),r.onSign),f(Bo,Da(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return L(f(zo,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(zo,t.toMsg,e)}},n))},r.onMined));return f(jo,a,n)}),Wo=function(e){return{$:"AbiDecoder",a:e}},Jo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Qo=z,Xo=Fr,Zo=r(function(e,t){return e<1?t:l(Xo,e,Qo(t),t)}),eu=Zo(64),tu=n(function(e,t,r){return L(f(Jo,e,eu(t)),r)}),ru=r(function(e,t){return e<1?"":l(Xo,0,e,t)}),nu=ru(64),au=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),iu=function(e){return-e},ou=r(function(e,t){return e<1?"":l(Xo,-e,Qo(t),t)}),uu=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(ru,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(ou,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Wo(function(t){var r=t.a,n=t.b;return f(au,f(tu,r,n),e(nu(n)))})}(),su=Hr,cu=function(e){return f(su,"0x",e)||f(su,"0X",e)?f(Zo,2,e):e},fu=function(e){return e.b},lu=r(function(e,t){var r=e.a;return f(au,fu,r(function(e){return f(Jo,e,e)}(cu(t))))}),du=Xr,hu=ae,pu=Wr,gu=function(e){return f(du,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return hu(a)},pu)},vu=f(zo,lu,gu),yu=function(e){return{$:"Magnitude",a:e}},mu=function(e){return{$:"Pos",a:e}},bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Cu=function(e){return{$:"MagnitudeNotNormalised",a:e}},Eu=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 si(n)}return ci}},Su=function(e){var t=Eu(e);return"Nothing"!==t.$&&t.a<0},Tu=function(e){return{$:"Neg",a:e}},wu={$:"Zer"},Iu=function(e){return!e.b},Au=r(function(e,t){var r=t.a;if(Iu(r))return wu;switch(e.$){case"Zero":return wu;case"Positive":return mu(t);default:return Tu(t)}}),Bu=r(function(e,t){return f(bu,e,Cu(t))}),ku=function(e){return f(La,r(function(t,r){return e(t)&&Iu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Nu=Ir,Ru=-1+f(Nu,10,7),$u=Ru+1,_u=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Lu=function(e){return e<0?f(_u,Na(-1),Lu(e+$u)):L(e/$u|0,e%$u)},xu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Lu(r+e),i=a.a,o=a.b;return f(ka,o,f(xu,i,n))}{if(!(_(e,$u)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Pu=function(e){var t=e.a;return yu(ku(f(xu,0,t)))},Du=xa(iu),Uu={$:"Negative"},Ou={$:"Positive"},Mu={$:"Zero"},Fu=function(e){switch(e.$){case"Positive":return Uu;case"Negative":return Ou;default:return Mu}},Vu=function(e){for(;;){var t=e.a,r=e.b,n=Pu(r),a=n.a;if(!Su(a))return f(Au,t,yu(a));e=f(Bu,Fu(t),Du(a))}},Ku=pr,Hu=function(e){switch(f(Ku,e,0).$){case"LT":return Uu;case"GT":return Ou;default:return Mu}},ju=function(e){return e<0?-e:e},qu=function(e){return Vu(f(bu,Hu(e),Cu(M([ju(e)]))))},Gu=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(Nu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},zu=function(e){switch(e.$){case"Zer":return wu;case"Neg":var t=e.a;return mu(t);default:return e}},Yu=function(e){return{$:"MagnitudePair",a:e}},Wu=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(ka,L(a,u),f(Wu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Wu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Wu,yr,s))}return yr}),Ju=r(function(e,t){var r=e.a,n=t.a;return Yu(f(Wu,r,n))}),Qu=function(e){switch(e.$){case"Zer":return f(Bu,Mu,yr);case"Neg":var t=e.a.a;return f(Bu,Ou,Du(t));default:var t=e.a.a;return f(Bu,Ou,t)}},Xu=r(function(e,t){var r=Qu(t),n=r.b,a=Qu(e),i=a.b,o=f(Ju,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Vu(f(bu,Ou,Cu(s)))}),Zu=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(R(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 Ta}return a.b.b?ba:f(Ku,e,t)}}),es=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},ts=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(Zu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return es(d(Zu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),rs=r(function(e,t){return R(f(ts,e,t),Ta)}),ns=K,as=r(function(e,t){return!f(rs,e,t)}),is=function(e){switch(e.$){case"Zer":return yu(yr);case"Pos":default:var t=e.a;return t}},os=r(function(e,t){var r=e.a;return Pu(Cu(f(xa,ti(t),r)))}),us=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(os,yu(n),a),u=f(us,yu(i),yu(n)),s=u.a,c=f(Xu,f(Au,Ou,o),f(Au,Ou,yu(f(ka,0,s))));return is(c)}var a=r.a;return f(os,yu(n),a)}return yu(yr)}),ss=function(e){switch(e.$){case"Zer":return Mu;case"Pos":return Ou;default:return Uu}},cs=r(function(e,t){return R(e,Mu)||R(t,Mu)?Mu:R(e,t)?Ou:Uu}),fs=r(function(e,t){return f(Au,f(cs,ss(e),ss(t)),f(us,is(e),is(t)))}),ls=function(e){switch(e.$){case"Zer":return wu;case"Pos":var t=e.a;return Tu(t);default:var t=e.a;return mu(t)}},ds=r(function(e,t){return f(Xu,e,ls(t))}),hs=qu(0),ps=a(function(e,t,r,n){if(e){var a=qu(e),i=f(fs,f(fs,a,n),t),o=f(as,i,r)?L(f(fs,a,t),f(ds,r,i)):L(hs,r),u=o.a,s=o.b,c=d(ps,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Xu,u,l),h)}return L(hs,r)}),gs=Fa(f(Va,2,Ru)),vs=n(function(e,t,r){return d(ps,f(Nu,2,gs),e,t,r)}),ys=qu(1),ms=r(function(e,t){return e}),bs=n(function(e,t,r){return l(Ra,ms(e),t,f(Ai,1,r))}),Cs=function(e){return l(bs,fs(qu($u)),ys,e)},Es=n(function(e,t,r){if(e){var n=l(vs,Cs(e),t,r),a=n.a,i=n.b,o=l(Es,e-1,i,r),u=o.a,s=o.b;return L(f(Xu,a,u),s)}return l(vs,Cs(e),t,r)}),Ss=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Ts=r(function(e,t){if(R(t,hs))return ci;var r=Ti(Ss(e))-Ti(Ss(t))+1,n=l(Es,f(ei,0,r),zu(e),zu(t)),a=n.a,i=n.b;return si(L(f(Au,f(cs,ss(e),ss(t)),is(a)),f(Au,ss(e),is(i))))}),ws=f(fs,qu(2),qu(2147483648)),Is=xr,As=function(e){return f(Is,e,"")},Bs=Pn,ks=n(function(e,t,r){return e<=0?r:l(ks,e>>1,U(t,t),1&e?U(r,t):r)}),Ns=r(function(e,t){return l(ks,e,t,"")}),Rs=n(function(e,t,r){return U(f(Ns,e-Qo(r),As(t)),r)}),$s=te,_s=Ar,Ls=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},xs=r(function(e,t){for(;;){if(t<16)return f(ka,Ls(t),e);var r=f(ka,Ls(f(_s,16,t)),e),n=t/16|0;e=r,t=n}}),Ps=function(e){return $s(e<0?f(ka,P("-"),f(xs,yr,-e)):f(xs,yr,e))},Ds=function(e){var t=f(Ts,e,ws);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=Ps(Gu(a));return R(n,qu(0))?i:U(Ds(n),l(Rs,8,P("0"),i))},Us=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,yu(yr))?"0":Ds(mu(t));default:var t=e.a;return"-"+Us(f(fs,qu(-1),e))}},Os=function(e){return l(Rs,64,P("0"),e)},Ms=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(Ps(a)),c=function(e){return U(e,n)}(Os(Ps(u)));return x(a+32+(Qo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Fs=Dr,Vs=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))))}),Ks=n(function(e,t,n){return l(Fs,r(function(t,r){return l(Vs,e,yi(t),r)}),t,n)}),Hs=function(e){return $a(l(Ks,ka,yr,e))},js=function(e){return f(Ri,"",f(xa,f(zo,Ps,f(Rs,2,P("0"))),Hs(e)))},qs=function(e){return 64-f(_s,64,e)},Gs=function(e){return U(e,f(Ns,qs(Qo(e)),"0"))},zs=function(e){return L(si(Qo(e)/2|0),Gs(e))},Ys=function(e){return L(ci,Os(e))},Ws=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Js=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"}},Qs=Ur,Xs=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(Is,P("1"),r),!0);case"1":return L(f(Is,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Is,P("0"),r),!1);case"1":return L(f(Is,P("1"),r),!0);default:break e}return L(r,!0)});return l(Qs,t,L("",!1),e).a},Zs=function(e){return l(Qs,ka,yr,e)},ec=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Zo,e,t),i=f(ka,l(Xo,0,e,t),r);e=n,t=a,r=i}}),tc=r(function(e,t){return e&&""!==t?l(ec,e,t,yr):M([t])}),rc=function(e){var t=function(){var t=Zs(Us(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(zo,Xs,f(Rs,256,P("1"))))}var r=t;return L(r,f(Rs,256,P("0")))}(),r=t.a,n=t.b;return $s(f(xa,Ws,f(tc,4,n(f(Ri,"",f(xa,Js,r))))))},nc=function(e){return{$:"Hex",a:e}},ac=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Ys(t);case"UintE":var r=e.a;return Ys(Us(r));case"IntE":var n=e.a;return Ys(rc(n));case"BoolE":return Ys(e.a?"1":"0");case"DBytesE":var a=e.a.a;return zs(a);case"BytesE":var a=e.a.a;return Ys(cu(a));case"StringE":var i=e.a;return zs(js(i));case"ListE":var o=e.a;return function(e){var t=e.a;return zs(t)}(Xt()(o));default:var i=e.a;return Ys(cu(i))}};try{var ic=Xt();Xt=function(){return ic}}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 oc=Pr,uc=function(e){return 1===Qo(e)?f(oc,"0",e):e},sc=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(ka,n,r);e=i,t=o,r=u}}}),cc=r(function(e,t){return $a(l(sc,e,t,yr))}),fc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(cc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(fc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),lc=r(function(e,t){return l(fc,0,e,t)}),dc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),hc=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 Pt(e.a)}},pc={$:"LE"},gc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,pc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,pc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,pc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,pc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,pc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,pc));case"Seq":var i=e.b;return l(vc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),vc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(gc,n,t,r);e=i,t=o,r=u}}),yc=Dt,mc=r(function(e,t){return{$:"Seq",a:e,b:t}}),bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+hc(r),i=n;e=a,t=i}}),Cc=function(e){return f(mc,f(bc,0,e),e)},Ec=function(e){return{$:"U8",a:e}},Sc=Ec,Tc=r(function(e,t){return _(e,t)<0?e:t}),wc=hr,Ic=function(e){return{$:"Bytes",a:e}},Ac=Ic,Bc=function(e){return yc(Cc(f(xa,Ac,$a(e))))},kc=Pt,Nc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Rc=function(e){return{$:"Decoder",a:e}},$c=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}}),_c=r(function(e,t){return Rc(f($c,e,t))}),Lc=Rc(Yn),xc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Pc=function(e){return{$:"Done",a:e}},Dc=function(e){return{$:"Loop",a:e}},Uc=r(function(e,t){var n=t.a;return Rc(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 Rc(r(function(t,r){return L(r,e)}))},Mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Oc(Pc($a(n))):f(Uc,function(e){return Dc(L(r-1,f(ka,e,n)))},e)}),Fc=function(e){return f(xc,yr,f(Nc,f(_c,L(kc(e),yr),Mc(Lc)),e))},Vc=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))}),Kc=r(function(e,t){return l(Vc,Bs,e,t)}),Hc=f(Ai,0,4),jc=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}}),qc=xt,Gc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),zc=function(e){return f(Gc,f(zo,qc,Bs(4294967295)),e)},Yc=r(function(e,t){return 5*t+e}),Wc=4294967295>>>32-Ha,Jc=ar,Qc=n(function(e,t,r){for(;;){var n=Wc&t>>>e,a=f(Jc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Jc,Wc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Xc=function(e){return e>>>5<<5},Zc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Xc(r))>-1?f(Jc,Wc&e,i):l(Qc,n,e,a))}),ef=r(function(e,t){var r=f(Zc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),tf=n(function(e,t,r){var n=f(Yc,e,t);return f(ef,n,r)}),rf=ir,nf=a(function(e,t,r,n){var a=Wc&t>>>e,i=f(Jc,a,n);if("SubTree"===i.$){var o=i.a,u=d(nf,e-Ha,t,r,o);return l(rf,a,za(u),n)}var s=i.a,c=l(rf,Wc&t,r,s);return l(rf,a,Ga(c),n)}),af=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,Xc(n))>-1?d(Ma,n,a,i,l(rf,Wc&e,t,o)):d(Ma,n,a,d(nf,a,e,t,i),o)}),of=n(function(e,t,r){return l(af,e,t,r)}),uf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(of,a,r,n)}),sf=Dn,cf=r(function(e,t){return l(Vc,sf,e,t)}),ff=function(e){var t=l(La,r(function(t,n){var a={d0:l(tf,0,t,e.state),d1:l(tf,1,t,e.state),d2:l(tf,2,t,e.state),d3:l(tf,3,t,e.state),d4:l(tf,4,t,e.state)},i=r(function(e,r){return d(uf,e,t,f(cf,f(jc,e,a),f(Kc,zc(f(jc,f(_s,5,e+1),a)),f(jc,f(_s,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Hc);return D(e,{state:t})},lf=L(0,0),df=function(e){return{current:lf,lfsrstate:1,state:e,x:1,y:0}},hf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},pf=L(1,0),gf=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),vf=r(function(e,t){if(e){var n=f(gf,1,t);return l(Vc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),yf=r(function(e,t){var r=f(_s,32,e/32|0),n=f(gf,r,t),a=f(_s,32,e);return f(vf,a,n)}),mf=n(function(e,t,r){var n=f(Zc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(af,e,t(a),r)}),bf=n(function(e,t,r){return l(mf,e,cf(t),r)}),Cf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(bf,a,r,n)}),Ef=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Nf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Tc,n,r),i=f(xa,function(e){return f(kf,e,g)},f(Ai,0,a)),o=Bf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(lc,i.outputLen,l(v,g,yr,i.outputLen))},Lf=function(e){return{$:"KS",a:e}},xf=function(e){var t=e.a;return Lf({config:t,inputLength:0,partial:yr,state:f(ui,25,ms(lf))})},Pf=function(e){return Rc(Wn(e))},Df=yc(Cc(yr)),Uf=r(function(e,t){var n=t.a;return Rc(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(Uf,function(e){return Pf(t)},Pf(e))}),Mf=r(function(e,t){return f(xc,Df,f(Nc,f(Of,e,kc(t)-e),t))}),Ff=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=kc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+kc(e)}),0,i),a)>-1))return Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:i}));var o=Bc(i),u=f(xc,Df,f(Nc,Pf(a),o)),s=Fc(u),c=f($f,s,n.state),d=Bf(c),h=f(Mf,a,o),p=Df,g=Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Vf=r(function(e,t){return _f(f(Ff,yc(Cc(f(xa,Sc,t))),xf(e)))}),Kf=Vf(dc),Hf=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,4,Kf(f(xa,yi,Zs(e)))))))},jf=function(e){return f(su,"0x",e)||f(su,"0X",e)?e:"0x"+e},qf=function(e){var t=e.a;return jf(t)},Gf=r(function(e,t){var r=Ms(f(xa,ac,t)),n=function(e){return U(e,r)}(cu(qf(Hf(e))));return nc(n)}),zf=function(e){return{data:si(f(Gf,"poke()",yr)),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yf=r(function(e,t){return D(t,{checked:e})}),Wf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Jf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Wf,f(zo,function(e){return e.type_},Ja(r)),function(e){return D(e,{options:l(Wf,f(zo,function(e){return e.label},Ja(n)),Yf(a),e.options)})},t)}),Qf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Xf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zf={$:"Descending"},el=function(e){return"Ascending"===e.$?Zf:Lo},tl=function(e){return d(Xf,e,Do,Fo,yr)},rl=r(function(e,t){return L(t.a,e(t.b))}),nl=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Xf,t,Do,Fo,M([da(f(Qf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(rl,el,t.orderBy):L(a,Lo);return tl(D(t,{orderBy:i}));default:return tl(t)}}),al=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},il=yn,ol=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=al(zf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(qo,a,n);return d(Oo,t,Do,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Oo,t,Do,Fo,M([da(f(Qf,o,u))]));case"FiltersMsg":var s=e.a;return Ho(D(t,{filters:f(Jf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(nl,c,t.tradeTable);return d(Oo,D(t,{tradeTable:l.model}),f(il,Ko,l.cmd),f(Yo,Ko,l.chainCmd),f(xa,Ji(Ko),l.appCmds));default:return Vo(t)}}),ul={$:"BottomRight"},sl={$:"ShouldBeImpossible"},cl=lr,fl=function(e){return qi(e)},ll=r(function(e,t){f(cl,e,t);return{align:ul,label:"unexpectedError",mainParagraphs:M([M([fl(e)])]),noticeType:sl}}),dl=function(e){var t=e.a;return jf(t)},hl=ye,pl=f(zo,dl,hl),gl=f(zo,Us,f(zo,jf,hl)),vl=f(zo,qf,hl),yl=f(zo,Ps,f(zo,jf,hl)),ml=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),bl=un,Cl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},El=function(e){return Cl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(xc,bl,r))},f(ml,function(e){e.a;return!R(e.b,ci)},e)))},Sl=function(e){return El(M([L("to",f(Bo,pl,e.to)),L("from",f(Bo,pl,e.from)),L("gas",f(Bo,yl,e.gas)),L("gasPrice",f(Bo,gl,e.gasPrice)),L("value",f(Bo,gl,e.value)),L("data",f(Bo,vl,e.data)),L("nonce",f(Bo,yl,e.nonce))]))},Tl=function(e){return{$:"TxSentry",a:e}},wl=ye,Il=r(function(e,t){return Cl(M([L("ref",wl(e)),L("txParams",t)]))}),Al=function(e){return{$:"Signing",a:e}},Bl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Al(e)}}),kl={$:"Black"},Nl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Rl={$:"RBEmpty_elm_builtin"},$l={$:"Red"},_l=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(Nl,$l,t,r,h(Nl,kl,c,f,l,d),h(Nl,kl,i,o,u,s))}return h(Nl,e,i,o,h(Nl,$l,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(Nl,$l,c,f,h(Nl,kl,g,v,y,m),h(Nl,kl,t,r,d,a))}return h(Nl,e,t,r,n,a)}),Ll=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Nl,$l,e,t,Rl,Rl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ku,e,a).$){case"LT":return h(_l,n,a,i,l(Ll,e,t,o),u);case"EQ":return h(Nl,n,a,t,o,u);default:return h(_l,n,a,i,o,l(Ll,e,t,u))}}),xl=n(function(e,t,r){var n=l(Ll,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(Nl,kl,a,i,o,u)}return n}),Pl=n(function(e,t,r){var n=e.a,a=Sl(r),i=l(xl,n.ref,f(Bl,r,t),n.txs);return L(Tl(D(n,{ref:n.ref+1,txs:i})),f(il,n.tagger,n.outPort(f(Il,n.ref,a))))}),Dl=Pl,Ul=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Do,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Dl,n,i,o))}return x(ci,Do,M([f(ll,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ol=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Ml=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Fl=function(e){return{$:"Posix",a:e}},Vl=Fl,Kl={autoabortInterval:Vl(0),autorecallInterval:Vl(0),autoreleaseInterval:Vl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Hl=function(e){return{$:"TokenValue",a:e}},jl=function(e){return e.a},ql=r(function(e,t){return f(xc,hs,f(Bo,Qa,f(Ts,e,t)))}),Gl=r(function(e,t){return Hl(f(ql,jl(e),qu(t)))}),zl=function(e){return f(Gl,e,12)},Yl=function(e){return f(Gl,e,3)},Wl=Hl(qu(0)),Jl=r(function(e,t){var r=Wl;return{abortPunishment:zl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Ql=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Xl=qr,Zl=function(e){var t=Ql(f(Xl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Qo(e)-1-r;return L(U(f(ru,r,e),f(Zo,r+1,e)),n)},ed=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 yr}}),td=function(e){var t=e.a,r=f(ed,Ja(0),t);return yu(r.b?t:yr)},rd=Z,nd=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}}}),ad=n(function(e,t,r){var n=f(nd,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(lc,e,r),l(ad,e,t,n)):yr}),id=r(function(e,t){return l(ad,e,e,t)}),od=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Bo,ka(a),r)});return f(La,t,si(yr))}(Ua),ud=function(e){return f(Bo,f(Da,td,yu),od(f(xa,f(zo,$a,f(zo,$s,rd)),f(id,7,$a(e)))))},sd=Q,cd=function(e){var t=Zs(sd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,Au(Uu),ud(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Bo,Au(Ou),ud(r))}return ci;default:var r=t;return f(Bo,Au(Ou),ud(r))}},fd=function(e){var t=function(e){return!f(_s,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(xc,0,Ql(r)))}},ld=function(e){return f(fs,e,e)},dd=qu(2),hd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ys;case"Neg":return wu;default:if(R(r,ys))return f(fs,e,t);if(fd(r)){var n=e,a=ld(t),i=f(ql,r,dd);e=n,t=a,r=i;continue e}var n=f(fs,t,e),a=ld(t),i=f(ql,f(ds,r,ys),dd);e=n,t=a,r=i;continue e}}),pd=r(function(e,t){return l(hd,ys,e,t)}),gd=function(e){if(""===e)return ci;var t=Zl(e),r=t.a,n=t.b,a=cd(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(fs,o,f(pd,qu(10),qu(i)));return si(u)},vd=function(e){return f(Bo,Hl,gd(e))},yd=jr,md=function(e){for(;;){if(f(yd,".",e))return l(Xo,0,-1,e);{if(!f(yd,"0",e))return""===e?"0":e;e=l(Xo,0,-1,e)}}},bd=f(Da,f(Rs,7,P("0")),Ni),Cd=function(e){return f(Ri,"",e)},Ed=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Cd(f(ka,Ni(n),f(xa,bd,a)))}return"0"},Sd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Ed(t);default:var t=e.a;return"-"+Ed(t)}},Td=r(function(e,t){return e<1?t:l(Xo,0,-e,t)}),wd=function(e){var t=l(Rs,18,P("0"),Sd(e)),r=f(Td,18,t)+"."+f(ou,18,t);return function(e){return""===e?"0":e}(md(r))},Id=r(function(e,t){var r=wd(t),n=Ql(f(Xl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(ru,a+1+e,r):f(ru,a,r)}),Ad=r(function(e,t){if("Nothing"===e.$)return wd(jl(t));var r=e.a;return f(Id,r,jl(t))}),Bd=ee,kd=function(e){var t=Bd(f(Ad,ci,e));if("Just"===t.$){return t.a}f(cl,"Error converting tokenValue to float: string -> float failed",e);return 0},Nd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=vd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return kd(r)<1?fi("Trade amount can't be less than 1."):li(r)},Rd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=cd(e);if("Nothing"===t.$){var r=Bd(e);return fi("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 li(n)},$d=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),_d=function(e){return""===e},Ld=function(e){return _d(e)?ci:si(e)},xd=function(e){return f($d,"You must specify a fiat type.",Ld(e))},Pd=function(e){return""===e?fi("Must specify a payment method."):li(e)},Dd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ud=g(Dd,ci,ci,ci,ci,ci,ci,ci),Od=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Md=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Fd={$:"Custom"},Vd=r(function(e,t){return{info:t,type_:e}}),Kd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Hd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),jd=function(e){return e.a},qd=function(e){return p(Kd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Vd,Fd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Hd,function(e){return D(Ud,{daiAmount:si(e)})},Nd(e.daiAmount)),f(Hd,function(e){return D(Ud,{fiatAmount:si(e)})},Rd(e.fiatAmount)),f(Hd,function(e){return D(Ud,{fiatType:si(e)})},xd(e.fiatType)),f(Hd,function(e){return D(Ud,{paymentMethod:si(e)})},Pd(e.paymentMethod)),Od(d(Md,function(e){return jd(e)>0?li(e):fi(D(Ud,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Gd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},zd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Yd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Wd=function(e){var t=qd(e.inputs),r=function(){return R(e.errors,Ud)?Ud:"Ok"===t.$?Ud:t.a}();return D(e,{createParameters:l(zd,Jl,Gd(e.wallet),Yd(t)),errors:r})},Jd=r(function(e,t){return Wd(D(t,{inputs:e}))}),Qd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Xd=function(e){return d(Qd,f(Jd,Kl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:Ud,inputs:Kl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Do,Fo,yr)},Zd=a(function(e,t,r,n){return la(d(Ol,e,t,r,n))}),eh=function(e){return{$:"Address",a:e}},th=f(zo,cu,f(zo,sd,eh)),rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return th("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return th("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return th("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return th("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nh=function(e){return th("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ah=function(e){return{$:"AddressE",a:e}},ih=ah,oh=function(e){return{$:"UintE",a:e}},uh=oh,sh=n(function(e,t,r){return{data:si(f(Gf,"approve(address,uint256)",M([ih(t),uh(r)]))),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ch=function(e){return f(Gl,e,200)},fh=r(function(e,t){return Hl(f(Xu,jl(e),jl(t)))}),lh=function(e){var t=f(Gl,e.tradeAmount,200);return f(fh,e.pokeReward,f(fh,ch(e.tradeAmount),f(fh,t,function(){return"Buyer"===e.initiatorRole.$?Yl(e.tradeAmount):e.tradeAmount}())))},dh=Mi(ya),hh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ph=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gh=Xn,vh=Qn,yh=function(e){return f(vh,{caseInsensitive:!1,multiline:!1},e)},mh=Jn,bh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ch=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}}),Eh=r(function(e,t){return!f(Ch,f(Da,ns,e),t)}),Sh=Eh(Ua),Th=q,wh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ih=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Ah=f(La,Ih(ka),li(yr)),Bh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},kh=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Nu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Nu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Nu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Nu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Nu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Nu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Nu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Nu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Nu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Nu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Nu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Nu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Nu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Nu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Nu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(As(s)+" is not a valid hexadecimal character.")}}}),Nh=function(e){if(_d(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(su,"-",e)){var t=f(xc,yr,Bh(Zs(e)));return f(au,iu,l(kh,Ti(t)-1,t,0))}return l(kh,Qo(e)-1,Zs(e),0)}();return f(Hd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rh=function(e){var t=Zs(e);return function(e){return L(t,e)}(f(wh,yr,Ah(f(xa,Nh,f(_i,"",f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,20,Kf(f(xa,f(zo,Th,yi),t))))))))))},$h=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Rh(cu(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!bh(e)&&Sh(o)},_h=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-f]{40}$"))),Lh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-F]{40}$"))),xh=function(e){return'"'+e+'"'},Ph=function(e){var t=cu(e),r=f(ru,24,t),n=f(ou,40,e);return 64===Qo(t)&&f(ki,Ja(P("0")),r)?Lh(n)||_h(n)?li(eh(n)):$h(n)?li(eh(n)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):40!==Qo(t)?fi("Given address "+xh(e)+" is not the correct length."):bh(t)?Lh(t)||_h(t)?li(eh(t)):$h(t)?li(eh(t)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):fi("Given address "+xh(e)+" contains invalid hex characters.")},Dh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),Ph(nu(r)))}),Uh=r(function(e,t){var r=t.a;return Wo(function(t){var n=t.a,a=t.b;return r(f(Jo,n,f(Zo,64*e,a)))})}),Oh=Jr,Mh=r(function(e,t){return f(Oh,"data",vu(f(Uh,e,t)))}),Fh=Qr,Vh=r(function(e,t){return f(Oh,"topics",f(Fh,e,vu(t)))}),Kh=function(e){return f(Bo,f(zo,$a,f(Ra,r(function(e,t){return f(Xu,qu(e),f(fs,t,ws))}),hs)),od(f(xa,f(zo,$a,f(zo,$s,f(zo,Nh,Yd))),f(id,8,$a(e)))))},Hh=function(e){var t=Zs(sd(e));e:for(;;){if(!t.b)return ci;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(Bo,fs(qu(-1)),Kh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Bo,fs(qu(-1)),Kh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Kh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kh(a)}t.b;return ci}break e;default:break e}}var a=t;return Kh(a)},jh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f($d,"Error Decoding Uint into BigInt",Hh(jf(nu(r)))))}),qh=f(dh,f(Vh,1,Dh),f(dh,f(Mh,1,Dh),f(dh,f(Mh,0,jh),Fi(hh)))),Gh=nn,zh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Yh=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(Gh,e,Cl(M([L("data",hl(t.data)),L("topics",f(zh,vl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Wh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Jh=r(function(e,t){return f(au,function(e){return e.id},f(Wh,function(e){return f(Hd,Di,f(Yh,qh,e).returnData)},f($d,"No log found from that factoryAddress in that txReceipt",Ql(f(ml,function(t){return R(f(zo,dl,sd)(t.address),f(zo,dl,sd)(rh(e)))},t.logs)))))}),Qh=n(function(e,t,r){return{data:si(f(Gf,"allowance(address,address)",M([ih(t),ih(r)]))),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Zh=function(e){switch(e.$){case"BlockNum":var t=e.a;return hl(jf(Ps(t)));case"EarliestBlock":return hl("earliest");case"LatestBlock":return hl("latest");default:return hl("pending")}},ep=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return El(M([L("to",f(Bo,pl,t)),L("from",f(Bo,pl,r)),L("gas",f(Bo,yl,n)),L("gasPrice",f(Bo,gl,a)),L("value",f(Bo,gl,i)),L("data",f(Bo,vl,o))]))},tp=function(e){return{$:"BadBody",a:e}},rp=function(e){return{$:"BadStatus",a:e}},np=function(e){return{$:"BadUrl",a:e}},ap={$:"NetworkError"},ip={$:"Timeout"},op=rn,up=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(np(r));case"Timeout_":return fi(ip);case"NetworkError_":return fi(ap);case"BadStatus_":var n=t.a,a=t.b;return fi(rp(n.statusCode));default:var n=t.a,a=t.b,i=f(op,f(Oh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(tp(Di(u)))}}),sp=n(function(e,t,r){return Cl(M([L("id",wl(e)),L("jsonrpc",hl("2.0")),L("method",hl(t)),L("params",f(zh,Ua,r))]))}),cp=Rl,fp=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ku,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),lp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},dp=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(Nl,$l,p,g,h(Nl,kl,r,n,h(Nl,$l,i,o,u,s),v),h(Nl,kl,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(Nl,kl,r,n,h(Nl,$l,i,o,u,s),h(Nl,$l,f,l,d,m))}return e},hp=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(Nl,$l,i,o,h(Nl,kl,s,c,f,l),h(Nl,kl,r,n,d,h(Nl,$l,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Nl,kl,r,n,h(Nl,$l,i,o,C,d),h(Nl,$l,g,v,y,m))}return e},pp=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(Nl,r,u,s,c,h(Nl,$l,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 hp(t)}break e}o.a,o.d;return hp(t)}break e}return t}),gp=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(Nl,t,r,n,gp(a),u)}var s=dp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(_l,c,f,l,gp(d),p)}return Rl}return h(Nl,t,r,n,gp(a),u)}return Rl},vp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Rl;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(Nl,r,n,a,f(vp,e,i),o)}var s=dp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(_l,c,l,d,f(vp,e,p),v)}return Rl}return h(Nl,r,n,a,f(vp,e,i),o)}return f(yp,e,g(pp,e,t,r,n,a,i,o))}),yp=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(R(e,n)){var u=lp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(_l,r,s,c,i,gp(o))}return Rl}return h(_l,r,n,a,i,f(vp,e,o))}return Rl}),mp=r(function(e,t){var r=f(vp,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(Nl,kl,n,a,i,o)}return r}),bp=n(function(e,t,r){var n=t(f(fp,e,r));if("Just"===n.$){var a=n.a;return l(xl,e,a,r)}return f(mp,e,r)}),Cp=function(e){return"Just"===e.$},Ep=gn,Sp=vn,Tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),wp=function(e){return{$:"BadUrl_",a:e}},Ip=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ap={$:"NetworkError_"},Bp=function(e){return{$:"Receiving",a:e}},kp=function(e){return{$:"Sending",a:e}},Np={$:"Timeout_"},Rp=function(e){return f(ta,"application/json",f(xi,0,e))},$p=n(function(e,t,r){return Rp(l(sp,e,t,r))}),_p=f(ea,"",Ua),Lp=Te,xp=Se,Pp=function(e){if("Ok"===e.$){var t=e.a;return xp(t)}var r=e.a;return Lp(r)},Dp=function(e){return l(Zn,gr,Pp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},Up=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Dp({body:l($p,1,r,n),headers:yr,method:"POST",resolver:_p(up(a)),timeout:ci,url:t})},Op=n(function(e,t,r){return Up({decoder:t.decoder,method:"eth_call",params:M([ep(t),Zh(r)]),url:e})}),Mp={$:"LatestBlock"},Fp=r(function(e,t){return l(Op,e,t,Mp)}),Vp=function(e){return{$:"Perform",a:e}},Kp=sn,Hp=xp(gr),jp=r(function(e,t){return f(Kp,function(t){return xp(e(t))},t)}),qp=n(function(e,t,r){return f(Kp,function(t){return f(Kp,function(r){return xp(f(e,t,r))},r)},t)}),Gp=function(e){return l(La,qp(ka),xp(yr),e)},zp=r(function(e,t){var r=t.a;return Be(f(Kp,Ep(e),r))}),Yp=n(function(e,t,r){return f(jp,function(e){return gr},Gp(f(xa,zp(e),t)))}),Wp=n(function(e,t,r){return xp(gr)}),Jp=r(function(e,t){var r=t.a;return Vp(f(jp,e,r))});pn.Task=Pe(Hp,Yp,Wp,Jp);var Qp=Ue("Task"),Xp=cn,Zp=r(function(e,t){return Qp(Vp(f(Xp,f(Da,f(Da,xp,e),fi),f(Kp,f(Da,f(Da,xp,e),li),t))))}),eg=a(function(e,t,r,n){return f(Zp,n,f(Fp,Xh(eo(e)),l(Qh,nh(e),t,r)))}),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return th("0x092110996699c3E06e998d89F0f4586026e44F0F")}},rg=function(e){return{$:"BoolE",a:e}},ng=rg,ag=function(e){return{$:"StringE",a:e}},ig=ag,og=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ug=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},sg=r(function(e,t){return{paymentMethods:t,price:e}}),cg=function(e){return hl(Sd(e))},fg=function(e){return f(zh,Ua,M([hl(e.fiatType),cg(e.amount)]))},lg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},dg=function(e){return Cl(M([L("type",hl(lg(e.type_))),L("info",hl(e.info))]))},hg=function(e){var t=fg(e.price),r=f(zh,dg,e.paymentMethods);return f(xi,0,Cl(M([L("paymentmethods",r),L("price",t)])))},pg=r(function(e,t){return D(t,{value:si(e)})}),gg=function(e){return qu(jd(e))},vg=function(e){return f(ql,gg(e),qu(1e3))},yg=r(function(e,t){var r=function(){return"Token"===e.$?og:ug}();return function(){return"Native"===e.$?pg(jl(lh(t))):Ua}()(r(rh(e))(t.initiatorAddress)(tg(e))(R(t.initiatorRole,lo))(jl(t.tradeAmount))(jl(Yl(t.tradeAmount)))(jl(zl(t.tradeAmount)))(jl(t.pokeReward))(vg(t.autorecallInterval))(vg(t.autoabortInterval))(vg(t.autoreleaseInterval))(jl(ch(t.tradeAmount)))(hg(f(sg,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),mg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),bg=function(e){return{$:"CreateNeedsSig",a:e}},Cg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Eg=r(function(e,t){var r=al(f(yg,e,t)),n={onBroadcast:ci,onMined:si(L(mg(e),ci)),onSign:si(Cg(e))};return L(si(bg(e)),f(qo,n,r))}),Sg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wg=function(e){return{$:"ApproveNeedsSig",a:e}},Ig=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Bg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),kg={$:"NoOp"},Ng=function(e){return{appCmds:yr,chainCmd:Fo,cmd:Do,model:e}},Rg=function(e){return rd(Sd(e))},$g={$:"Error"},_g=r(function(e,t){f(cl,e+" fetch error",t);return{align:ul,label:"web3FetchError",mainParagraphs:M([M([fl('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:$g}}),Lg=r(function(e,t){return{align:ul,label:"web3MiningError",mainParagraphs:M([M([fl('Error mining "'+e+'" transaction: '+t)])]),noticeType:$g}}),xg={$:"Caution"},Pg=r(function(e,t){return{align:ul,label:"web3SigError",mainParagraphs:M([M([fl('Error signing "'+e+'" transaction: '+t)])]),noticeType:xg}}),Dg={$:"KovanDai"},Ug=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Dg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Og=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Mg=function(e){return f(Io,Ug,Og(e))},Fg=r(function(e,t){return 1-e(1-t)}),Vg=function(e){return f(Nu,e,5)},Kg=Fg(Vg),Hg={easing:Kg,offset:12,speed:200},jg=function(e){return{$:"External",a:e}},qg=function(e){return{$:"Internal",a:e}},Gg=function(e){return{$:"NotFound",a:e}},zg=function(e){for(;;){e=e.a}},Yg=r(function(e,t){return Qp(Vp(f(jp,e,t)))}),Wg={$:"Http"},Jg={$:"Https"},Qg=Kr,Xg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Zg=i(function(e,t,r,n,a){if(_d(a)||f(Qg,"@",a))return ci;var i=f(Xl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=rd(f(Zo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Xg,e,f(ru,o,a),s,t,r,n))}return si(p(Xg,e,a,ci,t,r,n))}),ev=a(function(e,t,r,n){if(_d(n))return ci;var a=f(Xl,"/",n);if(a.b){var i=a.a;return h(Zg,e,f(Zo,i,n),t,r,f(ru,i,n))}return h(Zg,e,"/",t,r,n)}),tv=n(function(e,t,r){if(_d(r))return ci;var n=f(Xl,"?",r);if(n.b){var a=n.a;return d(ev,e,si(f(Zo,a+1,r)),t,f(ru,a,r))}return d(ev,e,ci,t,r)}),rv=r(function(e,t){if(_d(t))return ci;var r=f(Xl,"#",t);if(r.b){var n=r.a;return l(tv,e,si(f(Zo,n+1,t)),f(ru,n,t))}return l(tv,e,ci,t)}),nv=function(e){return f(su,"http://",e)?f(rv,Wg,f(Zo,7,e)):f(su,"https://",e)?f(rv,Jg,f(Zo,8,e)):ci},av=Wt,iv=Gt(zt),ov=sa,uv=r(function(e,t){return L(e,t)}),sv=_r,cv=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=ju(r-n),o=f(ei,1,sv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),fv=r(function(e,t){var n=r(function(t,r){return Gp(f(xa,ov(0),d(cv,e.speed,e.easing,t,r-e.offset)))});return f(Kp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(qp,uv,iv,av(t)))}),lv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Gd(t.wallet),Mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(eg,a,n.address,rh(eo(a)),Sg(a));return d(Qd,t,i,Fo,yr)}return Ng(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Qd,D(t,{inputs:D(u,{userRole:o})}),Do,Fo,M([function(){return"Buyer"===o.$?d(Zd,"create offer type changed","input","sell dai",0):d(Zd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ng(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ng(f(Jd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Qd,(g?Jd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Do,Fo,g?M([d(Zd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=qd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jl,n,m);return Ng(D(t,{depositAmount:si(jl(lh(b))),txChainStatus:si(f(Ag,v,b))}))}var C=y.a;return d(Qd,D(t,{errors:C}),f(Zp,ms(kg),function(){return f(fv,D(Hg,{offset:60}),"inputError")}()),Fo,yr);case"AbortCreate":return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([d(Zd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Eg,v,b);var e=v.a,r=function(){var t=al(l(sh,nh(e),rh(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Ig,e,b))};return f(qo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(ts,a,E),ba)?L(si(wg(e)),r):f(Eg,v,b)}return L(si(wg(e)),r)}(),T=S.a,w=S.b;return d(Qd,D(t,{txChainStatus:T}),Do,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(l(Tg,a,b,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(ts,N,P),ba))return Ng($);var U=f(Eg,eo(a),b),T=U.a,w=U.b;return d(Qd,D($,{txChainStatus:T}),Do,w,yr)}return Ng($)}var O=k.a;return d(Qd,t,Do,Fo,M([pa(f(_g,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(f(Bg,v,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Qd,t,Do,Fo,M([pa(f(Lg,"create",B))]))}var F=e.a,V=e.b.a,K=f(Io,Rg,Yd(f(Jh,F,V)));if("Just"===K.$){var H=K.a;return d(Qd,t,Do,Fo,M([da(f(Qf,F,H))]))}return d(Qd,t,Do,Fo,M([pa(f(ll,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Qd,t,Do,Fo,M([ga]));case"NoOp":return Ng(t);default:var j=e.a;return d(Qd,t,Do,Fo,M([j]))}}),dv=r(function(e,t){return f(Eh,function(e){return f(Ch,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),hv=r(function(e,t){return f(Ku,jd(e),jd(t))}),pv=r(function(e,t){return R(f(hv,t.derived.phaseEndTime,e),Ta)}),gv=function(e){if(""===e)return li(ci);var t=vd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},vv=r(function(e,t){return{maxDai:t,minDai:e}}),yv=f(vv,ci,ci),mv=function(e){return l(Ih,r(function(t,r){return{dai:{max:r,min:t},fiatType:Ld(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Hd,function(e){return D(yv,{minDai:si(e)})},gv(e.minDai)),f(Hd,function(e){return D(yv,{maxDai:si(e)})},gv(e.maxDai)))},bv=r(function(e,t){var r=function(t){return f(Eh,function(e){return f(Qg,sd(e),sd(t))},e)};return f(Ch,function(e){return r(e.info)},t)}),Cv=r(function(e,t){return D(t,{paymentMethod:e})}),Ev=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Sv=r(function(e,t){return f(ts,jl(e),jl(t))}),Tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return wv(D(e,{inputs:f(Ev,r,f(Cv,"",e.inputs))}))},wv=function(e){var t=Tv(e),n=mv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(bv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(pv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(dv,t.filters,r)});return D(t,{filterFunc:s})},Iv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Av={$:"Expires"},Bv=function(e){return L(wv({errors:yv,filterFunc:pv,filters:co(M([f(vo,!0,!0),d(So,!0,!1,!1,!1)])),inputs:Iv,showCurrencyDropdown:!1,tradeTable:_o(L(Av,Lo)),wallet:e}),Do)},kv=r(function(e,t){var r=f(ml,wc(e),t.inputs.paymentMethodTerms);return wv(D(t,{inputs:f(Ev,r,t.inputs)}))}),Nv=function(e){return wv(D(e,{filterFunc:pv,inputs:Iv}))},Rv=function(e){return{$:"TradeTableMsg",a:e}},$v=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),_v=function(e){return d($v,e,Do,Fo,yr)},Lv=r(function(e,t){return D(t,{fiatType:e})}),xv=r(function(e,t){return D(t,{maxDai:e})}),Pv=r(function(e,t){return D(t,{minDai:e})}),Dv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return _v(D(t,{inputs:f(Pv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return _v(D(t,{inputs:f(xv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return _v(D(t,{inputs:f(Lv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return _v(D(t,{inputs:(n?Lv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return _v(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return _v(D(t,{inputs:f(Cv,r,t.inputs)}));case"AddSearchTerm":return _v(Tv(t));case"RemoveTerm":var a=e.a;return _v(f(kv,a,t));case"ApplyInputs":return d($v,wv(t),Do,Fo,yr);case"ResetSearch":return _v(Nv(t));case"FiltersMsg":var i=e.a;return _v(wv(D(t,{filters:f(Jf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(nl,o,t.tradeTable);return d($v,D(t,{tradeTable:u.model}),f(il,Rv,u.cmd),f(Yo,Rv,u.chainCmd),f(xa,Ji(Rv),u.appCmds));case"NoOp":return _v(t);default:var s=e.a;return d($v,t,Do,Fo,M([s]))}}),Uv=a(function(e,t,r,n){return e(Cl(M([L("title",hl(t)),L("body",function(){if("Nothing"===r.$)return bl;var e=r.a;return hl(e)}()),L("image",function(){if("Nothing"===n.$)return bl;var e=n.a;return hl(e)}())])))}),Ov=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Mv=function(e){return e.a+"="+e.b},Fv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Mv,e)):""},Vv=r(function(e,t){return"/"+(f(Ri,"/",e)+Fv(t))}),Kv=function(e){switch(e.$){case"Home":return f(Vv,M(["DAIHard"]),yr);case"Create":return f(Vv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Vv,M(["DAIHard","trade",Ov(t),Ni(r)]),yr);case"Marketplace":return f(Vv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Vv,M(["DAIHard","history",dl(n)]),yr);default:return f(Vv,yr,yr)}},Hv={$:"NotFound"},jv=function(e){return{$:"AgentHistory",a:e}},qv={$:"Create"},Gv={$:"Home"},zv={$:"Marketplace"},Yv=function(e){return{$:"Parser",a:e}},Wv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Jv=r(function(e,t){return Yv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Wv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Qv=f(Jv,"ADDRESS",f(zo,Ph,Yd)),Xv={$:"Eth"},Zv={$:"Kovan"},ey=f(Jv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Xv));case"keth":return si(Zi(Zv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Dg));case"xdai":return si(Zi(to));default:return ci}}),ty=f(Jv,"NUMBER",rd),ry=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Wv,r,n,a,i,e(o))}),ny=r(function(e,t){var r=t.a;return Yv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,ry(u),r(h(Wv,n,a,i,o,e)))})}),ay=function(e){return l(La,oo,yr,e)},iy=r(function(e,t){return ay(f(xa,e,t))}),oy=function(e){return Yv(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 R(u,e)?M([h(Wv,f(ka,u,r),s,a,i,o)]):yr}return yr})},uy=r(function(e,t){var r=e.a,n=t.a;return Yv(function(e){return f(iy,n,r(e))})}),sy=Yv(function(e){return M([e])}),cy=f(uy,oy("DAIHard"),function(e){return Yv(function(t){return f(iy,function(e){return(0,e.a)(t)},e)})}(M([f(ny,Gv,sy),f(ny,qv,oy("create")),f(ny,Qf,f(uy,oy("trade"),f(uy,ey,ty))),f(ny,zv,oy("marketplace")),f(ny,jv,f(uy,oy("history"),Qv)),f(ny,function(e){return jv(e)},f(uy,oy("history"),Qv))]))),fy=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 si(t.value)}return si(t.value)}return ci}},ly=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ly(r))}return yr}return yr},dy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ly(r)}var r=t;return ly(r)},hy=Qt,py=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),gy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=hy(n);if("Nothing"===o.$)return t;var u=o.a,s=hy(i);if("Nothing"===s.$)return t;var c=s.a;return l(bp,u,py(c),t)}return t}),vy=function(e){if("Nothing"===e.$)return cp;var t=e.a;return l(La,gy,cp,f(_i,"&",t))},yy=r(function(e,t){var r=e.a;return fy(r(h(Wv,yr,dy(t.path),vy(t.query),t.fragment,Ua)))}),my=function(e){return f(xc,Hv,f(yy,cy,e))},by=aa,Cy=r(function(e,t){return f(by,e,Kv(t))}),Ey=je("connectToWeb3",function(e){return bl}),Sy=function(e){return Cl(M([L("event",hl(e.event)),L("category",hl(e.category)),L("label",hl(e.label)),L("value",wl(e.value))]))},Ty=r(function(e,t){return Cl(M([L("address",hl(dl(e))),L("signSeedMsg",hl(t))]))}),wy=je("gTagOut",Ua),Iy=je("genPrivkey",Ua),Ay=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),By=n(function(e,t,r){return f(Io,Zc(t),f(Bo,function(e){return e.trades},f(Ay,function(t){return R(t.factory,e)},r)))}),ky=je("notifyPort",Ua),Ny=je("requestNotifyPermissionPort",function(e){return bl}),Ry=r(function(e,t){return D(t,{wallet:e})}),$y=r(function(e,t){return L(f(Jd,t.inputs,D(t,{wallet:e})),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(eg,n,r.address,rh(eo(n)),Sg(n))}return Do}())}),_y=r(function(e,t){return D(t,{wallet:e})}),Ly=function(e){return{$:"AllowanceFetched",a:e}},xy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Gd(e),Mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Mg(e),si(i.factory))?d(eg,a,n.address,i.creationInfo.address,Ly):Do}return Do}())}),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{$:"TradeModel",a:e}},Fy=function(e){return{$:"TradeMsg",a:e}},Vy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Do);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Dy(a),f(il,Uy,i));case"TradeModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(il,Fy,c));case"MarketplaceModel":var l=t.a;return L(Oy(f(_y,e,l)),Do);default:var d=t.a;return L(Py(f(Ry,e,d)),Do)}}),Ky=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Hy=function(e){return{$:"PartiallyLoadedTrade",a:e}},jy=r(function(e,t){return Hy(g(Ky,e,t,ci,ci,ci,ci,ci))}),qy=function(e){return{$:"CurrentBlockFetched",a:e}},Gy=gu(f(zo,cu,Nh)),zy=function(e){return Up({decoder:Gy,method:"eth_blockNumber",params:yr,url:e})},Yy=function(e){return f(Zp,qy,zy(e))},Wy=r(function(e,t){return{address_:e,blocknum:t}}),Jy=function(e){return Wo(function(t){return li(L(t,e))})},Qy=n(function(e,t,r){var n=t.a,a=r.a;return Wo(function(t){return f(Wh,function(t){var r=t.a,n=t.b;return f(au,rl(e(n)),a(r))},n(t))})}),Xy=r(function(e,t){return l(Qy,r(function(e,t){return e(t)}),t,e)}),Zy=vu(f(Xy,jh,f(Xy,Dh,Jy(Wy)))),em=r(function(e,t){return{data:si(f(Gf,"createdTrades(uint256)",M([uh(t)]))),decoder:Zy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tm=n(function(e,t,r){return f(Zp,r,f(Fp,Xh(e),f(em,rh(e),t)))}),rm=function(e){return{$:"CreationInfoFetched",a:e}},nm=r(function(e,t){return l(tm,e,qu(t),rm)}),am=function(e){return{$:"EventSentryMsg",a:e}},im=function(e){return{$:"BlockNumber",a:e}},om=function(e){return{$:"EventSentry",a:e}},um=function(e){return{$:"Set_elm_builtin",a:e}},sm=um(cp),cm=r(function(e,t){return L(om({blockNumber:ci,errors:yr,nodePath:t,pending:sm,ref:1,requests:cp,tagger:e,watching:sm}),f(Zp,f(zo,im,e),zy(t)))}),fm=function(e){return f(cm,am,Xh(e))},lm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},hm=dm(f(lm,ci,ci)),pm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:Co,secureCommInfo:hm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),gm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),vm=n(function(e,t,r){var n=f(nm,t,r),a=fm(t),i=a.a,o=a.b;return d(gm,l(pm,f(jy,t,r),i,e),Po(M([n,o,Yy(Xh(t))])),Fo,M([ha]))}),ym=function(e){return{$:"LoadedTrade",a:e}},mm=function(e){return{$:"EventLogFetched",a:e}},bm=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),Cm=ue,Em=ce,Sm=Yr,Tm=n(function(e,t,r){var n=function(e){return Em(M([e,Cm(r)]))};return f(du,function(a){var i=f(Gh,e,a);if("Ok"===i.$){var o=i.a,u=f(Gh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return hu(Di(c))}return Fi(r)},Sm)}),wm=a(function(e,t,r,n){return f(dh,l(Tm,f(Oh,e,Sm),t,r),n)}),Im=n(function(e,t,r){return f(dh,f(Oh,e,t),r)}),Am=gu(Ph),Bm=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),km=function(e){return{$:"BlockHash",a:e}},Nm=function(e){return Bm(e)?li(km(cu(e))):fi("Given blockHash "+xh(e)+" is not valid.")},Rm=gu(Nm),$m=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),_m=function(e){return $m(e)?li(nc(cu(e))):fi("Something in here is not very hexy: "+xh(e))},Lm=gu(_m),xm=function(e){return{$:"TxHash",a:e}},Pm=function(e){return Bm(e)?li(xm(cu(e))):fi("Given txHash "+xh(e)+" is not valid.")},Dm=gu(Pm),Um=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}}),Om=zr,Mm=oe,Fm=l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionHash",Dm,l(Im,"transactionIndex",Gy,l(Im,"logIndex",Gy,d(wm,"removed",Om,!1,l(Im,"topics",Mm(Lm),l(Im,"data",pu,l(Im,"address",Am,Fi(Um)))))))))),Vm=function(e){return f(zh,function(e){if("Just"===e.$){var t=e.a;return hl(qf(t))}return bl},e)},Km=function(e){return Cl(M([L("fromBlock",Zh(e.fromBlock)),L("toBlock",Zh(e.toBlock)),L("address",pl(e.address)),L("topics",Vm(e.topics))]))},Hm=r(function(e,t){return Up({decoder:Mm(Fm),method:"eth_getLogs",params:M([Km(t)]),url:e})}),jm=function(e){return{$:"BlockNum",a:e}},qm=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Kp,function(r){return f(jp,vi(r),f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)})))},f(Hm,e,t)):f(Hm,e,t)}),Gm=r(function(e,t){var r=t.a;return um(l(xl,e,gr,r))}),zm=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(xl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(om(D(o,{watching:f(Gm,a.ref,o.watching)})),f(Zp,f(zo,bm(a.ref),a.tagger),e),a.ref)}(l(qm,a.nodePath,n,L(s,s)))}return x(om(D(o,{pending:f(Gm,a.ref,o.pending)})),Do,a.ref)}),Ym=zm(!1),Wm=r(function(e,t){var r=function(){var e=fm(t.factory),r=e.a,n=e.b;return function(e){var t=e.a,r=e.b,a=e.c;return x(t,Po(M([n,r])),a)}(l(Ym,mm,r,{address:t.creationInfo.address,fromBlock:jm(t.creationInfo.blocknum),toBlock:Mp,topics:yr}))}(),n=r.a,a=r.b;return d(gm,l(pm,ym(t),n,e),Po(M([a,Yy(Xh(t.factory))])),Fo,M([ha]))}),Jm=function(e){return{data:si(f(Gf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Qm=function(e){return{data:si(f(Gf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Xm=function(e){return{data:si(f(Gf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Zm=r(function(e,t){return{data:si(f(Gf,"initiatorStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),eb=function(e){return{data:si(f(Gf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},tb=function(e){return{data:si(f(Gf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},rb=r(function(e,t){return{data:si(f(Gf,"responderStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),nb=r(function(e,t){return{amount:t,fiatType:e}}),ab=f(du,function(e){var t=cd(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("Can't convert that to a BigInt")},pu),ib=l(Mi,nb,f(Fh,0,pu),f(Fh,1,ab)),ob={$:"Bank"},ub={$:"Cash"},sb=function(e){switch(e){case"cash":return si(ub);case"bank":return si(ob);case"custom":return si(Fd);default:return ci}},cb=f(du,function(e){var t=sb(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("")},pu),fb=l(Mi,Vd,f(Oh,"type",cb),f(Oh,"info",pu)),lb=function(e){var t=l(Mi,sg,f(Oh,"price",ib),f(Oh,"paymentmethods",Mm(fb)));return f(op,t,e)},db=r(function(e,t){return{commPubkey:t,responder:e}}),hb=r(function(e,t){var n=r(function(t,r){return l(Xo,t,t+2*r,e)}),a=f(zo,Nh,au(ti(2)));return f(Wh,function(t){return f(au,function(e){return f(n,t+64,e)},Nh(l(Xo,t,t+64,e)))},a(t))}),pb=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),gb=n(function(e,t,r){var n=l(Ra,pb(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),vb=j,yb=function(e){return As(vb(e))},mb=function(e){return l(gb,r(function(e,t){return U(t,yb(e))}),"",e)},bb=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f(Wh,mb,f(Wh,f(zo,xa(Nh),Ah),f(au,ml(f(zo,_d,ns)),f(au,tc(2),f(hb,t,nu(r)))))))}),Cb=f(dh,f(Mh,1,bb),f(dh,f(Mh,0,Dh),Fi(db))),Eb=r(function(e,t){return{commPubkey:t,terms:e}}),Sb=f(dh,f(Mh,1,bb),f(dh,f(Mh,0,bb),Fi(Eb))),Tb=function(e){return{statement:e}},wb=f(dh,f(Mh,0,bb),Fi(Tb)),Ib=function(e){return{statement:e}},Ab=f(dh,f(Mh,0,bb),Fi(Ib)),Bb={$:"AbortedEvent"},kb={$:"BurnedEvent"},Nb={$:"ClaimedEvent"},Rb=function(e){return{$:"CommittedEvent",a:e}},$b=function(e){return{$:"InitiatedEvent",a:e}},_b=function(e){return{$:"InitiatorStatementLogEvent",a:e}},Lb={$:"PokeEvent"},xb={$:"RecalledEvent"},Pb={$:"ReleasedEvent"},Db=function(e){return{$:"ResponderStatementLogEvent",a:e}},Ub=f(Oh,"topics",f(Fh,0,Lm)),Ob=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),Kf(f(xa,yi,Zs(e))))))},Mb=f(du,function(e){return R(e,Ob("Initiated(string,string)"))?f(Oi,$b,Sb):R(e,Ob("Committed(address,string)"))?f(Oi,Rb,Cb):R(e,Ob("Recalled()"))?Fi(xb):R(e,Ob("Claimed()"))?Fi(Nb):R(e,Ob("Aborted()"))?Fi(Bb):R(e,Ob("Released()"))?Fi(Pb):R(e,Ob("Burned()"))?Fi(kb):R(e,Ob("InitiatorStatementLog(string)"))?f(Oi,_b,wb):R(e,Ob("ResponderStatementLog(string)"))?f(Oi,Db,Ab):R(e,Ob("Poke()"))?Fi(Lb):hu("Unrecognized topic hash")},Ub),Fb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},Vb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},Kb=function(e){return R(e.buyerDeposit,Yl(e.tradeAmount))&&R(e.abortPunishment,zl(e.tradeAmount))},Hb={$:"Invalid"},jb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),qb=r(function(e,t){return Vl(jd(t)+jd(e))}),Gb=function(e){var t=Bd(Sd(e.amount));if("Just"===t.$){return t.a}f(cl,"Error converting FiatValue to float--string -> float failed!",e);return 0},zb=r(function(e,t){return(t-e)/e}),Yb=r(function(e,t){var r=Gb(t),n=kd(e);return"USD"===t.fiatType?si(f(zb,n,r)):ci}),Wb=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 Vl(0)}}();return{margin:f(Yb,e.tradeAmount,r.price),phaseEndTime:function(){return"Closed"===t.phase.$?Vl(f(Nu,2,53)-1):f(qb,t.phaseStartTime,n)}()}}),Jb=function(e){var t=x(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 ym(v(jb,e.factory,e.id,n,a,o,u,s,l(Wb,a,o,u)))}return Hy(e)},Qb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(cl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Hb}}),Xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Hb}}),Zb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Hb}}),eC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return ym(D(n,{state:e}));default:return Hb}}),tC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Hb}}),rC=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}}),nC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,uu,f(Xy,Dh,Jy(rC))))))))))),aC=function(e){return{data:si(f(Gf,"getParameters()",yr)),decoder:nC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},iC=function(e){return f(Bo,function(e){return Vl(1e3*e)},rd(Sd(e)))},oC=function(e){return Hl(e)},uC=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),sC=function(e){var t=f($d,"error converting BigInt to Time.Posix",iC(e.autoabortInterval)),r=f($d,"error converting BigInt to Time.Posix",iC(e.autoreleaseInterval)),a=f($d,"error converting BigInt to Time.Posix",iC(e.autorecallInterval));return d(uC,n(function(t,r,n){return{abortPunishment:oC(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:oC(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:oC(e.pokeReward),tradeAmount:oC(e.tradeAmount)}}),a,t,r)},cC=n(function(e,t,r){return f(Zp,r,f(jp,sC,f(Fp,Xh(e),aC(t))))}),fC=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}}}}}}}}}}},lC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(fC)))))))))))),dC=function(e){return{data:si(f(Gf,"getPhaseStartInfo()",yr)),decoder:lC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},hC=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),pC=function(e){return h(hC,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}}),iC(e.v6),iC(e.v7),iC(e.v8),iC(e.v9))},gC=n(function(e,t,r){return f(Zp,r,f(jp,pC,f(Fp,Xh(e),dC(t))))}),vC=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),yC=vu(f(Xy,jh,f(Xy,Dh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(vC))))))),mC=function(e){return{data:si(f(Gf,"getState()",yr)),decoder:yC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},bC={$:"Aborted"},CC={$:"Burned"},EC={$:"NotClosed"},SC={$:"Recalled"},TC={$:"Released"},wC=function(e){switch(f(xc,99,rd(Sd(e)))){case 0:return si(EC);case 1:return si(SC);case 2:return si(bC);case 3:return si(TC);case 4:return si(CC);default:return ci}},IC=function(e){switch(f(xc,99,rd(Sd(e)))){case 1:return si(Co);case 2:return si(mo);case 3:return si(bo);case 4:return si(yo);default:return ci}},AC=function(e){return R(e,th("0x0000000000000000000000000000000000000000"))?ci:si(e)},BC=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),kC=function(e){var t=iC(e.phaseStartTimestamp),r=IC(e.phase),a=wC(e.closedReason);return d(BC,n(function(t,r,n){return{balance:oC(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:AC(e.responder)}}),r,t,a)},NC=n(function(e,t,r){return f(Zp,r,f(jp,kC,f(Fp,Xh(e),mC(t))))}),RC=i(function(e,t,r,n,a){return Po(M([l(cC,e,t,r),l(NC,e,t,n),l(gC,e,t,a)]))}),$C=function(e){var t=Rg(e);if("Just"===t.$){return t.a}f(cl,"Warning! BigInt to Int conversion failed!",Sd(e));return 0},_C=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),LC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),xC=function(e){return e.b?l(LC,e,yr,0):qa},PC=tn,DC=function(e){var t=h(PC,_C,f(Oh,"encapsulation",pu),f(Oh,"iv",pu),f(Oh,"tag",pu),f(Oh,"encrypted",pu)),r=Mm(t),n=f(Gh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Zc,0,e),f(Zc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(xC(i))},UC=function(e){var t=function(e){var t=Qo(e);return t>1114111?fi("string is too long"):li(f(Is,vb(t),e))};return f(au,Ri(""),Ah(f(xa,t,e)))},OC=function(e){var t=e.a,r=e.b;return UC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},MC=r(function(e,t){return Cl(M([L("message",hl(e)),L("pubkeyHexStrings",f(zh,hl,M([t.initiatorPubkey,t.responderPubkey])))]))}),FC=function(e){return{$:"LoadedCommInfo",a:e}},VC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),KC=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 FC(f(VC,r,n))}return dm(e)},HC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return FC(D(n,{initiatorPubkey:e}))}),jC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{responderPubkey:si(e)}))}var n=t.a;return FC(D(n,{responderPubkey:e}))}),qC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),GC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(nd,a,n),o=$s(f(lc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),zC=function(e){var t=xC(f(GC,Zs(e),yr));return l(zd,uv,h(hC,_C,f(Zc,0,t),f(Zc,1,t),f(Zc,2,t),f(Zc,3,t)),h(hC,_C,f(Zc,4,t),f(Zc,5,t),f(Zc,6,t),f(Zc,7,t)))},YC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),WC={$:"Aborted"},JC={$:"Burned"},QC={$:"Claimed"},XC=function(e){return{$:"Committed",a:e}},ZC=function(e){return{$:"Encrypted",a:e}},eE={$:"FailedDecode"},tE={$:"Initiated"},rE={$:"Recalled"},nE={$:"Released"},aE=function(e){return{$:"StateChange",a:e}},iE=function(e){return{$:"Statement",a:e}},oE=fr,uE=cr,sE=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(oE,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(uE,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),cE=or,fE=y,lE=a(function(e,t,r,n){var a=Wc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(cE,Ga(r),n);var i=za(d(lE,e-Ha,t,r,ja));return f(cE,i,n)}var o=f(Jc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(lE,e-Ha,t,r,u));return l(rf,a,i,n)}var i=za(d(lE,e-Ha,t,r,fE(o)));return l(rf,a,i,n)}),dE=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(lE,c,r,e,fE(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(lE,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),hE=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(oE,32,r,e),o=f(dE,i,t);if(a<0){var u=l(uE,a,n,e);return f(dE,u,o)}return o}),pE=ur,gE=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(pE,i,t,r)}return f(ka,e,t)});return{nodeList:l(pE,i,yr,n),nodeListSize:t/32|0,tail:a}},vE=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(pE,o,t,r)}var n=e.a;return f(hE,n,t)});return f(hE,i,l(pE,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(pE,o,t,r)}var n=e.a;return f(sE,n,t)});return f(ai,!0,f(sE,i,l(pE,o,gE(e),a)))}),yE=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),mE=f(La,yE,yr),bE=n(function(e,t,r){var n=qC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(aE(tE));case"CommittedEvent":var r=t.a;return si(aE(XC(r.responder)));case"RecalledEvent":return si(aE(rE));case"ClaimedEvent":return si(aE(QC));case"AbortedEvent":return si(aE(WC));case"ReleasedEvent":return si(aE(nE));case"BurnedEvent":return si(aE(JC));case"InitiatorStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(To)}));case"ResponderStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(wo)}));default:return ci}}(),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(vE,r.history,xC(mE(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Bo,YC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),mE(M([s])))}),CE=Gr,EE=function(e){var t=l(Mi,uv,f(Oh,"id",CE),f(Oh,"message",pu));return f(Hd,Di,f(Gh,t,e))},SE=function(e){return{$:"Decrypted",a:e}},TE=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),wE=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(bE,n,a,t),o=i.a,u=i.b,s=i.c;return d(TE,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(TE,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(TE,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=EE(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Zc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:SE(y)}),T=D(b,{eventInfo:iE(S)}),w=l(af,v,T,t.history);return d(TE,D(t,{history:w}),!1,ci,yr)}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an event that is not a message!",b))]))}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(TE,t,!1,ci,M([pa(f(ll,"Error decoding decryption result",I))]))}}),IE=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),AE=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),BE=function(e){return{onBroadcast:ci,onMined:si(L(IE(e),ci)),onSign:si(AE(e))}},kE=je("encryptToPubkeys",Ua),NE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),RE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),$E=function(e){return{$:"CommitMined",a:e}},_E={$:"CommitNeedsSig"},LE=function(e){return{$:"CommitSigned",a:e}},xE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?RE:NE}(),a=al(function(){return"Token"===e.factory.$?Ua:pg(jl(Fb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(_E),f(qo,{onBroadcast:ci,onMined:si(L($E,ci)),onSign:si(LE)},a))}),PE=r(function(e,t){return Cl(M([L("id",wl(e)),L("encapsulation",hl(t.encapsulatedKey)),L("iv",hl(t.iv)),L("tag",hl(t.tag)),L("encrypted",hl(t.message))]))}),DE=je("decryptMessage",Ua),UE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},OE=r(function(e,t){return Po(f(xa,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 DE(f(PE,r,s))}return Do}return Do},UE(e.history)))}),ME=function(e){if("Just"===e.$){return e.a}return ci},FE=function(e){var t=ME(l(zd,Ao,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Bo,function(e){return e.address},Gd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(OE,n,a)}return Do},VE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(bE,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),KE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),HE=i(function(e,t,r,n,a){return f(VE,n,p(KE,e,r,t,qa,a,""))}),jE=function(e){return{$:"ChatHistoryMsg",a:e}},qE=a(function(e,t,r,n){var a=x(t,Gd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(ko,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(jE),n))}(h(HE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),GE={$:"Abort"},zE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),YE=function(e){return{$:"ActionNeedsSig",a:e}},WE=function(e){return{$:"ApproveMining",a:e}},JE={$:"ApproveNeedsSig"},QE=function(e){return{$:"ApproveSigned",a:e}},XE={$:"Burn"},ZE={$:"Claim"},eS=function(e){return{$:"CommitMining",a:e}},tS=function(e){return{$:"ConfirmingAction",a:e}},rS=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),nS=function(e){return{$:"ParametersFetched",a:e}},aS=function(e){return{$:"PhaseInfoFetched",a:e}},iS={$:"Poke"},oS={$:"Recall"},uS={$:"Release"},sS=function(e){return{$:"StartContractAction",a:e}},cS=function(e){return{$:"StateFetched",a:e}},fS=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"}},lS=function(e){return d(gm,e,Do,Fo,yr)},dS={align:ul,label:"cantFindTradeWillRetry",mainParagraphs:M([M([fl("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:$g},hS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(_g,e,r)}if("Nothing"===t.a.$){t.a;return f(ll,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ll,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),pS={align:ul,label:"tradeParametersNotDefault",mainParagraphs:M([M([fl("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:$g},gS=eo(Xi),vS=n(function(e,t,r){return l(bp,e,Bo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),yS=r(function(e,t){var r=t.a;return um(f(mp,e,r))}),mS=n(function(e,t,r){var n=e.a,a=f(fp,t,n.requests);if("Nothing"===a.$)return L(om(n),Do);var i=a.a,o=L(i.watchOnce,Ql(r));if("Nothing"===o.b.$){o.b;return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Do)}if(o.a){var u=o.b.a;return L(om(D(n,{requests:l(vS,t,r,n.requests),watching:f(yS,t,n.watching)})),f(Yg,i.tagger,xp(u)))}return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Po(f(xa,function(e){return f(Yg,i.tagger,xp(e))},r)))}),bS=_e,CS=r(function(e,t){return f(Zp,f(zo,im,t),f(Kp,function(t){return zy(e)},bS(2e3)))}),ES=n(function(e,t,r){var n=r.a,a=r.b;return f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)}))}),SS=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(SS,e,t,i)),c=o;e=u,t=s,r=c}}),TS=r(function(e,t){return l(SS,xl,t,e)}),wS=r(function(e,t){var r=e.a,n=t.a;return um(f(TS,r,n))}),IS=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 Po(f(xa,function(t){return f(Zp,f(zo,bm(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},mE(f(xa,function(e){return f(fp,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(om(D(r,{blockNumber:si(a)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,ES)]))):L(t,f(CS,r.nodePath,r.tagger))}return L(om(D(r,{blockNumber:si(a),pending:sm,watching:f(wS,r.watching,r.pending)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(a,a),r.pending,qm),l(i,L(a,a),r.watching,ES)])))}var s=e.a.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),f(CS,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(mS,t,c,d)}var s=e.b.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),Do)}),AS=function(e){return M([e])},BS=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(nm,r.factory,r.id):Do}}(),function(){var e=x(Gd(t.wallet),Mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Mg(t.wallet),si(a.factory))?d(eg,n,r.address,a.creationInfo.address,Ly):Do}return Do}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(qE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?FE(t):Do,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(gm,u,Po(M([l(NC,p.factory,p.creationInfo.address,cS),s,r])),Fo,o)}return lS(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return lS(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(ts,m,jl(Fb(C.parameters))),ba))return lS(u);var S=l(xE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(gm,D(u,{txChainStatus:T}),Do,w,yr)}return lS(u)}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:$C(I.blocknum)},B=l(Ym,mm,t.eventSentry,{address:A.address,fromBlock:jm(A.blocknum),toBlock:Mp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(Qb,A,t.trade)}),$=f(xc,gS,Vb(u.trade)),_=Po(M([N,h(RC,$,A.address,nS,cS,aS)]));return d(gm,u,_,Fo,yr)}if("BadBody"===g.a.$){g.a.a;return d(gm,t,Do,Fo,M([pa(dS)]))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(eC,P,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(Kb(F)){var u=D(t,{trade:f(Xb,F,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(pS)]))}var V=g.a.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Zb,H,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Yh,Mb,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(HC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(jC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=lb(e.terms);if("Ok"===r.$){var n=r.a;return L(f(tC,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ll,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(jE),n))}(l(bE,q.blockNumber,Y,r))}return d(qE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?FE(u):Do;return d(gm,u,_,Fo,f(oo,f(xa,pa,mE(M([X]))),o));case"ExpandPhase":var te=e.a;return lS(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return lS(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return lS(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(gm,t,Do,Fo,M([da(jv(C.parameters.initiatorAddress))]))}return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return lS(D(t,{txChainStatus:si(f(rS,E,ie))}));case"AbortAction":return lS(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(xE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=al(l(sh,nh(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(QE)};return f(qo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(ts,i,jl(Fb(C.parameters))),ba)?L(si(JE),n):l(xE,C,E.address,E.commPubkey)}return L(si(JE),n)}(),T=oe.a,w=oe.b;return d(gm,D(t,{txChainStatus:T}),Do,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,iS)||R(ue,oS)){var se=sS(ue),ce=t;e=se,t=ce;continue e}return lS(D(t,{txChainStatus:si(tS(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Fo,M([pa(f(ll,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=al(eb(n.creationInfo.address));return x(si(YE(oS)),f(qo,BE(oS),a),yr);case"Claim":var a=al(Xm(n.creationInfo.address));return x(si(YE(ZE)),f(qo,BE(ZE),a),yr);case"Abort":var a=al(Jm(n.creationInfo.address));return x(si(YE(GE)),f(qo,BE(GE),a),yr);case"Release":var a=al(tb(n.creationInfo.address));return x(si(YE(uS)),f(qo,BE(uS),a),yr);case"Burn":var a=al(Qm(n.creationInfo.address));return x(si(YE(XE)),f(qo,BE(XE),a),yr);default:var a=al(zf(n.creationInfo.address));return x(si(YE(iS)),f(qo,BE(iS),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(gm,D(t,{txChainStatus:T}),Do,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return lS(D(t,{txChainStatus:si(WE(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return lS(D(t,{txChainStatus:si(eS(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"commit",V))]));case"CommitMined":return lS(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return lS(D(t,{txChainStatus:si(f(zE,ue,he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,fS(ue),V))]));case"ActionMined":var ue=e.a;return lS(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(IS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(gm,D(t,{eventSentry:ve}),_,Fo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(wE,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?FE(t):Do,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(kE(f(MC,r,a)),ci)}return L(Do,si(f(ll,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Do,ci)}(),Te=Se.a,we=Se.b;return d(gm,Ee,Po(M([s,Te])),Fo,U(f(Qi,jE,Ce.appCmds),f(xc,yr,f(Bo,AS,f(Bo,pa,we)))))}return d(gm,t,Do,Fo,M([pa(f(ll,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Wh,OC,DC(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Ao,p,E.address);if("Nothing"===Ne.$)return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return al("Initiator"===Re.$?f(Zm,p.creationInfo.address,ke):f(rb,p.creationInfo.address,ke))}();return d(gm,t,Do,f(qo,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(gm,t,Do,Fo,M([pa(f(ll,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return lS(t)}var V=e.a.a;return d(gm,t,Do,Fo,M([pa(f(Lg,"message",V))]));default:return d(gm,t,Do,Fo,M([ga]))}}),kS=r(function(e,t){return{address:e,blocknum:t}}),NS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},RS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(zm,!0,e,t,r))}),$S=n(function(e,t,r){var n=function(e){return r(f(Yh,Sb,e).returnData)},a={address:t.address,fromBlock:jm(t.blocknum),toBlock:jm(t.blocknum),topics:M([si(Ob("Initiated(string,string)"))])};return l(RS,n,e,a)}),_S=function(e){return{data:si(f(Gf,"numTrades()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},LS=r(function(e,t){return f(Zp,t,f(Fp,Xh(e),_S(rh(e))))}),xS=function(e){return{data:si(f(Gf,"phase()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},PS=n(function(e,t,r){return f(Zp,r,f(jp,IC,f(Fp,Xh(e),xS(t))))}),DS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),US=r(function(e,t){return l(La,DS(e),yr,t)}),OS=function(e){return f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},MS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},FS=function(e){return f(MS,Ja(Hb),Sa(e.trades))},VS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:FS(e),loaded:Ti(OS(e))})})},KS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),HS=r(function(e,t){var r=f(Zc,e,t.trades);if("Just"===r.$){var n=(r.a,l(af,e,Hb,t.trades));return l(KS,VS(D(t,{trades:n})),Do,yr)}return l(KS,t,Do,M([pa(f(ll,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),jS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Qb,t,a),o=l(af,e,i,r.trades);return L(VS(D(r,{trades:o})),yr)}return L(r,M([f(ll,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),qS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Xb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(af,e,ym(D(a,{state:D(i,{phase:t})})),r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),zS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Zb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),YS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(eC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),WS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),JS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),QS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),XS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),ZS=function(e){return{$:"NumTradesFetchedAgain",a:e}},eT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),tT=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),rT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),nT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),aT=function(e){return l(KS,e,Do,yr)},iT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=$C(n),i=xC(f(xa,jy(t.factory),f(Ai,0,a-1))),o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,0,a-1)));return l(KS,D(t,{dataFetchState:l(QS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CheckForNewTrades":return l(KS,t,f(LS,t.factory,ZS),yr);case"UpdateTradePhases":var s=Po(mE(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(PS,e.factory,e.creationInfo.address,f(tT,e.factory,e.id)))},OS(t))));return l(KS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(GS,d,p,t),v=function(){var e=L(p,f(Zc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=NS(r);if("Just"===n.$){var a=n.a;return L(l(NC,c,a.address,nT(d)),yr)}return L(Do,M([pa(f(ll,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Do,yr)}e.b;return L(Do,M([pa(f(ll,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(KS,g.tradeCache,Po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(KS,t,Do,M([pa(f(hS,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=$C(n);if(_(C,E)<0){var S=t.dataFetchState,o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,C,E-1))),T=xC(f(xa,jy(t.factory),f(Ai,C,E-1)));return l(KS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(vE,t.trades,T)}),o,yr)}return aT(t)}b.b;return l(KS,t,Do,M([pa(f(ll,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(kS,w.address_,$C(w.blocknum)),A=l($S,t.eventSentry,I,XS(d)),B=A.a,k=A.b,y=Po(M([h(RC,t.factory,I.address,eT(d),nT(d),rT(d)),k])),N=l(jS,d,I,t),R=N.a,$=N.b;return l(KS,VS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(KS,t,Do,M([pa(f(_g,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(qS,d,P,t)}var U=r.a.a;return l(KS,t,Do,M([pa(f(ll,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(YS,d,O,t)}return l(KS,t,Do,M([pa(f(hS,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(zS,d,F,t)}return l(KS,t,Do,M([pa(f(hS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=lb(V.terms);if("Ok"===K.$){var H=K.a;return l(WS,d,H,t)}var j=K.a;return f(HS,d,t)}var j=r.a;return l(KS,t,Do,M([pa(f(ll,"Error decoding initiated event",j))]));default:var q=e.a,G=f(IS,q,t.eventSentry),z=G.a,y=G.b;return l(KS,D(t,{eventSentry:z}),y,yr)}}),oT=function(e){return{$:"AgentHistoryMsg",a:e}},uT=function(e){return{$:"AppCmd",a:e}},sT={$:"BetaLandingPage"},cT={$:"ConnectToWeb3"},fT=function(e){return{$:"MarketplaceMsg",a:e}},lT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),dT=r(function(e,t){return f(kn,e,hl(t))}),hT=function(e){return f(dT,"href",tt(e))},pT=Nn("rel"),gT=dT("target"),vT=function(e){return{$:"Height",a:e}},yT=vT,mT={$:"Content"},bT=mT,CT=function(e){return{$:"Width",a:e}},ET=CT,ST=function(e){return{$:"Attr",a:e}},TT=function(e){return{$:"NodeName",a:e}},wT=function(e){return{$:"Unkeyed",a:e}},IT={$:"AsEl"},AT=IT,BT=r(function(e,t){return{$:"Field",a:e,b:t}}),kT=f(BT,0,0),NT={$:"NoNearbyChildren"},RT={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"},$T=RT.any+" "+RT.column,_T=RT.any+" "+RT.grid,LT=RT.any+" "+RT.page,xT=RT.any+" "+RT.paragraph,PT=RT.any+" "+RT.row,DT=RT.any+" "+RT.single,UT=function(e){switch(e.$){case"AsRow":return PT;case"AsColumn":return $T;case"AsEl":return DT;case"AsGrid":return _T;case"AsParagraph":return xT;default:return LT}},OT=function(e){return{$:"Keyed",a:e}},MT={$:"NoStyleSheet"},FT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),VT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),KT={$:"AsParagraph"},HT=KT,jT=Sn("div"),qT=Sn("p"),GT=Sn("s"),zT=Sn("u"),YT=dT("className"),WT=function(e){return wn(Xe(e))},JT=function(e){return Sn(Xe(e))},QT=function(e){return{$:"Flag",a:e}},XT=function(e){return{$:"Second",a:e}},ZT=function(e){return e>31?XT(1< .ctr > ."+RT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",eI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+" { flex-basis: auto !important; } "+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+Ew(RT.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"+Zw,tI=function(e){return{$:"Intermediate",a:e}},rI=r(function(e,t){return tI({closing:t,others:yr,props:yr,selector:e})}),nI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,tI({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(nI,f(rI,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(nI,f(rI,n.selector,""),v),t.others)})}});return tI(l(La,a,n,t))}),aI=U(eI,function(e){var t=function(e){return Cd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Cd(f(xa,a,t.others)))};return Cd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(nI,f(rI,r,""),n),t)}),yr,e)))}(U(Jw,Xw))),iI=l(JT,"style",yr,M([Tw(aI)])),oI=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+'"'}},uI=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}},sI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ch,uI,t.variants)}return!1},cI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),fI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),lI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(fI,"."+e+"."+t+", ."+e+" ."+t,n),f(fI,"."+e+"."+t+"> ."+RT.text+", ."+e+" ."+t+" > ."+RT.text,a)])}),dI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(lI,i,RT.sizeByCapital,a),l(lI,i,RT.fullSize,n)))}),hI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(fI,"."+r+"."+RT.sizeByCapital+", ."+r+" ."+RT.sizeByCapital,M([L("line-height","1")])),f(fI,"."+r+"."+RT.sizeByCapital+"> ."+RT.text+", ."+r+" ."+RT.sizeByCapital+" > ."+RT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),pI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},gI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Tc,t,r))}return ci},vI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),yI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(xc,e.descender,gI(t)),n=f(xc,e.baseline,gI(f(ml,function(e){return!R(e,r)},t))),a=f(xc,e.capital,pI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(vI,i,a-n,o),full:l(vI,u,a-r,s)}},mI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",mw(e.height)),L("vertical-align",mw(e.vertical)+"em"),L("font-size",mw(e.size)+"em")]))},bI=function(e){return l(Ra,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 si(L(mI(function(e){return e.full}(yI(a))),mI(function(e){return e.capital}(yI(a)))))}return t}return t}),ci,e)},CI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(US,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=bI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,hI(t),n));var i=a.a;return f(Ri,"",f(xa,f(dI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},EI=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+'" '+Ni(r)}},SI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,EI,t.variants)))}return ci},TI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},wI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+mw(r)+"px, "+mw(n)+"px, "+mw(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("+mw(o)+"px, "+mw(u)+"px, "+mw(s)+"px)",b="scale3d("+mw(f)+", "+mw(l)+", "+mw(d)+")",C="rotate3d("+mw(p)+", "+mw(g)+", "+mw(v)+", "+mw(y)+"rad)";return si(m+" "+b+" "+C)}},II=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,cI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,cI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,cI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,cI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+RT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+RT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+RT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,cI(!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,M([f(vw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Tc,1,1-c));return l(a,t,"."+u,M([f(vw,"opacity",mw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(vw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(US,SI,p)),v=M([f(vw,"font-family",f(Ri,", ",f(xa,oI,p))),f(vw,"font-feature-settings",g),f(vw,"font-variant",f(Ch,sI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(vw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(vw,s,bw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+RT.row,A="."+(RT.wrapped+I),B="."+RT.alignRight,k="."+RT.paragraph,N="."+RT.page,R="."+RT.alignLeft,$=mw(S/2)+"px",_=mw(E/2)+"px",x="."+RT.column,y="."+C,P="."+RT.any;return Cd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(vw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(vw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,U(y,k),M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,lw,F.rows))+"-cols-"+f(Ri,"-",f(xa,lw,F.columns))+"-space-x-"+lw(F.spacing.a)+"-space-y-"+lw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=wI(ne),y=hw(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,M([f(vw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=TI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(CI(s),c)}),AI=r(function(e,t){return l(JT,"style",yr,M([Tw(f(II,e,t))]))}),BI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",iI),f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)}),kI=a(function(e,t,r,n){return e?f(ka,iI,f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)):f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)}),NI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(WT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(BI,!1,e,t,r);default:var e=i.a,t=i.b;return d(BI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return jT;case"p":return qT;default:return JT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(kI,!1,e,t,n);default:var e=i.a,t=i.b;return d(kI,!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(JT,e,n,M([f(u,r,M([YT(RT.any+" "+RT.single)]))]))}}();switch(o.$){case"AsRow":return f(ow,sw,e)&&!f(ow,uw,e)?s:f(ow,tw,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerRight])))]),M([s])):f(ow,rw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(ow,iw,e)&&!f(ow,aw,e)?s:f(ow,nw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerCenterY])))]),M([s])):f(ow,ew,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerBottom])))]),M([s])):s;default:return s}}),RI=Tw,$I=function(e){return f(jT,M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthContent,RT.heightContent])))]),M([RI(e)]))},_I=function(e){return l(JT,"div",M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthFill,RT.heightFill])))]),M([Tw(e)]))},LI=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 R(e,HT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,HT),L(f(ka,L(n,f(s.html,MT,e)),i),Iu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,AT)?_I(c):$I(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 R(e,HT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,HT),L(f(ka,f(o.html,MT,e),n),Iu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,AT)?_I(u):$I(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children)),MT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children)),MT))}),xI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),PI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(BT,a|r,n)}var i=e.a;return f(BT,r,i|n)}),DI=ZT(7),UI=ZT(36),OI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(BT,r|a,n|i)}),MI=ZT(6),FI=ZT(38),VI=ZT(30),KI=ZT(29),HI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),jI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),qI=function(e){return{$:"Transform",a:e}},GI=function(e){return{$:"ChildrenBehind",a:e}},zI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),YI=function(e){return{$:"ChildrenInFront",a:e}},WI=r(function(e,t){return f(jT,M([YT(function(){switch(e.$){case"Above":return f(Ri," ",M([RT.nearby,RT.single,RT.above]));case"Below":return f(Ri," ",M([RT.nearby,RT.single,RT.below]));case"OnRight":return f(Ri," ",M([RT.nearby,RT.single,RT.onRight]));case"OnLeft":return f(Ri," ",M([RT.nearby,RT.single,RT.onLeft]));case"InFront":return f(Ri," ",M([RT.nearby,RT.single,RT.inFront]));default:return f(Ri," ",M([RT.nearby,RT.single,RT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Tw("");case"Text":var e=t.a;return $I(e);case"Unstyled":return(0,t.a)(AT);default:return f(t.a.html,MT,AT)}}()]))}),JI=n(function(e,t,r){var n=f(WI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?GI(M([n])):YI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?GI(f(ka,n,a)):f(zI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(zI,M([n]),i):YI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(zI,f(ka,n,a),i):f(zI,a,f(ka,n,i))}}),QI=r(function(e,t){switch(t.$){case"Generic":return TT(e);case"NodeName":var r=t.a;return f(HI,r,e);default:var n=t.a,a=t.b;return f(HI,n,a)}}),XI=function(e){switch(e.$){case"Left":return RT.alignedHorizontally+" "+RT.alignLeft;case"Right":return RT.alignedHorizontally+" "+RT.alignRight;default:return RT.alignedHorizontally+" "+RT.alignCenterX}},ZI=function(e){switch(e.$){case"Top":return RT.alignedVertically+" "+RT.alignTop;case"Bottom":return RT.alignedVertically+" "+RT.alignBottom;default:return RT.alignedVertically+" "+RT.alignCenterY}},eA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),tA=function(e){return{$:"Moved",a:e}},rA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return tA(x(r,0,0));case"MoveY":var n=t.a;return tA(x(0,n,0));case"MoveZ":var a=t.a;return tA(x(0,0,a));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(eA,x(0,0,0),i,x(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 tA(x(s,n,a));case"MoveY":var c=t.a;return tA(x(r,c,a));case"MoveZ":var f=t.a;return tA(x(r,n,f));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,u,x(1,1,1),i,o);default:var l=t.a;return d(eA,u,l,x(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(eA,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(eA,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(eA,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(eA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(eA,u,h,v,y);default:var m=t.a;return d(eA,u,m,p,o)}}}),nA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(kT,n,M([l(jI,n,"height",r+"px")]));case"Content":return x(f(PI,UI,kT),RT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(PI,iw,kT),RT.heightFill,yr):x(f(PI,iw,kT),RT.heightFillPortion+" height-fill-"+Ni(a),M([l(jI,RT.any+"."+RT.row+" > "+Ew("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(jI,u,"min-height",Ni(i)+"px"),c=nA(o),d=c.a,h=c.b,p=c.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(jI,u,"max-height",Ni(g)+"px"),v=nA(o),d=v.a,h=v.b,p=v.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p))}},aA=function(e){switch(e.$){case"Px":var t=e.a;return x(kT,RT.widthExact+" width-px-"+Ni(t),M([l(jI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(PI,FI,kT),RT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(PI,sw,kT),RT.widthFill,yr):x(f(PI,sw,kT),RT.widthFillPortion+" width-fill-"+Ni(r),M([l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(jI,i,"min-width",Ni(n)+"px"),u=aA(a),s=u.a,c=u.b,d=u.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(jI,i,"max-width",Ni(h)+"px"),p=aA(a),s=p.a,c=p.b,d=p.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d))}},iA=ZT(27),oA=r(function(e,t){if(R(e,iA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),uA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=hw(n);if("Nothing"===s.$)return{attributes:f(ka,YT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,YT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,qI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(oA,S,I)){var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(PI,S,r),y=f(rA,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(ow,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=RT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(PI,MI,r),y=n,m=f(ka,l(jI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+RT.widthContent,g=t,v=f(PI,FI,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+RT.widthFill,g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=aA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(ow,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(PI,DI,r),y=n,m=f(ka,l(jI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=RT.heightContent+" "+e,g=t,v=f(PI,UI,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=RT.heightFill+" "+e,g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.column+" > "+Ew("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=nA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(QI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(QI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(QI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(QI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(QI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(QI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(QI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return TT("p");case"NodeName":var e=t.a;return TT(e);default:var r=t.a,n=t.b;return f(HI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(JI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(ow,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=XI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(PI,rw,e);case"Right":return f(PI,tw,e);default:return e}}(f(PI,VI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(ow,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=ZI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(PI,nw,e);case"Bottom":return f(PI,ew,e);default:return e}}(f(PI,KI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),sA={$:"Untransformed"},cA=sA,fA=a(function(e,t,r,n){return l(LI,e,n,v(uA,UT(e),t,kT,cA,yr,yr,NT,$a(r)))}),lA=function(e){return ST(YT(e))},dA=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ST(gT("_blank")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e)))))),wT(M([n])))}),hA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),pA=n(function(e,t,r){return d(hA,e,t,r,1)}),gA=ZT(14),vA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),yA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),mA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return dw(t)+"-"+dw(r)+"-"+dw(n)+"-"+dw(a)},bA=function(e){return f(yA,gA,l(vA,"fc-"+mA(e),"color",e))},CA={align:ul,label:"cantConnectNoWeb3",mainParagraphs:M([M([fl("You need a web3 provider (such as "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(") to Connect.")]),M([fl("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:xg},EA={align:ul,label:"invalidUrl",mainParagraphs:M([M([fl("I don't understand that URL...")]),M([fl("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:$g},SA=function(e){return{$:"Active",a:e}},TA=gu(f(zo,jf,f(zo,Hh,$d("Error decoding hex to BigInt")))),wA=function(){return gu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),IA=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}}}}}}}}}}}},AA=function(e){return Em(M([f(Oi,si,e),Fi(ci)]))},BA=f(dh,AA(f(Oh,"status",wA)),f(dh,AA(f(Oh,"root",pu)),l(Im,"logsBloom",pu,l(Im,"logs",Mm(Fm),f(dh,AA(f(Oh,"contractAddress",Am)),l(Im,"cumulativeGasUsed",TA,l(Im,"gasUsed",TA,l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionIndex",Gy,l(Im,"transactionHash",Dm,Fi(IA)))))))))))),kA=function(e){var t=e.a;return jf(t)},NA=f(zo,kA,hl),RA=r(function(e,t){return Up({decoder:BA,method:"eth_getTransactionReceipt",params:M([NA(t)]),url:e})}),$A=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),_A=r(function(e,t){return{$:"TxMined",a:e,b:t}}),LA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),xA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(Io,function(e){return e.b},f(Io,function(e){return e.onMinedTagger},f(fp,t,e))))}),PA=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}}}}}}}}}}}},DA=function(e){return Em(M([Cm(ci),f(Oi,si,e)]))},UA=l(Im,"input",pu,l(Im,"gas",Gy,l(Im,"gasPrice",TA,l(Im,"value",TA,l(Im,"to",DA(Am),l(Im,"from",Am,l(Im,"transactionIndex",Gy,l(Im,"blockNumber",DA(Gy),l(Im,"blockHash",function(e){return f(du,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},cu(t))?Fi(ci):f(Oi,si,e)},pu)}(Rm),l(Im,"nonce",Gy,l(Im,"hash",Dm,Fi(PA)))))))))))),OA=r(function(e,t){return Up({decoder:UA,method:"eth_getTransactionByHash",params:M([NA(t)]),url:e})}),MA=r(function(e,t){return{attempts:e,sleep:t}}),FA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Xp,function(e){return a>0?f(Kp,function(e){return f(FA,f(MA,a,n),t)},bS(1e3*n)):Lp(e)},t)}),VA=r(function(e,t){return f(Kp,function(r){return f(FA,{attempts:30,sleep:1},f(OA,e,t))},bS(250))}),KA=r(function(e,t){return f(FA,{attempts:60,sleep:5},f(RA,e,t))}),HA=function(e){return{$:"Mined",a:e}},jA=function(e){return Bo(function(t){return D(t,{status:HA(e)})})},qA=function(e){return{$:"Sent",a:e}},GA=function(e){return Bo(function(t){return D(t,{status:qA(e)})})},zA=function(e){return{$:"Signed",a:e}},YA=function(e){return Bo(function(t){return D(t,{status:zA(e)})})},WA=function(e){return"Nothing"!==e.$},JA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Tl(r),Do);case"TxSigned":var n=e.a,a=e.b,i=f(fp,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(Yg,t,xp(a))}return Do}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Do;if("Just"===t.b.$){var r=t.b.a;return f(Yg,r,xp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Yg,a,xp(fi(e)))}t.a,t.b,t.c;return Do};if("Ok"===a.$){var c=a.a,d=WA(o.onBroadcastTagger)||WA(o.onMinedTagger)?f(il,r.tagger,f(Zp,LA(n),f(VA,r.nodePath,c))):Do;return L(Tl(D(r,{txs:l(bp,n,YA(c),r.txs)})),Po(M([u,d])))}var h=a.a;return L(Tl(r),Po(M([u,s(h)])))}return L(Tl(r),Do);case"TxSent":var n=e.a,p=e.b,g=f(fp,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(il,r.tagger,f(Zp,_A(n),f(KA,r.nodePath,v.hash))):Do}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Yg,t,xp(li(v)))}return Do}();return L(Tl(D(r,{txs:l(bp,n,GA(v),r.txs)})),Po(M([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(Yg,t,xp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Yg,n,xp(fi("Error with TxSent stuff")))}e.a,e.b;return Do}();return L(Tl(r),s)}return L(Tl(r),Do);case"TxMined":var n=e.a,m=e.b,b=f(fp,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Yg,a,xp(li(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 Po(M([f(il,r.tagger,f(Zp,f($A,n,s),zy(r.nodePath))),f(Yg,a,xp(li(C))),f(Yg,u.toMsg,xp(s))]))}return Do}();return L(Tl(D(r,{txs:l(bp,n,jA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Yg,r,xp(fi("TxReceipt decoding failure")))}return Do}();return L(Tl(r),S)}return L(Tl(r),Do);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(xA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Tl(r),f(Yg,B,f(Xp,function(e){return xp(D(I,{doneWatching:!0,reOrg:!0}))},f(Kp,function(e){return xp(D(I,{doneWatching:!0}))},f(RA,r.nodePath,T.txHash)))))}return L(Tl(r),Do)}if(R(w,T.lastCheckedBlock))return L(Tl(r),f(il,r.tagger,f(Zp,f($A,n,T),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))));var k=f(xA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Tl(r),Po(M([f(il,r.tagger,f(Zp,f($A,n,I),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))),f(Yg,B,xp(I))])))}return L(Tl(r),Do)}var n=e.a,h=e.c.a;return L(Tl(r),Do);default:var h=e.a;return L(Tl(r),Do)}}),QA=Jt,XA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),ZA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),eB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(ZA,"#",e.fragment,l(ZA,"?",e.query,U(f(XA,e.port_,U(t,e.host)),e.path)))},tB=r(function(e,t){return e<0?ci:Ql(f(nd,e,t))}),rB=r(function(e,t){if(e<0)return t;var r=Bh(f(nd,e,t)),n=f(lc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),nB=n(function(e,t,r){if(e<0)return r;var n=f(nd,e,r),a=f(lc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),aB=r(function(e,t){return f(nB,e,ms(t))}),iB=r(function(e,t){Kv(t);switch(t.$){case"Home":return L(D(e,{submodel:sT}),Do);case"Create":var r=Xd(e.wallet),n=f(Ul,e.txSentry,f(Yo,Uy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(uB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),Po(M([f(il,Uy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(By,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(Wm,e.wallet,r)}return l(vm,e.wallet,u,s)}(),c=f(Ul,e.txSentry,f(Yo,Fy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(uB,U(f(Qi,Fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:My(r.model),txSentry:a}),Po(M([f(il,Fy,r.cmd),i]))));case"Marketplace":var d=Bv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Oy(h)}),Po(M([f(il,fT,p)])));case"AgentHistory":var g=t.a,v=f(Uo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:Py(y)}),Po(M([f(il,oT,m)])));default:return L(f(uo,EA,e),Do)}}),oB=r(function(e,t){var r=t.a,n=t.b,a=f(sB,uT(e),r),i=a.a,o=a.b;return L(i,Po(M([n,o])))}),uB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,oB,L(r,n),e)}),sB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(sB,cT,t);case"GotoRoute":var n=r.a;return L(t,f(Cy,t.key,n));case"GTag":var a=r.a;return L(t,wy(Sy(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),wy(Sy(d(Ol,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Uv,ky,o,u,s));default:return L(t,Ny(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(rB,c,t.userNotices)}),Do);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(by,t.key,eB(e))}var r=h.a;return QA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(cB,g,t);case"GotoRoute":var v=e.a;return L(t,Po(M([wy(Sy(d(Ol,"GotoRoute","navigation",Kv(v),0))),f(Cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Do);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,CA,t),Do):L(t,Ey(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Do;var t=e.a;return Iy(f(Ty,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Gh,pu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=SA(l(Ml,I,w,S)),B=f(Vy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ll,"Unexpected wallet state encounted when setting commPubkey!",ci),t),Do)}T.a;return L(f(uo,f(ll,"User pubkey set, but I can no longer find the user address!",ci),t),Do)}var N=E.a;return L(l(Pa,uo,f(ll,"error decoding commPubkey from JS",N),t),Do);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(lv,R,_),P=f(Ul,t.txSentry,f(Yo,Uy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(uB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),Po(M([f(il,Uy,x.cmd),F]))))}return L(t,Do);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(BS,K,j),q=f(Ul,t.txSentry,f(Yo,Fy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(uB,U(f(Qi,Fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:My(x.model),txSentry:O}),Po(M([f(il,Fy,x.cmd),F]))))}return L(t,Do);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Dv,G,Y);return f(uB,f(Qi,fT,x.appCmds),L(D(t,{submodel:Oy(x.model)}),f(il,fT,x.cmd)))}return L(t,Do);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(ol,W,Q),X=f(Ul,t.txSentry,f(Yo,oT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(uB,U(f(Qi,oT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Py(x.model),txSentry:O}),Po(M([f(il,oT,x.cmd),F]))))}return L(t,Do);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(_u,si,f(JA,Z,r))}return L(ci,Do)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(tB,re,t.tradeCaches);if("Nothing"===ae.$)return f(oB,pa(f(ll,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Do));var ie=ae.a,x=f(iT,ne,ie);return L(D(t,{tradeCaches:l(aB,re,x.tradeCache,t.tradeCaches)}),f(il,lT(re),x.cmd));case"NoOp":return L(t,Do);default:var N=e.a;f(cl,"test",N);return L(t,Do)}}),cB=r(function(e,t){return f(iB,t,my(e))}),fB=Ge("txIn",Sm),lB=je("txOut",Ua),dB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},hB=function(e){return{$:"EventSentryMsg",a:e}},pB=function(e){var t=f(cm,hB,Xh(e)),r=t.a,n=t.b;return x({dataFetchState:l(QS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Zd,"tradeCache init","processing",dB(e),0)]))},gB=function(e){return{$:"InitialNumTradesFetched",a:e}},vB=function(e){return f(LS,e.factory,gB)},yB=function(e){var t=pB(e),r=t.a,n=t.b,a=t.c;return x(r,Po(M([n,vB(r)])),a)},mB=function(e){return{$:"TxSentryMsg",a:e}},bB={align:ul,label:"noWeb3Provider",mainParagraphs:M([M([fl("No web3 provider detected. Is "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(" or some other web3 provider installed and unlocked?")])]),noticeType:xg},CB={$:"TopLeft"},EB={align:CB,label:"screenToSmall",mainParagraphs:M([M([fl("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:xg},SB={align:ul,label:"wrongWeb3Network",mainParagraphs:M([M([fl("Make sure your wallet is set to a compatible network.")]),M([fl(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:$g},TB={$:"NoneDetected"},wB=function(e){return{$:"OnlyNetwork",a:e}},IB=function(e){return f(Bo,Xh,Mg(e))},AB={$:"ETCMain"},BB={$:"ETCTest"},kB={$:"Expanse"},NB={$:"Kovan"},RB={$:"Mainnet"},$B=function(e){return{$:"Private",a:e}},_B={$:"Rinkeby"},LB={$:"Ropsten"},xB={$:"RskMain"},PB={$:"RskTest"},DB=function(e){switch(e){case 1:return RB;case 2:return kB;case 3:return LB;case 4:return _B;case 30:return xB;case 31:return PB;case 42:return NB;case 41:return AB;case 62:return BB;default:return $B(e)}},UB=n(function(e,t,r){var n=e.a,a=e.b;return Tl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:cp})}),OB=n(function(e,t,n){var a=e.networkId?wB(DB(e.networkId)):TB,i=f(Bo,function(e){return l(UB,L(lB,fB),mB,e)},IB(a)),o=e.width<1024?si(EB):ci,u=f(xa,yB,ro),s=function(){return R(a,TB)?si(bB):"Nothing"===Mg(a).$?si(SB):ci}(),c=mE(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ay(f(Bi,r(function(e,t){return f(Qi,lT(e),t)}),g)),y=Po(f(Bi,r(function(e,t){return f(il,lT(e),t)}),p)),m=f(uB,v,f(cB,t,{key:n,screenWidth:e.width,submodel:sT,time:Vl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),Po(M([y,C])))}),MB=Oe,FB=MB(yr),VB=function(e){return FB},KB=function(e){return{$:"Refresh",a:e}},HB=r(function(e,t){return{$:"Every",a:e,b:t}}),jB=r(function(e,t){return{processes:t,taggers:e}}),qB=xp(f(jB,cp,cp)),GB=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(SS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),zB=Ne,YB=r(function(e,t){var r=e.a,n=e.b,a=f(fp,r,t);if("Nothing"===a.$)return l(xl,r,M([n]),t);var i=a.a;return l(xl,r,f(ka,n,i),t)}),WB=Be,JB=r(function(e,t){return{$:"Zone",a:e,b:t}}),QB=ca,XB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=WB(f(QB,n,f(Sp,e,n)));return f(Kp,function(t){return l(XB,e,a,l(xl,n,t,r))},i)}return xp(r)}),ZB=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 x(n,a,f(Kp,function(e){return i},zB(t)))}),u=l(Ra,YB,cp,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(xl,e,r,i),o)}),d=p(GB,s,c,o,u,i,x(yr,cp,xp(gr))),h=d.a,g=d.b,v=d.c;return f(Kp,function(e){return xp(f(jB,u,e))},f(Kp,function(t){return l(XB,e,h,g)},v))}),ek=function(e){return we(function(t){t(Se(e(Date.now())))})}(Vl),tk=n(function(e,t,r){var n=f(fp,t,r.taggers);if("Nothing"===n.$)return xp(r);var a=n.a,i=function(t){return Gp(f(xa,function(r){return f(Ep,e,r(t))},a))};return f(Kp,function(e){return xp(r)},f(Kp,i,ek))}),rk=r(function(e,t){var r=t.a,n=t.b;return f(HB,r,f(Da,e,n))});pn.Time=Pe(qB,ZB,tk,0,rk);var nk=Ue("Time"),ak=r(function(e,t){return nk(f(HB,e,t))}),ik=function(e){return f(ak,2e3,KB)},ok=function(e){return FB},uk=function(e){return{$:"DecryptionFinished",a:e}},sk=Ge("decryptionFinished",Sm),ck=Ge("encryptionFinished",Sm),fk=function(e){return{$:"EncryptionFinished",a:e}},lk=function(e){return{$:"Refresh",a:e}},dk=function(e){return MB(M([f(ak,3e3,lk),ck(fk),sk(function(e){return jE(uk(e))})]))},hk=yn,pk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return FB;case"CreateModel":t.a;return f(hk,Uy,ik());case"TradeModel":t.a;return f(hk,Fy,dk());case"MarketplaceModel":t.a;return f(hk,fT,ok());default:t.a;return f(hk,oT,VB())}},gk=Ge("userPubkeyResult",Sm),vk=Ge("walletSentryPort",Sm),yk={$:"CheckForNewTrades"},mk={$:"UpdateTradePhases"},bk=function(e){return MB(M([f(ak,5e3,function(e){return yk}),f(ak,3e3,function(e){return mk})]))},Ck=function(e){return{$:"Tick",a:e}},Ek=function(e){return{$:"UserPubkeySet",a:e}},Sk=function(e){return{$:"WalletStatus",a:e}},Tk=function(e){return f(ll,"Error decoding JS walletSentry: "+e,ci)},wk=function(e){return{$:"ErrorDecoding",a:e}},Ik=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Ak=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Oh,"ref",CE),f(Oh,"txHash",AA(Dm))),Bk=function(e){var t=f(Gh,Ak,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Ik,r.ref,li(a))}return f(Ik,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return wk("Error decoding tx data")},kk=function(e){var t=e.a;return f(hk,t.tagger,t.inPort(Bk))},Nk=f(Oi,DB,CE),Rk=gu(f(zo,rd,f(zo,$d("Failure decoding stringy int"),au(DB)))),$k=Em(M([Rk,Nk])),_k=r(function(e,t){return{account:e,networkId:t}}),Lk=l(Mi,_k,f(Oh,"account",AA(Am)),f(Oh,"networkId",$k)),xk=n(function(e,t,r){var n=f(Gh,Lk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),Pk=function(e){var t=f(zo,Tk,f(zo,pa,uT));return MB(U(M([f(ak,1e3,Ck),vk(f(xk,t,Sk)),f(xc,FB,f(Bo,kk,e.txSentry)),gk(Ek),MB(f(Bi,r(function(e,t){return f(hk,lT(e),t)}),f(xa,bk,e.tradeCaches)))]),M([pk(e)])))},Dk=function(e){return{$:"LinkClicked",a:e}},Uk=function(e){return{$:"UrlChanged",a:e}},Ok=n(function(e,t,r){return d(hA,e/255,t/255,r/255,1)}),Mk=l(Ok,10,33,108),Fk={$:"Generic"},Vk=Fk,Kk=r(function(e,t){return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),e)),wT(M([t])))}),Hk=function(e){return{$:"Fill",a:e}},jk=Hk(1),qk=Hi,Gk=function(e){return{$:"Px",a:e}},zk=Gk,Yk=ZT(8),Wk=function(e){return f(yA,Yk,l(vA,"bg-"+mA(e),"background-color",e))},Jk=f(Kk,M([ET(jk),yT(zk(150)),Wk(Mk)]),qk),Qk=function(e){return{$:"GotoRoute",a:e}},Xk={$:"Active"},Zk={$:"Important"},eN={$:"Normal"},tN=l(pA,1,1,1),rN=ZT(2),nN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),aN=r(function(e,t){return R(e,t)?f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e)):f(yA,rN,h(nN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),iN=ZT(21),oN=r(function(e,t){return{$:"Class",a:e,b:t}}),uN=f(oN,iN,RT.cursorPointer),sN=ZT(17),cN=function(e){return f(yA,sN,l(jI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},fN=function(e){return{$:"Normal",a:e}},lN=An,dN=r(function(e,t){return f(lN,e,fN(t))}),hN=function(e){return f(dN,"click",Fi(e))},pN=f(Da,ST,hN),gN=ZT(13),vN=f(oN,gN,RT.textSemiBold),yN=ZT(4),mN=function(e){return{$:"FontSize",a:e}},bN=function(e){return f(yA,yN,mN(e))},CN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([cN(4),Wk(l(pA,0,0,1))]);default:return M([cN(4),Wk(l(pA,.9,0,0))])}}();return f(Kk,U(M([f(aN,23,12),bN(22),vN,bA(tN),uN,pN(t)]),n),fl(e))}),EN=l(Ok,244,0,103),SN=function(e){return{$:"AlignX",a:e}},TN={$:"CenterX"},wN=SN(TN),IN=ZT(3),AN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),BN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),kN=function(e){return f(yA,IN,l(AN,f(BN,e,e),e,e))},NN=function(e){return{$:"Describe",a:e}},RN={$:"Paragraph"},$N=r(function(e,t){return d(fA,HT,Vk,f(ka,NN(RN),f(ka,ET(jk),f(ka,kN(5),e))),wT(t))}),_N=f(oN,gN,RT.bold),LN=f(Kk,M([bN(29),bA(tN),_N,wN,uN,pN(Qk(Gv))]),f($N,yr,M([fl("DAI"),f(Kk,M([bA(EN)]),fl("Hard"))]))),xN={$:"Right"},PN=SN(xN),DN={$:"AsColumn"},UN=DN,ON=r(function(e,t){return d(fA,UN,Vk,f(ka,lA(RT.contentTop+" "+RT.contentLeft),f(ka,yT(bT),f(ka,ET(bT),e))),wT(t))}),MN={$:"AsRow"},FN=MN,VN=r(function(e,t){return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY),f(ka,ET(bT),f(ka,yT(bT),e))),wT(t))}),KN=function(e){return f(VN,M([ET(jk),kN(30),f(aN,30,17)]),M([l(CN,"Browse Offers",Qk(zv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Xk}return eN}()),l(CN,"Create a New Offer",Qk(qv),function(){return"CreateModel"===e.submodel.$?Xk:eN}()),function(){var t=Gd(e.wallet);if("Just"===t.$){var r=t.a;return l(CN,"My Trades",Qk(jv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Xk:eN}return eN}())}return l(CN,"Connect to Wallet",cT,Zk)}(),f(ON,M([PN,kN(0),f(aN,8,0)]),M([LN]))]))},HN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},jN=function(e){return ml(e)},qN=r(function(e,t){return f(ml,dv(e),t)}),GN=function(e){return f(ml,function(e){return Kb(e.parameters)},OS(e))},zN={$:"BurnWindow"},YN={$:"FiatPrice"},WN={$:"Margin"},JN={$:"Offer"},QN={$:"PaymentWindow"},XN=function(e){return{$:"AlignY",a:e}},ZN={$:"CenterY"},eR=XN(ZN),tR=ZT(20),rR=f(oN,tR,RT.clip),nR=Hk,aR=function(e){return f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e))},iR=r(function(e,t){return f(Kk,M([ET(nR(e)),yT(zk(60)),rR,Wk(tN)]),f(Kk,M([aR(12),eR,ET(jk)]),t))}),oR=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},uR=function(e){return{$:"JustImage",a:e}},sR=uR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),cR=dT("alt"),fR=function(e){return f(dT,"src",rt(e))},lR=r(function(e,t){var r=t.src,n=t.description,a=f(ml,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(fA,AT,Vk,f(ka,lA(RT.imageContainer),e),wT(M([d(fA,AT,TT("img"),U(M([ST(fR(r)),ST(cR(n))]),a),wT(yr))])))}),dR=r(function(e,t){if("None"===t.$)return qk;var r=t.a;return f(lR,e,r)}),hR=uR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),pR=function(e){return{$:"ChangeSort",a:e}},gR=f(oN,gN,RT.textMedium),vR=function(e){return f(Kk,M([gR,bN(17)]),fl(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},yR=r(function(e,t){return f(VN,M([kN(5),uN,pN(pR(e))]),M([vR(e),function(){if("Just"===t.$){var e=t.a;return f(Kk,M([eR]),f(dR,M([ET(zk(8))]),function(){return"Ascending"===e.$?sR:hR}()))}return qk}()]))}),mR=r(function(e,t){return f(iR,oR(t),f(yR,t,e))}),bR=r(function(e,t){return f(VN,M([ET(jk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(mR,r,t)},t))}),CR=l(Ok,150,150,150),ER=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},SR=r(function(e,t){return f(ts,e.amount,t.amount)}),TR=n(function(e,t,r){return f(e,r,t)}),wR=function(e){var t=e.a;return(R(e.b,Lo)?Ua:TR)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(wR,L(Av,Zf),e,t):f(Ku,ER(e.state.phase),ER(t.state.phase))});case"Expires":return r(function(e,t){return f(hv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Sv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(SR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(xc,ma,l(zd,r(function(e,t){return f(Ku,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(hv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(hv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},IR=l(Ok,233,237,242),AR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),BR=function(e){return f(Kk,M([ET(jk),yT(jk),rR]),f($N,M([bN(12)]),M([fl(e.info)])))},kR=function(e){return f(xc,qk,f(Bo,BR,Ql(e)))},NR=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"}},RR=function(e){return{$:"TimeLeft",a:e}},$R=function(e){return{$:"TimeUp",a:e}},_R=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 Vl(0)}}),LR=r(function(e,t){return Vl(jd(e)-jd(t))}),xR=r(function(e,t){var r=f(_R,t.state.phase,t),n=f(LR,e,t.state.phaseStartTime),a=f(LR,r,n);return jd(a)>0?RR(L(a,r)):$R(r)}),PR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},DR=l(pA,0,0,0),UR=l(Ok,51,183,2),OR=function(e){var t=ju(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Qo(n));return n+(function(){if(a){return f(ru,a+1,f(Zo,1,mw(r)))}return""}()+"%")},MR=r(function(e,t){return uR({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"}()})}),FR=n(function(e,t,r){return f(dR,f(ka,yT(zk(34)),e),f(MR,t,r))}),VR=r(function(e,t){var r=OR(t);if("0%"===r)return f(Kk,M([bN(16)]),fl("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?UR:EN;return f(VN,M([kN(4)]),M([l(FR,yr,a,si(i)),f(Kk,M([bA(o),bN(16)]),fl(n))]))}),KR=uR,HR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(xl,r,n,t)}),cp,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,KR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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(xc,"",f(Bo,Qa,f(fp,e,HR)))},qR=function(e){return Qo(e)<=3?e:qR(f(Td,3,e))+","+f(ou,3,e)},GR=function(e){return qR(Sd(e))},zR=function(e){return U(jR(e.fiatType),GR(e.amount))},YR=hA,WR=function(e){var t=function(){var t=f(fp,e.fiatType,HR);if("Nothing"===t.$)return qk;var r=t.a,n=(r.a,r.b);return f(dR,M([yT(zk(26))]),n)}();return f(VN,M([kN(4)]),M([t,f(Kk,M([bA(d(YR,0,0,0,.5)),gR,ET(zk(50))]),fl(e.fiatType)),fl(zR(e))]))},JR=function(e){return jd(e)<0},QR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),XR=function(e){var t=vg(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(QR,$C(t),$C(r),$C(n),$C(a))}(f(xc,L(qu(0),qu(0)),f(Ts,n,qu(60))))}(f(xc,L(qu(0),qu(0)),f(Ts,r,qu(3600))))}(f(xc,L(qu(0),qu(0)),f(Ts,t,qu(86400))))},ZR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!JR(a)){var u=r(function(e,t){return U(l(Rs,2,P("0"),Ni(e)),t)}),s=jd(a)>0?i:o,c=XR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(VN,U(M([kN(5)]),e),M([f(Kk,U(M([bA(h)]),t),fl(f(u,c.days,"d"))),f(Kk,U(M([bA(d)]),t),fl(f(u,c.hours,"h"))),f(Kk,U(M([bA(s)]),t),fl(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Vl(0);e=p,t=g,n=v,a=y}}),e$={$:"Behind"},t$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),r$=function(e){return f(t$,e$,e)},n$=r(function(e,t){var r=sv(200*e),n=200-r,a=f(Kk,M([ET(nR(n))]),qk),i=M([yT(zk(3)),cN(20)]),o=f(Kk,U(i,M([ET(nR(r)),Wk(t)])),qk),u=f(Kk,U(i,M([ET(jk),Wk(IR)])),qk);return f(VN,M([ET(jk),r$(u)]),M([o,a]))}),a$=l(pA,1,1,0),i$=r(function(e,t){return jd(e)/jd(t)}),o$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(i$,o,u),c=(f(Kk,M([wN]),d(ZR,yr,yr,L(a,i),o)),s<.1?EN:s<.2?a$:UR);return f(ON,U(M([kN(5)]),e),M([d(ZR,M([wN]),t,L(a,i),o),f(n$,1-s,c)]))}),u$=function(e){var t=wd(jl(e)),r=f(Xl,".",t);if(!r.b)return t;if(r.b.b){cl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(ru,3,t);case 1:return f(ru,4,f(xc,t,f(Bo,mw,f(Bo,function(e){return e/100},f(Bo,Ka,f(Bo,sv,f(Bo,ti(100),Bd(t))))))));default:var n=r.a;return f(xc,f(ru,n,t),f(Bo,Ni,f(Bo,sv,Bd(t))))}},s$=n(function(e,t,r){return f(iR,oR(t),function(){switch(t.$){case"Phase":var n=PR(r.state.phase),a=L(f(xR,e,r),r.state.phase);e:for(;;){if("TimeLeft"===a.a.$){if("Closed"===a.b.$)break e;var i=a.a.a,o=f(i$,i.a,i.b)<.05?EN:DR;return f(ON,M([kN(3)]),M([fl(n),d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)]))}if("Closed"===a.b.$)break e;var u=a.a.a;return f(VN,M([kN(6),bA(CR)]),M([fl(n),f(Kk,M([bN(16)]),fl("(stale)"))]))}a.b;return fl(n);case"Expires":if("Open"===r.state.phase.$){var s=f(xR,e,r);if("TimeLeft"===s.$){var i=s.a,o=f(i$,i.a,i.b)<.05?EN:DR;return d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)}var u=s.a;return d(o$,M([ET(jk)]),M([bN(16)]),L(EN,IR),L(Vl(0),u))}return qk;case"Offer":return f(VN,M([kN(5)]),M([fl(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(u$(r.parameters.tradeAmount)+" ")+NR(r.factory))]));case"FiatPrice":return WR(r.terms.price);case"Margin":var c=R(r.parameters.initiatorRole,fo);return f(xc,qk,f(Bo,VR(c),r.derived.margin));case"PaymentWindow":var l=function(){return"Seller"===r.parameters.initiatorRole.$?EN:UR}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoabortInterval);default:var l=function(){return"Seller"===r.parameters.initiatorRole.$?UR:EN}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoreleaseInterval)}}())}),c$=n(function(e,t,r){return f(ON,M([ET(jk),kN(1),Wk(IR),uN,pN(f(AR,r.factory,r.id))]),M([f(VN,M([ET(jk),kN(1)]),f(xa,function(t){return l(s$,e,t,r)},t)),f(iR,1,kR(r.terms.paymentMethods))]))}),f$=Er,l$=ZT(28),d$=function(e){return f(yA,l$,l(vA,"bc-"+mA(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(yA,iA,h(h$,"b-"+Ni(e),e,e,e,e))},g$=a(function(e,t,r,n){return f(ON,M([ET(jk),p$(2),cN(8),d$(CR),kN(2),Wk(CR),rR]),f(xa,f(c$,e,r),f(f$,wR(t.orderBy),n)))}),v$=a(function(e,t,r,n){return f(ON,M([ET(jk),yT(jk),kN(5)]),M([f(bR,t.orderBy,r),d(g$,e,t,r,n)]))}),y$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),m$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(yA,rN,h(nN,"p-"+Ni(t),t,t,t,t)):f(yA,rN,h(nN,d(y$,t,r,n,a),t,r,n,a))},b$=lA(RT.italic),C$=a(function(e,t,r,n){var a=f(qN,n.filters,ay(f(xa,function(e){return f(jN,HN(n),GN(e))},r)));return R(a,yr)?f(Kk,M([wN,bN(24),m$({bottom:0,left:0,right:0,top:30}),b$]),fl(t?"No trades found with those filters.":"Initializing Trade Cache...")):f(Yi,Ko,d(v$,e,n.tradeTable,M([xo,JN,YN,WN,QN,zN]),a))}),E$=r(function(e,t){return f(Kk,M([cN(4),Wk(d(YR,0,0,1,.1)),bA(l(Ok,16,7,234)),bN(e),vN,f(aN,15,13)]),fl(dl(t)))}),S$=function(e){return function(){var t=Gd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?qk:f(VN,M([kN(10),m$({bottom:20,left:20,right:20,top:10})]),M([f(Kk,M([bN(24),vN]),fl("Trade History for User")),f(E$,18,e.agentAddress)]))},T$=function(e){return{$:"FiltersMsg",a:e}},w$=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},I$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),A$=xI,B$={$:"Left"},k$=SN(B$),N$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(fA,UN,TT("label"),e,wT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(fA,AT,Vk,a,wT(M([i])));switch(n.$){case"Above":return d(fA,UN,TT("label"),e,wT(M([o,r])));case"Below":return d(fA,UN,TT("label"),e,wT(M([r,o])));case"OnRight":return d(fA,FN,TT("label"),e,wT(M([r,o])));default:return d(fA,FN,TT("label"),e,wT(M([o,r])))}}),R$=function(e){return{$:"Label",a:e}},$$={$:"NoAttribute"},_$=function(e){if("HiddenLabel"===e.$){var t=e.a;return NN(R$(t))}return $$},L$=function(e){return"HiddenLabel"===e.$},x$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return hu("No key matched");var n=r.a;return Fi(n)},r=f(du,t,f(Oh,"key",pu));return ST(f(dN,"keyup",r))},P$=function(e){return f(Nn,"tabIndex",Ni(e))},D$=f(Da,ST,P$),U$={$:"LivePolite"},O$=NN(U$),M$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([L$(r)?$$:kN(6),ST(hN(i(!a))),O$,x$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),D$(0),uN,k$,ET(jk)]),e);return l(N$,o,r,d(fA,AT,Vk,M([ST(f(A$,"role","checkbox")),ST(f(A$,"aria-checked",a?"true":"false")),_$(r),eR,yT(jk),ET(bT)]),wT(M([n(a)]))))}),F$=Br,V$=function(e){return e*F$/180},K$=ZT(26),H$=function(e){return{$:"MoveY",a:e}},j$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),q$=function(e){return f(j$,K$,H$(-e))},G$=ZT(24),z$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),Y$=function(e){return f(j$,G$,f(z$,x(0,0,1),e))},W$=ZT(19),J$=function(e){return Cd(M([e.inset?"box-inset":"box-",mw(e.offset.a)+"px",mw(e.offset.b)+"px",mw(e.blur)+"px",mw(e.size)+"px",mA(e.color)]))},Q$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(yA,W$,l(jI,J$(t),"box-shadow",Cw(t)))},X$=r(function(e,t){return f(yA,iA,h(h$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Z$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?p$(r):f(X$,n,r):f(yA,iA,h(h$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},e_=ZT(12),t_=f(oN,e_,RT.textCenter),r_=l(pA,1,1,1),n_=function(e){return f(Kk,M([lA("focusable"),ET(zk(14)),yT(zk(14)),bA(r_),eR,bN(9),t_,cN(3),d$(e?l(pA,59/255,.6,252/255):l(pA,211/255,211/255,211/255)),Q$({blur:1,color:e?d(YR,238/255,238/255,238/255,0):l(pA,238/255,238/255,238/255),offset:L(0,0),size:1}),Wk(e?l(pA,59/255,.6,252/255):r_),p$(e?0:1)]),e?f(Kk,M([d$(r_),yT(zk(6)),ET(zk(9)),Y$(V$(-45)),wN,eR,q$(1),Z$({bottom:2,left:2,right:0,top:0})]),qk):qk)},a_=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),i_={$:"OnRight"},o_=a_(i_),u_=r(function(e,t){return f(M$,yr,{checked:t.checked,icon:n_,label:f(o_,yr,fl(t.label)),onChange:f(I$,e,t.label)})}),s_={$:"Top"},c_=XN(s_),f_=function(e){return f(ON,M([kN(15),c_]),M([f(Kk,M([bN(28),gR]),fl(w$(e.type_))),f(ON,M([kN(5)]),f(xa,u_(e.type_),e.options))]))},l_=function(e){return f(VN,M([kN(20)]),f(xa,f_,e))},d_={$:"NoneFound"},h_={$:"AllFetched"},p_={$:"FetchingTrades"},g_={$:"QueryingNumTrades"},v_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return g_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?p_:h_}return d_},y_={$:"InFront"},m_=function(e){return f(t$,y_,e)},b_=r(function(e,t){var r=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},n=f(Eh,Ja(d_),f(xa,v_,e))?M([r("No trades found.")]):f(xa,r,mE(f(xa,function(e){switch(v_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),m_(f(ON,M([kN(5),k$]),n))]),f(Kk,M([wN]),f(Yi,T$,l_(t.filters))))}),C_=n(function(e,t,r){return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),f(aN,30,20)]),M([S$(r),f(b_,t,r),function(){var n=f(Eh,f(zo,v_,Ja(h_)),t);return d(C$,e,n,t,r)}()]))}),E_=function(e){return{$:"ShowCurrencyDropdown",a:e}},S_={$:"AbortCreate"},T_=function(e){return{$:"AppCmd",a:e}},w_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),I_=function(e){return f(xa,function(e){return M([f(Kk,M([bA(EN)]),fl("Caution! ")),fl(e)])},mE(M([R(f(hv,e.autoreleaseInterval,Vl(12e5)),ba)?si(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."}()):ci,R(f(hv,e.autoabortInterval,Vl(36e5)),ba)?si(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.'}()):ci])))},A_=l(pA,0,0,1),B_=function(e){return f(Kk,M([m$({bottom:5,left:5,right:5,top:0}),pN(e),cN(30),Wk(d(YR,1,1,1,.4)),p$(1),d$(d(YR,0,0,0,.3)),uN,bN(14)]),f(Kk,M([bA(d(YR,0,0,0,.7))]),fl("x")))},k_=Bn,N_=k_,R_=ST,$_=r(function(e,t){return f(Kk,M([r$(f(Kk,M([Wk(e),R_(f(N_,"position","fixed")),R_(f(N_,"z-index","1000")),R_(f(N_,"top","0")),R_(f(N_,"left","0")),R_(f(N_,"width","100%")),R_(f(N_,"height","100%"))]),qk)),ET(jk),yT(jk)]),t)}),__=r(function(e,t){return{$:"Max",a:e,b:t}}),L_=r(function(e,t){return f(__,e,t)}),x_=n(function(e,t,r){return l(Pa,$_,d(YR,0,0,.3,.6),f(Kk,U(M([wN,eR,ET(f(L_,500,bT)),Wk(tN),cN(8),m_(f(Kk,M([PN,c_]),B_(r)))]),e),t))}),P_=r(function(e,t){if("Nothing"===t.$)return qk;var r=t.a;return f(Kk,U(M([cN(5),d$(l(pA,.9,0,0)),p$(1),Wk(l(pA,1,.4,.4)),aR(5),wN,eR,ET(f(L_,200,bT)),bN(14)]),e),f($N,yr,M([fl(r)])))}),D_={$:"Above"},U_=function(e){return f(t$,D_,e)},O_=r(function(e,t){return f(Kk,M([cN(4),f(aN,25,17),bN(18),vN,Wk(IR),U_(f(P_,M([q$(5)]),t))]),fl(e))}),M_=a(function(e,t,r,n){return d(hA,e/255,t/255,r/255,n)}),F_=d(M_,1,31,52,.64),V_=ZT(32),K_={$:"Active"},H_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),j_=$n,q_=r(function(e,t){switch(t.$){case"NoAttribute":return $$;case"Describe":var r=t.a;return NN(r);case"AlignX":var n=t.a;return SN(n);case"AlignY":var a=t.a;return XN(a);case"Width":var n=t.a;return CT(n);case"Height":var n=t.a;return vT(n);case"Class":var n=t.a,a=t.b;return f(oN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(yA,i,o);case"Nearby":var u=t.a,s=t.b;return f(t$,u,f(zi,e,s));case"Attr":var c=t.a;return ST(f(j_,e,c));default:var l=t.a,d=t.b;return f(j$,l,d)}}),G_=function(e){return f(q_,zg,e)},z_=r(function(e,t){var r=t.a,n=t.b,a=G_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(rA,n,o));default:return L(r,n)}}),Y_=function(e){var t=l(Ra,z_,L(yr,sA),e),r=t.a,n=t.b;return f(ka,qI(n),r)},W_=function(e){return f(yA,V_,f(H_,K_,Y_(e)))},J_=ZT(33),Q_={$:"Hover"},X_=function(e){return f(yA,J_,f(H_,Q_,Y_(e)))},Z_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Kk,M([cN(4),uN,pN(n),f(aN,25,17),bA(t),bN(18),vN,Wk(a),W_(M([Wk(o)])),X_(M([Wk(i)]))]),fl(r))}),eL=r(function(e,t){return d(Z_,x(d(YR,1,0,0,1),d(YR,1,0,0,.8),d(YR,1,0,0,.6)),tN,e,t)}),tL=function(e){return $_(d(YR,0,0,.3,.6))(f(ON,M([kN(10),wN,eR,Wk(d(YR,0,0,0,.5)),cN(8),aR(20)]),f(xa,function(e){return f($N,M([wN,eR,bN(20),vN,bA(tN),t_]),M([e]))},e)))},rL=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+kA(t)}e.a;return"https://kovan.etherscan.io/tx/"+kA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+kA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+kA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+kA(t)}}),nL={$:"Bottom"},aL=XN(nL),iL=lA(RT.underline),oL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(fl(u$(oC(a))),f(eL,"Yes, I definitely want to open this trade.",l(w_,r,n,a)))}return L(fl("??"),f(O_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),U(I_(n),U(M([M([fl("You will deposit "),i,fl(" "+NR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([fl("This ususally requires two Metamask signatures. Your "+NR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Kk,M([aL,wN]),o)])),S_);case"ApproveNeedsSig":var u=e.a;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),tL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","ApproveMining",0)))]),tL(M([fl("Mining the initial approve transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,eo(u),s)}),fl("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),tL(M([fl("Waiting for user signature for the create call."),fl("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","CreateMining",0)))]),tL(M([fl("Mining the final create call..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,r,s)}),fl("You will be redirected when it's mined.")])))}}),uL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return qk;var r=t.a;return f(oL,r,e)},sL=function(e){return{$:"TradeAmountChanged",a:e}},cL=dT("id"),fL=R_(cL("inputError")),lL=l(Ok,109,127,138),dL=uR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),hL=function(e){return f(dR,f(ka,yT(zk(26)),e),dL)},pL=function(e){return f(VN,M([kN(4)]),M([hL(yr),f(Kk,M([bN(24),gR,bA(lL)]),fl(NR(e)))]))},gL=function(e){return{$:"HiddenLabel",a:e}},vL=gL,yL=dT("type"),mL=function(e){return L(e,!0)},bL=function(e){return{$:"MayStopPropagation",a:e}},CL=r(function(e,t){return f(lN,e,bL(t))}),EL=r(function(e,t){return l(La,Oh,t,e)}),SL=f(EL,M(["target","value"]),pu),TL=function(e){return f(CL,"input",f(Oi,mL,f(Oi,e,SL)))},wL=ZT(0),IL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),AL=function(e){var t=function(e){return 1-e}(f(Tc,1,f(ei,0,e)));return f(yA,wL,f(IL,"transparency-"+dw(t),t))},BL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),kL=f(Da,ST,A$("autocomplete")),NL=l(pA,136/255,138/255,133/255),RL=l(pA,186/255,189/255,182/255),$L=f(aN,12,12),_L=M([$L,cN(3),d$(RL),Wk(r_),p$(1),kN(3),ET(jk)]),LL=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},xL=function(e){return f(Ch,LL,e)?$$:lA("focusable")},PL=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},DL=ye,UL=r(function(e,t){return f(kn,e,DL(t))}),OL=UL("spellcheck"),ML=f(Da,ST,OL),FL=W,VL=ZT(47),KL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(FL(e))),o=(i-1)*t+f(xc,0,f(Bo,a,r))+f(xc,0,f(Bo,a,n));return f(yA,VL,l(jI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),HL=dT("value"),jL=f(Da,ST,HL),qL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(fw,"width",n)?L(r,n):L(f(ka,e,r),f(Gm,"width",n));case"Height":e.a;return f(fw,"height",n)?L(r,n):L(f(ka,e,r),f(Gm,"height",n));case"Describe":e.a;return f(fw,"described",n)?L(r,n):L(f(ka,e,r),f(Gm,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(fw,"align-x",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-x",n));case"AlignY":return f(fw,"align-y",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-y",n));default:return f(fw,"transform",n)?L(r,n):L(f(ka,e,r),f(Gm,"transform",n))}}),L(yr,sm),e).a},GL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,qL(e))}),zL=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}},YL=f(Da,Gi,ms),WL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([ST(TL(n.onChange))]),o=U(_L,t),u=f(GL,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(ml,PL,o),c=f(GL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(GL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(GL,o,function(e){return"Nearby"===e.$})),p=f(ml,f(Da,ns,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([jL(n.text),ST(yL(a)),ML(e.spellchecked),lA(RT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return $$;var r=t.a;return kL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(zL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(BL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(BL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(xc,5,c);return x("textarea",U(M([ML(e.spellchecked),lA(RT.inputMultiline),f(xc,$$,f(Bo,kL,e.autofill)),function(){if("Nothing"===u.$)return $$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return m$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?$$:s.a?d(KL,n.text,v,u,g):$$}()]),h),M([YL(RI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(fA,AT,Vk,f(ka,ET(jk),ay(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([m_(f(Kk,f(ka,$L,U(s,U(M([bA(NL),lA(RT.noTextSelection+" "+RT.passPointerEvents),d$(d(YR,0,0,0,0)),Wk(d(YR,0,0,0,0)),yT(jk),ET(jk),AL(""===n.text?1:0)]),r))),a))])}()]))),wT(M([d(fA,AT,TT(v),ay(M([M([xL(t),_$(n.label)]),y,i])),wT(m))])));return l(N$,f(ka,f(oN,iN,RT.cursorText),f(ka,L$(n.label)?$$:kN(5),f(ka,O$,u))),n.label,b)}),JL=WL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),QL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(JL,M([ET(jk),yT(zk(40)),p$(0)]),{label:vL(r),onChange:i,placeholder:n,text:a});return f(VN,U(M([kN(5)]),e),mE(M([f(Bo,Kk(M([k$])),o),si(s),f(Bo,Kk(M([PN])),u)])))}),XL={$:"Below"},ZL=function(e){return f(t$,XL,e)},ex=function(e){return f(j$,K$,H$(e))},tx=n(function(e,t,r){return p(QL,M([ET(zk(150)),gR,bN(24),ZL(f(P_,M([fL,ex(5)]),r))]),L(ci,si(f(Kk,M([pN(T_(d(Zd,"click","misclick","dai symbol in dai input",0)))]),pL(e)))),"dai input",ci,t,sL)}),rx=Kk(M([d$(IR),Z$({bottom:2,left:0,right:0,top:0})])),nx=r(function(e,t){return f(ON,M([kN(10)]),M([f(Kk,M([bN(17),vN]),fl(e)),t]))}),ax=r(function(e,t){return rx(f(nx,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(tx,e,t.inputs.daiAmount,t.errors.daiAmount)))}),ix=function(e){return f(xc,gS,Mg(e))},ox=function(e){var t=function(){var t=vd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+u$(f(Gl,r,100))+" "+NR(ix(e.wallet))+"."}return"There is a 1% fee."}();return f(VN,M([wN,f(aN,20,10),Wk(l(Ok,10,33,108)),cN(8),kN(5),pN(T_(d(Zd,"click","misclick","fee notify element",0)))]),M([f(Kk,M([bN(18),bA(l(Ok,0,226,255)),vN]),fl(t)),f(Kk,M([bN(17),bA(tN),gR]),fl("We only collect this fee when trades resolve successfully."))]))},ux=function(e){return{$:"FiatAmountChanged",a:e}},sx=function(e){return{$:"FiatTypeChanged",a:e}},cx=r(function(e,t){return l(SS,n(function(t,r,n){return f(e,t,r)?l(xl,t,r,n):n}),cp,t)}),fx=function(e){return f(cx,r(function(t,r){return f(Qg,e,t)}),HR)},lx=uR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),dx=function(e){return f(dR,M([yT(zk(26))]),f(xc,lx,f(Bo,fu,f(fp,e,HR))))},hx=function(e){return R_(f(CL,"click",Fi(L(e,!0))))},px=YL,gx=function(e){return{$:"AppendProperty",a:e}},vx=r(function(e,t){return gx(e+":"+t)}),yx=r(function(e,t){return f(vx,e,t.value)}),mx=yx("cursor"),bx={$:"Compatible"},Cx={cursor:bx,value:"default"},Ex=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Sx=function(e){return{$:"PseudoClassSelector",a:e}},Tx=function(e){return Ex(Sx(e))}("hover"),wx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),Ix=wx,Ax=Ix,Bx=Ax("span"),kx=r(function(e,t){return f(kn,et(e),rt(t))}),Nx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),Rx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),$x=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),_x=r(function(e,t){return t<>>32-e}),Lx=function(e){var t=e.hash?e.seed^f($x,461845907,f(_x,15,f($x,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f($x,2246822507,r^r>>>16),a=f($x,3266489909,n^n>>>13);return(a^a>>>16)>>>0},xx=r(function(e,t){return f($x,5,f(_x,13,e^f($x,461845907,f(_x,15,f($x,3432918353,t)))))+3864292196}),Px=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},HP=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+"]"}},jP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,HP,r)));case"UniversalSelectorSequence":var r=e.a;return Iu(r)?"*":f(Ri,"",f(xa,HP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,HP,r)))}},qP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([KP(t),jP(r)]))},GP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,jP(t),f(xa,qP,r)),i=f(Ri,"",M([f(xc,"",f(Bo,VP,n))]));return f(oc,f(Ri," ",f(ml,f(Da,ns,_d),a)),i)},zP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,GP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,FP(a),"\n",e,"}"]))}),YP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(zP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,xP,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,OP,zP(" ")),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"}},WP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(ml,f(Da,ns,_d),M([$P(t),f(Ri,"\n",f(xa,DP,r)),f(Ri,"\n",f(xa,UP,n)),f(Ri,"\n\n",f(xa,YP,a))])))},JP=function(e){return WP(RP(BP(e)))},QP=function(e){return f(Ri,"\n\n",f(xa,JP,e))},XP=function(e){return{$:"Snippet",a:e}},ZP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),eD=function(e){return{$:"StyleBlockDeclaration",a:e}},tD=r(function(e,t){var r=l(eP,t,yr,ci);return XP(M([eD(l(ZP,r,yr,e))]))}),rD=function(e){return Iu(e)?"unstyled":f(Is,P("_"),Ps(f(Dx,15739,QP(AS(Ux(AS(f(tD,e,dP(yr)))))))))},nD=function(e){var t=rD(e),r=f(kx,"className",hl(t));return l(Nx,r,e,t)},aD=a(function(e,t,r,n){return f(e,f(ka,nD(t),r),n)}),iD=function(e){return{$:"Unstyled",a:e}},oD=function(e){return iD(Tw(e))},uD=oD,sD=r(function(e,t){return f(Tn,e,Xe(t))}),cD=function(e){return En(Xe(e))},fD=r(function(e,t){var r=e.b,n=e.c;return Iu(r)?t:l(xl,n,r,t)}),lD=function(e){return e.a},dD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,fD,i,s),p=l(Ra,hD,L(yr,h),c),g=p.a,v=p.b,o=l(JT,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,fD,i,s),m=l(Ra,hD,L(yr,h),c),g=m.a,v=m.b,o=d(cD,y,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,fD,i,s),b=l(Ra,dD,L(yr,h),c),g=b.a,v=b.b,o=l(WT,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,fD,i,s),C=l(Ra,dD,L(yr,h),c),g=C.a,v=C.b,o=d(sD,y,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),hD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,fD,n,o),c=l(Ra,hD,L(yr,s),u),h=c.a,p=c.b,a=l(JT,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,fD,n,o),v=l(Ra,hD,L(yr,s),u),h=v.a,p=v.b,a=d(cD,g,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,fD,n,o),y=l(Ra,dD,L(yr,s),u),h=y.a,p=y.b,a=l(WT,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,fD,n,o),m=l(Ra,dD,L(yr,s),u),h=m.a,p=m.b,a=d(sD,g,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p)}}),pD=r(function(e,t){return h(Nl,kl,e,t,Rl,Rl)}),gD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(_d(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),vD=function(e){var t=f(gD,ci,e);if("Nothing"===t.$)return cp;var r=t.a,n=r.a,a=r.b;return f(pD,n,a)},yD=function(e){return{$:"ClassSelector",a:e}},mD=function(e){var t=e.a,r=e.b;return f(tD,r,dP(M([yD(t)])))},bD=function(e){return QP(AS(Ux(f(xa,mD,Ia(e)))))},CD=function(e){return l(JT,"style",yr,AS(Tw(bD(e))))},ED=n(function(e,t,r){var n=f(xa,lD,t),a=vD(t),i=l(Ra,hD,L(yr,a),r),o=i.a,u=i.b,s=CD(u);return l(JT,e,n,f(ka,s,$a(o)))}),SD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),TD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(SD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),wD=r(function(e,t){return L(f(TD,"_",t),CD(e))}),ID=n(function(e,t,r){var n=f(xa,lD,t),a=vD(t),i=l(Ra,dD,L(yr,a),r),o=i.a,u=i.b,s=f(wD,u,o);return l(WT,e,n,f(ka,s,$a(o)))}),AD=a(function(e,t,r,n){var a=f(xa,lD,r),i=vD(r),o=l(Ra,dD,L(yr,i),n),u=o.a,s=o.b,c=f(wD,s,u);return d(sD,e,t,a,f(ka,c,$a(u)))}),BD=a(function(e,t,r,n){var a=f(xa,lD,r),i=vD(r),o=l(Ra,hD,L(yr,i),n),u=o.a,s=o.b,c=CD(s);return d(cD,e,t,a,f(ka,c,$a(u)))}),kD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(ED,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(BD,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(ID,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(AD,a,t,r,n)}},ND=kD,RD=function(e){return px(ND(d(aD,Bx,M([Tx(M([mx(Cx)]))]),yr,M([uD(e)]))))},$D=J,_D=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),LD=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),xD=function(e){return l(La,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 si(h(_D,n,a,i,o,u))}return ci}(),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 si(l(LD,a,t,i))}return ci}())}),L(ci,ci),e)},PD=r(function(e,t){var r=xD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),e))),wT(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?si(m$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),U(e,M([h]))))),wT(t))}var p=-s/2,g=-u/2;return d(fA,AT,Vk,e,wT(M([d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ST(f(N_,"margin",mw(p)+"px "+mw(g)+"px")),f(ka,ST(f(N_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,ST(f(N_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(yA,IN,l(AN,o,u,s)),yr))))),wT(t))])))}),DD=i(function(e,t,r,n,a){var i=f(JL,M([ET(zk(80)),yT(zk(40)),bN(24),gR,d$(IR),hx(r)]),{label:vL("currency type"),onChange:f(zo,$D,n),placeholder:ci,text:t}),o=f(fp,t,HR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return qk;r.b;return f(PD,M([ET(zk(350)),d$(DR),p$(1),Wk(tN),aR(10),wN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(VN,M([ET(zk(80)),kN(9),f(aN,0,5),hx(n(t)),X_(M([Wk(l(pA,.8,.8,1))]))]),M([f(dR,M([yT(zk(26))]),a),f(Kk,M([bN(16),vN]),RD(t))]))},Ia(fx(t))))}return qk}();return f(VN,M([kN(4),ZL(u)]),M([f(Kk,M([pN(a)]),dx(t)),i]))}),UD=i(function(e,t,r,n,a){var i=T_(d(Zd,"click","misclick","currency flag",0)),o=f(Kk,M([pN(T_(d(Zd,"click","misclick","currency symbol",0)))]),fl(jR(e))),u=f(Kk,M([ZL(f(P_,M([fL,ex(5)]),a))]),h(DD,r,e,E_(!0),sx,i));return p(QL,M([ET(zk(250)),gR,bN(24),ZL(f(P_,M([fL,ex(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,ux)}),OD=function(e){return rx(f(nx,"For fiat",h(UD,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},MD=function(e){return{$:"ChangeRole",a:e}},FD=d(M_,1,31,52,.13),VD=r(function(e,t){var r=M([bN(24),gR,uN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([bA(FD)]))):L(U(r,M([bA(FD)])),r)}(),a=n.a,i=n.b;return f(VN,M([kN(20)]),M([f(Kk,U(M([pN(MD(lo))]),i),fl("Sell "+e)),f(Kk,U(M([pN(MD(fo))]),a),fl("Buy "+e))]))}),KD=r(function(e,t){return f(nx,"Trade Type",f(VD,NR(e),t.inputs.userRole))}),HD=Q$({blur:20,color:d(M_,0,0,0,.04),offset:L(0,3),size:0}),jD=f(oN,IN,RT.spaceEvenly),qD=function(e){var t=ix(e.wallet);return f(ON,M([ET(jk),kN(20),Wk(tN),cN(5),aR(20),HD]),M([f(VN,M([ET(jk),jD]),M([f(KD,t,e),f(ax,t,e),OD(e)])),ox(e)]))},GD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),zD={$:"Web3Connect"},YD=function(e){return f(Kk,M([wN]),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(eL,"Open Trade",f(GD,n,r))}t.b;return f(O_,"Unsupported Network",ci)}t.a;return f(eL,"Connect to Wallet",zD)}())},WD=function(e){return{$:"AutoabortIntervalChanged",a:e}},JD=function(e){return{$:"ChangePaymentMethodText",a:e}},QD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),XD=QD,ZD=function(e){return f(XD,M([bA(d(YR,0,0,0,.2))]),function(){return fl("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")}())},eU={$:"TextArea"},tU=r(function(e,t){return l(WL,{autofill:ci,spellchecked:t.spellcheck,type_:eU},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),rU=n(function(e,t,r){var n=f(Kk,M([bN(22),vN]),fl("Payment Method")),a=f(tU,M([ET(jk),yT(zk(150)),Wk(d(M_,155,203,255,.2)),p$(0)]),{label:vL("payment method"),onChange:JD,placeholder:""===r?si(ZD(t)):ci,spellcheck:!0,text:r});return f(ON,M([kN(20),m$({bottom:15,left:45,right:45,top:0}),ET(jk),U_(f(P_,M([fL,ex(30),aR(10),bN(20),ET(zk(400))]),e))]),M([n,a]))}),nU=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."},aU=a(function(e,t,r,n){var a=l(Rs,e,P("0"),Ni(n));return f(Kk,M([bN(22),bA(t)]),fl(U(a,r)))}),iU=function(e){return jd(e)<0?Vl(0):e},oU=n(function(e,t,n){var a=r(function(e,r){return f(ON,M([kN(4)]),M([f(Kk,M([aR(4),uN,pN(n(f(qb,t,e)))]),f(dR,M([yT(zk(10))]),hR)),r,f(Kk,M([aR(4),uN,pN(n(function(e){return jd(e)?e:Vl(3e5)}(iU(f(LR,t,e)))))]),f(dR,M([yT(zk(10))]),sR))]))}),i=XR(t);return f(VN,M([jD,kN(10)]),M([f(a,Vl(864e5),d(aU,3,e," days",i.days)),f(a,Vl(36e5),d(aU,2,e," hours",i.hours)),f(a,Vl(3e5),d(aU,2,e," min",i.min))]))}),uU=o(function(e,t,r,n,a,i){var o=f(Kk,M([Wk(d(M_,155,203,255,.2)),cN(5),aR(15),U_(f(P_,M([fL]),a))]),l(oU,DR,n,i)),u=f(VN,M([kN(30)]),M([f(dR,M([yT(zk(40)),pN(T_(d(Zd,"click","misclick","symbol for "+t,0)))]),e),f(Kk,M([bN(22),vN]),fl(t))])),s=f($N,M([bN(17),gR,bA(F_)]),M([fl(r)]));return f(ON,M([ET(jk),cN(10),Wk(l(Ok,237,237,237)),kN(2)]),f(xa,Kk(M([Wk(tN),f(aN,45,18),ET(jk)])),M([u,f(VN,M([ET(jk),kN(25),Wk(tN)]),M([o,s]))])))}),sU=uR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),cU=f(oN,tR,RT.clipX),fU=f(oN,tR,RT.clipY),lU=i(function(e,t,r,n,a){return f(ON,M([kN(15),cN(8),cU,fU,Wk(tN)]),M([p(uU,sU,"Payment Window",nU(a),r,n,WD),l(rU,t,a,e)]))}),dU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},hU=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."},pU=uR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),gU=n(function(e,t,r){return f(Kk,M([cN(8),cU,fU,Wk(tN)]),p(uU,pU,"Burn/Release Window",hU(r),e,t,dU))}),vU=function(e){return{$:"AutorecallIntervalChanged",a:e}},yU=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."},mU=uR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),bU=n(function(e,t,r){return f(Kk,M([cN(8),Wk(tN),cU,fU]),p(uU,mU,"Open Window",yU(r),e,t,vU))}),CU=function(e){return f(ON,M([ET(jk),kN(20)]),M([l(bU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(lU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(gU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},EU=function(e){return f(ON,M([ET(f(L_,1e3,jk)),wN,kN(20),m$({bottom:30,left:40,right:40,top:0}),pN(E_(!1)),m_(uL(e))]),M([qD(e),CU(e),YD(e.wallet)]))},SU=As(vb(8226)),TU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),wU=r(function(e,t){return l(Ra,ka,t,e)}),IU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(wU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),AU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(wU,f(lc,e%r,t),l(IU,yr,e/r|0,t))):f(lc,e,t)}),BU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(fw,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(Gm,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),kU=function(e){return d(BU,Ua,sm,e,yr)},NU=r(function(e,t){return f(Kk,M([ET(jk),m_(f(VN,M([kN(3),ET(nR(100)),ET(t),rR]),f(TU,f(Kk,M([bA(d(YR,0,0,0,.1)),bN(14)]),fl(SU)),f(xa,f(Da,Kk(M([bA(d(YR,0,0,0,.2))])),fl),f(AU,100,(e?$a:Ua)(kU(f(xa,f(zo,fu,Qa),Ia(HR)))))))))]),fl(" "))}),RU=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e))))),wT(M([n])))}),$U=function(){var e=f(Da,Kk(M([bA(l(pA,.8,.2,.2))])),fl),t=f(Da,Kk(M([_N])),fl);return f(ON,M([ET(jk),yT(jk),Wk(tN),cN(6),kN(50),Q$({blur:20,color:d(M_,0,0,0,.1),offset:L(0,3),size:0}),cN(10),aR(20)]),M([f(NU,!1,jk),f(ON,M([wN,ET(f(L_,700,jk)),kN(20)]),M([f($N,M([bN(70),_N,wN,t_]),M([fl("DAI"),e("Hard")])),f(VN,M([bN(30),vN,wN,t_,b$]),M([fl("The "),e("Global"),fl(", "),e("Unkillable"),fl(" Crypto Gateway")]))])),f(VN,M([Wk(CR),kN(2),wN,c_,ET(jk)]),M([f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([kN(60),PN]),M([f(Kk,M([bN(40),vN,wN]),fl("Want to learn more?")),f(ON,M([kN(15)]),M([f(RU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(A_),bA(tN),_N,bN(24),wN]),{label:f($N,M([t_]),M([fl("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"}),f(RU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(A_),bA(tN),_N,bN(24),wN]),{label:f($N,M([t_]),M([fl("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})]))]))),f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([k$,kN(60)]),M([f(Kk,M([bN(40),vN,wN]),fl("Ready to try it out?")),f(ON,M([kN(10),ET(zk(400)),wN]),M([f($N,M([bN(24),ET(jk)]),M([fl("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f($N,M([bN(24),ET(jk)]),M([fl("Then follow the links at the top of this page to browse "),t("Sell Offers"),fl(", browse "),t("Buy Offers"),fl(", or "),t("Create Your Own Offer"),fl(".")]))]))])))])),f(Kk,M([aL,ET(jk)]),f(NU,!0,jk))]))}(),_U=r(function(e,t){return f(Ay,f(zo,function(e){return e.type_},Ja(e)),t)}),LU=function(e){return{$:"ShowCurrencyDropdown",a:e}},xU=r(function(e,t){return ml(t(e))}),PU=i(function(e,t,r,n,a){var i=l(xU,e,a.filterFunc,ay(f(xa,GN,n)));return R(i,yr)?f(Kk,M([wN,bN(24),m$({bottom:0,left:0,right:0,top:30}),b$]),fl(r?"No trades found with those filters.":"Initializing Trade Cache...")):f(Yi,Rv,d(v$,e,a.tradeTable,M([t?Av:xo,JN,YN,WN,QN,zN]),i))}),DU=function(e){return{$:"FiltersMsg",a:e}},UU={$:"ApplyInputs"},OU=UL("disabled"),MU=function(e){return{$:"MayPreventDefault",a:e}},FU=r(function(e,t){return f(lN,e,MU(t))}),VU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):hu("Not the enter key")},n=f(du,r,f(Oh,"key",pu));return ST(f(FU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),KU=function(e){return f(VU,"Enter",e)},HU={$:"Button"},jU=r(function(e,t){var r=t.onPress,n=t.label;return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY+" "+RT.seButton+" "+RT.noTextSelection),f(ka,uN,f(ka,xL(e),f(ka,NN(HU),f(ka,ST(P$(0)),function(){if("Nothing"===r.$)return f(ka,ST(OU(!0)),e);var t=r.a;return f(ka,pN(t),f(ka,KU(t),e))}()))))))),wT(M([n])))}),qU=f(jU,M([Wk(A_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Apply")),onPress:si(UU)}),GU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(yA,sN,l(jI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},zU=function(e){return f(dN,"focus",Fi(e))},YU=f(Da,ST,zU),WU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([YU(e(!0)),hx(e(!0))])}();return f(VN,U(e,M([yT(zk(40)),Q$({blur:20,color:d(M_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Kk,M([Wk(IR),yT(zk(40)),GU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Kk,M([eR,f(aN,10,0)]),r)),f(JL,U(s,U(t,M([ET(zk(100)),yT(zk(40)),d$(IR),GU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),Z$({bottom:1,left:0,right:1,top:1})]))),{label:vL(n),onChange:u,placeholder:i,text:a})]))}),JU=function(e){return{$:"MaxDaiChanged",a:e}},QU=function(e){return{$:"MinDaiChanged",a:e}},XU=r(function(e,t){return f(ON,M([ET(jk),kN(8)]),M([f(Kk,M([bN(17),gR]),fl(e)),t]))}),ZU=ZT(25),eO=function(e){return{$:"MoveX",a:e}},tO=function(e){return f(j$,ZU,eO(-e))},rO={$:"OnLeft"},nO=function(e){return f(t$,rO,e)},aO=n(function(e,t,r){var n=hL(M([eR])),a=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("max"))])),i=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("min"))]));return f(XU,"Dai Range",f(ON,M([kN(5),ET(zk(200))]),M([v(WU,M([nO(f(P_,M([tO(5),ET(zk(200))]),r.minDai))]),M([YU(LU(!1))]),i,"min Dai",e,ci,ci,QU),v(WU,M([nO(f(P_,M([tO(5),ET(zk(200))]),r.maxDai))]),M([YU(LU(!1))]),a,"max Dai",t,ci,ci,JU)])))}),iO=function(e){var t=f(fp,e,HR);if("Nothing"===t.$)return fl("*");var r=t.a,n=r.b;return f(dR,M([yT(zk(26))]),n)},oO=function(e){return{$:"AppCmd",a:e}},uO=function(e){return{$:"FiatTypeInputChanged",a:e}},sO=n(function(e,t,r){var n=oO(d(Zd,"click","misclick","currency flag",0)),a=iO(t);f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("max"))])),f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("min"))]));return f(Kk,M([c_,ET(zk(120))]),f(XU,"Fiat Type",h(DD,e,t,LU(!0),uO,n)))}),cO={$:"AddSearchTerm"},fO=function(e){return{$:"PaymentMethodInputChanged",a:e}},lO=f(Oh,"keyCode",CE),dO=function(e){return f(dN,"keyup",f(du,function(t){return 13===t?Fi(e):hu(Ni(t))},lO))},hO=function(e){return f(XU,"Search Payment Methods",f(JL,M([c_,ET(zk(250)),yT(zk(40)),d$(IR),Q$({blur:20,color:d(M_,233,237,242,.05),offset:L(0,3),size:0}),R_(dO(cO))]),{label:vL("payment methods search"),onChange:fO,placeholder:ci,text:e}))},pO={$:"ResetSearch"},gO=f(jU,M([Wk(A_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Reset")),onPress:si(pO)}),vO=function(e){return{$:"RemoveTerm",a:e}},yO=function(e){return f(Kk,M([aR(3),c_,uN,pN(vO(e)),bN(10),bA(EN)]),fl("x"))},mO=function(e){if(e.b){var t=e;return f(VN,M([ET(jk),aR(10),kN(10)]),f(xa,function(e){return f(VN,M([Wk(d(M_,16,7,234,.2)),cN(5),aR(4),kN(3)]),M([fl(e),yO(e)]))},t))}return qk},bO=i(function(e,t,r,n,a){var i=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},o=f(Eh,Ja(d_),f(xa,v_,e))?M([i("No trades found.")]):f(xa,i,mE(f(xa,function(e){switch(v_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),m_(f(ON,M([kN(5),k$]),o))]),f(VN,M([wN,kN(50)]),M([f(Yi,DU,l_(t)),f(VN,M([ET(bT),kN(10)]),M([f(Kk,M([ET(bT),c_]),l(aO,r.minDai,r.maxDai,n)),f(Kk,M([ET(bT),c_]),l(sO,a,r.fiatType,n)),f(ON,M([ET(bT),c_,kN(5)]),M([hO(r.paymentMethod),mO(r.paymentMethodTerms)])),f(XU," ",f(ON,M([kN(5),ET(bT)]),M([qU,gO])))]))])))}),CO=n(function(e,t,r){var n=f(Eh,f(zo,v_,Ja(h_)),t),a=function(){return!f(xc,0,f(Bo,function(e){return f(MS,function(e){return e.checked&&"Open"!==e.label},e.options)},f(_U,Eo,r.filters)))}();return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),pN(LU(!1)),aR(30)]),M([f(VN,M([ET(jk),kN(10)]),M([h(bO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),h(PU,e,a,n,t,r)]))}),EO=function(e){return{$:"MessageInputChanged",a:e}},SO={$:"MessageSubmit"},TO=function(e){return f(ON,M([ET(jk),kN(10)]),M([f(tU,M([ET(jk),yT(zk(100))]),{label:vL("messageInput"),onChange:EO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(jU,M([wN,bN(24)]),{label:fl("Submit"),onPress:si(SO)})]))},wO=f(oN,tR,RT.scrollbarsY),IO=r(function(e,t){return f(Kk,M([yT(jk),ET(jk)]),f(Kk,U(M([R_(f(N_,"position","absolute")),R_(f(N_,"top","0")),R_(f(N_,"right","0")),R_(f(N_,"bottom","0")),R_(f(N_,"left","0")),wO]),e),t))}),AO=l(Ok,200,205,210),BO=n(function(e,t,r){var n=M([PN,Wk(A_),bA(tN),GU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([k$,Wk(AO),bA(DR),GU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Kk,U(M([aR(7)]),u),f($N,yr,M([fl(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(pA,0,0,1),tN,"Initiator opened the trade"));case"Recalled":return si(x(l(pA,0,0,1),tN,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(ru,8,dl(t))+"..";return si(x(l(pA,1,0,1),tN,r+" committed to the trade"));case"Aborted":return si(x(l(pA,1,0,0),tN,"Buyer aborted the trade"));case"Claimed":return si(x(l(pA,0,1,0),tN,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(pA,0,0,1),tN,"Seller released the "+NR(e)+" and closed the contract"));default:return si(x(l(pA,0,0,1),tN,"Seller burned the "+NR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return qk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Kk,M([cN(3),p$(1),d$(l(pA,1,0,1)),wN,Wk(h)]),f($N,M([bA(p)]),M([fl(g)])))}),kO=n(function(e,t,r){if(r.b){var n=r;return f(IO,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),aR(10)]),f(ON,M([ET(jk),yT(jk),kN(10)]),f(xa,f(BO,e,t),n)))}return f(Kk,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),wN,bA(l(pA,.5,.5,.5)),b$]),fl("no messages found."))}),NO=Cr,RO=function(e){return f(ON,M([ET(jk),yT(jk),kN(10),p$(1),cN(5),aR(20)]),M([l(kO,e.trade.factory,e.userRole,f(NO,function(e){return e.blocknum},Sa(e.history))),TO(e)]))},$O=function(e){return f(Kk,M([Wk(tN),cN(8),HD,ET(jk),yT(jk)]),RO(e))},_O={$:"ToggleChat"},LO=function(e){if(e.showChatHistory){var t=f(xc,qk,f(Bo,$O,e.chatHistoryModel));return f(Kk,M([yT(jk),ET(zk(500)),aR(20),PN]),l(x_,M([yT(jk),ET(jk)]),f(Yi,jE,t),_O))}return qk},xO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},PO=function(e){return zR(e)+" "+e.fiatType},DO={$:"AbortAction"},UO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),OO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return qk}if("LoadedTrade"!==t.b.$)return qk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=PO(n.terms.price),u=u$(oC(i)),s=u$(n.parameters.tradeAmount)+" "+NR(n.factory),c=function(){return"Buyer"===xO(n.parameters).$?L(f(Kk,M([gR,bA(DR)]),fl("buyer")),M([fl("pay the seller "),f(Kk,M([bA(A_)]),fl(o)),fl(" in exchange for the "),f(Kk,M([bA(A_)]),fl(s)),fl(" held in this contract.")])):L(f(Kk,M([gR,bA(DR)]),fl("seller")),M([fl("accept "),f(Kk,M([bA(A_)]),fl(o)),fl(" from the buyer in exchange for the "),f(Kk,M([bA(A_)]),fl(s)),fl(" held in this contract.")]))}(),d=c.a,h=c.b;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),U(M([U(M([fl("You will deposit "),f(Kk,M([bA(A_)]),fl(u+" "+NR(n.factory))),fl(", thereby becoming the "),d,fl(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([fl("(This ususally requires two Metamask signatures. Your "+NR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Kk,M([aL,wN]),f(eL,"Yes, I definitely want to commit to this trade.",l(UO,n,a,i)))])),DO);case"ApproveNeedsSig":return tL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return tL(M([fl("Mining the initial approve transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,n.factory,p)}),fl("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return tL(M([fl("Waiting for user signature for the final commit call."),fl("(check Metamask!)"),fl("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return tL(M([fl("Mining the final commit transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction"),url:f(rL,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([fl('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 '+NR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([fl("Aborting will incur a small penalty on both parties, and refund the rest of the "+NR(n.factory)+".")])]);case"Release":return M([M([fl("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([fl("This will destroy the "+NR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Kk,M([aL,wN]),function(e){return f(eL,e,sS(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 "+NR(n.factory)+".";default:return"I understand. Burn the "+NR(n.factory)+"."}}()))])),DO);case"ActionNeedsSig":var g=r.a;return tL(M([fl("Waiting for user signature for the "+fS(g)+" call."),fl("(check Metamask!)")]));default:var g=r.a,p=r.b;return qk}},MO=VN(M([ET(jk),Wk(tN),cN(5),aR(20),jD,HD])),FO=function(e){return f(VN,M([kN(8)]),M([f(dR,yr,dL),f(Kk,M([bN(24),gR]),fl(u$(e)))]))},VO=r(function(e,t){var r=f(Io,Ao(e),f(Bo,function(e){return e.address},Gd(t)));return f(nx,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"}(),FO(e.parameters.tradeAmount))}),KO=function(e){return f(VN,M([kN(5)]),M([dx(e.fiatType),f(Kk,M([bN(24),gR]),fl(PO(e)))]))},HO=function(e){return f(nx,"For Fiat",KO(e.terms.price))},jO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},qO=l(Ok,250,165,22),GO=l(Ok,255,0,0),zO=l(Ok,0,255,0),YO=uR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),WO=uR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),JO=uR({description:"released",src:"/DAIHard/static/img/released.svg"}),QO={$:"ToggleStatsModal"},XO=function(e){return f(NO,Ua,e)},ZO=n(function(e,t,n){var a=ay(f(xa,function(e){return f(ml,function(e){return R(f(ko,e,n),si(t))},f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(fh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(fh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wl,amountReleased:Wl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,Vl,Ql(XO(f(US,function(e){return function(e){return e?si(e):ci}(jd(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}}),eM=r(function(e,t){return d(Z_,x(d(YR,0,0,1,1),d(YR,0,0,1,.8),d(YR,0,0,1,.6)),tN,e,t)}),tM=function(e){return{$:"ViewUserHistory",a:e}},rM=f(JB,0,yr),nM=f(oN,gN,RT.textNormalWeight),aM=r(function(e,t){return Za(e/t)}),iM=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}}),oM=r(function(e,t){var r=e.a,n=e.b;return l(iM,r,f(aM,jd(t),6e4),n)}),uM=r(function(e,t){return f(_s,24,f(aM,f(oM,e,t),60))}),sM=r(function(e,t){return f(_s,1e3,jd(t))}),cM=r(function(e,t){return f(_s,60,f(oM,e,t))}),fM={$:"Apr"},lM={$:"Aug"},dM={$:"Dec"},hM={$:"Feb"},pM={$:"Jan"},gM={$:"Jul"},vM={$:"Jun"},yM={$:"Mar"},mM={$:"May"},bM={$:"Nov"},CM={$:"Oct"},EM={$:"Sep"},SM=function(e){var t=f(aM,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)}},TM=r(function(e,t){switch(SM(f(oM,e,t)).month){case 1:return pM;case 2:return hM;case 3:return yM;case 4:return fM;case 5:return mM;case 6:return vM;case 7:return gM;case 8:return lM;case 9:return EM;case 10:return CM;case 11:return bM;default:return dM}}),wM=r(function(e,t){return f(_s,60,f(aM,jd(t),1e3))}),IM={$:"Fri"},AM={$:"Mon"},BM={$:"Sat"},kM={$:"Sun"},NM={$:"Thu"},RM={$:"Tue"},$M={$:"Wed"},_M=r(function(e,t){switch(f(_s,7,f(aM,f(oM,e,t),1440))){case 0:return NM;case 1:return IM;case 2:return BM;case 3:return kM;case 4:return AM;case 5:return RM;default:return $M}}),LM=n(function(e,t,r){return e.toAmPm(f(uM,t,r))}),xM=r(function(e,t){return SM(f(oM,e,t)).day}),PM=xM,DM=M([kM,AM,RM,$M,NM,IM,BM]),UM=r(function(e,t){return function(e){return e.a}(f(xc,L(0,kM),Ql(f(ml,function(r){return R(r.b,f(_M,e,t))},f(Bi,r(function(e,t){return L(e,t)}),DM)))))}),OM=function(e){return l(Ra,Na,0,e)},MM=r(function(e,t){return SM(f(oM,e,t)).year}),FM=function(e){return!f(_s,4,e)&&(!!f(_s,100,e)||!f(_s,400,e))},VM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return FM(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}}),KM=M([pM,hM,yM,fM,mM,vM,gM,lM,EM,CM,bM,dM]),HM=r(function(e,t){return f(xc,L(0,pM),Ql(f(ml,function(r){r.a;return R(r.b,f(TM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),KM))))}),jM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(HM,e,t))}),qM=r(function(e,t){var r=f(lc,f(jM,e,t)-1,KM);return OM(f(xa,VM(f(MM,e,t)),r))+f(PM,e,t)}),GM=r(function(e,t){return f(jM,e,t)/4|0}),zM=r(function(e,t){var r=Ni(t),n=e-Qo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),YM=function(e){return e?e<=12?e:e-12:12},WM=sv(315576e5),JM=r(function(e,t){return Vl(WM*f(MM,e,t))}),QM=r(function(e,t){var r=f(JM,e,t),n=f(UM,e,r);return 1+((f(qM,e,t)+n)/7|0)}),XM=r(function(e,t){return Ni(f(MM,e,t))}),ZM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(jM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(jM,t,r));case"MonthFixed":return f(zM,2,f(jM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(TM,t,r));case"MonthNameFull":return e.toMonthName(f(TM,t,r));case"QuarterNumber":return Ni(1+f(GM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(GM,t,r));case"DayOfMonthNumber":return Ni(f(PM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(PM,t,r));case"DayOfMonthFixed":return f(zM,2,f(PM,t,r));case"DayOfYearNumber":return Ni(f(qM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(qM,t,r));case"DayOfYearFixed":return f(zM,3,f(qM,t,r));case"DayOfWeekNumber":return Ni(f(UM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(UM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(_M,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(_M,t,r));case"WeekOfYearNumber":return Ni(f(QM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(QM,t,r));case"WeekOfYearFixed":return f(zM,2,f(QM,t,r));case"YearNumberLastTwo":return f(ou,2,f(XM,t,r));case"YearNumber":return f(XM,t,r);case"AmPmUppercase":return $D(l(LM,e,t,r));case"AmPmLowercase":return sd(l(LM,e,t,r));case"HourMilitaryNumber":return Ni(f(uM,t,r));case"HourMilitaryFixed":return f(zM,2,f(uM,t,r));case"HourNumber":return Ni(YM(f(uM,t,r)));case"HourFixed":return f(zM,2,YM(f(uM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(uM,t,r));case"HourMilitaryFromOneFixed":return f(zM,2,1+f(uM,t,r));case"MinuteNumber":return Ni(f(cM,t,r));case"MinuteFixed":return f(zM,2,f(cM,t,r));case"SecondNumber":return Ni(f(wM,t,r));case"SecondFixed":return f(zM,2,f(wM,t,r));case"MillisecondNumber":return Ni(f(sM,t,r));case"MillisecondFixed":return f(zM,3,f(sM,t,r));default:return n.a}}),eF=a(function(e,t,r,n){return f(Ri,"",f(xa,l(ZM,e,r,n),t))}),tF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),rF=function(e){return e>11?"pm":"am"},nF=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"}},aF=function(e){switch(f(_s,100,e)){case 11:case 12:case 13:return"th";default:switch(f(_s,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},iF=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"}},oF=p(tF,nF,f(zo,nF,ru(3)),iF,f(zo,iF,ru(3)),rF,aF),uF=eF(oF),sF={$:"MonthNameFull"},cF=sF,fF=function(e){return{$:"Text",a:e}},lF=fF,dF={$:"YearNumber"},hF=dF,pF=n(function(e,t,n){var a=r(function(e,t){return f(ON,M([bN(18),kN(6)]),M([f(Kk,M([_N]),fl(e)),f(Kk,M([nM]),fl(t))]))}),i=uF(M([cF,lF(", "),hF])),o=f(ON,M([kN(23),ET(jk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,rM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+u$(n.amountReleased)+" "+NR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+u$(n.amountBurned)+" "+NR(e)+" Burned")])),M([f(Kk,M([wN]),f(eM,"View User History",tM(n.asRole)))])));return f(ON,M([cN(8),cU,fU,Wk(IR),kN(1),Q$({blur:20,color:d(YR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Kk,M([ET(jk),Wk(tN),aR(17)]),f(E$,18,t)),f(Kk,M([ET(jk),Wk(tN),aR(17)]),o)]))}),gF=n(function(e,t,r){var n=l(ZO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=jO(e.parameters.initiatorRole)+" Stats";return f(Kk,r?M([ZL(f(Kk,M([ex(30),PN]),l(pF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(nx,a,f(VN,M([ET(jk),kN(20),uN,pN(QO)]),f(xa,VN(M([kN(5)])),M([M([f(dR,M([yT(zk(28))]),JO),f(Kk,M([bN(24),gR,bA(zO)]),fl(l(Rs,2,P("0"),Ni(n.numReleases))))]),M([f(dR,M([yT(zk(28))]),YO),f(Kk,M([bN(24),gR,bA(qO)]),fl(l(Rs,2,P("0"),Ni(n.numAborts))))]),M([f(dR,M([yT(zk(28))]),WO),f(Kk,M([bN(24),gR,bA(GO)]),fl(l(Rs,2,P("0"),Ni(n.numBurns))))])])))))}),vF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+dl(t)}e.a;return"https://kovan.etherscan.io/address/"+dl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+dl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+dl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+dl(t)}}),yF=n(function(e,t,r){return f(dA,e,{label:fl(dl(r)),url:f(vF,t,r)})}),mF=function(e){return f(nx,"Trade Status",f(ON,M([bN(24),gR,kN(8)]),M([fl(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(yF,M([bN(12),bA(A_),iL]),e.factory,e.creationInfo.address)])))},bF=i(function(e,t,r,n,a){return MO(M([mF(t),f(VO,t,r),HO(t),l(gF,t,n,a)]))}),CF=l(Ok,9,32,107),EF=uR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),SF=f(Kk,M([cN(4),uN,pN(_O),aR(5),Wk(l(Ok,22,0,255))]),f(dR,M([ET(zk(42))]),EF)),TF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},wF=function(e){return f(ON,M([cN(12),Wk(IR),aR(15),kN(15)]),M([f(Kk,M([bN(24),vN,b$]),fl("Fiat Payment Method")),f($N,M([bN(18),yT(bT),Wk(tN),Q$({blur:5,color:d(YR,0,0,0,.2),offset:L(-3,3),size:0}),cN(3),aR(5)]),M([f(xc,f(Kk,M([bA(FD),b$]),fl("No payment methods found.")),f(Bo,fl,f(Bo,function(e){return e.info},Ql(e))))]))]))},IF={$:"Active"},AF=function(e){return{$:"ExpandPhase",a:e}},BF=M([Wk(CF),bA(tN)]),kF=r(function(e,t){return{$:"Min",a:e,b:t}}),NF=r(function(e,t){return f(kF,e,t)}),RF=function(e){return M(e?[cN(12),c_,yT(f(NF,380,bT))]:[cN(12),wN])},$F=M([Wk(tN)]),_F=uR({description:"flame",src:"/DAIHard/static/img/flame.png"}),LF=r(function(e,t){return Hl(f(ds,jl(e),jl(t)))}),xF=r(function(e,t){return d(Z_,x(d(YR,1,.6,.2,1),d(YR,1,.6,.2,.8),d(YR,1,.6,.2,.6)),tN,e,t)}),PF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),DF=function(e){return{$:"ContractActionClicked",a:e}},UF={$:"Web3Connect"},OF=n(function(e,t,r){var n=Gd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(xR,e,t).$?qk:f(VN,M([kN(8)]),function(){var e=x(t.state.phase,f(Ao,t,a.address),f(ko,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,sS,f(eM,"Remove and Refund this Trade",oS))])}break e}var r=(e.a,e.b,jl(Fb(t.parameters)));return M([f(eL,"Deposit and Commit to Trade",l(PF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(xF,"Abort Trade",GE)),f(Yi,DF,f(eL,"Confirm Payment",ZE)),SF])}e.a,e.c.a;return M([SF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(eL,"Burn it All!",XE)),f(Yi,DF,f(eM,"Release Everything",uS)),SF])}e.a,e.c.a;return M([SF])}break e;default:break e}return yr}())}return f(eL,"Connect to Wallet",UF)}),MF={$:"Finished"},FF={$:"NotStarted"},VF=r(function(e,t){var r=L(ER(t),ER(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?FF:R(n,a)?IF:MF}),KF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),HF=r(function(e,t){return l(KF,yr,e,t)}),jF=a(function(e,t,r,n){var a=u$(f(fh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+NR(r.factory),i=u$(r.parameters.tradeAmount)+" "+NR(r.factory),o=f(VN,yr,f(HF,3,f(dR,M([yT(zk(18))]),_F))),u=f(Da,Kk(M([bA(l(pA,1,0,0))])),fl),s=R(e,r.state.phase),c=f(Io,ko(r),f(Bo,function(e){return e.address},Gd(n))),d=s?tN:DR,h=$N(M([bA(d),bN(18),vN])),p=PO(r.terms.price),g=s?l(Ok,0,226,255):l(Ok,16,7,234),v=f(Da,Kk(M([bA(g)])),fl),y=u$(r.parameters.buyerDeposit)+" "+NR(r.factory),m=r.parameters.abortPunishment,b=u$(m)+" "+NR(r.factory),C=u$(f(LF,r.parameters.buyerDeposit,m))+" "+NR(r.factory),E=u$(f(LF,r.parameters.tradeAmount,m))+" "+NR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([fl("Your "),u("burnable deposit"),fl(" of "),v(y),fl(" is now held in this contract, and your offer to buy "),v(i),fl(" for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Seller by depositing the full "),v(i),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),fl(" to you.")])])):f(xa,h,M([M([fl("Your offer to sell the "),v(i),fl(" held in this contract for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),fl(" of 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),fl(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([fl("You must now pay the Seller "),v(p),fl(" via the Fiat Payment Method, "),f(Kk,M([vN]),fl("and then click ")),u("Confirm Payment"),fl(" before the payment window runs out. Use the chat to coordinate.")]),M([fl("If you abort the trade, or do not confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to you).")]),M([fl("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),fl(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([fl("Work and communicate with the Buyer to receive "),v(p),fl(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to you, "),v(C),fl(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),fl(" will be released to you.")]),M([fl("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),fl(" In this case the "),v(a),fl(" will be lost to both parties.")]),M([fl("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([fl("So, have you recieved the "),v(p),fl("? If so, you can click "),v("Release Everything"),fl(".")]),M([fl("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),fl(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([fl("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([fl("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([fl("The Seller has deposited "),v(i),fl(" into this contract, and offers to sell it for "),v(p),fl(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("If the trade is successful, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),fl(" within the payment window.")])])):f(xa,h,M([M([fl("The Buyer is offering to buy "),v(i),fl(" for "),v(p),fl(", and has deposited "),v(y),fl(" into this contract as a "),u("burnable deposit"),fl(". To become the Seller, deposit "),v(i),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("When you receive the "),v(p),fl(" from the Buyer, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can receive "),v(p),fl(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([fl("During this phase, the Buyer is expected to transfer "),v(p),fl(" to the Seller, as described in Fiat Payment Method, "),f(Kk,M([vN]),fl("and ")),u("Confirm the Payment "),fl(" before the payment window runs out. This would move the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(" amount) will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([fl("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([fl("If the Seller can verify he has received the "),v(p),fl(", he will probably release the total balance of "),v(i),fl(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),fl(".")]),M([fl("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),fl(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(ON,M([ET(jk),yT(jk),aR(20),kN(30)]),M([f(VN,M([ET(jk)]),M([f(Kk,M([bN(24),vN,bA(g),k$]),fl(T))])),f(ON,M([ET(jk),eR,kN(13)]),w),f(Kk,M([PN]),function(){switch(f(VF,r,e).$){case"Active":return l(OF,t,r,n);case"NotStarted":return f(Kk,M([bN(20),vN,b$,bA(CR)]),fl("Phase not yet started."));default:return f(Kk,M([bN(20),vN,b$]),fl("Phase no longer active."))}}())]))}),qF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},GF=uR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),zF=uR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),YF={$:"None"},WF=YF,JF=uR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),QF=function(e){switch(e.$){case"Open":return JF;case"Committed":return GF;case"Judgment":return zF;default:return WF}},XF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),ZF=a(function(e,t,r,n){return d(XF,e,t,r,n)}),eV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},tV=function(e){return function(e){return d(ZF,e.red,e.green,e.blue,e.alpha)}(eV(e))},rV=function(e){return{$:"Circle",a:e}},nV=rV,aV=d(XF,0,0,0,1),iV={$:"Flat"},oV={$:"Sharp"},uV=function(e){return{$:"Uniform",a:e}},sV=uV,cV={cap:iV,dashPattern:yr,dashPhase:0,fill:sV(aV),join:oV,thickness:2},fV=n(function(e,t,r){return D(cV,{dashPattern:e,fill:r,thickness:t})}),lV=fV(yr),dV={$:"Transparent"},hV=dV,pV=f(lV,0,hV),gV=r(function(e,t){return{$:"Shape",a:e,b:t}}),vV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},yV=function(e){return f(Da,vV,gV(e))},mV=function(e){return yV(L(e,pV))},bV=function(e){return L(-e.a,-e.b)},CV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),EV=r(function(e,t){return f(CV,bV(e(t)),t)}),SV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},TV=r(function(e,t){return{$:"Path",a:e,b:t}}),wV=kr,IV=Nr,AV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=IV(n),i=wV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},BV=function(e){return xa(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)})},kV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(BV,e,M([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 M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},RV=function(e){var t=$V(e.basic),r=SV(f(xa,AV(e),t)),n=r.a,a=r.b;return{toBottom:-f(xc,0,gI(a)),toLeft:-f(xc,0,gI(n)),toRight:f(xc,0,pI(n)),toTop:f(xc,0,pI(a))}},$V=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(kV,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(kV,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(kV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(BV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(TV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(BV,R(C,iV)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(kV,0,E);case"Group":var S=e.a;return f(BV,0,ay(f(xa,f(zo,RV,NV),S)));default:var T=e.b;return f(BV,0,NV(RV(T)))}},_V=function(e){var t=RV(e);return t.toTop+t.toBottom},LV=function(e){var t=RV(e);return L(-t.toLeft,t.toTop)},xV=function(e){var t=RV(e);return t.toLeft+t.toRight},PV=En("http://www.w3.org/2000/svg"),DV=PV("svg"),UV=Nn("height"),OV=Nn("version"),MV=Nn("width"),FV=PV("circle"),VV=PV("ellipse"),KV=PV("foreignObject"),HV=PV("g"),jV=PV("image"),qV=PV("polygon"),GV=PV("polyline"),zV=PV("rect"),YV=Tw,WV=PV("text"),JV=Nn("id"),QV=Nn("points"),XV=Nn("r"),ZV=Nn("rx"),eK=Nn("ry"),tK=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},rK=function(e){return{$:"Group",a:e}},nK=Nn("dominant-baseline"),aK=Nn("fill"),iK=Nn("fill-opacity"),oK=Nn("font-family"),uK=Nn("font-size"),sK=Nn("font-style"),cK=Nn("font-variant"),fK=Nn("font-weight"),lK=Nn("opacity"),dK=Nn("stroke"),hK=Nn("stroke-dasharray"),pK=Nn("stroke-dashoffset"),gK=Nn("stroke-linecap"),vK=Nn("stroke-linejoin"),yK=Nn("stroke-opacity"),mK=Nn("stroke-width"),bK=Nn("text-anchor"),CK=Nn("text-decoration"),EK=Nn("transform"),SK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},TK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},wK=n(function(e,t,r){return d(XF,e,t,r,1)}),IK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return sv(1e4*e)/100};return Cd(M(["rgba(",mw(i(t)),"%,",mw(i(r)),"%,",mw(i(n)),"%,",mw(function(e){return sv(1e3*e)/1e3}(a)),")"]))},AK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},BK=function(e){var t=AK(e),r=t.red,n=t.green,a=t.blue;return IK(l(wK,r,n,a))},kK=function(e){if("Uniform"===e.$){var t=e.a;return BK(t)}return"none"},NK=function(e){var t=AK(e),r=t.alpha;return mw(r)},RK=function(e){if("Uniform"===e.$){var t=e.a;return NK(t)}return"0"},$K=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},_K=function(e){var t=mw(e.scale.b),r=mw(e.scale.a),n=mw(-e.rotation/2/F$*360),a=mw(-e.shift.b),i=mw(e.shift.a);return Cd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},LK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),aK("none"),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([aK(kK(a)),iK(RK(a)),dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([aK(kK(uV(o.color))),oK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),uK(Ni(o.size)),fK(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"}}()),sK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),cK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),CK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),bK("middle"),nK("middle"),EK(_K(e))]);default:return M([EK(_K(e))])}},xK=Nn("x"),PK=Nn("y"),DK=r(function(e,t){return M([MV(mw(e)),UV(mw(t)),xK(mw(-e/2)),PK(mw(-t/2))])}),UK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([mw(t),mw(-r)]))},e))},OK=dN,MK=r(function(e,t){return f(e,t.a,t.b)}),FK=function(e){return f(xa,MK(OK),e)},VK=function(e){e:for(;;){var t=f(xc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(GV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(qV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Circle":var c=s.a;return f(FV,U(M([JV(t),XV(mw(c))]),U(LK(e),FK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(VV,U(M([JV(t),ZV(mw(d)),eK(mw(h))]),U(LK(e),FK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(zV,U(M([JV(t),ZV(mw(c)),eK(mw(c))]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(TV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(WV,U(M([JV(t)]),U(LK(e),FK(e.handlers))),M([YV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(jV,U(M([JV(t),tK(C)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(KV,U(M([JV(t)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(HV,f(ka,JV(t),U(LK(e),FK(e.handlers))),l(Ra,r(function(e,t){return f(ka,VK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:rK(M([w,I]))});e=v;continue e}}},KK=r(function(e,t){var r=e.a,n=e.b,a=mw(r),i=mw(n);return f(jT,yr,M([f(DV,M([MV(a),UV(i),OV("1.1")]),M([VK(t)]))]))}),HK=function(e){return f(KK,L(xV(e),_V(e)),f(EV,LV,e))},jK=r(function(e,t){var r=QF(e),n=function(){switch(t.$){case"NotStarted":return l(Ok,10,33,108);case"Active":return l(Ok,0,100,170);default:return l(Ok,1,129,104)}}(),a=px(HK(f(mV,sV(tV(n)),nV(50))));return f(Kk,M([wN,m_(f(dR,M([wN,eR,yT(zk(60))]),r))]),a)}),qK=function(e){var t=M([b$,vN,bN(20)]);switch(e.$){case"Active":return f(Kk,U(t,M([bA(EN)])),fl("Active"));case"NotStarted":return f(Kk,U(t,M([bA(CR)])),fl("Not Started"));default:return f(Kk,t,fl("Finished"))}},GK=n(function(e,t,r){var n=f(VF,t,e),a=function(){return"Active"===n.$?l(Ok,0,226,255):DR}(),i=f(Kk,M([bA(a),bN(20),vN,wN]),fl(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 qk;switch(n.$){case"NotStarted":return d(ZR,M([wN]),M([bN(22),gR]),L(DR,IR),f(_R,e,t));case"Active":var a=f(xR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(o$,M([wN]),M([bN(22),gR]),L(tN,IR),i)}return f(ON,M([wN,kN(10)]),M([f(Kk,M([wN]),fl(qF(e))),f(eM,"Poke",sS(iS))]));default:return f(Kk,M([yT(zk(1))]),qk)}}();return f(ON,M([aR(20),kN(10),yT(jk)]),M([f(Kk,M([c_,wN]),i),f(Kk,M([yT(jk),wN]),f(Kk,M([eR]),f(jK,e,n))),f(ON,M([kN(10),aL,wN]),M([f(Kk,M([wN]),qK(n)),o]))]))}),zK=o(function(e,t,r,n,a,i){var o=f(VF,r,t),u=f(Kk,M([aR(10),ET(jk),yT(jk)]),d(jF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Vl(0)}}(),c=l(GK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(LR,f(qb,r.state.phaseStartTime,s),i);default:Vl(0)}}(),f(Kk,M([yT(jk),ET(zk(1)),Wk(function(){return"Active"===o.$?l(pA,0,0,1):IR}())]),qk)),p=a?f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([ET(jk)]))),M([c,h,u])):f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([uN,pN(AF(t))]))),M([c]));return!e&&R(o,IF)?f(ON,M([ET(jk),kN(20),m$({bottom:20,left:0,right:0,top:0})]),M([p,wF(r.terms.paymentMethods)])):p}),YK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(VN,M([wN,cN(12),aR(30),kN(10),Wk(CF),bN(24),vN,bA(tN)]),M([fl("Trade "+TF(t.state.closedReason)),SF])):e?f(ON,M([ET(jk),kN(10)]),M([f(VN,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)])),wF(t.terms.paymentMethods)])):f(ON,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)]))}),WK=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(ON,M([ET(jk),yT(jk),kN(40)]),M([h(bF,t,i,n.wallet,r,n.showStatsModal),f(Kk,M([ET(jk),f(aN,40,0),kN(40)]),h(YK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Kk,M([wN,eR,bN(30)]),fl("Loading trade info..."));default:return f(Kk,M([wN,eR,bN(30)]),fl("Invalid trade"))}}(),M([LO(n),OO(n)]))}),JK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),QK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L($U,yr);case"CreateModel":var n=r.a;return L(f(Yi,Uy,EU(n)),yr);case"TradeModel":var a=r.a;return l(JK,Yi(Fy),xa(Yi(Fy)),d(WK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,fT,l(CO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,oT,l(C_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Kk,M([ET(jk),yT(jk),cN(10)]),n),a)}),XK=function(e){return{$:"DismissNotice",a:e}},ZK=function(e){return f(j$,ZU,eO(e))},eH=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(pA,1,1,1):l(pA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Ok,100,200,255);case"Caution":return l(Ok,255,188,0);case"Error":return l(Ok,255,70,70);default:return l(Ok,200,200,200)}}(),o=f(Kk,M([PN,c_,q$(5),ZK(5)]),B_(XK(t)));return f(Kk,M([Wk(i),cN(10),aR(8),ET(jk),p$(1),d$(d(YR,0,0,0,.15)),HD]),f(ON,M([kN(4),ET(jk)]),f(Bi,r(function(e,t){return f($N,M([ET(jk),bA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},tH=function(e){return R(e,yr)?yr:M([f(ON,M([tO(20),q$(20),kN(10),PN,aL,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,ul)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(ON,M([ZK(20),ex(100),kN(10),k$,c_,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,CB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},rH=r(function(e,t){var r=f(QK,e,t),n=r.a,a=r.b;return L(f(ON,M([r$(Jk),m_(KN(t)),ET(jk),yT(jk),aR(30)]),M([f(Kk,M([yT(zk(50))]),qk),n])),U(a,tH(t.userNotices)))}),nH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),aH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),iH={$:"AllowHover"},oH={$:"Layout"},uH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(hA,155/255,203/255,1,1),offset:L(0,0),size:3})},sH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?uH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?iH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?oH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},cH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(AT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),AT);case"Text":var a=t.a;return $I(a);default:return $I("")}}),fH=n(function(e,t,r){var n=sH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?nH(n):aH(n)}();return f(cH,a,d(fA,AT,Vk,t,wT(M([r]))))}),lH=ZT(5),dH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),hH={$:"SansSerif"},pH=function(e){return{$:"Typeface",a:e}},gH=Y,vH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",gH(sd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",gH(sd(t)));default:var t=e.a.name;return f(Ri,"-",gH(sd(t)))}}())}),yH=function(){var e=M([pH("Open Sans"),pH("Helvetica"),pH("Verdana"),hH]);return M([f(yA,Yk,l(vA,"bg-color-"+mA(d(hA,1,1,1,0)),"background-color",d(hA,1,1,1,0))),f(yA,gA,l(vA,"font-color-"+mA(d(hA,0,0,0,1)),"color",d(hA,0,0,0,1))),f(yA,yN,mN(20)),f(yA,lH,f(dH,l(Ra,vH,"font-",e),e))])}(),mH=n(function(e,t,r){var n=e.options;return l(fH,n,f(ka,lA(f(Ri," ",M([RT.root,RT.any,RT.single]))),U(yH,t)),r)}),bH=mH({options:yr}),CH=function(e){return f(yA,lH,f(dH,l(Ra,vH,"ff-",e),e))},EH=hH,SH=pH,TH=function(e){return{body:M([function(){var t=f(rH,e.screenWidth,e),r=t.a,n=t.b,a=U(M([ET(jk),yT(jk),CH(M([SH("Soleil"),EH]))]),f(xa,m_,n));return f(bH,a,r)}()]),title:"DAIHard"}},wH=Ht,IH=wH({init:OB,onUrlChange:Uk,onUrlRequest:Dk,subscriptions:Pk,update:sB,view:TH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:IH(f(du,function(e){return f(du,function(t){return f(du,function(r){return Fi({height:r,networkId:t,width:e})},f(Oh,"height",CE))},f(Oh,"networkId",CE))},f(Oh,"width",CE)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/src/AgentHistory/View.elm b/src/AgentHistory/View.elm index ebd251d..ec6f694 100644 --- a/src/AgentHistory/View.elm +++ b/src/AgentHistory/View.elm @@ -41,7 +41,13 @@ root time tradeCaches model = ] [ pageTitleElement model , statusAndFiltersElement tradeCaches model - , maybeResultsElement time tradeCaches model + , let + tcDoneLoading = + List.all + (TradeCache.loadingStatus >> (==) TradeCache.AllFetched) + tradeCaches + in + maybeResultsElement time tcDoneLoading tradeCaches model ] @@ -130,8 +136,8 @@ statusAndFiltersElement tradeCaches model = ) -maybeResultsElement : Time.Posix -> List TradeCache -> Model -> Element Msg -maybeResultsElement time tradeCaches model = +maybeResultsElement : Time.Posix -> Bool -> List TradeCache -> Model -> Element Msg +maybeResultsElement time tcDoneLoading tradeCaches model = let visibleTrades = tradeCaches @@ -145,7 +151,23 @@ maybeResultsElement time tradeCaches model = |> Filters.filterTrades model.filters in if visibleTrades == [] then - Element.none + Element.el + [ Element.centerX + , Element.Font.size 24 + , Element.paddingEach + { top = 30 + , left = 0 + , right = 0 + , bottom = 0 + } + , Element.Font.italic + ] + (if tcDoneLoading then + Element.text "No trades found with those filters." + + else + Element.text "Initializing Trade Cache..." + ) else TradeTable.view diff --git a/src/Marketplace/View.elm b/src/Marketplace/View.elm index 32cb299..0797a54 100644 --- a/src/Marketplace/View.elm +++ b/src/Marketplace/View.elm @@ -49,6 +49,11 @@ root time tradeCaches model = |> Maybe.withDefault 0 in nonOpenPhasesChecked == 0 + + tcDoneLoading = + List.all + (TradeCache.loadingStatus >> (==) TradeCache.AllFetched) + tradeCaches in Element.column [ Element.Border.rounded 5 @@ -67,6 +72,7 @@ root time tradeCaches model = , maybeResultsElement time onlyOpenPhaseChecked + tcDoneLoading tradeCaches model ] @@ -195,8 +201,8 @@ removeSearchTermButton term = (Element.text "x") -maybeResultsElement : Time.Posix -> Bool -> List TradeCache -> Model -> Element Msg -maybeResultsElement time onlyOpenTrades tradeCaches model = +maybeResultsElement : Time.Posix -> Bool -> Bool -> List TradeCache -> Model -> Element Msg +maybeResultsElement time onlyOpenTrades tcDoneLoading tradeCaches model = let visibleTrades = tradeCaches @@ -205,7 +211,23 @@ maybeResultsElement time onlyOpenTrades tradeCaches model = |> filterTrades time model.filterFunc in if visibleTrades == [] then - Element.none + Element.el + [ Element.centerX + , Element.Font.size 24 + , Element.paddingEach + { top = 30 + , left = 0 + , right = 0 + , bottom = 0 + } + , Element.Font.italic + ] + (if tcDoneLoading then + Element.text "No trades found with those filters." + + else + Element.text "Initializing Trade Cache..." + ) else TradeTable.view From c99070f225d2fec03a14c486a990afc386940b3f Mon Sep 17 00:00:00 2001 From: oglog Date: Thu, 15 Aug 2019 11:22:17 +0200 Subject: [PATCH 17/19] Fix bug when switching wallet accounts --- src/State.elm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/State.elm b/src/State.elm index ce60978..a773c49 100644 --- a/src/State.elm +++ b/src/State.elm @@ -242,6 +242,7 @@ update msg model = in ( { model | userAddress = walletSentry.account + , wallet = Wallet.OnlyNetwork walletSentry.networkId } , genCommPubkeyCmd ) @@ -284,7 +285,7 @@ update msg model = |> addUserNotice (UN.unexpectedError "Unexpected wallet state encounted when setting commPubkey!" - Nothing + ( model.userAddress, model.wallet ) ) , Cmd.none ) From ce023e9a9b51d13ab54f9dadb7d928cd8873ba0e Mon Sep 17 00:00:00 2001 From: oglog Date: Thu, 15 Aug 2019 14:51:00 +0200 Subject: [PATCH 18/19] Fixed bug where events occasionally got lost --- docs/404.html | 2 +- docs/index.html | 2 +- ...34fc5f.js => main-b2b413098bd26a0c0948.js} | 2 +- src/Trade/State.elm | 43 +++++++++++-------- 4 files changed, 27 insertions(+), 22 deletions(-) rename docs/static/js/{main-c8df61b4d62b7f34fc5f.js => main-b2b413098bd26a0c0948.js} (65%) diff --git a/docs/404.html b/docs/404.html index bd7299e..8986c30 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 bd7299e..8986c30 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-c8df61b4d62b7f34fc5f.js b/docs/static/js/main-b2b413098bd26a0c0948.js similarity index 65% rename from docs/static/js/main-c8df61b4d62b7f34fc5f.js rename to docs/static/js/main-b2b413098bd26a0c0948.js index d4d31fa..cc199d9 100644 --- a/docs/static/js/main-c8df61b4d62b7f34fc5f.js +++ b/docs/static/js/main-b2b413098bd26a0c0948.js @@ -4,4 +4,4 @@ * @author Feross Aboukhadijeh * @license MIT */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(bp,o,function(e){return si(Cp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,kp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,Bp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=nv(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?qg(o):jg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return nv(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Gg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Yg,zg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(zo,xa(ac),f(zo,Ms,nc))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ph,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ph,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ap)}),i.addEventListener("timeout",function(){a(Np)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Cp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(wp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Yg,zg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Yg,zg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Yg,zg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{options:t,type_:e}}),po={$:"OfferType"},go=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),vo=r(function(e,t){return f(ho,po,M([l(go,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(go,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),yo={$:"Closed"},mo={$:"Committed"},bo={$:"Judgment"},Co={$:"Open"},Eo={$:"Phase"},So=a(function(e,t,r,n){return f(ho,Eo,M([l(go,"Open",e,function(e){return R(e.state.phase,Co)}),l(go,"Committed",t,function(e){return R(e.state.phase,mo)}),l(go,"Judgment",r,function(e){return R(e.state.phase,bo)}),l(go,"Closed",n,function(e){return R(e.state.phase,yo)})]))}),To={$:"Initiator"},wo={$:"Responder"},Io=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),Ao=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(To):f(Io,function(e){return R(t,e)?si(wo):ci},e.state.responder)}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),ko=r(function(e,t){return f(Bo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(Ao,e,t))}),No={$:"Role"},Ro=n(function(e,t,r){return f(ho,No,M([l(go,"Buyer",t,function(t){return R(f(ko,t,e),si(fo))}),l(go,"Seller",r,function(t){return R(f(ko,t,e),si(lo))})]))}),$o=function(e){return{orderBy:e}},_o=$o,Lo={$:"Ascending"},xo={$:"Phase"},Po=Oe,Do=Po(yr),Uo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(So,!0,!0,!0,!1),f(vo,!0,!0),l(Ro,t,!0,!0)])),tradeTable:_o(L(xo,Lo)),wallet:e},Do)}),Oo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Mo={$:"None"},Fo=Mo,Vo=function(e){return d(Oo,e,Do,Fo,yr)},Ko=function(e){return{$:"TradeTableMsg",a:e}},Ho=function(e){return d(Oo,e,Do,Fo,yr)},jo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),qo=r(function(e,t){return f(jo,e,t)}),Go=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),zo=n(function(e,t,r){return t(e(r))}),Yo=r(function(e,t){if("None"===t.$)return Mo;var r=t.a,n=t.b,a=l(Go,f(Bo,Da(e),r.onSign),f(Bo,Da(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return L(f(zo,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(zo,t.toMsg,e)}},n))},r.onMined));return f(jo,a,n)}),Wo=function(e){return{$:"AbiDecoder",a:e}},Jo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Qo=z,Xo=Fr,Zo=r(function(e,t){return e<1?t:l(Xo,e,Qo(t),t)}),eu=Zo(64),tu=n(function(e,t,r){return L(f(Jo,e,eu(t)),r)}),ru=r(function(e,t){return e<1?"":l(Xo,0,e,t)}),nu=ru(64),au=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),iu=function(e){return-e},ou=r(function(e,t){return e<1?"":l(Xo,-e,Qo(t),t)}),uu=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(ru,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(ou,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Wo(function(t){var r=t.a,n=t.b;return f(au,f(tu,r,n),e(nu(n)))})}(),su=Hr,cu=function(e){return f(su,"0x",e)||f(su,"0X",e)?f(Zo,2,e):e},fu=function(e){return e.b},lu=r(function(e,t){var r=e.a;return f(au,fu,r(function(e){return f(Jo,e,e)}(cu(t))))}),du=Xr,hu=ae,pu=Wr,gu=function(e){return f(du,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return hu(a)},pu)},vu=f(zo,lu,gu),yu=function(e){return{$:"Magnitude",a:e}},mu=function(e){return{$:"Pos",a:e}},bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Cu=function(e){return{$:"MagnitudeNotNormalised",a:e}},Eu=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 si(n)}return ci}},Su=function(e){var t=Eu(e);return"Nothing"!==t.$&&t.a<0},Tu=function(e){return{$:"Neg",a:e}},wu={$:"Zer"},Iu=function(e){return!e.b},Au=r(function(e,t){var r=t.a;if(Iu(r))return wu;switch(e.$){case"Zero":return wu;case"Positive":return mu(t);default:return Tu(t)}}),Bu=r(function(e,t){return f(bu,e,Cu(t))}),ku=function(e){return f(La,r(function(t,r){return e(t)&&Iu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Nu=Ir,Ru=-1+f(Nu,10,7),$u=Ru+1,_u=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Lu=function(e){return e<0?f(_u,Na(-1),Lu(e+$u)):L(e/$u|0,e%$u)},xu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Lu(r+e),i=a.a,o=a.b;return f(ka,o,f(xu,i,n))}{if(!(_(e,$u)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Pu=function(e){var t=e.a;return yu(ku(f(xu,0,t)))},Du=xa(iu),Uu={$:"Negative"},Ou={$:"Positive"},Mu={$:"Zero"},Fu=function(e){switch(e.$){case"Positive":return Uu;case"Negative":return Ou;default:return Mu}},Vu=function(e){for(;;){var t=e.a,r=e.b,n=Pu(r),a=n.a;if(!Su(a))return f(Au,t,yu(a));e=f(Bu,Fu(t),Du(a))}},Ku=pr,Hu=function(e){switch(f(Ku,e,0).$){case"LT":return Uu;case"GT":return Ou;default:return Mu}},ju=function(e){return e<0?-e:e},qu=function(e){return Vu(f(bu,Hu(e),Cu(M([ju(e)]))))},Gu=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(Nu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},zu=function(e){switch(e.$){case"Zer":return wu;case"Neg":var t=e.a;return mu(t);default:return e}},Yu=function(e){return{$:"MagnitudePair",a:e}},Wu=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(ka,L(a,u),f(Wu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Wu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Wu,yr,s))}return yr}),Ju=r(function(e,t){var r=e.a,n=t.a;return Yu(f(Wu,r,n))}),Qu=function(e){switch(e.$){case"Zer":return f(Bu,Mu,yr);case"Neg":var t=e.a.a;return f(Bu,Ou,Du(t));default:var t=e.a.a;return f(Bu,Ou,t)}},Xu=r(function(e,t){var r=Qu(t),n=r.b,a=Qu(e),i=a.b,o=f(Ju,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Vu(f(bu,Ou,Cu(s)))}),Zu=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(R(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 Ta}return a.b.b?ba:f(Ku,e,t)}}),es=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},ts=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(Zu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return es(d(Zu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),rs=r(function(e,t){return R(f(ts,e,t),Ta)}),ns=K,as=r(function(e,t){return!f(rs,e,t)}),is=function(e){switch(e.$){case"Zer":return yu(yr);case"Pos":default:var t=e.a;return t}},os=r(function(e,t){var r=e.a;return Pu(Cu(f(xa,ti(t),r)))}),us=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(os,yu(n),a),u=f(us,yu(i),yu(n)),s=u.a,c=f(Xu,f(Au,Ou,o),f(Au,Ou,yu(f(ka,0,s))));return is(c)}var a=r.a;return f(os,yu(n),a)}return yu(yr)}),ss=function(e){switch(e.$){case"Zer":return Mu;case"Pos":return Ou;default:return Uu}},cs=r(function(e,t){return R(e,Mu)||R(t,Mu)?Mu:R(e,t)?Ou:Uu}),fs=r(function(e,t){return f(Au,f(cs,ss(e),ss(t)),f(us,is(e),is(t)))}),ls=function(e){switch(e.$){case"Zer":return wu;case"Pos":var t=e.a;return Tu(t);default:var t=e.a;return mu(t)}},ds=r(function(e,t){return f(Xu,e,ls(t))}),hs=qu(0),ps=a(function(e,t,r,n){if(e){var a=qu(e),i=f(fs,f(fs,a,n),t),o=f(as,i,r)?L(f(fs,a,t),f(ds,r,i)):L(hs,r),u=o.a,s=o.b,c=d(ps,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Xu,u,l),h)}return L(hs,r)}),gs=Fa(f(Va,2,Ru)),vs=n(function(e,t,r){return d(ps,f(Nu,2,gs),e,t,r)}),ys=qu(1),ms=r(function(e,t){return e}),bs=n(function(e,t,r){return l(Ra,ms(e),t,f(Ai,1,r))}),Cs=function(e){return l(bs,fs(qu($u)),ys,e)},Es=n(function(e,t,r){if(e){var n=l(vs,Cs(e),t,r),a=n.a,i=n.b,o=l(Es,e-1,i,r),u=o.a,s=o.b;return L(f(Xu,a,u),s)}return l(vs,Cs(e),t,r)}),Ss=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Ts=r(function(e,t){if(R(t,hs))return ci;var r=Ti(Ss(e))-Ti(Ss(t))+1,n=l(Es,f(ei,0,r),zu(e),zu(t)),a=n.a,i=n.b;return si(L(f(Au,f(cs,ss(e),ss(t)),is(a)),f(Au,ss(e),is(i))))}),ws=f(fs,qu(2),qu(2147483648)),Is=xr,As=function(e){return f(Is,e,"")},Bs=Pn,ks=n(function(e,t,r){return e<=0?r:l(ks,e>>1,U(t,t),1&e?U(r,t):r)}),Ns=r(function(e,t){return l(ks,e,t,"")}),Rs=n(function(e,t,r){return U(f(Ns,e-Qo(r),As(t)),r)}),$s=te,_s=Ar,Ls=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},xs=r(function(e,t){for(;;){if(t<16)return f(ka,Ls(t),e);var r=f(ka,Ls(f(_s,16,t)),e),n=t/16|0;e=r,t=n}}),Ps=function(e){return $s(e<0?f(ka,P("-"),f(xs,yr,-e)):f(xs,yr,e))},Ds=function(e){var t=f(Ts,e,ws);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=Ps(Gu(a));return R(n,qu(0))?i:U(Ds(n),l(Rs,8,P("0"),i))},Us=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,yu(yr))?"0":Ds(mu(t));default:var t=e.a;return"-"+Us(f(fs,qu(-1),e))}},Os=function(e){return l(Rs,64,P("0"),e)},Ms=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(Ps(a)),c=function(e){return U(e,n)}(Os(Ps(u)));return x(a+32+(Qo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Fs=Dr,Vs=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))))}),Ks=n(function(e,t,n){return l(Fs,r(function(t,r){return l(Vs,e,yi(t),r)}),t,n)}),Hs=function(e){return $a(l(Ks,ka,yr,e))},js=function(e){return f(Ri,"",f(xa,f(zo,Ps,f(Rs,2,P("0"))),Hs(e)))},qs=function(e){return 64-f(_s,64,e)},Gs=function(e){return U(e,f(Ns,qs(Qo(e)),"0"))},zs=function(e){return L(si(Qo(e)/2|0),Gs(e))},Ys=function(e){return L(ci,Os(e))},Ws=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Js=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"}},Qs=Ur,Xs=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(Is,P("1"),r),!0);case"1":return L(f(Is,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Is,P("0"),r),!1);case"1":return L(f(Is,P("1"),r),!0);default:break e}return L(r,!0)});return l(Qs,t,L("",!1),e).a},Zs=function(e){return l(Qs,ka,yr,e)},ec=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Zo,e,t),i=f(ka,l(Xo,0,e,t),r);e=n,t=a,r=i}}),tc=r(function(e,t){return e&&""!==t?l(ec,e,t,yr):M([t])}),rc=function(e){var t=function(){var t=Zs(Us(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(zo,Xs,f(Rs,256,P("1"))))}var r=t;return L(r,f(Rs,256,P("0")))}(),r=t.a,n=t.b;return $s(f(xa,Ws,f(tc,4,n(f(Ri,"",f(xa,Js,r))))))},nc=function(e){return{$:"Hex",a:e}},ac=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Ys(t);case"UintE":var r=e.a;return Ys(Us(r));case"IntE":var n=e.a;return Ys(rc(n));case"BoolE":return Ys(e.a?"1":"0");case"DBytesE":var a=e.a.a;return zs(a);case"BytesE":var a=e.a.a;return Ys(cu(a));case"StringE":var i=e.a;return zs(js(i));case"ListE":var o=e.a;return function(e){var t=e.a;return zs(t)}(Xt()(o));default:var i=e.a;return Ys(cu(i))}};try{var ic=Xt();Xt=function(){return ic}}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 oc=Pr,uc=function(e){return 1===Qo(e)?f(oc,"0",e):e},sc=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(ka,n,r);e=i,t=o,r=u}}}),cc=r(function(e,t){return $a(l(sc,e,t,yr))}),fc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(cc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(fc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),lc=r(function(e,t){return l(fc,0,e,t)}),dc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),hc=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 Pt(e.a)}},pc={$:"LE"},gc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,pc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,pc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,pc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,pc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,pc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,pc));case"Seq":var i=e.b;return l(vc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),vc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(gc,n,t,r);e=i,t=o,r=u}}),yc=Dt,mc=r(function(e,t){return{$:"Seq",a:e,b:t}}),bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+hc(r),i=n;e=a,t=i}}),Cc=function(e){return f(mc,f(bc,0,e),e)},Ec=function(e){return{$:"U8",a:e}},Sc=Ec,Tc=r(function(e,t){return _(e,t)<0?e:t}),wc=hr,Ic=function(e){return{$:"Bytes",a:e}},Ac=Ic,Bc=function(e){return yc(Cc(f(xa,Ac,$a(e))))},kc=Pt,Nc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Rc=function(e){return{$:"Decoder",a:e}},$c=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}}),_c=r(function(e,t){return Rc(f($c,e,t))}),Lc=Rc(Yn),xc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Pc=function(e){return{$:"Done",a:e}},Dc=function(e){return{$:"Loop",a:e}},Uc=r(function(e,t){var n=t.a;return Rc(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 Rc(r(function(t,r){return L(r,e)}))},Mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Oc(Pc($a(n))):f(Uc,function(e){return Dc(L(r-1,f(ka,e,n)))},e)}),Fc=function(e){return f(xc,yr,f(Nc,f(_c,L(kc(e),yr),Mc(Lc)),e))},Vc=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))}),Kc=r(function(e,t){return l(Vc,Bs,e,t)}),Hc=f(Ai,0,4),jc=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}}),qc=xt,Gc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),zc=function(e){return f(Gc,f(zo,qc,Bs(4294967295)),e)},Yc=r(function(e,t){return 5*t+e}),Wc=4294967295>>>32-Ha,Jc=ar,Qc=n(function(e,t,r){for(;;){var n=Wc&t>>>e,a=f(Jc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Jc,Wc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Xc=function(e){return e>>>5<<5},Zc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Xc(r))>-1?f(Jc,Wc&e,i):l(Qc,n,e,a))}),ef=r(function(e,t){var r=f(Zc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),tf=n(function(e,t,r){var n=f(Yc,e,t);return f(ef,n,r)}),rf=ir,nf=a(function(e,t,r,n){var a=Wc&t>>>e,i=f(Jc,a,n);if("SubTree"===i.$){var o=i.a,u=d(nf,e-Ha,t,r,o);return l(rf,a,za(u),n)}var s=i.a,c=l(rf,Wc&t,r,s);return l(rf,a,Ga(c),n)}),af=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,Xc(n))>-1?d(Ma,n,a,i,l(rf,Wc&e,t,o)):d(Ma,n,a,d(nf,a,e,t,i),o)}),of=n(function(e,t,r){return l(af,e,t,r)}),uf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(of,a,r,n)}),sf=Dn,cf=r(function(e,t){return l(Vc,sf,e,t)}),ff=function(e){var t=l(La,r(function(t,n){var a={d0:l(tf,0,t,e.state),d1:l(tf,1,t,e.state),d2:l(tf,2,t,e.state),d3:l(tf,3,t,e.state),d4:l(tf,4,t,e.state)},i=r(function(e,r){return d(uf,e,t,f(cf,f(jc,e,a),f(Kc,zc(f(jc,f(_s,5,e+1),a)),f(jc,f(_s,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Hc);return D(e,{state:t})},lf=L(0,0),df=function(e){return{current:lf,lfsrstate:1,state:e,x:1,y:0}},hf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},pf=L(1,0),gf=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),vf=r(function(e,t){if(e){var n=f(gf,1,t);return l(Vc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),yf=r(function(e,t){var r=f(_s,32,e/32|0),n=f(gf,r,t),a=f(_s,32,e);return f(vf,a,n)}),mf=n(function(e,t,r){var n=f(Zc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(af,e,t(a),r)}),bf=n(function(e,t,r){return l(mf,e,cf(t),r)}),Cf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(bf,a,r,n)}),Ef=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Nf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Tc,n,r),i=f(xa,function(e){return f(kf,e,g)},f(Ai,0,a)),o=Bf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(lc,i.outputLen,l(v,g,yr,i.outputLen))},Lf=function(e){return{$:"KS",a:e}},xf=function(e){var t=e.a;return Lf({config:t,inputLength:0,partial:yr,state:f(ui,25,ms(lf))})},Pf=function(e){return Rc(Wn(e))},Df=yc(Cc(yr)),Uf=r(function(e,t){var n=t.a;return Rc(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(Uf,function(e){return Pf(t)},Pf(e))}),Mf=r(function(e,t){return f(xc,Df,f(Nc,f(Of,e,kc(t)-e),t))}),Ff=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=kc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+kc(e)}),0,i),a)>-1))return Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:i}));var o=Bc(i),u=f(xc,Df,f(Nc,Pf(a),o)),s=Fc(u),c=f($f,s,n.state),d=Bf(c),h=f(Mf,a,o),p=Df,g=Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Vf=r(function(e,t){return _f(f(Ff,yc(Cc(f(xa,Sc,t))),xf(e)))}),Kf=Vf(dc),Hf=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,4,Kf(f(xa,yi,Zs(e)))))))},jf=function(e){return f(su,"0x",e)||f(su,"0X",e)?e:"0x"+e},qf=function(e){var t=e.a;return jf(t)},Gf=r(function(e,t){var r=Ms(f(xa,ac,t)),n=function(e){return U(e,r)}(cu(qf(Hf(e))));return nc(n)}),zf=function(e){return{data:si(f(Gf,"poke()",yr)),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yf=r(function(e,t){return D(t,{checked:e})}),Wf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Jf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Wf,f(zo,function(e){return e.type_},Ja(r)),function(e){return D(e,{options:l(Wf,f(zo,function(e){return e.label},Ja(n)),Yf(a),e.options)})},t)}),Qf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Xf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zf={$:"Descending"},el=function(e){return"Ascending"===e.$?Zf:Lo},tl=function(e){return d(Xf,e,Do,Fo,yr)},rl=r(function(e,t){return L(t.a,e(t.b))}),nl=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Xf,t,Do,Fo,M([da(f(Qf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(rl,el,t.orderBy):L(a,Lo);return tl(D(t,{orderBy:i}));default:return tl(t)}}),al=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},il=yn,ol=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=al(zf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(qo,a,n);return d(Oo,t,Do,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Oo,t,Do,Fo,M([da(f(Qf,o,u))]));case"FiltersMsg":var s=e.a;return Ho(D(t,{filters:f(Jf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(nl,c,t.tradeTable);return d(Oo,D(t,{tradeTable:l.model}),f(il,Ko,l.cmd),f(Yo,Ko,l.chainCmd),f(xa,Ji(Ko),l.appCmds));default:return Vo(t)}}),ul={$:"BottomRight"},sl={$:"ShouldBeImpossible"},cl=lr,fl=function(e){return qi(e)},ll=r(function(e,t){f(cl,e,t);return{align:ul,label:"unexpectedError",mainParagraphs:M([M([fl(e)])]),noticeType:sl}}),dl=function(e){var t=e.a;return jf(t)},hl=ye,pl=f(zo,dl,hl),gl=f(zo,Us,f(zo,jf,hl)),vl=f(zo,qf,hl),yl=f(zo,Ps,f(zo,jf,hl)),ml=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),bl=un,Cl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},El=function(e){return Cl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(xc,bl,r))},f(ml,function(e){e.a;return!R(e.b,ci)},e)))},Sl=function(e){return El(M([L("to",f(Bo,pl,e.to)),L("from",f(Bo,pl,e.from)),L("gas",f(Bo,yl,e.gas)),L("gasPrice",f(Bo,gl,e.gasPrice)),L("value",f(Bo,gl,e.value)),L("data",f(Bo,vl,e.data)),L("nonce",f(Bo,yl,e.nonce))]))},Tl=function(e){return{$:"TxSentry",a:e}},wl=ye,Il=r(function(e,t){return Cl(M([L("ref",wl(e)),L("txParams",t)]))}),Al=function(e){return{$:"Signing",a:e}},Bl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Al(e)}}),kl={$:"Black"},Nl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Rl={$:"RBEmpty_elm_builtin"},$l={$:"Red"},_l=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(Nl,$l,t,r,h(Nl,kl,c,f,l,d),h(Nl,kl,i,o,u,s))}return h(Nl,e,i,o,h(Nl,$l,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(Nl,$l,c,f,h(Nl,kl,g,v,y,m),h(Nl,kl,t,r,d,a))}return h(Nl,e,t,r,n,a)}),Ll=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Nl,$l,e,t,Rl,Rl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ku,e,a).$){case"LT":return h(_l,n,a,i,l(Ll,e,t,o),u);case"EQ":return h(Nl,n,a,t,o,u);default:return h(_l,n,a,i,o,l(Ll,e,t,u))}}),xl=n(function(e,t,r){var n=l(Ll,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(Nl,kl,a,i,o,u)}return n}),Pl=n(function(e,t,r){var n=e.a,a=Sl(r),i=l(xl,n.ref,f(Bl,r,t),n.txs);return L(Tl(D(n,{ref:n.ref+1,txs:i})),f(il,n.tagger,n.outPort(f(Il,n.ref,a))))}),Dl=Pl,Ul=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Do,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Dl,n,i,o))}return x(ci,Do,M([f(ll,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ol=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Ml=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Fl=function(e){return{$:"Posix",a:e}},Vl=Fl,Kl={autoabortInterval:Vl(0),autorecallInterval:Vl(0),autoreleaseInterval:Vl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Hl=function(e){return{$:"TokenValue",a:e}},jl=function(e){return e.a},ql=r(function(e,t){return f(xc,hs,f(Bo,Qa,f(Ts,e,t)))}),Gl=r(function(e,t){return Hl(f(ql,jl(e),qu(t)))}),zl=function(e){return f(Gl,e,12)},Yl=function(e){return f(Gl,e,3)},Wl=Hl(qu(0)),Jl=r(function(e,t){var r=Wl;return{abortPunishment:zl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Ql=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Xl=qr,Zl=function(e){var t=Ql(f(Xl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Qo(e)-1-r;return L(U(f(ru,r,e),f(Zo,r+1,e)),n)},ed=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 yr}}),td=function(e){var t=e.a,r=f(ed,Ja(0),t);return yu(r.b?t:yr)},rd=Z,nd=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}}}),ad=n(function(e,t,r){var n=f(nd,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(lc,e,r),l(ad,e,t,n)):yr}),id=r(function(e,t){return l(ad,e,e,t)}),od=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Bo,ka(a),r)});return f(La,t,si(yr))}(Ua),ud=function(e){return f(Bo,f(Da,td,yu),od(f(xa,f(zo,$a,f(zo,$s,rd)),f(id,7,$a(e)))))},sd=Q,cd=function(e){var t=Zs(sd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,Au(Uu),ud(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Bo,Au(Ou),ud(r))}return ci;default:var r=t;return f(Bo,Au(Ou),ud(r))}},fd=function(e){var t=function(e){return!f(_s,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(xc,0,Ql(r)))}},ld=function(e){return f(fs,e,e)},dd=qu(2),hd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ys;case"Neg":return wu;default:if(R(r,ys))return f(fs,e,t);if(fd(r)){var n=e,a=ld(t),i=f(ql,r,dd);e=n,t=a,r=i;continue e}var n=f(fs,t,e),a=ld(t),i=f(ql,f(ds,r,ys),dd);e=n,t=a,r=i;continue e}}),pd=r(function(e,t){return l(hd,ys,e,t)}),gd=function(e){if(""===e)return ci;var t=Zl(e),r=t.a,n=t.b,a=cd(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(fs,o,f(pd,qu(10),qu(i)));return si(u)},vd=function(e){return f(Bo,Hl,gd(e))},yd=jr,md=function(e){for(;;){if(f(yd,".",e))return l(Xo,0,-1,e);{if(!f(yd,"0",e))return""===e?"0":e;e=l(Xo,0,-1,e)}}},bd=f(Da,f(Rs,7,P("0")),Ni),Cd=function(e){return f(Ri,"",e)},Ed=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Cd(f(ka,Ni(n),f(xa,bd,a)))}return"0"},Sd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Ed(t);default:var t=e.a;return"-"+Ed(t)}},Td=r(function(e,t){return e<1?t:l(Xo,0,-e,t)}),wd=function(e){var t=l(Rs,18,P("0"),Sd(e)),r=f(Td,18,t)+"."+f(ou,18,t);return function(e){return""===e?"0":e}(md(r))},Id=r(function(e,t){var r=wd(t),n=Ql(f(Xl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(ru,a+1+e,r):f(ru,a,r)}),Ad=r(function(e,t){if("Nothing"===e.$)return wd(jl(t));var r=e.a;return f(Id,r,jl(t))}),Bd=ee,kd=function(e){var t=Bd(f(Ad,ci,e));if("Just"===t.$){return t.a}f(cl,"Error converting tokenValue to float: string -> float failed",e);return 0},Nd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=vd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return kd(r)<1?fi("Trade amount can't be less than 1."):li(r)},Rd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=cd(e);if("Nothing"===t.$){var r=Bd(e);return fi("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 li(n)},$d=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),_d=function(e){return""===e},Ld=function(e){return _d(e)?ci:si(e)},xd=function(e){return f($d,"You must specify a fiat type.",Ld(e))},Pd=function(e){return""===e?fi("Must specify a payment method."):li(e)},Dd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ud=g(Dd,ci,ci,ci,ci,ci,ci,ci),Od=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Md=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Fd={$:"Custom"},Vd=r(function(e,t){return{info:t,type_:e}}),Kd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Hd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),jd=function(e){return e.a},qd=function(e){return p(Kd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Vd,Fd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Hd,function(e){return D(Ud,{daiAmount:si(e)})},Nd(e.daiAmount)),f(Hd,function(e){return D(Ud,{fiatAmount:si(e)})},Rd(e.fiatAmount)),f(Hd,function(e){return D(Ud,{fiatType:si(e)})},xd(e.fiatType)),f(Hd,function(e){return D(Ud,{paymentMethod:si(e)})},Pd(e.paymentMethod)),Od(d(Md,function(e){return jd(e)>0?li(e):fi(D(Ud,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Gd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},zd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Yd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Wd=function(e){var t=qd(e.inputs),r=function(){return R(e.errors,Ud)?Ud:"Ok"===t.$?Ud:t.a}();return D(e,{createParameters:l(zd,Jl,Gd(e.wallet),Yd(t)),errors:r})},Jd=r(function(e,t){return Wd(D(t,{inputs:e}))}),Qd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Xd=function(e){return d(Qd,f(Jd,Kl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:Ud,inputs:Kl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Do,Fo,yr)},Zd=a(function(e,t,r,n){return la(d(Ol,e,t,r,n))}),eh=function(e){return{$:"Address",a:e}},th=f(zo,cu,f(zo,sd,eh)),rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return th("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return th("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return th("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return th("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nh=function(e){return th("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ah=function(e){return{$:"AddressE",a:e}},ih=ah,oh=function(e){return{$:"UintE",a:e}},uh=oh,sh=n(function(e,t,r){return{data:si(f(Gf,"approve(address,uint256)",M([ih(t),uh(r)]))),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ch=function(e){return f(Gl,e,200)},fh=r(function(e,t){return Hl(f(Xu,jl(e),jl(t)))}),lh=function(e){var t=f(Gl,e.tradeAmount,200);return f(fh,e.pokeReward,f(fh,ch(e.tradeAmount),f(fh,t,function(){return"Buyer"===e.initiatorRole.$?Yl(e.tradeAmount):e.tradeAmount}())))},dh=Mi(ya),hh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ph=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gh=Xn,vh=Qn,yh=function(e){return f(vh,{caseInsensitive:!1,multiline:!1},e)},mh=Jn,bh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ch=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}}),Eh=r(function(e,t){return!f(Ch,f(Da,ns,e),t)}),Sh=Eh(Ua),Th=q,wh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ih=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Ah=f(La,Ih(ka),li(yr)),Bh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},kh=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Nu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Nu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Nu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Nu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Nu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Nu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Nu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Nu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Nu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Nu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Nu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Nu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Nu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Nu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Nu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(As(s)+" is not a valid hexadecimal character.")}}}),Nh=function(e){if(_d(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(su,"-",e)){var t=f(xc,yr,Bh(Zs(e)));return f(au,iu,l(kh,Ti(t)-1,t,0))}return l(kh,Qo(e)-1,Zs(e),0)}();return f(Hd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rh=function(e){var t=Zs(e);return function(e){return L(t,e)}(f(wh,yr,Ah(f(xa,Nh,f(_i,"",f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,20,Kf(f(xa,f(zo,Th,yi),t))))))))))},$h=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Rh(cu(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!bh(e)&&Sh(o)},_h=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-f]{40}$"))),Lh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-F]{40}$"))),xh=function(e){return'"'+e+'"'},Ph=function(e){var t=cu(e),r=f(ru,24,t),n=f(ou,40,e);return 64===Qo(t)&&f(ki,Ja(P("0")),r)?Lh(n)||_h(n)?li(eh(n)):$h(n)?li(eh(n)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):40!==Qo(t)?fi("Given address "+xh(e)+" is not the correct length."):bh(t)?Lh(t)||_h(t)?li(eh(t)):$h(t)?li(eh(t)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):fi("Given address "+xh(e)+" contains invalid hex characters.")},Dh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),Ph(nu(r)))}),Uh=r(function(e,t){var r=t.a;return Wo(function(t){var n=t.a,a=t.b;return r(f(Jo,n,f(Zo,64*e,a)))})}),Oh=Jr,Mh=r(function(e,t){return f(Oh,"data",vu(f(Uh,e,t)))}),Fh=Qr,Vh=r(function(e,t){return f(Oh,"topics",f(Fh,e,vu(t)))}),Kh=function(e){return f(Bo,f(zo,$a,f(Ra,r(function(e,t){return f(Xu,qu(e),f(fs,t,ws))}),hs)),od(f(xa,f(zo,$a,f(zo,$s,f(zo,Nh,Yd))),f(id,8,$a(e)))))},Hh=function(e){var t=Zs(sd(e));e:for(;;){if(!t.b)return ci;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(Bo,fs(qu(-1)),Kh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Bo,fs(qu(-1)),Kh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Kh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kh(a)}t.b;return ci}break e;default:break e}}var a=t;return Kh(a)},jh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f($d,"Error Decoding Uint into BigInt",Hh(jf(nu(r)))))}),qh=f(dh,f(Vh,1,Dh),f(dh,f(Mh,1,Dh),f(dh,f(Mh,0,jh),Fi(hh)))),Gh=nn,zh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Yh=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(Gh,e,Cl(M([L("data",hl(t.data)),L("topics",f(zh,vl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Wh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Jh=r(function(e,t){return f(au,function(e){return e.id},f(Wh,function(e){return f(Hd,Di,f(Yh,qh,e).returnData)},f($d,"No log found from that factoryAddress in that txReceipt",Ql(f(ml,function(t){return R(f(zo,dl,sd)(t.address),f(zo,dl,sd)(rh(e)))},t.logs)))))}),Qh=n(function(e,t,r){return{data:si(f(Gf,"allowance(address,address)",M([ih(t),ih(r)]))),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Zh=function(e){switch(e.$){case"BlockNum":var t=e.a;return hl(jf(Ps(t)));case"EarliestBlock":return hl("earliest");case"LatestBlock":return hl("latest");default:return hl("pending")}},ep=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return El(M([L("to",f(Bo,pl,t)),L("from",f(Bo,pl,r)),L("gas",f(Bo,yl,n)),L("gasPrice",f(Bo,gl,a)),L("value",f(Bo,gl,i)),L("data",f(Bo,vl,o))]))},tp=function(e){return{$:"BadBody",a:e}},rp=function(e){return{$:"BadStatus",a:e}},np=function(e){return{$:"BadUrl",a:e}},ap={$:"NetworkError"},ip={$:"Timeout"},op=rn,up=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(np(r));case"Timeout_":return fi(ip);case"NetworkError_":return fi(ap);case"BadStatus_":var n=t.a,a=t.b;return fi(rp(n.statusCode));default:var n=t.a,a=t.b,i=f(op,f(Oh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(tp(Di(u)))}}),sp=n(function(e,t,r){return Cl(M([L("id",wl(e)),L("jsonrpc",hl("2.0")),L("method",hl(t)),L("params",f(zh,Ua,r))]))}),cp=Rl,fp=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ku,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),lp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},dp=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(Nl,$l,p,g,h(Nl,kl,r,n,h(Nl,$l,i,o,u,s),v),h(Nl,kl,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(Nl,kl,r,n,h(Nl,$l,i,o,u,s),h(Nl,$l,f,l,d,m))}return e},hp=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(Nl,$l,i,o,h(Nl,kl,s,c,f,l),h(Nl,kl,r,n,d,h(Nl,$l,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Nl,kl,r,n,h(Nl,$l,i,o,C,d),h(Nl,$l,g,v,y,m))}return e},pp=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(Nl,r,u,s,c,h(Nl,$l,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 hp(t)}break e}o.a,o.d;return hp(t)}break e}return t}),gp=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(Nl,t,r,n,gp(a),u)}var s=dp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(_l,c,f,l,gp(d),p)}return Rl}return h(Nl,t,r,n,gp(a),u)}return Rl},vp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Rl;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(Nl,r,n,a,f(vp,e,i),o)}var s=dp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(_l,c,l,d,f(vp,e,p),v)}return Rl}return h(Nl,r,n,a,f(vp,e,i),o)}return f(yp,e,g(pp,e,t,r,n,a,i,o))}),yp=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(R(e,n)){var u=lp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(_l,r,s,c,i,gp(o))}return Rl}return h(_l,r,n,a,i,f(vp,e,o))}return Rl}),mp=r(function(e,t){var r=f(vp,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(Nl,kl,n,a,i,o)}return r}),bp=n(function(e,t,r){var n=t(f(fp,e,r));if("Just"===n.$){var a=n.a;return l(xl,e,a,r)}return f(mp,e,r)}),Cp=function(e){return"Just"===e.$},Ep=gn,Sp=vn,Tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),wp=function(e){return{$:"BadUrl_",a:e}},Ip=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ap={$:"NetworkError_"},Bp=function(e){return{$:"Receiving",a:e}},kp=function(e){return{$:"Sending",a:e}},Np={$:"Timeout_"},Rp=function(e){return f(ta,"application/json",f(xi,0,e))},$p=n(function(e,t,r){return Rp(l(sp,e,t,r))}),_p=f(ea,"",Ua),Lp=Te,xp=Se,Pp=function(e){if("Ok"===e.$){var t=e.a;return xp(t)}var r=e.a;return Lp(r)},Dp=function(e){return l(Zn,gr,Pp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},Up=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Dp({body:l($p,1,r,n),headers:yr,method:"POST",resolver:_p(up(a)),timeout:ci,url:t})},Op=n(function(e,t,r){return Up({decoder:t.decoder,method:"eth_call",params:M([ep(t),Zh(r)]),url:e})}),Mp={$:"LatestBlock"},Fp=r(function(e,t){return l(Op,e,t,Mp)}),Vp=function(e){return{$:"Perform",a:e}},Kp=sn,Hp=xp(gr),jp=r(function(e,t){return f(Kp,function(t){return xp(e(t))},t)}),qp=n(function(e,t,r){return f(Kp,function(t){return f(Kp,function(r){return xp(f(e,t,r))},r)},t)}),Gp=function(e){return l(La,qp(ka),xp(yr),e)},zp=r(function(e,t){var r=t.a;return Be(f(Kp,Ep(e),r))}),Yp=n(function(e,t,r){return f(jp,function(e){return gr},Gp(f(xa,zp(e),t)))}),Wp=n(function(e,t,r){return xp(gr)}),Jp=r(function(e,t){var r=t.a;return Vp(f(jp,e,r))});pn.Task=Pe(Hp,Yp,Wp,Jp);var Qp=Ue("Task"),Xp=cn,Zp=r(function(e,t){return Qp(Vp(f(Xp,f(Da,f(Da,xp,e),fi),f(Kp,f(Da,f(Da,xp,e),li),t))))}),eg=a(function(e,t,r,n){return f(Zp,n,f(Fp,Xh(eo(e)),l(Qh,nh(e),t,r)))}),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return th("0x092110996699c3E06e998d89F0f4586026e44F0F")}},rg=function(e){return{$:"BoolE",a:e}},ng=rg,ag=function(e){return{$:"StringE",a:e}},ig=ag,og=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ug=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},sg=r(function(e,t){return{paymentMethods:t,price:e}}),cg=function(e){return hl(Sd(e))},fg=function(e){return f(zh,Ua,M([hl(e.fiatType),cg(e.amount)]))},lg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},dg=function(e){return Cl(M([L("type",hl(lg(e.type_))),L("info",hl(e.info))]))},hg=function(e){var t=fg(e.price),r=f(zh,dg,e.paymentMethods);return f(xi,0,Cl(M([L("paymentmethods",r),L("price",t)])))},pg=r(function(e,t){return D(t,{value:si(e)})}),gg=function(e){return qu(jd(e))},vg=function(e){return f(ql,gg(e),qu(1e3))},yg=r(function(e,t){var r=function(){return"Token"===e.$?og:ug}();return function(){return"Native"===e.$?pg(jl(lh(t))):Ua}()(r(rh(e))(t.initiatorAddress)(tg(e))(R(t.initiatorRole,lo))(jl(t.tradeAmount))(jl(Yl(t.tradeAmount)))(jl(zl(t.tradeAmount)))(jl(t.pokeReward))(vg(t.autorecallInterval))(vg(t.autoabortInterval))(vg(t.autoreleaseInterval))(jl(ch(t.tradeAmount)))(hg(f(sg,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),mg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),bg=function(e){return{$:"CreateNeedsSig",a:e}},Cg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Eg=r(function(e,t){var r=al(f(yg,e,t)),n={onBroadcast:ci,onMined:si(L(mg(e),ci)),onSign:si(Cg(e))};return L(si(bg(e)),f(qo,n,r))}),Sg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wg=function(e){return{$:"ApproveNeedsSig",a:e}},Ig=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Bg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),kg={$:"NoOp"},Ng=function(e){return{appCmds:yr,chainCmd:Fo,cmd:Do,model:e}},Rg=function(e){return rd(Sd(e))},$g={$:"Error"},_g=r(function(e,t){f(cl,e+" fetch error",t);return{align:ul,label:"web3FetchError",mainParagraphs:M([M([fl('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:$g}}),Lg=r(function(e,t){return{align:ul,label:"web3MiningError",mainParagraphs:M([M([fl('Error mining "'+e+'" transaction: '+t)])]),noticeType:$g}}),xg={$:"Caution"},Pg=r(function(e,t){return{align:ul,label:"web3SigError",mainParagraphs:M([M([fl('Error signing "'+e+'" transaction: '+t)])]),noticeType:xg}}),Dg={$:"KovanDai"},Ug=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Dg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Og=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Mg=function(e){return f(Io,Ug,Og(e))},Fg=r(function(e,t){return 1-e(1-t)}),Vg=function(e){return f(Nu,e,5)},Kg=Fg(Vg),Hg={easing:Kg,offset:12,speed:200},jg=function(e){return{$:"External",a:e}},qg=function(e){return{$:"Internal",a:e}},Gg=function(e){return{$:"NotFound",a:e}},zg=function(e){for(;;){e=e.a}},Yg=r(function(e,t){return Qp(Vp(f(jp,e,t)))}),Wg={$:"Http"},Jg={$:"Https"},Qg=Kr,Xg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Zg=i(function(e,t,r,n,a){if(_d(a)||f(Qg,"@",a))return ci;var i=f(Xl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=rd(f(Zo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Xg,e,f(ru,o,a),s,t,r,n))}return si(p(Xg,e,a,ci,t,r,n))}),ev=a(function(e,t,r,n){if(_d(n))return ci;var a=f(Xl,"/",n);if(a.b){var i=a.a;return h(Zg,e,f(Zo,i,n),t,r,f(ru,i,n))}return h(Zg,e,"/",t,r,n)}),tv=n(function(e,t,r){if(_d(r))return ci;var n=f(Xl,"?",r);if(n.b){var a=n.a;return d(ev,e,si(f(Zo,a+1,r)),t,f(ru,a,r))}return d(ev,e,ci,t,r)}),rv=r(function(e,t){if(_d(t))return ci;var r=f(Xl,"#",t);if(r.b){var n=r.a;return l(tv,e,si(f(Zo,n+1,t)),f(ru,n,t))}return l(tv,e,ci,t)}),nv=function(e){return f(su,"http://",e)?f(rv,Wg,f(Zo,7,e)):f(su,"https://",e)?f(rv,Jg,f(Zo,8,e)):ci},av=Wt,iv=Gt(zt),ov=sa,uv=r(function(e,t){return L(e,t)}),sv=_r,cv=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=ju(r-n),o=f(ei,1,sv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),fv=r(function(e,t){var n=r(function(t,r){return Gp(f(xa,ov(0),d(cv,e.speed,e.easing,t,r-e.offset)))});return f(Kp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(qp,uv,iv,av(t)))}),lv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Gd(t.wallet),Mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(eg,a,n.address,rh(eo(a)),Sg(a));return d(Qd,t,i,Fo,yr)}return Ng(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Qd,D(t,{inputs:D(u,{userRole:o})}),Do,Fo,M([function(){return"Buyer"===o.$?d(Zd,"create offer type changed","input","sell dai",0):d(Zd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ng(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ng(f(Jd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Qd,(g?Jd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Do,Fo,g?M([d(Zd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=qd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jl,n,m);return Ng(D(t,{depositAmount:si(jl(lh(b))),txChainStatus:si(f(Ag,v,b))}))}var C=y.a;return d(Qd,D(t,{errors:C}),f(Zp,ms(kg),function(){return f(fv,D(Hg,{offset:60}),"inputError")}()),Fo,yr);case"AbortCreate":return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([d(Zd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Eg,v,b);var e=v.a,r=function(){var t=al(l(sh,nh(e),rh(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Ig,e,b))};return f(qo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(ts,a,E),ba)?L(si(wg(e)),r):f(Eg,v,b)}return L(si(wg(e)),r)}(),T=S.a,w=S.b;return d(Qd,D(t,{txChainStatus:T}),Do,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(l(Tg,a,b,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(ts,N,P),ba))return Ng($);var U=f(Eg,eo(a),b),T=U.a,w=U.b;return d(Qd,D($,{txChainStatus:T}),Do,w,yr)}return Ng($)}var O=k.a;return d(Qd,t,Do,Fo,M([pa(f(_g,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(f(Bg,v,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Qd,t,Do,Fo,M([pa(f(Lg,"create",B))]))}var F=e.a,V=e.b.a,K=f(Io,Rg,Yd(f(Jh,F,V)));if("Just"===K.$){var H=K.a;return d(Qd,t,Do,Fo,M([da(f(Qf,F,H))]))}return d(Qd,t,Do,Fo,M([pa(f(ll,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Qd,t,Do,Fo,M([ga]));case"NoOp":return Ng(t);default:var j=e.a;return d(Qd,t,Do,Fo,M([j]))}}),dv=r(function(e,t){return f(Eh,function(e){return f(Ch,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),hv=r(function(e,t){return f(Ku,jd(e),jd(t))}),pv=r(function(e,t){return R(f(hv,t.derived.phaseEndTime,e),Ta)}),gv=function(e){if(""===e)return li(ci);var t=vd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},vv=r(function(e,t){return{maxDai:t,minDai:e}}),yv=f(vv,ci,ci),mv=function(e){return l(Ih,r(function(t,r){return{dai:{max:r,min:t},fiatType:Ld(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Hd,function(e){return D(yv,{minDai:si(e)})},gv(e.minDai)),f(Hd,function(e){return D(yv,{maxDai:si(e)})},gv(e.maxDai)))},bv=r(function(e,t){var r=function(t){return f(Eh,function(e){return f(Qg,sd(e),sd(t))},e)};return f(Ch,function(e){return r(e.info)},t)}),Cv=r(function(e,t){return D(t,{paymentMethod:e})}),Ev=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Sv=r(function(e,t){return f(ts,jl(e),jl(t))}),Tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return wv(D(e,{inputs:f(Ev,r,f(Cv,"",e.inputs))}))},wv=function(e){var t=Tv(e),n=mv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(bv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(pv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(dv,t.filters,r)});return D(t,{filterFunc:s})},Iv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Av={$:"Expires"},Bv=function(e){return L(wv({errors:yv,filterFunc:pv,filters:co(M([f(vo,!0,!0),d(So,!0,!1,!1,!1)])),inputs:Iv,showCurrencyDropdown:!1,tradeTable:_o(L(Av,Lo)),wallet:e}),Do)},kv=r(function(e,t){var r=f(ml,wc(e),t.inputs.paymentMethodTerms);return wv(D(t,{inputs:f(Ev,r,t.inputs)}))}),Nv=function(e){return wv(D(e,{filterFunc:pv,inputs:Iv}))},Rv=function(e){return{$:"TradeTableMsg",a:e}},$v=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),_v=function(e){return d($v,e,Do,Fo,yr)},Lv=r(function(e,t){return D(t,{fiatType:e})}),xv=r(function(e,t){return D(t,{maxDai:e})}),Pv=r(function(e,t){return D(t,{minDai:e})}),Dv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return _v(D(t,{inputs:f(Pv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return _v(D(t,{inputs:f(xv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return _v(D(t,{inputs:f(Lv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return _v(D(t,{inputs:(n?Lv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return _v(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return _v(D(t,{inputs:f(Cv,r,t.inputs)}));case"AddSearchTerm":return _v(Tv(t));case"RemoveTerm":var a=e.a;return _v(f(kv,a,t));case"ApplyInputs":return d($v,wv(t),Do,Fo,yr);case"ResetSearch":return _v(Nv(t));case"FiltersMsg":var i=e.a;return _v(wv(D(t,{filters:f(Jf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(nl,o,t.tradeTable);return d($v,D(t,{tradeTable:u.model}),f(il,Rv,u.cmd),f(Yo,Rv,u.chainCmd),f(xa,Ji(Rv),u.appCmds));case"NoOp":return _v(t);default:var s=e.a;return d($v,t,Do,Fo,M([s]))}}),Uv=a(function(e,t,r,n){return e(Cl(M([L("title",hl(t)),L("body",function(){if("Nothing"===r.$)return bl;var e=r.a;return hl(e)}()),L("image",function(){if("Nothing"===n.$)return bl;var e=n.a;return hl(e)}())])))}),Ov=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Mv=function(e){return e.a+"="+e.b},Fv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Mv,e)):""},Vv=r(function(e,t){return"/"+(f(Ri,"/",e)+Fv(t))}),Kv=function(e){switch(e.$){case"Home":return f(Vv,M(["DAIHard"]),yr);case"Create":return f(Vv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Vv,M(["DAIHard","trade",Ov(t),Ni(r)]),yr);case"Marketplace":return f(Vv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Vv,M(["DAIHard","history",dl(n)]),yr);default:return f(Vv,yr,yr)}},Hv={$:"NotFound"},jv=function(e){return{$:"AgentHistory",a:e}},qv={$:"Create"},Gv={$:"Home"},zv={$:"Marketplace"},Yv=function(e){return{$:"Parser",a:e}},Wv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Jv=r(function(e,t){return Yv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Wv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Qv=f(Jv,"ADDRESS",f(zo,Ph,Yd)),Xv={$:"Eth"},Zv={$:"Kovan"},ey=f(Jv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Xv));case"keth":return si(Zi(Zv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Dg));case"xdai":return si(Zi(to));default:return ci}}),ty=f(Jv,"NUMBER",rd),ry=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Wv,r,n,a,i,e(o))}),ny=r(function(e,t){var r=t.a;return Yv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,ry(u),r(h(Wv,n,a,i,o,e)))})}),ay=function(e){return l(La,oo,yr,e)},iy=r(function(e,t){return ay(f(xa,e,t))}),oy=function(e){return Yv(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 R(u,e)?M([h(Wv,f(ka,u,r),s,a,i,o)]):yr}return yr})},uy=r(function(e,t){var r=e.a,n=t.a;return Yv(function(e){return f(iy,n,r(e))})}),sy=Yv(function(e){return M([e])}),cy=f(uy,oy("DAIHard"),function(e){return Yv(function(t){return f(iy,function(e){return(0,e.a)(t)},e)})}(M([f(ny,Gv,sy),f(ny,qv,oy("create")),f(ny,Qf,f(uy,oy("trade"),f(uy,ey,ty))),f(ny,zv,oy("marketplace")),f(ny,jv,f(uy,oy("history"),Qv)),f(ny,function(e){return jv(e)},f(uy,oy("history"),Qv))]))),fy=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 si(t.value)}return si(t.value)}return ci}},ly=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ly(r))}return yr}return yr},dy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ly(r)}var r=t;return ly(r)},hy=Qt,py=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),gy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=hy(n);if("Nothing"===o.$)return t;var u=o.a,s=hy(i);if("Nothing"===s.$)return t;var c=s.a;return l(bp,u,py(c),t)}return t}),vy=function(e){if("Nothing"===e.$)return cp;var t=e.a;return l(La,gy,cp,f(_i,"&",t))},yy=r(function(e,t){var r=e.a;return fy(r(h(Wv,yr,dy(t.path),vy(t.query),t.fragment,Ua)))}),my=function(e){return f(xc,Hv,f(yy,cy,e))},by=aa,Cy=r(function(e,t){return f(by,e,Kv(t))}),Ey=je("connectToWeb3",function(e){return bl}),Sy=function(e){return Cl(M([L("event",hl(e.event)),L("category",hl(e.category)),L("label",hl(e.label)),L("value",wl(e.value))]))},Ty=r(function(e,t){return Cl(M([L("address",hl(dl(e))),L("signSeedMsg",hl(t))]))}),wy=je("gTagOut",Ua),Iy=je("genPrivkey",Ua),Ay=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),By=n(function(e,t,r){return f(Io,Zc(t),f(Bo,function(e){return e.trades},f(Ay,function(t){return R(t.factory,e)},r)))}),ky=je("notifyPort",Ua),Ny=je("requestNotifyPermissionPort",function(e){return bl}),Ry=r(function(e,t){return D(t,{wallet:e})}),$y=r(function(e,t){return L(f(Jd,t.inputs,D(t,{wallet:e})),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(eg,n,r.address,rh(eo(n)),Sg(n))}return Do}())}),_y=r(function(e,t){return D(t,{wallet:e})}),Ly=function(e){return{$:"AllowanceFetched",a:e}},xy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Gd(e),Mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Mg(e),si(i.factory))?d(eg,a,n.address,i.creationInfo.address,Ly):Do}return Do}())}),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{$:"TradeModel",a:e}},Fy=function(e){return{$:"TradeMsg",a:e}},Vy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Do);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Dy(a),f(il,Uy,i));case"TradeModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(il,Fy,c));case"MarketplaceModel":var l=t.a;return L(Oy(f(_y,e,l)),Do);default:var d=t.a;return L(Py(f(Ry,e,d)),Do)}}),Ky=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Hy=function(e){return{$:"PartiallyLoadedTrade",a:e}},jy=r(function(e,t){return Hy(g(Ky,e,t,ci,ci,ci,ci,ci))}),qy=function(e){return{$:"CurrentBlockFetched",a:e}},Gy=gu(f(zo,cu,Nh)),zy=function(e){return Up({decoder:Gy,method:"eth_blockNumber",params:yr,url:e})},Yy=function(e){return f(Zp,qy,zy(e))},Wy=r(function(e,t){return{address_:e,blocknum:t}}),Jy=function(e){return Wo(function(t){return li(L(t,e))})},Qy=n(function(e,t,r){var n=t.a,a=r.a;return Wo(function(t){return f(Wh,function(t){var r=t.a,n=t.b;return f(au,rl(e(n)),a(r))},n(t))})}),Xy=r(function(e,t){return l(Qy,r(function(e,t){return e(t)}),t,e)}),Zy=vu(f(Xy,jh,f(Xy,Dh,Jy(Wy)))),em=r(function(e,t){return{data:si(f(Gf,"createdTrades(uint256)",M([uh(t)]))),decoder:Zy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tm=n(function(e,t,r){return f(Zp,r,f(Fp,Xh(e),f(em,rh(e),t)))}),rm=function(e){return{$:"CreationInfoFetched",a:e}},nm=r(function(e,t){return l(tm,e,qu(t),rm)}),am=function(e){return{$:"EventSentryMsg",a:e}},im=function(e){return{$:"BlockNumber",a:e}},om=function(e){return{$:"EventSentry",a:e}},um=function(e){return{$:"Set_elm_builtin",a:e}},sm=um(cp),cm=r(function(e,t){return L(om({blockNumber:ci,errors:yr,nodePath:t,pending:sm,ref:1,requests:cp,tagger:e,watching:sm}),f(Zp,f(zo,im,e),zy(t)))}),fm=function(e){return f(cm,am,Xh(e))},lm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},hm=dm(f(lm,ci,ci)),pm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:Co,secureCommInfo:hm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),gm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),vm=n(function(e,t,r){var n=f(nm,t,r),a=fm(t),i=a.a,o=a.b;return d(gm,l(pm,f(jy,t,r),i,e),Po(M([n,o,Yy(Xh(t))])),Fo,M([ha]))}),ym=function(e){return{$:"LoadedTrade",a:e}},mm=function(e){return{$:"EventLogFetched",a:e}},bm=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),Cm=ue,Em=ce,Sm=Yr,Tm=n(function(e,t,r){var n=function(e){return Em(M([e,Cm(r)]))};return f(du,function(a){var i=f(Gh,e,a);if("Ok"===i.$){var o=i.a,u=f(Gh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return hu(Di(c))}return Fi(r)},Sm)}),wm=a(function(e,t,r,n){return f(dh,l(Tm,f(Oh,e,Sm),t,r),n)}),Im=n(function(e,t,r){return f(dh,f(Oh,e,t),r)}),Am=gu(Ph),Bm=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),km=function(e){return{$:"BlockHash",a:e}},Nm=function(e){return Bm(e)?li(km(cu(e))):fi("Given blockHash "+xh(e)+" is not valid.")},Rm=gu(Nm),$m=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),_m=function(e){return $m(e)?li(nc(cu(e))):fi("Something in here is not very hexy: "+xh(e))},Lm=gu(_m),xm=function(e){return{$:"TxHash",a:e}},Pm=function(e){return Bm(e)?li(xm(cu(e))):fi("Given txHash "+xh(e)+" is not valid.")},Dm=gu(Pm),Um=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}}),Om=zr,Mm=oe,Fm=l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionHash",Dm,l(Im,"transactionIndex",Gy,l(Im,"logIndex",Gy,d(wm,"removed",Om,!1,l(Im,"topics",Mm(Lm),l(Im,"data",pu,l(Im,"address",Am,Fi(Um)))))))))),Vm=function(e){return f(zh,function(e){if("Just"===e.$){var t=e.a;return hl(qf(t))}return bl},e)},Km=function(e){return Cl(M([L("fromBlock",Zh(e.fromBlock)),L("toBlock",Zh(e.toBlock)),L("address",pl(e.address)),L("topics",Vm(e.topics))]))},Hm=r(function(e,t){return Up({decoder:Mm(Fm),method:"eth_getLogs",params:M([Km(t)]),url:e})}),jm=function(e){return{$:"BlockNum",a:e}},qm=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Kp,function(r){return f(jp,vi(r),f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)})))},f(Hm,e,t)):f(Hm,e,t)}),Gm=r(function(e,t){var r=t.a;return um(l(xl,e,gr,r))}),zm=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(xl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(om(D(o,{watching:f(Gm,a.ref,o.watching)})),f(Zp,f(zo,bm(a.ref),a.tagger),e),a.ref)}(l(qm,a.nodePath,n,L(s,s)))}return x(om(D(o,{pending:f(Gm,a.ref,o.pending)})),Do,a.ref)}),Ym=zm(!1),Wm=r(function(e,t){var r=function(){var e=fm(t.factory),r=e.a,n=e.b;return function(e){var t=e.a,r=e.b,a=e.c;return x(t,Po(M([n,r])),a)}(l(Ym,mm,r,{address:t.creationInfo.address,fromBlock:jm(t.creationInfo.blocknum),toBlock:Mp,topics:yr}))}(),n=r.a,a=r.b;return d(gm,l(pm,ym(t),n,e),Po(M([a,Yy(Xh(t.factory))])),Fo,M([ha]))}),Jm=function(e){return{data:si(f(Gf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Qm=function(e){return{data:si(f(Gf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Xm=function(e){return{data:si(f(Gf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Zm=r(function(e,t){return{data:si(f(Gf,"initiatorStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),eb=function(e){return{data:si(f(Gf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},tb=function(e){return{data:si(f(Gf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},rb=r(function(e,t){return{data:si(f(Gf,"responderStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),nb=r(function(e,t){return{amount:t,fiatType:e}}),ab=f(du,function(e){var t=cd(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("Can't convert that to a BigInt")},pu),ib=l(Mi,nb,f(Fh,0,pu),f(Fh,1,ab)),ob={$:"Bank"},ub={$:"Cash"},sb=function(e){switch(e){case"cash":return si(ub);case"bank":return si(ob);case"custom":return si(Fd);default:return ci}},cb=f(du,function(e){var t=sb(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("")},pu),fb=l(Mi,Vd,f(Oh,"type",cb),f(Oh,"info",pu)),lb=function(e){var t=l(Mi,sg,f(Oh,"price",ib),f(Oh,"paymentmethods",Mm(fb)));return f(op,t,e)},db=r(function(e,t){return{commPubkey:t,responder:e}}),hb=r(function(e,t){var n=r(function(t,r){return l(Xo,t,t+2*r,e)}),a=f(zo,Nh,au(ti(2)));return f(Wh,function(t){return f(au,function(e){return f(n,t+64,e)},Nh(l(Xo,t,t+64,e)))},a(t))}),pb=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),gb=n(function(e,t,r){var n=l(Ra,pb(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),vb=j,yb=function(e){return As(vb(e))},mb=function(e){return l(gb,r(function(e,t){return U(t,yb(e))}),"",e)},bb=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f(Wh,mb,f(Wh,f(zo,xa(Nh),Ah),f(au,ml(f(zo,_d,ns)),f(au,tc(2),f(hb,t,nu(r)))))))}),Cb=f(dh,f(Mh,1,bb),f(dh,f(Mh,0,Dh),Fi(db))),Eb=r(function(e,t){return{commPubkey:t,terms:e}}),Sb=f(dh,f(Mh,1,bb),f(dh,f(Mh,0,bb),Fi(Eb))),Tb=function(e){return{statement:e}},wb=f(dh,f(Mh,0,bb),Fi(Tb)),Ib=function(e){return{statement:e}},Ab=f(dh,f(Mh,0,bb),Fi(Ib)),Bb={$:"AbortedEvent"},kb={$:"BurnedEvent"},Nb={$:"ClaimedEvent"},Rb=function(e){return{$:"CommittedEvent",a:e}},$b=function(e){return{$:"InitiatedEvent",a:e}},_b=function(e){return{$:"InitiatorStatementLogEvent",a:e}},Lb={$:"PokeEvent"},xb={$:"RecalledEvent"},Pb={$:"ReleasedEvent"},Db=function(e){return{$:"ResponderStatementLogEvent",a:e}},Ub=f(Oh,"topics",f(Fh,0,Lm)),Ob=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),Kf(f(xa,yi,Zs(e))))))},Mb=f(du,function(e){return R(e,Ob("Initiated(string,string)"))?f(Oi,$b,Sb):R(e,Ob("Committed(address,string)"))?f(Oi,Rb,Cb):R(e,Ob("Recalled()"))?Fi(xb):R(e,Ob("Claimed()"))?Fi(Nb):R(e,Ob("Aborted()"))?Fi(Bb):R(e,Ob("Released()"))?Fi(Pb):R(e,Ob("Burned()"))?Fi(kb):R(e,Ob("InitiatorStatementLog(string)"))?f(Oi,_b,wb):R(e,Ob("ResponderStatementLog(string)"))?f(Oi,Db,Ab):R(e,Ob("Poke()"))?Fi(Lb):hu("Unrecognized topic hash")},Ub),Fb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},Vb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},Kb=function(e){return R(e.buyerDeposit,Yl(e.tradeAmount))&&R(e.abortPunishment,zl(e.tradeAmount))},Hb={$:"Invalid"},jb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),qb=r(function(e,t){return Vl(jd(t)+jd(e))}),Gb=function(e){var t=Bd(Sd(e.amount));if("Just"===t.$){return t.a}f(cl,"Error converting FiatValue to float--string -> float failed!",e);return 0},zb=r(function(e,t){return(t-e)/e}),Yb=r(function(e,t){var r=Gb(t),n=kd(e);return"USD"===t.fiatType?si(f(zb,n,r)):ci}),Wb=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 Vl(0)}}();return{margin:f(Yb,e.tradeAmount,r.price),phaseEndTime:function(){return"Closed"===t.phase.$?Vl(f(Nu,2,53)-1):f(qb,t.phaseStartTime,n)}()}}),Jb=function(e){var t=x(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 ym(v(jb,e.factory,e.id,n,a,o,u,s,l(Wb,a,o,u)))}return Hy(e)},Qb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(cl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Hb}}),Xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Hb}}),Zb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Hb}}),eC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return ym(D(n,{state:e}));default:return Hb}}),tC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Hb}}),rC=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}}),nC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,uu,f(Xy,Dh,Jy(rC))))))))))),aC=function(e){return{data:si(f(Gf,"getParameters()",yr)),decoder:nC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},iC=function(e){return f(Bo,function(e){return Vl(1e3*e)},rd(Sd(e)))},oC=function(e){return Hl(e)},uC=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),sC=function(e){var t=f($d,"error converting BigInt to Time.Posix",iC(e.autoabortInterval)),r=f($d,"error converting BigInt to Time.Posix",iC(e.autoreleaseInterval)),a=f($d,"error converting BigInt to Time.Posix",iC(e.autorecallInterval));return d(uC,n(function(t,r,n){return{abortPunishment:oC(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:oC(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:oC(e.pokeReward),tradeAmount:oC(e.tradeAmount)}}),a,t,r)},cC=n(function(e,t,r){return f(Zp,r,f(jp,sC,f(Fp,Xh(e),aC(t))))}),fC=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}}}}}}}}}}},lC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(fC)))))))))))),dC=function(e){return{data:si(f(Gf,"getPhaseStartInfo()",yr)),decoder:lC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},hC=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),pC=function(e){return h(hC,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}}),iC(e.v6),iC(e.v7),iC(e.v8),iC(e.v9))},gC=n(function(e,t,r){return f(Zp,r,f(jp,pC,f(Fp,Xh(e),dC(t))))}),vC=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),yC=vu(f(Xy,jh,f(Xy,Dh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(vC))))))),mC=function(e){return{data:si(f(Gf,"getState()",yr)),decoder:yC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},bC={$:"Aborted"},CC={$:"Burned"},EC={$:"NotClosed"},SC={$:"Recalled"},TC={$:"Released"},wC=function(e){switch(f(xc,99,rd(Sd(e)))){case 0:return si(EC);case 1:return si(SC);case 2:return si(bC);case 3:return si(TC);case 4:return si(CC);default:return ci}},IC=function(e){switch(f(xc,99,rd(Sd(e)))){case 1:return si(Co);case 2:return si(mo);case 3:return si(bo);case 4:return si(yo);default:return ci}},AC=function(e){return R(e,th("0x0000000000000000000000000000000000000000"))?ci:si(e)},BC=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),kC=function(e){var t=iC(e.phaseStartTimestamp),r=IC(e.phase),a=wC(e.closedReason);return d(BC,n(function(t,r,n){return{balance:oC(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:AC(e.responder)}}),r,t,a)},NC=n(function(e,t,r){return f(Zp,r,f(jp,kC,f(Fp,Xh(e),mC(t))))}),RC=i(function(e,t,r,n,a){return Po(M([l(cC,e,t,r),l(NC,e,t,n),l(gC,e,t,a)]))}),$C=function(e){var t=Rg(e);if("Just"===t.$){return t.a}f(cl,"Warning! BigInt to Int conversion failed!",Sd(e));return 0},_C=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),LC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),xC=function(e){return e.b?l(LC,e,yr,0):qa},PC=tn,DC=function(e){var t=h(PC,_C,f(Oh,"encapsulation",pu),f(Oh,"iv",pu),f(Oh,"tag",pu),f(Oh,"encrypted",pu)),r=Mm(t),n=f(Gh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Zc,0,e),f(Zc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(xC(i))},UC=function(e){var t=function(e){var t=Qo(e);return t>1114111?fi("string is too long"):li(f(Is,vb(t),e))};return f(au,Ri(""),Ah(f(xa,t,e)))},OC=function(e){var t=e.a,r=e.b;return UC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},MC=r(function(e,t){return Cl(M([L("message",hl(e)),L("pubkeyHexStrings",f(zh,hl,M([t.initiatorPubkey,t.responderPubkey])))]))}),FC=function(e){return{$:"LoadedCommInfo",a:e}},VC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),KC=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 FC(f(VC,r,n))}return dm(e)},HC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return FC(D(n,{initiatorPubkey:e}))}),jC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{responderPubkey:si(e)}))}var n=t.a;return FC(D(n,{responderPubkey:e}))}),qC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),GC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(nd,a,n),o=$s(f(lc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),zC=function(e){var t=xC(f(GC,Zs(e),yr));return l(zd,uv,h(hC,_C,f(Zc,0,t),f(Zc,1,t),f(Zc,2,t),f(Zc,3,t)),h(hC,_C,f(Zc,4,t),f(Zc,5,t),f(Zc,6,t),f(Zc,7,t)))},YC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),WC={$:"Aborted"},JC={$:"Burned"},QC={$:"Claimed"},XC=function(e){return{$:"Committed",a:e}},ZC=function(e){return{$:"Encrypted",a:e}},eE={$:"FailedDecode"},tE={$:"Initiated"},rE={$:"Recalled"},nE={$:"Released"},aE=function(e){return{$:"StateChange",a:e}},iE=function(e){return{$:"Statement",a:e}},oE=fr,uE=cr,sE=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(oE,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(uE,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),cE=or,fE=y,lE=a(function(e,t,r,n){var a=Wc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(cE,Ga(r),n);var i=za(d(lE,e-Ha,t,r,ja));return f(cE,i,n)}var o=f(Jc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(lE,e-Ha,t,r,u));return l(rf,a,i,n)}var i=za(d(lE,e-Ha,t,r,fE(o)));return l(rf,a,i,n)}),dE=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(lE,c,r,e,fE(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(lE,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),hE=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(oE,32,r,e),o=f(dE,i,t);if(a<0){var u=l(uE,a,n,e);return f(dE,u,o)}return o}),pE=ur,gE=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(pE,i,t,r)}return f(ka,e,t)});return{nodeList:l(pE,i,yr,n),nodeListSize:t/32|0,tail:a}},vE=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(pE,o,t,r)}var n=e.a;return f(hE,n,t)});return f(hE,i,l(pE,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(pE,o,t,r)}var n=e.a;return f(sE,n,t)});return f(ai,!0,f(sE,i,l(pE,o,gE(e),a)))}),yE=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),mE=f(La,yE,yr),bE=n(function(e,t,r){var n=qC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(aE(tE));case"CommittedEvent":var r=t.a;return si(aE(XC(r.responder)));case"RecalledEvent":return si(aE(rE));case"ClaimedEvent":return si(aE(QC));case"AbortedEvent":return si(aE(WC));case"ReleasedEvent":return si(aE(nE));case"BurnedEvent":return si(aE(JC));case"InitiatorStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(To)}));case"ResponderStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(wo)}));default:return ci}}(),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(vE,r.history,xC(mE(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Bo,YC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),mE(M([s])))}),CE=Gr,EE=function(e){var t=l(Mi,uv,f(Oh,"id",CE),f(Oh,"message",pu));return f(Hd,Di,f(Gh,t,e))},SE=function(e){return{$:"Decrypted",a:e}},TE=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),wE=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(bE,n,a,t),o=i.a,u=i.b,s=i.c;return d(TE,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(TE,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(TE,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=EE(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Zc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:SE(y)}),T=D(b,{eventInfo:iE(S)}),w=l(af,v,T,t.history);return d(TE,D(t,{history:w}),!1,ci,yr)}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an event that is not a message!",b))]))}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(TE,t,!1,ci,M([pa(f(ll,"Error decoding decryption result",I))]))}}),IE=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),AE=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),BE=function(e){return{onBroadcast:ci,onMined:si(L(IE(e),ci)),onSign:si(AE(e))}},kE=je("encryptToPubkeys",Ua),NE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),RE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),$E=function(e){return{$:"CommitMined",a:e}},_E={$:"CommitNeedsSig"},LE=function(e){return{$:"CommitSigned",a:e}},xE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?RE:NE}(),a=al(function(){return"Token"===e.factory.$?Ua:pg(jl(Fb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(_E),f(qo,{onBroadcast:ci,onMined:si(L($E,ci)),onSign:si(LE)},a))}),PE=r(function(e,t){return Cl(M([L("id",wl(e)),L("encapsulation",hl(t.encapsulatedKey)),L("iv",hl(t.iv)),L("tag",hl(t.tag)),L("encrypted",hl(t.message))]))}),DE=je("decryptMessage",Ua),UE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},OE=r(function(e,t){return Po(f(xa,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 DE(f(PE,r,s))}return Do}return Do},UE(e.history)))}),ME=function(e){if("Just"===e.$){return e.a}return ci},FE=function(e){var t=ME(l(zd,Ao,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Bo,function(e){return e.address},Gd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(OE,n,a)}return Do},VE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(bE,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),KE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),HE=i(function(e,t,r,n,a){return f(VE,n,p(KE,e,r,t,qa,a,""))}),jE=function(e){return{$:"ChatHistoryMsg",a:e}},qE=a(function(e,t,r,n){var a=x(t,Gd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(ko,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(jE),n))}(h(HE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),GE={$:"Abort"},zE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),YE=function(e){return{$:"ActionNeedsSig",a:e}},WE=function(e){return{$:"ApproveMining",a:e}},JE={$:"ApproveNeedsSig"},QE=function(e){return{$:"ApproveSigned",a:e}},XE={$:"Burn"},ZE={$:"Claim"},eS=function(e){return{$:"CommitMining",a:e}},tS=function(e){return{$:"ConfirmingAction",a:e}},rS=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),nS=function(e){return{$:"ParametersFetched",a:e}},aS=function(e){return{$:"PhaseInfoFetched",a:e}},iS={$:"Poke"},oS={$:"Recall"},uS={$:"Release"},sS=function(e){return{$:"StartContractAction",a:e}},cS=function(e){return{$:"StateFetched",a:e}},fS=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"}},lS=function(e){return d(gm,e,Do,Fo,yr)},dS={align:ul,label:"cantFindTradeWillRetry",mainParagraphs:M([M([fl("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:$g},hS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(_g,e,r)}if("Nothing"===t.a.$){t.a;return f(ll,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ll,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),pS={align:ul,label:"tradeParametersNotDefault",mainParagraphs:M([M([fl("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:$g},gS=eo(Xi),vS=n(function(e,t,r){return l(bp,e,Bo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),yS=r(function(e,t){var r=t.a;return um(f(mp,e,r))}),mS=n(function(e,t,r){var n=e.a,a=f(fp,t,n.requests);if("Nothing"===a.$)return L(om(n),Do);var i=a.a,o=L(i.watchOnce,Ql(r));if("Nothing"===o.b.$){o.b;return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Do)}if(o.a){var u=o.b.a;return L(om(D(n,{requests:l(vS,t,r,n.requests),watching:f(yS,t,n.watching)})),f(Yg,i.tagger,xp(u)))}return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Po(f(xa,function(e){return f(Yg,i.tagger,xp(e))},r)))}),bS=_e,CS=r(function(e,t){return f(Zp,f(zo,im,t),f(Kp,function(t){return zy(e)},bS(2e3)))}),ES=n(function(e,t,r){var n=r.a,a=r.b;return f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)}))}),SS=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(SS,e,t,i)),c=o;e=u,t=s,r=c}}),TS=r(function(e,t){return l(SS,xl,t,e)}),wS=r(function(e,t){var r=e.a,n=t.a;return um(f(TS,r,n))}),IS=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 Po(f(xa,function(t){return f(Zp,f(zo,bm(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},mE(f(xa,function(e){return f(fp,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(om(D(r,{blockNumber:si(a)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,ES)]))):L(t,f(CS,r.nodePath,r.tagger))}return L(om(D(r,{blockNumber:si(a),pending:sm,watching:f(wS,r.watching,r.pending)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(a,a),r.pending,qm),l(i,L(a,a),r.watching,ES)])))}var s=e.a.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),f(CS,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(mS,t,c,d)}var s=e.b.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),Do)}),AS=function(e){return M([e])},BS=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(nm,r.factory,r.id):Do}}(),function(){var e=x(Gd(t.wallet),Mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Mg(t.wallet),si(a.factory))?d(eg,n,r.address,a.creationInfo.address,Ly):Do}return Do}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(qE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?FE(t):Do,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(gm,u,Po(M([l(NC,p.factory,p.creationInfo.address,cS),s,r])),Fo,o)}return lS(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return lS(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(ts,m,jl(Fb(C.parameters))),ba))return lS(u);var S=l(xE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(gm,D(u,{txChainStatus:T}),Do,w,yr)}return lS(u)}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:$C(I.blocknum)},B=l(Ym,mm,t.eventSentry,{address:A.address,fromBlock:jm(A.blocknum),toBlock:Mp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(Qb,A,t.trade)}),$=f(xc,gS,Vb(u.trade)),_=Po(M([N,h(RC,$,A.address,nS,cS,aS)]));return d(gm,u,_,Fo,yr)}if("BadBody"===g.a.$){g.a.a;return d(gm,t,Do,Fo,M([pa(dS)]))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(eC,P,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(Kb(F)){var u=D(t,{trade:f(Xb,F,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(pS)]))}var V=g.a.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Zb,H,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Yh,Mb,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(HC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(jC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=lb(e.terms);if("Ok"===r.$){var n=r.a;return L(f(tC,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ll,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(jE),n))}(l(bE,q.blockNumber,Y,r))}return d(qE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),a=Z.a,i=Z.b,o=Z.c,ee=function(){return"Nothing"===a.$?f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])):yr}(),u=D(t,{chatHistoryModel:a,eventsWaitingForChatHistory:ee,secureCommInfo:W,trade:Q}),_=i?FE(u):Do;return d(gm,u,_,Fo,f(oo,f(xa,pa,mE(M([X]))),o));case"ExpandPhase":var te=e.a;return lS(D(t,{expandedPhase:te}));case"ToggleChat":var re=!t.showChatHistory;return lS(D(t,{showChatHistory:re}));case"ToggleStatsModal":var ne=!t.showStatsModal;return lS(D(t,{showStatsModal:ne}));case"ViewUserHistory":var ae=(e.a,t.trade);if("LoadedTrade"===ae.$){var C=ae.a;return d(gm,t,Do,Fo,M([da(jv(C.parameters.initiatorAddress))]))}return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,ie=e.c;return lS(D(t,{txChainStatus:si(f(rS,E,ie))}));case"AbortAction":return lS(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,ie=e.c,oe=function(){var e=C.factory;if("Native"===e.$)return l(xE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=al(l(sh,nh(r),C.creationInfo.address,ie)),t={onBroadcast:ci,onMined:ci,onSign:si(QE)};return f(qo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(ts,i,jl(Fb(C.parameters))),ba)?L(si(JE),n):l(xE,C,E.address,E.commPubkey)}return L(si(JE),n)}(),T=oe.a,w=oe.b;return d(gm,D(t,{txChainStatus:T}),Do,w,yr);case"ContractActionClicked":var ue=e.a;if(R(ue,iS)||R(ue,oS)){var se=sS(ue),ce=t;e=se,t=ce;continue e}return lS(D(t,{txChainStatus:si(tS(ue))}));case"StartContractAction":var fe=e.a,le=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Fo,M([pa(f(ll,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(fe.$){case"Recall":var a=al(eb(n.creationInfo.address));return x(si(YE(oS)),f(qo,BE(oS),a),yr);case"Claim":var a=al(Xm(n.creationInfo.address));return x(si(YE(ZE)),f(qo,BE(ZE),a),yr);case"Abort":var a=al(Jm(n.creationInfo.address));return x(si(YE(GE)),f(qo,BE(GE),a),yr);case"Release":var a=al(tb(n.creationInfo.address));return x(si(YE(uS)),f(qo,BE(uS),a),yr);case"Burn":var a=al(Qm(n.creationInfo.address));return x(si(YE(XE)),f(qo,BE(XE),a),yr);default:var a=al(zf(n.creationInfo.address));return x(si(YE(iS)),f(qo,BE(iS),a),yr)}}(),T=le.a,w=le.b,o=le.c;return d(gm,D(t,{txChainStatus:T}),Do,w,o);case"ApproveSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return lS(D(t,{txChainStatus:si(WE(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"approve",V))]));case"CommitSigned":var de=e.a;if("Ok"===de.$){var he=de.a;return lS(D(t,{txChainStatus:si(eS(he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"commit",V))]));case"CommitMined":return lS(D(t,{txChainStatus:ci}));case"ActionSigned":var ue=e.a,de=e.b;if("Ok"===de.$){var he=de.a;return lS(D(t,{txChainStatus:si(f(zE,ue,he))}))}var V=de.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,fS(ue),V))]));case"ActionMined":var ue=e.a;return lS(D(t,{txChainStatus:ci}));case"EventSentryMsg":var pe=e.a,ge=f(IS,pe,t.eventSentry),ve=ge.a,_=ge.b;return d(gm,D(t,{eventSentry:ve}),_,Fo,yr);case"ChatHistoryMsg":var ye=e.a,me=t.chatHistoryModel;if("Just"===me.$){var be=me.a,Ce=f(wE,ye,be),Ee=D(t,{chatHistoryModel:si(Ce.model)}),s=Ce.shouldCallDecrypt?FE(t):Do,Se=function(){var e=Ce.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(kE(f(MC,r,a)),ci)}return L(Do,si(f(ll,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Do,ci)}(),Te=Se.a,we=Se.b;return d(gm,Ee,Po(M([s,Te])),Fo,U(f(Qi,jE,Ce.appCmds),f(xc,yr,f(Bo,AS,f(Bo,pa,we)))))}return d(gm,t,Do,Fo,M([pa(f(ll,"Got a chat history message, but there is no chat history model!",ye))]));case"EncryptionFinished":var Ie=e.a,Ae=f(Wh,OC,DC(Ie)),Be=x(t.wallet,t.trade,Ae);if("Ok"===Be.c.$){if("Active"===Be.a.$&&"LoadedTrade"===Be.b.$){var E=Be.a.a,p=Be.b.a,ke=Be.c.a,Ne=f(Ao,p,E.address);if("Nothing"===Ne.$)return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Re=Ne.a,$e=function(){return al("Initiator"===Re.$?f(Zm,p.creationInfo.address,ke):f(rb,p.creationInfo.address,ke))}();return d(gm,t,Do,f(qo,{onBroadcast:ci,onMined:ci,onSign:ci},$e),yr)}var _e=Be.a,Le=Be.b;return d(gm,t,Do,Fo,M([pa(f(ll,"Encryption successful, but the user or trade is no longer valid.",L(_e,Le)))]))}var xe=Be.c.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error translating JS encryption result into Elm.",xe))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return lS(t)}var V=e.a.a;return d(gm,t,Do,Fo,M([pa(f(Lg,"message",V))]));default:return d(gm,t,Do,Fo,M([ga]))}}),kS=r(function(e,t){return{address:e,blocknum:t}}),NS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},RS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(zm,!0,e,t,r))}),$S=n(function(e,t,r){var n=function(e){return r(f(Yh,Sb,e).returnData)},a={address:t.address,fromBlock:jm(t.blocknum),toBlock:jm(t.blocknum),topics:M([si(Ob("Initiated(string,string)"))])};return l(RS,n,e,a)}),_S=function(e){return{data:si(f(Gf,"numTrades()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},LS=r(function(e,t){return f(Zp,t,f(Fp,Xh(e),_S(rh(e))))}),xS=function(e){return{data:si(f(Gf,"phase()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},PS=n(function(e,t,r){return f(Zp,r,f(jp,IC,f(Fp,Xh(e),xS(t))))}),DS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),US=r(function(e,t){return l(La,DS(e),yr,t)}),OS=function(e){return f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},MS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},FS=function(e){return f(MS,Ja(Hb),Sa(e.trades))},VS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:FS(e),loaded:Ti(OS(e))})})},KS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),HS=r(function(e,t){var r=f(Zc,e,t.trades);if("Just"===r.$){var n=(r.a,l(af,e,Hb,t.trades));return l(KS,VS(D(t,{trades:n})),Do,yr)}return l(KS,t,Do,M([pa(f(ll,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),jS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Qb,t,a),o=l(af,e,i,r.trades);return L(VS(D(r,{trades:o})),yr)}return L(r,M([f(ll,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),qS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Xb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(af,e,ym(D(a,{state:D(i,{phase:t})})),r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),zS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Zb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),YS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(eC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),WS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),JS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),QS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),XS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),ZS=function(e){return{$:"NumTradesFetchedAgain",a:e}},eT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),tT=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),rT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),nT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),aT=function(e){return l(KS,e,Do,yr)},iT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=$C(n),i=xC(f(xa,jy(t.factory),f(Ai,0,a-1))),o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,0,a-1)));return l(KS,D(t,{dataFetchState:l(QS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CheckForNewTrades":return l(KS,t,f(LS,t.factory,ZS),yr);case"UpdateTradePhases":var s=Po(mE(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(PS,e.factory,e.creationInfo.address,f(tT,e.factory,e.id)))},OS(t))));return l(KS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(GS,d,p,t),v=function(){var e=L(p,f(Zc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=NS(r);if("Just"===n.$){var a=n.a;return L(l(NC,c,a.address,nT(d)),yr)}return L(Do,M([pa(f(ll,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Do,yr)}e.b;return L(Do,M([pa(f(ll,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(KS,g.tradeCache,Po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(KS,t,Do,M([pa(f(hS,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=$C(n);if(_(C,E)<0){var S=t.dataFetchState,o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,C,E-1))),T=xC(f(xa,jy(t.factory),f(Ai,C,E-1)));return l(KS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(vE,t.trades,T)}),o,yr)}return aT(t)}b.b;return l(KS,t,Do,M([pa(f(ll,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(kS,w.address_,$C(w.blocknum)),A=l($S,t.eventSentry,I,XS(d)),B=A.a,k=A.b,y=Po(M([h(RC,t.factory,I.address,eT(d),nT(d),rT(d)),k])),N=l(jS,d,I,t),R=N.a,$=N.b;return l(KS,VS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(KS,t,Do,M([pa(f(_g,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(qS,d,P,t)}var U=r.a.a;return l(KS,t,Do,M([pa(f(ll,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(YS,d,O,t)}return l(KS,t,Do,M([pa(f(hS,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(zS,d,F,t)}return l(KS,t,Do,M([pa(f(hS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=lb(V.terms);if("Ok"===K.$){var H=K.a;return l(WS,d,H,t)}var j=K.a;return f(HS,d,t)}var j=r.a;return l(KS,t,Do,M([pa(f(ll,"Error decoding initiated event",j))]));default:var q=e.a,G=f(IS,q,t.eventSentry),z=G.a,y=G.b;return l(KS,D(t,{eventSentry:z}),y,yr)}}),oT=function(e){return{$:"AgentHistoryMsg",a:e}},uT=function(e){return{$:"AppCmd",a:e}},sT={$:"BetaLandingPage"},cT={$:"ConnectToWeb3"},fT=function(e){return{$:"MarketplaceMsg",a:e}},lT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),dT=r(function(e,t){return f(kn,e,hl(t))}),hT=function(e){return f(dT,"href",tt(e))},pT=Nn("rel"),gT=dT("target"),vT=function(e){return{$:"Height",a:e}},yT=vT,mT={$:"Content"},bT=mT,CT=function(e){return{$:"Width",a:e}},ET=CT,ST=function(e){return{$:"Attr",a:e}},TT=function(e){return{$:"NodeName",a:e}},wT=function(e){return{$:"Unkeyed",a:e}},IT={$:"AsEl"},AT=IT,BT=r(function(e,t){return{$:"Field",a:e,b:t}}),kT=f(BT,0,0),NT={$:"NoNearbyChildren"},RT={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"},$T=RT.any+" "+RT.column,_T=RT.any+" "+RT.grid,LT=RT.any+" "+RT.page,xT=RT.any+" "+RT.paragraph,PT=RT.any+" "+RT.row,DT=RT.any+" "+RT.single,UT=function(e){switch(e.$){case"AsRow":return PT;case"AsColumn":return $T;case"AsEl":return DT;case"AsGrid":return _T;case"AsParagraph":return xT;default:return LT}},OT=function(e){return{$:"Keyed",a:e}},MT={$:"NoStyleSheet"},FT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),VT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),KT={$:"AsParagraph"},HT=KT,jT=Sn("div"),qT=Sn("p"),GT=Sn("s"),zT=Sn("u"),YT=dT("className"),WT=function(e){return wn(Xe(e))},JT=function(e){return Sn(Xe(e))},QT=function(e){return{$:"Flag",a:e}},XT=function(e){return{$:"Second",a:e}},ZT=function(e){return e>31?XT(1< .ctr > ."+RT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",eI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+" { flex-basis: auto !important; } "+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+Ew(RT.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"+Zw,tI=function(e){return{$:"Intermediate",a:e}},rI=r(function(e,t){return tI({closing:t,others:yr,props:yr,selector:e})}),nI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,tI({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(nI,f(rI,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(nI,f(rI,n.selector,""),v),t.others)})}});return tI(l(La,a,n,t))}),aI=U(eI,function(e){var t=function(e){return Cd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Cd(f(xa,a,t.others)))};return Cd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(nI,f(rI,r,""),n),t)}),yr,e)))}(U(Jw,Xw))),iI=l(JT,"style",yr,M([Tw(aI)])),oI=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+'"'}},uI=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}},sI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ch,uI,t.variants)}return!1},cI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),fI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),lI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(fI,"."+e+"."+t+", ."+e+" ."+t,n),f(fI,"."+e+"."+t+"> ."+RT.text+", ."+e+" ."+t+" > ."+RT.text,a)])}),dI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(lI,i,RT.sizeByCapital,a),l(lI,i,RT.fullSize,n)))}),hI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(fI,"."+r+"."+RT.sizeByCapital+", ."+r+" ."+RT.sizeByCapital,M([L("line-height","1")])),f(fI,"."+r+"."+RT.sizeByCapital+"> ."+RT.text+", ."+r+" ."+RT.sizeByCapital+" > ."+RT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),pI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},gI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Tc,t,r))}return ci},vI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),yI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(xc,e.descender,gI(t)),n=f(xc,e.baseline,gI(f(ml,function(e){return!R(e,r)},t))),a=f(xc,e.capital,pI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(vI,i,a-n,o),full:l(vI,u,a-r,s)}},mI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",mw(e.height)),L("vertical-align",mw(e.vertical)+"em"),L("font-size",mw(e.size)+"em")]))},bI=function(e){return l(Ra,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 si(L(mI(function(e){return e.full}(yI(a))),mI(function(e){return e.capital}(yI(a)))))}return t}return t}),ci,e)},CI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(US,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=bI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,hI(t),n));var i=a.a;return f(Ri,"",f(xa,f(dI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},EI=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+'" '+Ni(r)}},SI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,EI,t.variants)))}return ci},TI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},wI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+mw(r)+"px, "+mw(n)+"px, "+mw(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("+mw(o)+"px, "+mw(u)+"px, "+mw(s)+"px)",b="scale3d("+mw(f)+", "+mw(l)+", "+mw(d)+")",C="rotate3d("+mw(p)+", "+mw(g)+", "+mw(v)+", "+mw(y)+"rad)";return si(m+" "+b+" "+C)}},II=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,cI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,cI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,cI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,cI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+RT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+RT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+RT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,cI(!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,M([f(vw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Tc,1,1-c));return l(a,t,"."+u,M([f(vw,"opacity",mw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(vw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(US,SI,p)),v=M([f(vw,"font-family",f(Ri,", ",f(xa,oI,p))),f(vw,"font-feature-settings",g),f(vw,"font-variant",f(Ch,sI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(vw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(vw,s,bw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+RT.row,A="."+(RT.wrapped+I),B="."+RT.alignRight,k="."+RT.paragraph,N="."+RT.page,R="."+RT.alignLeft,$=mw(S/2)+"px",_=mw(E/2)+"px",x="."+RT.column,y="."+C,P="."+RT.any;return Cd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(vw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(vw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,U(y,k),M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,lw,F.rows))+"-cols-"+f(Ri,"-",f(xa,lw,F.columns))+"-space-x-"+lw(F.spacing.a)+"-space-y-"+lw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=wI(ne),y=hw(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,M([f(vw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=TI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(CI(s),c)}),AI=r(function(e,t){return l(JT,"style",yr,M([Tw(f(II,e,t))]))}),BI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",iI),f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)}),kI=a(function(e,t,r,n){return e?f(ka,iI,f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)):f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)}),NI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(WT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(BI,!1,e,t,r);default:var e=i.a,t=i.b;return d(BI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return jT;case"p":return qT;default:return JT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(kI,!1,e,t,n);default:var e=i.a,t=i.b;return d(kI,!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(JT,e,n,M([f(u,r,M([YT(RT.any+" "+RT.single)]))]))}}();switch(o.$){case"AsRow":return f(ow,sw,e)&&!f(ow,uw,e)?s:f(ow,tw,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerRight])))]),M([s])):f(ow,rw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(ow,iw,e)&&!f(ow,aw,e)?s:f(ow,nw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerCenterY])))]),M([s])):f(ow,ew,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerBottom])))]),M([s])):s;default:return s}}),RI=Tw,$I=function(e){return f(jT,M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthContent,RT.heightContent])))]),M([RI(e)]))},_I=function(e){return l(JT,"div",M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthFill,RT.heightFill])))]),M([Tw(e)]))},LI=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 R(e,HT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,HT),L(f(ka,L(n,f(s.html,MT,e)),i),Iu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,AT)?_I(c):$I(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 R(e,HT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,HT),L(f(ka,f(o.html,MT,e),n),Iu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,AT)?_I(u):$I(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children)),MT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children)),MT))}),xI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),PI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(BT,a|r,n)}var i=e.a;return f(BT,r,i|n)}),DI=ZT(7),UI=ZT(36),OI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(BT,r|a,n|i)}),MI=ZT(6),FI=ZT(38),VI=ZT(30),KI=ZT(29),HI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),jI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),qI=function(e){return{$:"Transform",a:e}},GI=function(e){return{$:"ChildrenBehind",a:e}},zI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),YI=function(e){return{$:"ChildrenInFront",a:e}},WI=r(function(e,t){return f(jT,M([YT(function(){switch(e.$){case"Above":return f(Ri," ",M([RT.nearby,RT.single,RT.above]));case"Below":return f(Ri," ",M([RT.nearby,RT.single,RT.below]));case"OnRight":return f(Ri," ",M([RT.nearby,RT.single,RT.onRight]));case"OnLeft":return f(Ri," ",M([RT.nearby,RT.single,RT.onLeft]));case"InFront":return f(Ri," ",M([RT.nearby,RT.single,RT.inFront]));default:return f(Ri," ",M([RT.nearby,RT.single,RT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Tw("");case"Text":var e=t.a;return $I(e);case"Unstyled":return(0,t.a)(AT);default:return f(t.a.html,MT,AT)}}()]))}),JI=n(function(e,t,r){var n=f(WI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?GI(M([n])):YI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?GI(f(ka,n,a)):f(zI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(zI,M([n]),i):YI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(zI,f(ka,n,a),i):f(zI,a,f(ka,n,i))}}),QI=r(function(e,t){switch(t.$){case"Generic":return TT(e);case"NodeName":var r=t.a;return f(HI,r,e);default:var n=t.a,a=t.b;return f(HI,n,a)}}),XI=function(e){switch(e.$){case"Left":return RT.alignedHorizontally+" "+RT.alignLeft;case"Right":return RT.alignedHorizontally+" "+RT.alignRight;default:return RT.alignedHorizontally+" "+RT.alignCenterX}},ZI=function(e){switch(e.$){case"Top":return RT.alignedVertically+" "+RT.alignTop;case"Bottom":return RT.alignedVertically+" "+RT.alignBottom;default:return RT.alignedVertically+" "+RT.alignCenterY}},eA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),tA=function(e){return{$:"Moved",a:e}},rA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return tA(x(r,0,0));case"MoveY":var n=t.a;return tA(x(0,n,0));case"MoveZ":var a=t.a;return tA(x(0,0,a));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(eA,x(0,0,0),i,x(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 tA(x(s,n,a));case"MoveY":var c=t.a;return tA(x(r,c,a));case"MoveZ":var f=t.a;return tA(x(r,n,f));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,u,x(1,1,1),i,o);default:var l=t.a;return d(eA,u,l,x(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(eA,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(eA,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(eA,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(eA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(eA,u,h,v,y);default:var m=t.a;return d(eA,u,m,p,o)}}}),nA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(kT,n,M([l(jI,n,"height",r+"px")]));case"Content":return x(f(PI,UI,kT),RT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(PI,iw,kT),RT.heightFill,yr):x(f(PI,iw,kT),RT.heightFillPortion+" height-fill-"+Ni(a),M([l(jI,RT.any+"."+RT.row+" > "+Ew("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(jI,u,"min-height",Ni(i)+"px"),c=nA(o),d=c.a,h=c.b,p=c.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(jI,u,"max-height",Ni(g)+"px"),v=nA(o),d=v.a,h=v.b,p=v.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p))}},aA=function(e){switch(e.$){case"Px":var t=e.a;return x(kT,RT.widthExact+" width-px-"+Ni(t),M([l(jI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(PI,FI,kT),RT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(PI,sw,kT),RT.widthFill,yr):x(f(PI,sw,kT),RT.widthFillPortion+" width-fill-"+Ni(r),M([l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(jI,i,"min-width",Ni(n)+"px"),u=aA(a),s=u.a,c=u.b,d=u.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(jI,i,"max-width",Ni(h)+"px"),p=aA(a),s=p.a,c=p.b,d=p.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d))}},iA=ZT(27),oA=r(function(e,t){if(R(e,iA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),uA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=hw(n);if("Nothing"===s.$)return{attributes:f(ka,YT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,YT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,qI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(oA,S,I)){var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(PI,S,r),y=f(rA,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(ow,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=RT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(PI,MI,r),y=n,m=f(ka,l(jI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+RT.widthContent,g=t,v=f(PI,FI,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+RT.widthFill,g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=aA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(ow,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(PI,DI,r),y=n,m=f(ka,l(jI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=RT.heightContent+" "+e,g=t,v=f(PI,UI,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=RT.heightFill+" "+e,g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.column+" > "+Ew("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=nA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(QI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(QI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(QI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(QI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(QI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(QI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(QI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return TT("p");case"NodeName":var e=t.a;return TT(e);default:var r=t.a,n=t.b;return f(HI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(JI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(ow,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=XI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(PI,rw,e);case"Right":return f(PI,tw,e);default:return e}}(f(PI,VI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(ow,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=ZI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(PI,nw,e);case"Bottom":return f(PI,ew,e);default:return e}}(f(PI,KI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),sA={$:"Untransformed"},cA=sA,fA=a(function(e,t,r,n){return l(LI,e,n,v(uA,UT(e),t,kT,cA,yr,yr,NT,$a(r)))}),lA=function(e){return ST(YT(e))},dA=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ST(gT("_blank")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e)))))),wT(M([n])))}),hA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),pA=n(function(e,t,r){return d(hA,e,t,r,1)}),gA=ZT(14),vA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),yA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),mA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return dw(t)+"-"+dw(r)+"-"+dw(n)+"-"+dw(a)},bA=function(e){return f(yA,gA,l(vA,"fc-"+mA(e),"color",e))},CA={align:ul,label:"cantConnectNoWeb3",mainParagraphs:M([M([fl("You need a web3 provider (such as "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(") to Connect.")]),M([fl("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:xg},EA={align:ul,label:"invalidUrl",mainParagraphs:M([M([fl("I don't understand that URL...")]),M([fl("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:$g},SA=function(e){return{$:"Active",a:e}},TA=gu(f(zo,jf,f(zo,Hh,$d("Error decoding hex to BigInt")))),wA=function(){return gu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),IA=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}}}}}}}}}}}},AA=function(e){return Em(M([f(Oi,si,e),Fi(ci)]))},BA=f(dh,AA(f(Oh,"status",wA)),f(dh,AA(f(Oh,"root",pu)),l(Im,"logsBloom",pu,l(Im,"logs",Mm(Fm),f(dh,AA(f(Oh,"contractAddress",Am)),l(Im,"cumulativeGasUsed",TA,l(Im,"gasUsed",TA,l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionIndex",Gy,l(Im,"transactionHash",Dm,Fi(IA)))))))))))),kA=function(e){var t=e.a;return jf(t)},NA=f(zo,kA,hl),RA=r(function(e,t){return Up({decoder:BA,method:"eth_getTransactionReceipt",params:M([NA(t)]),url:e})}),$A=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),_A=r(function(e,t){return{$:"TxMined",a:e,b:t}}),LA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),xA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(Io,function(e){return e.b},f(Io,function(e){return e.onMinedTagger},f(fp,t,e))))}),PA=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}}}}}}}}}}}},DA=function(e){return Em(M([Cm(ci),f(Oi,si,e)]))},UA=l(Im,"input",pu,l(Im,"gas",Gy,l(Im,"gasPrice",TA,l(Im,"value",TA,l(Im,"to",DA(Am),l(Im,"from",Am,l(Im,"transactionIndex",Gy,l(Im,"blockNumber",DA(Gy),l(Im,"blockHash",function(e){return f(du,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},cu(t))?Fi(ci):f(Oi,si,e)},pu)}(Rm),l(Im,"nonce",Gy,l(Im,"hash",Dm,Fi(PA)))))))))))),OA=r(function(e,t){return Up({decoder:UA,method:"eth_getTransactionByHash",params:M([NA(t)]),url:e})}),MA=r(function(e,t){return{attempts:e,sleep:t}}),FA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Xp,function(e){return a>0?f(Kp,function(e){return f(FA,f(MA,a,n),t)},bS(1e3*n)):Lp(e)},t)}),VA=r(function(e,t){return f(Kp,function(r){return f(FA,{attempts:30,sleep:1},f(OA,e,t))},bS(250))}),KA=r(function(e,t){return f(FA,{attempts:60,sleep:5},f(RA,e,t))}),HA=function(e){return{$:"Mined",a:e}},jA=function(e){return Bo(function(t){return D(t,{status:HA(e)})})},qA=function(e){return{$:"Sent",a:e}},GA=function(e){return Bo(function(t){return D(t,{status:qA(e)})})},zA=function(e){return{$:"Signed",a:e}},YA=function(e){return Bo(function(t){return D(t,{status:zA(e)})})},WA=function(e){return"Nothing"!==e.$},JA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Tl(r),Do);case"TxSigned":var n=e.a,a=e.b,i=f(fp,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(Yg,t,xp(a))}return Do}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Do;if("Just"===t.b.$){var r=t.b.a;return f(Yg,r,xp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Yg,a,xp(fi(e)))}t.a,t.b,t.c;return Do};if("Ok"===a.$){var c=a.a,d=WA(o.onBroadcastTagger)||WA(o.onMinedTagger)?f(il,r.tagger,f(Zp,LA(n),f(VA,r.nodePath,c))):Do;return L(Tl(D(r,{txs:l(bp,n,YA(c),r.txs)})),Po(M([u,d])))}var h=a.a;return L(Tl(r),Po(M([u,s(h)])))}return L(Tl(r),Do);case"TxSent":var n=e.a,p=e.b,g=f(fp,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(il,r.tagger,f(Zp,_A(n),f(KA,r.nodePath,v.hash))):Do}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Yg,t,xp(li(v)))}return Do}();return L(Tl(D(r,{txs:l(bp,n,GA(v),r.txs)})),Po(M([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(Yg,t,xp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Yg,n,xp(fi("Error with TxSent stuff")))}e.a,e.b;return Do}();return L(Tl(r),s)}return L(Tl(r),Do);case"TxMined":var n=e.a,m=e.b,b=f(fp,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Yg,a,xp(li(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 Po(M([f(il,r.tagger,f(Zp,f($A,n,s),zy(r.nodePath))),f(Yg,a,xp(li(C))),f(Yg,u.toMsg,xp(s))]))}return Do}();return L(Tl(D(r,{txs:l(bp,n,jA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Yg,r,xp(fi("TxReceipt decoding failure")))}return Do}();return L(Tl(r),S)}return L(Tl(r),Do);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(xA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Tl(r),f(Yg,B,f(Xp,function(e){return xp(D(I,{doneWatching:!0,reOrg:!0}))},f(Kp,function(e){return xp(D(I,{doneWatching:!0}))},f(RA,r.nodePath,T.txHash)))))}return L(Tl(r),Do)}if(R(w,T.lastCheckedBlock))return L(Tl(r),f(il,r.tagger,f(Zp,f($A,n,T),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))));var k=f(xA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Tl(r),Po(M([f(il,r.tagger,f(Zp,f($A,n,I),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))),f(Yg,B,xp(I))])))}return L(Tl(r),Do)}var n=e.a,h=e.c.a;return L(Tl(r),Do);default:var h=e.a;return L(Tl(r),Do)}}),QA=Jt,XA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),ZA=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),eB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(ZA,"#",e.fragment,l(ZA,"?",e.query,U(f(XA,e.port_,U(t,e.host)),e.path)))},tB=r(function(e,t){return e<0?ci:Ql(f(nd,e,t))}),rB=r(function(e,t){if(e<0)return t;var r=Bh(f(nd,e,t)),n=f(lc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),nB=n(function(e,t,r){if(e<0)return r;var n=f(nd,e,r),a=f(lc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),aB=r(function(e,t){return f(nB,e,ms(t))}),iB=r(function(e,t){Kv(t);switch(t.$){case"Home":return L(D(e,{submodel:sT}),Do);case"Create":var r=Xd(e.wallet),n=f(Ul,e.txSentry,f(Yo,Uy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(uB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),Po(M([f(il,Uy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(By,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(Wm,e.wallet,r)}return l(vm,e.wallet,u,s)}(),c=f(Ul,e.txSentry,f(Yo,Fy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(uB,U(f(Qi,Fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:My(r.model),txSentry:a}),Po(M([f(il,Fy,r.cmd),i]))));case"Marketplace":var d=Bv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Oy(h)}),Po(M([f(il,fT,p)])));case"AgentHistory":var g=t.a,v=f(Uo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:Py(y)}),Po(M([f(il,oT,m)])));default:return L(f(uo,EA,e),Do)}}),oB=r(function(e,t){var r=t.a,n=t.b,a=f(sB,uT(e),r),i=a.a,o=a.b;return L(i,Po(M([n,o])))}),uB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,oB,L(r,n),e)}),sB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(sB,cT,t);case"GotoRoute":var n=r.a;return L(t,f(Cy,t.key,n));case"GTag":var a=r.a;return L(t,wy(Sy(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),wy(Sy(d(Ol,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Uv,ky,o,u,s));default:return L(t,Ny(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(rB,c,t.userNotices)}),Do);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(by,t.key,eB(e))}var r=h.a;return QA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(cB,g,t);case"GotoRoute":var v=e.a;return L(t,Po(M([wy(Sy(d(Ol,"GotoRoute","navigation",Kv(v),0))),f(Cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Do);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,CA,t),Do):L(t,Ey(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Do;var t=e.a;return Iy(f(Ty,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(D(t,{userAddress:m.account}),b);case"UserPubkeySet":var C=e.a,E=f(Gh,pu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=SA(l(Ml,I,w,S)),B=f(Vy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ll,"Unexpected wallet state encounted when setting commPubkey!",ci),t),Do)}T.a;return L(f(uo,f(ll,"User pubkey set, but I can no longer find the user address!",ci),t),Do)}var N=E.a;return L(l(Pa,uo,f(ll,"error decoding commPubkey from JS",N),t),Do);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(lv,R,_),P=f(Ul,t.txSentry,f(Yo,Uy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(uB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),Po(M([f(il,Uy,x.cmd),F]))))}return L(t,Do);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(BS,K,j),q=f(Ul,t.txSentry,f(Yo,Fy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(uB,U(f(Qi,Fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:My(x.model),txSentry:O}),Po(M([f(il,Fy,x.cmd),F]))))}return L(t,Do);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Dv,G,Y);return f(uB,f(Qi,fT,x.appCmds),L(D(t,{submodel:Oy(x.model)}),f(il,fT,x.cmd)))}return L(t,Do);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(ol,W,Q),X=f(Ul,t.txSentry,f(Yo,oT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(uB,U(f(Qi,oT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Py(x.model),txSentry:O}),Po(M([f(il,oT,x.cmd),F]))))}return L(t,Do);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(_u,si,f(JA,Z,r))}return L(ci,Do)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(tB,re,t.tradeCaches);if("Nothing"===ae.$)return f(oB,pa(f(ll,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Do));var ie=ae.a,x=f(iT,ne,ie);return L(D(t,{tradeCaches:l(aB,re,x.tradeCache,t.tradeCaches)}),f(il,lT(re),x.cmd));case"NoOp":return L(t,Do);default:var N=e.a;f(cl,"test",N);return L(t,Do)}}),cB=r(function(e,t){return f(iB,t,my(e))}),fB=Ge("txIn",Sm),lB=je("txOut",Ua),dB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},hB=function(e){return{$:"EventSentryMsg",a:e}},pB=function(e){var t=f(cm,hB,Xh(e)),r=t.a,n=t.b;return x({dataFetchState:l(QS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Zd,"tradeCache init","processing",dB(e),0)]))},gB=function(e){return{$:"InitialNumTradesFetched",a:e}},vB=function(e){return f(LS,e.factory,gB)},yB=function(e){var t=pB(e),r=t.a,n=t.b,a=t.c;return x(r,Po(M([n,vB(r)])),a)},mB=function(e){return{$:"TxSentryMsg",a:e}},bB={align:ul,label:"noWeb3Provider",mainParagraphs:M([M([fl("No web3 provider detected. Is "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(" or some other web3 provider installed and unlocked?")])]),noticeType:xg},CB={$:"TopLeft"},EB={align:CB,label:"screenToSmall",mainParagraphs:M([M([fl("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:xg},SB={align:ul,label:"wrongWeb3Network",mainParagraphs:M([M([fl("Make sure your wallet is set to a compatible network.")]),M([fl(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:$g},TB={$:"NoneDetected"},wB=function(e){return{$:"OnlyNetwork",a:e}},IB=function(e){return f(Bo,Xh,Mg(e))},AB={$:"ETCMain"},BB={$:"ETCTest"},kB={$:"Expanse"},NB={$:"Kovan"},RB={$:"Mainnet"},$B=function(e){return{$:"Private",a:e}},_B={$:"Rinkeby"},LB={$:"Ropsten"},xB={$:"RskMain"},PB={$:"RskTest"},DB=function(e){switch(e){case 1:return RB;case 2:return kB;case 3:return LB;case 4:return _B;case 30:return xB;case 31:return PB;case 42:return NB;case 41:return AB;case 62:return BB;default:return $B(e)}},UB=n(function(e,t,r){var n=e.a,a=e.b;return Tl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:cp})}),OB=n(function(e,t,n){var a=e.networkId?wB(DB(e.networkId)):TB,i=f(Bo,function(e){return l(UB,L(lB,fB),mB,e)},IB(a)),o=e.width<1024?si(EB):ci,u=f(xa,yB,ro),s=function(){return R(a,TB)?si(bB):"Nothing"===Mg(a).$?si(SB):ci}(),c=mE(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ay(f(Bi,r(function(e,t){return f(Qi,lT(e),t)}),g)),y=Po(f(Bi,r(function(e,t){return f(il,lT(e),t)}),p)),m=f(uB,v,f(cB,t,{key:n,screenWidth:e.width,submodel:sT,time:Vl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),Po(M([y,C])))}),MB=Oe,FB=MB(yr),VB=function(e){return FB},KB=function(e){return{$:"Refresh",a:e}},HB=r(function(e,t){return{$:"Every",a:e,b:t}}),jB=r(function(e,t){return{processes:t,taggers:e}}),qB=xp(f(jB,cp,cp)),GB=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(SS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),zB=Ne,YB=r(function(e,t){var r=e.a,n=e.b,a=f(fp,r,t);if("Nothing"===a.$)return l(xl,r,M([n]),t);var i=a.a;return l(xl,r,f(ka,n,i),t)}),WB=Be,JB=r(function(e,t){return{$:"Zone",a:e,b:t}}),QB=ca,XB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=WB(f(QB,n,f(Sp,e,n)));return f(Kp,function(t){return l(XB,e,a,l(xl,n,t,r))},i)}return xp(r)}),ZB=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 x(n,a,f(Kp,function(e){return i},zB(t)))}),u=l(Ra,YB,cp,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(xl,e,r,i),o)}),d=p(GB,s,c,o,u,i,x(yr,cp,xp(gr))),h=d.a,g=d.b,v=d.c;return f(Kp,function(e){return xp(f(jB,u,e))},f(Kp,function(t){return l(XB,e,h,g)},v))}),ek=function(e){return we(function(t){t(Se(e(Date.now())))})}(Vl),tk=n(function(e,t,r){var n=f(fp,t,r.taggers);if("Nothing"===n.$)return xp(r);var a=n.a,i=function(t){return Gp(f(xa,function(r){return f(Ep,e,r(t))},a))};return f(Kp,function(e){return xp(r)},f(Kp,i,ek))}),rk=r(function(e,t){var r=t.a,n=t.b;return f(HB,r,f(Da,e,n))});pn.Time=Pe(qB,ZB,tk,0,rk);var nk=Ue("Time"),ak=r(function(e,t){return nk(f(HB,e,t))}),ik=function(e){return f(ak,2e3,KB)},ok=function(e){return FB},uk=function(e){return{$:"DecryptionFinished",a:e}},sk=Ge("decryptionFinished",Sm),ck=Ge("encryptionFinished",Sm),fk=function(e){return{$:"EncryptionFinished",a:e}},lk=function(e){return{$:"Refresh",a:e}},dk=function(e){return MB(M([f(ak,3e3,lk),ck(fk),sk(function(e){return jE(uk(e))})]))},hk=yn,pk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return FB;case"CreateModel":t.a;return f(hk,Uy,ik());case"TradeModel":t.a;return f(hk,Fy,dk());case"MarketplaceModel":t.a;return f(hk,fT,ok());default:t.a;return f(hk,oT,VB())}},gk=Ge("userPubkeyResult",Sm),vk=Ge("walletSentryPort",Sm),yk={$:"CheckForNewTrades"},mk={$:"UpdateTradePhases"},bk=function(e){return MB(M([f(ak,5e3,function(e){return yk}),f(ak,3e3,function(e){return mk})]))},Ck=function(e){return{$:"Tick",a:e}},Ek=function(e){return{$:"UserPubkeySet",a:e}},Sk=function(e){return{$:"WalletStatus",a:e}},Tk=function(e){return f(ll,"Error decoding JS walletSentry: "+e,ci)},wk=function(e){return{$:"ErrorDecoding",a:e}},Ik=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Ak=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Oh,"ref",CE),f(Oh,"txHash",AA(Dm))),Bk=function(e){var t=f(Gh,Ak,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Ik,r.ref,li(a))}return f(Ik,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return wk("Error decoding tx data")},kk=function(e){var t=e.a;return f(hk,t.tagger,t.inPort(Bk))},Nk=f(Oi,DB,CE),Rk=gu(f(zo,rd,f(zo,$d("Failure decoding stringy int"),au(DB)))),$k=Em(M([Rk,Nk])),_k=r(function(e,t){return{account:e,networkId:t}}),Lk=l(Mi,_k,f(Oh,"account",AA(Am)),f(Oh,"networkId",$k)),xk=n(function(e,t,r){var n=f(Gh,Lk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),Pk=function(e){var t=f(zo,Tk,f(zo,pa,uT));return MB(U(M([f(ak,1e3,Ck),vk(f(xk,t,Sk)),f(xc,FB,f(Bo,kk,e.txSentry)),gk(Ek),MB(f(Bi,r(function(e,t){return f(hk,lT(e),t)}),f(xa,bk,e.tradeCaches)))]),M([pk(e)])))},Dk=function(e){return{$:"LinkClicked",a:e}},Uk=function(e){return{$:"UrlChanged",a:e}},Ok=n(function(e,t,r){return d(hA,e/255,t/255,r/255,1)}),Mk=l(Ok,10,33,108),Fk={$:"Generic"},Vk=Fk,Kk=r(function(e,t){return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),e)),wT(M([t])))}),Hk=function(e){return{$:"Fill",a:e}},jk=Hk(1),qk=Hi,Gk=function(e){return{$:"Px",a:e}},zk=Gk,Yk=ZT(8),Wk=function(e){return f(yA,Yk,l(vA,"bg-"+mA(e),"background-color",e))},Jk=f(Kk,M([ET(jk),yT(zk(150)),Wk(Mk)]),qk),Qk=function(e){return{$:"GotoRoute",a:e}},Xk={$:"Active"},Zk={$:"Important"},eN={$:"Normal"},tN=l(pA,1,1,1),rN=ZT(2),nN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),aN=r(function(e,t){return R(e,t)?f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e)):f(yA,rN,h(nN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),iN=ZT(21),oN=r(function(e,t){return{$:"Class",a:e,b:t}}),uN=f(oN,iN,RT.cursorPointer),sN=ZT(17),cN=function(e){return f(yA,sN,l(jI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},fN=function(e){return{$:"Normal",a:e}},lN=An,dN=r(function(e,t){return f(lN,e,fN(t))}),hN=function(e){return f(dN,"click",Fi(e))},pN=f(Da,ST,hN),gN=ZT(13),vN=f(oN,gN,RT.textSemiBold),yN=ZT(4),mN=function(e){return{$:"FontSize",a:e}},bN=function(e){return f(yA,yN,mN(e))},CN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([cN(4),Wk(l(pA,0,0,1))]);default:return M([cN(4),Wk(l(pA,.9,0,0))])}}();return f(Kk,U(M([f(aN,23,12),bN(22),vN,bA(tN),uN,pN(t)]),n),fl(e))}),EN=l(Ok,244,0,103),SN=function(e){return{$:"AlignX",a:e}},TN={$:"CenterX"},wN=SN(TN),IN=ZT(3),AN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),BN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),kN=function(e){return f(yA,IN,l(AN,f(BN,e,e),e,e))},NN=function(e){return{$:"Describe",a:e}},RN={$:"Paragraph"},$N=r(function(e,t){return d(fA,HT,Vk,f(ka,NN(RN),f(ka,ET(jk),f(ka,kN(5),e))),wT(t))}),_N=f(oN,gN,RT.bold),LN=f(Kk,M([bN(29),bA(tN),_N,wN,uN,pN(Qk(Gv))]),f($N,yr,M([fl("DAI"),f(Kk,M([bA(EN)]),fl("Hard"))]))),xN={$:"Right"},PN=SN(xN),DN={$:"AsColumn"},UN=DN,ON=r(function(e,t){return d(fA,UN,Vk,f(ka,lA(RT.contentTop+" "+RT.contentLeft),f(ka,yT(bT),f(ka,ET(bT),e))),wT(t))}),MN={$:"AsRow"},FN=MN,VN=r(function(e,t){return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY),f(ka,ET(bT),f(ka,yT(bT),e))),wT(t))}),KN=function(e){return f(VN,M([ET(jk),kN(30),f(aN,30,17)]),M([l(CN,"Browse Offers",Qk(zv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Xk}return eN}()),l(CN,"Create a New Offer",Qk(qv),function(){return"CreateModel"===e.submodel.$?Xk:eN}()),function(){var t=Gd(e.wallet);if("Just"===t.$){var r=t.a;return l(CN,"My Trades",Qk(jv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Xk:eN}return eN}())}return l(CN,"Connect to Wallet",cT,Zk)}(),f(ON,M([PN,kN(0),f(aN,8,0)]),M([LN]))]))},HN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},jN=function(e){return ml(e)},qN=r(function(e,t){return f(ml,dv(e),t)}),GN=function(e){return f(ml,function(e){return Kb(e.parameters)},OS(e))},zN={$:"BurnWindow"},YN={$:"FiatPrice"},WN={$:"Margin"},JN={$:"Offer"},QN={$:"PaymentWindow"},XN=function(e){return{$:"AlignY",a:e}},ZN={$:"CenterY"},eR=XN(ZN),tR=ZT(20),rR=f(oN,tR,RT.clip),nR=Hk,aR=function(e){return f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e))},iR=r(function(e,t){return f(Kk,M([ET(nR(e)),yT(zk(60)),rR,Wk(tN)]),f(Kk,M([aR(12),eR,ET(jk)]),t))}),oR=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},uR=function(e){return{$:"JustImage",a:e}},sR=uR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),cR=dT("alt"),fR=function(e){return f(dT,"src",rt(e))},lR=r(function(e,t){var r=t.src,n=t.description,a=f(ml,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(fA,AT,Vk,f(ka,lA(RT.imageContainer),e),wT(M([d(fA,AT,TT("img"),U(M([ST(fR(r)),ST(cR(n))]),a),wT(yr))])))}),dR=r(function(e,t){if("None"===t.$)return qk;var r=t.a;return f(lR,e,r)}),hR=uR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),pR=function(e){return{$:"ChangeSort",a:e}},gR=f(oN,gN,RT.textMedium),vR=function(e){return f(Kk,M([gR,bN(17)]),fl(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},yR=r(function(e,t){return f(VN,M([kN(5),uN,pN(pR(e))]),M([vR(e),function(){if("Just"===t.$){var e=t.a;return f(Kk,M([eR]),f(dR,M([ET(zk(8))]),function(){return"Ascending"===e.$?sR:hR}()))}return qk}()]))}),mR=r(function(e,t){return f(iR,oR(t),f(yR,t,e))}),bR=r(function(e,t){return f(VN,M([ET(jk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(mR,r,t)},t))}),CR=l(Ok,150,150,150),ER=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},SR=r(function(e,t){return f(ts,e.amount,t.amount)}),TR=n(function(e,t,r){return f(e,r,t)}),wR=function(e){var t=e.a;return(R(e.b,Lo)?Ua:TR)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(wR,L(Av,Zf),e,t):f(Ku,ER(e.state.phase),ER(t.state.phase))});case"Expires":return r(function(e,t){return f(hv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Sv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(SR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(xc,ma,l(zd,r(function(e,t){return f(Ku,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(hv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(hv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},IR=l(Ok,233,237,242),AR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),BR=function(e){return f(Kk,M([ET(jk),yT(jk),rR]),f($N,M([bN(12)]),M([fl(e.info)])))},kR=function(e){return f(xc,qk,f(Bo,BR,Ql(e)))},NR=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"}},RR=function(e){return{$:"TimeLeft",a:e}},$R=function(e){return{$:"TimeUp",a:e}},_R=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 Vl(0)}}),LR=r(function(e,t){return Vl(jd(e)-jd(t))}),xR=r(function(e,t){var r=f(_R,t.state.phase,t),n=f(LR,e,t.state.phaseStartTime),a=f(LR,r,n);return jd(a)>0?RR(L(a,r)):$R(r)}),PR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},DR=l(pA,0,0,0),UR=l(Ok,51,183,2),OR=function(e){var t=ju(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Qo(n));return n+(function(){if(a){return f(ru,a+1,f(Zo,1,mw(r)))}return""}()+"%")},MR=r(function(e,t){return uR({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"}()})}),FR=n(function(e,t,r){return f(dR,f(ka,yT(zk(34)),e),f(MR,t,r))}),VR=r(function(e,t){var r=OR(t);if("0%"===r)return f(Kk,M([bN(16)]),fl("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?UR:EN;return f(VN,M([kN(4)]),M([l(FR,yr,a,si(i)),f(Kk,M([bA(o),bN(16)]),fl(n))]))}),KR=uR,HR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(xl,r,n,t)}),cp,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,KR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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(xc,"",f(Bo,Qa,f(fp,e,HR)))},qR=function(e){return Qo(e)<=3?e:qR(f(Td,3,e))+","+f(ou,3,e)},GR=function(e){return qR(Sd(e))},zR=function(e){return U(jR(e.fiatType),GR(e.amount))},YR=hA,WR=function(e){var t=function(){var t=f(fp,e.fiatType,HR);if("Nothing"===t.$)return qk;var r=t.a,n=(r.a,r.b);return f(dR,M([yT(zk(26))]),n)}();return f(VN,M([kN(4)]),M([t,f(Kk,M([bA(d(YR,0,0,0,.5)),gR,ET(zk(50))]),fl(e.fiatType)),fl(zR(e))]))},JR=function(e){return jd(e)<0},QR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),XR=function(e){var t=vg(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(QR,$C(t),$C(r),$C(n),$C(a))}(f(xc,L(qu(0),qu(0)),f(Ts,n,qu(60))))}(f(xc,L(qu(0),qu(0)),f(Ts,r,qu(3600))))}(f(xc,L(qu(0),qu(0)),f(Ts,t,qu(86400))))},ZR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!JR(a)){var u=r(function(e,t){return U(l(Rs,2,P("0"),Ni(e)),t)}),s=jd(a)>0?i:o,c=XR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(VN,U(M([kN(5)]),e),M([f(Kk,U(M([bA(h)]),t),fl(f(u,c.days,"d"))),f(Kk,U(M([bA(d)]),t),fl(f(u,c.hours,"h"))),f(Kk,U(M([bA(s)]),t),fl(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Vl(0);e=p,t=g,n=v,a=y}}),e$={$:"Behind"},t$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),r$=function(e){return f(t$,e$,e)},n$=r(function(e,t){var r=sv(200*e),n=200-r,a=f(Kk,M([ET(nR(n))]),qk),i=M([yT(zk(3)),cN(20)]),o=f(Kk,U(i,M([ET(nR(r)),Wk(t)])),qk),u=f(Kk,U(i,M([ET(jk),Wk(IR)])),qk);return f(VN,M([ET(jk),r$(u)]),M([o,a]))}),a$=l(pA,1,1,0),i$=r(function(e,t){return jd(e)/jd(t)}),o$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(i$,o,u),c=(f(Kk,M([wN]),d(ZR,yr,yr,L(a,i),o)),s<.1?EN:s<.2?a$:UR);return f(ON,U(M([kN(5)]),e),M([d(ZR,M([wN]),t,L(a,i),o),f(n$,1-s,c)]))}),u$=function(e){var t=wd(jl(e)),r=f(Xl,".",t);if(!r.b)return t;if(r.b.b){cl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(ru,3,t);case 1:return f(ru,4,f(xc,t,f(Bo,mw,f(Bo,function(e){return e/100},f(Bo,Ka,f(Bo,sv,f(Bo,ti(100),Bd(t))))))));default:var n=r.a;return f(xc,f(ru,n,t),f(Bo,Ni,f(Bo,sv,Bd(t))))}},s$=n(function(e,t,r){return f(iR,oR(t),function(){switch(t.$){case"Phase":var n=PR(r.state.phase),a=L(f(xR,e,r),r.state.phase);e:for(;;){if("TimeLeft"===a.a.$){if("Closed"===a.b.$)break e;var i=a.a.a,o=f(i$,i.a,i.b)<.05?EN:DR;return f(ON,M([kN(3)]),M([fl(n),d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)]))}if("Closed"===a.b.$)break e;var u=a.a.a;return f(VN,M([kN(6),bA(CR)]),M([fl(n),f(Kk,M([bN(16)]),fl("(stale)"))]))}a.b;return fl(n);case"Expires":if("Open"===r.state.phase.$){var s=f(xR,e,r);if("TimeLeft"===s.$){var i=s.a,o=f(i$,i.a,i.b)<.05?EN:DR;return d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)}var u=s.a;return d(o$,M([ET(jk)]),M([bN(16)]),L(EN,IR),L(Vl(0),u))}return qk;case"Offer":return f(VN,M([kN(5)]),M([fl(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(u$(r.parameters.tradeAmount)+" ")+NR(r.factory))]));case"FiatPrice":return WR(r.terms.price);case"Margin":var c=R(r.parameters.initiatorRole,fo);return f(xc,qk,f(Bo,VR(c),r.derived.margin));case"PaymentWindow":var l=function(){return"Seller"===r.parameters.initiatorRole.$?EN:UR}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoabortInterval);default:var l=function(){return"Seller"===r.parameters.initiatorRole.$?UR:EN}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoreleaseInterval)}}())}),c$=n(function(e,t,r){return f(ON,M([ET(jk),kN(1),Wk(IR),uN,pN(f(AR,r.factory,r.id))]),M([f(VN,M([ET(jk),kN(1)]),f(xa,function(t){return l(s$,e,t,r)},t)),f(iR,1,kR(r.terms.paymentMethods))]))}),f$=Er,l$=ZT(28),d$=function(e){return f(yA,l$,l(vA,"bc-"+mA(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(yA,iA,h(h$,"b-"+Ni(e),e,e,e,e))},g$=a(function(e,t,r,n){return f(ON,M([ET(jk),p$(2),cN(8),d$(CR),kN(2),Wk(CR),rR]),f(xa,f(c$,e,r),f(f$,wR(t.orderBy),n)))}),v$=a(function(e,t,r,n){return f(ON,M([ET(jk),yT(jk),kN(5)]),M([f(bR,t.orderBy,r),d(g$,e,t,r,n)]))}),y$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),m$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(yA,rN,h(nN,"p-"+Ni(t),t,t,t,t)):f(yA,rN,h(nN,d(y$,t,r,n,a),t,r,n,a))},b$=lA(RT.italic),C$=a(function(e,t,r,n){var a=f(qN,n.filters,ay(f(xa,function(e){return f(jN,HN(n),GN(e))},r)));return R(a,yr)?f(Kk,M([wN,bN(24),m$({bottom:0,left:0,right:0,top:30}),b$]),fl(t?"No trades found with those filters.":"Initializing Trade Cache...")):f(Yi,Ko,d(v$,e,n.tradeTable,M([xo,JN,YN,WN,QN,zN]),a))}),E$=r(function(e,t){return f(Kk,M([cN(4),Wk(d(YR,0,0,1,.1)),bA(l(Ok,16,7,234)),bN(e),vN,f(aN,15,13)]),fl(dl(t)))}),S$=function(e){return function(){var t=Gd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?qk:f(VN,M([kN(10),m$({bottom:20,left:20,right:20,top:10})]),M([f(Kk,M([bN(24),vN]),fl("Trade History for User")),f(E$,18,e.agentAddress)]))},T$=function(e){return{$:"FiltersMsg",a:e}},w$=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},I$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),A$=xI,B$={$:"Left"},k$=SN(B$),N$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(fA,UN,TT("label"),e,wT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(fA,AT,Vk,a,wT(M([i])));switch(n.$){case"Above":return d(fA,UN,TT("label"),e,wT(M([o,r])));case"Below":return d(fA,UN,TT("label"),e,wT(M([r,o])));case"OnRight":return d(fA,FN,TT("label"),e,wT(M([r,o])));default:return d(fA,FN,TT("label"),e,wT(M([o,r])))}}),R$=function(e){return{$:"Label",a:e}},$$={$:"NoAttribute"},_$=function(e){if("HiddenLabel"===e.$){var t=e.a;return NN(R$(t))}return $$},L$=function(e){return"HiddenLabel"===e.$},x$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return hu("No key matched");var n=r.a;return Fi(n)},r=f(du,t,f(Oh,"key",pu));return ST(f(dN,"keyup",r))},P$=function(e){return f(Nn,"tabIndex",Ni(e))},D$=f(Da,ST,P$),U$={$:"LivePolite"},O$=NN(U$),M$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([L$(r)?$$:kN(6),ST(hN(i(!a))),O$,x$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),D$(0),uN,k$,ET(jk)]),e);return l(N$,o,r,d(fA,AT,Vk,M([ST(f(A$,"role","checkbox")),ST(f(A$,"aria-checked",a?"true":"false")),_$(r),eR,yT(jk),ET(bT)]),wT(M([n(a)]))))}),F$=Br,V$=function(e){return e*F$/180},K$=ZT(26),H$=function(e){return{$:"MoveY",a:e}},j$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),q$=function(e){return f(j$,K$,H$(-e))},G$=ZT(24),z$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),Y$=function(e){return f(j$,G$,f(z$,x(0,0,1),e))},W$=ZT(19),J$=function(e){return Cd(M([e.inset?"box-inset":"box-",mw(e.offset.a)+"px",mw(e.offset.b)+"px",mw(e.blur)+"px",mw(e.size)+"px",mA(e.color)]))},Q$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(yA,W$,l(jI,J$(t),"box-shadow",Cw(t)))},X$=r(function(e,t){return f(yA,iA,h(h$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Z$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?p$(r):f(X$,n,r):f(yA,iA,h(h$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},e_=ZT(12),t_=f(oN,e_,RT.textCenter),r_=l(pA,1,1,1),n_=function(e){return f(Kk,M([lA("focusable"),ET(zk(14)),yT(zk(14)),bA(r_),eR,bN(9),t_,cN(3),d$(e?l(pA,59/255,.6,252/255):l(pA,211/255,211/255,211/255)),Q$({blur:1,color:e?d(YR,238/255,238/255,238/255,0):l(pA,238/255,238/255,238/255),offset:L(0,0),size:1}),Wk(e?l(pA,59/255,.6,252/255):r_),p$(e?0:1)]),e?f(Kk,M([d$(r_),yT(zk(6)),ET(zk(9)),Y$(V$(-45)),wN,eR,q$(1),Z$({bottom:2,left:2,right:0,top:0})]),qk):qk)},a_=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),i_={$:"OnRight"},o_=a_(i_),u_=r(function(e,t){return f(M$,yr,{checked:t.checked,icon:n_,label:f(o_,yr,fl(t.label)),onChange:f(I$,e,t.label)})}),s_={$:"Top"},c_=XN(s_),f_=function(e){return f(ON,M([kN(15),c_]),M([f(Kk,M([bN(28),gR]),fl(w$(e.type_))),f(ON,M([kN(5)]),f(xa,u_(e.type_),e.options))]))},l_=function(e){return f(VN,M([kN(20)]),f(xa,f_,e))},d_={$:"NoneFound"},h_={$:"AllFetched"},p_={$:"FetchingTrades"},g_={$:"QueryingNumTrades"},v_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return g_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?p_:h_}return d_},y_={$:"InFront"},m_=function(e){return f(t$,y_,e)},b_=r(function(e,t){var r=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},n=f(Eh,Ja(d_),f(xa,v_,e))?M([r("No trades found.")]):f(xa,r,mE(f(xa,function(e){switch(v_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),m_(f(ON,M([kN(5),k$]),n))]),f(Kk,M([wN]),f(Yi,T$,l_(t.filters))))}),C_=n(function(e,t,r){return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),f(aN,30,20)]),M([S$(r),f(b_,t,r),function(){var n=f(Eh,f(zo,v_,Ja(h_)),t);return d(C$,e,n,t,r)}()]))}),E_=function(e){return{$:"ShowCurrencyDropdown",a:e}},S_={$:"AbortCreate"},T_=function(e){return{$:"AppCmd",a:e}},w_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),I_=function(e){return f(xa,function(e){return M([f(Kk,M([bA(EN)]),fl("Caution! ")),fl(e)])},mE(M([R(f(hv,e.autoreleaseInterval,Vl(12e5)),ba)?si(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."}()):ci,R(f(hv,e.autoabortInterval,Vl(36e5)),ba)?si(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.'}()):ci])))},A_=l(pA,0,0,1),B_=function(e){return f(Kk,M([m$({bottom:5,left:5,right:5,top:0}),pN(e),cN(30),Wk(d(YR,1,1,1,.4)),p$(1),d$(d(YR,0,0,0,.3)),uN,bN(14)]),f(Kk,M([bA(d(YR,0,0,0,.7))]),fl("x")))},k_=Bn,N_=k_,R_=ST,$_=r(function(e,t){return f(Kk,M([r$(f(Kk,M([Wk(e),R_(f(N_,"position","fixed")),R_(f(N_,"z-index","1000")),R_(f(N_,"top","0")),R_(f(N_,"left","0")),R_(f(N_,"width","100%")),R_(f(N_,"height","100%"))]),qk)),ET(jk),yT(jk)]),t)}),__=r(function(e,t){return{$:"Max",a:e,b:t}}),L_=r(function(e,t){return f(__,e,t)}),x_=n(function(e,t,r){return l(Pa,$_,d(YR,0,0,.3,.6),f(Kk,U(M([wN,eR,ET(f(L_,500,bT)),Wk(tN),cN(8),m_(f(Kk,M([PN,c_]),B_(r)))]),e),t))}),P_=r(function(e,t){if("Nothing"===t.$)return qk;var r=t.a;return f(Kk,U(M([cN(5),d$(l(pA,.9,0,0)),p$(1),Wk(l(pA,1,.4,.4)),aR(5),wN,eR,ET(f(L_,200,bT)),bN(14)]),e),f($N,yr,M([fl(r)])))}),D_={$:"Above"},U_=function(e){return f(t$,D_,e)},O_=r(function(e,t){return f(Kk,M([cN(4),f(aN,25,17),bN(18),vN,Wk(IR),U_(f(P_,M([q$(5)]),t))]),fl(e))}),M_=a(function(e,t,r,n){return d(hA,e/255,t/255,r/255,n)}),F_=d(M_,1,31,52,.64),V_=ZT(32),K_={$:"Active"},H_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),j_=$n,q_=r(function(e,t){switch(t.$){case"NoAttribute":return $$;case"Describe":var r=t.a;return NN(r);case"AlignX":var n=t.a;return SN(n);case"AlignY":var a=t.a;return XN(a);case"Width":var n=t.a;return CT(n);case"Height":var n=t.a;return vT(n);case"Class":var n=t.a,a=t.b;return f(oN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(yA,i,o);case"Nearby":var u=t.a,s=t.b;return f(t$,u,f(zi,e,s));case"Attr":var c=t.a;return ST(f(j_,e,c));default:var l=t.a,d=t.b;return f(j$,l,d)}}),G_=function(e){return f(q_,zg,e)},z_=r(function(e,t){var r=t.a,n=t.b,a=G_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(rA,n,o));default:return L(r,n)}}),Y_=function(e){var t=l(Ra,z_,L(yr,sA),e),r=t.a,n=t.b;return f(ka,qI(n),r)},W_=function(e){return f(yA,V_,f(H_,K_,Y_(e)))},J_=ZT(33),Q_={$:"Hover"},X_=function(e){return f(yA,J_,f(H_,Q_,Y_(e)))},Z_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Kk,M([cN(4),uN,pN(n),f(aN,25,17),bA(t),bN(18),vN,Wk(a),W_(M([Wk(o)])),X_(M([Wk(i)]))]),fl(r))}),eL=r(function(e,t){return d(Z_,x(d(YR,1,0,0,1),d(YR,1,0,0,.8),d(YR,1,0,0,.6)),tN,e,t)}),tL=function(e){return $_(d(YR,0,0,.3,.6))(f(ON,M([kN(10),wN,eR,Wk(d(YR,0,0,0,.5)),cN(8),aR(20)]),f(xa,function(e){return f($N,M([wN,eR,bN(20),vN,bA(tN),t_]),M([e]))},e)))},rL=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+kA(t)}e.a;return"https://kovan.etherscan.io/tx/"+kA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+kA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+kA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+kA(t)}}),nL={$:"Bottom"},aL=XN(nL),iL=lA(RT.underline),oL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(fl(u$(oC(a))),f(eL,"Yes, I definitely want to open this trade.",l(w_,r,n,a)))}return L(fl("??"),f(O_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),U(I_(n),U(M([M([fl("You will deposit "),i,fl(" "+NR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([fl("This ususally requires two Metamask signatures. Your "+NR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Kk,M([aL,wN]),o)])),S_);case"ApproveNeedsSig":var u=e.a;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),tL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","ApproveMining",0)))]),tL(M([fl("Mining the initial approve transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,eo(u),s)}),fl("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),tL(M([fl("Waiting for user signature for the create call."),fl("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","CreateMining",0)))]),tL(M([fl("Mining the final create call..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,r,s)}),fl("You will be redirected when it's mined.")])))}}),uL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return qk;var r=t.a;return f(oL,r,e)},sL=function(e){return{$:"TradeAmountChanged",a:e}},cL=dT("id"),fL=R_(cL("inputError")),lL=l(Ok,109,127,138),dL=uR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),hL=function(e){return f(dR,f(ka,yT(zk(26)),e),dL)},pL=function(e){return f(VN,M([kN(4)]),M([hL(yr),f(Kk,M([bN(24),gR,bA(lL)]),fl(NR(e)))]))},gL=function(e){return{$:"HiddenLabel",a:e}},vL=gL,yL=dT("type"),mL=function(e){return L(e,!0)},bL=function(e){return{$:"MayStopPropagation",a:e}},CL=r(function(e,t){return f(lN,e,bL(t))}),EL=r(function(e,t){return l(La,Oh,t,e)}),SL=f(EL,M(["target","value"]),pu),TL=function(e){return f(CL,"input",f(Oi,mL,f(Oi,e,SL)))},wL=ZT(0),IL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),AL=function(e){var t=function(e){return 1-e}(f(Tc,1,f(ei,0,e)));return f(yA,wL,f(IL,"transparency-"+dw(t),t))},BL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),kL=f(Da,ST,A$("autocomplete")),NL=l(pA,136/255,138/255,133/255),RL=l(pA,186/255,189/255,182/255),$L=f(aN,12,12),_L=M([$L,cN(3),d$(RL),Wk(r_),p$(1),kN(3),ET(jk)]),LL=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},xL=function(e){return f(Ch,LL,e)?$$:lA("focusable")},PL=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},DL=ye,UL=r(function(e,t){return f(kn,e,DL(t))}),OL=UL("spellcheck"),ML=f(Da,ST,OL),FL=W,VL=ZT(47),KL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(FL(e))),o=(i-1)*t+f(xc,0,f(Bo,a,r))+f(xc,0,f(Bo,a,n));return f(yA,VL,l(jI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),HL=dT("value"),jL=f(Da,ST,HL),qL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(fw,"width",n)?L(r,n):L(f(ka,e,r),f(Gm,"width",n));case"Height":e.a;return f(fw,"height",n)?L(r,n):L(f(ka,e,r),f(Gm,"height",n));case"Describe":e.a;return f(fw,"described",n)?L(r,n):L(f(ka,e,r),f(Gm,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(fw,"align-x",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-x",n));case"AlignY":return f(fw,"align-y",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-y",n));default:return f(fw,"transform",n)?L(r,n):L(f(ka,e,r),f(Gm,"transform",n))}}),L(yr,sm),e).a},GL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,qL(e))}),zL=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}},YL=f(Da,Gi,ms),WL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([ST(TL(n.onChange))]),o=U(_L,t),u=f(GL,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(ml,PL,o),c=f(GL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(GL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(GL,o,function(e){return"Nearby"===e.$})),p=f(ml,f(Da,ns,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([jL(n.text),ST(yL(a)),ML(e.spellchecked),lA(RT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return $$;var r=t.a;return kL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(zL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(BL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(BL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(xc,5,c);return x("textarea",U(M([ML(e.spellchecked),lA(RT.inputMultiline),f(xc,$$,f(Bo,kL,e.autofill)),function(){if("Nothing"===u.$)return $$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return m$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?$$:s.a?d(KL,n.text,v,u,g):$$}()]),h),M([YL(RI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(fA,AT,Vk,f(ka,ET(jk),ay(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([m_(f(Kk,f(ka,$L,U(s,U(M([bA(NL),lA(RT.noTextSelection+" "+RT.passPointerEvents),d$(d(YR,0,0,0,0)),Wk(d(YR,0,0,0,0)),yT(jk),ET(jk),AL(""===n.text?1:0)]),r))),a))])}()]))),wT(M([d(fA,AT,TT(v),ay(M([M([xL(t),_$(n.label)]),y,i])),wT(m))])));return l(N$,f(ka,f(oN,iN,RT.cursorText),f(ka,L$(n.label)?$$:kN(5),f(ka,O$,u))),n.label,b)}),JL=WL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),QL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(JL,M([ET(jk),yT(zk(40)),p$(0)]),{label:vL(r),onChange:i,placeholder:n,text:a});return f(VN,U(M([kN(5)]),e),mE(M([f(Bo,Kk(M([k$])),o),si(s),f(Bo,Kk(M([PN])),u)])))}),XL={$:"Below"},ZL=function(e){return f(t$,XL,e)},ex=function(e){return f(j$,K$,H$(e))},tx=n(function(e,t,r){return p(QL,M([ET(zk(150)),gR,bN(24),ZL(f(P_,M([fL,ex(5)]),r))]),L(ci,si(f(Kk,M([pN(T_(d(Zd,"click","misclick","dai symbol in dai input",0)))]),pL(e)))),"dai input",ci,t,sL)}),rx=Kk(M([d$(IR),Z$({bottom:2,left:0,right:0,top:0})])),nx=r(function(e,t){return f(ON,M([kN(10)]),M([f(Kk,M([bN(17),vN]),fl(e)),t]))}),ax=r(function(e,t){return rx(f(nx,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(tx,e,t.inputs.daiAmount,t.errors.daiAmount)))}),ix=function(e){return f(xc,gS,Mg(e))},ox=function(e){var t=function(){var t=vd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+u$(f(Gl,r,100))+" "+NR(ix(e.wallet))+"."}return"There is a 1% fee."}();return f(VN,M([wN,f(aN,20,10),Wk(l(Ok,10,33,108)),cN(8),kN(5),pN(T_(d(Zd,"click","misclick","fee notify element",0)))]),M([f(Kk,M([bN(18),bA(l(Ok,0,226,255)),vN]),fl(t)),f(Kk,M([bN(17),bA(tN),gR]),fl("We only collect this fee when trades resolve successfully."))]))},ux=function(e){return{$:"FiatAmountChanged",a:e}},sx=function(e){return{$:"FiatTypeChanged",a:e}},cx=r(function(e,t){return l(SS,n(function(t,r,n){return f(e,t,r)?l(xl,t,r,n):n}),cp,t)}),fx=function(e){return f(cx,r(function(t,r){return f(Qg,e,t)}),HR)},lx=uR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),dx=function(e){return f(dR,M([yT(zk(26))]),f(xc,lx,f(Bo,fu,f(fp,e,HR))))},hx=function(e){return R_(f(CL,"click",Fi(L(e,!0))))},px=YL,gx=function(e){return{$:"AppendProperty",a:e}},vx=r(function(e,t){return gx(e+":"+t)}),yx=r(function(e,t){return f(vx,e,t.value)}),mx=yx("cursor"),bx={$:"Compatible"},Cx={cursor:bx,value:"default"},Ex=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Sx=function(e){return{$:"PseudoClassSelector",a:e}},Tx=function(e){return Ex(Sx(e))}("hover"),wx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),Ix=wx,Ax=Ix,Bx=Ax("span"),kx=r(function(e,t){return f(kn,et(e),rt(t))}),Nx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),Rx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),$x=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),_x=r(function(e,t){return t<>>32-e}),Lx=function(e){var t=e.hash?e.seed^f($x,461845907,f(_x,15,f($x,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f($x,2246822507,r^r>>>16),a=f($x,3266489909,n^n>>>13);return(a^a>>>16)>>>0},xx=r(function(e,t){return f($x,5,f(_x,13,e^f($x,461845907,f(_x,15,f($x,3432918353,t)))))+3864292196}),Px=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},HP=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+"]"}},jP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,HP,r)));case"UniversalSelectorSequence":var r=e.a;return Iu(r)?"*":f(Ri,"",f(xa,HP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,HP,r)))}},qP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([KP(t),jP(r)]))},GP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,jP(t),f(xa,qP,r)),i=f(Ri,"",M([f(xc,"",f(Bo,VP,n))]));return f(oc,f(Ri," ",f(ml,f(Da,ns,_d),a)),i)},zP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,GP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,FP(a),"\n",e,"}"]))}),YP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(zP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,xP,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,OP,zP(" ")),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"}},WP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(ml,f(Da,ns,_d),M([$P(t),f(Ri,"\n",f(xa,DP,r)),f(Ri,"\n",f(xa,UP,n)),f(Ri,"\n\n",f(xa,YP,a))])))},JP=function(e){return WP(RP(BP(e)))},QP=function(e){return f(Ri,"\n\n",f(xa,JP,e))},XP=function(e){return{$:"Snippet",a:e}},ZP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),eD=function(e){return{$:"StyleBlockDeclaration",a:e}},tD=r(function(e,t){var r=l(eP,t,yr,ci);return XP(M([eD(l(ZP,r,yr,e))]))}),rD=function(e){return Iu(e)?"unstyled":f(Is,P("_"),Ps(f(Dx,15739,QP(AS(Ux(AS(f(tD,e,dP(yr)))))))))},nD=function(e){var t=rD(e),r=f(kx,"className",hl(t));return l(Nx,r,e,t)},aD=a(function(e,t,r,n){return f(e,f(ka,nD(t),r),n)}),iD=function(e){return{$:"Unstyled",a:e}},oD=function(e){return iD(Tw(e))},uD=oD,sD=r(function(e,t){return f(Tn,e,Xe(t))}),cD=function(e){return En(Xe(e))},fD=r(function(e,t){var r=e.b,n=e.c;return Iu(r)?t:l(xl,n,r,t)}),lD=function(e){return e.a},dD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,fD,i,s),p=l(Ra,hD,L(yr,h),c),g=p.a,v=p.b,o=l(JT,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,fD,i,s),m=l(Ra,hD,L(yr,h),c),g=m.a,v=m.b,o=d(cD,y,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,fD,i,s),b=l(Ra,dD,L(yr,h),c),g=b.a,v=b.b,o=l(WT,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,fD,i,s),C=l(Ra,dD,L(yr,h),c),g=C.a,v=C.b,o=d(sD,y,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),hD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,fD,n,o),c=l(Ra,hD,L(yr,s),u),h=c.a,p=c.b,a=l(JT,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,fD,n,o),v=l(Ra,hD,L(yr,s),u),h=v.a,p=v.b,a=d(cD,g,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,fD,n,o),y=l(Ra,dD,L(yr,s),u),h=y.a,p=y.b,a=l(WT,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,fD,n,o),m=l(Ra,dD,L(yr,s),u),h=m.a,p=m.b,a=d(sD,g,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p)}}),pD=r(function(e,t){return h(Nl,kl,e,t,Rl,Rl)}),gD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(_d(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),vD=function(e){var t=f(gD,ci,e);if("Nothing"===t.$)return cp;var r=t.a,n=r.a,a=r.b;return f(pD,n,a)},yD=function(e){return{$:"ClassSelector",a:e}},mD=function(e){var t=e.a,r=e.b;return f(tD,r,dP(M([yD(t)])))},bD=function(e){return QP(AS(Ux(f(xa,mD,Ia(e)))))},CD=function(e){return l(JT,"style",yr,AS(Tw(bD(e))))},ED=n(function(e,t,r){var n=f(xa,lD,t),a=vD(t),i=l(Ra,hD,L(yr,a),r),o=i.a,u=i.b,s=CD(u);return l(JT,e,n,f(ka,s,$a(o)))}),SD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),TD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(SD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),wD=r(function(e,t){return L(f(TD,"_",t),CD(e))}),ID=n(function(e,t,r){var n=f(xa,lD,t),a=vD(t),i=l(Ra,dD,L(yr,a),r),o=i.a,u=i.b,s=f(wD,u,o);return l(WT,e,n,f(ka,s,$a(o)))}),AD=a(function(e,t,r,n){var a=f(xa,lD,r),i=vD(r),o=l(Ra,dD,L(yr,i),n),u=o.a,s=o.b,c=f(wD,s,u);return d(sD,e,t,a,f(ka,c,$a(u)))}),BD=a(function(e,t,r,n){var a=f(xa,lD,r),i=vD(r),o=l(Ra,hD,L(yr,i),n),u=o.a,s=o.b,c=CD(s);return d(cD,e,t,a,f(ka,c,$a(u)))}),kD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(ED,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(BD,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(ID,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(AD,a,t,r,n)}},ND=kD,RD=function(e){return px(ND(d(aD,Bx,M([Tx(M([mx(Cx)]))]),yr,M([uD(e)]))))},$D=J,_D=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),LD=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),xD=function(e){return l(La,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 si(h(_D,n,a,i,o,u))}return ci}(),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 si(l(LD,a,t,i))}return ci}())}),L(ci,ci),e)},PD=r(function(e,t){var r=xD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),e))),wT(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?si(m$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),U(e,M([h]))))),wT(t))}var p=-s/2,g=-u/2;return d(fA,AT,Vk,e,wT(M([d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ST(f(N_,"margin",mw(p)+"px "+mw(g)+"px")),f(ka,ST(f(N_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,ST(f(N_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(yA,IN,l(AN,o,u,s)),yr))))),wT(t))])))}),DD=i(function(e,t,r,n,a){var i=f(JL,M([ET(zk(80)),yT(zk(40)),bN(24),gR,d$(IR),hx(r)]),{label:vL("currency type"),onChange:f(zo,$D,n),placeholder:ci,text:t}),o=f(fp,t,HR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return qk;r.b;return f(PD,M([ET(zk(350)),d$(DR),p$(1),Wk(tN),aR(10),wN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(VN,M([ET(zk(80)),kN(9),f(aN,0,5),hx(n(t)),X_(M([Wk(l(pA,.8,.8,1))]))]),M([f(dR,M([yT(zk(26))]),a),f(Kk,M([bN(16),vN]),RD(t))]))},Ia(fx(t))))}return qk}();return f(VN,M([kN(4),ZL(u)]),M([f(Kk,M([pN(a)]),dx(t)),i]))}),UD=i(function(e,t,r,n,a){var i=T_(d(Zd,"click","misclick","currency flag",0)),o=f(Kk,M([pN(T_(d(Zd,"click","misclick","currency symbol",0)))]),fl(jR(e))),u=f(Kk,M([ZL(f(P_,M([fL,ex(5)]),a))]),h(DD,r,e,E_(!0),sx,i));return p(QL,M([ET(zk(250)),gR,bN(24),ZL(f(P_,M([fL,ex(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,ux)}),OD=function(e){return rx(f(nx,"For fiat",h(UD,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},MD=function(e){return{$:"ChangeRole",a:e}},FD=d(M_,1,31,52,.13),VD=r(function(e,t){var r=M([bN(24),gR,uN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([bA(FD)]))):L(U(r,M([bA(FD)])),r)}(),a=n.a,i=n.b;return f(VN,M([kN(20)]),M([f(Kk,U(M([pN(MD(lo))]),i),fl("Sell "+e)),f(Kk,U(M([pN(MD(fo))]),a),fl("Buy "+e))]))}),KD=r(function(e,t){return f(nx,"Trade Type",f(VD,NR(e),t.inputs.userRole))}),HD=Q$({blur:20,color:d(M_,0,0,0,.04),offset:L(0,3),size:0}),jD=f(oN,IN,RT.spaceEvenly),qD=function(e){var t=ix(e.wallet);return f(ON,M([ET(jk),kN(20),Wk(tN),cN(5),aR(20),HD]),M([f(VN,M([ET(jk),jD]),M([f(KD,t,e),f(ax,t,e),OD(e)])),ox(e)]))},GD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),zD={$:"Web3Connect"},YD=function(e){return f(Kk,M([wN]),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(eL,"Open Trade",f(GD,n,r))}t.b;return f(O_,"Unsupported Network",ci)}t.a;return f(eL,"Connect to Wallet",zD)}())},WD=function(e){return{$:"AutoabortIntervalChanged",a:e}},JD=function(e){return{$:"ChangePaymentMethodText",a:e}},QD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),XD=QD,ZD=function(e){return f(XD,M([bA(d(YR,0,0,0,.2))]),function(){return fl("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")}())},eU={$:"TextArea"},tU=r(function(e,t){return l(WL,{autofill:ci,spellchecked:t.spellcheck,type_:eU},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),rU=n(function(e,t,r){var n=f(Kk,M([bN(22),vN]),fl("Payment Method")),a=f(tU,M([ET(jk),yT(zk(150)),Wk(d(M_,155,203,255,.2)),p$(0)]),{label:vL("payment method"),onChange:JD,placeholder:""===r?si(ZD(t)):ci,spellcheck:!0,text:r});return f(ON,M([kN(20),m$({bottom:15,left:45,right:45,top:0}),ET(jk),U_(f(P_,M([fL,ex(30),aR(10),bN(20),ET(zk(400))]),e))]),M([n,a]))}),nU=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."},aU=a(function(e,t,r,n){var a=l(Rs,e,P("0"),Ni(n));return f(Kk,M([bN(22),bA(t)]),fl(U(a,r)))}),iU=function(e){return jd(e)<0?Vl(0):e},oU=n(function(e,t,n){var a=r(function(e,r){return f(ON,M([kN(4)]),M([f(Kk,M([aR(4),uN,pN(n(f(qb,t,e)))]),f(dR,M([yT(zk(10))]),hR)),r,f(Kk,M([aR(4),uN,pN(n(function(e){return jd(e)?e:Vl(3e5)}(iU(f(LR,t,e)))))]),f(dR,M([yT(zk(10))]),sR))]))}),i=XR(t);return f(VN,M([jD,kN(10)]),M([f(a,Vl(864e5),d(aU,3,e," days",i.days)),f(a,Vl(36e5),d(aU,2,e," hours",i.hours)),f(a,Vl(3e5),d(aU,2,e," min",i.min))]))}),uU=o(function(e,t,r,n,a,i){var o=f(Kk,M([Wk(d(M_,155,203,255,.2)),cN(5),aR(15),U_(f(P_,M([fL]),a))]),l(oU,DR,n,i)),u=f(VN,M([kN(30)]),M([f(dR,M([yT(zk(40)),pN(T_(d(Zd,"click","misclick","symbol for "+t,0)))]),e),f(Kk,M([bN(22),vN]),fl(t))])),s=f($N,M([bN(17),gR,bA(F_)]),M([fl(r)]));return f(ON,M([ET(jk),cN(10),Wk(l(Ok,237,237,237)),kN(2)]),f(xa,Kk(M([Wk(tN),f(aN,45,18),ET(jk)])),M([u,f(VN,M([ET(jk),kN(25),Wk(tN)]),M([o,s]))])))}),sU=uR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),cU=f(oN,tR,RT.clipX),fU=f(oN,tR,RT.clipY),lU=i(function(e,t,r,n,a){return f(ON,M([kN(15),cN(8),cU,fU,Wk(tN)]),M([p(uU,sU,"Payment Window",nU(a),r,n,WD),l(rU,t,a,e)]))}),dU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},hU=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."},pU=uR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),gU=n(function(e,t,r){return f(Kk,M([cN(8),cU,fU,Wk(tN)]),p(uU,pU,"Burn/Release Window",hU(r),e,t,dU))}),vU=function(e){return{$:"AutorecallIntervalChanged",a:e}},yU=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."},mU=uR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),bU=n(function(e,t,r){return f(Kk,M([cN(8),Wk(tN),cU,fU]),p(uU,mU,"Open Window",yU(r),e,t,vU))}),CU=function(e){return f(ON,M([ET(jk),kN(20)]),M([l(bU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(lU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(gU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},EU=function(e){return f(ON,M([ET(f(L_,1e3,jk)),wN,kN(20),m$({bottom:30,left:40,right:40,top:0}),pN(E_(!1)),m_(uL(e))]),M([qD(e),CU(e),YD(e.wallet)]))},SU=As(vb(8226)),TU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),wU=r(function(e,t){return l(Ra,ka,t,e)}),IU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(wU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),AU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(wU,f(lc,e%r,t),l(IU,yr,e/r|0,t))):f(lc,e,t)}),BU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(fw,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(Gm,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),kU=function(e){return d(BU,Ua,sm,e,yr)},NU=r(function(e,t){return f(Kk,M([ET(jk),m_(f(VN,M([kN(3),ET(nR(100)),ET(t),rR]),f(TU,f(Kk,M([bA(d(YR,0,0,0,.1)),bN(14)]),fl(SU)),f(xa,f(Da,Kk(M([bA(d(YR,0,0,0,.2))])),fl),f(AU,100,(e?$a:Ua)(kU(f(xa,f(zo,fu,Qa),Ia(HR)))))))))]),fl(" "))}),RU=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e))))),wT(M([n])))}),$U=function(){var e=f(Da,Kk(M([bA(l(pA,.8,.2,.2))])),fl),t=f(Da,Kk(M([_N])),fl);return f(ON,M([ET(jk),yT(jk),Wk(tN),cN(6),kN(50),Q$({blur:20,color:d(M_,0,0,0,.1),offset:L(0,3),size:0}),cN(10),aR(20)]),M([f(NU,!1,jk),f(ON,M([wN,ET(f(L_,700,jk)),kN(20)]),M([f($N,M([bN(70),_N,wN,t_]),M([fl("DAI"),e("Hard")])),f(VN,M([bN(30),vN,wN,t_,b$]),M([fl("The "),e("Global"),fl(", "),e("Unkillable"),fl(" Crypto Gateway")]))])),f(VN,M([Wk(CR),kN(2),wN,c_,ET(jk)]),M([f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([kN(60),PN]),M([f(Kk,M([bN(40),vN,wN]),fl("Want to learn more?")),f(ON,M([kN(15)]),M([f(RU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(A_),bA(tN),_N,bN(24),wN]),{label:f($N,M([t_]),M([fl("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"}),f(RU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(A_),bA(tN),_N,bN(24),wN]),{label:f($N,M([t_]),M([fl("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})]))]))),f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([k$,kN(60)]),M([f(Kk,M([bN(40),vN,wN]),fl("Ready to try it out?")),f(ON,M([kN(10),ET(zk(400)),wN]),M([f($N,M([bN(24),ET(jk)]),M([fl("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f($N,M([bN(24),ET(jk)]),M([fl("Then follow the links at the top of this page to browse "),t("Sell Offers"),fl(", browse "),t("Buy Offers"),fl(", or "),t("Create Your Own Offer"),fl(".")]))]))])))])),f(Kk,M([aL,ET(jk)]),f(NU,!0,jk))]))}(),_U=r(function(e,t){return f(Ay,f(zo,function(e){return e.type_},Ja(e)),t)}),LU=function(e){return{$:"ShowCurrencyDropdown",a:e}},xU=r(function(e,t){return ml(t(e))}),PU=i(function(e,t,r,n,a){var i=l(xU,e,a.filterFunc,ay(f(xa,GN,n)));return R(i,yr)?f(Kk,M([wN,bN(24),m$({bottom:0,left:0,right:0,top:30}),b$]),fl(r?"No trades found with those filters.":"Initializing Trade Cache...")):f(Yi,Rv,d(v$,e,a.tradeTable,M([t?Av:xo,JN,YN,WN,QN,zN]),i))}),DU=function(e){return{$:"FiltersMsg",a:e}},UU={$:"ApplyInputs"},OU=UL("disabled"),MU=function(e){return{$:"MayPreventDefault",a:e}},FU=r(function(e,t){return f(lN,e,MU(t))}),VU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):hu("Not the enter key")},n=f(du,r,f(Oh,"key",pu));return ST(f(FU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),KU=function(e){return f(VU,"Enter",e)},HU={$:"Button"},jU=r(function(e,t){var r=t.onPress,n=t.label;return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY+" "+RT.seButton+" "+RT.noTextSelection),f(ka,uN,f(ka,xL(e),f(ka,NN(HU),f(ka,ST(P$(0)),function(){if("Nothing"===r.$)return f(ka,ST(OU(!0)),e);var t=r.a;return f(ka,pN(t),f(ka,KU(t),e))}()))))))),wT(M([n])))}),qU=f(jU,M([Wk(A_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Apply")),onPress:si(UU)}),GU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(yA,sN,l(jI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},zU=function(e){return f(dN,"focus",Fi(e))},YU=f(Da,ST,zU),WU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([YU(e(!0)),hx(e(!0))])}();return f(VN,U(e,M([yT(zk(40)),Q$({blur:20,color:d(M_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Kk,M([Wk(IR),yT(zk(40)),GU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Kk,M([eR,f(aN,10,0)]),r)),f(JL,U(s,U(t,M([ET(zk(100)),yT(zk(40)),d$(IR),GU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),Z$({bottom:1,left:0,right:1,top:1})]))),{label:vL(n),onChange:u,placeholder:i,text:a})]))}),JU=function(e){return{$:"MaxDaiChanged",a:e}},QU=function(e){return{$:"MinDaiChanged",a:e}},XU=r(function(e,t){return f(ON,M([ET(jk),kN(8)]),M([f(Kk,M([bN(17),gR]),fl(e)),t]))}),ZU=ZT(25),eO=function(e){return{$:"MoveX",a:e}},tO=function(e){return f(j$,ZU,eO(-e))},rO={$:"OnLeft"},nO=function(e){return f(t$,rO,e)},aO=n(function(e,t,r){var n=hL(M([eR])),a=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("max"))])),i=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("min"))]));return f(XU,"Dai Range",f(ON,M([kN(5),ET(zk(200))]),M([v(WU,M([nO(f(P_,M([tO(5),ET(zk(200))]),r.minDai))]),M([YU(LU(!1))]),i,"min Dai",e,ci,ci,QU),v(WU,M([nO(f(P_,M([tO(5),ET(zk(200))]),r.maxDai))]),M([YU(LU(!1))]),a,"max Dai",t,ci,ci,JU)])))}),iO=function(e){var t=f(fp,e,HR);if("Nothing"===t.$)return fl("*");var r=t.a,n=r.b;return f(dR,M([yT(zk(26))]),n)},oO=function(e){return{$:"AppCmd",a:e}},uO=function(e){return{$:"FiatTypeInputChanged",a:e}},sO=n(function(e,t,r){var n=oO(d(Zd,"click","misclick","currency flag",0)),a=iO(t);f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("max"))])),f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("min"))]));return f(Kk,M([c_,ET(zk(120))]),f(XU,"Fiat Type",h(DD,e,t,LU(!0),uO,n)))}),cO={$:"AddSearchTerm"},fO=function(e){return{$:"PaymentMethodInputChanged",a:e}},lO=f(Oh,"keyCode",CE),dO=function(e){return f(dN,"keyup",f(du,function(t){return 13===t?Fi(e):hu(Ni(t))},lO))},hO=function(e){return f(XU,"Search Payment Methods",f(JL,M([c_,ET(zk(250)),yT(zk(40)),d$(IR),Q$({blur:20,color:d(M_,233,237,242,.05),offset:L(0,3),size:0}),R_(dO(cO))]),{label:vL("payment methods search"),onChange:fO,placeholder:ci,text:e}))},pO={$:"ResetSearch"},gO=f(jU,M([Wk(A_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Reset")),onPress:si(pO)}),vO=function(e){return{$:"RemoveTerm",a:e}},yO=function(e){return f(Kk,M([aR(3),c_,uN,pN(vO(e)),bN(10),bA(EN)]),fl("x"))},mO=function(e){if(e.b){var t=e;return f(VN,M([ET(jk),aR(10),kN(10)]),f(xa,function(e){return f(VN,M([Wk(d(M_,16,7,234,.2)),cN(5),aR(4),kN(3)]),M([fl(e),yO(e)]))},t))}return qk},bO=i(function(e,t,r,n,a){var i=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},o=f(Eh,Ja(d_),f(xa,v_,e))?M([i("No trades found.")]):f(xa,i,mE(f(xa,function(e){switch(v_(e).$){case"QueryingNumTrades":return si("Querying "+dB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+dB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),m_(f(ON,M([kN(5),k$]),o))]),f(VN,M([wN,kN(50)]),M([f(Yi,DU,l_(t)),f(VN,M([ET(bT),kN(10)]),M([f(Kk,M([ET(bT),c_]),l(aO,r.minDai,r.maxDai,n)),f(Kk,M([ET(bT),c_]),l(sO,a,r.fiatType,n)),f(ON,M([ET(bT),c_,kN(5)]),M([hO(r.paymentMethod),mO(r.paymentMethodTerms)])),f(XU," ",f(ON,M([kN(5),ET(bT)]),M([qU,gO])))]))])))}),CO=n(function(e,t,r){var n=f(Eh,f(zo,v_,Ja(h_)),t),a=function(){return!f(xc,0,f(Bo,function(e){return f(MS,function(e){return e.checked&&"Open"!==e.label},e.options)},f(_U,Eo,r.filters)))}();return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),pN(LU(!1)),aR(30)]),M([f(VN,M([ET(jk),kN(10)]),M([h(bO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),h(PU,e,a,n,t,r)]))}),EO=function(e){return{$:"MessageInputChanged",a:e}},SO={$:"MessageSubmit"},TO=function(e){return f(ON,M([ET(jk),kN(10)]),M([f(tU,M([ET(jk),yT(zk(100))]),{label:vL("messageInput"),onChange:EO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(jU,M([wN,bN(24)]),{label:fl("Submit"),onPress:si(SO)})]))},wO=f(oN,tR,RT.scrollbarsY),IO=r(function(e,t){return f(Kk,M([yT(jk),ET(jk)]),f(Kk,U(M([R_(f(N_,"position","absolute")),R_(f(N_,"top","0")),R_(f(N_,"right","0")),R_(f(N_,"bottom","0")),R_(f(N_,"left","0")),wO]),e),t))}),AO=l(Ok,200,205,210),BO=n(function(e,t,r){var n=M([PN,Wk(A_),bA(tN),GU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([k$,Wk(AO),bA(DR),GU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Kk,U(M([aR(7)]),u),f($N,yr,M([fl(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(pA,0,0,1),tN,"Initiator opened the trade"));case"Recalled":return si(x(l(pA,0,0,1),tN,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(ru,8,dl(t))+"..";return si(x(l(pA,1,0,1),tN,r+" committed to the trade"));case"Aborted":return si(x(l(pA,1,0,0),tN,"Buyer aborted the trade"));case"Claimed":return si(x(l(pA,0,1,0),tN,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(pA,0,0,1),tN,"Seller released the "+NR(e)+" and closed the contract"));default:return si(x(l(pA,0,0,1),tN,"Seller burned the "+NR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return qk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Kk,M([cN(3),p$(1),d$(l(pA,1,0,1)),wN,Wk(h)]),f($N,M([bA(p)]),M([fl(g)])))}),kO=n(function(e,t,r){if(r.b){var n=r;return f(IO,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),aR(10)]),f(ON,M([ET(jk),yT(jk),kN(10)]),f(xa,f(BO,e,t),n)))}return f(Kk,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),wN,bA(l(pA,.5,.5,.5)),b$]),fl("no messages found."))}),NO=Cr,RO=function(e){return f(ON,M([ET(jk),yT(jk),kN(10),p$(1),cN(5),aR(20)]),M([l(kO,e.trade.factory,e.userRole,f(NO,function(e){return e.blocknum},Sa(e.history))),TO(e)]))},$O=function(e){return f(Kk,M([Wk(tN),cN(8),HD,ET(jk),yT(jk)]),RO(e))},_O={$:"ToggleChat"},LO=function(e){if(e.showChatHistory){var t=f(xc,qk,f(Bo,$O,e.chatHistoryModel));return f(Kk,M([yT(jk),ET(zk(500)),aR(20),PN]),l(x_,M([yT(jk),ET(jk)]),f(Yi,jE,t),_O))}return qk},xO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},PO=function(e){return zR(e)+" "+e.fiatType},DO={$:"AbortAction"},UO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),OO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return qk}if("LoadedTrade"!==t.b.$)return qk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=PO(n.terms.price),u=u$(oC(i)),s=u$(n.parameters.tradeAmount)+" "+NR(n.factory),c=function(){return"Buyer"===xO(n.parameters).$?L(f(Kk,M([gR,bA(DR)]),fl("buyer")),M([fl("pay the seller "),f(Kk,M([bA(A_)]),fl(o)),fl(" in exchange for the "),f(Kk,M([bA(A_)]),fl(s)),fl(" held in this contract.")])):L(f(Kk,M([gR,bA(DR)]),fl("seller")),M([fl("accept "),f(Kk,M([bA(A_)]),fl(o)),fl(" from the buyer in exchange for the "),f(Kk,M([bA(A_)]),fl(s)),fl(" held in this contract.")]))}(),d=c.a,h=c.b;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),U(M([U(M([fl("You will deposit "),f(Kk,M([bA(A_)]),fl(u+" "+NR(n.factory))),fl(", thereby becoming the "),d,fl(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([fl("(This ususally requires two Metamask signatures. Your "+NR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Kk,M([aL,wN]),f(eL,"Yes, I definitely want to commit to this trade.",l(UO,n,a,i)))])),DO);case"ApproveNeedsSig":return tL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return tL(M([fl("Mining the initial approve transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,n.factory,p)}),fl("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return tL(M([fl("Waiting for user signature for the final commit call."),fl("(check Metamask!)"),fl("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return tL(M([fl("Mining the final commit transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction"),url:f(rL,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([fl('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 '+NR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([fl("Aborting will incur a small penalty on both parties, and refund the rest of the "+NR(n.factory)+".")])]);case"Release":return M([M([fl("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([fl("This will destroy the "+NR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Kk,M([aL,wN]),function(e){return f(eL,e,sS(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 "+NR(n.factory)+".";default:return"I understand. Burn the "+NR(n.factory)+"."}}()))])),DO);case"ActionNeedsSig":var g=r.a;return tL(M([fl("Waiting for user signature for the "+fS(g)+" call."),fl("(check Metamask!)")]));default:var g=r.a,p=r.b;return qk}},MO=VN(M([ET(jk),Wk(tN),cN(5),aR(20),jD,HD])),FO=function(e){return f(VN,M([kN(8)]),M([f(dR,yr,dL),f(Kk,M([bN(24),gR]),fl(u$(e)))]))},VO=r(function(e,t){var r=f(Io,Ao(e),f(Bo,function(e){return e.address},Gd(t)));return f(nx,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"}(),FO(e.parameters.tradeAmount))}),KO=function(e){return f(VN,M([kN(5)]),M([dx(e.fiatType),f(Kk,M([bN(24),gR]),fl(PO(e)))]))},HO=function(e){return f(nx,"For Fiat",KO(e.terms.price))},jO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},qO=l(Ok,250,165,22),GO=l(Ok,255,0,0),zO=l(Ok,0,255,0),YO=uR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),WO=uR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),JO=uR({description:"released",src:"/DAIHard/static/img/released.svg"}),QO={$:"ToggleStatsModal"},XO=function(e){return f(NO,Ua,e)},ZO=n(function(e,t,n){var a=ay(f(xa,function(e){return f(ml,function(e){return R(f(ko,e,n),si(t))},f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(fh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(fh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wl,amountReleased:Wl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,Vl,Ql(XO(f(US,function(e){return function(e){return e?si(e):ci}(jd(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}}),eM=r(function(e,t){return d(Z_,x(d(YR,0,0,1,1),d(YR,0,0,1,.8),d(YR,0,0,1,.6)),tN,e,t)}),tM=function(e){return{$:"ViewUserHistory",a:e}},rM=f(JB,0,yr),nM=f(oN,gN,RT.textNormalWeight),aM=r(function(e,t){return Za(e/t)}),iM=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}}),oM=r(function(e,t){var r=e.a,n=e.b;return l(iM,r,f(aM,jd(t),6e4),n)}),uM=r(function(e,t){return f(_s,24,f(aM,f(oM,e,t),60))}),sM=r(function(e,t){return f(_s,1e3,jd(t))}),cM=r(function(e,t){return f(_s,60,f(oM,e,t))}),fM={$:"Apr"},lM={$:"Aug"},dM={$:"Dec"},hM={$:"Feb"},pM={$:"Jan"},gM={$:"Jul"},vM={$:"Jun"},yM={$:"Mar"},mM={$:"May"},bM={$:"Nov"},CM={$:"Oct"},EM={$:"Sep"},SM=function(e){var t=f(aM,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)}},TM=r(function(e,t){switch(SM(f(oM,e,t)).month){case 1:return pM;case 2:return hM;case 3:return yM;case 4:return fM;case 5:return mM;case 6:return vM;case 7:return gM;case 8:return lM;case 9:return EM;case 10:return CM;case 11:return bM;default:return dM}}),wM=r(function(e,t){return f(_s,60,f(aM,jd(t),1e3))}),IM={$:"Fri"},AM={$:"Mon"},BM={$:"Sat"},kM={$:"Sun"},NM={$:"Thu"},RM={$:"Tue"},$M={$:"Wed"},_M=r(function(e,t){switch(f(_s,7,f(aM,f(oM,e,t),1440))){case 0:return NM;case 1:return IM;case 2:return BM;case 3:return kM;case 4:return AM;case 5:return RM;default:return $M}}),LM=n(function(e,t,r){return e.toAmPm(f(uM,t,r))}),xM=r(function(e,t){return SM(f(oM,e,t)).day}),PM=xM,DM=M([kM,AM,RM,$M,NM,IM,BM]),UM=r(function(e,t){return function(e){return e.a}(f(xc,L(0,kM),Ql(f(ml,function(r){return R(r.b,f(_M,e,t))},f(Bi,r(function(e,t){return L(e,t)}),DM)))))}),OM=function(e){return l(Ra,Na,0,e)},MM=r(function(e,t){return SM(f(oM,e,t)).year}),FM=function(e){return!f(_s,4,e)&&(!!f(_s,100,e)||!f(_s,400,e))},VM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return FM(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}}),KM=M([pM,hM,yM,fM,mM,vM,gM,lM,EM,CM,bM,dM]),HM=r(function(e,t){return f(xc,L(0,pM),Ql(f(ml,function(r){r.a;return R(r.b,f(TM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),KM))))}),jM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(HM,e,t))}),qM=r(function(e,t){var r=f(lc,f(jM,e,t)-1,KM);return OM(f(xa,VM(f(MM,e,t)),r))+f(PM,e,t)}),GM=r(function(e,t){return f(jM,e,t)/4|0}),zM=r(function(e,t){var r=Ni(t),n=e-Qo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),YM=function(e){return e?e<=12?e:e-12:12},WM=sv(315576e5),JM=r(function(e,t){return Vl(WM*f(MM,e,t))}),QM=r(function(e,t){var r=f(JM,e,t),n=f(UM,e,r);return 1+((f(qM,e,t)+n)/7|0)}),XM=r(function(e,t){return Ni(f(MM,e,t))}),ZM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(jM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(jM,t,r));case"MonthFixed":return f(zM,2,f(jM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(TM,t,r));case"MonthNameFull":return e.toMonthName(f(TM,t,r));case"QuarterNumber":return Ni(1+f(GM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(GM,t,r));case"DayOfMonthNumber":return Ni(f(PM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(PM,t,r));case"DayOfMonthFixed":return f(zM,2,f(PM,t,r));case"DayOfYearNumber":return Ni(f(qM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(qM,t,r));case"DayOfYearFixed":return f(zM,3,f(qM,t,r));case"DayOfWeekNumber":return Ni(f(UM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(UM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(_M,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(_M,t,r));case"WeekOfYearNumber":return Ni(f(QM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(QM,t,r));case"WeekOfYearFixed":return f(zM,2,f(QM,t,r));case"YearNumberLastTwo":return f(ou,2,f(XM,t,r));case"YearNumber":return f(XM,t,r);case"AmPmUppercase":return $D(l(LM,e,t,r));case"AmPmLowercase":return sd(l(LM,e,t,r));case"HourMilitaryNumber":return Ni(f(uM,t,r));case"HourMilitaryFixed":return f(zM,2,f(uM,t,r));case"HourNumber":return Ni(YM(f(uM,t,r)));case"HourFixed":return f(zM,2,YM(f(uM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(uM,t,r));case"HourMilitaryFromOneFixed":return f(zM,2,1+f(uM,t,r));case"MinuteNumber":return Ni(f(cM,t,r));case"MinuteFixed":return f(zM,2,f(cM,t,r));case"SecondNumber":return Ni(f(wM,t,r));case"SecondFixed":return f(zM,2,f(wM,t,r));case"MillisecondNumber":return Ni(f(sM,t,r));case"MillisecondFixed":return f(zM,3,f(sM,t,r));default:return n.a}}),eF=a(function(e,t,r,n){return f(Ri,"",f(xa,l(ZM,e,r,n),t))}),tF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),rF=function(e){return e>11?"pm":"am"},nF=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"}},aF=function(e){switch(f(_s,100,e)){case 11:case 12:case 13:return"th";default:switch(f(_s,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},iF=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"}},oF=p(tF,nF,f(zo,nF,ru(3)),iF,f(zo,iF,ru(3)),rF,aF),uF=eF(oF),sF={$:"MonthNameFull"},cF=sF,fF=function(e){return{$:"Text",a:e}},lF=fF,dF={$:"YearNumber"},hF=dF,pF=n(function(e,t,n){var a=r(function(e,t){return f(ON,M([bN(18),kN(6)]),M([f(Kk,M([_N]),fl(e)),f(Kk,M([nM]),fl(t))]))}),i=uF(M([cF,lF(", "),hF])),o=f(ON,M([kN(23),ET(jk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,rM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+u$(n.amountReleased)+" "+NR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+u$(n.amountBurned)+" "+NR(e)+" Burned")])),M([f(Kk,M([wN]),f(eM,"View User History",tM(n.asRole)))])));return f(ON,M([cN(8),cU,fU,Wk(IR),kN(1),Q$({blur:20,color:d(YR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Kk,M([ET(jk),Wk(tN),aR(17)]),f(E$,18,t)),f(Kk,M([ET(jk),Wk(tN),aR(17)]),o)]))}),gF=n(function(e,t,r){var n=l(ZO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=jO(e.parameters.initiatorRole)+" Stats";return f(Kk,r?M([ZL(f(Kk,M([ex(30),PN]),l(pF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(nx,a,f(VN,M([ET(jk),kN(20),uN,pN(QO)]),f(xa,VN(M([kN(5)])),M([M([f(dR,M([yT(zk(28))]),JO),f(Kk,M([bN(24),gR,bA(zO)]),fl(l(Rs,2,P("0"),Ni(n.numReleases))))]),M([f(dR,M([yT(zk(28))]),YO),f(Kk,M([bN(24),gR,bA(qO)]),fl(l(Rs,2,P("0"),Ni(n.numAborts))))]),M([f(dR,M([yT(zk(28))]),WO),f(Kk,M([bN(24),gR,bA(GO)]),fl(l(Rs,2,P("0"),Ni(n.numBurns))))])])))))}),vF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+dl(t)}e.a;return"https://kovan.etherscan.io/address/"+dl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+dl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+dl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+dl(t)}}),yF=n(function(e,t,r){return f(dA,e,{label:fl(dl(r)),url:f(vF,t,r)})}),mF=function(e){return f(nx,"Trade Status",f(ON,M([bN(24),gR,kN(8)]),M([fl(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(yF,M([bN(12),bA(A_),iL]),e.factory,e.creationInfo.address)])))},bF=i(function(e,t,r,n,a){return MO(M([mF(t),f(VO,t,r),HO(t),l(gF,t,n,a)]))}),CF=l(Ok,9,32,107),EF=uR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),SF=f(Kk,M([cN(4),uN,pN(_O),aR(5),Wk(l(Ok,22,0,255))]),f(dR,M([ET(zk(42))]),EF)),TF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},wF=function(e){return f(ON,M([cN(12),Wk(IR),aR(15),kN(15)]),M([f(Kk,M([bN(24),vN,b$]),fl("Fiat Payment Method")),f($N,M([bN(18),yT(bT),Wk(tN),Q$({blur:5,color:d(YR,0,0,0,.2),offset:L(-3,3),size:0}),cN(3),aR(5)]),M([f(xc,f(Kk,M([bA(FD),b$]),fl("No payment methods found.")),f(Bo,fl,f(Bo,function(e){return e.info},Ql(e))))]))]))},IF={$:"Active"},AF=function(e){return{$:"ExpandPhase",a:e}},BF=M([Wk(CF),bA(tN)]),kF=r(function(e,t){return{$:"Min",a:e,b:t}}),NF=r(function(e,t){return f(kF,e,t)}),RF=function(e){return M(e?[cN(12),c_,yT(f(NF,380,bT))]:[cN(12),wN])},$F=M([Wk(tN)]),_F=uR({description:"flame",src:"/DAIHard/static/img/flame.png"}),LF=r(function(e,t){return Hl(f(ds,jl(e),jl(t)))}),xF=r(function(e,t){return d(Z_,x(d(YR,1,.6,.2,1),d(YR,1,.6,.2,.8),d(YR,1,.6,.2,.6)),tN,e,t)}),PF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),DF=function(e){return{$:"ContractActionClicked",a:e}},UF={$:"Web3Connect"},OF=n(function(e,t,r){var n=Gd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(xR,e,t).$?qk:f(VN,M([kN(8)]),function(){var e=x(t.state.phase,f(Ao,t,a.address),f(ko,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,sS,f(eM,"Remove and Refund this Trade",oS))])}break e}var r=(e.a,e.b,jl(Fb(t.parameters)));return M([f(eL,"Deposit and Commit to Trade",l(PF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(xF,"Abort Trade",GE)),f(Yi,DF,f(eL,"Confirm Payment",ZE)),SF])}e.a,e.c.a;return M([SF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(eL,"Burn it All!",XE)),f(Yi,DF,f(eM,"Release Everything",uS)),SF])}e.a,e.c.a;return M([SF])}break e;default:break e}return yr}())}return f(eL,"Connect to Wallet",UF)}),MF={$:"Finished"},FF={$:"NotStarted"},VF=r(function(e,t){var r=L(ER(t),ER(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?FF:R(n,a)?IF:MF}),KF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),HF=r(function(e,t){return l(KF,yr,e,t)}),jF=a(function(e,t,r,n){var a=u$(f(fh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+NR(r.factory),i=u$(r.parameters.tradeAmount)+" "+NR(r.factory),o=f(VN,yr,f(HF,3,f(dR,M([yT(zk(18))]),_F))),u=f(Da,Kk(M([bA(l(pA,1,0,0))])),fl),s=R(e,r.state.phase),c=f(Io,ko(r),f(Bo,function(e){return e.address},Gd(n))),d=s?tN:DR,h=$N(M([bA(d),bN(18),vN])),p=PO(r.terms.price),g=s?l(Ok,0,226,255):l(Ok,16,7,234),v=f(Da,Kk(M([bA(g)])),fl),y=u$(r.parameters.buyerDeposit)+" "+NR(r.factory),m=r.parameters.abortPunishment,b=u$(m)+" "+NR(r.factory),C=u$(f(LF,r.parameters.buyerDeposit,m))+" "+NR(r.factory),E=u$(f(LF,r.parameters.tradeAmount,m))+" "+NR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([fl("Your "),u("burnable deposit"),fl(" of "),v(y),fl(" is now held in this contract, and your offer to buy "),v(i),fl(" for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Seller by depositing the full "),v(i),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),fl(" to you.")])])):f(xa,h,M([M([fl("Your offer to sell the "),v(i),fl(" held in this contract for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),fl(" of 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),fl(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([fl("You must now pay the Seller "),v(p),fl(" via the Fiat Payment Method, "),f(Kk,M([vN]),fl("and then click ")),u("Confirm Payment"),fl(" before the payment window runs out. Use the chat to coordinate.")]),M([fl("If you abort the trade, or do not confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to you).")]),M([fl("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),fl(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([fl("Work and communicate with the Buyer to receive "),v(p),fl(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to you, "),v(C),fl(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),fl(" will be released to you.")]),M([fl("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),fl(" In this case the "),v(a),fl(" will be lost to both parties.")]),M([fl("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([fl("So, have you recieved the "),v(p),fl("? If so, you can click "),v("Release Everything"),fl(".")]),M([fl("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),fl(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([fl("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([fl("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([fl("The Seller has deposited "),v(i),fl(" into this contract, and offers to sell it for "),v(p),fl(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("If the trade is successful, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),fl(" within the payment window.")])])):f(xa,h,M([M([fl("The Buyer is offering to buy "),v(i),fl(" for "),v(p),fl(", and has deposited "),v(y),fl(" into this contract as a "),u("burnable deposit"),fl(". To become the Seller, deposit "),v(i),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("When you receive the "),v(p),fl(" from the Buyer, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can receive "),v(p),fl(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([fl("During this phase, the Buyer is expected to transfer "),v(p),fl(" to the Seller, as described in Fiat Payment Method, "),f(Kk,M([vN]),fl("and ")),u("Confirm the Payment "),fl(" before the payment window runs out. This would move the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(" amount) will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([fl("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([fl("If the Seller can verify he has received the "),v(p),fl(", he will probably release the total balance of "),v(i),fl(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),fl(".")]),M([fl("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),fl(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(ON,M([ET(jk),yT(jk),aR(20),kN(30)]),M([f(VN,M([ET(jk)]),M([f(Kk,M([bN(24),vN,bA(g),k$]),fl(T))])),f(ON,M([ET(jk),eR,kN(13)]),w),f(Kk,M([PN]),function(){switch(f(VF,r,e).$){case"Active":return l(OF,t,r,n);case"NotStarted":return f(Kk,M([bN(20),vN,b$,bA(CR)]),fl("Phase not yet started."));default:return f(Kk,M([bN(20),vN,b$]),fl("Phase no longer active."))}}())]))}),qF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},GF=uR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),zF=uR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),YF={$:"None"},WF=YF,JF=uR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),QF=function(e){switch(e.$){case"Open":return JF;case"Committed":return GF;case"Judgment":return zF;default:return WF}},XF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),ZF=a(function(e,t,r,n){return d(XF,e,t,r,n)}),eV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},tV=function(e){return function(e){return d(ZF,e.red,e.green,e.blue,e.alpha)}(eV(e))},rV=function(e){return{$:"Circle",a:e}},nV=rV,aV=d(XF,0,0,0,1),iV={$:"Flat"},oV={$:"Sharp"},uV=function(e){return{$:"Uniform",a:e}},sV=uV,cV={cap:iV,dashPattern:yr,dashPhase:0,fill:sV(aV),join:oV,thickness:2},fV=n(function(e,t,r){return D(cV,{dashPattern:e,fill:r,thickness:t})}),lV=fV(yr),dV={$:"Transparent"},hV=dV,pV=f(lV,0,hV),gV=r(function(e,t){return{$:"Shape",a:e,b:t}}),vV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},yV=function(e){return f(Da,vV,gV(e))},mV=function(e){return yV(L(e,pV))},bV=function(e){return L(-e.a,-e.b)},CV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),EV=r(function(e,t){return f(CV,bV(e(t)),t)}),SV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},TV=r(function(e,t){return{$:"Path",a:e,b:t}}),wV=kr,IV=Nr,AV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=IV(n),i=wV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},BV=function(e){return xa(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)})},kV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(BV,e,M([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 M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},RV=function(e){var t=$V(e.basic),r=SV(f(xa,AV(e),t)),n=r.a,a=r.b;return{toBottom:-f(xc,0,gI(a)),toLeft:-f(xc,0,gI(n)),toRight:f(xc,0,pI(n)),toTop:f(xc,0,pI(a))}},$V=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(kV,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(kV,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(kV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(BV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(TV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(BV,R(C,iV)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(kV,0,E);case"Group":var S=e.a;return f(BV,0,ay(f(xa,f(zo,RV,NV),S)));default:var T=e.b;return f(BV,0,NV(RV(T)))}},_V=function(e){var t=RV(e);return t.toTop+t.toBottom},LV=function(e){var t=RV(e);return L(-t.toLeft,t.toTop)},xV=function(e){var t=RV(e);return t.toLeft+t.toRight},PV=En("http://www.w3.org/2000/svg"),DV=PV("svg"),UV=Nn("height"),OV=Nn("version"),MV=Nn("width"),FV=PV("circle"),VV=PV("ellipse"),KV=PV("foreignObject"),HV=PV("g"),jV=PV("image"),qV=PV("polygon"),GV=PV("polyline"),zV=PV("rect"),YV=Tw,WV=PV("text"),JV=Nn("id"),QV=Nn("points"),XV=Nn("r"),ZV=Nn("rx"),eK=Nn("ry"),tK=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},rK=function(e){return{$:"Group",a:e}},nK=Nn("dominant-baseline"),aK=Nn("fill"),iK=Nn("fill-opacity"),oK=Nn("font-family"),uK=Nn("font-size"),sK=Nn("font-style"),cK=Nn("font-variant"),fK=Nn("font-weight"),lK=Nn("opacity"),dK=Nn("stroke"),hK=Nn("stroke-dasharray"),pK=Nn("stroke-dashoffset"),gK=Nn("stroke-linecap"),vK=Nn("stroke-linejoin"),yK=Nn("stroke-opacity"),mK=Nn("stroke-width"),bK=Nn("text-anchor"),CK=Nn("text-decoration"),EK=Nn("transform"),SK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},TK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},wK=n(function(e,t,r){return d(XF,e,t,r,1)}),IK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return sv(1e4*e)/100};return Cd(M(["rgba(",mw(i(t)),"%,",mw(i(r)),"%,",mw(i(n)),"%,",mw(function(e){return sv(1e3*e)/1e3}(a)),")"]))},AK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},BK=function(e){var t=AK(e),r=t.red,n=t.green,a=t.blue;return IK(l(wK,r,n,a))},kK=function(e){if("Uniform"===e.$){var t=e.a;return BK(t)}return"none"},NK=function(e){var t=AK(e),r=t.alpha;return mw(r)},RK=function(e){if("Uniform"===e.$){var t=e.a;return NK(t)}return"0"},$K=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},_K=function(e){var t=mw(e.scale.b),r=mw(e.scale.a),n=mw(-e.rotation/2/F$*360),a=mw(-e.shift.b),i=mw(e.shift.a);return Cd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},LK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),aK("none"),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([aK(kK(a)),iK(RK(a)),dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([aK(kK(uV(o.color))),oK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),uK(Ni(o.size)),fK(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"}}()),sK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),cK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),CK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),bK("middle"),nK("middle"),EK(_K(e))]);default:return M([EK(_K(e))])}},xK=Nn("x"),PK=Nn("y"),DK=r(function(e,t){return M([MV(mw(e)),UV(mw(t)),xK(mw(-e/2)),PK(mw(-t/2))])}),UK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([mw(t),mw(-r)]))},e))},OK=dN,MK=r(function(e,t){return f(e,t.a,t.b)}),FK=function(e){return f(xa,MK(OK),e)},VK=function(e){e:for(;;){var t=f(xc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(GV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(qV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Circle":var c=s.a;return f(FV,U(M([JV(t),XV(mw(c))]),U(LK(e),FK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(VV,U(M([JV(t),ZV(mw(d)),eK(mw(h))]),U(LK(e),FK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(zV,U(M([JV(t),ZV(mw(c)),eK(mw(c))]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(TV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(WV,U(M([JV(t)]),U(LK(e),FK(e.handlers))),M([YV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(jV,U(M([JV(t),tK(C)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(KV,U(M([JV(t)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(HV,f(ka,JV(t),U(LK(e),FK(e.handlers))),l(Ra,r(function(e,t){return f(ka,VK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:rK(M([w,I]))});e=v;continue e}}},KK=r(function(e,t){var r=e.a,n=e.b,a=mw(r),i=mw(n);return f(jT,yr,M([f(DV,M([MV(a),UV(i),OV("1.1")]),M([VK(t)]))]))}),HK=function(e){return f(KK,L(xV(e),_V(e)),f(EV,LV,e))},jK=r(function(e,t){var r=QF(e),n=function(){switch(t.$){case"NotStarted":return l(Ok,10,33,108);case"Active":return l(Ok,0,100,170);default:return l(Ok,1,129,104)}}(),a=px(HK(f(mV,sV(tV(n)),nV(50))));return f(Kk,M([wN,m_(f(dR,M([wN,eR,yT(zk(60))]),r))]),a)}),qK=function(e){var t=M([b$,vN,bN(20)]);switch(e.$){case"Active":return f(Kk,U(t,M([bA(EN)])),fl("Active"));case"NotStarted":return f(Kk,U(t,M([bA(CR)])),fl("Not Started"));default:return f(Kk,t,fl("Finished"))}},GK=n(function(e,t,r){var n=f(VF,t,e),a=function(){return"Active"===n.$?l(Ok,0,226,255):DR}(),i=f(Kk,M([bA(a),bN(20),vN,wN]),fl(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 qk;switch(n.$){case"NotStarted":return d(ZR,M([wN]),M([bN(22),gR]),L(DR,IR),f(_R,e,t));case"Active":var a=f(xR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(o$,M([wN]),M([bN(22),gR]),L(tN,IR),i)}return f(ON,M([wN,kN(10)]),M([f(Kk,M([wN]),fl(qF(e))),f(eM,"Poke",sS(iS))]));default:return f(Kk,M([yT(zk(1))]),qk)}}();return f(ON,M([aR(20),kN(10),yT(jk)]),M([f(Kk,M([c_,wN]),i),f(Kk,M([yT(jk),wN]),f(Kk,M([eR]),f(jK,e,n))),f(ON,M([kN(10),aL,wN]),M([f(Kk,M([wN]),qK(n)),o]))]))}),zK=o(function(e,t,r,n,a,i){var o=f(VF,r,t),u=f(Kk,M([aR(10),ET(jk),yT(jk)]),d(jF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Vl(0)}}(),c=l(GK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(LR,f(qb,r.state.phaseStartTime,s),i);default:Vl(0)}}(),f(Kk,M([yT(jk),ET(zk(1)),Wk(function(){return"Active"===o.$?l(pA,0,0,1):IR}())]),qk)),p=a?f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([ET(jk)]))),M([c,h,u])):f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([uN,pN(AF(t))]))),M([c]));return!e&&R(o,IF)?f(ON,M([ET(jk),kN(20),m$({bottom:20,left:0,right:0,top:0})]),M([p,wF(r.terms.paymentMethods)])):p}),YK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(VN,M([wN,cN(12),aR(30),kN(10),Wk(CF),bN(24),vN,bA(tN)]),M([fl("Trade "+TF(t.state.closedReason)),SF])):e?f(ON,M([ET(jk),kN(10)]),M([f(VN,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)])),wF(t.terms.paymentMethods)])):f(ON,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)]))}),WK=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(ON,M([ET(jk),yT(jk),kN(40)]),M([h(bF,t,i,n.wallet,r,n.showStatsModal),f(Kk,M([ET(jk),f(aN,40,0),kN(40)]),h(YK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Kk,M([wN,eR,bN(30)]),fl("Loading trade info..."));default:return f(Kk,M([wN,eR,bN(30)]),fl("Invalid trade"))}}(),M([LO(n),OO(n)]))}),JK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),QK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L($U,yr);case"CreateModel":var n=r.a;return L(f(Yi,Uy,EU(n)),yr);case"TradeModel":var a=r.a;return l(JK,Yi(Fy),xa(Yi(Fy)),d(WK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,fT,l(CO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,oT,l(C_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Kk,M([ET(jk),yT(jk),cN(10)]),n),a)}),XK=function(e){return{$:"DismissNotice",a:e}},ZK=function(e){return f(j$,ZU,eO(e))},eH=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(pA,1,1,1):l(pA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Ok,100,200,255);case"Caution":return l(Ok,255,188,0);case"Error":return l(Ok,255,70,70);default:return l(Ok,200,200,200)}}(),o=f(Kk,M([PN,c_,q$(5),ZK(5)]),B_(XK(t)));return f(Kk,M([Wk(i),cN(10),aR(8),ET(jk),p$(1),d$(d(YR,0,0,0,.15)),HD]),f(ON,M([kN(4),ET(jk)]),f(Bi,r(function(e,t){return f($N,M([ET(jk),bA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},tH=function(e){return R(e,yr)?yr:M([f(ON,M([tO(20),q$(20),kN(10),PN,aL,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,ul)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(ON,M([ZK(20),ex(100),kN(10),k$,c_,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,CB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},rH=r(function(e,t){var r=f(QK,e,t),n=r.a,a=r.b;return L(f(ON,M([r$(Jk),m_(KN(t)),ET(jk),yT(jk),aR(30)]),M([f(Kk,M([yT(zk(50))]),qk),n])),U(a,tH(t.userNotices)))}),nH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),aH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),iH={$:"AllowHover"},oH={$:"Layout"},uH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(hA,155/255,203/255,1,1),offset:L(0,0),size:3})},sH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?uH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?iH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?oH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},cH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(AT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),AT);case"Text":var a=t.a;return $I(a);default:return $I("")}}),fH=n(function(e,t,r){var n=sH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?nH(n):aH(n)}();return f(cH,a,d(fA,AT,Vk,t,wT(M([r]))))}),lH=ZT(5),dH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),hH={$:"SansSerif"},pH=function(e){return{$:"Typeface",a:e}},gH=Y,vH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",gH(sd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",gH(sd(t)));default:var t=e.a.name;return f(Ri,"-",gH(sd(t)))}}())}),yH=function(){var e=M([pH("Open Sans"),pH("Helvetica"),pH("Verdana"),hH]);return M([f(yA,Yk,l(vA,"bg-color-"+mA(d(hA,1,1,1,0)),"background-color",d(hA,1,1,1,0))),f(yA,gA,l(vA,"font-color-"+mA(d(hA,0,0,0,1)),"color",d(hA,0,0,0,1))),f(yA,yN,mN(20)),f(yA,lH,f(dH,l(Ra,vH,"font-",e),e))])}(),mH=n(function(e,t,r){var n=e.options;return l(fH,n,f(ka,lA(f(Ri," ",M([RT.root,RT.any,RT.single]))),U(yH,t)),r)}),bH=mH({options:yr}),CH=function(e){return f(yA,lH,f(dH,l(Ra,vH,"ff-",e),e))},EH=hH,SH=pH,TH=function(e){return{body:M([function(){var t=f(rH,e.screenWidth,e),r=t.a,n=t.b,a=U(M([ET(jk),yT(jk),CH(M([SH("Soleil"),EH]))]),f(xa,m_,n));return f(bH,a,r)}()]),title:"DAIHard"}},wH=Ht,IH=wH({init:OB,onUrlChange:Uk,onUrlRequest:Dk,subscriptions:Pk,update:sB,view:TH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:IH(f(du,function(e){return f(du,function(t){return f(du,function(r){return Fi({height:r,networkId:t,width:e})},f(Oh,"height",CE))},f(Oh,"networkId",CE))},f(Oh,"width",CE)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file +var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(bp,o,function(e){return si(Cp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,kp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,Bp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=nv(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?qg(o):jg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return nv(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Gg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Yg,zg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(zo,xa(ac),f(zo,Ms,nc))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ph,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ph,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ap)}),i.addEventListener("timeout",function(){a(Np)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Cp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(wp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Yg,zg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Yg,zg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Yg,zg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{options:t,type_:e}}),po={$:"OfferType"},go=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),vo=r(function(e,t){return f(ho,po,M([l(go,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(go,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),yo={$:"Closed"},mo={$:"Committed"},bo={$:"Judgment"},Co={$:"Open"},Eo={$:"Phase"},So=a(function(e,t,r,n){return f(ho,Eo,M([l(go,"Open",e,function(e){return R(e.state.phase,Co)}),l(go,"Committed",t,function(e){return R(e.state.phase,mo)}),l(go,"Judgment",r,function(e){return R(e.state.phase,bo)}),l(go,"Closed",n,function(e){return R(e.state.phase,yo)})]))}),To={$:"Initiator"},wo={$:"Responder"},Io=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),Ao=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(To):f(Io,function(e){return R(t,e)?si(wo):ci},e.state.responder)}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),ko=r(function(e,t){return f(Bo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(Ao,e,t))}),No={$:"Role"},Ro=n(function(e,t,r){return f(ho,No,M([l(go,"Buyer",t,function(t){return R(f(ko,t,e),si(fo))}),l(go,"Seller",r,function(t){return R(f(ko,t,e),si(lo))})]))}),$o=function(e){return{orderBy:e}},_o=$o,Lo={$:"Ascending"},xo={$:"Phase"},Po=Oe,Do=Po(yr),Uo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(So,!0,!0,!0,!1),f(vo,!0,!0),l(Ro,t,!0,!0)])),tradeTable:_o(L(xo,Lo)),wallet:e},Do)}),Oo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Mo={$:"None"},Fo=Mo,Vo=function(e){return d(Oo,e,Do,Fo,yr)},Ko=function(e){return{$:"TradeTableMsg",a:e}},Ho=function(e){return d(Oo,e,Do,Fo,yr)},jo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),qo=r(function(e,t){return f(jo,e,t)}),Go=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),zo=n(function(e,t,r){return t(e(r))}),Yo=r(function(e,t){if("None"===t.$)return Mo;var r=t.a,n=t.b,a=l(Go,f(Bo,Da(e),r.onSign),f(Bo,Da(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return L(f(zo,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(zo,t.toMsg,e)}},n))},r.onMined));return f(jo,a,n)}),Wo=function(e){return{$:"AbiDecoder",a:e}},Jo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Qo=z,Xo=Fr,Zo=r(function(e,t){return e<1?t:l(Xo,e,Qo(t),t)}),eu=Zo(64),tu=n(function(e,t,r){return L(f(Jo,e,eu(t)),r)}),ru=r(function(e,t){return e<1?"":l(Xo,0,e,t)}),nu=ru(64),au=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),iu=function(e){return-e},ou=r(function(e,t){return e<1?"":l(Xo,-e,Qo(t),t)}),uu=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(ru,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(ou,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Wo(function(t){var r=t.a,n=t.b;return f(au,f(tu,r,n),e(nu(n)))})}(),su=Hr,cu=function(e){return f(su,"0x",e)||f(su,"0X",e)?f(Zo,2,e):e},fu=function(e){return e.b},lu=r(function(e,t){var r=e.a;return f(au,fu,r(function(e){return f(Jo,e,e)}(cu(t))))}),du=Xr,hu=ae,pu=Wr,gu=function(e){return f(du,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return hu(a)},pu)},vu=f(zo,lu,gu),yu=function(e){return{$:"Magnitude",a:e}},mu=function(e){return{$:"Pos",a:e}},bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Cu=function(e){return{$:"MagnitudeNotNormalised",a:e}},Eu=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 si(n)}return ci}},Su=function(e){var t=Eu(e);return"Nothing"!==t.$&&t.a<0},Tu=function(e){return{$:"Neg",a:e}},wu={$:"Zer"},Iu=function(e){return!e.b},Au=r(function(e,t){var r=t.a;if(Iu(r))return wu;switch(e.$){case"Zero":return wu;case"Positive":return mu(t);default:return Tu(t)}}),Bu=r(function(e,t){return f(bu,e,Cu(t))}),ku=function(e){return f(La,r(function(t,r){return e(t)&&Iu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Nu=Ir,Ru=-1+f(Nu,10,7),$u=Ru+1,_u=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Lu=function(e){return e<0?f(_u,Na(-1),Lu(e+$u)):L(e/$u|0,e%$u)},xu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Lu(r+e),i=a.a,o=a.b;return f(ka,o,f(xu,i,n))}{if(!(_(e,$u)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Pu=function(e){var t=e.a;return yu(ku(f(xu,0,t)))},Du=xa(iu),Uu={$:"Negative"},Ou={$:"Positive"},Mu={$:"Zero"},Fu=function(e){switch(e.$){case"Positive":return Uu;case"Negative":return Ou;default:return Mu}},Vu=function(e){for(;;){var t=e.a,r=e.b,n=Pu(r),a=n.a;if(!Su(a))return f(Au,t,yu(a));e=f(Bu,Fu(t),Du(a))}},Ku=pr,Hu=function(e){switch(f(Ku,e,0).$){case"LT":return Uu;case"GT":return Ou;default:return Mu}},ju=function(e){return e<0?-e:e},qu=function(e){return Vu(f(bu,Hu(e),Cu(M([ju(e)]))))},Gu=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(Nu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},zu=function(e){switch(e.$){case"Zer":return wu;case"Neg":var t=e.a;return mu(t);default:return e}},Yu=function(e){return{$:"MagnitudePair",a:e}},Wu=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(ka,L(a,u),f(Wu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Wu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Wu,yr,s))}return yr}),Ju=r(function(e,t){var r=e.a,n=t.a;return Yu(f(Wu,r,n))}),Qu=function(e){switch(e.$){case"Zer":return f(Bu,Mu,yr);case"Neg":var t=e.a.a;return f(Bu,Ou,Du(t));default:var t=e.a.a;return f(Bu,Ou,t)}},Xu=r(function(e,t){var r=Qu(t),n=r.b,a=Qu(e),i=a.b,o=f(Ju,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Vu(f(bu,Ou,Cu(s)))}),Zu=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(R(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 Ta}return a.b.b?ba:f(Ku,e,t)}}),es=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},ts=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(Zu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return es(d(Zu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),rs=r(function(e,t){return R(f(ts,e,t),Ta)}),ns=K,as=r(function(e,t){return!f(rs,e,t)}),is=function(e){switch(e.$){case"Zer":return yu(yr);case"Pos":default:var t=e.a;return t}},os=r(function(e,t){var r=e.a;return Pu(Cu(f(xa,ti(t),r)))}),us=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(os,yu(n),a),u=f(us,yu(i),yu(n)),s=u.a,c=f(Xu,f(Au,Ou,o),f(Au,Ou,yu(f(ka,0,s))));return is(c)}var a=r.a;return f(os,yu(n),a)}return yu(yr)}),ss=function(e){switch(e.$){case"Zer":return Mu;case"Pos":return Ou;default:return Uu}},cs=r(function(e,t){return R(e,Mu)||R(t,Mu)?Mu:R(e,t)?Ou:Uu}),fs=r(function(e,t){return f(Au,f(cs,ss(e),ss(t)),f(us,is(e),is(t)))}),ls=function(e){switch(e.$){case"Zer":return wu;case"Pos":var t=e.a;return Tu(t);default:var t=e.a;return mu(t)}},ds=r(function(e,t){return f(Xu,e,ls(t))}),hs=qu(0),ps=a(function(e,t,r,n){if(e){var a=qu(e),i=f(fs,f(fs,a,n),t),o=f(as,i,r)?L(f(fs,a,t),f(ds,r,i)):L(hs,r),u=o.a,s=o.b,c=d(ps,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Xu,u,l),h)}return L(hs,r)}),gs=Fa(f(Va,2,Ru)),vs=n(function(e,t,r){return d(ps,f(Nu,2,gs),e,t,r)}),ys=qu(1),ms=r(function(e,t){return e}),bs=n(function(e,t,r){return l(Ra,ms(e),t,f(Ai,1,r))}),Cs=function(e){return l(bs,fs(qu($u)),ys,e)},Es=n(function(e,t,r){if(e){var n=l(vs,Cs(e),t,r),a=n.a,i=n.b,o=l(Es,e-1,i,r),u=o.a,s=o.b;return L(f(Xu,a,u),s)}return l(vs,Cs(e),t,r)}),Ss=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Ts=r(function(e,t){if(R(t,hs))return ci;var r=Ti(Ss(e))-Ti(Ss(t))+1,n=l(Es,f(ei,0,r),zu(e),zu(t)),a=n.a,i=n.b;return si(L(f(Au,f(cs,ss(e),ss(t)),is(a)),f(Au,ss(e),is(i))))}),ws=f(fs,qu(2),qu(2147483648)),Is=xr,As=function(e){return f(Is,e,"")},Bs=Pn,ks=n(function(e,t,r){return e<=0?r:l(ks,e>>1,U(t,t),1&e?U(r,t):r)}),Ns=r(function(e,t){return l(ks,e,t,"")}),Rs=n(function(e,t,r){return U(f(Ns,e-Qo(r),As(t)),r)}),$s=te,_s=Ar,Ls=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},xs=r(function(e,t){for(;;){if(t<16)return f(ka,Ls(t),e);var r=f(ka,Ls(f(_s,16,t)),e),n=t/16|0;e=r,t=n}}),Ps=function(e){return $s(e<0?f(ka,P("-"),f(xs,yr,-e)):f(xs,yr,e))},Ds=function(e){var t=f(Ts,e,ws);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=Ps(Gu(a));return R(n,qu(0))?i:U(Ds(n),l(Rs,8,P("0"),i))},Us=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,yu(yr))?"0":Ds(mu(t));default:var t=e.a;return"-"+Us(f(fs,qu(-1),e))}},Os=function(e){return l(Rs,64,P("0"),e)},Ms=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(Ps(a)),c=function(e){return U(e,n)}(Os(Ps(u)));return x(a+32+(Qo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Fs=Dr,Vs=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))))}),Ks=n(function(e,t,n){return l(Fs,r(function(t,r){return l(Vs,e,yi(t),r)}),t,n)}),Hs=function(e){return $a(l(Ks,ka,yr,e))},js=function(e){return f(Ri,"",f(xa,f(zo,Ps,f(Rs,2,P("0"))),Hs(e)))},qs=function(e){return 64-f(_s,64,e)},Gs=function(e){return U(e,f(Ns,qs(Qo(e)),"0"))},zs=function(e){return L(si(Qo(e)/2|0),Gs(e))},Ys=function(e){return L(ci,Os(e))},Ws=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Js=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"}},Qs=Ur,Xs=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(Is,P("1"),r),!0);case"1":return L(f(Is,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Is,P("0"),r),!1);case"1":return L(f(Is,P("1"),r),!0);default:break e}return L(r,!0)});return l(Qs,t,L("",!1),e).a},Zs=function(e){return l(Qs,ka,yr,e)},ec=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Zo,e,t),i=f(ka,l(Xo,0,e,t),r);e=n,t=a,r=i}}),tc=r(function(e,t){return e&&""!==t?l(ec,e,t,yr):M([t])}),rc=function(e){var t=function(){var t=Zs(Us(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(zo,Xs,f(Rs,256,P("1"))))}var r=t;return L(r,f(Rs,256,P("0")))}(),r=t.a,n=t.b;return $s(f(xa,Ws,f(tc,4,n(f(Ri,"",f(xa,Js,r))))))},nc=function(e){return{$:"Hex",a:e}},ac=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Ys(t);case"UintE":var r=e.a;return Ys(Us(r));case"IntE":var n=e.a;return Ys(rc(n));case"BoolE":return Ys(e.a?"1":"0");case"DBytesE":var a=e.a.a;return zs(a);case"BytesE":var a=e.a.a;return Ys(cu(a));case"StringE":var i=e.a;return zs(js(i));case"ListE":var o=e.a;return function(e){var t=e.a;return zs(t)}(Xt()(o));default:var i=e.a;return Ys(cu(i))}};try{var ic=Xt();Xt=function(){return ic}}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 oc=Pr,uc=function(e){return 1===Qo(e)?f(oc,"0",e):e},sc=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(ka,n,r);e=i,t=o,r=u}}}),cc=r(function(e,t){return $a(l(sc,e,t,yr))}),fc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(cc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(fc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),lc=r(function(e,t){return l(fc,0,e,t)}),dc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),hc=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 Pt(e.a)}},pc={$:"LE"},gc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,pc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,pc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,pc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,pc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,pc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,pc));case"Seq":var i=e.b;return l(vc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),vc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(gc,n,t,r);e=i,t=o,r=u}}),yc=Dt,mc=r(function(e,t){return{$:"Seq",a:e,b:t}}),bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+hc(r),i=n;e=a,t=i}}),Cc=function(e){return f(mc,f(bc,0,e),e)},Ec=function(e){return{$:"U8",a:e}},Sc=Ec,Tc=r(function(e,t){return _(e,t)<0?e:t}),wc=hr,Ic=function(e){return{$:"Bytes",a:e}},Ac=Ic,Bc=function(e){return yc(Cc(f(xa,Ac,$a(e))))},kc=Pt,Nc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Rc=function(e){return{$:"Decoder",a:e}},$c=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}}),_c=r(function(e,t){return Rc(f($c,e,t))}),Lc=Rc(Yn),xc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Pc=function(e){return{$:"Done",a:e}},Dc=function(e){return{$:"Loop",a:e}},Uc=r(function(e,t){var n=t.a;return Rc(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 Rc(r(function(t,r){return L(r,e)}))},Mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Oc(Pc($a(n))):f(Uc,function(e){return Dc(L(r-1,f(ka,e,n)))},e)}),Fc=function(e){return f(xc,yr,f(Nc,f(_c,L(kc(e),yr),Mc(Lc)),e))},Vc=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))}),Kc=r(function(e,t){return l(Vc,Bs,e,t)}),Hc=f(Ai,0,4),jc=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}}),qc=xt,Gc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),zc=function(e){return f(Gc,f(zo,qc,Bs(4294967295)),e)},Yc=r(function(e,t){return 5*t+e}),Wc=4294967295>>>32-Ha,Jc=ar,Qc=n(function(e,t,r){for(;;){var n=Wc&t>>>e,a=f(Jc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Jc,Wc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Xc=function(e){return e>>>5<<5},Zc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Xc(r))>-1?f(Jc,Wc&e,i):l(Qc,n,e,a))}),ef=r(function(e,t){var r=f(Zc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),tf=n(function(e,t,r){var n=f(Yc,e,t);return f(ef,n,r)}),rf=ir,nf=a(function(e,t,r,n){var a=Wc&t>>>e,i=f(Jc,a,n);if("SubTree"===i.$){var o=i.a,u=d(nf,e-Ha,t,r,o);return l(rf,a,za(u),n)}var s=i.a,c=l(rf,Wc&t,r,s);return l(rf,a,Ga(c),n)}),af=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,Xc(n))>-1?d(Ma,n,a,i,l(rf,Wc&e,t,o)):d(Ma,n,a,d(nf,a,e,t,i),o)}),of=n(function(e,t,r){return l(af,e,t,r)}),uf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(of,a,r,n)}),sf=Dn,cf=r(function(e,t){return l(Vc,sf,e,t)}),ff=function(e){var t=l(La,r(function(t,n){var a={d0:l(tf,0,t,e.state),d1:l(tf,1,t,e.state),d2:l(tf,2,t,e.state),d3:l(tf,3,t,e.state),d4:l(tf,4,t,e.state)},i=r(function(e,r){return d(uf,e,t,f(cf,f(jc,e,a),f(Kc,zc(f(jc,f(_s,5,e+1),a)),f(jc,f(_s,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Hc);return D(e,{state:t})},lf=L(0,0),df=function(e){return{current:lf,lfsrstate:1,state:e,x:1,y:0}},hf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},pf=L(1,0),gf=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),vf=r(function(e,t){if(e){var n=f(gf,1,t);return l(Vc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),yf=r(function(e,t){var r=f(_s,32,e/32|0),n=f(gf,r,t),a=f(_s,32,e);return f(vf,a,n)}),mf=n(function(e,t,r){var n=f(Zc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(af,e,t(a),r)}),bf=n(function(e,t,r){return l(mf,e,cf(t),r)}),Cf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(bf,a,r,n)}),Ef=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Nf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Tc,n,r),i=f(xa,function(e){return f(kf,e,g)},f(Ai,0,a)),o=Bf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(lc,i.outputLen,l(v,g,yr,i.outputLen))},Lf=function(e){return{$:"KS",a:e}},xf=function(e){var t=e.a;return Lf({config:t,inputLength:0,partial:yr,state:f(ui,25,ms(lf))})},Pf=function(e){return Rc(Wn(e))},Df=yc(Cc(yr)),Uf=r(function(e,t){var n=t.a;return Rc(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(Uf,function(e){return Pf(t)},Pf(e))}),Mf=r(function(e,t){return f(xc,Df,f(Nc,f(Of,e,kc(t)-e),t))}),Ff=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=kc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+kc(e)}),0,i),a)>-1))return Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:i}));var o=Bc(i),u=f(xc,Df,f(Nc,Pf(a),o)),s=Fc(u),c=f($f,s,n.state),d=Bf(c),h=f(Mf,a,o),p=Df,g=Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Vf=r(function(e,t){return _f(f(Ff,yc(Cc(f(xa,Sc,t))),xf(e)))}),Kf=Vf(dc),Hf=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,4,Kf(f(xa,yi,Zs(e)))))))},jf=function(e){return f(su,"0x",e)||f(su,"0X",e)?e:"0x"+e},qf=function(e){var t=e.a;return jf(t)},Gf=r(function(e,t){var r=Ms(f(xa,ac,t)),n=function(e){return U(e,r)}(cu(qf(Hf(e))));return nc(n)}),zf=function(e){return{data:si(f(Gf,"poke()",yr)),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yf=r(function(e,t){return D(t,{checked:e})}),Wf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Jf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Wf,f(zo,function(e){return e.type_},Ja(r)),function(e){return D(e,{options:l(Wf,f(zo,function(e){return e.label},Ja(n)),Yf(a),e.options)})},t)}),Qf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Xf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zf={$:"Descending"},el=function(e){return"Ascending"===e.$?Zf:Lo},tl=function(e){return d(Xf,e,Do,Fo,yr)},rl=r(function(e,t){return L(t.a,e(t.b))}),nl=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Xf,t,Do,Fo,M([da(f(Qf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(rl,el,t.orderBy):L(a,Lo);return tl(D(t,{orderBy:i}));default:return tl(t)}}),al=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},il=yn,ol=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=al(zf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(qo,a,n);return d(Oo,t,Do,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Oo,t,Do,Fo,M([da(f(Qf,o,u))]));case"FiltersMsg":var s=e.a;return Ho(D(t,{filters:f(Jf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(nl,c,t.tradeTable);return d(Oo,D(t,{tradeTable:l.model}),f(il,Ko,l.cmd),f(Yo,Ko,l.chainCmd),f(xa,Ji(Ko),l.appCmds));default:return Vo(t)}}),ul={$:"BottomRight"},sl={$:"ShouldBeImpossible"},cl=lr,fl=function(e){return qi(e)},ll=r(function(e,t){f(cl,e,t);return{align:ul,label:"unexpectedError",mainParagraphs:M([M([fl(e)])]),noticeType:sl}}),dl=function(e){var t=e.a;return jf(t)},hl=ye,pl=f(zo,dl,hl),gl=f(zo,Us,f(zo,jf,hl)),vl=f(zo,qf,hl),yl=f(zo,Ps,f(zo,jf,hl)),ml=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),bl=un,Cl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},El=function(e){return Cl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(xc,bl,r))},f(ml,function(e){e.a;return!R(e.b,ci)},e)))},Sl=function(e){return El(M([L("to",f(Bo,pl,e.to)),L("from",f(Bo,pl,e.from)),L("gas",f(Bo,yl,e.gas)),L("gasPrice",f(Bo,gl,e.gasPrice)),L("value",f(Bo,gl,e.value)),L("data",f(Bo,vl,e.data)),L("nonce",f(Bo,yl,e.nonce))]))},Tl=function(e){return{$:"TxSentry",a:e}},wl=ye,Il=r(function(e,t){return Cl(M([L("ref",wl(e)),L("txParams",t)]))}),Al=function(e){return{$:"Signing",a:e}},Bl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Al(e)}}),kl={$:"Black"},Nl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Rl={$:"RBEmpty_elm_builtin"},$l={$:"Red"},_l=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(Nl,$l,t,r,h(Nl,kl,c,f,l,d),h(Nl,kl,i,o,u,s))}return h(Nl,e,i,o,h(Nl,$l,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(Nl,$l,c,f,h(Nl,kl,g,v,y,m),h(Nl,kl,t,r,d,a))}return h(Nl,e,t,r,n,a)}),Ll=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Nl,$l,e,t,Rl,Rl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ku,e,a).$){case"LT":return h(_l,n,a,i,l(Ll,e,t,o),u);case"EQ":return h(Nl,n,a,t,o,u);default:return h(_l,n,a,i,o,l(Ll,e,t,u))}}),xl=n(function(e,t,r){var n=l(Ll,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(Nl,kl,a,i,o,u)}return n}),Pl=n(function(e,t,r){var n=e.a,a=Sl(r),i=l(xl,n.ref,f(Bl,r,t),n.txs);return L(Tl(D(n,{ref:n.ref+1,txs:i})),f(il,n.tagger,n.outPort(f(Il,n.ref,a))))}),Dl=Pl,Ul=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Do,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Dl,n,i,o))}return x(ci,Do,M([f(ll,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ol=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Ml=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Fl=function(e){return{$:"Posix",a:e}},Vl=Fl,Kl={autoabortInterval:Vl(0),autorecallInterval:Vl(0),autoreleaseInterval:Vl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Hl=function(e){return{$:"TokenValue",a:e}},jl=function(e){return e.a},ql=r(function(e,t){return f(xc,hs,f(Bo,Qa,f(Ts,e,t)))}),Gl=r(function(e,t){return Hl(f(ql,jl(e),qu(t)))}),zl=function(e){return f(Gl,e,12)},Yl=function(e){return f(Gl,e,3)},Wl=Hl(qu(0)),Jl=r(function(e,t){var r=Wl;return{abortPunishment:zl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Ql=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Xl=qr,Zl=function(e){var t=Ql(f(Xl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Qo(e)-1-r;return L(U(f(ru,r,e),f(Zo,r+1,e)),n)},ed=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 yr}}),td=function(e){var t=e.a,r=f(ed,Ja(0),t);return yu(r.b?t:yr)},rd=Z,nd=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}}}),ad=n(function(e,t,r){var n=f(nd,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(lc,e,r),l(ad,e,t,n)):yr}),id=r(function(e,t){return l(ad,e,e,t)}),od=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Bo,ka(a),r)});return f(La,t,si(yr))}(Ua),ud=function(e){return f(Bo,f(Da,td,yu),od(f(xa,f(zo,$a,f(zo,$s,rd)),f(id,7,$a(e)))))},sd=Q,cd=function(e){var t=Zs(sd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,Au(Uu),ud(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Bo,Au(Ou),ud(r))}return ci;default:var r=t;return f(Bo,Au(Ou),ud(r))}},fd=function(e){var t=function(e){return!f(_s,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(xc,0,Ql(r)))}},ld=function(e){return f(fs,e,e)},dd=qu(2),hd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ys;case"Neg":return wu;default:if(R(r,ys))return f(fs,e,t);if(fd(r)){var n=e,a=ld(t),i=f(ql,r,dd);e=n,t=a,r=i;continue e}var n=f(fs,t,e),a=ld(t),i=f(ql,f(ds,r,ys),dd);e=n,t=a,r=i;continue e}}),pd=r(function(e,t){return l(hd,ys,e,t)}),gd=function(e){if(""===e)return ci;var t=Zl(e),r=t.a,n=t.b,a=cd(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(fs,o,f(pd,qu(10),qu(i)));return si(u)},vd=function(e){return f(Bo,Hl,gd(e))},yd=jr,md=function(e){for(;;){if(f(yd,".",e))return l(Xo,0,-1,e);{if(!f(yd,"0",e))return""===e?"0":e;e=l(Xo,0,-1,e)}}},bd=f(Da,f(Rs,7,P("0")),Ni),Cd=function(e){return f(Ri,"",e)},Ed=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Cd(f(ka,Ni(n),f(xa,bd,a)))}return"0"},Sd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Ed(t);default:var t=e.a;return"-"+Ed(t)}},Td=r(function(e,t){return e<1?t:l(Xo,0,-e,t)}),wd=function(e){var t=l(Rs,18,P("0"),Sd(e)),r=f(Td,18,t)+"."+f(ou,18,t);return function(e){return""===e?"0":e}(md(r))},Id=r(function(e,t){var r=wd(t),n=Ql(f(Xl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(ru,a+1+e,r):f(ru,a,r)}),Ad=r(function(e,t){if("Nothing"===e.$)return wd(jl(t));var r=e.a;return f(Id,r,jl(t))}),Bd=ee,kd=function(e){var t=Bd(f(Ad,ci,e));if("Just"===t.$){return t.a}f(cl,"Error converting tokenValue to float: string -> float failed",e);return 0},Nd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=vd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return kd(r)<1?fi("Trade amount can't be less than 1."):li(r)},Rd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=cd(e);if("Nothing"===t.$){var r=Bd(e);return fi("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 li(n)},$d=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),_d=function(e){return""===e},Ld=function(e){return _d(e)?ci:si(e)},xd=function(e){return f($d,"You must specify a fiat type.",Ld(e))},Pd=function(e){return""===e?fi("Must specify a payment method."):li(e)},Dd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ud=g(Dd,ci,ci,ci,ci,ci,ci,ci),Od=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Md=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Fd={$:"Custom"},Vd=r(function(e,t){return{info:t,type_:e}}),Kd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Hd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),jd=function(e){return e.a},qd=function(e){return p(Kd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Vd,Fd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Hd,function(e){return D(Ud,{daiAmount:si(e)})},Nd(e.daiAmount)),f(Hd,function(e){return D(Ud,{fiatAmount:si(e)})},Rd(e.fiatAmount)),f(Hd,function(e){return D(Ud,{fiatType:si(e)})},xd(e.fiatType)),f(Hd,function(e){return D(Ud,{paymentMethod:si(e)})},Pd(e.paymentMethod)),Od(d(Md,function(e){return jd(e)>0?li(e):fi(D(Ud,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Gd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},zd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Yd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Wd=function(e){var t=qd(e.inputs),r=function(){return R(e.errors,Ud)?Ud:"Ok"===t.$?Ud:t.a}();return D(e,{createParameters:l(zd,Jl,Gd(e.wallet),Yd(t)),errors:r})},Jd=r(function(e,t){return Wd(D(t,{inputs:e}))}),Qd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Xd=function(e){return d(Qd,f(Jd,Kl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:Ud,inputs:Kl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Do,Fo,yr)},Zd=a(function(e,t,r,n){return la(d(Ol,e,t,r,n))}),eh=function(e){return{$:"Address",a:e}},th=f(zo,cu,f(zo,sd,eh)),rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return th("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return th("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return th("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return th("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nh=function(e){return th("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ah=function(e){return{$:"AddressE",a:e}},ih=ah,oh=function(e){return{$:"UintE",a:e}},uh=oh,sh=n(function(e,t,r){return{data:si(f(Gf,"approve(address,uint256)",M([ih(t),uh(r)]))),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ch=function(e){return f(Gl,e,200)},fh=r(function(e,t){return Hl(f(Xu,jl(e),jl(t)))}),lh=function(e){var t=f(Gl,e.tradeAmount,200);return f(fh,e.pokeReward,f(fh,ch(e.tradeAmount),f(fh,t,function(){return"Buyer"===e.initiatorRole.$?Yl(e.tradeAmount):e.tradeAmount}())))},dh=Mi(ya),hh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ph=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gh=Xn,vh=Qn,yh=function(e){return f(vh,{caseInsensitive:!1,multiline:!1},e)},mh=Jn,bh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ch=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}}),Eh=r(function(e,t){return!f(Ch,f(Da,ns,e),t)}),Sh=Eh(Ua),Th=q,wh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ih=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Ah=f(La,Ih(ka),li(yr)),Bh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},kh=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Nu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Nu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Nu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Nu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Nu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Nu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Nu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Nu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Nu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Nu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Nu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Nu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Nu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Nu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Nu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(As(s)+" is not a valid hexadecimal character.")}}}),Nh=function(e){if(_d(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(su,"-",e)){var t=f(xc,yr,Bh(Zs(e)));return f(au,iu,l(kh,Ti(t)-1,t,0))}return l(kh,Qo(e)-1,Zs(e),0)}();return f(Hd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rh=function(e){var t=Zs(e);return function(e){return L(t,e)}(f(wh,yr,Ah(f(xa,Nh,f(_i,"",f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,20,Kf(f(xa,f(zo,Th,yi),t))))))))))},$h=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Rh(cu(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!bh(e)&&Sh(o)},_h=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-f]{40}$"))),Lh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-F]{40}$"))),xh=function(e){return'"'+e+'"'},Ph=function(e){var t=cu(e),r=f(ru,24,t),n=f(ou,40,e);return 64===Qo(t)&&f(ki,Ja(P("0")),r)?Lh(n)||_h(n)?li(eh(n)):$h(n)?li(eh(n)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):40!==Qo(t)?fi("Given address "+xh(e)+" is not the correct length."):bh(t)?Lh(t)||_h(t)?li(eh(t)):$h(t)?li(eh(t)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):fi("Given address "+xh(e)+" contains invalid hex characters.")},Dh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),Ph(nu(r)))}),Uh=r(function(e,t){var r=t.a;return Wo(function(t){var n=t.a,a=t.b;return r(f(Jo,n,f(Zo,64*e,a)))})}),Oh=Jr,Mh=r(function(e,t){return f(Oh,"data",vu(f(Uh,e,t)))}),Fh=Qr,Vh=r(function(e,t){return f(Oh,"topics",f(Fh,e,vu(t)))}),Kh=function(e){return f(Bo,f(zo,$a,f(Ra,r(function(e,t){return f(Xu,qu(e),f(fs,t,ws))}),hs)),od(f(xa,f(zo,$a,f(zo,$s,f(zo,Nh,Yd))),f(id,8,$a(e)))))},Hh=function(e){var t=Zs(sd(e));e:for(;;){if(!t.b)return ci;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(Bo,fs(qu(-1)),Kh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Bo,fs(qu(-1)),Kh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Kh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kh(a)}t.b;return ci}break e;default:break e}}var a=t;return Kh(a)},jh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f($d,"Error Decoding Uint into BigInt",Hh(jf(nu(r)))))}),qh=f(dh,f(Vh,1,Dh),f(dh,f(Mh,1,Dh),f(dh,f(Mh,0,jh),Fi(hh)))),Gh=nn,zh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Yh=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(Gh,e,Cl(M([L("data",hl(t.data)),L("topics",f(zh,vl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Wh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Jh=r(function(e,t){return f(au,function(e){return e.id},f(Wh,function(e){return f(Hd,Di,f(Yh,qh,e).returnData)},f($d,"No log found from that factoryAddress in that txReceipt",Ql(f(ml,function(t){return R(f(zo,dl,sd)(t.address),f(zo,dl,sd)(rh(e)))},t.logs)))))}),Qh=n(function(e,t,r){return{data:si(f(Gf,"allowance(address,address)",M([ih(t),ih(r)]))),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Zh=function(e){switch(e.$){case"BlockNum":var t=e.a;return hl(jf(Ps(t)));case"EarliestBlock":return hl("earliest");case"LatestBlock":return hl("latest");default:return hl("pending")}},ep=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return El(M([L("to",f(Bo,pl,t)),L("from",f(Bo,pl,r)),L("gas",f(Bo,yl,n)),L("gasPrice",f(Bo,gl,a)),L("value",f(Bo,gl,i)),L("data",f(Bo,vl,o))]))},tp=function(e){return{$:"BadBody",a:e}},rp=function(e){return{$:"BadStatus",a:e}},np=function(e){return{$:"BadUrl",a:e}},ap={$:"NetworkError"},ip={$:"Timeout"},op=rn,up=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(np(r));case"Timeout_":return fi(ip);case"NetworkError_":return fi(ap);case"BadStatus_":var n=t.a,a=t.b;return fi(rp(n.statusCode));default:var n=t.a,a=t.b,i=f(op,f(Oh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(tp(Di(u)))}}),sp=n(function(e,t,r){return Cl(M([L("id",wl(e)),L("jsonrpc",hl("2.0")),L("method",hl(t)),L("params",f(zh,Ua,r))]))}),cp=Rl,fp=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ku,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),lp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},dp=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(Nl,$l,p,g,h(Nl,kl,r,n,h(Nl,$l,i,o,u,s),v),h(Nl,kl,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(Nl,kl,r,n,h(Nl,$l,i,o,u,s),h(Nl,$l,f,l,d,m))}return e},hp=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(Nl,$l,i,o,h(Nl,kl,s,c,f,l),h(Nl,kl,r,n,d,h(Nl,$l,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Nl,kl,r,n,h(Nl,$l,i,o,C,d),h(Nl,$l,g,v,y,m))}return e},pp=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(Nl,r,u,s,c,h(Nl,$l,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 hp(t)}break e}o.a,o.d;return hp(t)}break e}return t}),gp=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(Nl,t,r,n,gp(a),u)}var s=dp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(_l,c,f,l,gp(d),p)}return Rl}return h(Nl,t,r,n,gp(a),u)}return Rl},vp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Rl;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(Nl,r,n,a,f(vp,e,i),o)}var s=dp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(_l,c,l,d,f(vp,e,p),v)}return Rl}return h(Nl,r,n,a,f(vp,e,i),o)}return f(yp,e,g(pp,e,t,r,n,a,i,o))}),yp=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(R(e,n)){var u=lp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(_l,r,s,c,i,gp(o))}return Rl}return h(_l,r,n,a,i,f(vp,e,o))}return Rl}),mp=r(function(e,t){var r=f(vp,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(Nl,kl,n,a,i,o)}return r}),bp=n(function(e,t,r){var n=t(f(fp,e,r));if("Just"===n.$){var a=n.a;return l(xl,e,a,r)}return f(mp,e,r)}),Cp=function(e){return"Just"===e.$},Ep=gn,Sp=vn,Tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),wp=function(e){return{$:"BadUrl_",a:e}},Ip=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ap={$:"NetworkError_"},Bp=function(e){return{$:"Receiving",a:e}},kp=function(e){return{$:"Sending",a:e}},Np={$:"Timeout_"},Rp=function(e){return f(ta,"application/json",f(xi,0,e))},$p=n(function(e,t,r){return Rp(l(sp,e,t,r))}),_p=f(ea,"",Ua),Lp=Te,xp=Se,Pp=function(e){if("Ok"===e.$){var t=e.a;return xp(t)}var r=e.a;return Lp(r)},Dp=function(e){return l(Zn,gr,Pp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},Up=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Dp({body:l($p,1,r,n),headers:yr,method:"POST",resolver:_p(up(a)),timeout:ci,url:t})},Op=n(function(e,t,r){return Up({decoder:t.decoder,method:"eth_call",params:M([ep(t),Zh(r)]),url:e})}),Mp={$:"LatestBlock"},Fp=r(function(e,t){return l(Op,e,t,Mp)}),Vp=function(e){return{$:"Perform",a:e}},Kp=sn,Hp=xp(gr),jp=r(function(e,t){return f(Kp,function(t){return xp(e(t))},t)}),qp=n(function(e,t,r){return f(Kp,function(t){return f(Kp,function(r){return xp(f(e,t,r))},r)},t)}),Gp=function(e){return l(La,qp(ka),xp(yr),e)},zp=r(function(e,t){var r=t.a;return Be(f(Kp,Ep(e),r))}),Yp=n(function(e,t,r){return f(jp,function(e){return gr},Gp(f(xa,zp(e),t)))}),Wp=n(function(e,t,r){return xp(gr)}),Jp=r(function(e,t){var r=t.a;return Vp(f(jp,e,r))});pn.Task=Pe(Hp,Yp,Wp,Jp);var Qp=Ue("Task"),Xp=cn,Zp=r(function(e,t){return Qp(Vp(f(Xp,f(Da,f(Da,xp,e),fi),f(Kp,f(Da,f(Da,xp,e),li),t))))}),eg=a(function(e,t,r,n){return f(Zp,n,f(Fp,Xh(eo(e)),l(Qh,nh(e),t,r)))}),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return th("0x092110996699c3E06e998d89F0f4586026e44F0F")}},rg=function(e){return{$:"BoolE",a:e}},ng=rg,ag=function(e){return{$:"StringE",a:e}},ig=ag,og=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ug=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},sg=r(function(e,t){return{paymentMethods:t,price:e}}),cg=function(e){return hl(Sd(e))},fg=function(e){return f(zh,Ua,M([hl(e.fiatType),cg(e.amount)]))},lg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},dg=function(e){return Cl(M([L("type",hl(lg(e.type_))),L("info",hl(e.info))]))},hg=function(e){var t=fg(e.price),r=f(zh,dg,e.paymentMethods);return f(xi,0,Cl(M([L("paymentmethods",r),L("price",t)])))},pg=r(function(e,t){return D(t,{value:si(e)})}),gg=function(e){return qu(jd(e))},vg=function(e){return f(ql,gg(e),qu(1e3))},yg=r(function(e,t){var r=function(){return"Token"===e.$?og:ug}();return function(){return"Native"===e.$?pg(jl(lh(t))):Ua}()(r(rh(e))(t.initiatorAddress)(tg(e))(R(t.initiatorRole,lo))(jl(t.tradeAmount))(jl(Yl(t.tradeAmount)))(jl(zl(t.tradeAmount)))(jl(t.pokeReward))(vg(t.autorecallInterval))(vg(t.autoabortInterval))(vg(t.autoreleaseInterval))(jl(ch(t.tradeAmount)))(hg(f(sg,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),mg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),bg=function(e){return{$:"CreateNeedsSig",a:e}},Cg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Eg=r(function(e,t){var r=al(f(yg,e,t)),n={onBroadcast:ci,onMined:si(L(mg(e),ci)),onSign:si(Cg(e))};return L(si(bg(e)),f(qo,n,r))}),Sg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wg=function(e){return{$:"ApproveNeedsSig",a:e}},Ig=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Bg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),kg={$:"NoOp"},Ng=function(e){return{appCmds:yr,chainCmd:Fo,cmd:Do,model:e}},Rg=function(e){return rd(Sd(e))},$g={$:"Error"},_g=r(function(e,t){f(cl,e+" fetch error",t);return{align:ul,label:"web3FetchError",mainParagraphs:M([M([fl('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:$g}}),Lg=r(function(e,t){return{align:ul,label:"web3MiningError",mainParagraphs:M([M([fl('Error mining "'+e+'" transaction: '+t)])]),noticeType:$g}}),xg={$:"Caution"},Pg=r(function(e,t){return{align:ul,label:"web3SigError",mainParagraphs:M([M([fl('Error signing "'+e+'" transaction: '+t)])]),noticeType:xg}}),Dg={$:"KovanDai"},Ug=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Dg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Og=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Mg=function(e){return f(Io,Ug,Og(e))},Fg=r(function(e,t){return 1-e(1-t)}),Vg=function(e){return f(Nu,e,5)},Kg=Fg(Vg),Hg={easing:Kg,offset:12,speed:200},jg=function(e){return{$:"External",a:e}},qg=function(e){return{$:"Internal",a:e}},Gg=function(e){return{$:"NotFound",a:e}},zg=function(e){for(;;){e=e.a}},Yg=r(function(e,t){return Qp(Vp(f(jp,e,t)))}),Wg={$:"Http"},Jg={$:"Https"},Qg=Kr,Xg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Zg=i(function(e,t,r,n,a){if(_d(a)||f(Qg,"@",a))return ci;var i=f(Xl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=rd(f(Zo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Xg,e,f(ru,o,a),s,t,r,n))}return si(p(Xg,e,a,ci,t,r,n))}),ev=a(function(e,t,r,n){if(_d(n))return ci;var a=f(Xl,"/",n);if(a.b){var i=a.a;return h(Zg,e,f(Zo,i,n),t,r,f(ru,i,n))}return h(Zg,e,"/",t,r,n)}),tv=n(function(e,t,r){if(_d(r))return ci;var n=f(Xl,"?",r);if(n.b){var a=n.a;return d(ev,e,si(f(Zo,a+1,r)),t,f(ru,a,r))}return d(ev,e,ci,t,r)}),rv=r(function(e,t){if(_d(t))return ci;var r=f(Xl,"#",t);if(r.b){var n=r.a;return l(tv,e,si(f(Zo,n+1,t)),f(ru,n,t))}return l(tv,e,ci,t)}),nv=function(e){return f(su,"http://",e)?f(rv,Wg,f(Zo,7,e)):f(su,"https://",e)?f(rv,Jg,f(Zo,8,e)):ci},av=Wt,iv=Gt(zt),ov=sa,uv=r(function(e,t){return L(e,t)}),sv=_r,cv=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=ju(r-n),o=f(ei,1,sv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),fv=r(function(e,t){var n=r(function(t,r){return Gp(f(xa,ov(0),d(cv,e.speed,e.easing,t,r-e.offset)))});return f(Kp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(qp,uv,iv,av(t)))}),lv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Gd(t.wallet),Mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(eg,a,n.address,rh(eo(a)),Sg(a));return d(Qd,t,i,Fo,yr)}return Ng(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Qd,D(t,{inputs:D(u,{userRole:o})}),Do,Fo,M([function(){return"Buyer"===o.$?d(Zd,"create offer type changed","input","sell dai",0):d(Zd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ng(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ng(f(Jd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Qd,(g?Jd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Do,Fo,g?M([d(Zd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=qd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jl,n,m);return Ng(D(t,{depositAmount:si(jl(lh(b))),txChainStatus:si(f(Ag,v,b))}))}var C=y.a;return d(Qd,D(t,{errors:C}),f(Zp,ms(kg),function(){return f(fv,D(Hg,{offset:60}),"inputError")}()),Fo,yr);case"AbortCreate":return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([d(Zd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Eg,v,b);var e=v.a,r=function(){var t=al(l(sh,nh(e),rh(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Ig,e,b))};return f(qo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(ts,a,E),ba)?L(si(wg(e)),r):f(Eg,v,b)}return L(si(wg(e)),r)}(),T=S.a,w=S.b;return d(Qd,D(t,{txChainStatus:T}),Do,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(l(Tg,a,b,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(ts,N,P),ba))return Ng($);var U=f(Eg,eo(a),b),T=U.a,w=U.b;return d(Qd,D($,{txChainStatus:T}),Do,w,yr)}return Ng($)}var O=k.a;return d(Qd,t,Do,Fo,M([pa(f(_g,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(f(Bg,v,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Qd,t,Do,Fo,M([pa(f(Lg,"create",B))]))}var F=e.a,V=e.b.a,K=f(Io,Rg,Yd(f(Jh,F,V)));if("Just"===K.$){var H=K.a;return d(Qd,t,Do,Fo,M([da(f(Qf,F,H))]))}return d(Qd,t,Do,Fo,M([pa(f(ll,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Qd,t,Do,Fo,M([ga]));case"NoOp":return Ng(t);default:var j=e.a;return d(Qd,t,Do,Fo,M([j]))}}),dv=r(function(e,t){return f(Eh,function(e){return f(Ch,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),hv=r(function(e,t){return f(Ku,jd(e),jd(t))}),pv=r(function(e,t){return R(f(hv,t.derived.phaseEndTime,e),Ta)}),gv=function(e){if(""===e)return li(ci);var t=vd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},vv=r(function(e,t){return{maxDai:t,minDai:e}}),yv=f(vv,ci,ci),mv=function(e){return l(Ih,r(function(t,r){return{dai:{max:r,min:t},fiatType:Ld(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Hd,function(e){return D(yv,{minDai:si(e)})},gv(e.minDai)),f(Hd,function(e){return D(yv,{maxDai:si(e)})},gv(e.maxDai)))},bv=r(function(e,t){var r=function(t){return f(Eh,function(e){return f(Qg,sd(e),sd(t))},e)};return f(Ch,function(e){return r(e.info)},t)}),Cv=r(function(e,t){return D(t,{paymentMethod:e})}),Ev=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Sv=r(function(e,t){return f(ts,jl(e),jl(t))}),Tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return wv(D(e,{inputs:f(Ev,r,f(Cv,"",e.inputs))}))},wv=function(e){var t=Tv(e),n=mv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(bv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(pv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(dv,t.filters,r)});return D(t,{filterFunc:s})},Iv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Av={$:"Expires"},Bv=function(e){return L(wv({errors:yv,filterFunc:pv,filters:co(M([f(vo,!0,!0),d(So,!0,!1,!1,!1)])),inputs:Iv,showCurrencyDropdown:!1,tradeTable:_o(L(Av,Lo)),wallet:e}),Do)},kv=r(function(e,t){var r=f(ml,wc(e),t.inputs.paymentMethodTerms);return wv(D(t,{inputs:f(Ev,r,t.inputs)}))}),Nv=function(e){return wv(D(e,{filterFunc:pv,inputs:Iv}))},Rv=function(e){return{$:"TradeTableMsg",a:e}},$v=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),_v=function(e){return d($v,e,Do,Fo,yr)},Lv=r(function(e,t){return D(t,{fiatType:e})}),xv=r(function(e,t){return D(t,{maxDai:e})}),Pv=r(function(e,t){return D(t,{minDai:e})}),Dv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return _v(D(t,{inputs:f(Pv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return _v(D(t,{inputs:f(xv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return _v(D(t,{inputs:f(Lv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return _v(D(t,{inputs:(n?Lv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return _v(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return _v(D(t,{inputs:f(Cv,r,t.inputs)}));case"AddSearchTerm":return _v(Tv(t));case"RemoveTerm":var a=e.a;return _v(f(kv,a,t));case"ApplyInputs":return d($v,wv(t),Do,Fo,yr);case"ResetSearch":return _v(Nv(t));case"FiltersMsg":var i=e.a;return _v(wv(D(t,{filters:f(Jf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(nl,o,t.tradeTable);return d($v,D(t,{tradeTable:u.model}),f(il,Rv,u.cmd),f(Yo,Rv,u.chainCmd),f(xa,Ji(Rv),u.appCmds));case"NoOp":return _v(t);default:var s=e.a;return d($v,t,Do,Fo,M([s]))}}),Uv=a(function(e,t,r,n){return e(Cl(M([L("title",hl(t)),L("body",function(){if("Nothing"===r.$)return bl;var e=r.a;return hl(e)}()),L("image",function(){if("Nothing"===n.$)return bl;var e=n.a;return hl(e)}())])))}),Ov=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Mv=function(e){return e.a+"="+e.b},Fv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Mv,e)):""},Vv=r(function(e,t){return"/"+(f(Ri,"/",e)+Fv(t))}),Kv=function(e){switch(e.$){case"Home":return f(Vv,M(["DAIHard"]),yr);case"Create":return f(Vv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Vv,M(["DAIHard","trade",Ov(t),Ni(r)]),yr);case"Marketplace":return f(Vv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Vv,M(["DAIHard","history",dl(n)]),yr);default:return f(Vv,yr,yr)}},Hv={$:"NotFound"},jv=function(e){return{$:"AgentHistory",a:e}},qv={$:"Create"},Gv={$:"Home"},zv={$:"Marketplace"},Yv=function(e){return{$:"Parser",a:e}},Wv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Jv=r(function(e,t){return Yv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Wv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Qv=f(Jv,"ADDRESS",f(zo,Ph,Yd)),Xv={$:"Eth"},Zv={$:"Kovan"},ey=f(Jv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Xv));case"keth":return si(Zi(Zv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Dg));case"xdai":return si(Zi(to));default:return ci}}),ty=f(Jv,"NUMBER",rd),ry=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Wv,r,n,a,i,e(o))}),ny=r(function(e,t){var r=t.a;return Yv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,ry(u),r(h(Wv,n,a,i,o,e)))})}),ay=function(e){return l(La,oo,yr,e)},iy=r(function(e,t){return ay(f(xa,e,t))}),oy=function(e){return Yv(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 R(u,e)?M([h(Wv,f(ka,u,r),s,a,i,o)]):yr}return yr})},uy=r(function(e,t){var r=e.a,n=t.a;return Yv(function(e){return f(iy,n,r(e))})}),sy=Yv(function(e){return M([e])}),cy=f(uy,oy("DAIHard"),function(e){return Yv(function(t){return f(iy,function(e){return(0,e.a)(t)},e)})}(M([f(ny,Gv,sy),f(ny,qv,oy("create")),f(ny,Qf,f(uy,oy("trade"),f(uy,ey,ty))),f(ny,zv,oy("marketplace")),f(ny,jv,f(uy,oy("history"),Qv)),f(ny,function(e){return jv(e)},f(uy,oy("history"),Qv))]))),fy=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 si(t.value)}return si(t.value)}return ci}},ly=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ly(r))}return yr}return yr},dy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ly(r)}var r=t;return ly(r)},hy=Qt,py=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),gy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=hy(n);if("Nothing"===o.$)return t;var u=o.a,s=hy(i);if("Nothing"===s.$)return t;var c=s.a;return l(bp,u,py(c),t)}return t}),vy=function(e){if("Nothing"===e.$)return cp;var t=e.a;return l(La,gy,cp,f(_i,"&",t))},yy=r(function(e,t){var r=e.a;return fy(r(h(Wv,yr,dy(t.path),vy(t.query),t.fragment,Ua)))}),my=function(e){return f(xc,Hv,f(yy,cy,e))},by=aa,Cy=r(function(e,t){return f(by,e,Kv(t))}),Ey=je("connectToWeb3",function(e){return bl}),Sy=function(e){return Cl(M([L("event",hl(e.event)),L("category",hl(e.category)),L("label",hl(e.label)),L("value",wl(e.value))]))},Ty=r(function(e,t){return Cl(M([L("address",hl(dl(e))),L("signSeedMsg",hl(t))]))}),wy=je("gTagOut",Ua),Iy=je("genPrivkey",Ua),Ay=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),By=n(function(e,t,r){return f(Io,Zc(t),f(Bo,function(e){return e.trades},f(Ay,function(t){return R(t.factory,e)},r)))}),ky=je("notifyPort",Ua),Ny=je("requestNotifyPermissionPort",function(e){return bl}),Ry=r(function(e,t){return D(t,{wallet:e})}),$y=r(function(e,t){return L(f(Jd,t.inputs,D(t,{wallet:e})),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(eg,n,r.address,rh(eo(n)),Sg(n))}return Do}())}),_y=r(function(e,t){return D(t,{wallet:e})}),Ly=function(e){return{$:"AllowanceFetched",a:e}},xy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Gd(e),Mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Mg(e),si(i.factory))?d(eg,a,n.address,i.creationInfo.address,Ly):Do}return Do}())}),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{$:"TradeModel",a:e}},Fy=function(e){return{$:"TradeMsg",a:e}},Vy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Do);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Dy(a),f(il,Uy,i));case"TradeModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(il,Fy,c));case"MarketplaceModel":var l=t.a;return L(Oy(f(_y,e,l)),Do);default:var d=t.a;return L(Py(f(Ry,e,d)),Do)}}),Ky=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Hy=function(e){return{$:"PartiallyLoadedTrade",a:e}},jy=r(function(e,t){return Hy(g(Ky,e,t,ci,ci,ci,ci,ci))}),qy=function(e){return{$:"CurrentBlockFetched",a:e}},Gy=gu(f(zo,cu,Nh)),zy=function(e){return Up({decoder:Gy,method:"eth_blockNumber",params:yr,url:e})},Yy=function(e){return f(Zp,qy,zy(e))},Wy=r(function(e,t){return{address_:e,blocknum:t}}),Jy=function(e){return Wo(function(t){return li(L(t,e))})},Qy=n(function(e,t,r){var n=t.a,a=r.a;return Wo(function(t){return f(Wh,function(t){var r=t.a,n=t.b;return f(au,rl(e(n)),a(r))},n(t))})}),Xy=r(function(e,t){return l(Qy,r(function(e,t){return e(t)}),t,e)}),Zy=vu(f(Xy,jh,f(Xy,Dh,Jy(Wy)))),em=r(function(e,t){return{data:si(f(Gf,"createdTrades(uint256)",M([uh(t)]))),decoder:Zy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tm=n(function(e,t,r){return f(Zp,r,f(Fp,Xh(e),f(em,rh(e),t)))}),rm=function(e){return{$:"CreationInfoFetched",a:e}},nm=r(function(e,t){return l(tm,e,qu(t),rm)}),am=function(e){return{$:"EventSentryMsg",a:e}},im=function(e){return{$:"BlockNumber",a:e}},om=function(e){return{$:"EventSentry",a:e}},um=function(e){return{$:"Set_elm_builtin",a:e}},sm=um(cp),cm=r(function(e,t){return L(om({blockNumber:ci,errors:yr,nodePath:t,pending:sm,ref:1,requests:cp,tagger:e,watching:sm}),f(Zp,f(zo,im,e),zy(t)))}),fm=function(e){return f(cm,am,Xh(e))},lm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},hm=dm(f(lm,ci,ci)),pm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:Co,secureCommInfo:hm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),gm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),vm=n(function(e,t,r){var n=f(nm,t,r),a=fm(t),i=a.a,o=a.b;return d(gm,l(pm,f(jy,t,r),i,e),Po(M([n,o,Yy(Xh(t))])),Fo,M([ha]))}),ym=function(e){return{$:"LoadedTrade",a:e}},mm=function(e){return{$:"EventLogFetched",a:e}},bm=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),Cm=ue,Em=ce,Sm=Yr,Tm=n(function(e,t,r){var n=function(e){return Em(M([e,Cm(r)]))};return f(du,function(a){var i=f(Gh,e,a);if("Ok"===i.$){var o=i.a,u=f(Gh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return hu(Di(c))}return Fi(r)},Sm)}),wm=a(function(e,t,r,n){return f(dh,l(Tm,f(Oh,e,Sm),t,r),n)}),Im=n(function(e,t,r){return f(dh,f(Oh,e,t),r)}),Am=gu(Ph),Bm=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),km=function(e){return{$:"BlockHash",a:e}},Nm=function(e){return Bm(e)?li(km(cu(e))):fi("Given blockHash "+xh(e)+" is not valid.")},Rm=gu(Nm),$m=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),_m=function(e){return $m(e)?li(nc(cu(e))):fi("Something in here is not very hexy: "+xh(e))},Lm=gu(_m),xm=function(e){return{$:"TxHash",a:e}},Pm=function(e){return Bm(e)?li(xm(cu(e))):fi("Given txHash "+xh(e)+" is not valid.")},Dm=gu(Pm),Um=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}}),Om=zr,Mm=oe,Fm=l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionHash",Dm,l(Im,"transactionIndex",Gy,l(Im,"logIndex",Gy,d(wm,"removed",Om,!1,l(Im,"topics",Mm(Lm),l(Im,"data",pu,l(Im,"address",Am,Fi(Um)))))))))),Vm=function(e){return f(zh,function(e){if("Just"===e.$){var t=e.a;return hl(qf(t))}return bl},e)},Km=function(e){return Cl(M([L("fromBlock",Zh(e.fromBlock)),L("toBlock",Zh(e.toBlock)),L("address",pl(e.address)),L("topics",Vm(e.topics))]))},Hm=r(function(e,t){return Up({decoder:Mm(Fm),method:"eth_getLogs",params:M([Km(t)]),url:e})}),jm=function(e){return{$:"BlockNum",a:e}},qm=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Kp,function(r){return f(jp,vi(r),f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)})))},f(Hm,e,t)):f(Hm,e,t)}),Gm=r(function(e,t){var r=t.a;return um(l(xl,e,gr,r))}),zm=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(xl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(om(D(o,{watching:f(Gm,a.ref,o.watching)})),f(Zp,f(zo,bm(a.ref),a.tagger),e),a.ref)}(l(qm,a.nodePath,n,L(s,s)))}return x(om(D(o,{pending:f(Gm,a.ref,o.pending)})),Do,a.ref)}),Ym=zm(!1),Wm=r(function(e,t){var r=function(){var e=fm(t.factory),r=e.a,n=e.b;return function(e){var t=e.a,r=e.b,a=e.c;return x(t,Po(M([n,r])),a)}(l(Ym,mm,r,{address:t.creationInfo.address,fromBlock:jm(t.creationInfo.blocknum),toBlock:Mp,topics:yr}))}(),n=r.a,a=r.b;return d(gm,l(pm,ym(t),n,e),Po(M([a,Yy(Xh(t.factory))])),Fo,M([ha]))}),Jm=function(e){return{data:si(f(Gf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Qm=function(e){return{data:si(f(Gf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Xm=function(e){return{data:si(f(Gf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Zm=r(function(e,t){return{data:si(f(Gf,"initiatorStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),eb=function(e){return{data:si(f(Gf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},tb=function(e){return{data:si(f(Gf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},rb=r(function(e,t){return{data:si(f(Gf,"responderStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),nb=r(function(e,t){return{amount:t,fiatType:e}}),ab=f(du,function(e){var t=cd(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("Can't convert that to a BigInt")},pu),ib=l(Mi,nb,f(Fh,0,pu),f(Fh,1,ab)),ob={$:"Bank"},ub={$:"Cash"},sb=function(e){switch(e){case"cash":return si(ub);case"bank":return si(ob);case"custom":return si(Fd);default:return ci}},cb=f(du,function(e){var t=sb(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("")},pu),fb=l(Mi,Vd,f(Oh,"type",cb),f(Oh,"info",pu)),lb=function(e){var t=l(Mi,sg,f(Oh,"price",ib),f(Oh,"paymentmethods",Mm(fb)));return f(op,t,e)},db=r(function(e,t){return{commPubkey:t,responder:e}}),hb=r(function(e,t){var n=r(function(t,r){return l(Xo,t,t+2*r,e)}),a=f(zo,Nh,au(ti(2)));return f(Wh,function(t){return f(au,function(e){return f(n,t+64,e)},Nh(l(Xo,t,t+64,e)))},a(t))}),pb=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),gb=n(function(e,t,r){var n=l(Ra,pb(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),vb=j,yb=function(e){return As(vb(e))},mb=function(e){return l(gb,r(function(e,t){return U(t,yb(e))}),"",e)},bb=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f(Wh,mb,f(Wh,f(zo,xa(Nh),Ah),f(au,ml(f(zo,_d,ns)),f(au,tc(2),f(hb,t,nu(r)))))))}),Cb=f(dh,f(Mh,1,bb),f(dh,f(Mh,0,Dh),Fi(db))),Eb=r(function(e,t){return{commPubkey:t,terms:e}}),Sb=f(dh,f(Mh,1,bb),f(dh,f(Mh,0,bb),Fi(Eb))),Tb=function(e){return{statement:e}},wb=f(dh,f(Mh,0,bb),Fi(Tb)),Ib=function(e){return{statement:e}},Ab=f(dh,f(Mh,0,bb),Fi(Ib)),Bb={$:"AbortedEvent"},kb={$:"BurnedEvent"},Nb={$:"ClaimedEvent"},Rb=function(e){return{$:"CommittedEvent",a:e}},$b=function(e){return{$:"InitiatedEvent",a:e}},_b=function(e){return{$:"InitiatorStatementLogEvent",a:e}},Lb={$:"PokeEvent"},xb={$:"RecalledEvent"},Pb={$:"ReleasedEvent"},Db=function(e){return{$:"ResponderStatementLogEvent",a:e}},Ub=f(Oh,"topics",f(Fh,0,Lm)),Ob=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),Kf(f(xa,yi,Zs(e))))))},Mb=f(du,function(e){return R(e,Ob("Initiated(string,string)"))?f(Oi,$b,Sb):R(e,Ob("Committed(address,string)"))?f(Oi,Rb,Cb):R(e,Ob("Recalled()"))?Fi(xb):R(e,Ob("Claimed()"))?Fi(Nb):R(e,Ob("Aborted()"))?Fi(Bb):R(e,Ob("Released()"))?Fi(Pb):R(e,Ob("Burned()"))?Fi(kb):R(e,Ob("InitiatorStatementLog(string)"))?f(Oi,_b,wb):R(e,Ob("ResponderStatementLog(string)"))?f(Oi,Db,Ab):R(e,Ob("Poke()"))?Fi(Lb):hu("Unrecognized topic hash")},Ub),Fb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},Vb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},Kb=function(e){return R(e.buyerDeposit,Yl(e.tradeAmount))&&R(e.abortPunishment,zl(e.tradeAmount))},Hb={$:"Invalid"},jb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),qb=r(function(e,t){return Vl(jd(t)+jd(e))}),Gb=function(e){var t=Bd(Sd(e.amount));if("Just"===t.$){return t.a}f(cl,"Error converting FiatValue to float--string -> float failed!",e);return 0},zb=r(function(e,t){return(t-e)/e}),Yb=r(function(e,t){var r=Gb(t),n=kd(e);return"USD"===t.fiatType?si(f(zb,n,r)):ci}),Wb=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 Vl(0)}}();return{margin:f(Yb,e.tradeAmount,r.price),phaseEndTime:function(){return"Closed"===t.phase.$?Vl(f(Nu,2,53)-1):f(qb,t.phaseStartTime,n)}()}}),Jb=function(e){var t=x(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 ym(v(jb,e.factory,e.id,n,a,o,u,s,l(Wb,a,o,u)))}return Hy(e)},Qb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(cl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Hb}}),Xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Hb}}),Zb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Hb}}),eC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return ym(D(n,{state:e}));default:return Hb}}),tC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Hb}}),rC=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}}),nC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,uu,f(Xy,Dh,Jy(rC))))))))))),aC=function(e){return{data:si(f(Gf,"getParameters()",yr)),decoder:nC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},iC=function(e){return f(Bo,function(e){return Vl(1e3*e)},rd(Sd(e)))},oC=function(e){return Hl(e)},uC=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),sC=function(e){var t=f($d,"error converting BigInt to Time.Posix",iC(e.autoabortInterval)),r=f($d,"error converting BigInt to Time.Posix",iC(e.autoreleaseInterval)),a=f($d,"error converting BigInt to Time.Posix",iC(e.autorecallInterval));return d(uC,n(function(t,r,n){return{abortPunishment:oC(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:oC(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:oC(e.pokeReward),tradeAmount:oC(e.tradeAmount)}}),a,t,r)},cC=n(function(e,t,r){return f(Zp,r,f(jp,sC,f(Fp,Xh(e),aC(t))))}),fC=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}}}}}}}}}}},lC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(fC)))))))))))),dC=function(e){return{data:si(f(Gf,"getPhaseStartInfo()",yr)),decoder:lC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},hC=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),pC=function(e){return h(hC,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}}),iC(e.v6),iC(e.v7),iC(e.v8),iC(e.v9))},gC=n(function(e,t,r){return f(Zp,r,f(jp,pC,f(Fp,Xh(e),dC(t))))}),vC=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),yC=vu(f(Xy,jh,f(Xy,Dh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(vC))))))),mC=function(e){return{data:si(f(Gf,"getState()",yr)),decoder:yC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},bC={$:"Aborted"},CC={$:"Burned"},EC={$:"NotClosed"},SC={$:"Recalled"},TC={$:"Released"},wC=function(e){switch(f(xc,99,rd(Sd(e)))){case 0:return si(EC);case 1:return si(SC);case 2:return si(bC);case 3:return si(TC);case 4:return si(CC);default:return ci}},IC=function(e){switch(f(xc,99,rd(Sd(e)))){case 1:return si(Co);case 2:return si(mo);case 3:return si(bo);case 4:return si(yo);default:return ci}},AC=function(e){return R(e,th("0x0000000000000000000000000000000000000000"))?ci:si(e)},BC=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),kC=function(e){var t=iC(e.phaseStartTimestamp),r=IC(e.phase),a=wC(e.closedReason);return d(BC,n(function(t,r,n){return{balance:oC(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:AC(e.responder)}}),r,t,a)},NC=n(function(e,t,r){return f(Zp,r,f(jp,kC,f(Fp,Xh(e),mC(t))))}),RC=i(function(e,t,r,n,a){return Po(M([l(cC,e,t,r),l(NC,e,t,n),l(gC,e,t,a)]))}),$C=function(e){var t=Rg(e);if("Just"===t.$){return t.a}f(cl,"Warning! BigInt to Int conversion failed!",Sd(e));return 0},_C=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),LC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),xC=function(e){return e.b?l(LC,e,yr,0):qa},PC=tn,DC=function(e){var t=h(PC,_C,f(Oh,"encapsulation",pu),f(Oh,"iv",pu),f(Oh,"tag",pu),f(Oh,"encrypted",pu)),r=Mm(t),n=f(Gh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Zc,0,e),f(Zc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(xC(i))},UC=function(e){var t=function(e){var t=Qo(e);return t>1114111?fi("string is too long"):li(f(Is,vb(t),e))};return f(au,Ri(""),Ah(f(xa,t,e)))},OC=function(e){var t=e.a,r=e.b;return UC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},MC=r(function(e,t){return Cl(M([L("message",hl(e)),L("pubkeyHexStrings",f(zh,hl,M([t.initiatorPubkey,t.responderPubkey])))]))}),FC=function(e){return{$:"LoadedCommInfo",a:e}},VC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),KC=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 FC(f(VC,r,n))}return dm(e)},HC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return FC(D(n,{initiatorPubkey:e}))}),jC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{responderPubkey:si(e)}))}var n=t.a;return FC(D(n,{responderPubkey:e}))}),qC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),GC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(nd,a,n),o=$s(f(lc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),zC=function(e){var t=xC(f(GC,Zs(e),yr));return l(zd,uv,h(hC,_C,f(Zc,0,t),f(Zc,1,t),f(Zc,2,t),f(Zc,3,t)),h(hC,_C,f(Zc,4,t),f(Zc,5,t),f(Zc,6,t),f(Zc,7,t)))},YC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),WC={$:"Aborted"},JC={$:"Burned"},QC={$:"Claimed"},XC=function(e){return{$:"Committed",a:e}},ZC=function(e){return{$:"Encrypted",a:e}},eE={$:"FailedDecode"},tE={$:"Initiated"},rE={$:"Recalled"},nE={$:"Released"},aE=function(e){return{$:"StateChange",a:e}},iE=function(e){return{$:"Statement",a:e}},oE=fr,uE=cr,sE=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(oE,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(uE,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),cE=or,fE=y,lE=a(function(e,t,r,n){var a=Wc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(cE,Ga(r),n);var i=za(d(lE,e-Ha,t,r,ja));return f(cE,i,n)}var o=f(Jc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(lE,e-Ha,t,r,u));return l(rf,a,i,n)}var i=za(d(lE,e-Ha,t,r,fE(o)));return l(rf,a,i,n)}),dE=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(lE,c,r,e,fE(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(lE,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),hE=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(oE,32,r,e),o=f(dE,i,t);if(a<0){var u=l(uE,a,n,e);return f(dE,u,o)}return o}),pE=ur,gE=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(pE,i,t,r)}return f(ka,e,t)});return{nodeList:l(pE,i,yr,n),nodeListSize:t/32|0,tail:a}},vE=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(pE,o,t,r)}var n=e.a;return f(hE,n,t)});return f(hE,i,l(pE,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(pE,o,t,r)}var n=e.a;return f(sE,n,t)});return f(ai,!0,f(sE,i,l(pE,o,gE(e),a)))}),yE=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),mE=f(La,yE,yr),bE=n(function(e,t,r){var n=qC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(aE(tE));case"CommittedEvent":var r=t.a;return si(aE(XC(r.responder)));case"RecalledEvent":return si(aE(rE));case"ClaimedEvent":return si(aE(QC));case"AbortedEvent":return si(aE(WC));case"ReleasedEvent":return si(aE(nE));case"BurnedEvent":return si(aE(JC));case"InitiatorStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(To)}));case"ResponderStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(wo)}));default:return ci}}(),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(vE,r.history,xC(mE(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Bo,YC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),mE(M([s])))}),CE=Gr,EE=function(e){var t=l(Mi,uv,f(Oh,"id",CE),f(Oh,"message",pu));return f(Hd,Di,f(Gh,t,e))},SE=function(e){return{$:"Decrypted",a:e}},TE=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),wE=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(bE,n,a,t),o=i.a,u=i.b,s=i.c;return d(TE,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(TE,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(TE,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=EE(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Zc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:SE(y)}),T=D(b,{eventInfo:iE(S)}),w=l(af,v,T,t.history);return d(TE,D(t,{history:w}),!1,ci,yr)}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an event that is not a message!",b))]))}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(TE,t,!1,ci,M([pa(f(ll,"Error decoding decryption result",I))]))}}),IE=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),AE=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),BE=function(e){return{onBroadcast:ci,onMined:si(L(IE(e),ci)),onSign:si(AE(e))}},kE=je("encryptToPubkeys",Ua),NE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),RE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),$E=function(e){return{$:"CommitMined",a:e}},_E={$:"CommitNeedsSig"},LE=function(e){return{$:"CommitSigned",a:e}},xE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?RE:NE}(),a=al(function(){return"Token"===e.factory.$?Ua:pg(jl(Fb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(_E),f(qo,{onBroadcast:ci,onMined:si(L($E,ci)),onSign:si(LE)},a))}),PE=r(function(e,t){return Cl(M([L("id",wl(e)),L("encapsulation",hl(t.encapsulatedKey)),L("iv",hl(t.iv)),L("tag",hl(t.tag)),L("encrypted",hl(t.message))]))}),DE=je("decryptMessage",Ua),UE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},OE=r(function(e,t){return Po(f(xa,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 DE(f(PE,r,s))}return Do}return Do},UE(e.history)))}),ME=function(e){if("Just"===e.$){return e.a}return ci},FE=function(e){var t=ME(l(zd,Ao,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Bo,function(e){return e.address},Gd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(OE,n,a)}return Do},VE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(bE,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),KE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),HE=i(function(e,t,r,n,a){return f(VE,n,p(KE,e,r,t,qa,a,""))}),jE=function(e){return{$:"ChatHistoryMsg",a:e}},qE=a(function(e,t,r,n){var a=x(t,Gd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(ko,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(jE),n))}(h(HE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),GE={$:"Abort"},zE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),YE=function(e){return{$:"ActionNeedsSig",a:e}},WE=function(e){return{$:"ApproveMining",a:e}},JE={$:"ApproveNeedsSig"},QE=function(e){return{$:"ApproveSigned",a:e}},XE={$:"Burn"},ZE={$:"Claim"},eS=function(e){return{$:"CommitMining",a:e}},tS=function(e){return{$:"ConfirmingAction",a:e}},rS=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),nS=function(e){return{$:"ParametersFetched",a:e}},aS=function(e){return{$:"PhaseInfoFetched",a:e}},iS={$:"Poke"},oS={$:"Recall"},uS={$:"Release"},sS=function(e){return{$:"StartContractAction",a:e}},cS=function(e){return{$:"StateFetched",a:e}},fS=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"}},lS=function(e){return d(gm,e,Do,Fo,yr)},dS={align:ul,label:"cantFindTradeWillRetry",mainParagraphs:M([M([fl("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:$g},hS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(_g,e,r)}if("Nothing"===t.a.$){t.a;return f(ll,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ll,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),pS={align:ul,label:"tradeParametersNotDefault",mainParagraphs:M([M([fl("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:$g},gS=eo(Xi),vS=n(function(e,t,r){return l(bp,e,Bo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),yS=r(function(e,t){var r=t.a;return um(f(mp,e,r))}),mS=n(function(e,t,r){var n=e.a,a=f(fp,t,n.requests);if("Nothing"===a.$)return L(om(n),Do);var i=a.a,o=L(i.watchOnce,Ql(r));if("Nothing"===o.b.$){o.b;return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Do)}if(o.a){var u=o.b.a;return L(om(D(n,{requests:l(vS,t,r,n.requests),watching:f(yS,t,n.watching)})),f(Yg,i.tagger,xp(u)))}return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Po(f(xa,function(e){return f(Yg,i.tagger,xp(e))},r)))}),bS=_e,CS=r(function(e,t){return f(Zp,f(zo,im,t),f(Kp,function(t){return zy(e)},bS(2e3)))}),ES=n(function(e,t,r){var n=r.a,a=r.b;return f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)}))}),SS=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(SS,e,t,i)),c=o;e=u,t=s,r=c}}),TS=r(function(e,t){return l(SS,xl,t,e)}),wS=r(function(e,t){var r=e.a,n=t.a;return um(f(TS,r,n))}),IS=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 Po(f(xa,function(t){return f(Zp,f(zo,bm(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},mE(f(xa,function(e){return f(fp,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(om(D(r,{blockNumber:si(a)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,ES)]))):L(t,f(CS,r.nodePath,r.tagger))}return L(om(D(r,{blockNumber:si(a),pending:sm,watching:f(wS,r.watching,r.pending)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(a,a),r.pending,qm),l(i,L(a,a),r.watching,ES)])))}var s=e.a.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),f(CS,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(mS,t,c,d)}var s=e.b.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),Do)}),AS=function(e){return M([e])},BS=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(nm,r.factory,r.id):Do}}(),function(){var e=x(Gd(t.wallet),Mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Mg(t.wallet),si(a.factory))?d(eg,n,r.address,a.creationInfo.address,Ly):Do}return Do}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(qE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?FE(t):Do,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(gm,u,Po(M([l(NC,p.factory,p.creationInfo.address,cS),s,r])),Fo,o)}return lS(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return lS(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(ts,m,jl(Fb(C.parameters))),ba))return lS(u);var S=l(xE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(gm,D(u,{txChainStatus:T}),Do,w,yr)}return lS(u)}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:$C(I.blocknum)},B=l(Ym,mm,t.eventSentry,{address:A.address,fromBlock:jm(A.blocknum),toBlock:Mp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(Qb,A,t.trade)}),$=f(xc,gS,Vb(u.trade)),_=Po(M([N,h(RC,$,A.address,nS,cS,aS)]));return d(gm,u,_,Fo,yr)}if("BadBody"===g.a.$){g.a.a;return d(gm,t,Do,Fo,M([pa(dS)]))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(eC,P,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(Kb(F)){var u=D(t,{trade:f(Xb,F,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(pS)]))}var V=g.a.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Zb,H,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Yh,Mb,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(HC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(jC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=lb(e.terms);if("Ok"===r.$){var n=r.a;return L(f(tC,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ll,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return x(si(r),!1,yr)}return d(qE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),ee=Z.a,te=Z.b,re=Z.c,ne=function(){if("Just"===ee.$){var e=ee.a;return L(function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r||te,f(oo,re,f(xa,Ji(jE),n)))}(l(bE,q.blockNumber,Y,e)),yr)}return L(x(ci,!1,re),f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])))}(),ae=ne.a,ie=ae.a,oe=ae.b,ue=ae.c,se=ne.b,u=D(t,{chatHistoryModel:ie,eventsWaitingForChatHistory:se,secureCommInfo:W,trade:Q}),_=oe?FE(u):Do;return d(gm,u,_,Fo,f(oo,f(xa,pa,mE(M([X]))),ue));case"ExpandPhase":var ce=e.a;return lS(D(t,{expandedPhase:ce}));case"ToggleChat":var fe=!t.showChatHistory;return lS(D(t,{showChatHistory:fe}));case"ToggleStatsModal":var le=!t.showStatsModal;return lS(D(t,{showStatsModal:le}));case"ViewUserHistory":var de=(e.a,t.trade);if("LoadedTrade"===de.$){var C=de.a;return d(gm,t,Do,Fo,M([da(jv(C.parameters.initiatorAddress))]))}return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,he=e.c;return lS(D(t,{txChainStatus:si(f(rS,E,he))}));case"AbortAction":return lS(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,he=e.c,pe=function(){var e=C.factory;if("Native"===e.$)return l(xE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=al(l(sh,nh(r),C.creationInfo.address,he)),t={onBroadcast:ci,onMined:ci,onSign:si(QE)};return f(qo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(ts,i,jl(Fb(C.parameters))),ba)?L(si(JE),n):l(xE,C,E.address,E.commPubkey)}return L(si(JE),n)}(),T=pe.a,w=pe.b;return d(gm,D(t,{txChainStatus:T}),Do,w,yr);case"ContractActionClicked":var ge=e.a;if(R(ge,iS)||R(ge,oS)){var ve=sS(ge),ye=t;e=ve,t=ye;continue e}return lS(D(t,{txChainStatus:si(tS(ge))}));case"StartContractAction":var me=e.a,be=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Fo,M([pa(f(ll,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(me.$){case"Recall":var a=al(eb(n.creationInfo.address));return x(si(YE(oS)),f(qo,BE(oS),a),yr);case"Claim":var a=al(Xm(n.creationInfo.address));return x(si(YE(ZE)),f(qo,BE(ZE),a),yr);case"Abort":var a=al(Jm(n.creationInfo.address));return x(si(YE(GE)),f(qo,BE(GE),a),yr);case"Release":var a=al(tb(n.creationInfo.address));return x(si(YE(uS)),f(qo,BE(uS),a),yr);case"Burn":var a=al(Qm(n.creationInfo.address));return x(si(YE(XE)),f(qo,BE(XE),a),yr);default:var a=al(zf(n.creationInfo.address));return x(si(YE(iS)),f(qo,BE(iS),a),yr)}}(),T=be.a,w=be.b,o=be.c;return d(gm,D(t,{txChainStatus:T}),Do,w,o);case"ApproveSigned":var Ce=e.a;if("Ok"===Ce.$){var Ee=Ce.a;return lS(D(t,{txChainStatus:si(WE(Ee))}))}var V=Ce.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"approve",V))]));case"CommitSigned":var Ce=e.a;if("Ok"===Ce.$){var Ee=Ce.a;return lS(D(t,{txChainStatus:si(eS(Ee))}))}var V=Ce.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"commit",V))]));case"CommitMined":return lS(D(t,{txChainStatus:ci}));case"ActionSigned":var ge=e.a,Ce=e.b;if("Ok"===Ce.$){var Ee=Ce.a;return lS(D(t,{txChainStatus:si(f(zE,ge,Ee))}))}var V=Ce.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,fS(ge),V))]));case"ActionMined":var ge=e.a;return lS(D(t,{txChainStatus:ci}));case"EventSentryMsg":var Se=e.a,Te=f(IS,Se,t.eventSentry),we=Te.a,_=Te.b;return d(gm,D(t,{eventSentry:we}),_,Fo,yr);case"ChatHistoryMsg":var Ie=e.a,Ae=t.chatHistoryModel;if("Just"===Ae.$){var Be=Ae.a,ke=f(wE,Ie,Be),Ne=D(t,{chatHistoryModel:si(ke.model)}),s=ke.shouldCallDecrypt?FE(t):Do,Re=function(){var e=ke.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(kE(f(MC,r,a)),ci)}return L(Do,si(f(ll,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Do,ci)}(),$e=Re.a,_e=Re.b;return d(gm,Ne,Po(M([s,$e])),Fo,U(f(Qi,jE,ke.appCmds),f(xc,yr,f(Bo,AS,f(Bo,pa,_e)))))}return d(gm,t,Do,Fo,M([pa(f(ll,"Got a chat history message, but there is no chat history model!",Ie))]));case"EncryptionFinished":var Le=e.a,xe=f(Wh,OC,DC(Le)),Pe=x(t.wallet,t.trade,xe);if("Ok"===Pe.c.$){if("Active"===Pe.a.$&&"LoadedTrade"===Pe.b.$){var E=Pe.a.a,p=Pe.b.a,De=Pe.c.a,Ue=f(Ao,p,E.address);if("Nothing"===Ue.$)return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Oe=Ue.a,Me=function(){return al("Initiator"===Oe.$?f(Zm,p.creationInfo.address,De):f(rb,p.creationInfo.address,De))}();return d(gm,t,Do,f(qo,{onBroadcast:ci,onMined:ci,onSign:ci},Me),yr)}var Fe=Pe.a,Ve=Pe.b;return d(gm,t,Do,Fo,M([pa(f(ll,"Encryption successful, but the user or trade is no longer valid.",L(Fe,Ve)))]))}var Ke=Pe.c.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error translating JS encryption result into Elm.",Ke))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return lS(t)}var V=e.a.a;return d(gm,t,Do,Fo,M([pa(f(Lg,"message",V))]));default:return d(gm,t,Do,Fo,M([ga]))}}),kS=r(function(e,t){return{address:e,blocknum:t}}),NS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},RS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(zm,!0,e,t,r))}),$S=n(function(e,t,r){var n=function(e){return r(f(Yh,Sb,e).returnData)},a={address:t.address,fromBlock:jm(t.blocknum),toBlock:jm(t.blocknum),topics:M([si(Ob("Initiated(string,string)"))])};return l(RS,n,e,a)}),_S=function(e){return{data:si(f(Gf,"numTrades()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},LS=r(function(e,t){return f(Zp,t,f(Fp,Xh(e),_S(rh(e))))}),xS=function(e){return{data:si(f(Gf,"phase()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},PS=n(function(e,t,r){return f(Zp,r,f(jp,IC,f(Fp,Xh(e),xS(t))))}),DS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),US=r(function(e,t){return l(La,DS(e),yr,t)}),OS=function(e){return f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},MS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},FS=function(e){return f(MS,Ja(Hb),Sa(e.trades))},VS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:FS(e),loaded:Ti(OS(e))})})},KS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),HS=r(function(e,t){var r=f(Zc,e,t.trades);if("Just"===r.$){var n=(r.a,l(af,e,Hb,t.trades));return l(KS,VS(D(t,{trades:n})),Do,yr)}return l(KS,t,Do,M([pa(f(ll,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),jS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Qb,t,a),o=l(af,e,i,r.trades);return L(VS(D(r,{trades:o})),yr)}return L(r,M([f(ll,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),qS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Xb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(af,e,ym(D(a,{state:D(i,{phase:t})})),r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),zS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Zb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),YS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(eC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),WS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),JS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),QS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),XS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),ZS=function(e){return{$:"NumTradesFetchedAgain",a:e}},eT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),tT=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),rT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),nT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),aT=function(e){return l(KS,e,Do,yr)},iT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=$C(n),i=xC(f(xa,jy(t.factory),f(Ai,0,a-1))),o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,0,a-1)));return l(KS,D(t,{dataFetchState:l(QS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CheckForNewTrades":return l(KS,t,f(LS,t.factory,ZS),yr);case"UpdateTradePhases":var s=Po(mE(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(PS,e.factory,e.creationInfo.address,f(tT,e.factory,e.id)))},OS(t))));return l(KS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(GS,d,p,t),v=function(){var e=L(p,f(Zc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=NS(r);if("Just"===n.$){var a=n.a;return L(l(NC,c,a.address,nT(d)),yr)}return L(Do,M([pa(f(ll,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Do,yr)}e.b;return L(Do,M([pa(f(ll,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(KS,g.tradeCache,Po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(KS,t,Do,M([pa(f(hS,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=$C(n);if(_(C,E)<0){var S=t.dataFetchState,o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,C,E-1))),T=xC(f(xa,jy(t.factory),f(Ai,C,E-1)));return l(KS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(vE,t.trades,T)}),o,yr)}return aT(t)}b.b;return l(KS,t,Do,M([pa(f(ll,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(kS,w.address_,$C(w.blocknum)),A=l($S,t.eventSentry,I,XS(d)),B=A.a,k=A.b,y=Po(M([h(RC,t.factory,I.address,eT(d),nT(d),rT(d)),k])),N=l(jS,d,I,t),R=N.a,$=N.b;return l(KS,VS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(KS,t,Do,M([pa(f(_g,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(qS,d,P,t)}var U=r.a.a;return l(KS,t,Do,M([pa(f(ll,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(YS,d,O,t)}return l(KS,t,Do,M([pa(f(hS,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(zS,d,F,t)}return l(KS,t,Do,M([pa(f(hS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=lb(V.terms);if("Ok"===K.$){var H=K.a;return l(WS,d,H,t)}var j=K.a;return f(HS,d,t)}var j=r.a;return l(KS,t,Do,M([pa(f(ll,"Error decoding initiated event",j))]));default:var q=e.a,G=f(IS,q,t.eventSentry),z=G.a,y=G.b;return l(KS,D(t,{eventSentry:z}),y,yr)}}),oT=function(e){return{$:"AgentHistoryMsg",a:e}},uT=function(e){return{$:"AppCmd",a:e}},sT={$:"BetaLandingPage"},cT={$:"ConnectToWeb3"},fT=function(e){return{$:"MarketplaceMsg",a:e}},lT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),dT=r(function(e,t){return f(kn,e,hl(t))}),hT=function(e){return f(dT,"href",tt(e))},pT=Nn("rel"),gT=dT("target"),vT=function(e){return{$:"Height",a:e}},yT=vT,mT={$:"Content"},bT=mT,CT=function(e){return{$:"Width",a:e}},ET=CT,ST=function(e){return{$:"Attr",a:e}},TT=function(e){return{$:"NodeName",a:e}},wT=function(e){return{$:"Unkeyed",a:e}},IT={$:"AsEl"},AT=IT,BT=r(function(e,t){return{$:"Field",a:e,b:t}}),kT=f(BT,0,0),NT={$:"NoNearbyChildren"},RT={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"},$T=RT.any+" "+RT.column,_T=RT.any+" "+RT.grid,LT=RT.any+" "+RT.page,xT=RT.any+" "+RT.paragraph,PT=RT.any+" "+RT.row,DT=RT.any+" "+RT.single,UT=function(e){switch(e.$){case"AsRow":return PT;case"AsColumn":return $T;case"AsEl":return DT;case"AsGrid":return _T;case"AsParagraph":return xT;default:return LT}},OT=function(e){return{$:"Keyed",a:e}},MT={$:"NoStyleSheet"},FT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),VT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),KT={$:"AsParagraph"},HT=KT,jT=Sn("div"),qT=Sn("p"),GT=Sn("s"),zT=Sn("u"),YT=dT("className"),WT=function(e){return wn(Xe(e))},JT=function(e){return Sn(Xe(e))},QT=function(e){return{$:"Flag",a:e}},XT=function(e){return{$:"Second",a:e}},ZT=function(e){return e>31?XT(1< .ctr > ."+RT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",eI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+" { flex-basis: auto !important; } "+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+Ew(RT.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"+Zw,tI=function(e){return{$:"Intermediate",a:e}},rI=r(function(e,t){return tI({closing:t,others:yr,props:yr,selector:e})}),nI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,tI({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(nI,f(rI,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(nI,f(rI,n.selector,""),v),t.others)})}});return tI(l(La,a,n,t))}),aI=U(eI,function(e){var t=function(e){return Cd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Cd(f(xa,a,t.others)))};return Cd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(nI,f(rI,r,""),n),t)}),yr,e)))}(U(Jw,Xw))),iI=l(JT,"style",yr,M([Tw(aI)])),oI=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+'"'}},uI=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}},sI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ch,uI,t.variants)}return!1},cI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),fI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),lI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(fI,"."+e+"."+t+", ."+e+" ."+t,n),f(fI,"."+e+"."+t+"> ."+RT.text+", ."+e+" ."+t+" > ."+RT.text,a)])}),dI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(lI,i,RT.sizeByCapital,a),l(lI,i,RT.fullSize,n)))}),hI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(fI,"."+r+"."+RT.sizeByCapital+", ."+r+" ."+RT.sizeByCapital,M([L("line-height","1")])),f(fI,"."+r+"."+RT.sizeByCapital+"> ."+RT.text+", ."+r+" ."+RT.sizeByCapital+" > ."+RT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),pI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},gI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Tc,t,r))}return ci},vI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),yI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(xc,e.descender,gI(t)),n=f(xc,e.baseline,gI(f(ml,function(e){return!R(e,r)},t))),a=f(xc,e.capital,pI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(vI,i,a-n,o),full:l(vI,u,a-r,s)}},mI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",mw(e.height)),L("vertical-align",mw(e.vertical)+"em"),L("font-size",mw(e.size)+"em")]))},bI=function(e){return l(Ra,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 si(L(mI(function(e){return e.full}(yI(a))),mI(function(e){return e.capital}(yI(a)))))}return t}return t}),ci,e)},CI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(US,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=bI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,hI(t),n));var i=a.a;return f(Ri,"",f(xa,f(dI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},EI=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+'" '+Ni(r)}},SI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,EI,t.variants)))}return ci},TI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},wI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+mw(r)+"px, "+mw(n)+"px, "+mw(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("+mw(o)+"px, "+mw(u)+"px, "+mw(s)+"px)",b="scale3d("+mw(f)+", "+mw(l)+", "+mw(d)+")",C="rotate3d("+mw(p)+", "+mw(g)+", "+mw(v)+", "+mw(y)+"rad)";return si(m+" "+b+" "+C)}},II=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,cI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,cI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,cI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,cI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+RT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+RT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+RT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,cI(!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,M([f(vw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Tc,1,1-c));return l(a,t,"."+u,M([f(vw,"opacity",mw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(vw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(US,SI,p)),v=M([f(vw,"font-family",f(Ri,", ",f(xa,oI,p))),f(vw,"font-feature-settings",g),f(vw,"font-variant",f(Ch,sI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(vw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(vw,s,bw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+RT.row,A="."+(RT.wrapped+I),B="."+RT.alignRight,k="."+RT.paragraph,N="."+RT.page,R="."+RT.alignLeft,$=mw(S/2)+"px",_=mw(E/2)+"px",x="."+RT.column,y="."+C,P="."+RT.any;return Cd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(vw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(vw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,U(y,k),M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,lw,F.rows))+"-cols-"+f(Ri,"-",f(xa,lw,F.columns))+"-space-x-"+lw(F.spacing.a)+"-space-y-"+lw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=wI(ne),y=hw(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,M([f(vw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=TI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(CI(s),c)}),AI=r(function(e,t){return l(JT,"style",yr,M([Tw(f(II,e,t))]))}),BI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",iI),f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)}),kI=a(function(e,t,r,n){return e?f(ka,iI,f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)):f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)}),NI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(WT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(BI,!1,e,t,r);default:var e=i.a,t=i.b;return d(BI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return jT;case"p":return qT;default:return JT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(kI,!1,e,t,n);default:var e=i.a,t=i.b;return d(kI,!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(JT,e,n,M([f(u,r,M([YT(RT.any+" "+RT.single)]))]))}}();switch(o.$){case"AsRow":return f(ow,sw,e)&&!f(ow,uw,e)?s:f(ow,tw,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerRight])))]),M([s])):f(ow,rw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(ow,iw,e)&&!f(ow,aw,e)?s:f(ow,nw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerCenterY])))]),M([s])):f(ow,ew,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerBottom])))]),M([s])):s;default:return s}}),RI=Tw,$I=function(e){return f(jT,M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthContent,RT.heightContent])))]),M([RI(e)]))},_I=function(e){return l(JT,"div",M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthFill,RT.heightFill])))]),M([Tw(e)]))},LI=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 R(e,HT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,HT),L(f(ka,L(n,f(s.html,MT,e)),i),Iu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,AT)?_I(c):$I(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 R(e,HT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,HT),L(f(ka,f(o.html,MT,e),n),Iu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,AT)?_I(u):$I(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children)),MT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children)),MT))}),xI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),PI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(BT,a|r,n)}var i=e.a;return f(BT,r,i|n)}),DI=ZT(7),UI=ZT(36),OI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(BT,r|a,n|i)}),MI=ZT(6),FI=ZT(38),VI=ZT(30),KI=ZT(29),HI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),jI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),qI=function(e){return{$:"Transform",a:e}},GI=function(e){return{$:"ChildrenBehind",a:e}},zI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),YI=function(e){return{$:"ChildrenInFront",a:e}},WI=r(function(e,t){return f(jT,M([YT(function(){switch(e.$){case"Above":return f(Ri," ",M([RT.nearby,RT.single,RT.above]));case"Below":return f(Ri," ",M([RT.nearby,RT.single,RT.below]));case"OnRight":return f(Ri," ",M([RT.nearby,RT.single,RT.onRight]));case"OnLeft":return f(Ri," ",M([RT.nearby,RT.single,RT.onLeft]));case"InFront":return f(Ri," ",M([RT.nearby,RT.single,RT.inFront]));default:return f(Ri," ",M([RT.nearby,RT.single,RT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Tw("");case"Text":var e=t.a;return $I(e);case"Unstyled":return(0,t.a)(AT);default:return f(t.a.html,MT,AT)}}()]))}),JI=n(function(e,t,r){var n=f(WI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?GI(M([n])):YI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?GI(f(ka,n,a)):f(zI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(zI,M([n]),i):YI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(zI,f(ka,n,a),i):f(zI,a,f(ka,n,i))}}),QI=r(function(e,t){switch(t.$){case"Generic":return TT(e);case"NodeName":var r=t.a;return f(HI,r,e);default:var n=t.a,a=t.b;return f(HI,n,a)}}),XI=function(e){switch(e.$){case"Left":return RT.alignedHorizontally+" "+RT.alignLeft;case"Right":return RT.alignedHorizontally+" "+RT.alignRight;default:return RT.alignedHorizontally+" "+RT.alignCenterX}},ZI=function(e){switch(e.$){case"Top":return RT.alignedVertically+" "+RT.alignTop;case"Bottom":return RT.alignedVertically+" "+RT.alignBottom;default:return RT.alignedVertically+" "+RT.alignCenterY}},eA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),tA=function(e){return{$:"Moved",a:e}},rA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return tA(x(r,0,0));case"MoveY":var n=t.a;return tA(x(0,n,0));case"MoveZ":var a=t.a;return tA(x(0,0,a));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(eA,x(0,0,0),i,x(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 tA(x(s,n,a));case"MoveY":var c=t.a;return tA(x(r,c,a));case"MoveZ":var f=t.a;return tA(x(r,n,f));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,u,x(1,1,1),i,o);default:var l=t.a;return d(eA,u,l,x(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(eA,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(eA,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(eA,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(eA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(eA,u,h,v,y);default:var m=t.a;return d(eA,u,m,p,o)}}}),nA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(kT,n,M([l(jI,n,"height",r+"px")]));case"Content":return x(f(PI,UI,kT),RT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(PI,iw,kT),RT.heightFill,yr):x(f(PI,iw,kT),RT.heightFillPortion+" height-fill-"+Ni(a),M([l(jI,RT.any+"."+RT.row+" > "+Ew("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(jI,u,"min-height",Ni(i)+"px"),c=nA(o),d=c.a,h=c.b,p=c.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(jI,u,"max-height",Ni(g)+"px"),v=nA(o),d=v.a,h=v.b,p=v.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p))}},aA=function(e){switch(e.$){case"Px":var t=e.a;return x(kT,RT.widthExact+" width-px-"+Ni(t),M([l(jI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(PI,FI,kT),RT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(PI,sw,kT),RT.widthFill,yr):x(f(PI,sw,kT),RT.widthFillPortion+" width-fill-"+Ni(r),M([l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(jI,i,"min-width",Ni(n)+"px"),u=aA(a),s=u.a,c=u.b,d=u.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(jI,i,"max-width",Ni(h)+"px"),p=aA(a),s=p.a,c=p.b,d=p.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d))}},iA=ZT(27),oA=r(function(e,t){if(R(e,iA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),uA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=hw(n);if("Nothing"===s.$)return{attributes:f(ka,YT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,YT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,qI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(oA,S,I)){var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(PI,S,r),y=f(rA,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(ow,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=RT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(PI,MI,r),y=n,m=f(ka,l(jI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+RT.widthContent,g=t,v=f(PI,FI,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+RT.widthFill,g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=aA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(ow,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(PI,DI,r),y=n,m=f(ka,l(jI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=RT.heightContent+" "+e,g=t,v=f(PI,UI,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=RT.heightFill+" "+e,g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.column+" > "+Ew("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=nA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(QI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(QI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(QI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(QI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(QI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(QI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(QI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return TT("p");case"NodeName":var e=t.a;return TT(e);default:var r=t.a,n=t.b;return f(HI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(JI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(ow,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=XI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(PI,rw,e);case"Right":return f(PI,tw,e);default:return e}}(f(PI,VI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(ow,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=ZI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(PI,nw,e);case"Bottom":return f(PI,ew,e);default:return e}}(f(PI,KI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),sA={$:"Untransformed"},cA=sA,fA=a(function(e,t,r,n){return l(LI,e,n,v(uA,UT(e),t,kT,cA,yr,yr,NT,$a(r)))}),lA=function(e){return ST(YT(e))},dA=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ST(gT("_blank")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e)))))),wT(M([n])))}),hA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),pA=n(function(e,t,r){return d(hA,e,t,r,1)}),gA=ZT(14),vA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),yA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),mA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return dw(t)+"-"+dw(r)+"-"+dw(n)+"-"+dw(a)},bA=function(e){return f(yA,gA,l(vA,"fc-"+mA(e),"color",e))},CA={align:ul,label:"cantConnectNoWeb3",mainParagraphs:M([M([fl("You need a web3 provider (such as "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(") to Connect.")]),M([fl("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:xg},EA={align:ul,label:"invalidUrl",mainParagraphs:M([M([fl("I don't understand that URL...")]),M([fl("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:$g},SA=function(e){return{$:"Active",a:e}},TA=function(e){return{$:"OnlyNetwork",a:e}},wA=gu(f(zo,jf,f(zo,Hh,$d("Error decoding hex to BigInt")))),IA=function(){return gu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),AA=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}}}}}}}}}}}},BA=function(e){return Em(M([f(Oi,si,e),Fi(ci)]))},kA=f(dh,BA(f(Oh,"status",IA)),f(dh,BA(f(Oh,"root",pu)),l(Im,"logsBloom",pu,l(Im,"logs",Mm(Fm),f(dh,BA(f(Oh,"contractAddress",Am)),l(Im,"cumulativeGasUsed",wA,l(Im,"gasUsed",wA,l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionIndex",Gy,l(Im,"transactionHash",Dm,Fi(AA)))))))))))),NA=function(e){var t=e.a;return jf(t)},RA=f(zo,NA,hl),$A=r(function(e,t){return Up({decoder:kA,method:"eth_getTransactionReceipt",params:M([RA(t)]),url:e})}),_A=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),LA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),xA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),PA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(Io,function(e){return e.b},f(Io,function(e){return e.onMinedTagger},f(fp,t,e))))}),DA=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}}}}}}}}}}}},UA=function(e){return Em(M([Cm(ci),f(Oi,si,e)]))},OA=l(Im,"input",pu,l(Im,"gas",Gy,l(Im,"gasPrice",wA,l(Im,"value",wA,l(Im,"to",UA(Am),l(Im,"from",Am,l(Im,"transactionIndex",Gy,l(Im,"blockNumber",UA(Gy),l(Im,"blockHash",function(e){return f(du,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},cu(t))?Fi(ci):f(Oi,si,e)},pu)}(Rm),l(Im,"nonce",Gy,l(Im,"hash",Dm,Fi(DA)))))))))))),MA=r(function(e,t){return Up({decoder:OA,method:"eth_getTransactionByHash",params:M([RA(t)]),url:e})}),FA=r(function(e,t){return{attempts:e,sleep:t}}),VA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Xp,function(e){return a>0?f(Kp,function(e){return f(VA,f(FA,a,n),t)},bS(1e3*n)):Lp(e)},t)}),KA=r(function(e,t){return f(Kp,function(r){return f(VA,{attempts:30,sleep:1},f(MA,e,t))},bS(250))}),HA=r(function(e,t){return f(VA,{attempts:60,sleep:5},f($A,e,t))}),jA=function(e){return{$:"Mined",a:e}},qA=function(e){return Bo(function(t){return D(t,{status:jA(e)})})},GA=function(e){return{$:"Sent",a:e}},zA=function(e){return Bo(function(t){return D(t,{status:GA(e)})})},YA=function(e){return{$:"Signed",a:e}},WA=function(e){return Bo(function(t){return D(t,{status:YA(e)})})},JA=function(e){return"Nothing"!==e.$},QA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Tl(r),Do);case"TxSigned":var n=e.a,a=e.b,i=f(fp,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(Yg,t,xp(a))}return Do}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Do;if("Just"===t.b.$){var r=t.b.a;return f(Yg,r,xp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Yg,a,xp(fi(e)))}t.a,t.b,t.c;return Do};if("Ok"===a.$){var c=a.a,d=JA(o.onBroadcastTagger)||JA(o.onMinedTagger)?f(il,r.tagger,f(Zp,xA(n),f(KA,r.nodePath,c))):Do;return L(Tl(D(r,{txs:l(bp,n,WA(c),r.txs)})),Po(M([u,d])))}var h=a.a;return L(Tl(r),Po(M([u,s(h)])))}return L(Tl(r),Do);case"TxSent":var n=e.a,p=e.b,g=f(fp,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(il,r.tagger,f(Zp,LA(n),f(HA,r.nodePath,v.hash))):Do}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Yg,t,xp(li(v)))}return Do}();return L(Tl(D(r,{txs:l(bp,n,zA(v),r.txs)})),Po(M([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(Yg,t,xp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Yg,n,xp(fi("Error with TxSent stuff")))}e.a,e.b;return Do}();return L(Tl(r),s)}return L(Tl(r),Do);case"TxMined":var n=e.a,m=e.b,b=f(fp,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Yg,a,xp(li(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 Po(M([f(il,r.tagger,f(Zp,f(_A,n,s),zy(r.nodePath))),f(Yg,a,xp(li(C))),f(Yg,u.toMsg,xp(s))]))}return Do}();return L(Tl(D(r,{txs:l(bp,n,qA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Yg,r,xp(fi("TxReceipt decoding failure")))}return Do}();return L(Tl(r),S)}return L(Tl(r),Do);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(PA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Tl(r),f(Yg,B,f(Xp,function(e){return xp(D(I,{doneWatching:!0,reOrg:!0}))},f(Kp,function(e){return xp(D(I,{doneWatching:!0}))},f($A,r.nodePath,T.txHash)))))}return L(Tl(r),Do)}if(R(w,T.lastCheckedBlock))return L(Tl(r),f(il,r.tagger,f(Zp,f(_A,n,T),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))));var k=f(PA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Tl(r),Po(M([f(il,r.tagger,f(Zp,f(_A,n,I),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))),f(Yg,B,xp(I))])))}return L(Tl(r),Do)}var n=e.a,h=e.c.a;return L(Tl(r),Do);default:var h=e.a;return L(Tl(r),Do)}}),XA=Jt,ZA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),eB=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),tB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(eB,"#",e.fragment,l(eB,"?",e.query,U(f(ZA,e.port_,U(t,e.host)),e.path)))},rB=r(function(e,t){return e<0?ci:Ql(f(nd,e,t))}),nB=r(function(e,t){if(e<0)return t;var r=Bh(f(nd,e,t)),n=f(lc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),aB=n(function(e,t,r){if(e<0)return r;var n=f(nd,e,r),a=f(lc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),iB=r(function(e,t){return f(aB,e,ms(t))}),oB=r(function(e,t){Kv(t);switch(t.$){case"Home":return L(D(e,{submodel:sT}),Do);case"Create":var r=Xd(e.wallet),n=f(Ul,e.txSentry,f(Yo,Uy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(sB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),Po(M([f(il,Uy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(By,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(Wm,e.wallet,r)}return l(vm,e.wallet,u,s)}(),c=f(Ul,e.txSentry,f(Yo,Fy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(sB,U(f(Qi,Fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:My(r.model),txSentry:a}),Po(M([f(il,Fy,r.cmd),i]))));case"Marketplace":var d=Bv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Oy(h)}),Po(M([f(il,fT,p)])));case"AgentHistory":var g=t.a,v=f(Uo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:Py(y)}),Po(M([f(il,oT,m)])));default:return L(f(uo,EA,e),Do)}}),uB=r(function(e,t){var r=t.a,n=t.b,a=f(cB,uT(e),r),i=a.a,o=a.b;return L(i,Po(M([n,o])))}),sB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,uB,L(r,n),e)}),cB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(cB,cT,t);case"GotoRoute":var n=r.a;return L(t,f(Cy,t.key,n));case"GTag":var a=r.a;return L(t,wy(Sy(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),wy(Sy(d(Ol,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Uv,ky,o,u,s));default:return L(t,Ny(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(nB,c,t.userNotices)}),Do);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(by,t.key,tB(e))}var r=h.a;return XA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(fB,g,t);case"GotoRoute":var v=e.a;return L(t,Po(M([wy(Sy(d(Ol,"GotoRoute","navigation",Kv(v),0))),f(Cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Do);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,CA,t),Do):L(t,Ey(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Do;var t=e.a;return Iy(f(Ty,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(D(t,{userAddress:m.account,wallet:TA(m.networkId)}),b);case"UserPubkeySet":var C=e.a,E=f(Gh,pu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=SA(l(Ml,I,w,S)),B=f(Vy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ll,"Unexpected wallet state encounted when setting commPubkey!",L(t.userAddress,t.wallet)),t),Do)}T.a;return L(f(uo,f(ll,"User pubkey set, but I can no longer find the user address!",ci),t),Do)}var N=E.a;return L(l(Pa,uo,f(ll,"error decoding commPubkey from JS",N),t),Do);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(lv,R,_),P=f(Ul,t.txSentry,f(Yo,Uy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(sB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),Po(M([f(il,Uy,x.cmd),F]))))}return L(t,Do);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(BS,K,j),q=f(Ul,t.txSentry,f(Yo,Fy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(sB,U(f(Qi,Fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:My(x.model),txSentry:O}),Po(M([f(il,Fy,x.cmd),F]))))}return L(t,Do);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Dv,G,Y);return f(sB,f(Qi,fT,x.appCmds),L(D(t,{submodel:Oy(x.model)}),f(il,fT,x.cmd)))}return L(t,Do);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(ol,W,Q),X=f(Ul,t.txSentry,f(Yo,oT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(sB,U(f(Qi,oT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Py(x.model),txSentry:O}),Po(M([f(il,oT,x.cmd),F]))))}return L(t,Do);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(_u,si,f(QA,Z,r))}return L(ci,Do)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(rB,re,t.tradeCaches);if("Nothing"===ae.$)return f(uB,pa(f(ll,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Do));var ie=ae.a,x=f(iT,ne,ie);return L(D(t,{tradeCaches:l(iB,re,x.tradeCache,t.tradeCaches)}),f(il,lT(re),x.cmd));case"NoOp":return L(t,Do);default:var N=e.a;f(cl,"test",N);return L(t,Do)}}),fB=r(function(e,t){return f(oB,t,my(e))}),lB=Ge("txIn",Sm),dB=je("txOut",Ua),hB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},pB=function(e){return{$:"EventSentryMsg",a:e}},gB=function(e){var t=f(cm,pB,Xh(e)),r=t.a,n=t.b;return x({dataFetchState:l(QS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Zd,"tradeCache init","processing",hB(e),0)]))},vB=function(e){return{$:"InitialNumTradesFetched",a:e}},yB=function(e){return f(LS,e.factory,vB)},mB=function(e){var t=gB(e),r=t.a,n=t.b,a=t.c;return x(r,Po(M([n,yB(r)])),a)},bB=function(e){return{$:"TxSentryMsg",a:e}},CB={align:ul,label:"noWeb3Provider",mainParagraphs:M([M([fl("No web3 provider detected. Is "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(" or some other web3 provider installed and unlocked?")])]),noticeType:xg},EB={$:"TopLeft"},SB={align:EB,label:"screenToSmall",mainParagraphs:M([M([fl("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:xg},TB={align:ul,label:"wrongWeb3Network",mainParagraphs:M([M([fl("Make sure your wallet is set to a compatible network.")]),M([fl(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:$g},wB={$:"NoneDetected"},IB=function(e){return f(Bo,Xh,Mg(e))},AB={$:"ETCMain"},BB={$:"ETCTest"},kB={$:"Expanse"},NB={$:"Kovan"},RB={$:"Mainnet"},$B=function(e){return{$:"Private",a:e}},_B={$:"Rinkeby"},LB={$:"Ropsten"},xB={$:"RskMain"},PB={$:"RskTest"},DB=function(e){switch(e){case 1:return RB;case 2:return kB;case 3:return LB;case 4:return _B;case 30:return xB;case 31:return PB;case 42:return NB;case 41:return AB;case 62:return BB;default:return $B(e)}},UB=n(function(e,t,r){var n=e.a,a=e.b;return Tl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:cp})}),OB=n(function(e,t,n){var a=e.networkId?TA(DB(e.networkId)):wB,i=f(Bo,function(e){return l(UB,L(dB,lB),bB,e)},IB(a)),o=e.width<1024?si(SB):ci,u=f(xa,mB,ro),s=function(){return R(a,wB)?si(CB):"Nothing"===Mg(a).$?si(TB):ci}(),c=mE(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ay(f(Bi,r(function(e,t){return f(Qi,lT(e),t)}),g)),y=Po(f(Bi,r(function(e,t){return f(il,lT(e),t)}),p)),m=f(sB,v,f(fB,t,{key:n,screenWidth:e.width,submodel:sT,time:Vl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),Po(M([y,C])))}),MB=Oe,FB=MB(yr),VB=function(e){return FB},KB=function(e){return{$:"Refresh",a:e}},HB=r(function(e,t){return{$:"Every",a:e,b:t}}),jB=r(function(e,t){return{processes:t,taggers:e}}),qB=xp(f(jB,cp,cp)),GB=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(SS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),zB=Ne,YB=r(function(e,t){var r=e.a,n=e.b,a=f(fp,r,t);if("Nothing"===a.$)return l(xl,r,M([n]),t);var i=a.a;return l(xl,r,f(ka,n,i),t)}),WB=Be,JB=r(function(e,t){return{$:"Zone",a:e,b:t}}),QB=ca,XB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=WB(f(QB,n,f(Sp,e,n)));return f(Kp,function(t){return l(XB,e,a,l(xl,n,t,r))},i)}return xp(r)}),ZB=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 x(n,a,f(Kp,function(e){return i},zB(t)))}),u=l(Ra,YB,cp,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(xl,e,r,i),o)}),d=p(GB,s,c,o,u,i,x(yr,cp,xp(gr))),h=d.a,g=d.b,v=d.c;return f(Kp,function(e){return xp(f(jB,u,e))},f(Kp,function(t){return l(XB,e,h,g)},v))}),ek=function(e){return we(function(t){t(Se(e(Date.now())))})}(Vl),tk=n(function(e,t,r){var n=f(fp,t,r.taggers);if("Nothing"===n.$)return xp(r);var a=n.a,i=function(t){return Gp(f(xa,function(r){return f(Ep,e,r(t))},a))};return f(Kp,function(e){return xp(r)},f(Kp,i,ek))}),rk=r(function(e,t){var r=t.a,n=t.b;return f(HB,r,f(Da,e,n))});pn.Time=Pe(qB,ZB,tk,0,rk);var nk=Ue("Time"),ak=r(function(e,t){return nk(f(HB,e,t))}),ik=function(e){return f(ak,2e3,KB)},ok=function(e){return FB},uk=function(e){return{$:"DecryptionFinished",a:e}},sk=Ge("decryptionFinished",Sm),ck=Ge("encryptionFinished",Sm),fk=function(e){return{$:"EncryptionFinished",a:e}},lk=function(e){return{$:"Refresh",a:e}},dk=function(e){return MB(M([f(ak,3e3,lk),ck(fk),sk(function(e){return jE(uk(e))})]))},hk=yn,pk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return FB;case"CreateModel":t.a;return f(hk,Uy,ik());case"TradeModel":t.a;return f(hk,Fy,dk());case"MarketplaceModel":t.a;return f(hk,fT,ok());default:t.a;return f(hk,oT,VB())}},gk=Ge("userPubkeyResult",Sm),vk=Ge("walletSentryPort",Sm),yk={$:"CheckForNewTrades"},mk={$:"UpdateTradePhases"},bk=function(e){return MB(M([f(ak,5e3,function(e){return yk}),f(ak,3e3,function(e){return mk})]))},Ck=function(e){return{$:"Tick",a:e}},Ek=function(e){return{$:"UserPubkeySet",a:e}},Sk=function(e){return{$:"WalletStatus",a:e}},Tk=function(e){return f(ll,"Error decoding JS walletSentry: "+e,ci)},wk=function(e){return{$:"ErrorDecoding",a:e}},Ik=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Ak=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Oh,"ref",CE),f(Oh,"txHash",BA(Dm))),Bk=function(e){var t=f(Gh,Ak,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Ik,r.ref,li(a))}return f(Ik,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return wk("Error decoding tx data")},kk=function(e){var t=e.a;return f(hk,t.tagger,t.inPort(Bk))},Nk=f(Oi,DB,CE),Rk=gu(f(zo,rd,f(zo,$d("Failure decoding stringy int"),au(DB)))),$k=Em(M([Rk,Nk])),_k=r(function(e,t){return{account:e,networkId:t}}),Lk=l(Mi,_k,f(Oh,"account",BA(Am)),f(Oh,"networkId",$k)),xk=n(function(e,t,r){var n=f(Gh,Lk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),Pk=function(e){var t=f(zo,Tk,f(zo,pa,uT));return MB(U(M([f(ak,1e3,Ck),vk(f(xk,t,Sk)),f(xc,FB,f(Bo,kk,e.txSentry)),gk(Ek),MB(f(Bi,r(function(e,t){return f(hk,lT(e),t)}),f(xa,bk,e.tradeCaches)))]),M([pk(e)])))},Dk=function(e){return{$:"LinkClicked",a:e}},Uk=function(e){return{$:"UrlChanged",a:e}},Ok=n(function(e,t,r){return d(hA,e/255,t/255,r/255,1)}),Mk=l(Ok,10,33,108),Fk={$:"Generic"},Vk=Fk,Kk=r(function(e,t){return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),e)),wT(M([t])))}),Hk=function(e){return{$:"Fill",a:e}},jk=Hk(1),qk=Hi,Gk=function(e){return{$:"Px",a:e}},zk=Gk,Yk=ZT(8),Wk=function(e){return f(yA,Yk,l(vA,"bg-"+mA(e),"background-color",e))},Jk=f(Kk,M([ET(jk),yT(zk(150)),Wk(Mk)]),qk),Qk=function(e){return{$:"GotoRoute",a:e}},Xk={$:"Active"},Zk={$:"Important"},eN={$:"Normal"},tN=l(pA,1,1,1),rN=ZT(2),nN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),aN=r(function(e,t){return R(e,t)?f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e)):f(yA,rN,h(nN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),iN=ZT(21),oN=r(function(e,t){return{$:"Class",a:e,b:t}}),uN=f(oN,iN,RT.cursorPointer),sN=ZT(17),cN=function(e){return f(yA,sN,l(jI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},fN=function(e){return{$:"Normal",a:e}},lN=An,dN=r(function(e,t){return f(lN,e,fN(t))}),hN=function(e){return f(dN,"click",Fi(e))},pN=f(Da,ST,hN),gN=ZT(13),vN=f(oN,gN,RT.textSemiBold),yN=ZT(4),mN=function(e){return{$:"FontSize",a:e}},bN=function(e){return f(yA,yN,mN(e))},CN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([cN(4),Wk(l(pA,0,0,1))]);default:return M([cN(4),Wk(l(pA,.9,0,0))])}}();return f(Kk,U(M([f(aN,23,12),bN(22),vN,bA(tN),uN,pN(t)]),n),fl(e))}),EN=l(Ok,244,0,103),SN=function(e){return{$:"AlignX",a:e}},TN={$:"CenterX"},wN=SN(TN),IN=ZT(3),AN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),BN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),kN=function(e){return f(yA,IN,l(AN,f(BN,e,e),e,e))},NN=function(e){return{$:"Describe",a:e}},RN={$:"Paragraph"},$N=r(function(e,t){return d(fA,HT,Vk,f(ka,NN(RN),f(ka,ET(jk),f(ka,kN(5),e))),wT(t))}),_N=f(oN,gN,RT.bold),LN=f(Kk,M([bN(29),bA(tN),_N,wN,uN,pN(Qk(Gv))]),f($N,yr,M([fl("DAI"),f(Kk,M([bA(EN)]),fl("Hard"))]))),xN={$:"Right"},PN=SN(xN),DN={$:"AsColumn"},UN=DN,ON=r(function(e,t){return d(fA,UN,Vk,f(ka,lA(RT.contentTop+" "+RT.contentLeft),f(ka,yT(bT),f(ka,ET(bT),e))),wT(t))}),MN={$:"AsRow"},FN=MN,VN=r(function(e,t){return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY),f(ka,ET(bT),f(ka,yT(bT),e))),wT(t))}),KN=function(e){return f(VN,M([ET(jk),kN(30),f(aN,30,17)]),M([l(CN,"Browse Offers",Qk(zv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Xk}return eN}()),l(CN,"Create a New Offer",Qk(qv),function(){return"CreateModel"===e.submodel.$?Xk:eN}()),function(){var t=Gd(e.wallet);if("Just"===t.$){var r=t.a;return l(CN,"My Trades",Qk(jv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Xk:eN}return eN}())}return l(CN,"Connect to Wallet",cT,Zk)}(),f(ON,M([PN,kN(0),f(aN,8,0)]),M([LN]))]))},HN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},jN=function(e){return ml(e)},qN=r(function(e,t){return f(ml,dv(e),t)}),GN=function(e){return f(ml,function(e){return Kb(e.parameters)},OS(e))},zN={$:"BurnWindow"},YN={$:"FiatPrice"},WN={$:"Margin"},JN={$:"Offer"},QN={$:"PaymentWindow"},XN=function(e){return{$:"AlignY",a:e}},ZN={$:"CenterY"},eR=XN(ZN),tR=ZT(20),rR=f(oN,tR,RT.clip),nR=Hk,aR=function(e){return f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e))},iR=r(function(e,t){return f(Kk,M([ET(nR(e)),yT(zk(60)),rR,Wk(tN)]),f(Kk,M([aR(12),eR,ET(jk)]),t))}),oR=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},uR=function(e){return{$:"JustImage",a:e}},sR=uR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),cR=dT("alt"),fR=function(e){return f(dT,"src",rt(e))},lR=r(function(e,t){var r=t.src,n=t.description,a=f(ml,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(fA,AT,Vk,f(ka,lA(RT.imageContainer),e),wT(M([d(fA,AT,TT("img"),U(M([ST(fR(r)),ST(cR(n))]),a),wT(yr))])))}),dR=r(function(e,t){if("None"===t.$)return qk;var r=t.a;return f(lR,e,r)}),hR=uR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),pR=function(e){return{$:"ChangeSort",a:e}},gR=f(oN,gN,RT.textMedium),vR=function(e){return f(Kk,M([gR,bN(17)]),fl(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},yR=r(function(e,t){return f(VN,M([kN(5),uN,pN(pR(e))]),M([vR(e),function(){if("Just"===t.$){var e=t.a;return f(Kk,M([eR]),f(dR,M([ET(zk(8))]),function(){return"Ascending"===e.$?sR:hR}()))}return qk}()]))}),mR=r(function(e,t){return f(iR,oR(t),f(yR,t,e))}),bR=r(function(e,t){return f(VN,M([ET(jk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(mR,r,t)},t))}),CR=l(Ok,150,150,150),ER=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},SR=r(function(e,t){return f(ts,e.amount,t.amount)}),TR=n(function(e,t,r){return f(e,r,t)}),wR=function(e){var t=e.a;return(R(e.b,Lo)?Ua:TR)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(wR,L(Av,Zf),e,t):f(Ku,ER(e.state.phase),ER(t.state.phase))});case"Expires":return r(function(e,t){return f(hv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Sv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(SR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(xc,ma,l(zd,r(function(e,t){return f(Ku,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(hv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(hv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},IR=l(Ok,233,237,242),AR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),BR=function(e){return f(Kk,M([ET(jk),yT(jk),rR]),f($N,M([bN(12)]),M([fl(e.info)])))},kR=function(e){return f(xc,qk,f(Bo,BR,Ql(e)))},NR=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"}},RR=function(e){return{$:"TimeLeft",a:e}},$R=function(e){return{$:"TimeUp",a:e}},_R=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 Vl(0)}}),LR=r(function(e,t){return Vl(jd(e)-jd(t))}),xR=r(function(e,t){var r=f(_R,t.state.phase,t),n=f(LR,e,t.state.phaseStartTime),a=f(LR,r,n);return jd(a)>0?RR(L(a,r)):$R(r)}),PR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},DR=l(pA,0,0,0),UR=l(Ok,51,183,2),OR=function(e){var t=ju(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Qo(n));return n+(function(){if(a){return f(ru,a+1,f(Zo,1,mw(r)))}return""}()+"%")},MR=r(function(e,t){return uR({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"}()})}),FR=n(function(e,t,r){return f(dR,f(ka,yT(zk(34)),e),f(MR,t,r))}),VR=r(function(e,t){var r=OR(t);if("0%"===r)return f(Kk,M([bN(16)]),fl("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?UR:EN;return f(VN,M([kN(4)]),M([l(FR,yr,a,si(i)),f(Kk,M([bA(o),bN(16)]),fl(n))]))}),KR=uR,HR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(xl,r,n,t)}),cp,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,KR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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(xc,"",f(Bo,Qa,f(fp,e,HR)))},qR=function(e){return Qo(e)<=3?e:qR(f(Td,3,e))+","+f(ou,3,e)},GR=function(e){return qR(Sd(e))},zR=function(e){return U(jR(e.fiatType),GR(e.amount))},YR=hA,WR=function(e){var t=function(){var t=f(fp,e.fiatType,HR);if("Nothing"===t.$)return qk;var r=t.a,n=(r.a,r.b);return f(dR,M([yT(zk(26))]),n)}();return f(VN,M([kN(4)]),M([t,f(Kk,M([bA(d(YR,0,0,0,.5)),gR,ET(zk(50))]),fl(e.fiatType)),fl(zR(e))]))},JR=function(e){return jd(e)<0},QR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),XR=function(e){var t=vg(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(QR,$C(t),$C(r),$C(n),$C(a))}(f(xc,L(qu(0),qu(0)),f(Ts,n,qu(60))))}(f(xc,L(qu(0),qu(0)),f(Ts,r,qu(3600))))}(f(xc,L(qu(0),qu(0)),f(Ts,t,qu(86400))))},ZR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!JR(a)){var u=r(function(e,t){return U(l(Rs,2,P("0"),Ni(e)),t)}),s=jd(a)>0?i:o,c=XR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(VN,U(M([kN(5)]),e),M([f(Kk,U(M([bA(h)]),t),fl(f(u,c.days,"d"))),f(Kk,U(M([bA(d)]),t),fl(f(u,c.hours,"h"))),f(Kk,U(M([bA(s)]),t),fl(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Vl(0);e=p,t=g,n=v,a=y}}),e$={$:"Behind"},t$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),r$=function(e){return f(t$,e$,e)},n$=r(function(e,t){var r=sv(200*e),n=200-r,a=f(Kk,M([ET(nR(n))]),qk),i=M([yT(zk(3)),cN(20)]),o=f(Kk,U(i,M([ET(nR(r)),Wk(t)])),qk),u=f(Kk,U(i,M([ET(jk),Wk(IR)])),qk);return f(VN,M([ET(jk),r$(u)]),M([o,a]))}),a$=l(pA,1,1,0),i$=r(function(e,t){return jd(e)/jd(t)}),o$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(i$,o,u),c=(f(Kk,M([wN]),d(ZR,yr,yr,L(a,i),o)),s<.1?EN:s<.2?a$:UR);return f(ON,U(M([kN(5)]),e),M([d(ZR,M([wN]),t,L(a,i),o),f(n$,1-s,c)]))}),u$=function(e){var t=wd(jl(e)),r=f(Xl,".",t);if(!r.b)return t;if(r.b.b){cl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(ru,3,t);case 1:return f(ru,4,f(xc,t,f(Bo,mw,f(Bo,function(e){return e/100},f(Bo,Ka,f(Bo,sv,f(Bo,ti(100),Bd(t))))))));default:var n=r.a;return f(xc,f(ru,n,t),f(Bo,Ni,f(Bo,sv,Bd(t))))}},s$=n(function(e,t,r){return f(iR,oR(t),function(){switch(t.$){case"Phase":var n=PR(r.state.phase),a=L(f(xR,e,r),r.state.phase);e:for(;;){if("TimeLeft"===a.a.$){if("Closed"===a.b.$)break e;var i=a.a.a,o=f(i$,i.a,i.b)<.05?EN:DR;return f(ON,M([kN(3)]),M([fl(n),d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)]))}if("Closed"===a.b.$)break e;var u=a.a.a;return f(VN,M([kN(6),bA(CR)]),M([fl(n),f(Kk,M([bN(16)]),fl("(stale)"))]))}a.b;return fl(n);case"Expires":if("Open"===r.state.phase.$){var s=f(xR,e,r);if("TimeLeft"===s.$){var i=s.a,o=f(i$,i.a,i.b)<.05?EN:DR;return d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)}var u=s.a;return d(o$,M([ET(jk)]),M([bN(16)]),L(EN,IR),L(Vl(0),u))}return qk;case"Offer":return f(VN,M([kN(5)]),M([fl(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(u$(r.parameters.tradeAmount)+" ")+NR(r.factory))]));case"FiatPrice":return WR(r.terms.price);case"Margin":var c=R(r.parameters.initiatorRole,fo);return f(xc,qk,f(Bo,VR(c),r.derived.margin));case"PaymentWindow":var l=function(){return"Seller"===r.parameters.initiatorRole.$?EN:UR}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoabortInterval);default:var l=function(){return"Seller"===r.parameters.initiatorRole.$?UR:EN}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoreleaseInterval)}}())}),c$=n(function(e,t,r){return f(ON,M([ET(jk),kN(1),Wk(IR),uN,pN(f(AR,r.factory,r.id))]),M([f(VN,M([ET(jk),kN(1)]),f(xa,function(t){return l(s$,e,t,r)},t)),f(iR,1,kR(r.terms.paymentMethods))]))}),f$=Er,l$=ZT(28),d$=function(e){return f(yA,l$,l(vA,"bc-"+mA(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(yA,iA,h(h$,"b-"+Ni(e),e,e,e,e))},g$=a(function(e,t,r,n){return f(ON,M([ET(jk),p$(2),cN(8),d$(CR),kN(2),Wk(CR),rR]),f(xa,f(c$,e,r),f(f$,wR(t.orderBy),n)))}),v$=a(function(e,t,r,n){return f(ON,M([ET(jk),yT(jk),kN(5)]),M([f(bR,t.orderBy,r),d(g$,e,t,r,n)]))}),y$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),m$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(yA,rN,h(nN,"p-"+Ni(t),t,t,t,t)):f(yA,rN,h(nN,d(y$,t,r,n,a),t,r,n,a))},b$=lA(RT.italic),C$=a(function(e,t,r,n){var a=f(qN,n.filters,ay(f(xa,function(e){return f(jN,HN(n),GN(e))},r)));return R(a,yr)?f(Kk,M([wN,bN(24),m$({bottom:0,left:0,right:0,top:30}),b$]),fl(t?"No trades found with those filters.":"Initializing Trade Cache...")):f(Yi,Ko,d(v$,e,n.tradeTable,M([xo,JN,YN,WN,QN,zN]),a))}),E$=r(function(e,t){return f(Kk,M([cN(4),Wk(d(YR,0,0,1,.1)),bA(l(Ok,16,7,234)),bN(e),vN,f(aN,15,13)]),fl(dl(t)))}),S$=function(e){return function(){var t=Gd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?qk:f(VN,M([kN(10),m$({bottom:20,left:20,right:20,top:10})]),M([f(Kk,M([bN(24),vN]),fl("Trade History for User")),f(E$,18,e.agentAddress)]))},T$=function(e){return{$:"FiltersMsg",a:e}},w$=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},I$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),A$=xI,B$={$:"Left"},k$=SN(B$),N$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(fA,UN,TT("label"),e,wT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(fA,AT,Vk,a,wT(M([i])));switch(n.$){case"Above":return d(fA,UN,TT("label"),e,wT(M([o,r])));case"Below":return d(fA,UN,TT("label"),e,wT(M([r,o])));case"OnRight":return d(fA,FN,TT("label"),e,wT(M([r,o])));default:return d(fA,FN,TT("label"),e,wT(M([o,r])))}}),R$=function(e){return{$:"Label",a:e}},$$={$:"NoAttribute"},_$=function(e){if("HiddenLabel"===e.$){var t=e.a;return NN(R$(t))}return $$},L$=function(e){return"HiddenLabel"===e.$},x$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return hu("No key matched");var n=r.a;return Fi(n)},r=f(du,t,f(Oh,"key",pu));return ST(f(dN,"keyup",r))},P$=function(e){return f(Nn,"tabIndex",Ni(e))},D$=f(Da,ST,P$),U$={$:"LivePolite"},O$=NN(U$),M$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([L$(r)?$$:kN(6),ST(hN(i(!a))),O$,x$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),D$(0),uN,k$,ET(jk)]),e);return l(N$,o,r,d(fA,AT,Vk,M([ST(f(A$,"role","checkbox")),ST(f(A$,"aria-checked",a?"true":"false")),_$(r),eR,yT(jk),ET(bT)]),wT(M([n(a)]))))}),F$=Br,V$=function(e){return e*F$/180},K$=ZT(26),H$=function(e){return{$:"MoveY",a:e}},j$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),q$=function(e){return f(j$,K$,H$(-e))},G$=ZT(24),z$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),Y$=function(e){return f(j$,G$,f(z$,x(0,0,1),e))},W$=ZT(19),J$=function(e){return Cd(M([e.inset?"box-inset":"box-",mw(e.offset.a)+"px",mw(e.offset.b)+"px",mw(e.blur)+"px",mw(e.size)+"px",mA(e.color)]))},Q$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(yA,W$,l(jI,J$(t),"box-shadow",Cw(t)))},X$=r(function(e,t){return f(yA,iA,h(h$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Z$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?p$(r):f(X$,n,r):f(yA,iA,h(h$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},e_=ZT(12),t_=f(oN,e_,RT.textCenter),r_=l(pA,1,1,1),n_=function(e){return f(Kk,M([lA("focusable"),ET(zk(14)),yT(zk(14)),bA(r_),eR,bN(9),t_,cN(3),d$(e?l(pA,59/255,.6,252/255):l(pA,211/255,211/255,211/255)),Q$({blur:1,color:e?d(YR,238/255,238/255,238/255,0):l(pA,238/255,238/255,238/255),offset:L(0,0),size:1}),Wk(e?l(pA,59/255,.6,252/255):r_),p$(e?0:1)]),e?f(Kk,M([d$(r_),yT(zk(6)),ET(zk(9)),Y$(V$(-45)),wN,eR,q$(1),Z$({bottom:2,left:2,right:0,top:0})]),qk):qk)},a_=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),i_={$:"OnRight"},o_=a_(i_),u_=r(function(e,t){return f(M$,yr,{checked:t.checked,icon:n_,label:f(o_,yr,fl(t.label)),onChange:f(I$,e,t.label)})}),s_={$:"Top"},c_=XN(s_),f_=function(e){return f(ON,M([kN(15),c_]),M([f(Kk,M([bN(28),gR]),fl(w$(e.type_))),f(ON,M([kN(5)]),f(xa,u_(e.type_),e.options))]))},l_=function(e){return f(VN,M([kN(20)]),f(xa,f_,e))},d_={$:"NoneFound"},h_={$:"AllFetched"},p_={$:"FetchingTrades"},g_={$:"QueryingNumTrades"},v_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return g_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?p_:h_}return d_},y_={$:"InFront"},m_=function(e){return f(t$,y_,e)},b_=r(function(e,t){var r=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},n=f(Eh,Ja(d_),f(xa,v_,e))?M([r("No trades found.")]):f(xa,r,mE(f(xa,function(e){switch(v_(e).$){case"QueryingNumTrades":return si("Querying "+hB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+hB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),m_(f(ON,M([kN(5),k$]),n))]),f(Kk,M([wN]),f(Yi,T$,l_(t.filters))))}),C_=n(function(e,t,r){return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),f(aN,30,20)]),M([S$(r),f(b_,t,r),function(){var n=f(Eh,f(zo,v_,Ja(h_)),t);return d(C$,e,n,t,r)}()]))}),E_=function(e){return{$:"ShowCurrencyDropdown",a:e}},S_={$:"AbortCreate"},T_=function(e){return{$:"AppCmd",a:e}},w_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),I_=function(e){return f(xa,function(e){return M([f(Kk,M([bA(EN)]),fl("Caution! ")),fl(e)])},mE(M([R(f(hv,e.autoreleaseInterval,Vl(12e5)),ba)?si(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."}()):ci,R(f(hv,e.autoabortInterval,Vl(36e5)),ba)?si(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.'}()):ci])))},A_=l(pA,0,0,1),B_=function(e){return f(Kk,M([m$({bottom:5,left:5,right:5,top:0}),pN(e),cN(30),Wk(d(YR,1,1,1,.4)),p$(1),d$(d(YR,0,0,0,.3)),uN,bN(14)]),f(Kk,M([bA(d(YR,0,0,0,.7))]),fl("x")))},k_=Bn,N_=k_,R_=ST,$_=r(function(e,t){return f(Kk,M([r$(f(Kk,M([Wk(e),R_(f(N_,"position","fixed")),R_(f(N_,"z-index","1000")),R_(f(N_,"top","0")),R_(f(N_,"left","0")),R_(f(N_,"width","100%")),R_(f(N_,"height","100%"))]),qk)),ET(jk),yT(jk)]),t)}),__=r(function(e,t){return{$:"Max",a:e,b:t}}),L_=r(function(e,t){return f(__,e,t)}),x_=n(function(e,t,r){return l(Pa,$_,d(YR,0,0,.3,.6),f(Kk,U(M([wN,eR,ET(f(L_,500,bT)),Wk(tN),cN(8),m_(f(Kk,M([PN,c_]),B_(r)))]),e),t))}),P_=r(function(e,t){if("Nothing"===t.$)return qk;var r=t.a;return f(Kk,U(M([cN(5),d$(l(pA,.9,0,0)),p$(1),Wk(l(pA,1,.4,.4)),aR(5),wN,eR,ET(f(L_,200,bT)),bN(14)]),e),f($N,yr,M([fl(r)])))}),D_={$:"Above"},U_=function(e){return f(t$,D_,e)},O_=r(function(e,t){return f(Kk,M([cN(4),f(aN,25,17),bN(18),vN,Wk(IR),U_(f(P_,M([q$(5)]),t))]),fl(e))}),M_=a(function(e,t,r,n){return d(hA,e/255,t/255,r/255,n)}),F_=d(M_,1,31,52,.64),V_=ZT(32),K_={$:"Active"},H_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),j_=$n,q_=r(function(e,t){switch(t.$){case"NoAttribute":return $$;case"Describe":var r=t.a;return NN(r);case"AlignX":var n=t.a;return SN(n);case"AlignY":var a=t.a;return XN(a);case"Width":var n=t.a;return CT(n);case"Height":var n=t.a;return vT(n);case"Class":var n=t.a,a=t.b;return f(oN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(yA,i,o);case"Nearby":var u=t.a,s=t.b;return f(t$,u,f(zi,e,s));case"Attr":var c=t.a;return ST(f(j_,e,c));default:var l=t.a,d=t.b;return f(j$,l,d)}}),G_=function(e){return f(q_,zg,e)},z_=r(function(e,t){var r=t.a,n=t.b,a=G_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(rA,n,o));default:return L(r,n)}}),Y_=function(e){var t=l(Ra,z_,L(yr,sA),e),r=t.a,n=t.b;return f(ka,qI(n),r)},W_=function(e){return f(yA,V_,f(H_,K_,Y_(e)))},J_=ZT(33),Q_={$:"Hover"},X_=function(e){return f(yA,J_,f(H_,Q_,Y_(e)))},Z_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Kk,M([cN(4),uN,pN(n),f(aN,25,17),bA(t),bN(18),vN,Wk(a),W_(M([Wk(o)])),X_(M([Wk(i)]))]),fl(r))}),eL=r(function(e,t){return d(Z_,x(d(YR,1,0,0,1),d(YR,1,0,0,.8),d(YR,1,0,0,.6)),tN,e,t)}),tL=function(e){return $_(d(YR,0,0,.3,.6))(f(ON,M([kN(10),wN,eR,Wk(d(YR,0,0,0,.5)),cN(8),aR(20)]),f(xa,function(e){return f($N,M([wN,eR,bN(20),vN,bA(tN),t_]),M([e]))},e)))},rL=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+NA(t)}e.a;return"https://kovan.etherscan.io/tx/"+NA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+NA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+NA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+NA(t)}}),nL={$:"Bottom"},aL=XN(nL),iL=lA(RT.underline),oL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(fl(u$(oC(a))),f(eL,"Yes, I definitely want to open this trade.",l(w_,r,n,a)))}return L(fl("??"),f(O_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),U(I_(n),U(M([M([fl("You will deposit "),i,fl(" "+NR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([fl("This ususally requires two Metamask signatures. Your "+NR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Kk,M([aL,wN]),o)])),S_);case"ApproveNeedsSig":var u=e.a;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),tL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","ApproveMining",0)))]),tL(M([fl("Mining the initial approve transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,eo(u),s)}),fl("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),tL(M([fl("Waiting for user signature for the create call."),fl("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","CreateMining",0)))]),tL(M([fl("Mining the final create call..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,r,s)}),fl("You will be redirected when it's mined.")])))}}),uL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return qk;var r=t.a;return f(oL,r,e)},sL=function(e){return{$:"TradeAmountChanged",a:e}},cL=dT("id"),fL=R_(cL("inputError")),lL=l(Ok,109,127,138),dL=uR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),hL=function(e){return f(dR,f(ka,yT(zk(26)),e),dL)},pL=function(e){return f(VN,M([kN(4)]),M([hL(yr),f(Kk,M([bN(24),gR,bA(lL)]),fl(NR(e)))]))},gL=function(e){return{$:"HiddenLabel",a:e}},vL=gL,yL=dT("type"),mL=function(e){return L(e,!0)},bL=function(e){return{$:"MayStopPropagation",a:e}},CL=r(function(e,t){return f(lN,e,bL(t))}),EL=r(function(e,t){return l(La,Oh,t,e)}),SL=f(EL,M(["target","value"]),pu),TL=function(e){return f(CL,"input",f(Oi,mL,f(Oi,e,SL)))},wL=ZT(0),IL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),AL=function(e){var t=function(e){return 1-e}(f(Tc,1,f(ei,0,e)));return f(yA,wL,f(IL,"transparency-"+dw(t),t))},BL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),kL=f(Da,ST,A$("autocomplete")),NL=l(pA,136/255,138/255,133/255),RL=l(pA,186/255,189/255,182/255),$L=f(aN,12,12),_L=M([$L,cN(3),d$(RL),Wk(r_),p$(1),kN(3),ET(jk)]),LL=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},xL=function(e){return f(Ch,LL,e)?$$:lA("focusable")},PL=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},DL=ye,UL=r(function(e,t){return f(kn,e,DL(t))}),OL=UL("spellcheck"),ML=f(Da,ST,OL),FL=W,VL=ZT(47),KL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(FL(e))),o=(i-1)*t+f(xc,0,f(Bo,a,r))+f(xc,0,f(Bo,a,n));return f(yA,VL,l(jI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),HL=dT("value"),jL=f(Da,ST,HL),qL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(fw,"width",n)?L(r,n):L(f(ka,e,r),f(Gm,"width",n));case"Height":e.a;return f(fw,"height",n)?L(r,n):L(f(ka,e,r),f(Gm,"height",n));case"Describe":e.a;return f(fw,"described",n)?L(r,n):L(f(ka,e,r),f(Gm,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(fw,"align-x",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-x",n));case"AlignY":return f(fw,"align-y",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-y",n));default:return f(fw,"transform",n)?L(r,n):L(f(ka,e,r),f(Gm,"transform",n))}}),L(yr,sm),e).a},GL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,qL(e))}),zL=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}},YL=f(Da,Gi,ms),WL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([ST(TL(n.onChange))]),o=U(_L,t),u=f(GL,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(ml,PL,o),c=f(GL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(GL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(GL,o,function(e){return"Nearby"===e.$})),p=f(ml,f(Da,ns,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([jL(n.text),ST(yL(a)),ML(e.spellchecked),lA(RT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return $$;var r=t.a;return kL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(zL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(BL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(BL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(xc,5,c);return x("textarea",U(M([ML(e.spellchecked),lA(RT.inputMultiline),f(xc,$$,f(Bo,kL,e.autofill)),function(){if("Nothing"===u.$)return $$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return m$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?$$:s.a?d(KL,n.text,v,u,g):$$}()]),h),M([YL(RI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(fA,AT,Vk,f(ka,ET(jk),ay(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([m_(f(Kk,f(ka,$L,U(s,U(M([bA(NL),lA(RT.noTextSelection+" "+RT.passPointerEvents),d$(d(YR,0,0,0,0)),Wk(d(YR,0,0,0,0)),yT(jk),ET(jk),AL(""===n.text?1:0)]),r))),a))])}()]))),wT(M([d(fA,AT,TT(v),ay(M([M([xL(t),_$(n.label)]),y,i])),wT(m))])));return l(N$,f(ka,f(oN,iN,RT.cursorText),f(ka,L$(n.label)?$$:kN(5),f(ka,O$,u))),n.label,b)}),JL=WL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),QL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(JL,M([ET(jk),yT(zk(40)),p$(0)]),{label:vL(r),onChange:i,placeholder:n,text:a});return f(VN,U(M([kN(5)]),e),mE(M([f(Bo,Kk(M([k$])),o),si(s),f(Bo,Kk(M([PN])),u)])))}),XL={$:"Below"},ZL=function(e){return f(t$,XL,e)},ex=function(e){return f(j$,K$,H$(e))},tx=n(function(e,t,r){return p(QL,M([ET(zk(150)),gR,bN(24),ZL(f(P_,M([fL,ex(5)]),r))]),L(ci,si(f(Kk,M([pN(T_(d(Zd,"click","misclick","dai symbol in dai input",0)))]),pL(e)))),"dai input",ci,t,sL)}),rx=Kk(M([d$(IR),Z$({bottom:2,left:0,right:0,top:0})])),nx=r(function(e,t){return f(ON,M([kN(10)]),M([f(Kk,M([bN(17),vN]),fl(e)),t]))}),ax=r(function(e,t){return rx(f(nx,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(tx,e,t.inputs.daiAmount,t.errors.daiAmount)))}),ix=function(e){return f(xc,gS,Mg(e))},ox=function(e){var t=function(){var t=vd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+u$(f(Gl,r,100))+" "+NR(ix(e.wallet))+"."}return"There is a 1% fee."}();return f(VN,M([wN,f(aN,20,10),Wk(l(Ok,10,33,108)),cN(8),kN(5),pN(T_(d(Zd,"click","misclick","fee notify element",0)))]),M([f(Kk,M([bN(18),bA(l(Ok,0,226,255)),vN]),fl(t)),f(Kk,M([bN(17),bA(tN),gR]),fl("We only collect this fee when trades resolve successfully."))]))},ux=function(e){return{$:"FiatAmountChanged",a:e}},sx=function(e){return{$:"FiatTypeChanged",a:e}},cx=r(function(e,t){return l(SS,n(function(t,r,n){return f(e,t,r)?l(xl,t,r,n):n}),cp,t)}),fx=function(e){return f(cx,r(function(t,r){return f(Qg,e,t)}),HR)},lx=uR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),dx=function(e){return f(dR,M([yT(zk(26))]),f(xc,lx,f(Bo,fu,f(fp,e,HR))))},hx=function(e){return R_(f(CL,"click",Fi(L(e,!0))))},px=YL,gx=function(e){return{$:"AppendProperty",a:e}},vx=r(function(e,t){return gx(e+":"+t)}),yx=r(function(e,t){return f(vx,e,t.value)}),mx=yx("cursor"),bx={$:"Compatible"},Cx={cursor:bx,value:"default"},Ex=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Sx=function(e){return{$:"PseudoClassSelector",a:e}},Tx=function(e){return Ex(Sx(e))}("hover"),wx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),Ix=wx,Ax=Ix,Bx=Ax("span"),kx=r(function(e,t){return f(kn,et(e),rt(t))}),Nx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),Rx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),$x=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),_x=r(function(e,t){return t<>>32-e}),Lx=function(e){var t=e.hash?e.seed^f($x,461845907,f(_x,15,f($x,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f($x,2246822507,r^r>>>16),a=f($x,3266489909,n^n>>>13);return(a^a>>>16)>>>0},xx=r(function(e,t){return f($x,5,f(_x,13,e^f($x,461845907,f(_x,15,f($x,3432918353,t)))))+3864292196}),Px=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},HP=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+"]"}},jP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,HP,r)));case"UniversalSelectorSequence":var r=e.a;return Iu(r)?"*":f(Ri,"",f(xa,HP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,HP,r)))}},qP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([KP(t),jP(r)]))},GP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,jP(t),f(xa,qP,r)),i=f(Ri,"",M([f(xc,"",f(Bo,VP,n))]));return f(oc,f(Ri," ",f(ml,f(Da,ns,_d),a)),i)},zP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,GP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,FP(a),"\n",e,"}"]))}),YP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(zP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,xP,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,OP,zP(" ")),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"}},WP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(ml,f(Da,ns,_d),M([$P(t),f(Ri,"\n",f(xa,DP,r)),f(Ri,"\n",f(xa,UP,n)),f(Ri,"\n\n",f(xa,YP,a))])))},JP=function(e){return WP(RP(BP(e)))},QP=function(e){return f(Ri,"\n\n",f(xa,JP,e))},XP=function(e){return{$:"Snippet",a:e}},ZP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),eD=function(e){return{$:"StyleBlockDeclaration",a:e}},tD=r(function(e,t){var r=l(eP,t,yr,ci);return XP(M([eD(l(ZP,r,yr,e))]))}),rD=function(e){return Iu(e)?"unstyled":f(Is,P("_"),Ps(f(Dx,15739,QP(AS(Ux(AS(f(tD,e,dP(yr)))))))))},nD=function(e){var t=rD(e),r=f(kx,"className",hl(t));return l(Nx,r,e,t)},aD=a(function(e,t,r,n){return f(e,f(ka,nD(t),r),n)}),iD=function(e){return{$:"Unstyled",a:e}},oD=function(e){return iD(Tw(e))},uD=oD,sD=r(function(e,t){return f(Tn,e,Xe(t))}),cD=function(e){return En(Xe(e))},fD=r(function(e,t){var r=e.b,n=e.c;return Iu(r)?t:l(xl,n,r,t)}),lD=function(e){return e.a},dD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,fD,i,s),p=l(Ra,hD,L(yr,h),c),g=p.a,v=p.b,o=l(JT,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,fD,i,s),m=l(Ra,hD,L(yr,h),c),g=m.a,v=m.b,o=d(cD,y,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,fD,i,s),b=l(Ra,dD,L(yr,h),c),g=b.a,v=b.b,o=l(WT,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,fD,i,s),C=l(Ra,dD,L(yr,h),c),g=C.a,v=C.b,o=d(sD,y,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),hD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,fD,n,o),c=l(Ra,hD,L(yr,s),u),h=c.a,p=c.b,a=l(JT,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,fD,n,o),v=l(Ra,hD,L(yr,s),u),h=v.a,p=v.b,a=d(cD,g,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,fD,n,o),y=l(Ra,dD,L(yr,s),u),h=y.a,p=y.b,a=l(WT,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,fD,n,o),m=l(Ra,dD,L(yr,s),u),h=m.a,p=m.b,a=d(sD,g,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p)}}),pD=r(function(e,t){return h(Nl,kl,e,t,Rl,Rl)}),gD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(_d(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),vD=function(e){var t=f(gD,ci,e);if("Nothing"===t.$)return cp;var r=t.a,n=r.a,a=r.b;return f(pD,n,a)},yD=function(e){return{$:"ClassSelector",a:e}},mD=function(e){var t=e.a,r=e.b;return f(tD,r,dP(M([yD(t)])))},bD=function(e){return QP(AS(Ux(f(xa,mD,Ia(e)))))},CD=function(e){return l(JT,"style",yr,AS(Tw(bD(e))))},ED=n(function(e,t,r){var n=f(xa,lD,t),a=vD(t),i=l(Ra,hD,L(yr,a),r),o=i.a,u=i.b,s=CD(u);return l(JT,e,n,f(ka,s,$a(o)))}),SD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),TD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(SD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),wD=r(function(e,t){return L(f(TD,"_",t),CD(e))}),ID=n(function(e,t,r){var n=f(xa,lD,t),a=vD(t),i=l(Ra,dD,L(yr,a),r),o=i.a,u=i.b,s=f(wD,u,o);return l(WT,e,n,f(ka,s,$a(o)))}),AD=a(function(e,t,r,n){var a=f(xa,lD,r),i=vD(r),o=l(Ra,dD,L(yr,i),n),u=o.a,s=o.b,c=f(wD,s,u);return d(sD,e,t,a,f(ka,c,$a(u)))}),BD=a(function(e,t,r,n){var a=f(xa,lD,r),i=vD(r),o=l(Ra,hD,L(yr,i),n),u=o.a,s=o.b,c=CD(s);return d(cD,e,t,a,f(ka,c,$a(u)))}),kD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(ED,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(BD,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(ID,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(AD,a,t,r,n)}},ND=kD,RD=function(e){return px(ND(d(aD,Bx,M([Tx(M([mx(Cx)]))]),yr,M([uD(e)]))))},$D=J,_D=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),LD=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),xD=function(e){return l(La,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 si(h(_D,n,a,i,o,u))}return ci}(),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 si(l(LD,a,t,i))}return ci}())}),L(ci,ci),e)},PD=r(function(e,t){var r=xD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),e))),wT(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?si(m$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),U(e,M([h]))))),wT(t))}var p=-s/2,g=-u/2;return d(fA,AT,Vk,e,wT(M([d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ST(f(N_,"margin",mw(p)+"px "+mw(g)+"px")),f(ka,ST(f(N_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,ST(f(N_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(yA,IN,l(AN,o,u,s)),yr))))),wT(t))])))}),DD=i(function(e,t,r,n,a){var i=f(JL,M([ET(zk(80)),yT(zk(40)),bN(24),gR,d$(IR),hx(r)]),{label:vL("currency type"),onChange:f(zo,$D,n),placeholder:ci,text:t}),o=f(fp,t,HR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return qk;r.b;return f(PD,M([ET(zk(350)),d$(DR),p$(1),Wk(tN),aR(10),wN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(VN,M([ET(zk(80)),kN(9),f(aN,0,5),hx(n(t)),X_(M([Wk(l(pA,.8,.8,1))]))]),M([f(dR,M([yT(zk(26))]),a),f(Kk,M([bN(16),vN]),RD(t))]))},Ia(fx(t))))}return qk}();return f(VN,M([kN(4),ZL(u)]),M([f(Kk,M([pN(a)]),dx(t)),i]))}),UD=i(function(e,t,r,n,a){var i=T_(d(Zd,"click","misclick","currency flag",0)),o=f(Kk,M([pN(T_(d(Zd,"click","misclick","currency symbol",0)))]),fl(jR(e))),u=f(Kk,M([ZL(f(P_,M([fL,ex(5)]),a))]),h(DD,r,e,E_(!0),sx,i));return p(QL,M([ET(zk(250)),gR,bN(24),ZL(f(P_,M([fL,ex(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,ux)}),OD=function(e){return rx(f(nx,"For fiat",h(UD,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},MD=function(e){return{$:"ChangeRole",a:e}},FD=d(M_,1,31,52,.13),VD=r(function(e,t){var r=M([bN(24),gR,uN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([bA(FD)]))):L(U(r,M([bA(FD)])),r)}(),a=n.a,i=n.b;return f(VN,M([kN(20)]),M([f(Kk,U(M([pN(MD(lo))]),i),fl("Sell "+e)),f(Kk,U(M([pN(MD(fo))]),a),fl("Buy "+e))]))}),KD=r(function(e,t){return f(nx,"Trade Type",f(VD,NR(e),t.inputs.userRole))}),HD=Q$({blur:20,color:d(M_,0,0,0,.04),offset:L(0,3),size:0}),jD=f(oN,IN,RT.spaceEvenly),qD=function(e){var t=ix(e.wallet);return f(ON,M([ET(jk),kN(20),Wk(tN),cN(5),aR(20),HD]),M([f(VN,M([ET(jk),jD]),M([f(KD,t,e),f(ax,t,e),OD(e)])),ox(e)]))},GD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),zD={$:"Web3Connect"},YD=function(e){return f(Kk,M([wN]),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(eL,"Open Trade",f(GD,n,r))}t.b;return f(O_,"Unsupported Network",ci)}t.a;return f(eL,"Connect to Wallet",zD)}())},WD=function(e){return{$:"AutoabortIntervalChanged",a:e}},JD=function(e){return{$:"ChangePaymentMethodText",a:e}},QD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),XD=QD,ZD=function(e){return f(XD,M([bA(d(YR,0,0,0,.2))]),function(){return fl("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")}())},eU={$:"TextArea"},tU=r(function(e,t){return l(WL,{autofill:ci,spellchecked:t.spellcheck,type_:eU},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),rU=n(function(e,t,r){var n=f(Kk,M([bN(22),vN]),fl("Payment Method")),a=f(tU,M([ET(jk),yT(zk(150)),Wk(d(M_,155,203,255,.2)),p$(0)]),{label:vL("payment method"),onChange:JD,placeholder:""===r?si(ZD(t)):ci,spellcheck:!0,text:r});return f(ON,M([kN(20),m$({bottom:15,left:45,right:45,top:0}),ET(jk),U_(f(P_,M([fL,ex(30),aR(10),bN(20),ET(zk(400))]),e))]),M([n,a]))}),nU=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."},aU=a(function(e,t,r,n){var a=l(Rs,e,P("0"),Ni(n));return f(Kk,M([bN(22),bA(t)]),fl(U(a,r)))}),iU=function(e){return jd(e)<0?Vl(0):e},oU=n(function(e,t,n){var a=r(function(e,r){return f(ON,M([kN(4)]),M([f(Kk,M([aR(4),uN,pN(n(f(qb,t,e)))]),f(dR,M([yT(zk(10))]),hR)),r,f(Kk,M([aR(4),uN,pN(n(function(e){return jd(e)?e:Vl(3e5)}(iU(f(LR,t,e)))))]),f(dR,M([yT(zk(10))]),sR))]))}),i=XR(t);return f(VN,M([jD,kN(10)]),M([f(a,Vl(864e5),d(aU,3,e," days",i.days)),f(a,Vl(36e5),d(aU,2,e," hours",i.hours)),f(a,Vl(3e5),d(aU,2,e," min",i.min))]))}),uU=o(function(e,t,r,n,a,i){var o=f(Kk,M([Wk(d(M_,155,203,255,.2)),cN(5),aR(15),U_(f(P_,M([fL]),a))]),l(oU,DR,n,i)),u=f(VN,M([kN(30)]),M([f(dR,M([yT(zk(40)),pN(T_(d(Zd,"click","misclick","symbol for "+t,0)))]),e),f(Kk,M([bN(22),vN]),fl(t))])),s=f($N,M([bN(17),gR,bA(F_)]),M([fl(r)]));return f(ON,M([ET(jk),cN(10),Wk(l(Ok,237,237,237)),kN(2)]),f(xa,Kk(M([Wk(tN),f(aN,45,18),ET(jk)])),M([u,f(VN,M([ET(jk),kN(25),Wk(tN)]),M([o,s]))])))}),sU=uR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),cU=f(oN,tR,RT.clipX),fU=f(oN,tR,RT.clipY),lU=i(function(e,t,r,n,a){return f(ON,M([kN(15),cN(8),cU,fU,Wk(tN)]),M([p(uU,sU,"Payment Window",nU(a),r,n,WD),l(rU,t,a,e)]))}),dU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},hU=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."},pU=uR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),gU=n(function(e,t,r){return f(Kk,M([cN(8),cU,fU,Wk(tN)]),p(uU,pU,"Burn/Release Window",hU(r),e,t,dU))}),vU=function(e){return{$:"AutorecallIntervalChanged",a:e}},yU=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."},mU=uR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),bU=n(function(e,t,r){return f(Kk,M([cN(8),Wk(tN),cU,fU]),p(uU,mU,"Open Window",yU(r),e,t,vU))}),CU=function(e){return f(ON,M([ET(jk),kN(20)]),M([l(bU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(lU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(gU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},EU=function(e){return f(ON,M([ET(f(L_,1e3,jk)),wN,kN(20),m$({bottom:30,left:40,right:40,top:0}),pN(E_(!1)),m_(uL(e))]),M([qD(e),CU(e),YD(e.wallet)]))},SU=As(vb(8226)),TU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),wU=r(function(e,t){return l(Ra,ka,t,e)}),IU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(wU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),AU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(wU,f(lc,e%r,t),l(IU,yr,e/r|0,t))):f(lc,e,t)}),BU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(fw,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(Gm,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),kU=function(e){return d(BU,Ua,sm,e,yr)},NU=r(function(e,t){return f(Kk,M([ET(jk),m_(f(VN,M([kN(3),ET(nR(100)),ET(t),rR]),f(TU,f(Kk,M([bA(d(YR,0,0,0,.1)),bN(14)]),fl(SU)),f(xa,f(Da,Kk(M([bA(d(YR,0,0,0,.2))])),fl),f(AU,100,(e?$a:Ua)(kU(f(xa,f(zo,fu,Qa),Ia(HR)))))))))]),fl(" "))}),RU=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e))))),wT(M([n])))}),$U=function(){var e=f(Da,Kk(M([bA(l(pA,.8,.2,.2))])),fl),t=f(Da,Kk(M([_N])),fl);return f(ON,M([ET(jk),yT(jk),Wk(tN),cN(6),kN(50),Q$({blur:20,color:d(M_,0,0,0,.1),offset:L(0,3),size:0}),cN(10),aR(20)]),M([f(NU,!1,jk),f(ON,M([wN,ET(f(L_,700,jk)),kN(20)]),M([f($N,M([bN(70),_N,wN,t_]),M([fl("DAI"),e("Hard")])),f(VN,M([bN(30),vN,wN,t_,b$]),M([fl("The "),e("Global"),fl(", "),e("Unkillable"),fl(" Crypto Gateway")]))])),f(VN,M([Wk(CR),kN(2),wN,c_,ET(jk)]),M([f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([kN(60),PN]),M([f(Kk,M([bN(40),vN,wN]),fl("Want to learn more?")),f(ON,M([kN(15)]),M([f(RU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(A_),bA(tN),_N,bN(24),wN]),{label:f($N,M([t_]),M([fl("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"}),f(RU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(A_),bA(tN),_N,bN(24),wN]),{label:f($N,M([t_]),M([fl("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})]))]))),f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([k$,kN(60)]),M([f(Kk,M([bN(40),vN,wN]),fl("Ready to try it out?")),f(ON,M([kN(10),ET(zk(400)),wN]),M([f($N,M([bN(24),ET(jk)]),M([fl("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f($N,M([bN(24),ET(jk)]),M([fl("Then follow the links at the top of this page to browse "),t("Sell Offers"),fl(", browse "),t("Buy Offers"),fl(", or "),t("Create Your Own Offer"),fl(".")]))]))])))])),f(Kk,M([aL,ET(jk)]),f(NU,!0,jk))]))}(),_U=r(function(e,t){return f(Ay,f(zo,function(e){return e.type_},Ja(e)),t)}),LU=function(e){return{$:"ShowCurrencyDropdown",a:e}},xU=r(function(e,t){return ml(t(e))}),PU=i(function(e,t,r,n,a){var i=l(xU,e,a.filterFunc,ay(f(xa,GN,n)));return R(i,yr)?f(Kk,M([wN,bN(24),m$({bottom:0,left:0,right:0,top:30}),b$]),fl(r?"No trades found with those filters.":"Initializing Trade Cache...")):f(Yi,Rv,d(v$,e,a.tradeTable,M([t?Av:xo,JN,YN,WN,QN,zN]),i))}),DU=function(e){return{$:"FiltersMsg",a:e}},UU={$:"ApplyInputs"},OU=UL("disabled"),MU=function(e){return{$:"MayPreventDefault",a:e}},FU=r(function(e,t){return f(lN,e,MU(t))}),VU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):hu("Not the enter key")},n=f(du,r,f(Oh,"key",pu));return ST(f(FU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),KU=function(e){return f(VU,"Enter",e)},HU={$:"Button"},jU=r(function(e,t){var r=t.onPress,n=t.label;return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY+" "+RT.seButton+" "+RT.noTextSelection),f(ka,uN,f(ka,xL(e),f(ka,NN(HU),f(ka,ST(P$(0)),function(){if("Nothing"===r.$)return f(ka,ST(OU(!0)),e);var t=r.a;return f(ka,pN(t),f(ka,KU(t),e))}()))))))),wT(M([n])))}),qU=f(jU,M([Wk(A_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Apply")),onPress:si(UU)}),GU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(yA,sN,l(jI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},zU=function(e){return f(dN,"focus",Fi(e))},YU=f(Da,ST,zU),WU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([YU(e(!0)),hx(e(!0))])}();return f(VN,U(e,M([yT(zk(40)),Q$({blur:20,color:d(M_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Kk,M([Wk(IR),yT(zk(40)),GU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Kk,M([eR,f(aN,10,0)]),r)),f(JL,U(s,U(t,M([ET(zk(100)),yT(zk(40)),d$(IR),GU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),Z$({bottom:1,left:0,right:1,top:1})]))),{label:vL(n),onChange:u,placeholder:i,text:a})]))}),JU=function(e){return{$:"MaxDaiChanged",a:e}},QU=function(e){return{$:"MinDaiChanged",a:e}},XU=r(function(e,t){return f(ON,M([ET(jk),kN(8)]),M([f(Kk,M([bN(17),gR]),fl(e)),t]))}),ZU=ZT(25),eO=function(e){return{$:"MoveX",a:e}},tO=function(e){return f(j$,ZU,eO(-e))},rO={$:"OnLeft"},nO=function(e){return f(t$,rO,e)},aO=n(function(e,t,r){var n=hL(M([eR])),a=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("max"))])),i=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("min"))]));return f(XU,"Dai Range",f(ON,M([kN(5),ET(zk(200))]),M([v(WU,M([nO(f(P_,M([tO(5),ET(zk(200))]),r.minDai))]),M([YU(LU(!1))]),i,"min Dai",e,ci,ci,QU),v(WU,M([nO(f(P_,M([tO(5),ET(zk(200))]),r.maxDai))]),M([YU(LU(!1))]),a,"max Dai",t,ci,ci,JU)])))}),iO=function(e){var t=f(fp,e,HR);if("Nothing"===t.$)return fl("*");var r=t.a,n=r.b;return f(dR,M([yT(zk(26))]),n)},oO=function(e){return{$:"AppCmd",a:e}},uO=function(e){return{$:"FiatTypeInputChanged",a:e}},sO=n(function(e,t,r){var n=oO(d(Zd,"click","misclick","currency flag",0)),a=iO(t);f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("max"))])),f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("min"))]));return f(Kk,M([c_,ET(zk(120))]),f(XU,"Fiat Type",h(DD,e,t,LU(!0),uO,n)))}),cO={$:"AddSearchTerm"},fO=function(e){return{$:"PaymentMethodInputChanged",a:e}},lO=f(Oh,"keyCode",CE),dO=function(e){return f(dN,"keyup",f(du,function(t){return 13===t?Fi(e):hu(Ni(t))},lO))},hO=function(e){return f(XU,"Search Payment Methods",f(JL,M([c_,ET(zk(250)),yT(zk(40)),d$(IR),Q$({blur:20,color:d(M_,233,237,242,.05),offset:L(0,3),size:0}),R_(dO(cO))]),{label:vL("payment methods search"),onChange:fO,placeholder:ci,text:e}))},pO={$:"ResetSearch"},gO=f(jU,M([Wk(A_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Reset")),onPress:si(pO)}),vO=function(e){return{$:"RemoveTerm",a:e}},yO=function(e){return f(Kk,M([aR(3),c_,uN,pN(vO(e)),bN(10),bA(EN)]),fl("x"))},mO=function(e){if(e.b){var t=e;return f(VN,M([ET(jk),aR(10),kN(10)]),f(xa,function(e){return f(VN,M([Wk(d(M_,16,7,234,.2)),cN(5),aR(4),kN(3)]),M([fl(e),yO(e)]))},t))}return qk},bO=i(function(e,t,r,n,a){var i=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},o=f(Eh,Ja(d_),f(xa,v_,e))?M([i("No trades found.")]):f(xa,i,mE(f(xa,function(e){switch(v_(e).$){case"QueryingNumTrades":return si("Querying "+hB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+hB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),m_(f(ON,M([kN(5),k$]),o))]),f(VN,M([wN,kN(50)]),M([f(Yi,DU,l_(t)),f(VN,M([ET(bT),kN(10)]),M([f(Kk,M([ET(bT),c_]),l(aO,r.minDai,r.maxDai,n)),f(Kk,M([ET(bT),c_]),l(sO,a,r.fiatType,n)),f(ON,M([ET(bT),c_,kN(5)]),M([hO(r.paymentMethod),mO(r.paymentMethodTerms)])),f(XU," ",f(ON,M([kN(5),ET(bT)]),M([qU,gO])))]))])))}),CO=n(function(e,t,r){var n=f(Eh,f(zo,v_,Ja(h_)),t),a=function(){return!f(xc,0,f(Bo,function(e){return f(MS,function(e){return e.checked&&"Open"!==e.label},e.options)},f(_U,Eo,r.filters)))}();return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),pN(LU(!1)),aR(30)]),M([f(VN,M([ET(jk),kN(10)]),M([h(bO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),h(PU,e,a,n,t,r)]))}),EO=function(e){return{$:"MessageInputChanged",a:e}},SO={$:"MessageSubmit"},TO=function(e){return f(ON,M([ET(jk),kN(10)]),M([f(tU,M([ET(jk),yT(zk(100))]),{label:vL("messageInput"),onChange:EO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(jU,M([wN,bN(24)]),{label:fl("Submit"),onPress:si(SO)})]))},wO=f(oN,tR,RT.scrollbarsY),IO=r(function(e,t){return f(Kk,M([yT(jk),ET(jk)]),f(Kk,U(M([R_(f(N_,"position","absolute")),R_(f(N_,"top","0")),R_(f(N_,"right","0")),R_(f(N_,"bottom","0")),R_(f(N_,"left","0")),wO]),e),t))}),AO=l(Ok,200,205,210),BO=n(function(e,t,r){var n=M([PN,Wk(A_),bA(tN),GU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([k$,Wk(AO),bA(DR),GU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Kk,U(M([aR(7)]),u),f($N,yr,M([fl(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(pA,0,0,1),tN,"Initiator opened the trade"));case"Recalled":return si(x(l(pA,0,0,1),tN,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(ru,8,dl(t))+"..";return si(x(l(pA,1,0,1),tN,r+" committed to the trade"));case"Aborted":return si(x(l(pA,1,0,0),tN,"Buyer aborted the trade"));case"Claimed":return si(x(l(pA,0,1,0),tN,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(pA,0,0,1),tN,"Seller released the "+NR(e)+" and closed the contract"));default:return si(x(l(pA,0,0,1),tN,"Seller burned the "+NR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return qk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Kk,M([cN(3),p$(1),d$(l(pA,1,0,1)),wN,Wk(h)]),f($N,M([bA(p)]),M([fl(g)])))}),kO=n(function(e,t,r){if(r.b){var n=r;return f(IO,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),aR(10)]),f(ON,M([ET(jk),yT(jk),kN(10)]),f(xa,f(BO,e,t),n)))}return f(Kk,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),wN,bA(l(pA,.5,.5,.5)),b$]),fl("no messages found."))}),NO=Cr,RO=function(e){return f(ON,M([ET(jk),yT(jk),kN(10),p$(1),cN(5),aR(20)]),M([l(kO,e.trade.factory,e.userRole,f(NO,function(e){return e.blocknum},Sa(e.history))),TO(e)]))},$O=function(e){return f(Kk,M([Wk(tN),cN(8),HD,ET(jk),yT(jk)]),RO(e))},_O={$:"ToggleChat"},LO=function(e){if(e.showChatHistory){var t=f(xc,qk,f(Bo,$O,e.chatHistoryModel));return f(Kk,M([yT(jk),ET(zk(500)),aR(20),PN]),l(x_,M([yT(jk),ET(jk)]),f(Yi,jE,t),_O))}return qk},xO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},PO=function(e){return zR(e)+" "+e.fiatType},DO={$:"AbortAction"},UO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),OO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return qk}if("LoadedTrade"!==t.b.$)return qk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=PO(n.terms.price),u=u$(oC(i)),s=u$(n.parameters.tradeAmount)+" "+NR(n.factory),c=function(){return"Buyer"===xO(n.parameters).$?L(f(Kk,M([gR,bA(DR)]),fl("buyer")),M([fl("pay the seller "),f(Kk,M([bA(A_)]),fl(o)),fl(" in exchange for the "),f(Kk,M([bA(A_)]),fl(s)),fl(" held in this contract.")])):L(f(Kk,M([gR,bA(DR)]),fl("seller")),M([fl("accept "),f(Kk,M([bA(A_)]),fl(o)),fl(" from the buyer in exchange for the "),f(Kk,M([bA(A_)]),fl(s)),fl(" held in this contract.")]))}(),d=c.a,h=c.b;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),U(M([U(M([fl("You will deposit "),f(Kk,M([bA(A_)]),fl(u+" "+NR(n.factory))),fl(", thereby becoming the "),d,fl(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([fl("(This ususally requires two Metamask signatures. Your "+NR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Kk,M([aL,wN]),f(eL,"Yes, I definitely want to commit to this trade.",l(UO,n,a,i)))])),DO);case"ApproveNeedsSig":return tL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return tL(M([fl("Mining the initial approve transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,n.factory,p)}),fl("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return tL(M([fl("Waiting for user signature for the final commit call."),fl("(check Metamask!)"),fl("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return tL(M([fl("Mining the final commit transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction"),url:f(rL,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([fl('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 '+NR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([fl("Aborting will incur a small penalty on both parties, and refund the rest of the "+NR(n.factory)+".")])]);case"Release":return M([M([fl("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([fl("This will destroy the "+NR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Kk,M([aL,wN]),function(e){return f(eL,e,sS(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 "+NR(n.factory)+".";default:return"I understand. Burn the "+NR(n.factory)+"."}}()))])),DO);case"ActionNeedsSig":var g=r.a;return tL(M([fl("Waiting for user signature for the "+fS(g)+" call."),fl("(check Metamask!)")]));default:var g=r.a,p=r.b;return qk}},MO=VN(M([ET(jk),Wk(tN),cN(5),aR(20),jD,HD])),FO=function(e){return f(VN,M([kN(8)]),M([f(dR,yr,dL),f(Kk,M([bN(24),gR]),fl(u$(e)))]))},VO=r(function(e,t){var r=f(Io,Ao(e),f(Bo,function(e){return e.address},Gd(t)));return f(nx,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"}(),FO(e.parameters.tradeAmount))}),KO=function(e){return f(VN,M([kN(5)]),M([dx(e.fiatType),f(Kk,M([bN(24),gR]),fl(PO(e)))]))},HO=function(e){return f(nx,"For Fiat",KO(e.terms.price))},jO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},qO=l(Ok,250,165,22),GO=l(Ok,255,0,0),zO=l(Ok,0,255,0),YO=uR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),WO=uR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),JO=uR({description:"released",src:"/DAIHard/static/img/released.svg"}),QO={$:"ToggleStatsModal"},XO=function(e){return f(NO,Ua,e)},ZO=n(function(e,t,n){var a=ay(f(xa,function(e){return f(ml,function(e){return R(f(ko,e,n),si(t))},f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(fh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(fh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wl,amountReleased:Wl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,Vl,Ql(XO(f(US,function(e){return function(e){return e?si(e):ci}(jd(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}}),eM=r(function(e,t){return d(Z_,x(d(YR,0,0,1,1),d(YR,0,0,1,.8),d(YR,0,0,1,.6)),tN,e,t)}),tM=function(e){return{$:"ViewUserHistory",a:e}},rM=f(JB,0,yr),nM=f(oN,gN,RT.textNormalWeight),aM=r(function(e,t){return Za(e/t)}),iM=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}}),oM=r(function(e,t){var r=e.a,n=e.b;return l(iM,r,f(aM,jd(t),6e4),n)}),uM=r(function(e,t){return f(_s,24,f(aM,f(oM,e,t),60))}),sM=r(function(e,t){return f(_s,1e3,jd(t))}),cM=r(function(e,t){return f(_s,60,f(oM,e,t))}),fM={$:"Apr"},lM={$:"Aug"},dM={$:"Dec"},hM={$:"Feb"},pM={$:"Jan"},gM={$:"Jul"},vM={$:"Jun"},yM={$:"Mar"},mM={$:"May"},bM={$:"Nov"},CM={$:"Oct"},EM={$:"Sep"},SM=function(e){var t=f(aM,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)}},TM=r(function(e,t){switch(SM(f(oM,e,t)).month){case 1:return pM;case 2:return hM;case 3:return yM;case 4:return fM;case 5:return mM;case 6:return vM;case 7:return gM;case 8:return lM;case 9:return EM;case 10:return CM;case 11:return bM;default:return dM}}),wM=r(function(e,t){return f(_s,60,f(aM,jd(t),1e3))}),IM={$:"Fri"},AM={$:"Mon"},BM={$:"Sat"},kM={$:"Sun"},NM={$:"Thu"},RM={$:"Tue"},$M={$:"Wed"},_M=r(function(e,t){switch(f(_s,7,f(aM,f(oM,e,t),1440))){case 0:return NM;case 1:return IM;case 2:return BM;case 3:return kM;case 4:return AM;case 5:return RM;default:return $M}}),LM=n(function(e,t,r){return e.toAmPm(f(uM,t,r))}),xM=r(function(e,t){return SM(f(oM,e,t)).day}),PM=xM,DM=M([kM,AM,RM,$M,NM,IM,BM]),UM=r(function(e,t){return function(e){return e.a}(f(xc,L(0,kM),Ql(f(ml,function(r){return R(r.b,f(_M,e,t))},f(Bi,r(function(e,t){return L(e,t)}),DM)))))}),OM=function(e){return l(Ra,Na,0,e)},MM=r(function(e,t){return SM(f(oM,e,t)).year}),FM=function(e){return!f(_s,4,e)&&(!!f(_s,100,e)||!f(_s,400,e))},VM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return FM(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}}),KM=M([pM,hM,yM,fM,mM,vM,gM,lM,EM,CM,bM,dM]),HM=r(function(e,t){return f(xc,L(0,pM),Ql(f(ml,function(r){r.a;return R(r.b,f(TM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),KM))))}),jM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(HM,e,t))}),qM=r(function(e,t){var r=f(lc,f(jM,e,t)-1,KM);return OM(f(xa,VM(f(MM,e,t)),r))+f(PM,e,t)}),GM=r(function(e,t){return f(jM,e,t)/4|0}),zM=r(function(e,t){var r=Ni(t),n=e-Qo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),YM=function(e){return e?e<=12?e:e-12:12},WM=sv(315576e5),JM=r(function(e,t){return Vl(WM*f(MM,e,t))}),QM=r(function(e,t){var r=f(JM,e,t),n=f(UM,e,r);return 1+((f(qM,e,t)+n)/7|0)}),XM=r(function(e,t){return Ni(f(MM,e,t))}),ZM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(jM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(jM,t,r));case"MonthFixed":return f(zM,2,f(jM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(TM,t,r));case"MonthNameFull":return e.toMonthName(f(TM,t,r));case"QuarterNumber":return Ni(1+f(GM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(GM,t,r));case"DayOfMonthNumber":return Ni(f(PM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(PM,t,r));case"DayOfMonthFixed":return f(zM,2,f(PM,t,r));case"DayOfYearNumber":return Ni(f(qM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(qM,t,r));case"DayOfYearFixed":return f(zM,3,f(qM,t,r));case"DayOfWeekNumber":return Ni(f(UM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(UM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(_M,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(_M,t,r));case"WeekOfYearNumber":return Ni(f(QM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(QM,t,r));case"WeekOfYearFixed":return f(zM,2,f(QM,t,r));case"YearNumberLastTwo":return f(ou,2,f(XM,t,r));case"YearNumber":return f(XM,t,r);case"AmPmUppercase":return $D(l(LM,e,t,r));case"AmPmLowercase":return sd(l(LM,e,t,r));case"HourMilitaryNumber":return Ni(f(uM,t,r));case"HourMilitaryFixed":return f(zM,2,f(uM,t,r));case"HourNumber":return Ni(YM(f(uM,t,r)));case"HourFixed":return f(zM,2,YM(f(uM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(uM,t,r));case"HourMilitaryFromOneFixed":return f(zM,2,1+f(uM,t,r));case"MinuteNumber":return Ni(f(cM,t,r));case"MinuteFixed":return f(zM,2,f(cM,t,r));case"SecondNumber":return Ni(f(wM,t,r));case"SecondFixed":return f(zM,2,f(wM,t,r));case"MillisecondNumber":return Ni(f(sM,t,r));case"MillisecondFixed":return f(zM,3,f(sM,t,r));default:return n.a}}),eF=a(function(e,t,r,n){return f(Ri,"",f(xa,l(ZM,e,r,n),t))}),tF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),rF=function(e){return e>11?"pm":"am"},nF=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"}},aF=function(e){switch(f(_s,100,e)){case 11:case 12:case 13:return"th";default:switch(f(_s,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},iF=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"}},oF=p(tF,nF,f(zo,nF,ru(3)),iF,f(zo,iF,ru(3)),rF,aF),uF=eF(oF),sF={$:"MonthNameFull"},cF=sF,fF=function(e){return{$:"Text",a:e}},lF=fF,dF={$:"YearNumber"},hF=dF,pF=n(function(e,t,n){var a=r(function(e,t){return f(ON,M([bN(18),kN(6)]),M([f(Kk,M([_N]),fl(e)),f(Kk,M([nM]),fl(t))]))}),i=uF(M([cF,lF(", "),hF])),o=f(ON,M([kN(23),ET(jk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,rM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+u$(n.amountReleased)+" "+NR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+u$(n.amountBurned)+" "+NR(e)+" Burned")])),M([f(Kk,M([wN]),f(eM,"View User History",tM(n.asRole)))])));return f(ON,M([cN(8),cU,fU,Wk(IR),kN(1),Q$({blur:20,color:d(YR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Kk,M([ET(jk),Wk(tN),aR(17)]),f(E$,18,t)),f(Kk,M([ET(jk),Wk(tN),aR(17)]),o)]))}),gF=n(function(e,t,r){var n=l(ZO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=jO(e.parameters.initiatorRole)+" Stats";return f(Kk,r?M([ZL(f(Kk,M([ex(30),PN]),l(pF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(nx,a,f(VN,M([ET(jk),kN(20),uN,pN(QO)]),f(xa,VN(M([kN(5)])),M([M([f(dR,M([yT(zk(28))]),JO),f(Kk,M([bN(24),gR,bA(zO)]),fl(l(Rs,2,P("0"),Ni(n.numReleases))))]),M([f(dR,M([yT(zk(28))]),YO),f(Kk,M([bN(24),gR,bA(qO)]),fl(l(Rs,2,P("0"),Ni(n.numAborts))))]),M([f(dR,M([yT(zk(28))]),WO),f(Kk,M([bN(24),gR,bA(GO)]),fl(l(Rs,2,P("0"),Ni(n.numBurns))))])])))))}),vF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+dl(t)}e.a;return"https://kovan.etherscan.io/address/"+dl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+dl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+dl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+dl(t)}}),yF=n(function(e,t,r){return f(dA,e,{label:fl(dl(r)),url:f(vF,t,r)})}),mF=function(e){return f(nx,"Trade Status",f(ON,M([bN(24),gR,kN(8)]),M([fl(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(yF,M([bN(12),bA(A_),iL]),e.factory,e.creationInfo.address)])))},bF=i(function(e,t,r,n,a){return MO(M([mF(t),f(VO,t,r),HO(t),l(gF,t,n,a)]))}),CF=l(Ok,9,32,107),EF=uR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),SF=f(Kk,M([cN(4),uN,pN(_O),aR(5),Wk(l(Ok,22,0,255))]),f(dR,M([ET(zk(42))]),EF)),TF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},wF=function(e){return f(ON,M([cN(12),Wk(IR),aR(15),kN(15)]),M([f(Kk,M([bN(24),vN,b$]),fl("Fiat Payment Method")),f($N,M([bN(18),yT(bT),Wk(tN),Q$({blur:5,color:d(YR,0,0,0,.2),offset:L(-3,3),size:0}),cN(3),aR(5)]),M([f(xc,f(Kk,M([bA(FD),b$]),fl("No payment methods found.")),f(Bo,fl,f(Bo,function(e){return e.info},Ql(e))))]))]))},IF={$:"Active"},AF=function(e){return{$:"ExpandPhase",a:e}},BF=M([Wk(CF),bA(tN)]),kF=r(function(e,t){return{$:"Min",a:e,b:t}}),NF=r(function(e,t){return f(kF,e,t)}),RF=function(e){return M(e?[cN(12),c_,yT(f(NF,380,bT))]:[cN(12),wN])},$F=M([Wk(tN)]),_F=uR({description:"flame",src:"/DAIHard/static/img/flame.png"}),LF=r(function(e,t){return Hl(f(ds,jl(e),jl(t)))}),xF=r(function(e,t){return d(Z_,x(d(YR,1,.6,.2,1),d(YR,1,.6,.2,.8),d(YR,1,.6,.2,.6)),tN,e,t)}),PF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),DF=function(e){return{$:"ContractActionClicked",a:e}},UF={$:"Web3Connect"},OF=n(function(e,t,r){var n=Gd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(xR,e,t).$?qk:f(VN,M([kN(8)]),function(){var e=x(t.state.phase,f(Ao,t,a.address),f(ko,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,sS,f(eM,"Remove and Refund this Trade",oS))])}break e}var r=(e.a,e.b,jl(Fb(t.parameters)));return M([f(eL,"Deposit and Commit to Trade",l(PF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(xF,"Abort Trade",GE)),f(Yi,DF,f(eL,"Confirm Payment",ZE)),SF])}e.a,e.c.a;return M([SF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(eL,"Burn it All!",XE)),f(Yi,DF,f(eM,"Release Everything",uS)),SF])}e.a,e.c.a;return M([SF])}break e;default:break e}return yr}())}return f(eL,"Connect to Wallet",UF)}),MF={$:"Finished"},FF={$:"NotStarted"},VF=r(function(e,t){var r=L(ER(t),ER(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?FF:R(n,a)?IF:MF}),KF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),HF=r(function(e,t){return l(KF,yr,e,t)}),jF=a(function(e,t,r,n){var a=u$(f(fh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+NR(r.factory),i=u$(r.parameters.tradeAmount)+" "+NR(r.factory),o=f(VN,yr,f(HF,3,f(dR,M([yT(zk(18))]),_F))),u=f(Da,Kk(M([bA(l(pA,1,0,0))])),fl),s=R(e,r.state.phase),c=f(Io,ko(r),f(Bo,function(e){return e.address},Gd(n))),d=s?tN:DR,h=$N(M([bA(d),bN(18),vN])),p=PO(r.terms.price),g=s?l(Ok,0,226,255):l(Ok,16,7,234),v=f(Da,Kk(M([bA(g)])),fl),y=u$(r.parameters.buyerDeposit)+" "+NR(r.factory),m=r.parameters.abortPunishment,b=u$(m)+" "+NR(r.factory),C=u$(f(LF,r.parameters.buyerDeposit,m))+" "+NR(r.factory),E=u$(f(LF,r.parameters.tradeAmount,m))+" "+NR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([fl("Your "),u("burnable deposit"),fl(" of "),v(y),fl(" is now held in this contract, and your offer to buy "),v(i),fl(" for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Seller by depositing the full "),v(i),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),fl(" to you.")])])):f(xa,h,M([M([fl("Your offer to sell the "),v(i),fl(" held in this contract for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),fl(" of 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),fl(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([fl("You must now pay the Seller "),v(p),fl(" via the Fiat Payment Method, "),f(Kk,M([vN]),fl("and then click ")),u("Confirm Payment"),fl(" before the payment window runs out. Use the chat to coordinate.")]),M([fl("If you abort the trade, or do not confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to you).")]),M([fl("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),fl(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([fl("Work and communicate with the Buyer to receive "),v(p),fl(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to you, "),v(C),fl(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),fl(" will be released to you.")]),M([fl("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),fl(" In this case the "),v(a),fl(" will be lost to both parties.")]),M([fl("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([fl("So, have you recieved the "),v(p),fl("? If so, you can click "),v("Release Everything"),fl(".")]),M([fl("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),fl(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([fl("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([fl("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([fl("The Seller has deposited "),v(i),fl(" into this contract, and offers to sell it for "),v(p),fl(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("If the trade is successful, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),fl(" within the payment window.")])])):f(xa,h,M([M([fl("The Buyer is offering to buy "),v(i),fl(" for "),v(p),fl(", and has deposited "),v(y),fl(" into this contract as a "),u("burnable deposit"),fl(". To become the Seller, deposit "),v(i),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("When you receive the "),v(p),fl(" from the Buyer, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can receive "),v(p),fl(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([fl("During this phase, the Buyer is expected to transfer "),v(p),fl(" to the Seller, as described in Fiat Payment Method, "),f(Kk,M([vN]),fl("and ")),u("Confirm the Payment "),fl(" before the payment window runs out. This would move the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(" amount) will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([fl("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([fl("If the Seller can verify he has received the "),v(p),fl(", he will probably release the total balance of "),v(i),fl(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),fl(".")]),M([fl("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),fl(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(ON,M([ET(jk),yT(jk),aR(20),kN(30)]),M([f(VN,M([ET(jk)]),M([f(Kk,M([bN(24),vN,bA(g),k$]),fl(T))])),f(ON,M([ET(jk),eR,kN(13)]),w),f(Kk,M([PN]),function(){switch(f(VF,r,e).$){case"Active":return l(OF,t,r,n);case"NotStarted":return f(Kk,M([bN(20),vN,b$,bA(CR)]),fl("Phase not yet started."));default:return f(Kk,M([bN(20),vN,b$]),fl("Phase no longer active."))}}())]))}),qF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},GF=uR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),zF=uR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),YF={$:"None"},WF=YF,JF=uR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),QF=function(e){switch(e.$){case"Open":return JF;case"Committed":return GF;case"Judgment":return zF;default:return WF}},XF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),ZF=a(function(e,t,r,n){return d(XF,e,t,r,n)}),eV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},tV=function(e){return function(e){return d(ZF,e.red,e.green,e.blue,e.alpha)}(eV(e))},rV=function(e){return{$:"Circle",a:e}},nV=rV,aV=d(XF,0,0,0,1),iV={$:"Flat"},oV={$:"Sharp"},uV=function(e){return{$:"Uniform",a:e}},sV=uV,cV={cap:iV,dashPattern:yr,dashPhase:0,fill:sV(aV),join:oV,thickness:2},fV=n(function(e,t,r){return D(cV,{dashPattern:e,fill:r,thickness:t})}),lV=fV(yr),dV={$:"Transparent"},hV=dV,pV=f(lV,0,hV),gV=r(function(e,t){return{$:"Shape",a:e,b:t}}),vV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},yV=function(e){return f(Da,vV,gV(e))},mV=function(e){return yV(L(e,pV))},bV=function(e){return L(-e.a,-e.b)},CV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),EV=r(function(e,t){return f(CV,bV(e(t)),t)}),SV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},TV=r(function(e,t){return{$:"Path",a:e,b:t}}),wV=kr,IV=Nr,AV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=IV(n),i=wV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},BV=function(e){return xa(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)})},kV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(BV,e,M([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 M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},RV=function(e){var t=$V(e.basic),r=SV(f(xa,AV(e),t)),n=r.a,a=r.b;return{toBottom:-f(xc,0,gI(a)),toLeft:-f(xc,0,gI(n)),toRight:f(xc,0,pI(n)),toTop:f(xc,0,pI(a))}},$V=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(kV,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(kV,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(kV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(BV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(TV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(BV,R(C,iV)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(kV,0,E);case"Group":var S=e.a;return f(BV,0,ay(f(xa,f(zo,RV,NV),S)));default:var T=e.b;return f(BV,0,NV(RV(T)))}},_V=function(e){var t=RV(e);return t.toTop+t.toBottom},LV=function(e){var t=RV(e);return L(-t.toLeft,t.toTop)},xV=function(e){var t=RV(e);return t.toLeft+t.toRight},PV=En("http://www.w3.org/2000/svg"),DV=PV("svg"),UV=Nn("height"),OV=Nn("version"),MV=Nn("width"),FV=PV("circle"),VV=PV("ellipse"),KV=PV("foreignObject"),HV=PV("g"),jV=PV("image"),qV=PV("polygon"),GV=PV("polyline"),zV=PV("rect"),YV=Tw,WV=PV("text"),JV=Nn("id"),QV=Nn("points"),XV=Nn("r"),ZV=Nn("rx"),eK=Nn("ry"),tK=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},rK=function(e){return{$:"Group",a:e}},nK=Nn("dominant-baseline"),aK=Nn("fill"),iK=Nn("fill-opacity"),oK=Nn("font-family"),uK=Nn("font-size"),sK=Nn("font-style"),cK=Nn("font-variant"),fK=Nn("font-weight"),lK=Nn("opacity"),dK=Nn("stroke"),hK=Nn("stroke-dasharray"),pK=Nn("stroke-dashoffset"),gK=Nn("stroke-linecap"),vK=Nn("stroke-linejoin"),yK=Nn("stroke-opacity"),mK=Nn("stroke-width"),bK=Nn("text-anchor"),CK=Nn("text-decoration"),EK=Nn("transform"),SK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},TK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},wK=n(function(e,t,r){return d(XF,e,t,r,1)}),IK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return sv(1e4*e)/100};return Cd(M(["rgba(",mw(i(t)),"%,",mw(i(r)),"%,",mw(i(n)),"%,",mw(function(e){return sv(1e3*e)/1e3}(a)),")"]))},AK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},BK=function(e){var t=AK(e),r=t.red,n=t.green,a=t.blue;return IK(l(wK,r,n,a))},kK=function(e){if("Uniform"===e.$){var t=e.a;return BK(t)}return"none"},NK=function(e){var t=AK(e),r=t.alpha;return mw(r)},RK=function(e){if("Uniform"===e.$){var t=e.a;return NK(t)}return"0"},$K=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},_K=function(e){var t=mw(e.scale.b),r=mw(e.scale.a),n=mw(-e.rotation/2/F$*360),a=mw(-e.shift.b),i=mw(e.shift.a);return Cd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},LK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),aK("none"),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([aK(kK(a)),iK(RK(a)),dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([aK(kK(uV(o.color))),oK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),uK(Ni(o.size)),fK(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"}}()),sK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),cK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),CK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),bK("middle"),nK("middle"),EK(_K(e))]);default:return M([EK(_K(e))])}},xK=Nn("x"),PK=Nn("y"),DK=r(function(e,t){return M([MV(mw(e)),UV(mw(t)),xK(mw(-e/2)),PK(mw(-t/2))])}),UK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([mw(t),mw(-r)]))},e))},OK=dN,MK=r(function(e,t){return f(e,t.a,t.b)}),FK=function(e){return f(xa,MK(OK),e)},VK=function(e){e:for(;;){var t=f(xc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(GV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(qV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Circle":var c=s.a;return f(FV,U(M([JV(t),XV(mw(c))]),U(LK(e),FK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(VV,U(M([JV(t),ZV(mw(d)),eK(mw(h))]),U(LK(e),FK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(zV,U(M([JV(t),ZV(mw(c)),eK(mw(c))]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(TV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(WV,U(M([JV(t)]),U(LK(e),FK(e.handlers))),M([YV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(jV,U(M([JV(t),tK(C)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(KV,U(M([JV(t)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(HV,f(ka,JV(t),U(LK(e),FK(e.handlers))),l(Ra,r(function(e,t){return f(ka,VK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:rK(M([w,I]))});e=v;continue e}}},KK=r(function(e,t){var r=e.a,n=e.b,a=mw(r),i=mw(n);return f(jT,yr,M([f(DV,M([MV(a),UV(i),OV("1.1")]),M([VK(t)]))]))}),HK=function(e){return f(KK,L(xV(e),_V(e)),f(EV,LV,e))},jK=r(function(e,t){var r=QF(e),n=function(){switch(t.$){case"NotStarted":return l(Ok,10,33,108);case"Active":return l(Ok,0,100,170);default:return l(Ok,1,129,104)}}(),a=px(HK(f(mV,sV(tV(n)),nV(50))));return f(Kk,M([wN,m_(f(dR,M([wN,eR,yT(zk(60))]),r))]),a)}),qK=function(e){var t=M([b$,vN,bN(20)]);switch(e.$){case"Active":return f(Kk,U(t,M([bA(EN)])),fl("Active"));case"NotStarted":return f(Kk,U(t,M([bA(CR)])),fl("Not Started"));default:return f(Kk,t,fl("Finished"))}},GK=n(function(e,t,r){var n=f(VF,t,e),a=function(){return"Active"===n.$?l(Ok,0,226,255):DR}(),i=f(Kk,M([bA(a),bN(20),vN,wN]),fl(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 qk;switch(n.$){case"NotStarted":return d(ZR,M([wN]),M([bN(22),gR]),L(DR,IR),f(_R,e,t));case"Active":var a=f(xR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(o$,M([wN]),M([bN(22),gR]),L(tN,IR),i)}return f(ON,M([wN,kN(10)]),M([f(Kk,M([wN]),fl(qF(e))),f(eM,"Poke",sS(iS))]));default:return f(Kk,M([yT(zk(1))]),qk)}}();return f(ON,M([aR(20),kN(10),yT(jk)]),M([f(Kk,M([c_,wN]),i),f(Kk,M([yT(jk),wN]),f(Kk,M([eR]),f(jK,e,n))),f(ON,M([kN(10),aL,wN]),M([f(Kk,M([wN]),qK(n)),o]))]))}),zK=o(function(e,t,r,n,a,i){var o=f(VF,r,t),u=f(Kk,M([aR(10),ET(jk),yT(jk)]),d(jF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Vl(0)}}(),c=l(GK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(LR,f(qb,r.state.phaseStartTime,s),i);default:Vl(0)}}(),f(Kk,M([yT(jk),ET(zk(1)),Wk(function(){return"Active"===o.$?l(pA,0,0,1):IR}())]),qk)),p=a?f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([ET(jk)]))),M([c,h,u])):f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([uN,pN(AF(t))]))),M([c]));return!e&&R(o,IF)?f(ON,M([ET(jk),kN(20),m$({bottom:20,left:0,right:0,top:0})]),M([p,wF(r.terms.paymentMethods)])):p}),YK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(VN,M([wN,cN(12),aR(30),kN(10),Wk(CF),bN(24),vN,bA(tN)]),M([fl("Trade "+TF(t.state.closedReason)),SF])):e?f(ON,M([ET(jk),kN(10)]),M([f(VN,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)])),wF(t.terms.paymentMethods)])):f(ON,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)]))}),WK=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(ON,M([ET(jk),yT(jk),kN(40)]),M([h(bF,t,i,n.wallet,r,n.showStatsModal),f(Kk,M([ET(jk),f(aN,40,0),kN(40)]),h(YK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Kk,M([wN,eR,bN(30)]),fl("Loading trade info..."));default:return f(Kk,M([wN,eR,bN(30)]),fl("Invalid trade"))}}(),M([LO(n),OO(n)]))}),JK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),QK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L($U,yr);case"CreateModel":var n=r.a;return L(f(Yi,Uy,EU(n)),yr);case"TradeModel":var a=r.a;return l(JK,Yi(Fy),xa(Yi(Fy)),d(WK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,fT,l(CO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,oT,l(C_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Kk,M([ET(jk),yT(jk),cN(10)]),n),a)}),XK=function(e){return{$:"DismissNotice",a:e}},ZK=function(e){return f(j$,ZU,eO(e))},eH=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(pA,1,1,1):l(pA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Ok,100,200,255);case"Caution":return l(Ok,255,188,0);case"Error":return l(Ok,255,70,70);default:return l(Ok,200,200,200)}}(),o=f(Kk,M([PN,c_,q$(5),ZK(5)]),B_(XK(t)));return f(Kk,M([Wk(i),cN(10),aR(8),ET(jk),p$(1),d$(d(YR,0,0,0,.15)),HD]),f(ON,M([kN(4),ET(jk)]),f(Bi,r(function(e,t){return f($N,M([ET(jk),bA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},tH=function(e){return R(e,yr)?yr:M([f(ON,M([tO(20),q$(20),kN(10),PN,aL,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,ul)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(ON,M([ZK(20),ex(100),kN(10),k$,c_,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,EB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},rH=r(function(e,t){var r=f(QK,e,t),n=r.a,a=r.b;return L(f(ON,M([r$(Jk),m_(KN(t)),ET(jk),yT(jk),aR(30)]),M([f(Kk,M([yT(zk(50))]),qk),n])),U(a,tH(t.userNotices)))}),nH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),aH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),iH={$:"AllowHover"},oH={$:"Layout"},uH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(hA,155/255,203/255,1,1),offset:L(0,0),size:3})},sH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?uH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?iH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?oH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},cH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(AT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),AT);case"Text":var a=t.a;return $I(a);default:return $I("")}}),fH=n(function(e,t,r){var n=sH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?nH(n):aH(n)}();return f(cH,a,d(fA,AT,Vk,t,wT(M([r]))))}),lH=ZT(5),dH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),hH={$:"SansSerif"},pH=function(e){return{$:"Typeface",a:e}},gH=Y,vH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",gH(sd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",gH(sd(t)));default:var t=e.a.name;return f(Ri,"-",gH(sd(t)))}}())}),yH=function(){var e=M([pH("Open Sans"),pH("Helvetica"),pH("Verdana"),hH]);return M([f(yA,Yk,l(vA,"bg-color-"+mA(d(hA,1,1,1,0)),"background-color",d(hA,1,1,1,0))),f(yA,gA,l(vA,"font-color-"+mA(d(hA,0,0,0,1)),"color",d(hA,0,0,0,1))),f(yA,yN,mN(20)),f(yA,lH,f(dH,l(Ra,vH,"font-",e),e))])}(),mH=n(function(e,t,r){var n=e.options;return l(fH,n,f(ka,lA(f(Ri," ",M([RT.root,RT.any,RT.single]))),U(yH,t)),r)}),bH=mH({options:yr}),CH=function(e){return f(yA,lH,f(dH,l(Ra,vH,"ff-",e),e))},EH=hH,SH=pH,TH=function(e){return{body:M([function(){var t=f(rH,e.screenWidth,e),r=t.a,n=t.b,a=U(M([ET(jk),yT(jk),CH(M([SH("Soleil"),EH]))]),f(xa,m_,n));return f(bH,a,r)}()]),title:"DAIHard"}},wH=Ht,IH=wH({init:OB,onUrlChange:Uk,onUrlRequest:Dk,subscriptions:Pk,update:cB,view:TH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:IH(f(du,function(e){return f(du,function(t){return f(du,function(r){return Fi({height:r,networkId:t,width:e})},f(Oh,"height",CE))},f(Oh,"networkId",CE))},f(Oh,"width",CE)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/src/Trade/State.elm b/src/Trade/State.elm index cc2b450..52f149b 100644 --- a/src/Trade/State.elm +++ b/src/Trade/State.elm @@ -475,44 +475,49 @@ update msg prevModel = _ -> prevModel.secureCommInfo - ( newChatHistoryModel, shouldDecrypt, appCmds ) = + ( maybeChatHistoryModel, firstShouldDecrypt, firstAppCmds ) = case prevModel.chatHistoryModel of Just prevChatHistoryModel -> - ChatHistory.handleNewEvent + ( Just prevChatHistoryModel, False, [] ) + + Nothing -> + tryInitChatHistory prevModel.wallet newTrade prevModel.blocknumOnInit prevModel.eventsWaitingForChatHistory + + ( ( updatedChatHistory, finalShouldDecrypt, finalAppCmds ), newEventsWaitingForChatHistory ) = + case maybeChatHistoryModel of + Just chatHistoryModel -> + ( ChatHistory.handleNewEvent decodedEventLog.blockNumber event - prevChatHistoryModel + chatHistoryModel |> (\( chModel, shouldDecrypt_, appCmds_ ) -> ( Just chModel - , shouldDecrypt_ - , appCmds_ |> List.map (AppCmd.map ChatHistoryMsg) + , shouldDecrypt_ || firstShouldDecrypt + , List.append + firstAppCmds + (List.map (AppCmd.map ChatHistoryMsg) appCmds_) ) ) + , [] + ) Nothing -> - -- chat is uninitialized; initialize if we can - tryInitChatHistory prevModel.wallet newTrade prevModel.blocknumOnInit prevModel.eventsWaitingForChatHistory - - eventsToSave = - case newChatHistoryModel of - Nothing -> - List.append + ( ( Nothing, False, firstAppCmds ) + , List.append prevModel.eventsWaitingForChatHistory [ ( decodedEventLog.blockNumber, event ) ] - - Just _ -> - [] + ) newModel = { prevModel | trade = newTrade - , chatHistoryModel = newChatHistoryModel + , chatHistoryModel = updatedChatHistory , secureCommInfo = newSecureCommInfo - , eventsWaitingForChatHistory = eventsToSave + , eventsWaitingForChatHistory = newEventsWaitingForChatHistory } cmd = - if shouldDecrypt then + if finalShouldDecrypt then tryBuildDecryptCmd newModel else @@ -527,7 +532,7 @@ update msg prevModel = |> Maybe.Extra.values |> List.map AppCmd.UserNotice ) - appCmds + finalAppCmds ) ExpandPhase phase -> From 55aafc2274a4cefdf219f015b73daf45edc0deca Mon Sep 17 00:00:00 2001 From: oglog Date: Thu, 15 Aug 2019 14:55:09 +0200 Subject: [PATCH 19/19] Mark trade as invalid internally --- docs/404.html | 2 +- docs/index.html | 2 +- ...n-b2b413098bd26a0c0948.js => main-eba4ac68919b2838e7f6.js} | 2 +- src/Trade/State.elm | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) rename docs/static/js/{main-b2b413098bd26a0c0948.js => main-eba4ac68919b2838e7f6.js} (64%) diff --git a/docs/404.html b/docs/404.html index 8986c30..5ff32e7 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 8986c30..5ff32e7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,6 +28,6 @@
- + \ No newline at end of file diff --git a/docs/static/js/main-b2b413098bd26a0c0948.js b/docs/static/js/main-eba4ac68919b2838e7f6.js similarity index 64% rename from docs/static/js/main-b2b413098bd26a0c0948.js rename to docs/static/js/main-eba4ac68919b2838e7f6.js index cc199d9..50ac6a1 100644 --- a/docs/static/js/main-b2b413098bd26a0c0948.js +++ b/docs/static/js/main-eba4ac68919b2838e7f6.js @@ -4,4 +4,4 @@ * @author Feross Aboukhadijeh * @license MIT */ -var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(bp,o,function(e){return si(Cp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,kp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,Bp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=nv(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?qg(o):jg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return nv(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Gg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Yg,zg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(zo,xa(ac),f(zo,Ms,nc))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ph,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ph,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ap)}),i.addEventListener("timeout",function(){a(Np)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Cp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(wp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Yg,zg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Yg,zg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Yg,zg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{options:t,type_:e}}),po={$:"OfferType"},go=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),vo=r(function(e,t){return f(ho,po,M([l(go,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(go,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),yo={$:"Closed"},mo={$:"Committed"},bo={$:"Judgment"},Co={$:"Open"},Eo={$:"Phase"},So=a(function(e,t,r,n){return f(ho,Eo,M([l(go,"Open",e,function(e){return R(e.state.phase,Co)}),l(go,"Committed",t,function(e){return R(e.state.phase,mo)}),l(go,"Judgment",r,function(e){return R(e.state.phase,bo)}),l(go,"Closed",n,function(e){return R(e.state.phase,yo)})]))}),To={$:"Initiator"},wo={$:"Responder"},Io=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),Ao=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(To):f(Io,function(e){return R(t,e)?si(wo):ci},e.state.responder)}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),ko=r(function(e,t){return f(Bo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(Ao,e,t))}),No={$:"Role"},Ro=n(function(e,t,r){return f(ho,No,M([l(go,"Buyer",t,function(t){return R(f(ko,t,e),si(fo))}),l(go,"Seller",r,function(t){return R(f(ko,t,e),si(lo))})]))}),$o=function(e){return{orderBy:e}},_o=$o,Lo={$:"Ascending"},xo={$:"Phase"},Po=Oe,Do=Po(yr),Uo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(So,!0,!0,!0,!1),f(vo,!0,!0),l(Ro,t,!0,!0)])),tradeTable:_o(L(xo,Lo)),wallet:e},Do)}),Oo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Mo={$:"None"},Fo=Mo,Vo=function(e){return d(Oo,e,Do,Fo,yr)},Ko=function(e){return{$:"TradeTableMsg",a:e}},Ho=function(e){return d(Oo,e,Do,Fo,yr)},jo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),qo=r(function(e,t){return f(jo,e,t)}),Go=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),zo=n(function(e,t,r){return t(e(r))}),Yo=r(function(e,t){if("None"===t.$)return Mo;var r=t.a,n=t.b,a=l(Go,f(Bo,Da(e),r.onSign),f(Bo,Da(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return L(f(zo,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(zo,t.toMsg,e)}},n))},r.onMined));return f(jo,a,n)}),Wo=function(e){return{$:"AbiDecoder",a:e}},Jo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Qo=z,Xo=Fr,Zo=r(function(e,t){return e<1?t:l(Xo,e,Qo(t),t)}),eu=Zo(64),tu=n(function(e,t,r){return L(f(Jo,e,eu(t)),r)}),ru=r(function(e,t){return e<1?"":l(Xo,0,e,t)}),nu=ru(64),au=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),iu=function(e){return-e},ou=r(function(e,t){return e<1?"":l(Xo,-e,Qo(t),t)}),uu=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(ru,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(ou,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Wo(function(t){var r=t.a,n=t.b;return f(au,f(tu,r,n),e(nu(n)))})}(),su=Hr,cu=function(e){return f(su,"0x",e)||f(su,"0X",e)?f(Zo,2,e):e},fu=function(e){return e.b},lu=r(function(e,t){var r=e.a;return f(au,fu,r(function(e){return f(Jo,e,e)}(cu(t))))}),du=Xr,hu=ae,pu=Wr,gu=function(e){return f(du,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return hu(a)},pu)},vu=f(zo,lu,gu),yu=function(e){return{$:"Magnitude",a:e}},mu=function(e){return{$:"Pos",a:e}},bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Cu=function(e){return{$:"MagnitudeNotNormalised",a:e}},Eu=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 si(n)}return ci}},Su=function(e){var t=Eu(e);return"Nothing"!==t.$&&t.a<0},Tu=function(e){return{$:"Neg",a:e}},wu={$:"Zer"},Iu=function(e){return!e.b},Au=r(function(e,t){var r=t.a;if(Iu(r))return wu;switch(e.$){case"Zero":return wu;case"Positive":return mu(t);default:return Tu(t)}}),Bu=r(function(e,t){return f(bu,e,Cu(t))}),ku=function(e){return f(La,r(function(t,r){return e(t)&&Iu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Nu=Ir,Ru=-1+f(Nu,10,7),$u=Ru+1,_u=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Lu=function(e){return e<0?f(_u,Na(-1),Lu(e+$u)):L(e/$u|0,e%$u)},xu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Lu(r+e),i=a.a,o=a.b;return f(ka,o,f(xu,i,n))}{if(!(_(e,$u)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Pu=function(e){var t=e.a;return yu(ku(f(xu,0,t)))},Du=xa(iu),Uu={$:"Negative"},Ou={$:"Positive"},Mu={$:"Zero"},Fu=function(e){switch(e.$){case"Positive":return Uu;case"Negative":return Ou;default:return Mu}},Vu=function(e){for(;;){var t=e.a,r=e.b,n=Pu(r),a=n.a;if(!Su(a))return f(Au,t,yu(a));e=f(Bu,Fu(t),Du(a))}},Ku=pr,Hu=function(e){switch(f(Ku,e,0).$){case"LT":return Uu;case"GT":return Ou;default:return Mu}},ju=function(e){return e<0?-e:e},qu=function(e){return Vu(f(bu,Hu(e),Cu(M([ju(e)]))))},Gu=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(Nu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},zu=function(e){switch(e.$){case"Zer":return wu;case"Neg":var t=e.a;return mu(t);default:return e}},Yu=function(e){return{$:"MagnitudePair",a:e}},Wu=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(ka,L(a,u),f(Wu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Wu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Wu,yr,s))}return yr}),Ju=r(function(e,t){var r=e.a,n=t.a;return Yu(f(Wu,r,n))}),Qu=function(e){switch(e.$){case"Zer":return f(Bu,Mu,yr);case"Neg":var t=e.a.a;return f(Bu,Ou,Du(t));default:var t=e.a.a;return f(Bu,Ou,t)}},Xu=r(function(e,t){var r=Qu(t),n=r.b,a=Qu(e),i=a.b,o=f(Ju,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Vu(f(bu,Ou,Cu(s)))}),Zu=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(R(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 Ta}return a.b.b?ba:f(Ku,e,t)}}),es=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},ts=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(Zu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return es(d(Zu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),rs=r(function(e,t){return R(f(ts,e,t),Ta)}),ns=K,as=r(function(e,t){return!f(rs,e,t)}),is=function(e){switch(e.$){case"Zer":return yu(yr);case"Pos":default:var t=e.a;return t}},os=r(function(e,t){var r=e.a;return Pu(Cu(f(xa,ti(t),r)))}),us=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(os,yu(n),a),u=f(us,yu(i),yu(n)),s=u.a,c=f(Xu,f(Au,Ou,o),f(Au,Ou,yu(f(ka,0,s))));return is(c)}var a=r.a;return f(os,yu(n),a)}return yu(yr)}),ss=function(e){switch(e.$){case"Zer":return Mu;case"Pos":return Ou;default:return Uu}},cs=r(function(e,t){return R(e,Mu)||R(t,Mu)?Mu:R(e,t)?Ou:Uu}),fs=r(function(e,t){return f(Au,f(cs,ss(e),ss(t)),f(us,is(e),is(t)))}),ls=function(e){switch(e.$){case"Zer":return wu;case"Pos":var t=e.a;return Tu(t);default:var t=e.a;return mu(t)}},ds=r(function(e,t){return f(Xu,e,ls(t))}),hs=qu(0),ps=a(function(e,t,r,n){if(e){var a=qu(e),i=f(fs,f(fs,a,n),t),o=f(as,i,r)?L(f(fs,a,t),f(ds,r,i)):L(hs,r),u=o.a,s=o.b,c=d(ps,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Xu,u,l),h)}return L(hs,r)}),gs=Fa(f(Va,2,Ru)),vs=n(function(e,t,r){return d(ps,f(Nu,2,gs),e,t,r)}),ys=qu(1),ms=r(function(e,t){return e}),bs=n(function(e,t,r){return l(Ra,ms(e),t,f(Ai,1,r))}),Cs=function(e){return l(bs,fs(qu($u)),ys,e)},Es=n(function(e,t,r){if(e){var n=l(vs,Cs(e),t,r),a=n.a,i=n.b,o=l(Es,e-1,i,r),u=o.a,s=o.b;return L(f(Xu,a,u),s)}return l(vs,Cs(e),t,r)}),Ss=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Ts=r(function(e,t){if(R(t,hs))return ci;var r=Ti(Ss(e))-Ti(Ss(t))+1,n=l(Es,f(ei,0,r),zu(e),zu(t)),a=n.a,i=n.b;return si(L(f(Au,f(cs,ss(e),ss(t)),is(a)),f(Au,ss(e),is(i))))}),ws=f(fs,qu(2),qu(2147483648)),Is=xr,As=function(e){return f(Is,e,"")},Bs=Pn,ks=n(function(e,t,r){return e<=0?r:l(ks,e>>1,U(t,t),1&e?U(r,t):r)}),Ns=r(function(e,t){return l(ks,e,t,"")}),Rs=n(function(e,t,r){return U(f(Ns,e-Qo(r),As(t)),r)}),$s=te,_s=Ar,Ls=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},xs=r(function(e,t){for(;;){if(t<16)return f(ka,Ls(t),e);var r=f(ka,Ls(f(_s,16,t)),e),n=t/16|0;e=r,t=n}}),Ps=function(e){return $s(e<0?f(ka,P("-"),f(xs,yr,-e)):f(xs,yr,e))},Ds=function(e){var t=f(Ts,e,ws);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=Ps(Gu(a));return R(n,qu(0))?i:U(Ds(n),l(Rs,8,P("0"),i))},Us=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,yu(yr))?"0":Ds(mu(t));default:var t=e.a;return"-"+Us(f(fs,qu(-1),e))}},Os=function(e){return l(Rs,64,P("0"),e)},Ms=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(Ps(a)),c=function(e){return U(e,n)}(Os(Ps(u)));return x(a+32+(Qo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Fs=Dr,Vs=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))))}),Ks=n(function(e,t,n){return l(Fs,r(function(t,r){return l(Vs,e,yi(t),r)}),t,n)}),Hs=function(e){return $a(l(Ks,ka,yr,e))},js=function(e){return f(Ri,"",f(xa,f(zo,Ps,f(Rs,2,P("0"))),Hs(e)))},qs=function(e){return 64-f(_s,64,e)},Gs=function(e){return U(e,f(Ns,qs(Qo(e)),"0"))},zs=function(e){return L(si(Qo(e)/2|0),Gs(e))},Ys=function(e){return L(ci,Os(e))},Ws=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Js=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"}},Qs=Ur,Xs=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(Is,P("1"),r),!0);case"1":return L(f(Is,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Is,P("0"),r),!1);case"1":return L(f(Is,P("1"),r),!0);default:break e}return L(r,!0)});return l(Qs,t,L("",!1),e).a},Zs=function(e){return l(Qs,ka,yr,e)},ec=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Zo,e,t),i=f(ka,l(Xo,0,e,t),r);e=n,t=a,r=i}}),tc=r(function(e,t){return e&&""!==t?l(ec,e,t,yr):M([t])}),rc=function(e){var t=function(){var t=Zs(Us(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(zo,Xs,f(Rs,256,P("1"))))}var r=t;return L(r,f(Rs,256,P("0")))}(),r=t.a,n=t.b;return $s(f(xa,Ws,f(tc,4,n(f(Ri,"",f(xa,Js,r))))))},nc=function(e){return{$:"Hex",a:e}},ac=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Ys(t);case"UintE":var r=e.a;return Ys(Us(r));case"IntE":var n=e.a;return Ys(rc(n));case"BoolE":return Ys(e.a?"1":"0");case"DBytesE":var a=e.a.a;return zs(a);case"BytesE":var a=e.a.a;return Ys(cu(a));case"StringE":var i=e.a;return zs(js(i));case"ListE":var o=e.a;return function(e){var t=e.a;return zs(t)}(Xt()(o));default:var i=e.a;return Ys(cu(i))}};try{var ic=Xt();Xt=function(){return ic}}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 oc=Pr,uc=function(e){return 1===Qo(e)?f(oc,"0",e):e},sc=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(ka,n,r);e=i,t=o,r=u}}}),cc=r(function(e,t){return $a(l(sc,e,t,yr))}),fc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(cc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(fc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),lc=r(function(e,t){return l(fc,0,e,t)}),dc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),hc=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 Pt(e.a)}},pc={$:"LE"},gc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,pc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,pc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,pc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,pc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,pc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,pc));case"Seq":var i=e.b;return l(vc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),vc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(gc,n,t,r);e=i,t=o,r=u}}),yc=Dt,mc=r(function(e,t){return{$:"Seq",a:e,b:t}}),bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+hc(r),i=n;e=a,t=i}}),Cc=function(e){return f(mc,f(bc,0,e),e)},Ec=function(e){return{$:"U8",a:e}},Sc=Ec,Tc=r(function(e,t){return _(e,t)<0?e:t}),wc=hr,Ic=function(e){return{$:"Bytes",a:e}},Ac=Ic,Bc=function(e){return yc(Cc(f(xa,Ac,$a(e))))},kc=Pt,Nc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Rc=function(e){return{$:"Decoder",a:e}},$c=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}}),_c=r(function(e,t){return Rc(f($c,e,t))}),Lc=Rc(Yn),xc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Pc=function(e){return{$:"Done",a:e}},Dc=function(e){return{$:"Loop",a:e}},Uc=r(function(e,t){var n=t.a;return Rc(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 Rc(r(function(t,r){return L(r,e)}))},Mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Oc(Pc($a(n))):f(Uc,function(e){return Dc(L(r-1,f(ka,e,n)))},e)}),Fc=function(e){return f(xc,yr,f(Nc,f(_c,L(kc(e),yr),Mc(Lc)),e))},Vc=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))}),Kc=r(function(e,t){return l(Vc,Bs,e,t)}),Hc=f(Ai,0,4),jc=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}}),qc=xt,Gc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),zc=function(e){return f(Gc,f(zo,qc,Bs(4294967295)),e)},Yc=r(function(e,t){return 5*t+e}),Wc=4294967295>>>32-Ha,Jc=ar,Qc=n(function(e,t,r){for(;;){var n=Wc&t>>>e,a=f(Jc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Jc,Wc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Xc=function(e){return e>>>5<<5},Zc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Xc(r))>-1?f(Jc,Wc&e,i):l(Qc,n,e,a))}),ef=r(function(e,t){var r=f(Zc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),tf=n(function(e,t,r){var n=f(Yc,e,t);return f(ef,n,r)}),rf=ir,nf=a(function(e,t,r,n){var a=Wc&t>>>e,i=f(Jc,a,n);if("SubTree"===i.$){var o=i.a,u=d(nf,e-Ha,t,r,o);return l(rf,a,za(u),n)}var s=i.a,c=l(rf,Wc&t,r,s);return l(rf,a,Ga(c),n)}),af=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,Xc(n))>-1?d(Ma,n,a,i,l(rf,Wc&e,t,o)):d(Ma,n,a,d(nf,a,e,t,i),o)}),of=n(function(e,t,r){return l(af,e,t,r)}),uf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(of,a,r,n)}),sf=Dn,cf=r(function(e,t){return l(Vc,sf,e,t)}),ff=function(e){var t=l(La,r(function(t,n){var a={d0:l(tf,0,t,e.state),d1:l(tf,1,t,e.state),d2:l(tf,2,t,e.state),d3:l(tf,3,t,e.state),d4:l(tf,4,t,e.state)},i=r(function(e,r){return d(uf,e,t,f(cf,f(jc,e,a),f(Kc,zc(f(jc,f(_s,5,e+1),a)),f(jc,f(_s,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Hc);return D(e,{state:t})},lf=L(0,0),df=function(e){return{current:lf,lfsrstate:1,state:e,x:1,y:0}},hf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},pf=L(1,0),gf=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),vf=r(function(e,t){if(e){var n=f(gf,1,t);return l(Vc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),yf=r(function(e,t){var r=f(_s,32,e/32|0),n=f(gf,r,t),a=f(_s,32,e);return f(vf,a,n)}),mf=n(function(e,t,r){var n=f(Zc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(af,e,t(a),r)}),bf=n(function(e,t,r){return l(mf,e,cf(t),r)}),Cf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(bf,a,r,n)}),Ef=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Nf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Tc,n,r),i=f(xa,function(e){return f(kf,e,g)},f(Ai,0,a)),o=Bf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(lc,i.outputLen,l(v,g,yr,i.outputLen))},Lf=function(e){return{$:"KS",a:e}},xf=function(e){var t=e.a;return Lf({config:t,inputLength:0,partial:yr,state:f(ui,25,ms(lf))})},Pf=function(e){return Rc(Wn(e))},Df=yc(Cc(yr)),Uf=r(function(e,t){var n=t.a;return Rc(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(Uf,function(e){return Pf(t)},Pf(e))}),Mf=r(function(e,t){return f(xc,Df,f(Nc,f(Of,e,kc(t)-e),t))}),Ff=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=kc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+kc(e)}),0,i),a)>-1))return Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:i}));var o=Bc(i),u=f(xc,Df,f(Nc,Pf(a),o)),s=Fc(u),c=f($f,s,n.state),d=Bf(c),h=f(Mf,a,o),p=Df,g=Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Vf=r(function(e,t){return _f(f(Ff,yc(Cc(f(xa,Sc,t))),xf(e)))}),Kf=Vf(dc),Hf=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,4,Kf(f(xa,yi,Zs(e)))))))},jf=function(e){return f(su,"0x",e)||f(su,"0X",e)?e:"0x"+e},qf=function(e){var t=e.a;return jf(t)},Gf=r(function(e,t){var r=Ms(f(xa,ac,t)),n=function(e){return U(e,r)}(cu(qf(Hf(e))));return nc(n)}),zf=function(e){return{data:si(f(Gf,"poke()",yr)),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yf=r(function(e,t){return D(t,{checked:e})}),Wf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Jf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Wf,f(zo,function(e){return e.type_},Ja(r)),function(e){return D(e,{options:l(Wf,f(zo,function(e){return e.label},Ja(n)),Yf(a),e.options)})},t)}),Qf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Xf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zf={$:"Descending"},el=function(e){return"Ascending"===e.$?Zf:Lo},tl=function(e){return d(Xf,e,Do,Fo,yr)},rl=r(function(e,t){return L(t.a,e(t.b))}),nl=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Xf,t,Do,Fo,M([da(f(Qf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(rl,el,t.orderBy):L(a,Lo);return tl(D(t,{orderBy:i}));default:return tl(t)}}),al=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},il=yn,ol=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=al(zf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(qo,a,n);return d(Oo,t,Do,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Oo,t,Do,Fo,M([da(f(Qf,o,u))]));case"FiltersMsg":var s=e.a;return Ho(D(t,{filters:f(Jf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(nl,c,t.tradeTable);return d(Oo,D(t,{tradeTable:l.model}),f(il,Ko,l.cmd),f(Yo,Ko,l.chainCmd),f(xa,Ji(Ko),l.appCmds));default:return Vo(t)}}),ul={$:"BottomRight"},sl={$:"ShouldBeImpossible"},cl=lr,fl=function(e){return qi(e)},ll=r(function(e,t){f(cl,e,t);return{align:ul,label:"unexpectedError",mainParagraphs:M([M([fl(e)])]),noticeType:sl}}),dl=function(e){var t=e.a;return jf(t)},hl=ye,pl=f(zo,dl,hl),gl=f(zo,Us,f(zo,jf,hl)),vl=f(zo,qf,hl),yl=f(zo,Ps,f(zo,jf,hl)),ml=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),bl=un,Cl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},El=function(e){return Cl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(xc,bl,r))},f(ml,function(e){e.a;return!R(e.b,ci)},e)))},Sl=function(e){return El(M([L("to",f(Bo,pl,e.to)),L("from",f(Bo,pl,e.from)),L("gas",f(Bo,yl,e.gas)),L("gasPrice",f(Bo,gl,e.gasPrice)),L("value",f(Bo,gl,e.value)),L("data",f(Bo,vl,e.data)),L("nonce",f(Bo,yl,e.nonce))]))},Tl=function(e){return{$:"TxSentry",a:e}},wl=ye,Il=r(function(e,t){return Cl(M([L("ref",wl(e)),L("txParams",t)]))}),Al=function(e){return{$:"Signing",a:e}},Bl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Al(e)}}),kl={$:"Black"},Nl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Rl={$:"RBEmpty_elm_builtin"},$l={$:"Red"},_l=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(Nl,$l,t,r,h(Nl,kl,c,f,l,d),h(Nl,kl,i,o,u,s))}return h(Nl,e,i,o,h(Nl,$l,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(Nl,$l,c,f,h(Nl,kl,g,v,y,m),h(Nl,kl,t,r,d,a))}return h(Nl,e,t,r,n,a)}),Ll=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Nl,$l,e,t,Rl,Rl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ku,e,a).$){case"LT":return h(_l,n,a,i,l(Ll,e,t,o),u);case"EQ":return h(Nl,n,a,t,o,u);default:return h(_l,n,a,i,o,l(Ll,e,t,u))}}),xl=n(function(e,t,r){var n=l(Ll,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(Nl,kl,a,i,o,u)}return n}),Pl=n(function(e,t,r){var n=e.a,a=Sl(r),i=l(xl,n.ref,f(Bl,r,t),n.txs);return L(Tl(D(n,{ref:n.ref+1,txs:i})),f(il,n.tagger,n.outPort(f(Il,n.ref,a))))}),Dl=Pl,Ul=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Do,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Dl,n,i,o))}return x(ci,Do,M([f(ll,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ol=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Ml=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Fl=function(e){return{$:"Posix",a:e}},Vl=Fl,Kl={autoabortInterval:Vl(0),autorecallInterval:Vl(0),autoreleaseInterval:Vl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Hl=function(e){return{$:"TokenValue",a:e}},jl=function(e){return e.a},ql=r(function(e,t){return f(xc,hs,f(Bo,Qa,f(Ts,e,t)))}),Gl=r(function(e,t){return Hl(f(ql,jl(e),qu(t)))}),zl=function(e){return f(Gl,e,12)},Yl=function(e){return f(Gl,e,3)},Wl=Hl(qu(0)),Jl=r(function(e,t){var r=Wl;return{abortPunishment:zl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Ql=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Xl=qr,Zl=function(e){var t=Ql(f(Xl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Qo(e)-1-r;return L(U(f(ru,r,e),f(Zo,r+1,e)),n)},ed=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 yr}}),td=function(e){var t=e.a,r=f(ed,Ja(0),t);return yu(r.b?t:yr)},rd=Z,nd=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}}}),ad=n(function(e,t,r){var n=f(nd,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(lc,e,r),l(ad,e,t,n)):yr}),id=r(function(e,t){return l(ad,e,e,t)}),od=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Bo,ka(a),r)});return f(La,t,si(yr))}(Ua),ud=function(e){return f(Bo,f(Da,td,yu),od(f(xa,f(zo,$a,f(zo,$s,rd)),f(id,7,$a(e)))))},sd=Q,cd=function(e){var t=Zs(sd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,Au(Uu),ud(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Bo,Au(Ou),ud(r))}return ci;default:var r=t;return f(Bo,Au(Ou),ud(r))}},fd=function(e){var t=function(e){return!f(_s,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(xc,0,Ql(r)))}},ld=function(e){return f(fs,e,e)},dd=qu(2),hd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ys;case"Neg":return wu;default:if(R(r,ys))return f(fs,e,t);if(fd(r)){var n=e,a=ld(t),i=f(ql,r,dd);e=n,t=a,r=i;continue e}var n=f(fs,t,e),a=ld(t),i=f(ql,f(ds,r,ys),dd);e=n,t=a,r=i;continue e}}),pd=r(function(e,t){return l(hd,ys,e,t)}),gd=function(e){if(""===e)return ci;var t=Zl(e),r=t.a,n=t.b,a=cd(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(fs,o,f(pd,qu(10),qu(i)));return si(u)},vd=function(e){return f(Bo,Hl,gd(e))},yd=jr,md=function(e){for(;;){if(f(yd,".",e))return l(Xo,0,-1,e);{if(!f(yd,"0",e))return""===e?"0":e;e=l(Xo,0,-1,e)}}},bd=f(Da,f(Rs,7,P("0")),Ni),Cd=function(e){return f(Ri,"",e)},Ed=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Cd(f(ka,Ni(n),f(xa,bd,a)))}return"0"},Sd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Ed(t);default:var t=e.a;return"-"+Ed(t)}},Td=r(function(e,t){return e<1?t:l(Xo,0,-e,t)}),wd=function(e){var t=l(Rs,18,P("0"),Sd(e)),r=f(Td,18,t)+"."+f(ou,18,t);return function(e){return""===e?"0":e}(md(r))},Id=r(function(e,t){var r=wd(t),n=Ql(f(Xl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(ru,a+1+e,r):f(ru,a,r)}),Ad=r(function(e,t){if("Nothing"===e.$)return wd(jl(t));var r=e.a;return f(Id,r,jl(t))}),Bd=ee,kd=function(e){var t=Bd(f(Ad,ci,e));if("Just"===t.$){return t.a}f(cl,"Error converting tokenValue to float: string -> float failed",e);return 0},Nd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=vd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return kd(r)<1?fi("Trade amount can't be less than 1."):li(r)},Rd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=cd(e);if("Nothing"===t.$){var r=Bd(e);return fi("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 li(n)},$d=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),_d=function(e){return""===e},Ld=function(e){return _d(e)?ci:si(e)},xd=function(e){return f($d,"You must specify a fiat type.",Ld(e))},Pd=function(e){return""===e?fi("Must specify a payment method."):li(e)},Dd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ud=g(Dd,ci,ci,ci,ci,ci,ci,ci),Od=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Md=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Fd={$:"Custom"},Vd=r(function(e,t){return{info:t,type_:e}}),Kd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Hd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),jd=function(e){return e.a},qd=function(e){return p(Kd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Vd,Fd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Hd,function(e){return D(Ud,{daiAmount:si(e)})},Nd(e.daiAmount)),f(Hd,function(e){return D(Ud,{fiatAmount:si(e)})},Rd(e.fiatAmount)),f(Hd,function(e){return D(Ud,{fiatType:si(e)})},xd(e.fiatType)),f(Hd,function(e){return D(Ud,{paymentMethod:si(e)})},Pd(e.paymentMethod)),Od(d(Md,function(e){return jd(e)>0?li(e):fi(D(Ud,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Gd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},zd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Yd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Wd=function(e){var t=qd(e.inputs),r=function(){return R(e.errors,Ud)?Ud:"Ok"===t.$?Ud:t.a}();return D(e,{createParameters:l(zd,Jl,Gd(e.wallet),Yd(t)),errors:r})},Jd=r(function(e,t){return Wd(D(t,{inputs:e}))}),Qd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Xd=function(e){return d(Qd,f(Jd,Kl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:Ud,inputs:Kl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Do,Fo,yr)},Zd=a(function(e,t,r,n){return la(d(Ol,e,t,r,n))}),eh=function(e){return{$:"Address",a:e}},th=f(zo,cu,f(zo,sd,eh)),rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return th("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return th("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return th("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return th("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nh=function(e){return th("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ah=function(e){return{$:"AddressE",a:e}},ih=ah,oh=function(e){return{$:"UintE",a:e}},uh=oh,sh=n(function(e,t,r){return{data:si(f(Gf,"approve(address,uint256)",M([ih(t),uh(r)]))),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ch=function(e){return f(Gl,e,200)},fh=r(function(e,t){return Hl(f(Xu,jl(e),jl(t)))}),lh=function(e){var t=f(Gl,e.tradeAmount,200);return f(fh,e.pokeReward,f(fh,ch(e.tradeAmount),f(fh,t,function(){return"Buyer"===e.initiatorRole.$?Yl(e.tradeAmount):e.tradeAmount}())))},dh=Mi(ya),hh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ph=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gh=Xn,vh=Qn,yh=function(e){return f(vh,{caseInsensitive:!1,multiline:!1},e)},mh=Jn,bh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ch=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}}),Eh=r(function(e,t){return!f(Ch,f(Da,ns,e),t)}),Sh=Eh(Ua),Th=q,wh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ih=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Ah=f(La,Ih(ka),li(yr)),Bh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},kh=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Nu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Nu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Nu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Nu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Nu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Nu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Nu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Nu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Nu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Nu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Nu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Nu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Nu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Nu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Nu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(As(s)+" is not a valid hexadecimal character.")}}}),Nh=function(e){if(_d(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(su,"-",e)){var t=f(xc,yr,Bh(Zs(e)));return f(au,iu,l(kh,Ti(t)-1,t,0))}return l(kh,Qo(e)-1,Zs(e),0)}();return f(Hd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rh=function(e){var t=Zs(e);return function(e){return L(t,e)}(f(wh,yr,Ah(f(xa,Nh,f(_i,"",f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,20,Kf(f(xa,f(zo,Th,yi),t))))))))))},$h=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Rh(cu(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!bh(e)&&Sh(o)},_h=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-f]{40}$"))),Lh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-F]{40}$"))),xh=function(e){return'"'+e+'"'},Ph=function(e){var t=cu(e),r=f(ru,24,t),n=f(ou,40,e);return 64===Qo(t)&&f(ki,Ja(P("0")),r)?Lh(n)||_h(n)?li(eh(n)):$h(n)?li(eh(n)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):40!==Qo(t)?fi("Given address "+xh(e)+" is not the correct length."):bh(t)?Lh(t)||_h(t)?li(eh(t)):$h(t)?li(eh(t)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):fi("Given address "+xh(e)+" contains invalid hex characters.")},Dh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),Ph(nu(r)))}),Uh=r(function(e,t){var r=t.a;return Wo(function(t){var n=t.a,a=t.b;return r(f(Jo,n,f(Zo,64*e,a)))})}),Oh=Jr,Mh=r(function(e,t){return f(Oh,"data",vu(f(Uh,e,t)))}),Fh=Qr,Vh=r(function(e,t){return f(Oh,"topics",f(Fh,e,vu(t)))}),Kh=function(e){return f(Bo,f(zo,$a,f(Ra,r(function(e,t){return f(Xu,qu(e),f(fs,t,ws))}),hs)),od(f(xa,f(zo,$a,f(zo,$s,f(zo,Nh,Yd))),f(id,8,$a(e)))))},Hh=function(e){var t=Zs(sd(e));e:for(;;){if(!t.b)return ci;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(Bo,fs(qu(-1)),Kh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Bo,fs(qu(-1)),Kh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Kh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kh(a)}t.b;return ci}break e;default:break e}}var a=t;return Kh(a)},jh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f($d,"Error Decoding Uint into BigInt",Hh(jf(nu(r)))))}),qh=f(dh,f(Vh,1,Dh),f(dh,f(Mh,1,Dh),f(dh,f(Mh,0,jh),Fi(hh)))),Gh=nn,zh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Yh=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(Gh,e,Cl(M([L("data",hl(t.data)),L("topics",f(zh,vl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Wh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Jh=r(function(e,t){return f(au,function(e){return e.id},f(Wh,function(e){return f(Hd,Di,f(Yh,qh,e).returnData)},f($d,"No log found from that factoryAddress in that txReceipt",Ql(f(ml,function(t){return R(f(zo,dl,sd)(t.address),f(zo,dl,sd)(rh(e)))},t.logs)))))}),Qh=n(function(e,t,r){return{data:si(f(Gf,"allowance(address,address)",M([ih(t),ih(r)]))),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Zh=function(e){switch(e.$){case"BlockNum":var t=e.a;return hl(jf(Ps(t)));case"EarliestBlock":return hl("earliest");case"LatestBlock":return hl("latest");default:return hl("pending")}},ep=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return El(M([L("to",f(Bo,pl,t)),L("from",f(Bo,pl,r)),L("gas",f(Bo,yl,n)),L("gasPrice",f(Bo,gl,a)),L("value",f(Bo,gl,i)),L("data",f(Bo,vl,o))]))},tp=function(e){return{$:"BadBody",a:e}},rp=function(e){return{$:"BadStatus",a:e}},np=function(e){return{$:"BadUrl",a:e}},ap={$:"NetworkError"},ip={$:"Timeout"},op=rn,up=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(np(r));case"Timeout_":return fi(ip);case"NetworkError_":return fi(ap);case"BadStatus_":var n=t.a,a=t.b;return fi(rp(n.statusCode));default:var n=t.a,a=t.b,i=f(op,f(Oh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(tp(Di(u)))}}),sp=n(function(e,t,r){return Cl(M([L("id",wl(e)),L("jsonrpc",hl("2.0")),L("method",hl(t)),L("params",f(zh,Ua,r))]))}),cp=Rl,fp=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ku,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),lp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},dp=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(Nl,$l,p,g,h(Nl,kl,r,n,h(Nl,$l,i,o,u,s),v),h(Nl,kl,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(Nl,kl,r,n,h(Nl,$l,i,o,u,s),h(Nl,$l,f,l,d,m))}return e},hp=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(Nl,$l,i,o,h(Nl,kl,s,c,f,l),h(Nl,kl,r,n,d,h(Nl,$l,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Nl,kl,r,n,h(Nl,$l,i,o,C,d),h(Nl,$l,g,v,y,m))}return e},pp=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(Nl,r,u,s,c,h(Nl,$l,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 hp(t)}break e}o.a,o.d;return hp(t)}break e}return t}),gp=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(Nl,t,r,n,gp(a),u)}var s=dp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(_l,c,f,l,gp(d),p)}return Rl}return h(Nl,t,r,n,gp(a),u)}return Rl},vp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Rl;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(Nl,r,n,a,f(vp,e,i),o)}var s=dp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(_l,c,l,d,f(vp,e,p),v)}return Rl}return h(Nl,r,n,a,f(vp,e,i),o)}return f(yp,e,g(pp,e,t,r,n,a,i,o))}),yp=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(R(e,n)){var u=lp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(_l,r,s,c,i,gp(o))}return Rl}return h(_l,r,n,a,i,f(vp,e,o))}return Rl}),mp=r(function(e,t){var r=f(vp,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(Nl,kl,n,a,i,o)}return r}),bp=n(function(e,t,r){var n=t(f(fp,e,r));if("Just"===n.$){var a=n.a;return l(xl,e,a,r)}return f(mp,e,r)}),Cp=function(e){return"Just"===e.$},Ep=gn,Sp=vn,Tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),wp=function(e){return{$:"BadUrl_",a:e}},Ip=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ap={$:"NetworkError_"},Bp=function(e){return{$:"Receiving",a:e}},kp=function(e){return{$:"Sending",a:e}},Np={$:"Timeout_"},Rp=function(e){return f(ta,"application/json",f(xi,0,e))},$p=n(function(e,t,r){return Rp(l(sp,e,t,r))}),_p=f(ea,"",Ua),Lp=Te,xp=Se,Pp=function(e){if("Ok"===e.$){var t=e.a;return xp(t)}var r=e.a;return Lp(r)},Dp=function(e){return l(Zn,gr,Pp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},Up=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Dp({body:l($p,1,r,n),headers:yr,method:"POST",resolver:_p(up(a)),timeout:ci,url:t})},Op=n(function(e,t,r){return Up({decoder:t.decoder,method:"eth_call",params:M([ep(t),Zh(r)]),url:e})}),Mp={$:"LatestBlock"},Fp=r(function(e,t){return l(Op,e,t,Mp)}),Vp=function(e){return{$:"Perform",a:e}},Kp=sn,Hp=xp(gr),jp=r(function(e,t){return f(Kp,function(t){return xp(e(t))},t)}),qp=n(function(e,t,r){return f(Kp,function(t){return f(Kp,function(r){return xp(f(e,t,r))},r)},t)}),Gp=function(e){return l(La,qp(ka),xp(yr),e)},zp=r(function(e,t){var r=t.a;return Be(f(Kp,Ep(e),r))}),Yp=n(function(e,t,r){return f(jp,function(e){return gr},Gp(f(xa,zp(e),t)))}),Wp=n(function(e,t,r){return xp(gr)}),Jp=r(function(e,t){var r=t.a;return Vp(f(jp,e,r))});pn.Task=Pe(Hp,Yp,Wp,Jp);var Qp=Ue("Task"),Xp=cn,Zp=r(function(e,t){return Qp(Vp(f(Xp,f(Da,f(Da,xp,e),fi),f(Kp,f(Da,f(Da,xp,e),li),t))))}),eg=a(function(e,t,r,n){return f(Zp,n,f(Fp,Xh(eo(e)),l(Qh,nh(e),t,r)))}),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return th("0x092110996699c3E06e998d89F0f4586026e44F0F")}},rg=function(e){return{$:"BoolE",a:e}},ng=rg,ag=function(e){return{$:"StringE",a:e}},ig=ag,og=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ug=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},sg=r(function(e,t){return{paymentMethods:t,price:e}}),cg=function(e){return hl(Sd(e))},fg=function(e){return f(zh,Ua,M([hl(e.fiatType),cg(e.amount)]))},lg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},dg=function(e){return Cl(M([L("type",hl(lg(e.type_))),L("info",hl(e.info))]))},hg=function(e){var t=fg(e.price),r=f(zh,dg,e.paymentMethods);return f(xi,0,Cl(M([L("paymentmethods",r),L("price",t)])))},pg=r(function(e,t){return D(t,{value:si(e)})}),gg=function(e){return qu(jd(e))},vg=function(e){return f(ql,gg(e),qu(1e3))},yg=r(function(e,t){var r=function(){return"Token"===e.$?og:ug}();return function(){return"Native"===e.$?pg(jl(lh(t))):Ua}()(r(rh(e))(t.initiatorAddress)(tg(e))(R(t.initiatorRole,lo))(jl(t.tradeAmount))(jl(Yl(t.tradeAmount)))(jl(zl(t.tradeAmount)))(jl(t.pokeReward))(vg(t.autorecallInterval))(vg(t.autoabortInterval))(vg(t.autoreleaseInterval))(jl(ch(t.tradeAmount)))(hg(f(sg,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),mg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),bg=function(e){return{$:"CreateNeedsSig",a:e}},Cg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Eg=r(function(e,t){var r=al(f(yg,e,t)),n={onBroadcast:ci,onMined:si(L(mg(e),ci)),onSign:si(Cg(e))};return L(si(bg(e)),f(qo,n,r))}),Sg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wg=function(e){return{$:"ApproveNeedsSig",a:e}},Ig=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Bg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),kg={$:"NoOp"},Ng=function(e){return{appCmds:yr,chainCmd:Fo,cmd:Do,model:e}},Rg=function(e){return rd(Sd(e))},$g={$:"Error"},_g=r(function(e,t){f(cl,e+" fetch error",t);return{align:ul,label:"web3FetchError",mainParagraphs:M([M([fl('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:$g}}),Lg=r(function(e,t){return{align:ul,label:"web3MiningError",mainParagraphs:M([M([fl('Error mining "'+e+'" transaction: '+t)])]),noticeType:$g}}),xg={$:"Caution"},Pg=r(function(e,t){return{align:ul,label:"web3SigError",mainParagraphs:M([M([fl('Error signing "'+e+'" transaction: '+t)])]),noticeType:xg}}),Dg={$:"KovanDai"},Ug=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Dg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Og=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Mg=function(e){return f(Io,Ug,Og(e))},Fg=r(function(e,t){return 1-e(1-t)}),Vg=function(e){return f(Nu,e,5)},Kg=Fg(Vg),Hg={easing:Kg,offset:12,speed:200},jg=function(e){return{$:"External",a:e}},qg=function(e){return{$:"Internal",a:e}},Gg=function(e){return{$:"NotFound",a:e}},zg=function(e){for(;;){e=e.a}},Yg=r(function(e,t){return Qp(Vp(f(jp,e,t)))}),Wg={$:"Http"},Jg={$:"Https"},Qg=Kr,Xg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Zg=i(function(e,t,r,n,a){if(_d(a)||f(Qg,"@",a))return ci;var i=f(Xl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=rd(f(Zo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Xg,e,f(ru,o,a),s,t,r,n))}return si(p(Xg,e,a,ci,t,r,n))}),ev=a(function(e,t,r,n){if(_d(n))return ci;var a=f(Xl,"/",n);if(a.b){var i=a.a;return h(Zg,e,f(Zo,i,n),t,r,f(ru,i,n))}return h(Zg,e,"/",t,r,n)}),tv=n(function(e,t,r){if(_d(r))return ci;var n=f(Xl,"?",r);if(n.b){var a=n.a;return d(ev,e,si(f(Zo,a+1,r)),t,f(ru,a,r))}return d(ev,e,ci,t,r)}),rv=r(function(e,t){if(_d(t))return ci;var r=f(Xl,"#",t);if(r.b){var n=r.a;return l(tv,e,si(f(Zo,n+1,t)),f(ru,n,t))}return l(tv,e,ci,t)}),nv=function(e){return f(su,"http://",e)?f(rv,Wg,f(Zo,7,e)):f(su,"https://",e)?f(rv,Jg,f(Zo,8,e)):ci},av=Wt,iv=Gt(zt),ov=sa,uv=r(function(e,t){return L(e,t)}),sv=_r,cv=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=ju(r-n),o=f(ei,1,sv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),fv=r(function(e,t){var n=r(function(t,r){return Gp(f(xa,ov(0),d(cv,e.speed,e.easing,t,r-e.offset)))});return f(Kp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(qp,uv,iv,av(t)))}),lv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Gd(t.wallet),Mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(eg,a,n.address,rh(eo(a)),Sg(a));return d(Qd,t,i,Fo,yr)}return Ng(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Qd,D(t,{inputs:D(u,{userRole:o})}),Do,Fo,M([function(){return"Buyer"===o.$?d(Zd,"create offer type changed","input","sell dai",0):d(Zd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ng(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ng(f(Jd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Qd,(g?Jd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Do,Fo,g?M([d(Zd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=qd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jl,n,m);return Ng(D(t,{depositAmount:si(jl(lh(b))),txChainStatus:si(f(Ag,v,b))}))}var C=y.a;return d(Qd,D(t,{errors:C}),f(Zp,ms(kg),function(){return f(fv,D(Hg,{offset:60}),"inputError")}()),Fo,yr);case"AbortCreate":return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([d(Zd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Eg,v,b);var e=v.a,r=function(){var t=al(l(sh,nh(e),rh(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Ig,e,b))};return f(qo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(ts,a,E),ba)?L(si(wg(e)),r):f(Eg,v,b)}return L(si(wg(e)),r)}(),T=S.a,w=S.b;return d(Qd,D(t,{txChainStatus:T}),Do,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(l(Tg,a,b,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(ts,N,P),ba))return Ng($);var U=f(Eg,eo(a),b),T=U.a,w=U.b;return d(Qd,D($,{txChainStatus:T}),Do,w,yr)}return Ng($)}var O=k.a;return d(Qd,t,Do,Fo,M([pa(f(_g,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(f(Bg,v,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Qd,t,Do,Fo,M([pa(f(Lg,"create",B))]))}var F=e.a,V=e.b.a,K=f(Io,Rg,Yd(f(Jh,F,V)));if("Just"===K.$){var H=K.a;return d(Qd,t,Do,Fo,M([da(f(Qf,F,H))]))}return d(Qd,t,Do,Fo,M([pa(f(ll,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Qd,t,Do,Fo,M([ga]));case"NoOp":return Ng(t);default:var j=e.a;return d(Qd,t,Do,Fo,M([j]))}}),dv=r(function(e,t){return f(Eh,function(e){return f(Ch,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),hv=r(function(e,t){return f(Ku,jd(e),jd(t))}),pv=r(function(e,t){return R(f(hv,t.derived.phaseEndTime,e),Ta)}),gv=function(e){if(""===e)return li(ci);var t=vd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},vv=r(function(e,t){return{maxDai:t,minDai:e}}),yv=f(vv,ci,ci),mv=function(e){return l(Ih,r(function(t,r){return{dai:{max:r,min:t},fiatType:Ld(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Hd,function(e){return D(yv,{minDai:si(e)})},gv(e.minDai)),f(Hd,function(e){return D(yv,{maxDai:si(e)})},gv(e.maxDai)))},bv=r(function(e,t){var r=function(t){return f(Eh,function(e){return f(Qg,sd(e),sd(t))},e)};return f(Ch,function(e){return r(e.info)},t)}),Cv=r(function(e,t){return D(t,{paymentMethod:e})}),Ev=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Sv=r(function(e,t){return f(ts,jl(e),jl(t))}),Tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return wv(D(e,{inputs:f(Ev,r,f(Cv,"",e.inputs))}))},wv=function(e){var t=Tv(e),n=mv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(bv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(pv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(dv,t.filters,r)});return D(t,{filterFunc:s})},Iv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Av={$:"Expires"},Bv=function(e){return L(wv({errors:yv,filterFunc:pv,filters:co(M([f(vo,!0,!0),d(So,!0,!1,!1,!1)])),inputs:Iv,showCurrencyDropdown:!1,tradeTable:_o(L(Av,Lo)),wallet:e}),Do)},kv=r(function(e,t){var r=f(ml,wc(e),t.inputs.paymentMethodTerms);return wv(D(t,{inputs:f(Ev,r,t.inputs)}))}),Nv=function(e){return wv(D(e,{filterFunc:pv,inputs:Iv}))},Rv=function(e){return{$:"TradeTableMsg",a:e}},$v=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),_v=function(e){return d($v,e,Do,Fo,yr)},Lv=r(function(e,t){return D(t,{fiatType:e})}),xv=r(function(e,t){return D(t,{maxDai:e})}),Pv=r(function(e,t){return D(t,{minDai:e})}),Dv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return _v(D(t,{inputs:f(Pv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return _v(D(t,{inputs:f(xv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return _v(D(t,{inputs:f(Lv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return _v(D(t,{inputs:(n?Lv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return _v(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return _v(D(t,{inputs:f(Cv,r,t.inputs)}));case"AddSearchTerm":return _v(Tv(t));case"RemoveTerm":var a=e.a;return _v(f(kv,a,t));case"ApplyInputs":return d($v,wv(t),Do,Fo,yr);case"ResetSearch":return _v(Nv(t));case"FiltersMsg":var i=e.a;return _v(wv(D(t,{filters:f(Jf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(nl,o,t.tradeTable);return d($v,D(t,{tradeTable:u.model}),f(il,Rv,u.cmd),f(Yo,Rv,u.chainCmd),f(xa,Ji(Rv),u.appCmds));case"NoOp":return _v(t);default:var s=e.a;return d($v,t,Do,Fo,M([s]))}}),Uv=a(function(e,t,r,n){return e(Cl(M([L("title",hl(t)),L("body",function(){if("Nothing"===r.$)return bl;var e=r.a;return hl(e)}()),L("image",function(){if("Nothing"===n.$)return bl;var e=n.a;return hl(e)}())])))}),Ov=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Mv=function(e){return e.a+"="+e.b},Fv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Mv,e)):""},Vv=r(function(e,t){return"/"+(f(Ri,"/",e)+Fv(t))}),Kv=function(e){switch(e.$){case"Home":return f(Vv,M(["DAIHard"]),yr);case"Create":return f(Vv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Vv,M(["DAIHard","trade",Ov(t),Ni(r)]),yr);case"Marketplace":return f(Vv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Vv,M(["DAIHard","history",dl(n)]),yr);default:return f(Vv,yr,yr)}},Hv={$:"NotFound"},jv=function(e){return{$:"AgentHistory",a:e}},qv={$:"Create"},Gv={$:"Home"},zv={$:"Marketplace"},Yv=function(e){return{$:"Parser",a:e}},Wv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Jv=r(function(e,t){return Yv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Wv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Qv=f(Jv,"ADDRESS",f(zo,Ph,Yd)),Xv={$:"Eth"},Zv={$:"Kovan"},ey=f(Jv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Xv));case"keth":return si(Zi(Zv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Dg));case"xdai":return si(Zi(to));default:return ci}}),ty=f(Jv,"NUMBER",rd),ry=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Wv,r,n,a,i,e(o))}),ny=r(function(e,t){var r=t.a;return Yv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,ry(u),r(h(Wv,n,a,i,o,e)))})}),ay=function(e){return l(La,oo,yr,e)},iy=r(function(e,t){return ay(f(xa,e,t))}),oy=function(e){return Yv(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 R(u,e)?M([h(Wv,f(ka,u,r),s,a,i,o)]):yr}return yr})},uy=r(function(e,t){var r=e.a,n=t.a;return Yv(function(e){return f(iy,n,r(e))})}),sy=Yv(function(e){return M([e])}),cy=f(uy,oy("DAIHard"),function(e){return Yv(function(t){return f(iy,function(e){return(0,e.a)(t)},e)})}(M([f(ny,Gv,sy),f(ny,qv,oy("create")),f(ny,Qf,f(uy,oy("trade"),f(uy,ey,ty))),f(ny,zv,oy("marketplace")),f(ny,jv,f(uy,oy("history"),Qv)),f(ny,function(e){return jv(e)},f(uy,oy("history"),Qv))]))),fy=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 si(t.value)}return si(t.value)}return ci}},ly=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ly(r))}return yr}return yr},dy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ly(r)}var r=t;return ly(r)},hy=Qt,py=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),gy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=hy(n);if("Nothing"===o.$)return t;var u=o.a,s=hy(i);if("Nothing"===s.$)return t;var c=s.a;return l(bp,u,py(c),t)}return t}),vy=function(e){if("Nothing"===e.$)return cp;var t=e.a;return l(La,gy,cp,f(_i,"&",t))},yy=r(function(e,t){var r=e.a;return fy(r(h(Wv,yr,dy(t.path),vy(t.query),t.fragment,Ua)))}),my=function(e){return f(xc,Hv,f(yy,cy,e))},by=aa,Cy=r(function(e,t){return f(by,e,Kv(t))}),Ey=je("connectToWeb3",function(e){return bl}),Sy=function(e){return Cl(M([L("event",hl(e.event)),L("category",hl(e.category)),L("label",hl(e.label)),L("value",wl(e.value))]))},Ty=r(function(e,t){return Cl(M([L("address",hl(dl(e))),L("signSeedMsg",hl(t))]))}),wy=je("gTagOut",Ua),Iy=je("genPrivkey",Ua),Ay=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),By=n(function(e,t,r){return f(Io,Zc(t),f(Bo,function(e){return e.trades},f(Ay,function(t){return R(t.factory,e)},r)))}),ky=je("notifyPort",Ua),Ny=je("requestNotifyPermissionPort",function(e){return bl}),Ry=r(function(e,t){return D(t,{wallet:e})}),$y=r(function(e,t){return L(f(Jd,t.inputs,D(t,{wallet:e})),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(eg,n,r.address,rh(eo(n)),Sg(n))}return Do}())}),_y=r(function(e,t){return D(t,{wallet:e})}),Ly=function(e){return{$:"AllowanceFetched",a:e}},xy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Gd(e),Mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Mg(e),si(i.factory))?d(eg,a,n.address,i.creationInfo.address,Ly):Do}return Do}())}),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{$:"TradeModel",a:e}},Fy=function(e){return{$:"TradeMsg",a:e}},Vy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Do);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Dy(a),f(il,Uy,i));case"TradeModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(il,Fy,c));case"MarketplaceModel":var l=t.a;return L(Oy(f(_y,e,l)),Do);default:var d=t.a;return L(Py(f(Ry,e,d)),Do)}}),Ky=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Hy=function(e){return{$:"PartiallyLoadedTrade",a:e}},jy=r(function(e,t){return Hy(g(Ky,e,t,ci,ci,ci,ci,ci))}),qy=function(e){return{$:"CurrentBlockFetched",a:e}},Gy=gu(f(zo,cu,Nh)),zy=function(e){return Up({decoder:Gy,method:"eth_blockNumber",params:yr,url:e})},Yy=function(e){return f(Zp,qy,zy(e))},Wy=r(function(e,t){return{address_:e,blocknum:t}}),Jy=function(e){return Wo(function(t){return li(L(t,e))})},Qy=n(function(e,t,r){var n=t.a,a=r.a;return Wo(function(t){return f(Wh,function(t){var r=t.a,n=t.b;return f(au,rl(e(n)),a(r))},n(t))})}),Xy=r(function(e,t){return l(Qy,r(function(e,t){return e(t)}),t,e)}),Zy=vu(f(Xy,jh,f(Xy,Dh,Jy(Wy)))),em=r(function(e,t){return{data:si(f(Gf,"createdTrades(uint256)",M([uh(t)]))),decoder:Zy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tm=n(function(e,t,r){return f(Zp,r,f(Fp,Xh(e),f(em,rh(e),t)))}),rm=function(e){return{$:"CreationInfoFetched",a:e}},nm=r(function(e,t){return l(tm,e,qu(t),rm)}),am=function(e){return{$:"EventSentryMsg",a:e}},im=function(e){return{$:"BlockNumber",a:e}},om=function(e){return{$:"EventSentry",a:e}},um=function(e){return{$:"Set_elm_builtin",a:e}},sm=um(cp),cm=r(function(e,t){return L(om({blockNumber:ci,errors:yr,nodePath:t,pending:sm,ref:1,requests:cp,tagger:e,watching:sm}),f(Zp,f(zo,im,e),zy(t)))}),fm=function(e){return f(cm,am,Xh(e))},lm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},hm=dm(f(lm,ci,ci)),pm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:Co,secureCommInfo:hm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),gm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),vm=n(function(e,t,r){var n=f(nm,t,r),a=fm(t),i=a.a,o=a.b;return d(gm,l(pm,f(jy,t,r),i,e),Po(M([n,o,Yy(Xh(t))])),Fo,M([ha]))}),ym=function(e){return{$:"LoadedTrade",a:e}},mm=function(e){return{$:"EventLogFetched",a:e}},bm=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),Cm=ue,Em=ce,Sm=Yr,Tm=n(function(e,t,r){var n=function(e){return Em(M([e,Cm(r)]))};return f(du,function(a){var i=f(Gh,e,a);if("Ok"===i.$){var o=i.a,u=f(Gh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return hu(Di(c))}return Fi(r)},Sm)}),wm=a(function(e,t,r,n){return f(dh,l(Tm,f(Oh,e,Sm),t,r),n)}),Im=n(function(e,t,r){return f(dh,f(Oh,e,t),r)}),Am=gu(Ph),Bm=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),km=function(e){return{$:"BlockHash",a:e}},Nm=function(e){return Bm(e)?li(km(cu(e))):fi("Given blockHash "+xh(e)+" is not valid.")},Rm=gu(Nm),$m=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),_m=function(e){return $m(e)?li(nc(cu(e))):fi("Something in here is not very hexy: "+xh(e))},Lm=gu(_m),xm=function(e){return{$:"TxHash",a:e}},Pm=function(e){return Bm(e)?li(xm(cu(e))):fi("Given txHash "+xh(e)+" is not valid.")},Dm=gu(Pm),Um=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}}),Om=zr,Mm=oe,Fm=l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionHash",Dm,l(Im,"transactionIndex",Gy,l(Im,"logIndex",Gy,d(wm,"removed",Om,!1,l(Im,"topics",Mm(Lm),l(Im,"data",pu,l(Im,"address",Am,Fi(Um)))))))))),Vm=function(e){return f(zh,function(e){if("Just"===e.$){var t=e.a;return hl(qf(t))}return bl},e)},Km=function(e){return Cl(M([L("fromBlock",Zh(e.fromBlock)),L("toBlock",Zh(e.toBlock)),L("address",pl(e.address)),L("topics",Vm(e.topics))]))},Hm=r(function(e,t){return Up({decoder:Mm(Fm),method:"eth_getLogs",params:M([Km(t)]),url:e})}),jm=function(e){return{$:"BlockNum",a:e}},qm=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Kp,function(r){return f(jp,vi(r),f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)})))},f(Hm,e,t)):f(Hm,e,t)}),Gm=r(function(e,t){var r=t.a;return um(l(xl,e,gr,r))}),zm=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(xl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(om(D(o,{watching:f(Gm,a.ref,o.watching)})),f(Zp,f(zo,bm(a.ref),a.tagger),e),a.ref)}(l(qm,a.nodePath,n,L(s,s)))}return x(om(D(o,{pending:f(Gm,a.ref,o.pending)})),Do,a.ref)}),Ym=zm(!1),Wm=r(function(e,t){var r=function(){var e=fm(t.factory),r=e.a,n=e.b;return function(e){var t=e.a,r=e.b,a=e.c;return x(t,Po(M([n,r])),a)}(l(Ym,mm,r,{address:t.creationInfo.address,fromBlock:jm(t.creationInfo.blocknum),toBlock:Mp,topics:yr}))}(),n=r.a,a=r.b;return d(gm,l(pm,ym(t),n,e),Po(M([a,Yy(Xh(t.factory))])),Fo,M([ha]))}),Jm=function(e){return{data:si(f(Gf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Qm=function(e){return{data:si(f(Gf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Xm=function(e){return{data:si(f(Gf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Zm=r(function(e,t){return{data:si(f(Gf,"initiatorStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),eb=function(e){return{data:si(f(Gf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},tb=function(e){return{data:si(f(Gf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},rb=r(function(e,t){return{data:si(f(Gf,"responderStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),nb=r(function(e,t){return{amount:t,fiatType:e}}),ab=f(du,function(e){var t=cd(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("Can't convert that to a BigInt")},pu),ib=l(Mi,nb,f(Fh,0,pu),f(Fh,1,ab)),ob={$:"Bank"},ub={$:"Cash"},sb=function(e){switch(e){case"cash":return si(ub);case"bank":return si(ob);case"custom":return si(Fd);default:return ci}},cb=f(du,function(e){var t=sb(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("")},pu),fb=l(Mi,Vd,f(Oh,"type",cb),f(Oh,"info",pu)),lb=function(e){var t=l(Mi,sg,f(Oh,"price",ib),f(Oh,"paymentmethods",Mm(fb)));return f(op,t,e)},db=r(function(e,t){return{commPubkey:t,responder:e}}),hb=r(function(e,t){var n=r(function(t,r){return l(Xo,t,t+2*r,e)}),a=f(zo,Nh,au(ti(2)));return f(Wh,function(t){return f(au,function(e){return f(n,t+64,e)},Nh(l(Xo,t,t+64,e)))},a(t))}),pb=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),gb=n(function(e,t,r){var n=l(Ra,pb(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),vb=j,yb=function(e){return As(vb(e))},mb=function(e){return l(gb,r(function(e,t){return U(t,yb(e))}),"",e)},bb=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f(Wh,mb,f(Wh,f(zo,xa(Nh),Ah),f(au,ml(f(zo,_d,ns)),f(au,tc(2),f(hb,t,nu(r)))))))}),Cb=f(dh,f(Mh,1,bb),f(dh,f(Mh,0,Dh),Fi(db))),Eb=r(function(e,t){return{commPubkey:t,terms:e}}),Sb=f(dh,f(Mh,1,bb),f(dh,f(Mh,0,bb),Fi(Eb))),Tb=function(e){return{statement:e}},wb=f(dh,f(Mh,0,bb),Fi(Tb)),Ib=function(e){return{statement:e}},Ab=f(dh,f(Mh,0,bb),Fi(Ib)),Bb={$:"AbortedEvent"},kb={$:"BurnedEvent"},Nb={$:"ClaimedEvent"},Rb=function(e){return{$:"CommittedEvent",a:e}},$b=function(e){return{$:"InitiatedEvent",a:e}},_b=function(e){return{$:"InitiatorStatementLogEvent",a:e}},Lb={$:"PokeEvent"},xb={$:"RecalledEvent"},Pb={$:"ReleasedEvent"},Db=function(e){return{$:"ResponderStatementLogEvent",a:e}},Ub=f(Oh,"topics",f(Fh,0,Lm)),Ob=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),Kf(f(xa,yi,Zs(e))))))},Mb=f(du,function(e){return R(e,Ob("Initiated(string,string)"))?f(Oi,$b,Sb):R(e,Ob("Committed(address,string)"))?f(Oi,Rb,Cb):R(e,Ob("Recalled()"))?Fi(xb):R(e,Ob("Claimed()"))?Fi(Nb):R(e,Ob("Aborted()"))?Fi(Bb):R(e,Ob("Released()"))?Fi(Pb):R(e,Ob("Burned()"))?Fi(kb):R(e,Ob("InitiatorStatementLog(string)"))?f(Oi,_b,wb):R(e,Ob("ResponderStatementLog(string)"))?f(Oi,Db,Ab):R(e,Ob("Poke()"))?Fi(Lb):hu("Unrecognized topic hash")},Ub),Fb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},Vb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},Kb=function(e){return R(e.buyerDeposit,Yl(e.tradeAmount))&&R(e.abortPunishment,zl(e.tradeAmount))},Hb={$:"Invalid"},jb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),qb=r(function(e,t){return Vl(jd(t)+jd(e))}),Gb=function(e){var t=Bd(Sd(e.amount));if("Just"===t.$){return t.a}f(cl,"Error converting FiatValue to float--string -> float failed!",e);return 0},zb=r(function(e,t){return(t-e)/e}),Yb=r(function(e,t){var r=Gb(t),n=kd(e);return"USD"===t.fiatType?si(f(zb,n,r)):ci}),Wb=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 Vl(0)}}();return{margin:f(Yb,e.tradeAmount,r.price),phaseEndTime:function(){return"Closed"===t.phase.$?Vl(f(Nu,2,53)-1):f(qb,t.phaseStartTime,n)}()}}),Jb=function(e){var t=x(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 ym(v(jb,e.factory,e.id,n,a,o,u,s,l(Wb,a,o,u)))}return Hy(e)},Qb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(cl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return Hb}}),Xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return Hb}}),Zb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return Hb}}),eC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return ym(D(n,{state:e}));default:return Hb}}),tC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return Hb}}),rC=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}}),nC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,uu,f(Xy,Dh,Jy(rC))))))))))),aC=function(e){return{data:si(f(Gf,"getParameters()",yr)),decoder:nC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},iC=function(e){return f(Bo,function(e){return Vl(1e3*e)},rd(Sd(e)))},oC=function(e){return Hl(e)},uC=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),sC=function(e){var t=f($d,"error converting BigInt to Time.Posix",iC(e.autoabortInterval)),r=f($d,"error converting BigInt to Time.Posix",iC(e.autoreleaseInterval)),a=f($d,"error converting BigInt to Time.Posix",iC(e.autorecallInterval));return d(uC,n(function(t,r,n){return{abortPunishment:oC(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:oC(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:oC(e.pokeReward),tradeAmount:oC(e.tradeAmount)}}),a,t,r)},cC=n(function(e,t,r){return f(Zp,r,f(jp,sC,f(Fp,Xh(e),aC(t))))}),fC=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}}}}}}}}}}},lC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(fC)))))))))))),dC=function(e){return{data:si(f(Gf,"getPhaseStartInfo()",yr)),decoder:lC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},hC=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),pC=function(e){return h(hC,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}}),iC(e.v6),iC(e.v7),iC(e.v8),iC(e.v9))},gC=n(function(e,t,r){return f(Zp,r,f(jp,pC,f(Fp,Xh(e),dC(t))))}),vC=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),yC=vu(f(Xy,jh,f(Xy,Dh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(vC))))))),mC=function(e){return{data:si(f(Gf,"getState()",yr)),decoder:yC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},bC={$:"Aborted"},CC={$:"Burned"},EC={$:"NotClosed"},SC={$:"Recalled"},TC={$:"Released"},wC=function(e){switch(f(xc,99,rd(Sd(e)))){case 0:return si(EC);case 1:return si(SC);case 2:return si(bC);case 3:return si(TC);case 4:return si(CC);default:return ci}},IC=function(e){switch(f(xc,99,rd(Sd(e)))){case 1:return si(Co);case 2:return si(mo);case 3:return si(bo);case 4:return si(yo);default:return ci}},AC=function(e){return R(e,th("0x0000000000000000000000000000000000000000"))?ci:si(e)},BC=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),kC=function(e){var t=iC(e.phaseStartTimestamp),r=IC(e.phase),a=wC(e.closedReason);return d(BC,n(function(t,r,n){return{balance:oC(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:AC(e.responder)}}),r,t,a)},NC=n(function(e,t,r){return f(Zp,r,f(jp,kC,f(Fp,Xh(e),mC(t))))}),RC=i(function(e,t,r,n,a){return Po(M([l(cC,e,t,r),l(NC,e,t,n),l(gC,e,t,a)]))}),$C=function(e){var t=Rg(e);if("Just"===t.$){return t.a}f(cl,"Warning! BigInt to Int conversion failed!",Sd(e));return 0},_C=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),LC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),xC=function(e){return e.b?l(LC,e,yr,0):qa},PC=tn,DC=function(e){var t=h(PC,_C,f(Oh,"encapsulation",pu),f(Oh,"iv",pu),f(Oh,"tag",pu),f(Oh,"encrypted",pu)),r=Mm(t),n=f(Gh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Zc,0,e),f(Zc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(xC(i))},UC=function(e){var t=function(e){var t=Qo(e);return t>1114111?fi("string is too long"):li(f(Is,vb(t),e))};return f(au,Ri(""),Ah(f(xa,t,e)))},OC=function(e){var t=e.a,r=e.b;return UC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},MC=r(function(e,t){return Cl(M([L("message",hl(e)),L("pubkeyHexStrings",f(zh,hl,M([t.initiatorPubkey,t.responderPubkey])))]))}),FC=function(e){return{$:"LoadedCommInfo",a:e}},VC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),KC=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 FC(f(VC,r,n))}return dm(e)},HC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return FC(D(n,{initiatorPubkey:e}))}),jC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{responderPubkey:si(e)}))}var n=t.a;return FC(D(n,{responderPubkey:e}))}),qC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),GC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(nd,a,n),o=$s(f(lc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),zC=function(e){var t=xC(f(GC,Zs(e),yr));return l(zd,uv,h(hC,_C,f(Zc,0,t),f(Zc,1,t),f(Zc,2,t),f(Zc,3,t)),h(hC,_C,f(Zc,4,t),f(Zc,5,t),f(Zc,6,t),f(Zc,7,t)))},YC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),WC={$:"Aborted"},JC={$:"Burned"},QC={$:"Claimed"},XC=function(e){return{$:"Committed",a:e}},ZC=function(e){return{$:"Encrypted",a:e}},eE={$:"FailedDecode"},tE={$:"Initiated"},rE={$:"Recalled"},nE={$:"Released"},aE=function(e){return{$:"StateChange",a:e}},iE=function(e){return{$:"Statement",a:e}},oE=fr,uE=cr,sE=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(oE,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(uE,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),cE=or,fE=y,lE=a(function(e,t,r,n){var a=Wc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(cE,Ga(r),n);var i=za(d(lE,e-Ha,t,r,ja));return f(cE,i,n)}var o=f(Jc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(lE,e-Ha,t,r,u));return l(rf,a,i,n)}var i=za(d(lE,e-Ha,t,r,fE(o)));return l(rf,a,i,n)}),dE=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(lE,c,r,e,fE(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(lE,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),hE=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(oE,32,r,e),o=f(dE,i,t);if(a<0){var u=l(uE,a,n,e);return f(dE,u,o)}return o}),pE=ur,gE=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(pE,i,t,r)}return f(ka,e,t)});return{nodeList:l(pE,i,yr,n),nodeListSize:t/32|0,tail:a}},vE=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(pE,o,t,r)}var n=e.a;return f(hE,n,t)});return f(hE,i,l(pE,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(pE,o,t,r)}var n=e.a;return f(sE,n,t)});return f(ai,!0,f(sE,i,l(pE,o,gE(e),a)))}),yE=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),mE=f(La,yE,yr),bE=n(function(e,t,r){var n=qC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(aE(tE));case"CommittedEvent":var r=t.a;return si(aE(XC(r.responder)));case"RecalledEvent":return si(aE(rE));case"ClaimedEvent":return si(aE(QC));case"AbortedEvent":return si(aE(WC));case"ReleasedEvent":return si(aE(nE));case"BurnedEvent":return si(aE(JC));case"InitiatorStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(To)}));case"ResponderStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(wo)}));default:return ci}}(),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(vE,r.history,xC(mE(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Bo,YC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),mE(M([s])))}),CE=Gr,EE=function(e){var t=l(Mi,uv,f(Oh,"id",CE),f(Oh,"message",pu));return f(Hd,Di,f(Gh,t,e))},SE=function(e){return{$:"Decrypted",a:e}},TE=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),wE=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(bE,n,a,t),o=i.a,u=i.b,s=i.c;return d(TE,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(TE,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(TE,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=EE(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Zc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:SE(y)}),T=D(b,{eventInfo:iE(S)}),w=l(af,v,T,t.history);return d(TE,D(t,{history:w}),!1,ci,yr)}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an event that is not a message!",b))]))}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(TE,t,!1,ci,M([pa(f(ll,"Error decoding decryption result",I))]))}}),IE=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),AE=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),BE=function(e){return{onBroadcast:ci,onMined:si(L(IE(e),ci)),onSign:si(AE(e))}},kE=je("encryptToPubkeys",Ua),NE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),RE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),$E=function(e){return{$:"CommitMined",a:e}},_E={$:"CommitNeedsSig"},LE=function(e){return{$:"CommitSigned",a:e}},xE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?RE:NE}(),a=al(function(){return"Token"===e.factory.$?Ua:pg(jl(Fb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(_E),f(qo,{onBroadcast:ci,onMined:si(L($E,ci)),onSign:si(LE)},a))}),PE=r(function(e,t){return Cl(M([L("id",wl(e)),L("encapsulation",hl(t.encapsulatedKey)),L("iv",hl(t.iv)),L("tag",hl(t.tag)),L("encrypted",hl(t.message))]))}),DE=je("decryptMessage",Ua),UE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},OE=r(function(e,t){return Po(f(xa,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 DE(f(PE,r,s))}return Do}return Do},UE(e.history)))}),ME=function(e){if("Just"===e.$){return e.a}return ci},FE=function(e){var t=ME(l(zd,Ao,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Bo,function(e){return e.address},Gd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(OE,n,a)}return Do},VE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(bE,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),KE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),HE=i(function(e,t,r,n,a){return f(VE,n,p(KE,e,r,t,qa,a,""))}),jE=function(e){return{$:"ChatHistoryMsg",a:e}},qE=a(function(e,t,r,n){var a=x(t,Gd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(ko,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(jE),n))}(h(HE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),GE={$:"Abort"},zE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),YE=function(e){return{$:"ActionNeedsSig",a:e}},WE=function(e){return{$:"ApproveMining",a:e}},JE={$:"ApproveNeedsSig"},QE=function(e){return{$:"ApproveSigned",a:e}},XE={$:"Burn"},ZE={$:"Claim"},eS=function(e){return{$:"CommitMining",a:e}},tS=function(e){return{$:"ConfirmingAction",a:e}},rS=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),nS=function(e){return{$:"ParametersFetched",a:e}},aS=function(e){return{$:"PhaseInfoFetched",a:e}},iS={$:"Poke"},oS={$:"Recall"},uS={$:"Release"},sS=function(e){return{$:"StartContractAction",a:e}},cS=function(e){return{$:"StateFetched",a:e}},fS=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"}},lS=function(e){return d(gm,e,Do,Fo,yr)},dS={align:ul,label:"cantFindTradeWillRetry",mainParagraphs:M([M([fl("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:$g},hS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(_g,e,r)}if("Nothing"===t.a.$){t.a;return f(ll,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ll,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),pS={align:ul,label:"tradeParametersNotDefault",mainParagraphs:M([M([fl("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:$g},gS=eo(Xi),vS=n(function(e,t,r){return l(bp,e,Bo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),yS=r(function(e,t){var r=t.a;return um(f(mp,e,r))}),mS=n(function(e,t,r){var n=e.a,a=f(fp,t,n.requests);if("Nothing"===a.$)return L(om(n),Do);var i=a.a,o=L(i.watchOnce,Ql(r));if("Nothing"===o.b.$){o.b;return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Do)}if(o.a){var u=o.b.a;return L(om(D(n,{requests:l(vS,t,r,n.requests),watching:f(yS,t,n.watching)})),f(Yg,i.tagger,xp(u)))}return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Po(f(xa,function(e){return f(Yg,i.tagger,xp(e))},r)))}),bS=_e,CS=r(function(e,t){return f(Zp,f(zo,im,t),f(Kp,function(t){return zy(e)},bS(2e3)))}),ES=n(function(e,t,r){var n=r.a,a=r.b;return f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)}))}),SS=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(SS,e,t,i)),c=o;e=u,t=s,r=c}}),TS=r(function(e,t){return l(SS,xl,t,e)}),wS=r(function(e,t){var r=e.a,n=t.a;return um(f(TS,r,n))}),IS=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 Po(f(xa,function(t){return f(Zp,f(zo,bm(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},mE(f(xa,function(e){return f(fp,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(om(D(r,{blockNumber:si(a)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,ES)]))):L(t,f(CS,r.nodePath,r.tagger))}return L(om(D(r,{blockNumber:si(a),pending:sm,watching:f(wS,r.watching,r.pending)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(a,a),r.pending,qm),l(i,L(a,a),r.watching,ES)])))}var s=e.a.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),f(CS,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(mS,t,c,d)}var s=e.b.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),Do)}),AS=function(e){return M([e])},BS=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(nm,r.factory,r.id):Do}}(),function(){var e=x(Gd(t.wallet),Mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Mg(t.wallet),si(a.factory))?d(eg,n,r.address,a.creationInfo.address,Ly):Do}return Do}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(qE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?FE(t):Do,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(gm,u,Po(M([l(NC,p.factory,p.creationInfo.address,cS),s,r])),Fo,o)}return lS(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return lS(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(ts,m,jl(Fb(C.parameters))),ba))return lS(u);var S=l(xE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(gm,D(u,{txChainStatus:T}),Do,w,yr)}return lS(u)}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:$C(I.blocknum)},B=l(Ym,mm,t.eventSentry,{address:A.address,fromBlock:jm(A.blocknum),toBlock:Mp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(Qb,A,t.trade)}),$=f(xc,gS,Vb(u.trade)),_=Po(M([N,h(RC,$,A.address,nS,cS,aS)]));return d(gm,u,_,Fo,yr)}if("BadBody"===g.a.$){g.a.a;return d(gm,t,Do,Fo,M([pa(dS)]))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(eC,P,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(Kb(F)){var u=D(t,{trade:f(Xb,F,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(pS)]))}var V=g.a.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Zb,H,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Yh,Mb,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(HC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(jC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=lb(e.terms);if("Ok"===r.$){var n=r.a;return L(f(tC,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ll,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return x(si(r),!1,yr)}return d(qE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),ee=Z.a,te=Z.b,re=Z.c,ne=function(){if("Just"===ee.$){var e=ee.a;return L(function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r||te,f(oo,re,f(xa,Ji(jE),n)))}(l(bE,q.blockNumber,Y,e)),yr)}return L(x(ci,!1,re),f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])))}(),ae=ne.a,ie=ae.a,oe=ae.b,ue=ae.c,se=ne.b,u=D(t,{chatHistoryModel:ie,eventsWaitingForChatHistory:se,secureCommInfo:W,trade:Q}),_=oe?FE(u):Do;return d(gm,u,_,Fo,f(oo,f(xa,pa,mE(M([X]))),ue));case"ExpandPhase":var ce=e.a;return lS(D(t,{expandedPhase:ce}));case"ToggleChat":var fe=!t.showChatHistory;return lS(D(t,{showChatHistory:fe}));case"ToggleStatsModal":var le=!t.showStatsModal;return lS(D(t,{showStatsModal:le}));case"ViewUserHistory":var de=(e.a,t.trade);if("LoadedTrade"===de.$){var C=de.a;return d(gm,t,Do,Fo,M([da(jv(C.parameters.initiatorAddress))]))}return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,he=e.c;return lS(D(t,{txChainStatus:si(f(rS,E,he))}));case"AbortAction":return lS(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,he=e.c,pe=function(){var e=C.factory;if("Native"===e.$)return l(xE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=al(l(sh,nh(r),C.creationInfo.address,he)),t={onBroadcast:ci,onMined:ci,onSign:si(QE)};return f(qo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(ts,i,jl(Fb(C.parameters))),ba)?L(si(JE),n):l(xE,C,E.address,E.commPubkey)}return L(si(JE),n)}(),T=pe.a,w=pe.b;return d(gm,D(t,{txChainStatus:T}),Do,w,yr);case"ContractActionClicked":var ge=e.a;if(R(ge,iS)||R(ge,oS)){var ve=sS(ge),ye=t;e=ve,t=ye;continue e}return lS(D(t,{txChainStatus:si(tS(ge))}));case"StartContractAction":var me=e.a,be=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Fo,M([pa(f(ll,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(me.$){case"Recall":var a=al(eb(n.creationInfo.address));return x(si(YE(oS)),f(qo,BE(oS),a),yr);case"Claim":var a=al(Xm(n.creationInfo.address));return x(si(YE(ZE)),f(qo,BE(ZE),a),yr);case"Abort":var a=al(Jm(n.creationInfo.address));return x(si(YE(GE)),f(qo,BE(GE),a),yr);case"Release":var a=al(tb(n.creationInfo.address));return x(si(YE(uS)),f(qo,BE(uS),a),yr);case"Burn":var a=al(Qm(n.creationInfo.address));return x(si(YE(XE)),f(qo,BE(XE),a),yr);default:var a=al(zf(n.creationInfo.address));return x(si(YE(iS)),f(qo,BE(iS),a),yr)}}(),T=be.a,w=be.b,o=be.c;return d(gm,D(t,{txChainStatus:T}),Do,w,o);case"ApproveSigned":var Ce=e.a;if("Ok"===Ce.$){var Ee=Ce.a;return lS(D(t,{txChainStatus:si(WE(Ee))}))}var V=Ce.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"approve",V))]));case"CommitSigned":var Ce=e.a;if("Ok"===Ce.$){var Ee=Ce.a;return lS(D(t,{txChainStatus:si(eS(Ee))}))}var V=Ce.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"commit",V))]));case"CommitMined":return lS(D(t,{txChainStatus:ci}));case"ActionSigned":var ge=e.a,Ce=e.b;if("Ok"===Ce.$){var Ee=Ce.a;return lS(D(t,{txChainStatus:si(f(zE,ge,Ee))}))}var V=Ce.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,fS(ge),V))]));case"ActionMined":var ge=e.a;return lS(D(t,{txChainStatus:ci}));case"EventSentryMsg":var Se=e.a,Te=f(IS,Se,t.eventSentry),we=Te.a,_=Te.b;return d(gm,D(t,{eventSentry:we}),_,Fo,yr);case"ChatHistoryMsg":var Ie=e.a,Ae=t.chatHistoryModel;if("Just"===Ae.$){var Be=Ae.a,ke=f(wE,Ie,Be),Ne=D(t,{chatHistoryModel:si(ke.model)}),s=ke.shouldCallDecrypt?FE(t):Do,Re=function(){var e=ke.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(kE(f(MC,r,a)),ci)}return L(Do,si(f(ll,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Do,ci)}(),$e=Re.a,_e=Re.b;return d(gm,Ne,Po(M([s,$e])),Fo,U(f(Qi,jE,ke.appCmds),f(xc,yr,f(Bo,AS,f(Bo,pa,_e)))))}return d(gm,t,Do,Fo,M([pa(f(ll,"Got a chat history message, but there is no chat history model!",Ie))]));case"EncryptionFinished":var Le=e.a,xe=f(Wh,OC,DC(Le)),Pe=x(t.wallet,t.trade,xe);if("Ok"===Pe.c.$){if("Active"===Pe.a.$&&"LoadedTrade"===Pe.b.$){var E=Pe.a.a,p=Pe.b.a,De=Pe.c.a,Ue=f(Ao,p,E.address);if("Nothing"===Ue.$)return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Oe=Ue.a,Me=function(){return al("Initiator"===Oe.$?f(Zm,p.creationInfo.address,De):f(rb,p.creationInfo.address,De))}();return d(gm,t,Do,f(qo,{onBroadcast:ci,onMined:ci,onSign:ci},Me),yr)}var Fe=Pe.a,Ve=Pe.b;return d(gm,t,Do,Fo,M([pa(f(ll,"Encryption successful, but the user or trade is no longer valid.",L(Fe,Ve)))]))}var Ke=Pe.c.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error translating JS encryption result into Elm.",Ke))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return lS(t)}var V=e.a.a;return d(gm,t,Do,Fo,M([pa(f(Lg,"message",V))]));default:return d(gm,t,Do,Fo,M([ga]))}}),kS=r(function(e,t){return{address:e,blocknum:t}}),NS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},RS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(zm,!0,e,t,r))}),$S=n(function(e,t,r){var n=function(e){return r(f(Yh,Sb,e).returnData)},a={address:t.address,fromBlock:jm(t.blocknum),toBlock:jm(t.blocknum),topics:M([si(Ob("Initiated(string,string)"))])};return l(RS,n,e,a)}),_S=function(e){return{data:si(f(Gf,"numTrades()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},LS=r(function(e,t){return f(Zp,t,f(Fp,Xh(e),_S(rh(e))))}),xS=function(e){return{data:si(f(Gf,"phase()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},PS=n(function(e,t,r){return f(Zp,r,f(jp,IC,f(Fp,Xh(e),xS(t))))}),DS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),US=r(function(e,t){return l(La,DS(e),yr,t)}),OS=function(e){return f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},MS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},FS=function(e){return f(MS,Ja(Hb),Sa(e.trades))},VS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:FS(e),loaded:Ti(OS(e))})})},KS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),HS=r(function(e,t){var r=f(Zc,e,t.trades);if("Just"===r.$){var n=(r.a,l(af,e,Hb,t.trades));return l(KS,VS(D(t,{trades:n})),Do,yr)}return l(KS,t,Do,M([pa(f(ll,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),jS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Qb,t,a),o=l(af,e,i,r.trades);return L(VS(D(r,{trades:o})),yr)}return L(r,M([f(ll,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),qS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Xb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(af,e,ym(D(a,{state:D(i,{phase:t})})),r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),zS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Zb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),YS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(eC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),WS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),JS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),QS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),XS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),ZS=function(e){return{$:"NumTradesFetchedAgain",a:e}},eT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),tT=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),rT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),nT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),aT=function(e){return l(KS,e,Do,yr)},iT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=$C(n),i=xC(f(xa,jy(t.factory),f(Ai,0,a-1))),o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,0,a-1)));return l(KS,D(t,{dataFetchState:l(QS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CheckForNewTrades":return l(KS,t,f(LS,t.factory,ZS),yr);case"UpdateTradePhases":var s=Po(mE(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(PS,e.factory,e.creationInfo.address,f(tT,e.factory,e.id)))},OS(t))));return l(KS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(GS,d,p,t),v=function(){var e=L(p,f(Zc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=NS(r);if("Just"===n.$){var a=n.a;return L(l(NC,c,a.address,nT(d)),yr)}return L(Do,M([pa(f(ll,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Do,yr)}e.b;return L(Do,M([pa(f(ll,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(KS,g.tradeCache,Po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(KS,t,Do,M([pa(f(hS,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=$C(n);if(_(C,E)<0){var S=t.dataFetchState,o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,C,E-1))),T=xC(f(xa,jy(t.factory),f(Ai,C,E-1)));return l(KS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(vE,t.trades,T)}),o,yr)}return aT(t)}b.b;return l(KS,t,Do,M([pa(f(ll,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(kS,w.address_,$C(w.blocknum)),A=l($S,t.eventSentry,I,XS(d)),B=A.a,k=A.b,y=Po(M([h(RC,t.factory,I.address,eT(d),nT(d),rT(d)),k])),N=l(jS,d,I,t),R=N.a,$=N.b;return l(KS,VS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(KS,t,Do,M([pa(f(_g,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(qS,d,P,t)}var U=r.a.a;return l(KS,t,Do,M([pa(f(ll,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(YS,d,O,t)}return l(KS,t,Do,M([pa(f(hS,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(zS,d,F,t)}return l(KS,t,Do,M([pa(f(hS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=lb(V.terms);if("Ok"===K.$){var H=K.a;return l(WS,d,H,t)}var j=K.a;return f(HS,d,t)}var j=r.a;return l(KS,t,Do,M([pa(f(ll,"Error decoding initiated event",j))]));default:var q=e.a,G=f(IS,q,t.eventSentry),z=G.a,y=G.b;return l(KS,D(t,{eventSentry:z}),y,yr)}}),oT=function(e){return{$:"AgentHistoryMsg",a:e}},uT=function(e){return{$:"AppCmd",a:e}},sT={$:"BetaLandingPage"},cT={$:"ConnectToWeb3"},fT=function(e){return{$:"MarketplaceMsg",a:e}},lT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),dT=r(function(e,t){return f(kn,e,hl(t))}),hT=function(e){return f(dT,"href",tt(e))},pT=Nn("rel"),gT=dT("target"),vT=function(e){return{$:"Height",a:e}},yT=vT,mT={$:"Content"},bT=mT,CT=function(e){return{$:"Width",a:e}},ET=CT,ST=function(e){return{$:"Attr",a:e}},TT=function(e){return{$:"NodeName",a:e}},wT=function(e){return{$:"Unkeyed",a:e}},IT={$:"AsEl"},AT=IT,BT=r(function(e,t){return{$:"Field",a:e,b:t}}),kT=f(BT,0,0),NT={$:"NoNearbyChildren"},RT={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"},$T=RT.any+" "+RT.column,_T=RT.any+" "+RT.grid,LT=RT.any+" "+RT.page,xT=RT.any+" "+RT.paragraph,PT=RT.any+" "+RT.row,DT=RT.any+" "+RT.single,UT=function(e){switch(e.$){case"AsRow":return PT;case"AsColumn":return $T;case"AsEl":return DT;case"AsGrid":return _T;case"AsParagraph":return xT;default:return LT}},OT=function(e){return{$:"Keyed",a:e}},MT={$:"NoStyleSheet"},FT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),VT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),KT={$:"AsParagraph"},HT=KT,jT=Sn("div"),qT=Sn("p"),GT=Sn("s"),zT=Sn("u"),YT=dT("className"),WT=function(e){return wn(Xe(e))},JT=function(e){return Sn(Xe(e))},QT=function(e){return{$:"Flag",a:e}},XT=function(e){return{$:"Second",a:e}},ZT=function(e){return e>31?XT(1< .ctr > ."+RT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",eI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+" { flex-basis: auto !important; } "+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+Ew(RT.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"+Zw,tI=function(e){return{$:"Intermediate",a:e}},rI=r(function(e,t){return tI({closing:t,others:yr,props:yr,selector:e})}),nI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,tI({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(nI,f(rI,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(nI,f(rI,n.selector,""),v),t.others)})}});return tI(l(La,a,n,t))}),aI=U(eI,function(e){var t=function(e){return Cd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Cd(f(xa,a,t.others)))};return Cd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(nI,f(rI,r,""),n),t)}),yr,e)))}(U(Jw,Xw))),iI=l(JT,"style",yr,M([Tw(aI)])),oI=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+'"'}},uI=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}},sI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ch,uI,t.variants)}return!1},cI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),fI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),lI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(fI,"."+e+"."+t+", ."+e+" ."+t,n),f(fI,"."+e+"."+t+"> ."+RT.text+", ."+e+" ."+t+" > ."+RT.text,a)])}),dI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(lI,i,RT.sizeByCapital,a),l(lI,i,RT.fullSize,n)))}),hI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(fI,"."+r+"."+RT.sizeByCapital+", ."+r+" ."+RT.sizeByCapital,M([L("line-height","1")])),f(fI,"."+r+"."+RT.sizeByCapital+"> ."+RT.text+", ."+r+" ."+RT.sizeByCapital+" > ."+RT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),pI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},gI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Tc,t,r))}return ci},vI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),yI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(xc,e.descender,gI(t)),n=f(xc,e.baseline,gI(f(ml,function(e){return!R(e,r)},t))),a=f(xc,e.capital,pI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(vI,i,a-n,o),full:l(vI,u,a-r,s)}},mI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",mw(e.height)),L("vertical-align",mw(e.vertical)+"em"),L("font-size",mw(e.size)+"em")]))},bI=function(e){return l(Ra,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 si(L(mI(function(e){return e.full}(yI(a))),mI(function(e){return e.capital}(yI(a)))))}return t}return t}),ci,e)},CI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(US,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=bI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,hI(t),n));var i=a.a;return f(Ri,"",f(xa,f(dI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},EI=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+'" '+Ni(r)}},SI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,EI,t.variants)))}return ci},TI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},wI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+mw(r)+"px, "+mw(n)+"px, "+mw(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("+mw(o)+"px, "+mw(u)+"px, "+mw(s)+"px)",b="scale3d("+mw(f)+", "+mw(l)+", "+mw(d)+")",C="rotate3d("+mw(p)+", "+mw(g)+", "+mw(v)+", "+mw(y)+"rad)";return si(m+" "+b+" "+C)}},II=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,cI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,cI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,cI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,cI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+RT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+RT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+RT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,cI(!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,M([f(vw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Tc,1,1-c));return l(a,t,"."+u,M([f(vw,"opacity",mw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(vw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(US,SI,p)),v=M([f(vw,"font-family",f(Ri,", ",f(xa,oI,p))),f(vw,"font-feature-settings",g),f(vw,"font-variant",f(Ch,sI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(vw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(vw,s,bw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+RT.row,A="."+(RT.wrapped+I),B="."+RT.alignRight,k="."+RT.paragraph,N="."+RT.page,R="."+RT.alignLeft,$=mw(S/2)+"px",_=mw(E/2)+"px",x="."+RT.column,y="."+C,P="."+RT.any;return Cd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(vw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(vw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,U(y,k),M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,lw,F.rows))+"-cols-"+f(Ri,"-",f(xa,lw,F.columns))+"-space-x-"+lw(F.spacing.a)+"-space-y-"+lw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=wI(ne),y=hw(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,M([f(vw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=TI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(CI(s),c)}),AI=r(function(e,t){return l(JT,"style",yr,M([Tw(f(II,e,t))]))}),BI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",iI),f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)}),kI=a(function(e,t,r,n){return e?f(ka,iI,f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)):f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)}),NI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(WT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(BI,!1,e,t,r);default:var e=i.a,t=i.b;return d(BI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return jT;case"p":return qT;default:return JT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(kI,!1,e,t,n);default:var e=i.a,t=i.b;return d(kI,!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(JT,e,n,M([f(u,r,M([YT(RT.any+" "+RT.single)]))]))}}();switch(o.$){case"AsRow":return f(ow,sw,e)&&!f(ow,uw,e)?s:f(ow,tw,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerRight])))]),M([s])):f(ow,rw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(ow,iw,e)&&!f(ow,aw,e)?s:f(ow,nw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerCenterY])))]),M([s])):f(ow,ew,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerBottom])))]),M([s])):s;default:return s}}),RI=Tw,$I=function(e){return f(jT,M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthContent,RT.heightContent])))]),M([RI(e)]))},_I=function(e){return l(JT,"div",M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthFill,RT.heightFill])))]),M([Tw(e)]))},LI=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 R(e,HT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,HT),L(f(ka,L(n,f(s.html,MT,e)),i),Iu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,AT)?_I(c):$I(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 R(e,HT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,HT),L(f(ka,f(o.html,MT,e),n),Iu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,AT)?_I(u):$I(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children)),MT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children)),MT))}),xI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),PI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(BT,a|r,n)}var i=e.a;return f(BT,r,i|n)}),DI=ZT(7),UI=ZT(36),OI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(BT,r|a,n|i)}),MI=ZT(6),FI=ZT(38),VI=ZT(30),KI=ZT(29),HI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),jI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),qI=function(e){return{$:"Transform",a:e}},GI=function(e){return{$:"ChildrenBehind",a:e}},zI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),YI=function(e){return{$:"ChildrenInFront",a:e}},WI=r(function(e,t){return f(jT,M([YT(function(){switch(e.$){case"Above":return f(Ri," ",M([RT.nearby,RT.single,RT.above]));case"Below":return f(Ri," ",M([RT.nearby,RT.single,RT.below]));case"OnRight":return f(Ri," ",M([RT.nearby,RT.single,RT.onRight]));case"OnLeft":return f(Ri," ",M([RT.nearby,RT.single,RT.onLeft]));case"InFront":return f(Ri," ",M([RT.nearby,RT.single,RT.inFront]));default:return f(Ri," ",M([RT.nearby,RT.single,RT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Tw("");case"Text":var e=t.a;return $I(e);case"Unstyled":return(0,t.a)(AT);default:return f(t.a.html,MT,AT)}}()]))}),JI=n(function(e,t,r){var n=f(WI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?GI(M([n])):YI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?GI(f(ka,n,a)):f(zI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(zI,M([n]),i):YI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(zI,f(ka,n,a),i):f(zI,a,f(ka,n,i))}}),QI=r(function(e,t){switch(t.$){case"Generic":return TT(e);case"NodeName":var r=t.a;return f(HI,r,e);default:var n=t.a,a=t.b;return f(HI,n,a)}}),XI=function(e){switch(e.$){case"Left":return RT.alignedHorizontally+" "+RT.alignLeft;case"Right":return RT.alignedHorizontally+" "+RT.alignRight;default:return RT.alignedHorizontally+" "+RT.alignCenterX}},ZI=function(e){switch(e.$){case"Top":return RT.alignedVertically+" "+RT.alignTop;case"Bottom":return RT.alignedVertically+" "+RT.alignBottom;default:return RT.alignedVertically+" "+RT.alignCenterY}},eA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),tA=function(e){return{$:"Moved",a:e}},rA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return tA(x(r,0,0));case"MoveY":var n=t.a;return tA(x(0,n,0));case"MoveZ":var a=t.a;return tA(x(0,0,a));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(eA,x(0,0,0),i,x(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 tA(x(s,n,a));case"MoveY":var c=t.a;return tA(x(r,c,a));case"MoveZ":var f=t.a;return tA(x(r,n,f));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,u,x(1,1,1),i,o);default:var l=t.a;return d(eA,u,l,x(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(eA,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(eA,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(eA,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(eA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(eA,u,h,v,y);default:var m=t.a;return d(eA,u,m,p,o)}}}),nA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(kT,n,M([l(jI,n,"height",r+"px")]));case"Content":return x(f(PI,UI,kT),RT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(PI,iw,kT),RT.heightFill,yr):x(f(PI,iw,kT),RT.heightFillPortion+" height-fill-"+Ni(a),M([l(jI,RT.any+"."+RT.row+" > "+Ew("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(jI,u,"min-height",Ni(i)+"px"),c=nA(o),d=c.a,h=c.b,p=c.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(jI,u,"max-height",Ni(g)+"px"),v=nA(o),d=v.a,h=v.b,p=v.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p))}},aA=function(e){switch(e.$){case"Px":var t=e.a;return x(kT,RT.widthExact+" width-px-"+Ni(t),M([l(jI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(PI,FI,kT),RT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(PI,sw,kT),RT.widthFill,yr):x(f(PI,sw,kT),RT.widthFillPortion+" width-fill-"+Ni(r),M([l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(jI,i,"min-width",Ni(n)+"px"),u=aA(a),s=u.a,c=u.b,d=u.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(jI,i,"max-width",Ni(h)+"px"),p=aA(a),s=p.a,c=p.b,d=p.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d))}},iA=ZT(27),oA=r(function(e,t){if(R(e,iA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),uA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=hw(n);if("Nothing"===s.$)return{attributes:f(ka,YT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,YT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,qI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(oA,S,I)){var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(PI,S,r),y=f(rA,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(ow,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=RT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(PI,MI,r),y=n,m=f(ka,l(jI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+RT.widthContent,g=t,v=f(PI,FI,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+RT.widthFill,g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=aA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(ow,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(PI,DI,r),y=n,m=f(ka,l(jI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=RT.heightContent+" "+e,g=t,v=f(PI,UI,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=RT.heightFill+" "+e,g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.column+" > "+Ew("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=nA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(QI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(QI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(QI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(QI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(QI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(QI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(QI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return TT("p");case"NodeName":var e=t.a;return TT(e);default:var r=t.a,n=t.b;return f(HI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(JI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(ow,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=XI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(PI,rw,e);case"Right":return f(PI,tw,e);default:return e}}(f(PI,VI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(ow,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=ZI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(PI,nw,e);case"Bottom":return f(PI,ew,e);default:return e}}(f(PI,KI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),sA={$:"Untransformed"},cA=sA,fA=a(function(e,t,r,n){return l(LI,e,n,v(uA,UT(e),t,kT,cA,yr,yr,NT,$a(r)))}),lA=function(e){return ST(YT(e))},dA=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ST(gT("_blank")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e)))))),wT(M([n])))}),hA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),pA=n(function(e,t,r){return d(hA,e,t,r,1)}),gA=ZT(14),vA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),yA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),mA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return dw(t)+"-"+dw(r)+"-"+dw(n)+"-"+dw(a)},bA=function(e){return f(yA,gA,l(vA,"fc-"+mA(e),"color",e))},CA={align:ul,label:"cantConnectNoWeb3",mainParagraphs:M([M([fl("You need a web3 provider (such as "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(") to Connect.")]),M([fl("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:xg},EA={align:ul,label:"invalidUrl",mainParagraphs:M([M([fl("I don't understand that URL...")]),M([fl("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:$g},SA=function(e){return{$:"Active",a:e}},TA=function(e){return{$:"OnlyNetwork",a:e}},wA=gu(f(zo,jf,f(zo,Hh,$d("Error decoding hex to BigInt")))),IA=function(){return gu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),AA=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}}}}}}}}}}}},BA=function(e){return Em(M([f(Oi,si,e),Fi(ci)]))},kA=f(dh,BA(f(Oh,"status",IA)),f(dh,BA(f(Oh,"root",pu)),l(Im,"logsBloom",pu,l(Im,"logs",Mm(Fm),f(dh,BA(f(Oh,"contractAddress",Am)),l(Im,"cumulativeGasUsed",wA,l(Im,"gasUsed",wA,l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionIndex",Gy,l(Im,"transactionHash",Dm,Fi(AA)))))))))))),NA=function(e){var t=e.a;return jf(t)},RA=f(zo,NA,hl),$A=r(function(e,t){return Up({decoder:kA,method:"eth_getTransactionReceipt",params:M([RA(t)]),url:e})}),_A=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),LA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),xA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),PA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(Io,function(e){return e.b},f(Io,function(e){return e.onMinedTagger},f(fp,t,e))))}),DA=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}}}}}}}}}}}},UA=function(e){return Em(M([Cm(ci),f(Oi,si,e)]))},OA=l(Im,"input",pu,l(Im,"gas",Gy,l(Im,"gasPrice",wA,l(Im,"value",wA,l(Im,"to",UA(Am),l(Im,"from",Am,l(Im,"transactionIndex",Gy,l(Im,"blockNumber",UA(Gy),l(Im,"blockHash",function(e){return f(du,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},cu(t))?Fi(ci):f(Oi,si,e)},pu)}(Rm),l(Im,"nonce",Gy,l(Im,"hash",Dm,Fi(DA)))))))))))),MA=r(function(e,t){return Up({decoder:OA,method:"eth_getTransactionByHash",params:M([RA(t)]),url:e})}),FA=r(function(e,t){return{attempts:e,sleep:t}}),VA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Xp,function(e){return a>0?f(Kp,function(e){return f(VA,f(FA,a,n),t)},bS(1e3*n)):Lp(e)},t)}),KA=r(function(e,t){return f(Kp,function(r){return f(VA,{attempts:30,sleep:1},f(MA,e,t))},bS(250))}),HA=r(function(e,t){return f(VA,{attempts:60,sleep:5},f($A,e,t))}),jA=function(e){return{$:"Mined",a:e}},qA=function(e){return Bo(function(t){return D(t,{status:jA(e)})})},GA=function(e){return{$:"Sent",a:e}},zA=function(e){return Bo(function(t){return D(t,{status:GA(e)})})},YA=function(e){return{$:"Signed",a:e}},WA=function(e){return Bo(function(t){return D(t,{status:YA(e)})})},JA=function(e){return"Nothing"!==e.$},QA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Tl(r),Do);case"TxSigned":var n=e.a,a=e.b,i=f(fp,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(Yg,t,xp(a))}return Do}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Do;if("Just"===t.b.$){var r=t.b.a;return f(Yg,r,xp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Yg,a,xp(fi(e)))}t.a,t.b,t.c;return Do};if("Ok"===a.$){var c=a.a,d=JA(o.onBroadcastTagger)||JA(o.onMinedTagger)?f(il,r.tagger,f(Zp,xA(n),f(KA,r.nodePath,c))):Do;return L(Tl(D(r,{txs:l(bp,n,WA(c),r.txs)})),Po(M([u,d])))}var h=a.a;return L(Tl(r),Po(M([u,s(h)])))}return L(Tl(r),Do);case"TxSent":var n=e.a,p=e.b,g=f(fp,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(il,r.tagger,f(Zp,LA(n),f(HA,r.nodePath,v.hash))):Do}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Yg,t,xp(li(v)))}return Do}();return L(Tl(D(r,{txs:l(bp,n,zA(v),r.txs)})),Po(M([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(Yg,t,xp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Yg,n,xp(fi("Error with TxSent stuff")))}e.a,e.b;return Do}();return L(Tl(r),s)}return L(Tl(r),Do);case"TxMined":var n=e.a,m=e.b,b=f(fp,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Yg,a,xp(li(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 Po(M([f(il,r.tagger,f(Zp,f(_A,n,s),zy(r.nodePath))),f(Yg,a,xp(li(C))),f(Yg,u.toMsg,xp(s))]))}return Do}();return L(Tl(D(r,{txs:l(bp,n,qA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Yg,r,xp(fi("TxReceipt decoding failure")))}return Do}();return L(Tl(r),S)}return L(Tl(r),Do);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(PA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Tl(r),f(Yg,B,f(Xp,function(e){return xp(D(I,{doneWatching:!0,reOrg:!0}))},f(Kp,function(e){return xp(D(I,{doneWatching:!0}))},f($A,r.nodePath,T.txHash)))))}return L(Tl(r),Do)}if(R(w,T.lastCheckedBlock))return L(Tl(r),f(il,r.tagger,f(Zp,f(_A,n,T),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))));var k=f(PA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Tl(r),Po(M([f(il,r.tagger,f(Zp,f(_A,n,I),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))),f(Yg,B,xp(I))])))}return L(Tl(r),Do)}var n=e.a,h=e.c.a;return L(Tl(r),Do);default:var h=e.a;return L(Tl(r),Do)}}),XA=Jt,ZA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),eB=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),tB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(eB,"#",e.fragment,l(eB,"?",e.query,U(f(ZA,e.port_,U(t,e.host)),e.path)))},rB=r(function(e,t){return e<0?ci:Ql(f(nd,e,t))}),nB=r(function(e,t){if(e<0)return t;var r=Bh(f(nd,e,t)),n=f(lc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),aB=n(function(e,t,r){if(e<0)return r;var n=f(nd,e,r),a=f(lc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),iB=r(function(e,t){return f(aB,e,ms(t))}),oB=r(function(e,t){Kv(t);switch(t.$){case"Home":return L(D(e,{submodel:sT}),Do);case"Create":var r=Xd(e.wallet),n=f(Ul,e.txSentry,f(Yo,Uy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(sB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),Po(M([f(il,Uy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(By,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(Wm,e.wallet,r)}return l(vm,e.wallet,u,s)}(),c=f(Ul,e.txSentry,f(Yo,Fy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(sB,U(f(Qi,Fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:My(r.model),txSentry:a}),Po(M([f(il,Fy,r.cmd),i]))));case"Marketplace":var d=Bv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Oy(h)}),Po(M([f(il,fT,p)])));case"AgentHistory":var g=t.a,v=f(Uo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:Py(y)}),Po(M([f(il,oT,m)])));default:return L(f(uo,EA,e),Do)}}),uB=r(function(e,t){var r=t.a,n=t.b,a=f(cB,uT(e),r),i=a.a,o=a.b;return L(i,Po(M([n,o])))}),sB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,uB,L(r,n),e)}),cB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(cB,cT,t);case"GotoRoute":var n=r.a;return L(t,f(Cy,t.key,n));case"GTag":var a=r.a;return L(t,wy(Sy(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),wy(Sy(d(Ol,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Uv,ky,o,u,s));default:return L(t,Ny(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(nB,c,t.userNotices)}),Do);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(by,t.key,tB(e))}var r=h.a;return XA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(fB,g,t);case"GotoRoute":var v=e.a;return L(t,Po(M([wy(Sy(d(Ol,"GotoRoute","navigation",Kv(v),0))),f(Cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Do);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,CA,t),Do):L(t,Ey(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Do;var t=e.a;return Iy(f(Ty,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(D(t,{userAddress:m.account,wallet:TA(m.networkId)}),b);case"UserPubkeySet":var C=e.a,E=f(Gh,pu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=SA(l(Ml,I,w,S)),B=f(Vy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ll,"Unexpected wallet state encounted when setting commPubkey!",L(t.userAddress,t.wallet)),t),Do)}T.a;return L(f(uo,f(ll,"User pubkey set, but I can no longer find the user address!",ci),t),Do)}var N=E.a;return L(l(Pa,uo,f(ll,"error decoding commPubkey from JS",N),t),Do);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(lv,R,_),P=f(Ul,t.txSentry,f(Yo,Uy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(sB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),Po(M([f(il,Uy,x.cmd),F]))))}return L(t,Do);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(BS,K,j),q=f(Ul,t.txSentry,f(Yo,Fy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(sB,U(f(Qi,Fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:My(x.model),txSentry:O}),Po(M([f(il,Fy,x.cmd),F]))))}return L(t,Do);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Dv,G,Y);return f(sB,f(Qi,fT,x.appCmds),L(D(t,{submodel:Oy(x.model)}),f(il,fT,x.cmd)))}return L(t,Do);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(ol,W,Q),X=f(Ul,t.txSentry,f(Yo,oT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(sB,U(f(Qi,oT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Py(x.model),txSentry:O}),Po(M([f(il,oT,x.cmd),F]))))}return L(t,Do);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(_u,si,f(QA,Z,r))}return L(ci,Do)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(rB,re,t.tradeCaches);if("Nothing"===ae.$)return f(uB,pa(f(ll,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Do));var ie=ae.a,x=f(iT,ne,ie);return L(D(t,{tradeCaches:l(iB,re,x.tradeCache,t.tradeCaches)}),f(il,lT(re),x.cmd));case"NoOp":return L(t,Do);default:var N=e.a;f(cl,"test",N);return L(t,Do)}}),fB=r(function(e,t){return f(oB,t,my(e))}),lB=Ge("txIn",Sm),dB=je("txOut",Ua),hB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},pB=function(e){return{$:"EventSentryMsg",a:e}},gB=function(e){var t=f(cm,pB,Xh(e)),r=t.a,n=t.b;return x({dataFetchState:l(QS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Zd,"tradeCache init","processing",hB(e),0)]))},vB=function(e){return{$:"InitialNumTradesFetched",a:e}},yB=function(e){return f(LS,e.factory,vB)},mB=function(e){var t=gB(e),r=t.a,n=t.b,a=t.c;return x(r,Po(M([n,yB(r)])),a)},bB=function(e){return{$:"TxSentryMsg",a:e}},CB={align:ul,label:"noWeb3Provider",mainParagraphs:M([M([fl("No web3 provider detected. Is "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(" or some other web3 provider installed and unlocked?")])]),noticeType:xg},EB={$:"TopLeft"},SB={align:EB,label:"screenToSmall",mainParagraphs:M([M([fl("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:xg},TB={align:ul,label:"wrongWeb3Network",mainParagraphs:M([M([fl("Make sure your wallet is set to a compatible network.")]),M([fl(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:$g},wB={$:"NoneDetected"},IB=function(e){return f(Bo,Xh,Mg(e))},AB={$:"ETCMain"},BB={$:"ETCTest"},kB={$:"Expanse"},NB={$:"Kovan"},RB={$:"Mainnet"},$B=function(e){return{$:"Private",a:e}},_B={$:"Rinkeby"},LB={$:"Ropsten"},xB={$:"RskMain"},PB={$:"RskTest"},DB=function(e){switch(e){case 1:return RB;case 2:return kB;case 3:return LB;case 4:return _B;case 30:return xB;case 31:return PB;case 42:return NB;case 41:return AB;case 62:return BB;default:return $B(e)}},UB=n(function(e,t,r){var n=e.a,a=e.b;return Tl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:cp})}),OB=n(function(e,t,n){var a=e.networkId?TA(DB(e.networkId)):wB,i=f(Bo,function(e){return l(UB,L(dB,lB),bB,e)},IB(a)),o=e.width<1024?si(SB):ci,u=f(xa,mB,ro),s=function(){return R(a,wB)?si(CB):"Nothing"===Mg(a).$?si(TB):ci}(),c=mE(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ay(f(Bi,r(function(e,t){return f(Qi,lT(e),t)}),g)),y=Po(f(Bi,r(function(e,t){return f(il,lT(e),t)}),p)),m=f(sB,v,f(fB,t,{key:n,screenWidth:e.width,submodel:sT,time:Vl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),Po(M([y,C])))}),MB=Oe,FB=MB(yr),VB=function(e){return FB},KB=function(e){return{$:"Refresh",a:e}},HB=r(function(e,t){return{$:"Every",a:e,b:t}}),jB=r(function(e,t){return{processes:t,taggers:e}}),qB=xp(f(jB,cp,cp)),GB=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(SS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),zB=Ne,YB=r(function(e,t){var r=e.a,n=e.b,a=f(fp,r,t);if("Nothing"===a.$)return l(xl,r,M([n]),t);var i=a.a;return l(xl,r,f(ka,n,i),t)}),WB=Be,JB=r(function(e,t){return{$:"Zone",a:e,b:t}}),QB=ca,XB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=WB(f(QB,n,f(Sp,e,n)));return f(Kp,function(t){return l(XB,e,a,l(xl,n,t,r))},i)}return xp(r)}),ZB=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 x(n,a,f(Kp,function(e){return i},zB(t)))}),u=l(Ra,YB,cp,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(xl,e,r,i),o)}),d=p(GB,s,c,o,u,i,x(yr,cp,xp(gr))),h=d.a,g=d.b,v=d.c;return f(Kp,function(e){return xp(f(jB,u,e))},f(Kp,function(t){return l(XB,e,h,g)},v))}),ek=function(e){return we(function(t){t(Se(e(Date.now())))})}(Vl),tk=n(function(e,t,r){var n=f(fp,t,r.taggers);if("Nothing"===n.$)return xp(r);var a=n.a,i=function(t){return Gp(f(xa,function(r){return f(Ep,e,r(t))},a))};return f(Kp,function(e){return xp(r)},f(Kp,i,ek))}),rk=r(function(e,t){var r=t.a,n=t.b;return f(HB,r,f(Da,e,n))});pn.Time=Pe(qB,ZB,tk,0,rk);var nk=Ue("Time"),ak=r(function(e,t){return nk(f(HB,e,t))}),ik=function(e){return f(ak,2e3,KB)},ok=function(e){return FB},uk=function(e){return{$:"DecryptionFinished",a:e}},sk=Ge("decryptionFinished",Sm),ck=Ge("encryptionFinished",Sm),fk=function(e){return{$:"EncryptionFinished",a:e}},lk=function(e){return{$:"Refresh",a:e}},dk=function(e){return MB(M([f(ak,3e3,lk),ck(fk),sk(function(e){return jE(uk(e))})]))},hk=yn,pk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return FB;case"CreateModel":t.a;return f(hk,Uy,ik());case"TradeModel":t.a;return f(hk,Fy,dk());case"MarketplaceModel":t.a;return f(hk,fT,ok());default:t.a;return f(hk,oT,VB())}},gk=Ge("userPubkeyResult",Sm),vk=Ge("walletSentryPort",Sm),yk={$:"CheckForNewTrades"},mk={$:"UpdateTradePhases"},bk=function(e){return MB(M([f(ak,5e3,function(e){return yk}),f(ak,3e3,function(e){return mk})]))},Ck=function(e){return{$:"Tick",a:e}},Ek=function(e){return{$:"UserPubkeySet",a:e}},Sk=function(e){return{$:"WalletStatus",a:e}},Tk=function(e){return f(ll,"Error decoding JS walletSentry: "+e,ci)},wk=function(e){return{$:"ErrorDecoding",a:e}},Ik=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Ak=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Oh,"ref",CE),f(Oh,"txHash",BA(Dm))),Bk=function(e){var t=f(Gh,Ak,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Ik,r.ref,li(a))}return f(Ik,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return wk("Error decoding tx data")},kk=function(e){var t=e.a;return f(hk,t.tagger,t.inPort(Bk))},Nk=f(Oi,DB,CE),Rk=gu(f(zo,rd,f(zo,$d("Failure decoding stringy int"),au(DB)))),$k=Em(M([Rk,Nk])),_k=r(function(e,t){return{account:e,networkId:t}}),Lk=l(Mi,_k,f(Oh,"account",BA(Am)),f(Oh,"networkId",$k)),xk=n(function(e,t,r){var n=f(Gh,Lk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),Pk=function(e){var t=f(zo,Tk,f(zo,pa,uT));return MB(U(M([f(ak,1e3,Ck),vk(f(xk,t,Sk)),f(xc,FB,f(Bo,kk,e.txSentry)),gk(Ek),MB(f(Bi,r(function(e,t){return f(hk,lT(e),t)}),f(xa,bk,e.tradeCaches)))]),M([pk(e)])))},Dk=function(e){return{$:"LinkClicked",a:e}},Uk=function(e){return{$:"UrlChanged",a:e}},Ok=n(function(e,t,r){return d(hA,e/255,t/255,r/255,1)}),Mk=l(Ok,10,33,108),Fk={$:"Generic"},Vk=Fk,Kk=r(function(e,t){return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),e)),wT(M([t])))}),Hk=function(e){return{$:"Fill",a:e}},jk=Hk(1),qk=Hi,Gk=function(e){return{$:"Px",a:e}},zk=Gk,Yk=ZT(8),Wk=function(e){return f(yA,Yk,l(vA,"bg-"+mA(e),"background-color",e))},Jk=f(Kk,M([ET(jk),yT(zk(150)),Wk(Mk)]),qk),Qk=function(e){return{$:"GotoRoute",a:e}},Xk={$:"Active"},Zk={$:"Important"},eN={$:"Normal"},tN=l(pA,1,1,1),rN=ZT(2),nN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),aN=r(function(e,t){return R(e,t)?f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e)):f(yA,rN,h(nN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),iN=ZT(21),oN=r(function(e,t){return{$:"Class",a:e,b:t}}),uN=f(oN,iN,RT.cursorPointer),sN=ZT(17),cN=function(e){return f(yA,sN,l(jI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},fN=function(e){return{$:"Normal",a:e}},lN=An,dN=r(function(e,t){return f(lN,e,fN(t))}),hN=function(e){return f(dN,"click",Fi(e))},pN=f(Da,ST,hN),gN=ZT(13),vN=f(oN,gN,RT.textSemiBold),yN=ZT(4),mN=function(e){return{$:"FontSize",a:e}},bN=function(e){return f(yA,yN,mN(e))},CN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([cN(4),Wk(l(pA,0,0,1))]);default:return M([cN(4),Wk(l(pA,.9,0,0))])}}();return f(Kk,U(M([f(aN,23,12),bN(22),vN,bA(tN),uN,pN(t)]),n),fl(e))}),EN=l(Ok,244,0,103),SN=function(e){return{$:"AlignX",a:e}},TN={$:"CenterX"},wN=SN(TN),IN=ZT(3),AN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),BN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),kN=function(e){return f(yA,IN,l(AN,f(BN,e,e),e,e))},NN=function(e){return{$:"Describe",a:e}},RN={$:"Paragraph"},$N=r(function(e,t){return d(fA,HT,Vk,f(ka,NN(RN),f(ka,ET(jk),f(ka,kN(5),e))),wT(t))}),_N=f(oN,gN,RT.bold),LN=f(Kk,M([bN(29),bA(tN),_N,wN,uN,pN(Qk(Gv))]),f($N,yr,M([fl("DAI"),f(Kk,M([bA(EN)]),fl("Hard"))]))),xN={$:"Right"},PN=SN(xN),DN={$:"AsColumn"},UN=DN,ON=r(function(e,t){return d(fA,UN,Vk,f(ka,lA(RT.contentTop+" "+RT.contentLeft),f(ka,yT(bT),f(ka,ET(bT),e))),wT(t))}),MN={$:"AsRow"},FN=MN,VN=r(function(e,t){return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY),f(ka,ET(bT),f(ka,yT(bT),e))),wT(t))}),KN=function(e){return f(VN,M([ET(jk),kN(30),f(aN,30,17)]),M([l(CN,"Browse Offers",Qk(zv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Xk}return eN}()),l(CN,"Create a New Offer",Qk(qv),function(){return"CreateModel"===e.submodel.$?Xk:eN}()),function(){var t=Gd(e.wallet);if("Just"===t.$){var r=t.a;return l(CN,"My Trades",Qk(jv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Xk:eN}return eN}())}return l(CN,"Connect to Wallet",cT,Zk)}(),f(ON,M([PN,kN(0),f(aN,8,0)]),M([LN]))]))},HN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},jN=function(e){return ml(e)},qN=r(function(e,t){return f(ml,dv(e),t)}),GN=function(e){return f(ml,function(e){return Kb(e.parameters)},OS(e))},zN={$:"BurnWindow"},YN={$:"FiatPrice"},WN={$:"Margin"},JN={$:"Offer"},QN={$:"PaymentWindow"},XN=function(e){return{$:"AlignY",a:e}},ZN={$:"CenterY"},eR=XN(ZN),tR=ZT(20),rR=f(oN,tR,RT.clip),nR=Hk,aR=function(e){return f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e))},iR=r(function(e,t){return f(Kk,M([ET(nR(e)),yT(zk(60)),rR,Wk(tN)]),f(Kk,M([aR(12),eR,ET(jk)]),t))}),oR=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},uR=function(e){return{$:"JustImage",a:e}},sR=uR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),cR=dT("alt"),fR=function(e){return f(dT,"src",rt(e))},lR=r(function(e,t){var r=t.src,n=t.description,a=f(ml,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(fA,AT,Vk,f(ka,lA(RT.imageContainer),e),wT(M([d(fA,AT,TT("img"),U(M([ST(fR(r)),ST(cR(n))]),a),wT(yr))])))}),dR=r(function(e,t){if("None"===t.$)return qk;var r=t.a;return f(lR,e,r)}),hR=uR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),pR=function(e){return{$:"ChangeSort",a:e}},gR=f(oN,gN,RT.textMedium),vR=function(e){return f(Kk,M([gR,bN(17)]),fl(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},yR=r(function(e,t){return f(VN,M([kN(5),uN,pN(pR(e))]),M([vR(e),function(){if("Just"===t.$){var e=t.a;return f(Kk,M([eR]),f(dR,M([ET(zk(8))]),function(){return"Ascending"===e.$?sR:hR}()))}return qk}()]))}),mR=r(function(e,t){return f(iR,oR(t),f(yR,t,e))}),bR=r(function(e,t){return f(VN,M([ET(jk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(mR,r,t)},t))}),CR=l(Ok,150,150,150),ER=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},SR=r(function(e,t){return f(ts,e.amount,t.amount)}),TR=n(function(e,t,r){return f(e,r,t)}),wR=function(e){var t=e.a;return(R(e.b,Lo)?Ua:TR)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(wR,L(Av,Zf),e,t):f(Ku,ER(e.state.phase),ER(t.state.phase))});case"Expires":return r(function(e,t){return f(hv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Sv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(SR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(xc,ma,l(zd,r(function(e,t){return f(Ku,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(hv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(hv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},IR=l(Ok,233,237,242),AR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),BR=function(e){return f(Kk,M([ET(jk),yT(jk),rR]),f($N,M([bN(12)]),M([fl(e.info)])))},kR=function(e){return f(xc,qk,f(Bo,BR,Ql(e)))},NR=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"}},RR=function(e){return{$:"TimeLeft",a:e}},$R=function(e){return{$:"TimeUp",a:e}},_R=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 Vl(0)}}),LR=r(function(e,t){return Vl(jd(e)-jd(t))}),xR=r(function(e,t){var r=f(_R,t.state.phase,t),n=f(LR,e,t.state.phaseStartTime),a=f(LR,r,n);return jd(a)>0?RR(L(a,r)):$R(r)}),PR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},DR=l(pA,0,0,0),UR=l(Ok,51,183,2),OR=function(e){var t=ju(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Qo(n));return n+(function(){if(a){return f(ru,a+1,f(Zo,1,mw(r)))}return""}()+"%")},MR=r(function(e,t){return uR({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"}()})}),FR=n(function(e,t,r){return f(dR,f(ka,yT(zk(34)),e),f(MR,t,r))}),VR=r(function(e,t){var r=OR(t);if("0%"===r)return f(Kk,M([bN(16)]),fl("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?UR:EN;return f(VN,M([kN(4)]),M([l(FR,yr,a,si(i)),f(Kk,M([bA(o),bN(16)]),fl(n))]))}),KR=uR,HR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(xl,r,n,t)}),cp,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,KR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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(xc,"",f(Bo,Qa,f(fp,e,HR)))},qR=function(e){return Qo(e)<=3?e:qR(f(Td,3,e))+","+f(ou,3,e)},GR=function(e){return qR(Sd(e))},zR=function(e){return U(jR(e.fiatType),GR(e.amount))},YR=hA,WR=function(e){var t=function(){var t=f(fp,e.fiatType,HR);if("Nothing"===t.$)return qk;var r=t.a,n=(r.a,r.b);return f(dR,M([yT(zk(26))]),n)}();return f(VN,M([kN(4)]),M([t,f(Kk,M([bA(d(YR,0,0,0,.5)),gR,ET(zk(50))]),fl(e.fiatType)),fl(zR(e))]))},JR=function(e){return jd(e)<0},QR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),XR=function(e){var t=vg(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(QR,$C(t),$C(r),$C(n),$C(a))}(f(xc,L(qu(0),qu(0)),f(Ts,n,qu(60))))}(f(xc,L(qu(0),qu(0)),f(Ts,r,qu(3600))))}(f(xc,L(qu(0),qu(0)),f(Ts,t,qu(86400))))},ZR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!JR(a)){var u=r(function(e,t){return U(l(Rs,2,P("0"),Ni(e)),t)}),s=jd(a)>0?i:o,c=XR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(VN,U(M([kN(5)]),e),M([f(Kk,U(M([bA(h)]),t),fl(f(u,c.days,"d"))),f(Kk,U(M([bA(d)]),t),fl(f(u,c.hours,"h"))),f(Kk,U(M([bA(s)]),t),fl(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Vl(0);e=p,t=g,n=v,a=y}}),e$={$:"Behind"},t$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),r$=function(e){return f(t$,e$,e)},n$=r(function(e,t){var r=sv(200*e),n=200-r,a=f(Kk,M([ET(nR(n))]),qk),i=M([yT(zk(3)),cN(20)]),o=f(Kk,U(i,M([ET(nR(r)),Wk(t)])),qk),u=f(Kk,U(i,M([ET(jk),Wk(IR)])),qk);return f(VN,M([ET(jk),r$(u)]),M([o,a]))}),a$=l(pA,1,1,0),i$=r(function(e,t){return jd(e)/jd(t)}),o$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(i$,o,u),c=(f(Kk,M([wN]),d(ZR,yr,yr,L(a,i),o)),s<.1?EN:s<.2?a$:UR);return f(ON,U(M([kN(5)]),e),M([d(ZR,M([wN]),t,L(a,i),o),f(n$,1-s,c)]))}),u$=function(e){var t=wd(jl(e)),r=f(Xl,".",t);if(!r.b)return t;if(r.b.b){cl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(ru,3,t);case 1:return f(ru,4,f(xc,t,f(Bo,mw,f(Bo,function(e){return e/100},f(Bo,Ka,f(Bo,sv,f(Bo,ti(100),Bd(t))))))));default:var n=r.a;return f(xc,f(ru,n,t),f(Bo,Ni,f(Bo,sv,Bd(t))))}},s$=n(function(e,t,r){return f(iR,oR(t),function(){switch(t.$){case"Phase":var n=PR(r.state.phase),a=L(f(xR,e,r),r.state.phase);e:for(;;){if("TimeLeft"===a.a.$){if("Closed"===a.b.$)break e;var i=a.a.a,o=f(i$,i.a,i.b)<.05?EN:DR;return f(ON,M([kN(3)]),M([fl(n),d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)]))}if("Closed"===a.b.$)break e;var u=a.a.a;return f(VN,M([kN(6),bA(CR)]),M([fl(n),f(Kk,M([bN(16)]),fl("(stale)"))]))}a.b;return fl(n);case"Expires":if("Open"===r.state.phase.$){var s=f(xR,e,r);if("TimeLeft"===s.$){var i=s.a,o=f(i$,i.a,i.b)<.05?EN:DR;return d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)}var u=s.a;return d(o$,M([ET(jk)]),M([bN(16)]),L(EN,IR),L(Vl(0),u))}return qk;case"Offer":return f(VN,M([kN(5)]),M([fl(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(u$(r.parameters.tradeAmount)+" ")+NR(r.factory))]));case"FiatPrice":return WR(r.terms.price);case"Margin":var c=R(r.parameters.initiatorRole,fo);return f(xc,qk,f(Bo,VR(c),r.derived.margin));case"PaymentWindow":var l=function(){return"Seller"===r.parameters.initiatorRole.$?EN:UR}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoabortInterval);default:var l=function(){return"Seller"===r.parameters.initiatorRole.$?UR:EN}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoreleaseInterval)}}())}),c$=n(function(e,t,r){return f(ON,M([ET(jk),kN(1),Wk(IR),uN,pN(f(AR,r.factory,r.id))]),M([f(VN,M([ET(jk),kN(1)]),f(xa,function(t){return l(s$,e,t,r)},t)),f(iR,1,kR(r.terms.paymentMethods))]))}),f$=Er,l$=ZT(28),d$=function(e){return f(yA,l$,l(vA,"bc-"+mA(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(yA,iA,h(h$,"b-"+Ni(e),e,e,e,e))},g$=a(function(e,t,r,n){return f(ON,M([ET(jk),p$(2),cN(8),d$(CR),kN(2),Wk(CR),rR]),f(xa,f(c$,e,r),f(f$,wR(t.orderBy),n)))}),v$=a(function(e,t,r,n){return f(ON,M([ET(jk),yT(jk),kN(5)]),M([f(bR,t.orderBy,r),d(g$,e,t,r,n)]))}),y$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),m$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(yA,rN,h(nN,"p-"+Ni(t),t,t,t,t)):f(yA,rN,h(nN,d(y$,t,r,n,a),t,r,n,a))},b$=lA(RT.italic),C$=a(function(e,t,r,n){var a=f(qN,n.filters,ay(f(xa,function(e){return f(jN,HN(n),GN(e))},r)));return R(a,yr)?f(Kk,M([wN,bN(24),m$({bottom:0,left:0,right:0,top:30}),b$]),fl(t?"No trades found with those filters.":"Initializing Trade Cache...")):f(Yi,Ko,d(v$,e,n.tradeTable,M([xo,JN,YN,WN,QN,zN]),a))}),E$=r(function(e,t){return f(Kk,M([cN(4),Wk(d(YR,0,0,1,.1)),bA(l(Ok,16,7,234)),bN(e),vN,f(aN,15,13)]),fl(dl(t)))}),S$=function(e){return function(){var t=Gd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?qk:f(VN,M([kN(10),m$({bottom:20,left:20,right:20,top:10})]),M([f(Kk,M([bN(24),vN]),fl("Trade History for User")),f(E$,18,e.agentAddress)]))},T$=function(e){return{$:"FiltersMsg",a:e}},w$=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},I$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),A$=xI,B$={$:"Left"},k$=SN(B$),N$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(fA,UN,TT("label"),e,wT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(fA,AT,Vk,a,wT(M([i])));switch(n.$){case"Above":return d(fA,UN,TT("label"),e,wT(M([o,r])));case"Below":return d(fA,UN,TT("label"),e,wT(M([r,o])));case"OnRight":return d(fA,FN,TT("label"),e,wT(M([r,o])));default:return d(fA,FN,TT("label"),e,wT(M([o,r])))}}),R$=function(e){return{$:"Label",a:e}},$$={$:"NoAttribute"},_$=function(e){if("HiddenLabel"===e.$){var t=e.a;return NN(R$(t))}return $$},L$=function(e){return"HiddenLabel"===e.$},x$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return hu("No key matched");var n=r.a;return Fi(n)},r=f(du,t,f(Oh,"key",pu));return ST(f(dN,"keyup",r))},P$=function(e){return f(Nn,"tabIndex",Ni(e))},D$=f(Da,ST,P$),U$={$:"LivePolite"},O$=NN(U$),M$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([L$(r)?$$:kN(6),ST(hN(i(!a))),O$,x$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),D$(0),uN,k$,ET(jk)]),e);return l(N$,o,r,d(fA,AT,Vk,M([ST(f(A$,"role","checkbox")),ST(f(A$,"aria-checked",a?"true":"false")),_$(r),eR,yT(jk),ET(bT)]),wT(M([n(a)]))))}),F$=Br,V$=function(e){return e*F$/180},K$=ZT(26),H$=function(e){return{$:"MoveY",a:e}},j$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),q$=function(e){return f(j$,K$,H$(-e))},G$=ZT(24),z$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),Y$=function(e){return f(j$,G$,f(z$,x(0,0,1),e))},W$=ZT(19),J$=function(e){return Cd(M([e.inset?"box-inset":"box-",mw(e.offset.a)+"px",mw(e.offset.b)+"px",mw(e.blur)+"px",mw(e.size)+"px",mA(e.color)]))},Q$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(yA,W$,l(jI,J$(t),"box-shadow",Cw(t)))},X$=r(function(e,t){return f(yA,iA,h(h$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Z$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?p$(r):f(X$,n,r):f(yA,iA,h(h$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},e_=ZT(12),t_=f(oN,e_,RT.textCenter),r_=l(pA,1,1,1),n_=function(e){return f(Kk,M([lA("focusable"),ET(zk(14)),yT(zk(14)),bA(r_),eR,bN(9),t_,cN(3),d$(e?l(pA,59/255,.6,252/255):l(pA,211/255,211/255,211/255)),Q$({blur:1,color:e?d(YR,238/255,238/255,238/255,0):l(pA,238/255,238/255,238/255),offset:L(0,0),size:1}),Wk(e?l(pA,59/255,.6,252/255):r_),p$(e?0:1)]),e?f(Kk,M([d$(r_),yT(zk(6)),ET(zk(9)),Y$(V$(-45)),wN,eR,q$(1),Z$({bottom:2,left:2,right:0,top:0})]),qk):qk)},a_=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),i_={$:"OnRight"},o_=a_(i_),u_=r(function(e,t){return f(M$,yr,{checked:t.checked,icon:n_,label:f(o_,yr,fl(t.label)),onChange:f(I$,e,t.label)})}),s_={$:"Top"},c_=XN(s_),f_=function(e){return f(ON,M([kN(15),c_]),M([f(Kk,M([bN(28),gR]),fl(w$(e.type_))),f(ON,M([kN(5)]),f(xa,u_(e.type_),e.options))]))},l_=function(e){return f(VN,M([kN(20)]),f(xa,f_,e))},d_={$:"NoneFound"},h_={$:"AllFetched"},p_={$:"FetchingTrades"},g_={$:"QueryingNumTrades"},v_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return g_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?p_:h_}return d_},y_={$:"InFront"},m_=function(e){return f(t$,y_,e)},b_=r(function(e,t){var r=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},n=f(Eh,Ja(d_),f(xa,v_,e))?M([r("No trades found.")]):f(xa,r,mE(f(xa,function(e){switch(v_(e).$){case"QueryingNumTrades":return si("Querying "+hB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+hB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),m_(f(ON,M([kN(5),k$]),n))]),f(Kk,M([wN]),f(Yi,T$,l_(t.filters))))}),C_=n(function(e,t,r){return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),f(aN,30,20)]),M([S$(r),f(b_,t,r),function(){var n=f(Eh,f(zo,v_,Ja(h_)),t);return d(C$,e,n,t,r)}()]))}),E_=function(e){return{$:"ShowCurrencyDropdown",a:e}},S_={$:"AbortCreate"},T_=function(e){return{$:"AppCmd",a:e}},w_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),I_=function(e){return f(xa,function(e){return M([f(Kk,M([bA(EN)]),fl("Caution! ")),fl(e)])},mE(M([R(f(hv,e.autoreleaseInterval,Vl(12e5)),ba)?si(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."}()):ci,R(f(hv,e.autoabortInterval,Vl(36e5)),ba)?si(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.'}()):ci])))},A_=l(pA,0,0,1),B_=function(e){return f(Kk,M([m$({bottom:5,left:5,right:5,top:0}),pN(e),cN(30),Wk(d(YR,1,1,1,.4)),p$(1),d$(d(YR,0,0,0,.3)),uN,bN(14)]),f(Kk,M([bA(d(YR,0,0,0,.7))]),fl("x")))},k_=Bn,N_=k_,R_=ST,$_=r(function(e,t){return f(Kk,M([r$(f(Kk,M([Wk(e),R_(f(N_,"position","fixed")),R_(f(N_,"z-index","1000")),R_(f(N_,"top","0")),R_(f(N_,"left","0")),R_(f(N_,"width","100%")),R_(f(N_,"height","100%"))]),qk)),ET(jk),yT(jk)]),t)}),__=r(function(e,t){return{$:"Max",a:e,b:t}}),L_=r(function(e,t){return f(__,e,t)}),x_=n(function(e,t,r){return l(Pa,$_,d(YR,0,0,.3,.6),f(Kk,U(M([wN,eR,ET(f(L_,500,bT)),Wk(tN),cN(8),m_(f(Kk,M([PN,c_]),B_(r)))]),e),t))}),P_=r(function(e,t){if("Nothing"===t.$)return qk;var r=t.a;return f(Kk,U(M([cN(5),d$(l(pA,.9,0,0)),p$(1),Wk(l(pA,1,.4,.4)),aR(5),wN,eR,ET(f(L_,200,bT)),bN(14)]),e),f($N,yr,M([fl(r)])))}),D_={$:"Above"},U_=function(e){return f(t$,D_,e)},O_=r(function(e,t){return f(Kk,M([cN(4),f(aN,25,17),bN(18),vN,Wk(IR),U_(f(P_,M([q$(5)]),t))]),fl(e))}),M_=a(function(e,t,r,n){return d(hA,e/255,t/255,r/255,n)}),F_=d(M_,1,31,52,.64),V_=ZT(32),K_={$:"Active"},H_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),j_=$n,q_=r(function(e,t){switch(t.$){case"NoAttribute":return $$;case"Describe":var r=t.a;return NN(r);case"AlignX":var n=t.a;return SN(n);case"AlignY":var a=t.a;return XN(a);case"Width":var n=t.a;return CT(n);case"Height":var n=t.a;return vT(n);case"Class":var n=t.a,a=t.b;return f(oN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(yA,i,o);case"Nearby":var u=t.a,s=t.b;return f(t$,u,f(zi,e,s));case"Attr":var c=t.a;return ST(f(j_,e,c));default:var l=t.a,d=t.b;return f(j$,l,d)}}),G_=function(e){return f(q_,zg,e)},z_=r(function(e,t){var r=t.a,n=t.b,a=G_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(rA,n,o));default:return L(r,n)}}),Y_=function(e){var t=l(Ra,z_,L(yr,sA),e),r=t.a,n=t.b;return f(ka,qI(n),r)},W_=function(e){return f(yA,V_,f(H_,K_,Y_(e)))},J_=ZT(33),Q_={$:"Hover"},X_=function(e){return f(yA,J_,f(H_,Q_,Y_(e)))},Z_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Kk,M([cN(4),uN,pN(n),f(aN,25,17),bA(t),bN(18),vN,Wk(a),W_(M([Wk(o)])),X_(M([Wk(i)]))]),fl(r))}),eL=r(function(e,t){return d(Z_,x(d(YR,1,0,0,1),d(YR,1,0,0,.8),d(YR,1,0,0,.6)),tN,e,t)}),tL=function(e){return $_(d(YR,0,0,.3,.6))(f(ON,M([kN(10),wN,eR,Wk(d(YR,0,0,0,.5)),cN(8),aR(20)]),f(xa,function(e){return f($N,M([wN,eR,bN(20),vN,bA(tN),t_]),M([e]))},e)))},rL=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+NA(t)}e.a;return"https://kovan.etherscan.io/tx/"+NA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+NA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+NA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+NA(t)}}),nL={$:"Bottom"},aL=XN(nL),iL=lA(RT.underline),oL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(fl(u$(oC(a))),f(eL,"Yes, I definitely want to open this trade.",l(w_,r,n,a)))}return L(fl("??"),f(O_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),U(I_(n),U(M([M([fl("You will deposit "),i,fl(" "+NR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([fl("This ususally requires two Metamask signatures. Your "+NR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Kk,M([aL,wN]),o)])),S_);case"ApproveNeedsSig":var u=e.a;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),tL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","ApproveMining",0)))]),tL(M([fl("Mining the initial approve transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,eo(u),s)}),fl("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),tL(M([fl("Waiting for user signature for the create call."),fl("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","CreateMining",0)))]),tL(M([fl("Mining the final create call..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,r,s)}),fl("You will be redirected when it's mined.")])))}}),uL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return qk;var r=t.a;return f(oL,r,e)},sL=function(e){return{$:"TradeAmountChanged",a:e}},cL=dT("id"),fL=R_(cL("inputError")),lL=l(Ok,109,127,138),dL=uR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),hL=function(e){return f(dR,f(ka,yT(zk(26)),e),dL)},pL=function(e){return f(VN,M([kN(4)]),M([hL(yr),f(Kk,M([bN(24),gR,bA(lL)]),fl(NR(e)))]))},gL=function(e){return{$:"HiddenLabel",a:e}},vL=gL,yL=dT("type"),mL=function(e){return L(e,!0)},bL=function(e){return{$:"MayStopPropagation",a:e}},CL=r(function(e,t){return f(lN,e,bL(t))}),EL=r(function(e,t){return l(La,Oh,t,e)}),SL=f(EL,M(["target","value"]),pu),TL=function(e){return f(CL,"input",f(Oi,mL,f(Oi,e,SL)))},wL=ZT(0),IL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),AL=function(e){var t=function(e){return 1-e}(f(Tc,1,f(ei,0,e)));return f(yA,wL,f(IL,"transparency-"+dw(t),t))},BL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),kL=f(Da,ST,A$("autocomplete")),NL=l(pA,136/255,138/255,133/255),RL=l(pA,186/255,189/255,182/255),$L=f(aN,12,12),_L=M([$L,cN(3),d$(RL),Wk(r_),p$(1),kN(3),ET(jk)]),LL=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},xL=function(e){return f(Ch,LL,e)?$$:lA("focusable")},PL=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},DL=ye,UL=r(function(e,t){return f(kn,e,DL(t))}),OL=UL("spellcheck"),ML=f(Da,ST,OL),FL=W,VL=ZT(47),KL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(FL(e))),o=(i-1)*t+f(xc,0,f(Bo,a,r))+f(xc,0,f(Bo,a,n));return f(yA,VL,l(jI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),HL=dT("value"),jL=f(Da,ST,HL),qL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(fw,"width",n)?L(r,n):L(f(ka,e,r),f(Gm,"width",n));case"Height":e.a;return f(fw,"height",n)?L(r,n):L(f(ka,e,r),f(Gm,"height",n));case"Describe":e.a;return f(fw,"described",n)?L(r,n):L(f(ka,e,r),f(Gm,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(fw,"align-x",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-x",n));case"AlignY":return f(fw,"align-y",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-y",n));default:return f(fw,"transform",n)?L(r,n):L(f(ka,e,r),f(Gm,"transform",n))}}),L(yr,sm),e).a},GL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,qL(e))}),zL=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}},YL=f(Da,Gi,ms),WL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([ST(TL(n.onChange))]),o=U(_L,t),u=f(GL,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(ml,PL,o),c=f(GL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(GL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(GL,o,function(e){return"Nearby"===e.$})),p=f(ml,f(Da,ns,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([jL(n.text),ST(yL(a)),ML(e.spellchecked),lA(RT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return $$;var r=t.a;return kL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(zL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(BL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(BL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(xc,5,c);return x("textarea",U(M([ML(e.spellchecked),lA(RT.inputMultiline),f(xc,$$,f(Bo,kL,e.autofill)),function(){if("Nothing"===u.$)return $$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return m$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?$$:s.a?d(KL,n.text,v,u,g):$$}()]),h),M([YL(RI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(fA,AT,Vk,f(ka,ET(jk),ay(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([m_(f(Kk,f(ka,$L,U(s,U(M([bA(NL),lA(RT.noTextSelection+" "+RT.passPointerEvents),d$(d(YR,0,0,0,0)),Wk(d(YR,0,0,0,0)),yT(jk),ET(jk),AL(""===n.text?1:0)]),r))),a))])}()]))),wT(M([d(fA,AT,TT(v),ay(M([M([xL(t),_$(n.label)]),y,i])),wT(m))])));return l(N$,f(ka,f(oN,iN,RT.cursorText),f(ka,L$(n.label)?$$:kN(5),f(ka,O$,u))),n.label,b)}),JL=WL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),QL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(JL,M([ET(jk),yT(zk(40)),p$(0)]),{label:vL(r),onChange:i,placeholder:n,text:a});return f(VN,U(M([kN(5)]),e),mE(M([f(Bo,Kk(M([k$])),o),si(s),f(Bo,Kk(M([PN])),u)])))}),XL={$:"Below"},ZL=function(e){return f(t$,XL,e)},ex=function(e){return f(j$,K$,H$(e))},tx=n(function(e,t,r){return p(QL,M([ET(zk(150)),gR,bN(24),ZL(f(P_,M([fL,ex(5)]),r))]),L(ci,si(f(Kk,M([pN(T_(d(Zd,"click","misclick","dai symbol in dai input",0)))]),pL(e)))),"dai input",ci,t,sL)}),rx=Kk(M([d$(IR),Z$({bottom:2,left:0,right:0,top:0})])),nx=r(function(e,t){return f(ON,M([kN(10)]),M([f(Kk,M([bN(17),vN]),fl(e)),t]))}),ax=r(function(e,t){return rx(f(nx,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(tx,e,t.inputs.daiAmount,t.errors.daiAmount)))}),ix=function(e){return f(xc,gS,Mg(e))},ox=function(e){var t=function(){var t=vd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+u$(f(Gl,r,100))+" "+NR(ix(e.wallet))+"."}return"There is a 1% fee."}();return f(VN,M([wN,f(aN,20,10),Wk(l(Ok,10,33,108)),cN(8),kN(5),pN(T_(d(Zd,"click","misclick","fee notify element",0)))]),M([f(Kk,M([bN(18),bA(l(Ok,0,226,255)),vN]),fl(t)),f(Kk,M([bN(17),bA(tN),gR]),fl("We only collect this fee when trades resolve successfully."))]))},ux=function(e){return{$:"FiatAmountChanged",a:e}},sx=function(e){return{$:"FiatTypeChanged",a:e}},cx=r(function(e,t){return l(SS,n(function(t,r,n){return f(e,t,r)?l(xl,t,r,n):n}),cp,t)}),fx=function(e){return f(cx,r(function(t,r){return f(Qg,e,t)}),HR)},lx=uR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),dx=function(e){return f(dR,M([yT(zk(26))]),f(xc,lx,f(Bo,fu,f(fp,e,HR))))},hx=function(e){return R_(f(CL,"click",Fi(L(e,!0))))},px=YL,gx=function(e){return{$:"AppendProperty",a:e}},vx=r(function(e,t){return gx(e+":"+t)}),yx=r(function(e,t){return f(vx,e,t.value)}),mx=yx("cursor"),bx={$:"Compatible"},Cx={cursor:bx,value:"default"},Ex=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Sx=function(e){return{$:"PseudoClassSelector",a:e}},Tx=function(e){return Ex(Sx(e))}("hover"),wx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),Ix=wx,Ax=Ix,Bx=Ax("span"),kx=r(function(e,t){return f(kn,et(e),rt(t))}),Nx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),Rx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),$x=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),_x=r(function(e,t){return t<>>32-e}),Lx=function(e){var t=e.hash?e.seed^f($x,461845907,f(_x,15,f($x,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f($x,2246822507,r^r>>>16),a=f($x,3266489909,n^n>>>13);return(a^a>>>16)>>>0},xx=r(function(e,t){return f($x,5,f(_x,13,e^f($x,461845907,f(_x,15,f($x,3432918353,t)))))+3864292196}),Px=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},HP=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+"]"}},jP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,HP,r)));case"UniversalSelectorSequence":var r=e.a;return Iu(r)?"*":f(Ri,"",f(xa,HP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,HP,r)))}},qP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([KP(t),jP(r)]))},GP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,jP(t),f(xa,qP,r)),i=f(Ri,"",M([f(xc,"",f(Bo,VP,n))]));return f(oc,f(Ri," ",f(ml,f(Da,ns,_d),a)),i)},zP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,GP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,FP(a),"\n",e,"}"]))}),YP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(zP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,xP,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,OP,zP(" ")),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"}},WP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(ml,f(Da,ns,_d),M([$P(t),f(Ri,"\n",f(xa,DP,r)),f(Ri,"\n",f(xa,UP,n)),f(Ri,"\n\n",f(xa,YP,a))])))},JP=function(e){return WP(RP(BP(e)))},QP=function(e){return f(Ri,"\n\n",f(xa,JP,e))},XP=function(e){return{$:"Snippet",a:e}},ZP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),eD=function(e){return{$:"StyleBlockDeclaration",a:e}},tD=r(function(e,t){var r=l(eP,t,yr,ci);return XP(M([eD(l(ZP,r,yr,e))]))}),rD=function(e){return Iu(e)?"unstyled":f(Is,P("_"),Ps(f(Dx,15739,QP(AS(Ux(AS(f(tD,e,dP(yr)))))))))},nD=function(e){var t=rD(e),r=f(kx,"className",hl(t));return l(Nx,r,e,t)},aD=a(function(e,t,r,n){return f(e,f(ka,nD(t),r),n)}),iD=function(e){return{$:"Unstyled",a:e}},oD=function(e){return iD(Tw(e))},uD=oD,sD=r(function(e,t){return f(Tn,e,Xe(t))}),cD=function(e){return En(Xe(e))},fD=r(function(e,t){var r=e.b,n=e.c;return Iu(r)?t:l(xl,n,r,t)}),lD=function(e){return e.a},dD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,fD,i,s),p=l(Ra,hD,L(yr,h),c),g=p.a,v=p.b,o=l(JT,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,fD,i,s),m=l(Ra,hD,L(yr,h),c),g=m.a,v=m.b,o=d(cD,y,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,fD,i,s),b=l(Ra,dD,L(yr,h),c),g=b.a,v=b.b,o=l(WT,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,fD,i,s),C=l(Ra,dD,L(yr,h),c),g=C.a,v=C.b,o=d(sD,y,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),hD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,fD,n,o),c=l(Ra,hD,L(yr,s),u),h=c.a,p=c.b,a=l(JT,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,fD,n,o),v=l(Ra,hD,L(yr,s),u),h=v.a,p=v.b,a=d(cD,g,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,fD,n,o),y=l(Ra,dD,L(yr,s),u),h=y.a,p=y.b,a=l(WT,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,fD,n,o),m=l(Ra,dD,L(yr,s),u),h=m.a,p=m.b,a=d(sD,g,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p)}}),pD=r(function(e,t){return h(Nl,kl,e,t,Rl,Rl)}),gD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(_d(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),vD=function(e){var t=f(gD,ci,e);if("Nothing"===t.$)return cp;var r=t.a,n=r.a,a=r.b;return f(pD,n,a)},yD=function(e){return{$:"ClassSelector",a:e}},mD=function(e){var t=e.a,r=e.b;return f(tD,r,dP(M([yD(t)])))},bD=function(e){return QP(AS(Ux(f(xa,mD,Ia(e)))))},CD=function(e){return l(JT,"style",yr,AS(Tw(bD(e))))},ED=n(function(e,t,r){var n=f(xa,lD,t),a=vD(t),i=l(Ra,hD,L(yr,a),r),o=i.a,u=i.b,s=CD(u);return l(JT,e,n,f(ka,s,$a(o)))}),SD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),TD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(SD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),wD=r(function(e,t){return L(f(TD,"_",t),CD(e))}),ID=n(function(e,t,r){var n=f(xa,lD,t),a=vD(t),i=l(Ra,dD,L(yr,a),r),o=i.a,u=i.b,s=f(wD,u,o);return l(WT,e,n,f(ka,s,$a(o)))}),AD=a(function(e,t,r,n){var a=f(xa,lD,r),i=vD(r),o=l(Ra,dD,L(yr,i),n),u=o.a,s=o.b,c=f(wD,s,u);return d(sD,e,t,a,f(ka,c,$a(u)))}),BD=a(function(e,t,r,n){var a=f(xa,lD,r),i=vD(r),o=l(Ra,hD,L(yr,i),n),u=o.a,s=o.b,c=CD(s);return d(cD,e,t,a,f(ka,c,$a(u)))}),kD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(ED,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(BD,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(ID,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(AD,a,t,r,n)}},ND=kD,RD=function(e){return px(ND(d(aD,Bx,M([Tx(M([mx(Cx)]))]),yr,M([uD(e)]))))},$D=J,_D=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),LD=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),xD=function(e){return l(La,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 si(h(_D,n,a,i,o,u))}return ci}(),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 si(l(LD,a,t,i))}return ci}())}),L(ci,ci),e)},PD=r(function(e,t){var r=xD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),e))),wT(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?si(m$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),U(e,M([h]))))),wT(t))}var p=-s/2,g=-u/2;return d(fA,AT,Vk,e,wT(M([d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ST(f(N_,"margin",mw(p)+"px "+mw(g)+"px")),f(ka,ST(f(N_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,ST(f(N_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(yA,IN,l(AN,o,u,s)),yr))))),wT(t))])))}),DD=i(function(e,t,r,n,a){var i=f(JL,M([ET(zk(80)),yT(zk(40)),bN(24),gR,d$(IR),hx(r)]),{label:vL("currency type"),onChange:f(zo,$D,n),placeholder:ci,text:t}),o=f(fp,t,HR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return qk;r.b;return f(PD,M([ET(zk(350)),d$(DR),p$(1),Wk(tN),aR(10),wN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(VN,M([ET(zk(80)),kN(9),f(aN,0,5),hx(n(t)),X_(M([Wk(l(pA,.8,.8,1))]))]),M([f(dR,M([yT(zk(26))]),a),f(Kk,M([bN(16),vN]),RD(t))]))},Ia(fx(t))))}return qk}();return f(VN,M([kN(4),ZL(u)]),M([f(Kk,M([pN(a)]),dx(t)),i]))}),UD=i(function(e,t,r,n,a){var i=T_(d(Zd,"click","misclick","currency flag",0)),o=f(Kk,M([pN(T_(d(Zd,"click","misclick","currency symbol",0)))]),fl(jR(e))),u=f(Kk,M([ZL(f(P_,M([fL,ex(5)]),a))]),h(DD,r,e,E_(!0),sx,i));return p(QL,M([ET(zk(250)),gR,bN(24),ZL(f(P_,M([fL,ex(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,ux)}),OD=function(e){return rx(f(nx,"For fiat",h(UD,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},MD=function(e){return{$:"ChangeRole",a:e}},FD=d(M_,1,31,52,.13),VD=r(function(e,t){var r=M([bN(24),gR,uN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([bA(FD)]))):L(U(r,M([bA(FD)])),r)}(),a=n.a,i=n.b;return f(VN,M([kN(20)]),M([f(Kk,U(M([pN(MD(lo))]),i),fl("Sell "+e)),f(Kk,U(M([pN(MD(fo))]),a),fl("Buy "+e))]))}),KD=r(function(e,t){return f(nx,"Trade Type",f(VD,NR(e),t.inputs.userRole))}),HD=Q$({blur:20,color:d(M_,0,0,0,.04),offset:L(0,3),size:0}),jD=f(oN,IN,RT.spaceEvenly),qD=function(e){var t=ix(e.wallet);return f(ON,M([ET(jk),kN(20),Wk(tN),cN(5),aR(20),HD]),M([f(VN,M([ET(jk),jD]),M([f(KD,t,e),f(ax,t,e),OD(e)])),ox(e)]))},GD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),zD={$:"Web3Connect"},YD=function(e){return f(Kk,M([wN]),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(eL,"Open Trade",f(GD,n,r))}t.b;return f(O_,"Unsupported Network",ci)}t.a;return f(eL,"Connect to Wallet",zD)}())},WD=function(e){return{$:"AutoabortIntervalChanged",a:e}},JD=function(e){return{$:"ChangePaymentMethodText",a:e}},QD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),XD=QD,ZD=function(e){return f(XD,M([bA(d(YR,0,0,0,.2))]),function(){return fl("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")}())},eU={$:"TextArea"},tU=r(function(e,t){return l(WL,{autofill:ci,spellchecked:t.spellcheck,type_:eU},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),rU=n(function(e,t,r){var n=f(Kk,M([bN(22),vN]),fl("Payment Method")),a=f(tU,M([ET(jk),yT(zk(150)),Wk(d(M_,155,203,255,.2)),p$(0)]),{label:vL("payment method"),onChange:JD,placeholder:""===r?si(ZD(t)):ci,spellcheck:!0,text:r});return f(ON,M([kN(20),m$({bottom:15,left:45,right:45,top:0}),ET(jk),U_(f(P_,M([fL,ex(30),aR(10),bN(20),ET(zk(400))]),e))]),M([n,a]))}),nU=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."},aU=a(function(e,t,r,n){var a=l(Rs,e,P("0"),Ni(n));return f(Kk,M([bN(22),bA(t)]),fl(U(a,r)))}),iU=function(e){return jd(e)<0?Vl(0):e},oU=n(function(e,t,n){var a=r(function(e,r){return f(ON,M([kN(4)]),M([f(Kk,M([aR(4),uN,pN(n(f(qb,t,e)))]),f(dR,M([yT(zk(10))]),hR)),r,f(Kk,M([aR(4),uN,pN(n(function(e){return jd(e)?e:Vl(3e5)}(iU(f(LR,t,e)))))]),f(dR,M([yT(zk(10))]),sR))]))}),i=XR(t);return f(VN,M([jD,kN(10)]),M([f(a,Vl(864e5),d(aU,3,e," days",i.days)),f(a,Vl(36e5),d(aU,2,e," hours",i.hours)),f(a,Vl(3e5),d(aU,2,e," min",i.min))]))}),uU=o(function(e,t,r,n,a,i){var o=f(Kk,M([Wk(d(M_,155,203,255,.2)),cN(5),aR(15),U_(f(P_,M([fL]),a))]),l(oU,DR,n,i)),u=f(VN,M([kN(30)]),M([f(dR,M([yT(zk(40)),pN(T_(d(Zd,"click","misclick","symbol for "+t,0)))]),e),f(Kk,M([bN(22),vN]),fl(t))])),s=f($N,M([bN(17),gR,bA(F_)]),M([fl(r)]));return f(ON,M([ET(jk),cN(10),Wk(l(Ok,237,237,237)),kN(2)]),f(xa,Kk(M([Wk(tN),f(aN,45,18),ET(jk)])),M([u,f(VN,M([ET(jk),kN(25),Wk(tN)]),M([o,s]))])))}),sU=uR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),cU=f(oN,tR,RT.clipX),fU=f(oN,tR,RT.clipY),lU=i(function(e,t,r,n,a){return f(ON,M([kN(15),cN(8),cU,fU,Wk(tN)]),M([p(uU,sU,"Payment Window",nU(a),r,n,WD),l(rU,t,a,e)]))}),dU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},hU=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."},pU=uR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),gU=n(function(e,t,r){return f(Kk,M([cN(8),cU,fU,Wk(tN)]),p(uU,pU,"Burn/Release Window",hU(r),e,t,dU))}),vU=function(e){return{$:"AutorecallIntervalChanged",a:e}},yU=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."},mU=uR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),bU=n(function(e,t,r){return f(Kk,M([cN(8),Wk(tN),cU,fU]),p(uU,mU,"Open Window",yU(r),e,t,vU))}),CU=function(e){return f(ON,M([ET(jk),kN(20)]),M([l(bU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(lU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(gU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},EU=function(e){return f(ON,M([ET(f(L_,1e3,jk)),wN,kN(20),m$({bottom:30,left:40,right:40,top:0}),pN(E_(!1)),m_(uL(e))]),M([qD(e),CU(e),YD(e.wallet)]))},SU=As(vb(8226)),TU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),wU=r(function(e,t){return l(Ra,ka,t,e)}),IU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(wU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),AU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(wU,f(lc,e%r,t),l(IU,yr,e/r|0,t))):f(lc,e,t)}),BU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(fw,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(Gm,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),kU=function(e){return d(BU,Ua,sm,e,yr)},NU=r(function(e,t){return f(Kk,M([ET(jk),m_(f(VN,M([kN(3),ET(nR(100)),ET(t),rR]),f(TU,f(Kk,M([bA(d(YR,0,0,0,.1)),bN(14)]),fl(SU)),f(xa,f(Da,Kk(M([bA(d(YR,0,0,0,.2))])),fl),f(AU,100,(e?$a:Ua)(kU(f(xa,f(zo,fu,Qa),Ia(HR)))))))))]),fl(" "))}),RU=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e))))),wT(M([n])))}),$U=function(){var e=f(Da,Kk(M([bA(l(pA,.8,.2,.2))])),fl),t=f(Da,Kk(M([_N])),fl);return f(ON,M([ET(jk),yT(jk),Wk(tN),cN(6),kN(50),Q$({blur:20,color:d(M_,0,0,0,.1),offset:L(0,3),size:0}),cN(10),aR(20)]),M([f(NU,!1,jk),f(ON,M([wN,ET(f(L_,700,jk)),kN(20)]),M([f($N,M([bN(70),_N,wN,t_]),M([fl("DAI"),e("Hard")])),f(VN,M([bN(30),vN,wN,t_,b$]),M([fl("The "),e("Global"),fl(", "),e("Unkillable"),fl(" Crypto Gateway")]))])),f(VN,M([Wk(CR),kN(2),wN,c_,ET(jk)]),M([f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([kN(60),PN]),M([f(Kk,M([bN(40),vN,wN]),fl("Want to learn more?")),f(ON,M([kN(15)]),M([f(RU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(A_),bA(tN),_N,bN(24),wN]),{label:f($N,M([t_]),M([fl("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"}),f(RU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(A_),bA(tN),_N,bN(24),wN]),{label:f($N,M([t_]),M([fl("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})]))]))),f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([k$,kN(60)]),M([f(Kk,M([bN(40),vN,wN]),fl("Ready to try it out?")),f(ON,M([kN(10),ET(zk(400)),wN]),M([f($N,M([bN(24),ET(jk)]),M([fl("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f($N,M([bN(24),ET(jk)]),M([fl("Then follow the links at the top of this page to browse "),t("Sell Offers"),fl(", browse "),t("Buy Offers"),fl(", or "),t("Create Your Own Offer"),fl(".")]))]))])))])),f(Kk,M([aL,ET(jk)]),f(NU,!0,jk))]))}(),_U=r(function(e,t){return f(Ay,f(zo,function(e){return e.type_},Ja(e)),t)}),LU=function(e){return{$:"ShowCurrencyDropdown",a:e}},xU=r(function(e,t){return ml(t(e))}),PU=i(function(e,t,r,n,a){var i=l(xU,e,a.filterFunc,ay(f(xa,GN,n)));return R(i,yr)?f(Kk,M([wN,bN(24),m$({bottom:0,left:0,right:0,top:30}),b$]),fl(r?"No trades found with those filters.":"Initializing Trade Cache...")):f(Yi,Rv,d(v$,e,a.tradeTable,M([t?Av:xo,JN,YN,WN,QN,zN]),i))}),DU=function(e){return{$:"FiltersMsg",a:e}},UU={$:"ApplyInputs"},OU=UL("disabled"),MU=function(e){return{$:"MayPreventDefault",a:e}},FU=r(function(e,t){return f(lN,e,MU(t))}),VU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):hu("Not the enter key")},n=f(du,r,f(Oh,"key",pu));return ST(f(FU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),KU=function(e){return f(VU,"Enter",e)},HU={$:"Button"},jU=r(function(e,t){var r=t.onPress,n=t.label;return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY+" "+RT.seButton+" "+RT.noTextSelection),f(ka,uN,f(ka,xL(e),f(ka,NN(HU),f(ka,ST(P$(0)),function(){if("Nothing"===r.$)return f(ka,ST(OU(!0)),e);var t=r.a;return f(ka,pN(t),f(ka,KU(t),e))}()))))))),wT(M([n])))}),qU=f(jU,M([Wk(A_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Apply")),onPress:si(UU)}),GU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(yA,sN,l(jI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},zU=function(e){return f(dN,"focus",Fi(e))},YU=f(Da,ST,zU),WU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([YU(e(!0)),hx(e(!0))])}();return f(VN,U(e,M([yT(zk(40)),Q$({blur:20,color:d(M_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Kk,M([Wk(IR),yT(zk(40)),GU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Kk,M([eR,f(aN,10,0)]),r)),f(JL,U(s,U(t,M([ET(zk(100)),yT(zk(40)),d$(IR),GU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),Z$({bottom:1,left:0,right:1,top:1})]))),{label:vL(n),onChange:u,placeholder:i,text:a})]))}),JU=function(e){return{$:"MaxDaiChanged",a:e}},QU=function(e){return{$:"MinDaiChanged",a:e}},XU=r(function(e,t){return f(ON,M([ET(jk),kN(8)]),M([f(Kk,M([bN(17),gR]),fl(e)),t]))}),ZU=ZT(25),eO=function(e){return{$:"MoveX",a:e}},tO=function(e){return f(j$,ZU,eO(-e))},rO={$:"OnLeft"},nO=function(e){return f(t$,rO,e)},aO=n(function(e,t,r){var n=hL(M([eR])),a=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("max"))])),i=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("min"))]));return f(XU,"Dai Range",f(ON,M([kN(5),ET(zk(200))]),M([v(WU,M([nO(f(P_,M([tO(5),ET(zk(200))]),r.minDai))]),M([YU(LU(!1))]),i,"min Dai",e,ci,ci,QU),v(WU,M([nO(f(P_,M([tO(5),ET(zk(200))]),r.maxDai))]),M([YU(LU(!1))]),a,"max Dai",t,ci,ci,JU)])))}),iO=function(e){var t=f(fp,e,HR);if("Nothing"===t.$)return fl("*");var r=t.a,n=r.b;return f(dR,M([yT(zk(26))]),n)},oO=function(e){return{$:"AppCmd",a:e}},uO=function(e){return{$:"FiatTypeInputChanged",a:e}},sO=n(function(e,t,r){var n=oO(d(Zd,"click","misclick","currency flag",0)),a=iO(t);f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("max"))])),f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("min"))]));return f(Kk,M([c_,ET(zk(120))]),f(XU,"Fiat Type",h(DD,e,t,LU(!0),uO,n)))}),cO={$:"AddSearchTerm"},fO=function(e){return{$:"PaymentMethodInputChanged",a:e}},lO=f(Oh,"keyCode",CE),dO=function(e){return f(dN,"keyup",f(du,function(t){return 13===t?Fi(e):hu(Ni(t))},lO))},hO=function(e){return f(XU,"Search Payment Methods",f(JL,M([c_,ET(zk(250)),yT(zk(40)),d$(IR),Q$({blur:20,color:d(M_,233,237,242,.05),offset:L(0,3),size:0}),R_(dO(cO))]),{label:vL("payment methods search"),onChange:fO,placeholder:ci,text:e}))},pO={$:"ResetSearch"},gO=f(jU,M([Wk(A_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Reset")),onPress:si(pO)}),vO=function(e){return{$:"RemoveTerm",a:e}},yO=function(e){return f(Kk,M([aR(3),c_,uN,pN(vO(e)),bN(10),bA(EN)]),fl("x"))},mO=function(e){if(e.b){var t=e;return f(VN,M([ET(jk),aR(10),kN(10)]),f(xa,function(e){return f(VN,M([Wk(d(M_,16,7,234,.2)),cN(5),aR(4),kN(3)]),M([fl(e),yO(e)]))},t))}return qk},bO=i(function(e,t,r,n,a){var i=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},o=f(Eh,Ja(d_),f(xa,v_,e))?M([i("No trades found.")]):f(xa,i,mE(f(xa,function(e){switch(v_(e).$){case"QueryingNumTrades":return si("Querying "+hB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+hB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),m_(f(ON,M([kN(5),k$]),o))]),f(VN,M([wN,kN(50)]),M([f(Yi,DU,l_(t)),f(VN,M([ET(bT),kN(10)]),M([f(Kk,M([ET(bT),c_]),l(aO,r.minDai,r.maxDai,n)),f(Kk,M([ET(bT),c_]),l(sO,a,r.fiatType,n)),f(ON,M([ET(bT),c_,kN(5)]),M([hO(r.paymentMethod),mO(r.paymentMethodTerms)])),f(XU," ",f(ON,M([kN(5),ET(bT)]),M([qU,gO])))]))])))}),CO=n(function(e,t,r){var n=f(Eh,f(zo,v_,Ja(h_)),t),a=function(){return!f(xc,0,f(Bo,function(e){return f(MS,function(e){return e.checked&&"Open"!==e.label},e.options)},f(_U,Eo,r.filters)))}();return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),pN(LU(!1)),aR(30)]),M([f(VN,M([ET(jk),kN(10)]),M([h(bO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),h(PU,e,a,n,t,r)]))}),EO=function(e){return{$:"MessageInputChanged",a:e}},SO={$:"MessageSubmit"},TO=function(e){return f(ON,M([ET(jk),kN(10)]),M([f(tU,M([ET(jk),yT(zk(100))]),{label:vL("messageInput"),onChange:EO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(jU,M([wN,bN(24)]),{label:fl("Submit"),onPress:si(SO)})]))},wO=f(oN,tR,RT.scrollbarsY),IO=r(function(e,t){return f(Kk,M([yT(jk),ET(jk)]),f(Kk,U(M([R_(f(N_,"position","absolute")),R_(f(N_,"top","0")),R_(f(N_,"right","0")),R_(f(N_,"bottom","0")),R_(f(N_,"left","0")),wO]),e),t))}),AO=l(Ok,200,205,210),BO=n(function(e,t,r){var n=M([PN,Wk(A_),bA(tN),GU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([k$,Wk(AO),bA(DR),GU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Kk,U(M([aR(7)]),u),f($N,yr,M([fl(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(pA,0,0,1),tN,"Initiator opened the trade"));case"Recalled":return si(x(l(pA,0,0,1),tN,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(ru,8,dl(t))+"..";return si(x(l(pA,1,0,1),tN,r+" committed to the trade"));case"Aborted":return si(x(l(pA,1,0,0),tN,"Buyer aborted the trade"));case"Claimed":return si(x(l(pA,0,1,0),tN,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(pA,0,0,1),tN,"Seller released the "+NR(e)+" and closed the contract"));default:return si(x(l(pA,0,0,1),tN,"Seller burned the "+NR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return qk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Kk,M([cN(3),p$(1),d$(l(pA,1,0,1)),wN,Wk(h)]),f($N,M([bA(p)]),M([fl(g)])))}),kO=n(function(e,t,r){if(r.b){var n=r;return f(IO,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),aR(10)]),f(ON,M([ET(jk),yT(jk),kN(10)]),f(xa,f(BO,e,t),n)))}return f(Kk,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),wN,bA(l(pA,.5,.5,.5)),b$]),fl("no messages found."))}),NO=Cr,RO=function(e){return f(ON,M([ET(jk),yT(jk),kN(10),p$(1),cN(5),aR(20)]),M([l(kO,e.trade.factory,e.userRole,f(NO,function(e){return e.blocknum},Sa(e.history))),TO(e)]))},$O=function(e){return f(Kk,M([Wk(tN),cN(8),HD,ET(jk),yT(jk)]),RO(e))},_O={$:"ToggleChat"},LO=function(e){if(e.showChatHistory){var t=f(xc,qk,f(Bo,$O,e.chatHistoryModel));return f(Kk,M([yT(jk),ET(zk(500)),aR(20),PN]),l(x_,M([yT(jk),ET(jk)]),f(Yi,jE,t),_O))}return qk},xO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},PO=function(e){return zR(e)+" "+e.fiatType},DO={$:"AbortAction"},UO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),OO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return qk}if("LoadedTrade"!==t.b.$)return qk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=PO(n.terms.price),u=u$(oC(i)),s=u$(n.parameters.tradeAmount)+" "+NR(n.factory),c=function(){return"Buyer"===xO(n.parameters).$?L(f(Kk,M([gR,bA(DR)]),fl("buyer")),M([fl("pay the seller "),f(Kk,M([bA(A_)]),fl(o)),fl(" in exchange for the "),f(Kk,M([bA(A_)]),fl(s)),fl(" held in this contract.")])):L(f(Kk,M([gR,bA(DR)]),fl("seller")),M([fl("accept "),f(Kk,M([bA(A_)]),fl(o)),fl(" from the buyer in exchange for the "),f(Kk,M([bA(A_)]),fl(s)),fl(" held in this contract.")]))}(),d=c.a,h=c.b;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),U(M([U(M([fl("You will deposit "),f(Kk,M([bA(A_)]),fl(u+" "+NR(n.factory))),fl(", thereby becoming the "),d,fl(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([fl("(This ususally requires two Metamask signatures. Your "+NR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Kk,M([aL,wN]),f(eL,"Yes, I definitely want to commit to this trade.",l(UO,n,a,i)))])),DO);case"ApproveNeedsSig":return tL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return tL(M([fl("Mining the initial approve transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,n.factory,p)}),fl("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return tL(M([fl("Waiting for user signature for the final commit call."),fl("(check Metamask!)"),fl("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return tL(M([fl("Mining the final commit transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction"),url:f(rL,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([fl('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 '+NR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([fl("Aborting will incur a small penalty on both parties, and refund the rest of the "+NR(n.factory)+".")])]);case"Release":return M([M([fl("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([fl("This will destroy the "+NR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Kk,M([aL,wN]),function(e){return f(eL,e,sS(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 "+NR(n.factory)+".";default:return"I understand. Burn the "+NR(n.factory)+"."}}()))])),DO);case"ActionNeedsSig":var g=r.a;return tL(M([fl("Waiting for user signature for the "+fS(g)+" call."),fl("(check Metamask!)")]));default:var g=r.a,p=r.b;return qk}},MO=VN(M([ET(jk),Wk(tN),cN(5),aR(20),jD,HD])),FO=function(e){return f(VN,M([kN(8)]),M([f(dR,yr,dL),f(Kk,M([bN(24),gR]),fl(u$(e)))]))},VO=r(function(e,t){var r=f(Io,Ao(e),f(Bo,function(e){return e.address},Gd(t)));return f(nx,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"}(),FO(e.parameters.tradeAmount))}),KO=function(e){return f(VN,M([kN(5)]),M([dx(e.fiatType),f(Kk,M([bN(24),gR]),fl(PO(e)))]))},HO=function(e){return f(nx,"For Fiat",KO(e.terms.price))},jO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},qO=l(Ok,250,165,22),GO=l(Ok,255,0,0),zO=l(Ok,0,255,0),YO=uR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),WO=uR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),JO=uR({description:"released",src:"/DAIHard/static/img/released.svg"}),QO={$:"ToggleStatsModal"},XO=function(e){return f(NO,Ua,e)},ZO=n(function(e,t,n){var a=ay(f(xa,function(e){return f(ml,function(e){return R(f(ko,e,n),si(t))},f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(fh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(fh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wl,amountReleased:Wl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,Vl,Ql(XO(f(US,function(e){return function(e){return e?si(e):ci}(jd(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}}),eM=r(function(e,t){return d(Z_,x(d(YR,0,0,1,1),d(YR,0,0,1,.8),d(YR,0,0,1,.6)),tN,e,t)}),tM=function(e){return{$:"ViewUserHistory",a:e}},rM=f(JB,0,yr),nM=f(oN,gN,RT.textNormalWeight),aM=r(function(e,t){return Za(e/t)}),iM=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}}),oM=r(function(e,t){var r=e.a,n=e.b;return l(iM,r,f(aM,jd(t),6e4),n)}),uM=r(function(e,t){return f(_s,24,f(aM,f(oM,e,t),60))}),sM=r(function(e,t){return f(_s,1e3,jd(t))}),cM=r(function(e,t){return f(_s,60,f(oM,e,t))}),fM={$:"Apr"},lM={$:"Aug"},dM={$:"Dec"},hM={$:"Feb"},pM={$:"Jan"},gM={$:"Jul"},vM={$:"Jun"},yM={$:"Mar"},mM={$:"May"},bM={$:"Nov"},CM={$:"Oct"},EM={$:"Sep"},SM=function(e){var t=f(aM,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)}},TM=r(function(e,t){switch(SM(f(oM,e,t)).month){case 1:return pM;case 2:return hM;case 3:return yM;case 4:return fM;case 5:return mM;case 6:return vM;case 7:return gM;case 8:return lM;case 9:return EM;case 10:return CM;case 11:return bM;default:return dM}}),wM=r(function(e,t){return f(_s,60,f(aM,jd(t),1e3))}),IM={$:"Fri"},AM={$:"Mon"},BM={$:"Sat"},kM={$:"Sun"},NM={$:"Thu"},RM={$:"Tue"},$M={$:"Wed"},_M=r(function(e,t){switch(f(_s,7,f(aM,f(oM,e,t),1440))){case 0:return NM;case 1:return IM;case 2:return BM;case 3:return kM;case 4:return AM;case 5:return RM;default:return $M}}),LM=n(function(e,t,r){return e.toAmPm(f(uM,t,r))}),xM=r(function(e,t){return SM(f(oM,e,t)).day}),PM=xM,DM=M([kM,AM,RM,$M,NM,IM,BM]),UM=r(function(e,t){return function(e){return e.a}(f(xc,L(0,kM),Ql(f(ml,function(r){return R(r.b,f(_M,e,t))},f(Bi,r(function(e,t){return L(e,t)}),DM)))))}),OM=function(e){return l(Ra,Na,0,e)},MM=r(function(e,t){return SM(f(oM,e,t)).year}),FM=function(e){return!f(_s,4,e)&&(!!f(_s,100,e)||!f(_s,400,e))},VM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return FM(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}}),KM=M([pM,hM,yM,fM,mM,vM,gM,lM,EM,CM,bM,dM]),HM=r(function(e,t){return f(xc,L(0,pM),Ql(f(ml,function(r){r.a;return R(r.b,f(TM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),KM))))}),jM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(HM,e,t))}),qM=r(function(e,t){var r=f(lc,f(jM,e,t)-1,KM);return OM(f(xa,VM(f(MM,e,t)),r))+f(PM,e,t)}),GM=r(function(e,t){return f(jM,e,t)/4|0}),zM=r(function(e,t){var r=Ni(t),n=e-Qo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),YM=function(e){return e?e<=12?e:e-12:12},WM=sv(315576e5),JM=r(function(e,t){return Vl(WM*f(MM,e,t))}),QM=r(function(e,t){var r=f(JM,e,t),n=f(UM,e,r);return 1+((f(qM,e,t)+n)/7|0)}),XM=r(function(e,t){return Ni(f(MM,e,t))}),ZM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(jM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(jM,t,r));case"MonthFixed":return f(zM,2,f(jM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(TM,t,r));case"MonthNameFull":return e.toMonthName(f(TM,t,r));case"QuarterNumber":return Ni(1+f(GM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(GM,t,r));case"DayOfMonthNumber":return Ni(f(PM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(PM,t,r));case"DayOfMonthFixed":return f(zM,2,f(PM,t,r));case"DayOfYearNumber":return Ni(f(qM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(qM,t,r));case"DayOfYearFixed":return f(zM,3,f(qM,t,r));case"DayOfWeekNumber":return Ni(f(UM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(UM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(_M,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(_M,t,r));case"WeekOfYearNumber":return Ni(f(QM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(QM,t,r));case"WeekOfYearFixed":return f(zM,2,f(QM,t,r));case"YearNumberLastTwo":return f(ou,2,f(XM,t,r));case"YearNumber":return f(XM,t,r);case"AmPmUppercase":return $D(l(LM,e,t,r));case"AmPmLowercase":return sd(l(LM,e,t,r));case"HourMilitaryNumber":return Ni(f(uM,t,r));case"HourMilitaryFixed":return f(zM,2,f(uM,t,r));case"HourNumber":return Ni(YM(f(uM,t,r)));case"HourFixed":return f(zM,2,YM(f(uM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(uM,t,r));case"HourMilitaryFromOneFixed":return f(zM,2,1+f(uM,t,r));case"MinuteNumber":return Ni(f(cM,t,r));case"MinuteFixed":return f(zM,2,f(cM,t,r));case"SecondNumber":return Ni(f(wM,t,r));case"SecondFixed":return f(zM,2,f(wM,t,r));case"MillisecondNumber":return Ni(f(sM,t,r));case"MillisecondFixed":return f(zM,3,f(sM,t,r));default:return n.a}}),eF=a(function(e,t,r,n){return f(Ri,"",f(xa,l(ZM,e,r,n),t))}),tF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),rF=function(e){return e>11?"pm":"am"},nF=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"}},aF=function(e){switch(f(_s,100,e)){case 11:case 12:case 13:return"th";default:switch(f(_s,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},iF=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"}},oF=p(tF,nF,f(zo,nF,ru(3)),iF,f(zo,iF,ru(3)),rF,aF),uF=eF(oF),sF={$:"MonthNameFull"},cF=sF,fF=function(e){return{$:"Text",a:e}},lF=fF,dF={$:"YearNumber"},hF=dF,pF=n(function(e,t,n){var a=r(function(e,t){return f(ON,M([bN(18),kN(6)]),M([f(Kk,M([_N]),fl(e)),f(Kk,M([nM]),fl(t))]))}),i=uF(M([cF,lF(", "),hF])),o=f(ON,M([kN(23),ET(jk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,rM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+u$(n.amountReleased)+" "+NR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+u$(n.amountBurned)+" "+NR(e)+" Burned")])),M([f(Kk,M([wN]),f(eM,"View User History",tM(n.asRole)))])));return f(ON,M([cN(8),cU,fU,Wk(IR),kN(1),Q$({blur:20,color:d(YR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Kk,M([ET(jk),Wk(tN),aR(17)]),f(E$,18,t)),f(Kk,M([ET(jk),Wk(tN),aR(17)]),o)]))}),gF=n(function(e,t,r){var n=l(ZO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=jO(e.parameters.initiatorRole)+" Stats";return f(Kk,r?M([ZL(f(Kk,M([ex(30),PN]),l(pF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(nx,a,f(VN,M([ET(jk),kN(20),uN,pN(QO)]),f(xa,VN(M([kN(5)])),M([M([f(dR,M([yT(zk(28))]),JO),f(Kk,M([bN(24),gR,bA(zO)]),fl(l(Rs,2,P("0"),Ni(n.numReleases))))]),M([f(dR,M([yT(zk(28))]),YO),f(Kk,M([bN(24),gR,bA(qO)]),fl(l(Rs,2,P("0"),Ni(n.numAborts))))]),M([f(dR,M([yT(zk(28))]),WO),f(Kk,M([bN(24),gR,bA(GO)]),fl(l(Rs,2,P("0"),Ni(n.numBurns))))])])))))}),vF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+dl(t)}e.a;return"https://kovan.etherscan.io/address/"+dl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+dl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+dl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+dl(t)}}),yF=n(function(e,t,r){return f(dA,e,{label:fl(dl(r)),url:f(vF,t,r)})}),mF=function(e){return f(nx,"Trade Status",f(ON,M([bN(24),gR,kN(8)]),M([fl(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(yF,M([bN(12),bA(A_),iL]),e.factory,e.creationInfo.address)])))},bF=i(function(e,t,r,n,a){return MO(M([mF(t),f(VO,t,r),HO(t),l(gF,t,n,a)]))}),CF=l(Ok,9,32,107),EF=uR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),SF=f(Kk,M([cN(4),uN,pN(_O),aR(5),Wk(l(Ok,22,0,255))]),f(dR,M([ET(zk(42))]),EF)),TF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},wF=function(e){return f(ON,M([cN(12),Wk(IR),aR(15),kN(15)]),M([f(Kk,M([bN(24),vN,b$]),fl("Fiat Payment Method")),f($N,M([bN(18),yT(bT),Wk(tN),Q$({blur:5,color:d(YR,0,0,0,.2),offset:L(-3,3),size:0}),cN(3),aR(5)]),M([f(xc,f(Kk,M([bA(FD),b$]),fl("No payment methods found.")),f(Bo,fl,f(Bo,function(e){return e.info},Ql(e))))]))]))},IF={$:"Active"},AF=function(e){return{$:"ExpandPhase",a:e}},BF=M([Wk(CF),bA(tN)]),kF=r(function(e,t){return{$:"Min",a:e,b:t}}),NF=r(function(e,t){return f(kF,e,t)}),RF=function(e){return M(e?[cN(12),c_,yT(f(NF,380,bT))]:[cN(12),wN])},$F=M([Wk(tN)]),_F=uR({description:"flame",src:"/DAIHard/static/img/flame.png"}),LF=r(function(e,t){return Hl(f(ds,jl(e),jl(t)))}),xF=r(function(e,t){return d(Z_,x(d(YR,1,.6,.2,1),d(YR,1,.6,.2,.8),d(YR,1,.6,.2,.6)),tN,e,t)}),PF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),DF=function(e){return{$:"ContractActionClicked",a:e}},UF={$:"Web3Connect"},OF=n(function(e,t,r){var n=Gd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(xR,e,t).$?qk:f(VN,M([kN(8)]),function(){var e=x(t.state.phase,f(Ao,t,a.address),f(ko,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,sS,f(eM,"Remove and Refund this Trade",oS))])}break e}var r=(e.a,e.b,jl(Fb(t.parameters)));return M([f(eL,"Deposit and Commit to Trade",l(PF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(xF,"Abort Trade",GE)),f(Yi,DF,f(eL,"Confirm Payment",ZE)),SF])}e.a,e.c.a;return M([SF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(eL,"Burn it All!",XE)),f(Yi,DF,f(eM,"Release Everything",uS)),SF])}e.a,e.c.a;return M([SF])}break e;default:break e}return yr}())}return f(eL,"Connect to Wallet",UF)}),MF={$:"Finished"},FF={$:"NotStarted"},VF=r(function(e,t){var r=L(ER(t),ER(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?FF:R(n,a)?IF:MF}),KF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),HF=r(function(e,t){return l(KF,yr,e,t)}),jF=a(function(e,t,r,n){var a=u$(f(fh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+NR(r.factory),i=u$(r.parameters.tradeAmount)+" "+NR(r.factory),o=f(VN,yr,f(HF,3,f(dR,M([yT(zk(18))]),_F))),u=f(Da,Kk(M([bA(l(pA,1,0,0))])),fl),s=R(e,r.state.phase),c=f(Io,ko(r),f(Bo,function(e){return e.address},Gd(n))),d=s?tN:DR,h=$N(M([bA(d),bN(18),vN])),p=PO(r.terms.price),g=s?l(Ok,0,226,255):l(Ok,16,7,234),v=f(Da,Kk(M([bA(g)])),fl),y=u$(r.parameters.buyerDeposit)+" "+NR(r.factory),m=r.parameters.abortPunishment,b=u$(m)+" "+NR(r.factory),C=u$(f(LF,r.parameters.buyerDeposit,m))+" "+NR(r.factory),E=u$(f(LF,r.parameters.tradeAmount,m))+" "+NR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([fl("Your "),u("burnable deposit"),fl(" of "),v(y),fl(" is now held in this contract, and your offer to buy "),v(i),fl(" for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Seller by depositing the full "),v(i),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),fl(" to you.")])])):f(xa,h,M([M([fl("Your offer to sell the "),v(i),fl(" held in this contract for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),fl(" of 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),fl(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([fl("You must now pay the Seller "),v(p),fl(" via the Fiat Payment Method, "),f(Kk,M([vN]),fl("and then click ")),u("Confirm Payment"),fl(" before the payment window runs out. Use the chat to coordinate.")]),M([fl("If you abort the trade, or do not confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to you).")]),M([fl("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),fl(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([fl("Work and communicate with the Buyer to receive "),v(p),fl(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to you, "),v(C),fl(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),fl(" will be released to you.")]),M([fl("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),fl(" In this case the "),v(a),fl(" will be lost to both parties.")]),M([fl("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([fl("So, have you recieved the "),v(p),fl("? If so, you can click "),v("Release Everything"),fl(".")]),M([fl("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),fl(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([fl("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([fl("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([fl("The Seller has deposited "),v(i),fl(" into this contract, and offers to sell it for "),v(p),fl(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("If the trade is successful, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),fl(" within the payment window.")])])):f(xa,h,M([M([fl("The Buyer is offering to buy "),v(i),fl(" for "),v(p),fl(", and has deposited "),v(y),fl(" into this contract as a "),u("burnable deposit"),fl(". To become the Seller, deposit "),v(i),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("When you receive the "),v(p),fl(" from the Buyer, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can receive "),v(p),fl(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([fl("During this phase, the Buyer is expected to transfer "),v(p),fl(" to the Seller, as described in Fiat Payment Method, "),f(Kk,M([vN]),fl("and ")),u("Confirm the Payment "),fl(" before the payment window runs out. This would move the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(" amount) will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([fl("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([fl("If the Seller can verify he has received the "),v(p),fl(", he will probably release the total balance of "),v(i),fl(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),fl(".")]),M([fl("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),fl(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(ON,M([ET(jk),yT(jk),aR(20),kN(30)]),M([f(VN,M([ET(jk)]),M([f(Kk,M([bN(24),vN,bA(g),k$]),fl(T))])),f(ON,M([ET(jk),eR,kN(13)]),w),f(Kk,M([PN]),function(){switch(f(VF,r,e).$){case"Active":return l(OF,t,r,n);case"NotStarted":return f(Kk,M([bN(20),vN,b$,bA(CR)]),fl("Phase not yet started."));default:return f(Kk,M([bN(20),vN,b$]),fl("Phase no longer active."))}}())]))}),qF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},GF=uR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),zF=uR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),YF={$:"None"},WF=YF,JF=uR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),QF=function(e){switch(e.$){case"Open":return JF;case"Committed":return GF;case"Judgment":return zF;default:return WF}},XF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),ZF=a(function(e,t,r,n){return d(XF,e,t,r,n)}),eV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},tV=function(e){return function(e){return d(ZF,e.red,e.green,e.blue,e.alpha)}(eV(e))},rV=function(e){return{$:"Circle",a:e}},nV=rV,aV=d(XF,0,0,0,1),iV={$:"Flat"},oV={$:"Sharp"},uV=function(e){return{$:"Uniform",a:e}},sV=uV,cV={cap:iV,dashPattern:yr,dashPhase:0,fill:sV(aV),join:oV,thickness:2},fV=n(function(e,t,r){return D(cV,{dashPattern:e,fill:r,thickness:t})}),lV=fV(yr),dV={$:"Transparent"},hV=dV,pV=f(lV,0,hV),gV=r(function(e,t){return{$:"Shape",a:e,b:t}}),vV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},yV=function(e){return f(Da,vV,gV(e))},mV=function(e){return yV(L(e,pV))},bV=function(e){return L(-e.a,-e.b)},CV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),EV=r(function(e,t){return f(CV,bV(e(t)),t)}),SV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},TV=r(function(e,t){return{$:"Path",a:e,b:t}}),wV=kr,IV=Nr,AV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=IV(n),i=wV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},BV=function(e){return xa(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)})},kV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(BV,e,M([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 M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},RV=function(e){var t=$V(e.basic),r=SV(f(xa,AV(e),t)),n=r.a,a=r.b;return{toBottom:-f(xc,0,gI(a)),toLeft:-f(xc,0,gI(n)),toRight:f(xc,0,pI(n)),toTop:f(xc,0,pI(a))}},$V=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(kV,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(kV,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(kV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(BV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(TV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(BV,R(C,iV)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(kV,0,E);case"Group":var S=e.a;return f(BV,0,ay(f(xa,f(zo,RV,NV),S)));default:var T=e.b;return f(BV,0,NV(RV(T)))}},_V=function(e){var t=RV(e);return t.toTop+t.toBottom},LV=function(e){var t=RV(e);return L(-t.toLeft,t.toTop)},xV=function(e){var t=RV(e);return t.toLeft+t.toRight},PV=En("http://www.w3.org/2000/svg"),DV=PV("svg"),UV=Nn("height"),OV=Nn("version"),MV=Nn("width"),FV=PV("circle"),VV=PV("ellipse"),KV=PV("foreignObject"),HV=PV("g"),jV=PV("image"),qV=PV("polygon"),GV=PV("polyline"),zV=PV("rect"),YV=Tw,WV=PV("text"),JV=Nn("id"),QV=Nn("points"),XV=Nn("r"),ZV=Nn("rx"),eK=Nn("ry"),tK=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},rK=function(e){return{$:"Group",a:e}},nK=Nn("dominant-baseline"),aK=Nn("fill"),iK=Nn("fill-opacity"),oK=Nn("font-family"),uK=Nn("font-size"),sK=Nn("font-style"),cK=Nn("font-variant"),fK=Nn("font-weight"),lK=Nn("opacity"),dK=Nn("stroke"),hK=Nn("stroke-dasharray"),pK=Nn("stroke-dashoffset"),gK=Nn("stroke-linecap"),vK=Nn("stroke-linejoin"),yK=Nn("stroke-opacity"),mK=Nn("stroke-width"),bK=Nn("text-anchor"),CK=Nn("text-decoration"),EK=Nn("transform"),SK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},TK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},wK=n(function(e,t,r){return d(XF,e,t,r,1)}),IK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return sv(1e4*e)/100};return Cd(M(["rgba(",mw(i(t)),"%,",mw(i(r)),"%,",mw(i(n)),"%,",mw(function(e){return sv(1e3*e)/1e3}(a)),")"]))},AK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},BK=function(e){var t=AK(e),r=t.red,n=t.green,a=t.blue;return IK(l(wK,r,n,a))},kK=function(e){if("Uniform"===e.$){var t=e.a;return BK(t)}return"none"},NK=function(e){var t=AK(e),r=t.alpha;return mw(r)},RK=function(e){if("Uniform"===e.$){var t=e.a;return NK(t)}return"0"},$K=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},_K=function(e){var t=mw(e.scale.b),r=mw(e.scale.a),n=mw(-e.rotation/2/F$*360),a=mw(-e.shift.b),i=mw(e.shift.a);return Cd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},LK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),aK("none"),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([aK(kK(a)),iK(RK(a)),dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([aK(kK(uV(o.color))),oK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),uK(Ni(o.size)),fK(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"}}()),sK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),cK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),CK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),bK("middle"),nK("middle"),EK(_K(e))]);default:return M([EK(_K(e))])}},xK=Nn("x"),PK=Nn("y"),DK=r(function(e,t){return M([MV(mw(e)),UV(mw(t)),xK(mw(-e/2)),PK(mw(-t/2))])}),UK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([mw(t),mw(-r)]))},e))},OK=dN,MK=r(function(e,t){return f(e,t.a,t.b)}),FK=function(e){return f(xa,MK(OK),e)},VK=function(e){e:for(;;){var t=f(xc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(GV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(qV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Circle":var c=s.a;return f(FV,U(M([JV(t),XV(mw(c))]),U(LK(e),FK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(VV,U(M([JV(t),ZV(mw(d)),eK(mw(h))]),U(LK(e),FK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(zV,U(M([JV(t),ZV(mw(c)),eK(mw(c))]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(TV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(WV,U(M([JV(t)]),U(LK(e),FK(e.handlers))),M([YV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(jV,U(M([JV(t),tK(C)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(KV,U(M([JV(t)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(HV,f(ka,JV(t),U(LK(e),FK(e.handlers))),l(Ra,r(function(e,t){return f(ka,VK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:rK(M([w,I]))});e=v;continue e}}},KK=r(function(e,t){var r=e.a,n=e.b,a=mw(r),i=mw(n);return f(jT,yr,M([f(DV,M([MV(a),UV(i),OV("1.1")]),M([VK(t)]))]))}),HK=function(e){return f(KK,L(xV(e),_V(e)),f(EV,LV,e))},jK=r(function(e,t){var r=QF(e),n=function(){switch(t.$){case"NotStarted":return l(Ok,10,33,108);case"Active":return l(Ok,0,100,170);default:return l(Ok,1,129,104)}}(),a=px(HK(f(mV,sV(tV(n)),nV(50))));return f(Kk,M([wN,m_(f(dR,M([wN,eR,yT(zk(60))]),r))]),a)}),qK=function(e){var t=M([b$,vN,bN(20)]);switch(e.$){case"Active":return f(Kk,U(t,M([bA(EN)])),fl("Active"));case"NotStarted":return f(Kk,U(t,M([bA(CR)])),fl("Not Started"));default:return f(Kk,t,fl("Finished"))}},GK=n(function(e,t,r){var n=f(VF,t,e),a=function(){return"Active"===n.$?l(Ok,0,226,255):DR}(),i=f(Kk,M([bA(a),bN(20),vN,wN]),fl(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 qk;switch(n.$){case"NotStarted":return d(ZR,M([wN]),M([bN(22),gR]),L(DR,IR),f(_R,e,t));case"Active":var a=f(xR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(o$,M([wN]),M([bN(22),gR]),L(tN,IR),i)}return f(ON,M([wN,kN(10)]),M([f(Kk,M([wN]),fl(qF(e))),f(eM,"Poke",sS(iS))]));default:return f(Kk,M([yT(zk(1))]),qk)}}();return f(ON,M([aR(20),kN(10),yT(jk)]),M([f(Kk,M([c_,wN]),i),f(Kk,M([yT(jk),wN]),f(Kk,M([eR]),f(jK,e,n))),f(ON,M([kN(10),aL,wN]),M([f(Kk,M([wN]),qK(n)),o]))]))}),zK=o(function(e,t,r,n,a,i){var o=f(VF,r,t),u=f(Kk,M([aR(10),ET(jk),yT(jk)]),d(jF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Vl(0)}}(),c=l(GK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(LR,f(qb,r.state.phaseStartTime,s),i);default:Vl(0)}}(),f(Kk,M([yT(jk),ET(zk(1)),Wk(function(){return"Active"===o.$?l(pA,0,0,1):IR}())]),qk)),p=a?f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([ET(jk)]))),M([c,h,u])):f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([uN,pN(AF(t))]))),M([c]));return!e&&R(o,IF)?f(ON,M([ET(jk),kN(20),m$({bottom:20,left:0,right:0,top:0})]),M([p,wF(r.terms.paymentMethods)])):p}),YK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(VN,M([wN,cN(12),aR(30),kN(10),Wk(CF),bN(24),vN,bA(tN)]),M([fl("Trade "+TF(t.state.closedReason)),SF])):e?f(ON,M([ET(jk),kN(10)]),M([f(VN,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)])),wF(t.terms.paymentMethods)])):f(ON,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)]))}),WK=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(ON,M([ET(jk),yT(jk),kN(40)]),M([h(bF,t,i,n.wallet,r,n.showStatsModal),f(Kk,M([ET(jk),f(aN,40,0),kN(40)]),h(YK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Kk,M([wN,eR,bN(30)]),fl("Loading trade info..."));default:return f(Kk,M([wN,eR,bN(30)]),fl("Invalid trade"))}}(),M([LO(n),OO(n)]))}),JK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),QK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L($U,yr);case"CreateModel":var n=r.a;return L(f(Yi,Uy,EU(n)),yr);case"TradeModel":var a=r.a;return l(JK,Yi(Fy),xa(Yi(Fy)),d(WK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,fT,l(CO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,oT,l(C_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Kk,M([ET(jk),yT(jk),cN(10)]),n),a)}),XK=function(e){return{$:"DismissNotice",a:e}},ZK=function(e){return f(j$,ZU,eO(e))},eH=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(pA,1,1,1):l(pA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Ok,100,200,255);case"Caution":return l(Ok,255,188,0);case"Error":return l(Ok,255,70,70);default:return l(Ok,200,200,200)}}(),o=f(Kk,M([PN,c_,q$(5),ZK(5)]),B_(XK(t)));return f(Kk,M([Wk(i),cN(10),aR(8),ET(jk),p$(1),d$(d(YR,0,0,0,.15)),HD]),f(ON,M([kN(4),ET(jk)]),f(Bi,r(function(e,t){return f($N,M([ET(jk),bA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},tH=function(e){return R(e,yr)?yr:M([f(ON,M([tO(20),q$(20),kN(10),PN,aL,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,ul)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(ON,M([ZK(20),ex(100),kN(10),k$,c_,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,EB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},rH=r(function(e,t){var r=f(QK,e,t),n=r.a,a=r.b;return L(f(ON,M([r$(Jk),m_(KN(t)),ET(jk),yT(jk),aR(30)]),M([f(Kk,M([yT(zk(50))]),qk),n])),U(a,tH(t.userNotices)))}),nH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),aH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),iH={$:"AllowHover"},oH={$:"Layout"},uH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(hA,155/255,203/255,1,1),offset:L(0,0),size:3})},sH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?uH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?iH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?oH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},cH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(AT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),AT);case"Text":var a=t.a;return $I(a);default:return $I("")}}),fH=n(function(e,t,r){var n=sH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?nH(n):aH(n)}();return f(cH,a,d(fA,AT,Vk,t,wT(M([r]))))}),lH=ZT(5),dH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),hH={$:"SansSerif"},pH=function(e){return{$:"Typeface",a:e}},gH=Y,vH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",gH(sd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",gH(sd(t)));default:var t=e.a.name;return f(Ri,"-",gH(sd(t)))}}())}),yH=function(){var e=M([pH("Open Sans"),pH("Helvetica"),pH("Verdana"),hH]);return M([f(yA,Yk,l(vA,"bg-color-"+mA(d(hA,1,1,1,0)),"background-color",d(hA,1,1,1,0))),f(yA,gA,l(vA,"font-color-"+mA(d(hA,0,0,0,1)),"color",d(hA,0,0,0,1))),f(yA,yN,mN(20)),f(yA,lH,f(dH,l(Ra,vH,"font-",e),e))])}(),mH=n(function(e,t,r){var n=e.options;return l(fH,n,f(ka,lA(f(Ri," ",M([RT.root,RT.any,RT.single]))),U(yH,t)),r)}),bH=mH({options:yr}),CH=function(e){return f(yA,lH,f(dH,l(Ra,vH,"ff-",e),e))},EH=hH,SH=pH,TH=function(e){return{body:M([function(){var t=f(rH,e.screenWidth,e),r=t.a,n=t.b,a=U(M([ET(jk),yT(jk),CH(M([SH("Soleil"),EH]))]),f(xa,m_,n));return f(bH,a,r)}()]),title:"DAIHard"}},wH=Ht,IH=wH({init:OB,onUrlChange:Uk,onUrlRequest:Dk,subscriptions:Pk,update:cB,view:TH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:IH(f(du,function(e){return f(du,function(t){return f(du,function(r){return Fi({height:r,networkId:t,width:e})},f(Oh,"height",CE))},f(Oh,"networkId",CE))},f(Oh,"width",CE)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file +var J=r(44),Q=r(45),X=r(46);t.Buffer=i,t.SlowBuffer=g,t.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),i.poolSize=8192,i._augment=function(e){return e.__proto__=i.prototype,e},i.from=function(e,t,r){return o(null,e,t,r)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(e,t,r){return s(null,e,t,r)},i.allocUnsafe=function(e){return c(null,e)},i.allocUnsafeSlow=function(e){return c(null,e)},i.isBuffer=function(e){return!(null==e||!e._isBuffer)},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,a=0,o=Math.min(r,n);a0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,a){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,a>>>=0,this===e)return 0;for(var o=a-n,u=r-t,s=Math.min(o,u),c=this.slice(n,a),f=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)n+=this[e+--t]*a;return n},i.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return t||x(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||x(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||x(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||x(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||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){t||x(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||x(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||x(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||x(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||x(e,4,this.length),Q.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),Q.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),Q.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t|=0,r|=0,!n){P(this,e,t,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),i.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),i.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},i.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!i.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o8?3:1,y=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^S),S^=t,E^=t<<4,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=858993459&(E>>>2^S),S^=t,E^=t<<2,t=65535&(S>>>-16^E),E^=t,S^=t<<-16,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=16711935&(S>>>8^E),E^=t,S^=t<<8,t=1431655765&(E>>>1^S),S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var w=r[E>>>28]|n[E>>>24&15]|a[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|u[E>>>8&15]|s[E>>>4&15],I=c[S>>>28]|f[S>>>24&15]|l[S>>>20&15]|d[S>>>16&15]|h[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(I>>>16^w),y[b++]=w^t,y[b++]=I^t<<16}}return y}function i(e,t,r,n){var a,i=32===e.length?3:9;a=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,u=t[0],v=t[1];o=252645135&(u>>>4^v),v^=o,u^=o<<4,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,u=u<<1|u>>>31,v=v<<1|v>>>31;for(var y=0;y>>4|v<<28)^e[C+1];o=u,u=v,v=o^(c[E>>>24&63]|l[E>>>16&63]|h[E>>>8&63]|g[63&E]|s[S>>>24&63]|f[S>>>16&63]|d[S>>>8&63]|p[63&S])}o=u,u=v,v=o}u=u>>>1|u<<31,v=v>>>1|v<<31,o=1431655765&(u>>>1^v),v^=o,u^=o<<1,o=16711935&(v>>>8^u),u^=o,v^=o<<8,o=858993459&(v>>>2^u),u^=o,v^=o<<2,o=65535&(u>>>16^v),v^=o,u^=o<<16,o=252645135&(u>>>4^v),v^=o,u^=o<<4,r[0]=u,r[1]=v}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var a=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,a.call(t,r)},t}var u=r(0);r(15),r(23),r(1),e.exports=u.des=u.des||{},u.des.startEncrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},u.des.startDecrypting=function(e,t,r,n){var a=o({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},u.des.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},u.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},u.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=u.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},n("DES-ECB",u.cipher.modes.ecb),n("DES-CBC",u.cipher.modes.cbc),n("DES-CFB",u.cipher.modes.cfb),n("DES-OFB",u.cipher.modes.ofb),n("DES-CTR",u.cipher.modes.ctr),n("3DES-ECB",u.cipher.modes.ecb),n("3DES-CBC",u.cipher.modes.cbc),n("3DES-CFB",u.cipher.modes.cfb),n("3DES-OFB",u.cipher.modes.ofb),n("3DES-CTR",u.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],d=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],h=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],g=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new n(null)}function i(e,t,r,n,a,i){for(;--i>=0;){var o=t*this.data[e++]+r.data[n]+a;a=Math.floor(o/67108864),r.data[n++]=67108863&o}return a}function o(e,t,r,n,a,i){for(var o=32767&t,u=t>>15;--i>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,f=u*s+c*o;s=o*s+((32767&f)<<15)+r.data[n]+(1073741823&a),a=(s>>>30)+(f>>>15)+u*c+(a>>>30),r.data[n++]=1073741823&s}return a}function u(e,t,r,n,a,i){for(var o=16383&t,u=t>>14;--i>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,f=u*s+c*o;s=o*s+((16383&f)<<14)+r.data[n]+a,a=(s>>28)+(f>>14)+u*c,r.data[n++]=268435455&s}return a}function s(e){return it.charAt(e)}function c(e,t){var r=ot[e.charCodeAt(t)];return null==r?-1:r}function f(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function d(e){var t=a();return t.fromInt(e),t}function h(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,i=!1,o=0;--a>=0;){var u=8==r?255&e[a]:c(e,a);u<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<>this.DB-o):this.data[this.t-1]|=u<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t}function g(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(u>u)>0&&(a=!0,i=s(r));o>=0;)u>(u+=this.DB-t)):(r=this.data[o]>>(u-=t)&n,u<=0&&(u+=this.DB,--o)),r>0&&(a=!0),a&&(i+=s(r));return a?i:"0"}function v(){var e=a();return n.ZERO.subTo(this,e),e}function y(){return this.s<0?this.negate():this}function m(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function C(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function S(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>a|u,u=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[o]=u,t.t=this.t+o+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function A(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t0?(i.lShiftTo(f,u),o.lShiftTo(f,r)):(i.copyTo(u),o.copyTo(r));var l=u.t,d=u.data[l-1];if(0!=d){var h=d*(1<1?u.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(l,C),C.subTo(u,u);u.t=0;){var E=r.data[--y]==d?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+v)*g);if((r.data[y]+=u.am(0,E,r,m,0,l))0&&r.rShiftTo(f,r),s<0&&n.ZERO.subTo(r,r)}}}function N(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function $(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function _(e){return e}function L(e){e.divRemTo(this.m,null,e)}function x(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 _e(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)}function Le(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function xe(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,S,t,r)){var n=g.derToOid(t.publicKeyOid);if(n!==y.oids.rsaEncryption){var a=new Error("Cannot read public key. Unknown OID.");throw a.oid=n,a}e=t.rsaPublicKey}if(r=[],!g.validate(e,E,t,r)){var a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var i=d.util.createBuffer(t.publicKeyModulus).toHex(),o=d.util.createBuffer(t.publicKeyExponent).toHex();return y.setRsaPublicKey(new h(i,16),new h(o,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(y.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(e)])])},y.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,o(e.e))])}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var a=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};a.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},a.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},a.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],f=new Array(64);for(var e=0;e<64;++e)f[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function a(e,t,r){for(var n,a,i,o,u,l,d,h,p=r.length();p>=64;){for(a=e.h0,i=e.h1,o=e.h2,u=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),l=u^i&(o^u),n=a+l+f[h]+t[h],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<32;++h)l=o^u&(i^o),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<48;++h)l=i^o^u,n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;for(;h<64;++h)l=o^(i|~u),n=a+l+f[h]+t[s[h]],d=c[h],a=u,u=o,o=i,i+=n<>>32-d;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+o|0,e.h3=e.h3+u|0,p-=64}}var i=r(0);r(4),r(1);var o=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=o,o.create=function(){l||n();var e=null,t=i.util.createBuffer(),r=new Array(16),o={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n>>0,s>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=s[1],s[1]=s[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),o},o.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,c=s&o.blockLength-1;n.putBytes(u.substr(0,o.blockLength-c));for(var f,l=0,d=o.fullMessageLength.length-1;d>=0;--d)f=8*o.fullMessageLength[d]+l,l=f/4294967296>>>0,n.putInt32Le(f>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};a(h,r,n);var p=i.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var u=null,s=null,c=null,f=null,l=!1},function(e,t,r){(function(t){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(21)),e.exports=n.pbkdf2=i.pbkdf2=function(e,r,i,o,u,s){function c(){if(C>h)return s(null,b);g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes(),E=2,f()}function f(){if(E<=i)return g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y,++E,n.util.setImmediate(f);b+=C4||!u||"sha1"===u))return"string"!=typeof u&&(u="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),s?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,i,o,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):a.pbkdf2(e,r,i,o,u,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,i,o).toString("binary"):a.pbkdf2Sync(e,r,i,o,u).toString("binary");if(void 0!==u&&null!==u||(u="sha1"),"string"==typeof u){if(!(u in n.md.algorithms))throw new Error("Unknown hash algorithm: "+u);u=n.md[u].create()}var l=u.digestLength;if(o>4294967295*l){var d=new Error("Derived key is too long.");if(s)return s(d);throw d}var h=Math.ceil(o/l),p=o-(h-1)*l,g=n.hmac.create();g.start(u,e);var v,y,m,b="";if(!s){for(var C=1;C<=h;++C){g.start(null,null),g.update(r),g.update(n.util.int32ToBytes(C)),v=m=g.digest().getBytes();for(var E=2;E<=i;++E)g.start(null,null),g.update(m),y=g.digest().getBytes(),v=n.util.xorBytes(v,y,l),m=y;b+=C>8*l-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},s.verify=function(e,i,u){var s,c=u-1,f=Math.ceil(c/8);if(i=i.substr(-f),f>8*f-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=r.generate(h,l),v="";for(s=0;s128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var v=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=v.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,v.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var s=e.value.value;if(e.keyIdentifier){var y=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;s.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,y))}if(e.authorityCertIssuer){var m=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[a(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];s.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=f.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);s.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var p,s=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),g=0;g=E&&e2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=p[0],s.validity.notAfter=p[1],s.tbsCertificate=r.tbsCertificate,t){if(s.md=null,s.signatureOid in h){var u=h[s.signatureOid];switch(u){case"sha1WithRSAEncryption":s.md=f.md.sha1.create();break;case"md5WithRSAEncryption":s.md=f.md.md5.create();break;case"sha256WithRSAEncryption":s.md=f.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=f.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=f.md.sha512.create();break;case"RSASSA-PSS":s.md=f.md.sha256.create()}}if(null===s.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=s.signatureOid,o}var g=l.toDer(s.tbsCertificate);s.md.update(g.getBytes())}var y=f.md.sha1.create();s.issuer.getField=function(e){return n(s.issuer,e)},s.issuer.addField=function(e){i([e]),s.issuer.attributes.push(e)},s.issuer.attributes=d.RDNAttributesAsArray(r.certIssuer,y),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=y.digest().toHex();var m=f.md.sha1.create();return s.subject.getField=function(e){return n(s.subject,e)},s.subject.addField=function(e){i([e]),s.subject.attributes.push(e)},s.subject.attributes=d.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=m.digest().toHex(),r.certExtensions?s.extensions=d.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=d.publicKeyFromAsn1(r.subjectPublicKeyInfo),s},d.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(n=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var s,r=l.fromDer(t.value),c=0;c0&&n.value.push(d.certificateExtensionsToAsn1(e.extensions)),n},d.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),a(e.subject),d.publicKeyToAsn1(e.publicKey),s(e)])},d.distinguishedNameToAsn1=function(e){return a(e)},d.certificateToAsn1=function(e){var t=e.tbsCertificate||d.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),u(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},d.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;ns.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:d.certificateError.certificate_expired,notBefore:s.validity.notBefore,notAfter:s.validity.notAfter,now:a}),null===o){if(c=t[0]||e.getIssuer(s),null===c&&s.isIssuer(s)&&(l=!0,c=s),c){var h=c;f.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){c=h.shift();try{p=c.verify(s)}catch(e){}}p||(o={message:"Certificate signature is invalid.",error:d.certificateError.bad_certificate})}null!==o||c&&!l||e.hasCertificate(s)||(o={message:"Certificate is not trusted.",error:d.certificateError.unknown_ca})}if(null===o&&c&&!s.isIssuer(c)&&(o={message:"Certificate issuer is invalid.",error:d.certificateError.bad_certificate}),null===o)for(var g={keyUsage:!0,basicConstraints:!0},v=0;null===o&&vm.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:d.certificateError.bad_certificate})}}var C=null===o||o.error,E=r.verify?r.verify(C,u,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:d.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||f.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,i=!1,++u}while(t.length>0);return!0}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function a(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?p=h.concat(p):v=-1,p.length&&u())}function u(){if(!g){var e=a(o);g=!0;for(var t=p.length;t;){for(h=p,p=[];++v1)for(var r=1;r4){var t=e;e=o.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},u.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(var a=0;a0)e.read-=this.blockSize;else for(var a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=o.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=o.util.createBuffer(r),this._aDataLength=i(8*r.length());var u=r.length()%this.blockSize;for(u&&r.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},u.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},u.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},u.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,a=e[n]>>>4*(7-r%8)&15,i=this._m[r][a];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},u.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},u.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),o=0;o>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;s--)N>>=8,N+=I.at(s)+k.at(s),k.setAt(s,255&N);B.putBuffer(k)}C=B,l.putBuffer(T)}return l.truncate(l.length()-a),l},f.pbe.getCipher=function(e,t,r){switch(e){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(e,t,r);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},f.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if((e=c.derToOid(n.kdfOid))!==f.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=e,o.supportedOids=["pkcs5PBKDF2"],o}if((e=c.derToOid(n.encOid))!==f.oids["aes128-CBC"]&&e!==f.oids["aes192-CBC"]&&e!==f.oids["aes256-CBC"]&&e!==f.oids["des-EDE3-CBC"]&&e!==f.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=e,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,l=u.util.createBuffer(n.kdfIterationCount);l=l.getInt(l.length()<<3);var d,p;switch(f.oids[e]){case"aes128-CBC":d=16,p=u.aes.createDecryptionCipher;break;case"aes192-CBC":d=24,p=u.aes.createDecryptionCipher;break;case"aes256-CBC":d=32,p=u.aes.createDecryptionCipher;break;case"des-EDE3-CBC":d=24,p=u.des.createDecryptionCipher;break;case"desCBC":d=8,p=u.des.createDecryptionCipher}var g=a(n.prfOid),v=u.pkcs5.pbkdf2(r,s,l,d,g),y=n.encIv,m=p(v);return m.start(y),m},f.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,p,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=u.util.createBuffer(n.salt),l=u.util.createBuffer(n.iterations);l=l.getInt(l.length()<<3);var d,h,g;switch(e){case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:d=24,h=8,g=u.des.startDecrypting;break;case f.oids["pbewithSHAAnd40BitRC2-CBC"]:d=5,h=8,g=function(e,t){var r=u.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=e,o}var v=a(n.prfOid),y=f.pbe.generatePkcs12Key(r,s,1,l,d,v);return v.start(),g(y,f.pbe.generatePkcs12Key(r,s,2,l,h,v))},f.pbe.opensslDeriveBytes=function(e,t,r,a){if(void 0===a||null===a){if(!("md5"in u.md))throw new Error('"md5" hash algorithm unavailable.');a=u.md.md5.create()}null===t&&(t="");for(var i=[n(a,e+t)],o=16,s=1;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+u),n+=r.digest().getBytes()}return n.substring(0,t)}var a=r(0);r(1),r(2),r(9);var i=e.exports=a.pkcs1=a.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,o,u,s;"string"==typeof r?(i=r,o=arguments[3]||void 0,u=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,u=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),u?u.start():u=a.md.sha1.create(),s||(s=u);var c=Math.ceil(e.n.bitLength()/8),f=c-2*u.digestLength-2;if(t.length>f){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=t.length,l.maxLength=f,l}i||(i=""),u.update(i,"raw");for(var d=u.digest(),h="",p=f-t.length,g=0;g=0&&a.push(u):a.push(u))}return a}function a(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r0&&(a=f.create(f.Class.UNIVERSAL,f.Type.SET,!0,s));var h=[],p=[];null!==t&&(p=c.util.isArray(t)?t:[t]);for(var g=[],v=0;v0){var C=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,g),E=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));S=null===r?f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.keyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[T]),a]):f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.pkcs8ShroudedKeyBag).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[l.encryptPrivateKeyInfo(T,r,n)]),a]);var w=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[S]),I=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,[f.create(f.Class.UNIVERSAL,f.Type.OID,!1,f.oidToDer(l.oids.data).getBytes()),f.create(f.Class.CONTEXT_SPECIFIC,0,!0,[f.create(f.Class.UNIVERSAL,f.Type.OCTETSTRING,!1,f.toDer(w).getBytes())])]);h.push(I)}var A,B=f.create(f.Class.UNIVERSAL,f.Type.SEQUENCE,!0,h);if(n.useMac){var u=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),N=n.count,e=d.generateKey(r,k,3,N,20),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,E,S,T,w,I,A,B,k,N,R,$,_,L,x,P,D,U,O,M=r.length();M>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)P=t[_-2],L=P[0],x=P[1],n=((L>>>19|x<<13)^(x>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|x>>>19)^(x<<3|L>>>29)^(L<<26|x>>>6))>>>0,U=t[_-15],L=U[0],x=U[1],i=((L>>>1|x<<31)^(L>>>8|x<<24)^L>>>7)>>>0,o=((L<<31|x>>>1)^(L<<24|x>>>8)^(L<<25|x>>>7))>>>0,D=t[_-7],O=t[_-16],x=a+D[1]+o+O[1],t[_][0]=n+D[0]+i+O[0]+(x/4294967296>>>0)>>>0,t[_][1]=x>>>0;for(v=e[0][0],y=e[0][1],m=e[1][0],b=e[1][1],C=e[2][0],E=e[2][1],S=e[3][0],T=e[3][1],w=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],k=e[6][0],N=e[6][1],R=e[7][0],$=e[7][1],_=0;_<80;++_)c=((w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23))>>>0,l=((w<<18|I>>>14)^(w<<14|I>>>18)^(I<<23|w>>>9))>>>0,d=(k^w&(A^k))>>>0,h=(N^I&(B^N))>>>0,u=((v>>>28|y<<4)^(y>>>2|v<<30)^(y>>>7|v<<25))>>>0,s=((v<<4|y>>>28)^(y<<30|v>>>2)^(y<<25|v>>>7))>>>0,p=(v&m|C&(v^m))>>>0,g=(y&b|E&(y^b))>>>0,x=$+l+h+f[_][1]+t[_][1],n=R+c+d+f[_][0]+t[_][0]+(x/4294967296>>>0)>>>0,a=x>>>0,x=s+g,i=u+p+(x/4294967296>>>0)>>>0,o=x>>>0,R=k,$=N,k=A,N=B,A=w,B=I,x=T+a,w=S+n+(x/4294967296>>>0)>>>0,I=x>>>0,S=C,T=E,C=m,E=b,m=v,b=y,x=a+o,v=n+i+(x/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+v+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+m+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+E,e[2][0]=e[2][0]+C+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+T,e[3][0]=e[3][0]+S+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+I,e[4][0]=e[4][0]+w+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+B,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+N,e[6][0]=e[6][0]+k+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+$,e[7][0]=e[7][0]+R+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,M-=128}}var i=r(0);r(4),r(1);var o=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=o;var u=i.sha384=i.sha512.sha384=i.sha512.sha384||{};u.create=function(){return o.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=u,i.sha512.sha256=i.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,o=i.util.createBuffer(),u=new Array(80),f=0;f<80;++f)u[f]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return h.start=function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n>>0,n>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=n[1],n[1]=n[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),a(r,u,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var f,l,d=8*h.fullMessageLength[0],p=0;p>>0,d+=l,t.putInt32(d>>>0),d=f>>>0;t.putInt32(d);for(var g=new Array(r.length),p=0;p>1,u=o+(1&e.length),s=e.substr(0,u),c=e.substr(o,u),f=n.util.createBuffer(),l=n.hmac.create();r=t+r;var d=Math.ceil(a/16),h=Math.ceil(a/20);l.start("MD5",s);var p=n.util.createBuffer();f.putBytes(r);for(var g=0;g0&&(f.queue(e,f.createAlert(e,{level:f.Alert.Level.warning,description:f.Alert.Description.no_renegotiation})),f.flush(e)),e.process()},f.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===f.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(a={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},i?(a.cipher_suite=o.getBytes(2),a.compression_method=o.getByte()):(a.cipher_suites=s(o,2),a.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var c=s(o,2);c.length()>0;)a.extensions.push({type:[c.getByte(),c.getByte()],data:s(c,2)});if(!i)for(var l=0;l0;){var p=h.getByte();if(0!==p)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=f.getCipherSuite(a.cipher_suite);else for(var g=n.util.createBuffer(a.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=f.getCipherSuite(g.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:f.CompressionMethod.none}return a},f.createSecurityParameters=function(e,t){var r=e.entity===f.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:f.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:f.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},f.handleServerHello=function(e,t,r){var n=f.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=g,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,f.createSecurityParameters(e,n)),e.session.id=a,e.process()}},f.handleClientHello=function(e,t,r){var a=f.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),o=null;if(e.sessionCache&&(o=e.sessionCache.getSession(i),null===o?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var u,s=1;s0;)a=s(u.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),c.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.bad_certificate}})}var l=e.entity===f.ConnectionEnd.client;!l&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=l?d:C:(l?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],f.verifyCertificateChain(e,c)&&(e.expect=l?d:C)):e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}}),e.process()},f.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});e.expect=h,e.process()},f.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:s(a,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==u.pre_master_secret.charCodeAt(0)||c.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},f.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=a,e.expect=p,e.process()},f.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var o={signature:s(a,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.handshake_failure}})}e.expect=S,e.process()},f.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificate(e)}),f.queue(e,t)),t=f.createRecord(e,{type:f.ContentType.handshake,data:f.createClientKeyExchange(e)}),f.queue(e,t),e.expect=m;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createCertificateVerify(e,t)})),f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.pending=f.createConnectionState(e),e.state.current.write=e.state.pending.write,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)})),e.expect=g,f.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);f.getClientSignature(e,o)},f.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.illegal_parameter}});var r=e.entity===f.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=f.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?v:T,e.process()},f.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var o=i.bytes();i.read+=4;var u=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===f.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp;if(i=a(l.master_secret,c,i.getBytes(),12),i.getBytes()!==u)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:f.Alert.Level.fatal,description:f.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&s||!e.session.resuming&&!s)&&(f.queue(e,f.createRecord(e,{type:f.ContentType.change_cipher_spec,data:f.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,f.queue(e,f.createRecord(e,{type:f.ContentType.handshake,data:f.createFinished(e)}))),e.expect=s?y:w,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,f.flush(e),e.isConnected=!0,e.connected(e),e.process()},f.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case f.Alert.Description.close_notify:r="Connection closed.";break;case f.Alert.Description.unexpected_message:r="Unexpected message.";break;case f.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case f.Alert.Description.decryption_failed:r="Decryption failed.";break;case f.Alert.Description.record_overflow:r="Record overflow.";break;case f.Alert.Description.decompression_failure:r="Decompression failed.";break;case f.Alert.Description.handshake_failure:r="Handshake failure.";break;case f.Alert.Description.bad_certificate:r="Bad certificate.";break;case f.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case f.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case f.Alert.Description.certificate_expired:r="Certificate expired.";break;case f.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case f.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case f.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case f.Alert.Description.access_denied:r="Access denied.";break;case f.Alert.Description.decode_error:r="Decode error.";break;case f.Alert.Description.decrypt_error:r="Decrypt error.";break;case f.Alert.Description.export_restriction:r="Export restriction.";break;case f.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case f.Alert.Description.insufficient_security:r="Insufficient security.";break;case f.Alert.Description.internal_error:r="Internal error.";break;case f.Alert.Description.user_canceled:r="User canceled.";break;case f.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===f.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===f.ConnectionEnd.client?"server":"client",alert:a}),e.process()},f.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(i+4);r.read+=4,a in M[e.entity][e.expect]?(e.entity!==f.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==f.HandshakeType.hello_request&&a!==f.HandshakeType.certificate_verify&&a!==f.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),M[e.entity][e.expect][a](e,t,i)):f.handleUnexpected(e,t)},f.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},f.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),o=r.getBytes(i);if(a===f.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>o.length)return e.process();f.queue(e,f.createRecord(e,{type:f.ContentType.heartbeat,data:f.createHeartbeat(f.HeartbeatMessageType.heartbeat_response,o)})),f.flush(e)}else if(a===f.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,d=2,h=3,p=4,g=5,v=6,y=7,m=8,b=1,C=2,E=3,S=4,T=5,w=6,I=f.handleUnexpected,A=f.handleChangeCipherSpec,B=f.handleAlert,k=f.handleHandshake,N=f.handleApplicationData,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 _=f.handleHelloRequest,L=f.handleServerHello,x=f.handleCertificate,P=f.handleServerKeyExchange,D=f.handleCertificateRequest,U=f.handleServerHelloDone,O=f.handleFinished,M=[];M[f.ConnectionEnd.client]=[[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,I,I,I,x,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,P,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,D,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,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]];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,x,I,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={};return e.isAvailable=function(){return"function"==typeof Notification},e.requestPermission=function(e){var t=Notification.permission;"default"!=t?e(t):Notification.requestPermission(e)},e.notify=function(t,r,n){e.isAvailable()&&e.requestPermission(function(e){if("granted"==e){var a={};r&&(a.body=r),n&&(a.icon=n);var i=new Notification(t,a);setTimeout(function(){i.close.bind(i)()},4e3)}})},e}();e.exports=n},function(e,t,r){"use strict";var n=function(){var e,t,r={};return r.startWatching=function(r,n){e=r,t=n},r}();e.exports=n},function(e,t,r){"use strict";function n(e,t){for(;e.length");if("boolean"==typeof t)return S(e,t?"True":"False");if("number"==typeof t)return T(e,t+"");if(t instanceof String)return I(e,"'"+E(t,!0)+"'");if("string"==typeof t)return w(e,'"'+E(t,!1)+'"');if("object"==typeof t&&"$"in t){var r=t.$;if("number"==typeof r)return B(e,"");if("#"===r[0]){var n=[];for(var a in t)"$"!==a&&n.push(C(e,t[a]));return"("+n.join(",")+")"}if("Set_elm_builtin"===r)return S(e,"Set")+A(e,".fromList")+" "+C(e,Ba(t));if("RBNode_elm_builtin"===r||"RBEmpty_elm_builtin"===r)return S(e,"Dict")+A(e,".fromList")+" "+C(e,Ia(t));if("Array_elm_builtin"===r)return S(e,"Array")+A(e,".fromList")+" "+C(e,Sa(t));if("::"===r||"[]"===r){var n="[";for(t.b&&(n+=C(e,t.a),t=t.b);t.b;t=t.b)n+=","+C(e,t.a);return n+"]"}var n="";for(var i in t)if("$"!==i){var o=C(e,t[i]),u=o[0],s="{"===u||"("===u||"["===u||"<"===u||'"'===u||o.indexOf(" ")<0;n+=" "+(s?o:"("+o+")")}return S(e,r)+n}if("function"==typeof DataView&&t instanceof DataView)return w(e,"<"+t.byteLength+" bytes>");if("function"==typeof File&&t instanceof File)return B(e,"<"+t.name+">");if("object"==typeof t){var n=[];for(var c in t){var f="_"===c[0]?c.slice(1):c;n.push(A(e,f)+" = "+C(e,t[c]))}return 0===n.length?"{}":"{ "+n.join(", ")+" }"}return B(e,"")}function E(e,t){var r=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return t?r.replace(/\'/g,"\\'"):r.replace(/\"/g,'\\"')}function S(e,t){return e?""+t+"":t}function T(e,t){return e?""+t+"":t}function w(e,t){return e?""+t+"":t}function I(e,t){return e?""+t+"":t}function A(e,t){return e?""+t+"":t}function B(e,t){return e?""+t+"":t}function k(e,t,r,n,a){switch(e){case 0:throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');case 1:throw new Error("Browser.application programs cannot handle URLs like this:\n\n "+document.location.href+"\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:var i=t;throw new Error("Problem with the flags given to your Elm program on initialization.\n\n"+i);case 3:var o=t;throw new Error("There can only be one port named `"+o+"`, but your program has multiple.");case 4:var o=t,u=r;throw new Error("Trying to send an unexpected type of value through port `"+o+"`:\n"+u);case 5:throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');case 6:var s=t;throw new Error("Your page is loading multiple Elm scripts with a module named "+s+". Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!");case 8:var s=t,c=r,f=n;throw new Error("TODO in module `"+s+"` "+N(c)+"\n\n"+f);case 9:var s=t,c=r,l=n,f=a;throw new Error("TODO in module `"+s+"` from the `case` expression "+N(c)+"\n\nIt received the following value:\n\n "+b(l).replace("\n","\n ")+"\n\nBut the branch that handles it says:\n\n "+f.replace("\n","\n "));case 10:throw new Error("Bug in https://github.com/elm/virtual-dom/issues");case 11:throw new Error("Cannot perform mod 0. Division by zero error.")}}function N(e){return e.start.line===e.end.line?"on line "+e.start.line:"on lines "+e.start.line+" through "+e.end.line}function R(e,t){for(var r,n=[],a=$(e,t,0,n);a&&(r=n.pop());a=$(r.a,r.b,0,n));return a}function $(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&&k(5),!1;"Set_elm_builtin"===e.$&&(e=Ba(e),t=Ba(t)),"RBNode_elm_builtin"!==e.$&&"RBEmpty_elm_builtin"!==e.$||(e=Ia(e),t=Ia(t));for(var a in e)if(!$(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 pe("a LONGER array. Need index "+a+" but only see "+t.length+" entries",t);var n=fe(e.b,t[a]);return Oa(n)?n:fi(f(pi,a,n.a));case 8:if("object"!=typeof t||null===t||de(t))return pe("an OBJECT",t);var i=yr;for(var o in t)if(t.hasOwnProperty(o)){var n=fe(e.b,t[o]);if(!Oa(n))return fi(f(hi,o,n.a));i=O(L(o,n.a),i)}return li($a(i));case 9:for(var u=e.f,s=e.g,c=0;c=0&&a.splice(t,1)}var a=[],i=pn[e].r,o=_e(0);return pn[e].b=o,pn[e].c=n(function(e,t,r){for(;t.b;t=t.b)for(var n=a,u=me(i(t.a)),s=0;s0&>(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 gt(r,0,n,t):((h?yt(l,d):l===d)||gt(r,2,n,d),void vt(p,g,r,n+1));case 0:return void(e.a!==t.a&>(r,3,n,t.a));case 1:return void mt(e,t,r,n,Ct);case 2:return void mt(e,t,r,n,Et);case 3:if(e.h!==t.h)return void gt(r,0,n,t);var v=bt(e.d,t.d);v&>(r,4,n,v);var y=t.i(e.g,t.g);return void(y&>(r,5,n,y))}}}function yt(e,t){for(var r=0;ru?gt(r,6,n,{v:u,i:o-u}):o0||o.length>0||k)&>(r,8,n,{w:a,x:o,y:k})}function St(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 vt(o.z,n,u,o.r),o.r=a,void(o.s.s={w:u,A:o})}St(e,t,r+xn,n,a,i)}function Tt(e,t,r,n,a){var i=e[r];if(!i){var o=gt(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 vt(n,i.z,u,a),void gt(t,9,a,{w:u,A:i})}Tt(e,t,r+xn,n,a)}function wt(e,t,r,n){It(e,t,r,0,0,t.b,n)}function It(e,t,r,n,a,i,o){for(var u=r[n],s=u.r;s===a;){var c=u.$;if(1===c)wt(e,t.k,u.s,o);else if(8===c){u.t=e,u.u=o;var f=u.s.w;f.length>0&&It(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&&It(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 It(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 At(e,t,r,n){return 0===r.length?e:(wt(e,t,r,n),Bt(e,r))}function Bt(e,t){for(var r=0;r0){var o=a.substring(0,i),u=a.substring(i+2);t=l(bp,o,function(e){return si(Cp(e)?u+", "+e.a:u)},t)}}return t}function Vt(e,t,r){t.upload.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,kp({sent:n.loaded,size:n.total}))))}),t.addEventListener("progress",function(n){t.c||Ae(f(Sp,e,L(r,Bp({received:n.loaded,size:n.lengthComputable?si(n.total):ci}))))})}function Kt(e,t){function r(){n=1===n?0:(na(r),t(e),1)}t(e);var n=0;return function(a,i){e=a,i?(t(e),2===n&&(n=1)):(0===n&&na(r),n=2)}}function Ht(e){var t=e.onUrlChange,n=e.onUrlRequest,a=function(){a.a(t(jt()))};return ra({setup:function(e){return a.a=e,ua.addEventListener("popstate",a),ua.navigator.userAgent.indexOf("Trident")<0||ua.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=jt(),o=nv(a).a;e(n(o&&i.protocol===o.protocol&&i.host===o.host&&i.port_.a===o.port_.a?qg(o):jg(a)))}})},init:function(t){return l(e.init,t,jt(),a)},view:e.view,update:e.update,subscriptions:e.subscriptions})}function jt(){return nv(Cn.location.href).a||k(1)}function qt(e,t){return we(function(r){na(function(){var n=document.getElementById(e);r(n?Se(t(n)):Te(Gg(e)))})})}function Gt(e){return we(function(t){na(function(){t(Se(e()))})})}function zt(){return{scene:Yt(),viewport:{x:ua.pageXOffset,y:ua.pageYOffset,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight}}}function Yt(){var e=oa.body,t=oa.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 Wt(e){return qt(e,function(e){var t=e.getBoundingClientRect(),r=ua.pageXOffset,n=ua.pageYOffset;return{scene:Yt(),viewport:{x:r,y:n,width:oa.documentElement.clientWidth,height:oa.documentElement.clientHeight},element:{x:r+t.left,y:n+t.top,width:t.width,height:t.height}}})}function Jt(e){return f(Yg,zg,we(function(t){try{ua.location=e}catch(e){Cn.location.reload(!1)}}))}function Qt(e){try{return si(decodeURIComponent(e))}catch(e){return ci}}function Xt(){return f(zo,xa(ac),f(zo,Ms,nc))}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 Zt,er,tr=[],rr=n(function(e,t,r){for(var n=new Array(e),a=0;a=0;n--)t=f(e,r[n],t);return t}),cr=(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?ba:r?Ta:ma})),gr={$:"#0"},vr=r(U),yr={$:"[]"},mr=r(O),br=n(function(e,t,r){for(var n=[];t.b&&r.b;t=t.b,r=r.b)n.push(f(e,t.a,r.a));return M(n)}),Cr=(a(function(e,t,r,n){for(var a=[];t.b&&r.b&&n.b;t=t.b,r=r.b,n=n.b)a.push(l(e,t.a,r.a,n.a));return M(a)}),i(function(e,t,r,n,a){for(var i=[];t.b&&r.b&&n.b&&a.b;t=t.b,r=r.b,n=n.b,a=a.b)i.push(d(e,t.a,r.a,n.a,a.a));return M(i)}),o(function(e,t,r,n,a,i){for(var o=[];t.b&&r.b&&n.b&&a.b&&i.b;t=t.b,r=r.b,n=n.b,a=a.b,i=i.b)o.push(h(e,t.a,r.a,n.a,a.a,i.a));return M(o)}),r(function(e,t){return M(F(t).sort(function(t,r){return _(e(t),e(r))}))})),Er=r(function(e,t){return M(F(t).sort(function(t,r){var n=f(e,t,r);return n===ma?0:n===ba?-1:1}))}),Sr=r(function(e,t){return e+t}),Tr=r(function(e,t){return e-t}),wr=r(function(e,t){return e*t}),Ir=(r(function(e,t){return e/t}),r(function(e,t){return e/t|0}),r(Math.pow)),Ar=(r(function(e,t){return t%e}),r(function(e,t){var r=t%e;return 0===e?k(11):r>0&&e<0||r<0&&e>0?r+e:r})),Br=Math.PI,kr=(Math.E,Math.cos),Nr=Math.sin,Rr=(Math.tan,Math.acos,Math.asin,Math.atan,r(Math.atan2),Math.ceil),$r=Math.floor,_r=Math.round,Lr=(Math.sqrt,Math.log),xr=(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})),Pr=r(function(e,t){return e+t}),Dr=(r(function(e,t){for(var r=t.length,n=new Array(r),a=0;a-1}),Hr=r(function(e,t){return 0===t.indexOf(e)}),jr=r(function(e,t){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}),qr=r(function(e,t){var r=e.length;if(r<1)return yr;for(var n=0,a=[];(n=t.indexOf(e,n))>-1;)a.push(n),n+=r;return M(a)}),Gr=ie(function(e){return"number"!=typeof e?pe("an INT",e):-2147483647>e}),r(function(e,t){return t>>>e}),r(function(e,t){return we(function(r){r(Se(1===new Uint8Array(new Uint32Array([1]))[0]?e:t))})}),n(function(e,t,r){return e.setInt8(t,r),t+1})),On=a(function(e,t,r,n){return e.setInt16(t,r,n),t+2}),Mn=a(function(e,t,r,n){return e.setInt32(t,r,n),t+4}),Fn=n(function(e,t,r){return e.setUint8(t,r),t+1}),Vn=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}),Hn=a(function(e,t,r,n){return e.setFloat32(t,r,n),t+4}),jn=a(function(e,t,r,n){return e.setFloat64(t,r,n),t+8}),qn=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}),zn=r(function(e,t){try{return si(f(e,t,0).b)}catch(e){return ci}}),Yn=(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))})),Wn=(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))})),Jn=(n(function(e,t,r){for(var n="",a=r+e;r0;){var l=n[c];f[--c]=l?si(l):ci}a.push(d(ph,n[0],n.index,i,M(f))),s=t.lastIndex}return t.lastIndex=u,M(a)}),a(function(e,t,r,n){function a(t){if(i++>=e)return t;for(var n=arguments.length-3,a=new Array(n);n>0;){var o=arguments[n];a[--n]=o?si(o):ci}return r(d(ph,t,arguments[arguments.length-2],i,M(a)))}var i=0;return n.replace(t,a)}),n(function(e,t,r){for(var n=r,a=[],i=t.lastIndex,o=t.lastIndex;e--;){var u=t.exec(n);if(!u)break;a.push(n.slice(i,u.index)),i=t.lastIndex}return a.push(n.slice(i)),t.lastIndex=o,M(a)}),n(function(e,t,r){return we(function(n){function a(e){n(t(r.expect.a(e)))}var i=new XMLHttpRequest;i.addEventListener("error",function(){a(Ap)}),i.addEventListener("timeout",function(){a(Np)}),i.addEventListener("load",function(){a(Ot(r.expect.b,i))}),Cp(r.tracker)&&Vt(e,i,r.tracker.a);try{i.open(r.method,r.url,!0)}catch(e){return a(wp(r.url))}return Ut(i,r),r.body.a&&i.setRequestHeader("Content-Type",r.body.a),i.send(r.body.b),function(){i.c=!0,i.abort()}})})),ea=n(function(e,t,r){return{$:0,d:e,b:t,a:r}}),ta=(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}})),ra=(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:k(0),o=_t(i);return Kt(r,function(e){var r=a(e),n=pt(o,r);i=At(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=Cn.title,o=Cn.body,u=_t(o);return Kt(r,function(e){Zt=n;var r=a(e),s=Sn("body")(yr)(r.body),c=pt(u,s);o=At(o,u,c,t),u=s,Zt=0,i!==r.title&&(Cn.title=i=r.title)})})})),na=("undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e,1e3/60)}),aa=(r(function(e,t){return f(Yg,zg,we(function(){t&&history.go(t),e()}))}),r(function(e,t){return f(Yg,zg,we(function(){history.pushState({},"",t),e()}))})),ia=(r(function(e,t){return f(Yg,zg,we(function(){history.replaceState({},"",t),e()}))}),{addEventListener:function(){},removeEventListener:function(){}}),oa="undefined"!=typeof document?document:ia,ua="undefined"!=typeof window?window:ia,sa=(n(function(e,t,r){return Be(we(function(n){function a(e){Ae(r(e))}return e.addEventListener(t,a,er&&{passive:!0}),function(){e.removeEventListener(t,a)}}))}),r(function(e,t){var r=fe(e,t);return Oa(r)?si(r.a):ci}),r(function(e,t){return qt(t,function(t){return t[e](),gr})}),r(function(e,t){return Gt(function(){return ua.scroll(e,t),gr})})),ca=(n(function(e,t,r){return qt(e,function(e){return e.scrollLeft=t,e.scrollTop=r,gr})}),r(function(e,t){return we(function(r){var n=setInterval(function(){Ae(t)},e);return function(){clearInterval(n)}})})),fa=n(function(e,t,r){return{$:"BrowserNotification",a:e,b:t,c:r}}),la=function(e){return{$:"GTag",a:e}},da=function(e){return{$:"GotoRoute",a:e}},ha={$:"RequestBrowserNotificationPermission"},pa=function(e){return{$:"UserNotice",a:e}},ga={$:"Web3Connect"},va=a(function(e,t,r,n){return{align:r,label:n,mainParagraphs:t,noticeType:e}}),ya=r(function(e,t){return t(e)}),ma={$:"EQ"},ba={$:"LT"},Ca=sr,Ea=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(Ca,o,r,n)}var a=t.a;return l(Ca,e,r,a)});return l(Ca,o,l(Ca,e,t,i),a)}),Sa=function(e){return l(Ea,ka,yr,e)},Ta={$:"GT"},wa=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(wa,e,t,o)),c=i;e=u,t=s,r=c}}),Ia=function(e){return l(wa,n(function(e,t,r){return f(ka,L(e,t),r)}),yr,e)},Aa=function(e){return l(wa,n(function(e,t,r){return f(ka,e,r)}),yr,e)},Ba=function(e){var t=e.a;return Aa(t)},ka=mr,Na=Sr,Ra=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}}),$a=function(e){return l(Ra,ka,yr,e)},_a=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(Ra,e,t,$a(p)):d(_a,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}),La=n(function(e,t,r){return d(_a,e,t,0,r)}),xa=r(function(e,t){return l(La,r(function(t,r){return f(ka,e(t),r)}),yr,t)}),Pa=r(function(e,t){return e(t)}),Da=n(function(e,t,r){return e(t(r))}),Ua=function(e){return e},Oa=function(e){return"Ok"===e.$},Ma=a(function(e,t,r,n){return{$:"Array_elm_builtin",a:e,b:t,c:r,d:n}}),Fa=Rr,Va=r(function(e,t){return Lr(t)/Lr(e)}),Ka=V,Ha=Fa(f(Va,2,32)),ja=tr,qa=d(Ma,0,Ha,ja,ja),Ga=function(e){return{$:"Leaf",a:e}},za=function(e){return{$:"SubTree",a:e}},Ya=nr,Wa=r(function(e,t){for(;;){var r=f(Ya,32,e),n=r.a,a=r.b,i=f(ka,za(n),t);if(!a.b)return $a(i);var o=a,u=i;e=o,t=u}}),Ja=dr,Qa=function(e){return e.a},Xa=r(function(e,t){for(;;){var r=Fa(t/32);if(1===r)return f(Ya,32,e).a;var n=f(Wa,e,yr),a=r;e=n,t=a}}),Za=$r,ei=r(function(e,t){return _(e,t)>0?e:t}),ti=wr,ri=Tr,ni=m,ai=r(function(e,t){if(t.nodeListSize){var r=32*t.nodeListSize,n=Za(f(Va,32,r-1)),a=e?$a(t.nodeList):t.nodeList,i=f(Xa,a,t.nodeListSize);return d(Ma,ni(t.tail)+r,f(ei,5,n*Ha),i,t.tail)}return d(Ma,ni(t.tail),Ha,ja,t.tail)}),ii=rr,oi=i(function(e,t,r,n,a){for(;;){if(t<0)return f(ai,!1,{nodeList:n,nodeListSize:r/32|0,tail:a});var i=Ga(l(ii,32,t,e)),o=e,u=t-32,s=r,c=f(ka,i,n),d=a;e=o,t=u,r=s,n=c,a=d}}),ui=r(function(e,t){if(e<=0)return qa;var r=e%32,n=l(ii,r,e-r,t);return h(oi,t,e-r-32,e,yr,n)}),si=function(e){return{$:"Just",a:e}},ci={$:"Nothing"},fi=function(e){return{$:"Err",a:e}},li=function(e){return{$:"Ok",a:e}},di=r(function(e,t){return{$:"Failure",a:e,b:t}}),hi=r(function(e,t){return{$:"Field",a:e,b:t}}),pi=r(function(e,t){return{$:"Index",a:e,b:t}}),gi=function(e){return{$:"OneOf",a:e}},vi=vr,yi=H,mi=function(e){var t=yi(e);return 97<=t&&t<=122},bi=function(e){var t=yi(e);return t<=90&&65<=t},Ci=function(e){return mi(e)||bi(e)},Ei=function(e){var t=yi(e);return t<=57&&48<=t},Si=function(e){return mi(e)||bi(e)||Ei(e)},Ti=function(e){return l(Ra,r(function(e,t){return t+1}),0,e)},wi=br,Ii=n(function(e,t,r){for(;;){if(!(_(e,t)<1))return r;var n=e,a=t-1,i=f(ka,t,r);e=n,t=a,r=i}}),Ai=r(function(e,t){return l(Ii,e,t,yr)}),Bi=r(function(e,t){return l(wi,e,f(Ai,0,Ti(t)-1),t)}),ki=Vr,Ni=X,Ri=r(function(e,t){return f(Mr,e,F(t))}),$i=G,_i=r(function(e,t){return M(f(Or,e,t))}),Li=function(e){return f(Ri,"\n ",f(_i,"\n",e))},xi=an,Pi=r(function(e,t){return"\n\n("+Ni(e+1)+") "+Li(Di(t))}),Di=function(e){return f(Ui,e,yr)},Ui=r(function(e,t){e:for(;;)switch(e.$){case"Field":var r=e.a,n=e.b,a=function(){var e=$i(r);if("Nothing"===e.$)return!1;var t=e.a,n=t.a,a=t.b;return Ci(n)&&f(ki,Si,a)}(),i=a?"."+r:"['"+r+"']",o=n,u=f(ka,i,t);e=o,t=u;continue e;case"Index":var s=e.a,n=e.b,c="["+Ni(s)+"]",o=n,u=f(ka,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(Ri,"",$a(t)):"Json.Decode.oneOf"}(),h=d+" failed in the following "+Ni(Ti(l))+" ways:";return f(Ri,"\n\n",f(ka,h,f(Bi,Pi,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(Ri,"",$a(t)):"!"}();default:var p=e.a,g=e.b,h=function(){return t.b?"Problem with the value at json"+f(Ri,"",$a(t))+":\n\n ":"Problem with the given value:\n\n"}();return h+(Li(f(xi,4,g))+"\n\n")+p}}),Oi=Zr,Mi=en,Fi=ne,Vi=function(e){switch(e.$){case"Normal":return 0;case"MayStopPropagation":return 1;case"MayPreventDefault":return 2;default:return 3}},Ki=In,Hi={$:"Empty"},ji=function(e){return{$:"Styled",a:e}},qi=function(e){return{$:"Text",a:e}},Gi=function(e){return{$:"Unstyled",a:e}},zi=r(function(e,t){switch(t.$){case"Styled":var n=t.a;return ji({html:r(function(t,r){return f(Ki,e,f(n.html,t,r))}),styles:n.styles});case"Unstyled":var a=t.a;return Gi(f(Da,Ki(e),a));case"Text":var i=t.a;return qi(i);default:return Hi}}),Yi=zi,Wi=r(function(e,t){return d(va,t.noticeType,f(xa,xa(Yi(e)),t.mainParagraphs),t.align,t.label)}),Ji=r(function(e,t){switch(t.$){case"UserNotice":var r=t.a;return pa(f(Wi,e,r));case"Web3Connect":return ga;case"GotoRoute":var n=t.a;return da(n);case"GTag":var a=t.a;return la(a);case"BrowserNotification":var i=t.a,o=t.b,u=t.c;return l(fa,i,o,u);default:return ha}}),Qi=r(function(e,t){return f(xa,Ji(e),t)}),Xi={$:"EthDai"},Zi=function(e){return{$:"Native",a:e}},eo=function(e){return{$:"Token",a:e}},to={$:"XDai"},ro=M([eo(Xi),Zi(to)]),no=function(e){var t=e.a;e.b,e.c;return t},ao=function(e){var t=(e.a,e.b);e.c;return t},io=function(e){e.a,e.b;return e.c},oo=r(function(e,t){return t.b?l(La,ka,t,e):e}),uo=r(function(e,t){return D(t,{userNotices:f(oo,t.userNotices,M([e]))})}),so=r(function(e,t){return l(Ra,uo,t,e)}),co=Ua,fo={$:"Buyer"},lo={$:"Seller"},ho=r(function(e,t){return{options:t,type_:e}}),po={$:"OfferType"},go=n(function(e,t,r){return{checked:t,label:e,testTrade:r}}),vo=r(function(e,t){return f(ho,po,M([l(go,"Buying",e,function(e){return R(e.parameters.initiatorRole,fo)}),l(go,"Selling",t,function(e){return R(e.parameters.initiatorRole,lo)})]))}),yo={$:"Closed"},mo={$:"Committed"},bo={$:"Judgment"},Co={$:"Open"},Eo={$:"Phase"},So=a(function(e,t,r,n){return f(ho,Eo,M([l(go,"Open",e,function(e){return R(e.state.phase,Co)}),l(go,"Committed",t,function(e){return R(e.state.phase,mo)}),l(go,"Judgment",r,function(e){return R(e.state.phase,bo)}),l(go,"Closed",n,function(e){return R(e.state.phase,yo)})]))}),To={$:"Initiator"},wo={$:"Responder"},Io=r(function(e,t){if("Just"===t.$){return e(t.a)}return ci}),Ao=r(function(e,t){return R(t,e.parameters.initiatorAddress)?si(To):f(Io,function(e){return R(t,e)?si(wo):ci},e.state.responder)}),Bo=r(function(e,t){if("Just"===t.$){var r=t.a;return si(e(r))}return ci}),ko=r(function(e,t){return f(Bo,function(t){var r=L(t,e.parameters.initiatorRole);if("Initiator"===r.a.$){if("Seller"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}if("Seller"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo},f(Ao,e,t))}),No={$:"Role"},Ro=n(function(e,t,r){return f(ho,No,M([l(go,"Buyer",t,function(t){return R(f(ko,t,e),si(fo))}),l(go,"Seller",r,function(t){return R(f(ko,t,e),si(lo))})]))}),$o=function(e){return{orderBy:e}},_o=$o,Lo={$:"Ascending"},xo={$:"Phase"},Po=Oe,Do=Po(yr),Uo=r(function(e,t){return L({agentAddress:t,filters:co(M([d(So,!0,!0,!0,!1),f(vo,!0,!0),l(Ro,t,!0,!0)])),tradeTable:_o(L(xo,Lo)),wallet:e},Do)}),Oo=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Mo={$:"None"},Fo=Mo,Vo=function(e){return d(Oo,e,Do,Fo,yr)},Ko=function(e){return{$:"TradeTableMsg",a:e}},Ho=function(e){return d(Oo,e,Do,Fo,yr)},jo=r(function(e,t){return{$:"CustomSend",a:e,b:t}}),qo=r(function(e,t){return f(jo,e,t)}),Go=n(function(e,t,r){return{onBroadcast:t,onMined:r,onSign:e}}),zo=n(function(e,t,r){return t(e(r))}),Yo=r(function(e,t){if("None"===t.$)return Mo;var r=t.a,n=t.b,a=l(Go,f(Bo,Da(e),r.onSign),f(Bo,Da(e),r.onBroadcast),f(Bo,function(t){var r=t.a,n=t.b;return L(f(zo,r,e),f(Bo,function(t){return{confirmations:t.confirmations,toMsg:f(zo,t.toMsg,e)}},n))},r.onMined));return f(jo,a,n)}),Wo=function(e){return{$:"AbiDecoder",a:e}},Jo=r(function(e,t){return{$:"Tape",a:e,b:t}}),Qo=z,Xo=Fr,Zo=r(function(e,t){return e<1?t:l(Xo,e,Qo(t),t)}),eu=Zo(64),tu=n(function(e,t,r){return L(f(Jo,e,eu(t)),r)}),ru=r(function(e,t){return e<1?"":l(Xo,0,e,t)}),nu=ru(64),au=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(e(r))}var n=t.a;return fi(n)}),iu=function(e){return-e},ou=r(function(e,t){return e<1?"":l(Xo,-e,Qo(t),t)}),uu=function(){var e=function(e){if(!f(ki,Ja(P("0")),f(ru,63,e)))return fi("Boolean decode error. "+e+" is not 1 or 0.");switch(f(ou,1,e)){case"0":return li(!1);case"1":return li(!0);default:return fi("Boolean decode error. "+e+" is not 1 or 0.")}};return Wo(function(t){var r=t.a,n=t.b;return f(au,f(tu,r,n),e(nu(n)))})}(),su=Hr,cu=function(e){return f(su,"0x",e)||f(su,"0X",e)?f(Zo,2,e):e},fu=function(e){return e.b},lu=r(function(e,t){var r=e.a;return f(au,fu,r(function(e){return f(Jo,e,e)}(cu(t))))}),du=Xr,hu=ae,pu=Wr,gu=function(e){return f(du,function(t){var r=e(t);if("Ok"===r.$){var n=r.a;return Fi(n)}var a=r.a;return hu(a)},pu)},vu=f(zo,lu,gu),yu=function(e){return{$:"Magnitude",a:e}},mu=function(e){return{$:"Pos",a:e}},bu=r(function(e,t){return{$:"BigIntNotNormalised",a:e,b:t}}),Cu=function(e){return{$:"MagnitudeNotNormalised",a:e}},Eu=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 si(n)}return ci}},Su=function(e){var t=Eu(e);return"Nothing"!==t.$&&t.a<0},Tu=function(e){return{$:"Neg",a:e}},wu={$:"Zer"},Iu=function(e){return!e.b},Au=r(function(e,t){var r=t.a;if(Iu(r))return wu;switch(e.$){case"Zero":return wu;case"Positive":return mu(t);default:return Tu(t)}}),Bu=r(function(e,t){return f(bu,e,Cu(t))}),ku=function(e){return f(La,r(function(t,r){return e(t)&&Iu(r)?yr:f(ka,t,r)}),yr)}(Ja(0)),Nu=Ir,Ru=-1+f(Nu,10,7),$u=Ru+1,_u=r(function(e,t){var r=t.a,n=t.b;return L(e(r),n)}),Lu=function(e){return e<0?f(_u,Na(-1),Lu(e+$u)):L(e/$u|0,e%$u)},xu=r(function(e,t){for(;;){if(t.b){var r=t.a,n=t.b,a=Lu(r+e),i=a.a,o=a.b;return f(ka,o,f(xu,i,n))}{if(!(_(e,$u)>0))return M([e]);var u=M([e]);e=0,t=u}}}),Pu=function(e){var t=e.a;return yu(ku(f(xu,0,t)))},Du=xa(iu),Uu={$:"Negative"},Ou={$:"Positive"},Mu={$:"Zero"},Fu=function(e){switch(e.$){case"Positive":return Uu;case"Negative":return Ou;default:return Mu}},Vu=function(e){for(;;){var t=e.a,r=e.b,n=Pu(r),a=n.a;if(!Su(a))return f(Au,t,yu(a));e=f(Bu,Fu(t),Du(a))}},Ku=pr,Hu=function(e){switch(f(Ku,e,0).$){case"LT":return Uu;case"GT":return Ou;default:return Mu}},ju=function(e){return e<0?-e:e},qu=function(e){return Vu(f(bu,Hu(e),Cu(M([ju(e)]))))},Gu=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(Nu,10,7)+r}var i=e.a.a,r=i.a;return r}break e;default:break e}return 42},zu=function(e){switch(e.$){case"Zer":return wu;case"Neg":var t=e.a;return mu(t);default:return e}},Yu=function(e){return{$:"MagnitudePair",a:e}},Wu=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(ka,L(a,u),f(Wu,i,s))}var c=r.a,a=c.a,i=c.b;return f(ka,L(a,0),f(Wu,i,yr))}if(r.b.b){var l=r.b,u=l.a,s=l.b;return f(ka,L(0,u),f(Wu,yr,s))}return yr}),Ju=r(function(e,t){var r=e.a,n=t.a;return Yu(f(Wu,r,n))}),Qu=function(e){switch(e.$){case"Zer":return f(Bu,Mu,yr);case"Neg":var t=e.a.a;return f(Bu,Ou,Du(t));default:var t=e.a.a;return f(Bu,Ou,t)}},Xu=r(function(e,t){var r=Qu(t),n=r.b,a=Qu(e),i=a.b,o=f(Ju,i,n),u=o.a,s=f(xa,function(e){return e.a+e.b},u);return Vu(f(bu,Ou,Cu(s)))}),Zu=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(R(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 Ta}return a.b.b?ba:f(Ku,e,t)}}),es=function(e){switch(e.$){case"LT":return Ta;case"EQ":return ma;default:return ba}},ts=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(Zu,0,0,n,a)}return Ta;case"Neg":if("Neg"===r.b.$){var n=r.a.a.a,a=r.b.a.a;return es(d(Zu,0,0,n,a))}return ba;default:switch(r.b.$){case"Pos":r.a;return ba;case"Zer":r.a,r.b;return ma;default:r.a;return Ta}}}),rs=r(function(e,t){return R(f(ts,e,t),Ta)}),ns=K,as=r(function(e,t){return!f(rs,e,t)}),is=function(e){switch(e.$){case"Zer":return yu(yr);case"Pos":default:var t=e.a;return t}},os=r(function(e,t){var r=e.a;return Pu(Cu(f(xa,ti(t),r)))}),us=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(os,yu(n),a),u=f(us,yu(i),yu(n)),s=u.a,c=f(Xu,f(Au,Ou,o),f(Au,Ou,yu(f(ka,0,s))));return is(c)}var a=r.a;return f(os,yu(n),a)}return yu(yr)}),ss=function(e){switch(e.$){case"Zer":return Mu;case"Pos":return Ou;default:return Uu}},cs=r(function(e,t){return R(e,Mu)||R(t,Mu)?Mu:R(e,t)?Ou:Uu}),fs=r(function(e,t){return f(Au,f(cs,ss(e),ss(t)),f(us,is(e),is(t)))}),ls=function(e){switch(e.$){case"Zer":return wu;case"Pos":var t=e.a;return Tu(t);default:var t=e.a;return mu(t)}},ds=r(function(e,t){return f(Xu,e,ls(t))}),hs=qu(0),ps=a(function(e,t,r,n){if(e){var a=qu(e),i=f(fs,f(fs,a,n),t),o=f(as,i,r)?L(f(fs,a,t),f(ds,r,i)):L(hs,r),u=o.a,s=o.b,c=d(ps,e/2|0,t,s,n),l=c.a,h=c.b;return L(f(Xu,u,l),h)}return L(hs,r)}),gs=Fa(f(Va,2,Ru)),vs=n(function(e,t,r){return d(ps,f(Nu,2,gs),e,t,r)}),ys=qu(1),ms=r(function(e,t){return e}),bs=n(function(e,t,r){return l(Ra,ms(e),t,f(Ai,1,r))}),Cs=function(e){return l(bs,fs(qu($u)),ys,e)},Es=n(function(e,t,r){if(e){var n=l(vs,Cs(e),t,r),a=n.a,i=n.b,o=l(Es,e-1,i,r),u=o.a,s=o.b;return L(f(Xu,a,u),s)}return l(vs,Cs(e),t,r)}),Ss=function(e){switch(e.$){case"Zer":return yr;case"Pos":default:var t=e.a.a;return t}},Ts=r(function(e,t){if(R(t,hs))return ci;var r=Ti(Ss(e))-Ti(Ss(t))+1,n=l(Es,f(ei,0,r),zu(e),zu(t)),a=n.a,i=n.b;return si(L(f(Au,f(cs,ss(e),ss(t)),is(a)),f(Au,ss(e),is(i))))}),ws=f(fs,qu(2),qu(2147483648)),Is=xr,As=function(e){return f(Is,e,"")},Bs=Pn,ks=n(function(e,t,r){return e<=0?r:l(ks,e>>1,U(t,t),1&e?U(r,t):r)}),Ns=r(function(e,t){return l(ks,e,t,"")}),Rs=n(function(e,t,r){return U(f(Ns,e-Qo(r),As(t)),r)}),$s=te,_s=Ar,Ls=function(e){e:for(;;)switch(e){case 0:return P("0");case 1:return P("1");case 2:return P("2");case 3:return P("3");case 4:return P("4");case 5:return P("5");case 6:return P("6");case 7:return P("7");case 8:return P("8");case 9:return P("9");case 10:return P("a");case 11:return P("b");case 12:return P("c");case 13:return P("d");case 14:return P("e");case 15:return P("f");default:var t=e;e=t;continue e}},xs=r(function(e,t){for(;;){if(t<16)return f(ka,Ls(t),e);var r=f(ka,Ls(f(_s,16,t)),e),n=t/16|0;e=r,t=n}}),Ps=function(e){return $s(e<0?f(ka,P("-"),f(xs,yr,-e)):f(xs,yr,e))},Ds=function(e){var t=f(Ts,e,ws);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=Ps(Gu(a));return R(n,qu(0))?i:U(Ds(n),l(Rs,8,P("0"),i))},Us=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return R(t,yu(yr))?"0":Ds(mu(t));default:var t=e.a;return"-"+Us(f(fs,qu(-1),e))}},Os=function(e){return l(Rs,64,P("0"),e)},Ms=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(Ps(a)),c=function(e){return U(e,n)}(Os(Ps(u)));return x(a+32+(Qo(n)/2|0),U(i,s),U(o,c))}return x(a,U(i,n),o)});return function(e){return U(e.b,e.c)}(l(Ra,t,x(32*Ti(e),"",""),e))},Fs=Dr,Vs=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))))}),Ks=n(function(e,t,n){return l(Fs,r(function(t,r){return l(Vs,e,yi(t),r)}),t,n)}),Hs=function(e){return $a(l(Ks,ka,yr,e))},js=function(e){return f(Ri,"",f(xa,f(zo,Ps,f(Rs,2,P("0"))),Hs(e)))},qs=function(e){return 64-f(_s,64,e)},Gs=function(e){return U(e,f(Ns,qs(Qo(e)),"0"))},zs=function(e){return L(si(Qo(e)/2|0),Gs(e))},Ys=function(e){return L(ci,Os(e))},Ws=function(e){switch(e){case"0000":return P("0");case"0001":return P("1");case"0010":return P("2");case"0011":return P("3");case"0100":return P("4");case"0101":return P("5");case"0110":return P("6");case"0111":return P("7");case"1000":return P("8");case"1001":return P("9");case"1010":return P("a");case"1011":return P("b");case"1100":return P("c");case"1101":return P("d");case"1110":return P("e");case"1111":return P("f");default:return P("!")}},Js=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"}},Qs=Ur,Xs=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(Is,P("1"),r),!0);case"1":return L(f(Is,P("0"),r),!0);default:break e}else switch(a.a.valueOf()){case"0":return L(f(Is,P("0"),r),!1);case"1":return L(f(Is,P("1"),r),!0);default:break e}return L(r,!0)});return l(Qs,t,L("",!1),e).a},Zs=function(e){return l(Qs,ka,yr,e)},ec=n(function(e,t,r){for(;;){if(""===t)return $a(r);var n=e,a=f(Zo,e,t),i=f(ka,l(Xo,0,e,t),r);e=n,t=a,r=i}}),tc=r(function(e,t){return e&&""!==t?l(ec,e,t,yr):M([t])}),rc=function(e){var t=function(){var t=Zs(Us(e));if(t.b&&"-"===t.a.valueOf()){var r=t.b;return L(r,f(zo,Xs,f(Rs,256,P("1"))))}var r=t;return L(r,f(Rs,256,P("0")))}(),r=t.a,n=t.b;return $s(f(xa,Ws,f(tc,4,n(f(Ri,"",f(xa,Js,r))))))},nc=function(e){return{$:"Hex",a:e}},ac=function(e){switch(e.$){case"AddressE":var t=e.a.a;return Ys(t);case"UintE":var r=e.a;return Ys(Us(r));case"IntE":var n=e.a;return Ys(rc(n));case"BoolE":return Ys(e.a?"1":"0");case"DBytesE":var a=e.a.a;return zs(a);case"BytesE":var a=e.a.a;return Ys(cu(a));case"StringE":var i=e.a;return zs(js(i));case"ListE":var o=e.a;return function(e){var t=e.a;return zs(t)}(Xt()(o));default:var i=e.a;return Ys(cu(i))}};try{var ic=Xt();Xt=function(){return ic}}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 oc=Pr,uc=function(e){return 1===Qo(e)?f(oc,"0",e):e},sc=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(ka,n,r);e=i,t=o,r=u}}}),cc=r(function(e,t){return $a(l(sc,e,t,yr))}),fc=n(function(e,t,r){if(t<=0)return yr;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 M([i,u]);case 3:if(n.b.b.b.b){var s=n.b,i=s.a,c=s.b,u=c.a,d=c.b,h=d.a;return M([i,u,h])}break t;default:if(n.b.b.b.b&&n.b.b.b.b.b){var p=n.b,i=p.a,g=p.b,u=g.a,v=g.b,h=v.a,y=v.b,m=y.a,b=y.b;return e>1e3?f(ka,i,f(ka,u,f(ka,h,f(ka,m,f(cc,t-4,b))))):f(ka,i,f(ka,u,f(ka,h,f(ka,m,l(fc,e+1,t-4,b)))))}break t}}return r}var C=n.b,i=C.a;return M([i])}),lc=r(function(e,t){return l(fc,0,e,t)}),dc=function(e){return{$:"KC",a:e}}({capacity:512,delSuffix:1,outputLen:32,rate:1088}),hc=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 Pt(e.a)}},pc={$:"LE"},gc=n(function(e,t,r){switch(e.$){case"I8":var n=e.a;return l(Un,t,r,n);case"I16":var a=e.a,n=e.b;return d(On,t,r,n,R(a,pc));case"I32":var a=e.a,n=e.b;return d(Mn,t,r,n,R(a,pc));case"U8":var n=e.a;return l(Fn,t,r,n);case"U16":var a=e.a,n=e.b;return d(Vn,t,r,n,R(a,pc));case"U32":var a=e.a,n=e.b;return d(Kn,t,r,n,R(a,pc));case"F32":var a=e.a,n=e.b;return d(Hn,t,r,n,R(a,pc));case"F64":var a=e.a,n=e.b;return d(jn,t,r,n,R(a,pc));case"Seq":var i=e.b;return l(vc,i,t,r);case"Utf8":var o=e.b;return l(Gn,t,r,o);default:var i=e.a;return l(qn,t,r,i)}}),vc=n(function(e,t,r){for(;;){if(!e.b)return r;var n=e.a,a=e.b,i=a,o=t,u=l(gc,n,t,r);e=i,t=o,r=u}}),yc=Dt,mc=r(function(e,t){return{$:"Seq",a:e,b:t}}),bc=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=t.b,a=e+hc(r),i=n;e=a,t=i}}),Cc=function(e){return f(mc,f(bc,0,e),e)},Ec=function(e){return{$:"U8",a:e}},Sc=Ec,Tc=r(function(e,t){return _(e,t)<0?e:t}),wc=hr,Ic=function(e){return{$:"Bytes",a:e}},Ac=Ic,Bc=function(e){return yc(Cc(f(xa,Ac,$a(e))))},kc=Pt,Nc=r(function(e,t){var r=e.a;return f(zn,r,t)}),Rc=function(e){return{$:"Decoder",a:e}},$c=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}}),_c=r(function(e,t){return Rc(f($c,e,t))}),Lc=Rc(Yn),xc=r(function(e,t){if("Just"===t.$){return t.a}return e}),Pc=function(e){return{$:"Done",a:e}},Dc=function(e){return{$:"Loop",a:e}},Uc=r(function(e,t){var n=t.a;return Rc(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 Rc(r(function(t,r){return L(r,e)}))},Mc=r(function(e,t){var r=t.a,n=t.b;return r<=0?Oc(Pc($a(n))):f(Uc,function(e){return Dc(L(r-1,f(ka,e,n)))},e)}),Fc=function(e){return f(xc,yr,f(Nc,f(_c,L(kc(e),yr),Mc(Lc)),e))},Vc=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))}),Kc=r(function(e,t){return l(Vc,Bs,e,t)}),Hc=f(Ai,0,4),jc=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}}),qc=xt,Gc=r(function(e,t){var r=t.a,n=t.b;return L(e(r),e(n))}),zc=function(e){return f(Gc,f(zo,qc,Bs(4294967295)),e)},Yc=r(function(e,t){return 5*t+e}),Wc=4294967295>>>32-Ha,Jc=ar,Qc=n(function(e,t,r){for(;;){var n=Wc&t>>>e,a=f(Jc,n,r);if("SubTree"!==a.$){var i=a.a;return f(Jc,Wc&t,i)}var o=a.a,u=e-Ha,s=t,c=o;e=u,t=s,r=c}}),Xc=function(e){return e>>>5<<5},Zc=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d;return e<0||_(e,r)>-1?ci:si(_(e,Xc(r))>-1?f(Jc,Wc&e,i):l(Qc,n,e,a))}),ef=r(function(e,t){var r=f(Zc,e,t);if("Just"===r.$){return r.a}return L(0,0)}),tf=n(function(e,t,r){var n=f(Yc,e,t);return f(ef,n,r)}),rf=ir,nf=a(function(e,t,r,n){var a=Wc&t>>>e,i=f(Jc,a,n);if("SubTree"===i.$){var o=i.a,u=d(nf,e-Ha,t,r,o);return l(rf,a,za(u),n)}var s=i.a,c=l(rf,Wc&t,r,s);return l(rf,a,Ga(c),n)}),af=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,Xc(n))>-1?d(Ma,n,a,i,l(rf,Wc&e,t,o)):d(Ma,n,a,d(nf,a,e,t,i),o)}),of=n(function(e,t,r){return l(af,e,t,r)}),uf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(of,a,r,n)}),sf=Dn,cf=r(function(e,t){return l(Vc,sf,e,t)}),ff=function(e){var t=l(La,r(function(t,n){var a={d0:l(tf,0,t,e.state),d1:l(tf,1,t,e.state),d2:l(tf,2,t,e.state),d3:l(tf,3,t,e.state),d4:l(tf,4,t,e.state)},i=r(function(e,r){return d(uf,e,t,f(cf,f(jc,e,a),f(Kc,zc(f(jc,f(_s,5,e+1),a)),f(jc,f(_s,5,e+2),a))),r)});return f(i,4,f(i,3,f(i,2,f(i,1,f(i,0,n)))))}),e.state,Hc);return D(e,{state:t})},lf=L(0,0),df=function(e){return{current:lf,lfsrstate:1,state:e,x:1,y:0}},hf=function(e){var t=1&e;return 128&e?L(t,e<<1^113):L(t,e<<1)},pf=L(1,0),gf=r(function(e,t){var r=t.a,n=t.b;return e?L(n,r):L(r,n)}),vf=r(function(e,t){if(e){var n=f(gf,1,t);return l(Vc,r(function(t,r){return 4294967295&(t<>>32-e)}),t,n)}return t}),yf=r(function(e,t){var r=f(_s,32,e/32|0),n=f(gf,r,t),a=f(_s,32,e);return f(vf,a,n)}),mf=n(function(e,t,r){var n=f(Zc,e,r);if("Nothing"===n.$)return r;var a=n.a;return l(af,e,t(a),r)}),bf=n(function(e,t,r){return l(mf,e,cf(t),r)}),Cf=a(function(e,t,r,n){var a=f(Yc,e,t);return l(bf,a,r,n)}),Ef=function(e){return l(Ra,r(function(e,t){var r=(1<>r}),Nf=n(function(e,t,r){return t?L(0,r<0))return t;var a=f(Tc,n,r),i=f(xa,function(e){return f(kf,e,g)},f(Ai,0,a)),o=Bf(e),u=U(t,i),s=n-a;e=o,t=u,n=s}});return f(lc,i.outputLen,l(v,g,yr,i.outputLen))},Lf=function(e){return{$:"KS",a:e}},xf=function(e){var t=e.a;return Lf({config:t,inputLength:0,partial:yr,state:f(ui,25,ms(lf))})},Pf=function(e){return Rc(Wn(e))},Df=yc(Cc(yr)),Uf=r(function(e,t){var n=t.a;return Rc(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(Uf,function(e){return Pf(t)},Pf(e))}),Mf=r(function(e,t){return f(xc,Df,f(Nc,f(Of,e,kc(t)-e),t))}),Ff=r(function(e,t){for(;;){var n=t.a,a=n.config.rate/8|0,i=kc(e)?f(ka,e,n.partial):n.partial;if(!(_(l(Ra,r(function(e,t){return t+kc(e)}),0,i),a)>-1))return Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:i}));var o=Bc(i),u=f(xc,Df,f(Nc,Pf(a),o)),s=Fc(u),c=f($f,s,n.state),d=Bf(c),h=f(Mf,a,o),p=Df,g=Lf(D(n,{inputLength:kc(e)+n.inputLength,partial:M([h]),state:d}));e=p,t=g}}),Vf=r(function(e,t){return _f(f(Ff,yc(Cc(f(xa,Sc,t))),xf(e)))}),Kf=Vf(dc),Hf=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,4,Kf(f(xa,yi,Zs(e)))))))},jf=function(e){return f(su,"0x",e)||f(su,"0X",e)?e:"0x"+e},qf=function(e){var t=e.a;return jf(t)},Gf=r(function(e,t){var r=Ms(f(xa,ac,t)),n=function(e){return U(e,r)}(cu(qf(Hf(e))));return nc(n)}),zf=function(e){return{data:si(f(Gf,"poke()",yr)),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Yf=r(function(e,t){return D(t,{checked:e})}),Wf=n(function(e,t,r){return f(xa,function(r){return e(r)?t(r):r},r)}),Jf=r(function(e,t){var r=e.a,n=e.b,a=e.c;return l(Wf,f(zo,function(e){return e.type_},Ja(r)),function(e){return D(e,{options:l(Wf,f(zo,function(e){return e.label},Ja(n)),Yf(a),e.options)})},t)}),Qf=r(function(e,t){return{$:"Trade",a:e,b:t}}),Xf=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Zf={$:"Descending"},el=function(e){return"Ascending"===e.$?Zf:Lo},tl=function(e){return d(Xf,e,Do,Fo,yr)},rl=r(function(e,t){return L(t.a,e(t.b))}),nl=r(function(e,t){switch(e.$){case"TradeClicked":var r=e.a,n=e.b;return d(Xf,t,Do,Fo,M([da(f(Qf,r,n))]));case"ChangeSort":var a=e.a,i=R(t.orderBy.a,a)?f(rl,el,t.orderBy):L(a,Lo);return tl(D(t,{orderBy:i}));default:return tl(t)}}),al=function(e){return{data:e.data,from:e.from,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce,to:e.to,value:e.value}},il=yn,ol=r(function(e,t){switch(e.$){case"Poke":var r=e.a,n=al(zf(r)),a={onBroadcast:ci,onMined:ci,onSign:ci},i=f(qo,a,n);return d(Oo,t,Do,i,yr);case"TradeClicked":var o=e.a,u=e.b;return d(Oo,t,Do,Fo,M([da(f(Qf,o,u))]));case"FiltersMsg":var s=e.a;return Ho(D(t,{filters:f(Jf,s,t.filters)}));case"TradeTableMsg":var c=e.a,l=f(nl,c,t.tradeTable);return d(Oo,D(t,{tradeTable:l.model}),f(il,Ko,l.cmd),f(Yo,Ko,l.chainCmd),f(xa,Ji(Ko),l.appCmds));default:return Vo(t)}}),ul={$:"BottomRight"},sl={$:"ShouldBeImpossible"},cl=lr,fl=function(e){return qi(e)},ll=r(function(e,t){f(cl,e,t);return{align:ul,label:"unexpectedError",mainParagraphs:M([M([fl(e)])]),noticeType:sl}}),dl=function(e){var t=e.a;return jf(t)},hl=ye,pl=f(zo,dl,hl),gl=f(zo,Us,f(zo,jf,hl)),vl=f(zo,qf,hl),yl=f(zo,Ps,f(zo,jf,hl)),ml=r(function(e,t){return l(La,r(function(t,r){return e(t)?f(ka,t,r):r}),yr,t)}),bl=un,Cl=function(e){return ye(l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(on,r,n,t)}),Ce(),e))},El=function(e){return Cl(f(xa,function(e){var t=e.a,r=e.b;return L(t,f(xc,bl,r))},f(ml,function(e){e.a;return!R(e.b,ci)},e)))},Sl=function(e){return El(M([L("to",f(Bo,pl,e.to)),L("from",f(Bo,pl,e.from)),L("gas",f(Bo,yl,e.gas)),L("gasPrice",f(Bo,gl,e.gasPrice)),L("value",f(Bo,gl,e.value)),L("data",f(Bo,vl,e.data)),L("nonce",f(Bo,yl,e.nonce))]))},Tl=function(e){return{$:"TxSentry",a:e}},wl=ye,Il=r(function(e,t){return Cl(M([L("ref",wl(e)),L("txParams",t)]))}),Al=function(e){return{$:"Signing",a:e}},Bl=r(function(e,t){var r=t.onSign;return{onBroadcastTagger:t.onBroadcast,onMinedTagger:t.onMined,onSignedTagger:r,params:e,status:Al(e)}}),kl={$:"Black"},Nl=i(function(e,t,r,n,a){return{$:"RBNode_elm_builtin",a:e,b:t,c:r,d:n,e:a}}),Rl={$:"RBEmpty_elm_builtin"},$l={$:"Red"},_l=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(Nl,$l,t,r,h(Nl,kl,c,f,l,d),h(Nl,kl,i,o,u,s))}return h(Nl,e,i,o,h(Nl,$l,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(Nl,$l,c,f,h(Nl,kl,g,v,y,m),h(Nl,kl,t,r,d,a))}return h(Nl,e,t,r,n,a)}),Ll=n(function(e,t,r){if("RBEmpty_elm_builtin"===r.$)return h(Nl,$l,e,t,Rl,Rl);var n=r.a,a=r.b,i=r.c,o=r.d,u=r.e;switch(f(Ku,e,a).$){case"LT":return h(_l,n,a,i,l(Ll,e,t,o),u);case"EQ":return h(Nl,n,a,t,o,u);default:return h(_l,n,a,i,o,l(Ll,e,t,u))}}),xl=n(function(e,t,r){var n=l(Ll,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(Nl,kl,a,i,o,u)}return n}),Pl=n(function(e,t,r){var n=e.a,a=Sl(r),i=l(xl,n.ref,f(Bl,r,t),n.txs);return L(Tl(D(n,{ref:n.ref+1,txs:i})),f(il,n.tagger,n.outPort(f(Il,n.ref,a))))}),Dl=Pl,Ul=r(function(e,t){var r=L(e,t);if("None"===r.b.$){r.b;return x(e,Do,yr)}if("Just"===r.a.$){var n=r.a.a,a=r.b,i=a.a,o=a.b;return function(e){var t=e.a,r=e.b;return x(si(t),r,yr)}(l(Dl,n,i,o))}return x(ci,Do,M([f(ll,"submodel sent chainCmd, but there is no txSentry to use!",ci)]))}),Ol=a(function(e,t,r,n){return{category:t,event:e,label:r,value:n}}),Ml=n(function(e,t,r){return{address:t,commPubkey:r,network:e}}),Fl=function(e){return{$:"Posix",a:e}},Vl=Fl,Kl={autoabortInterval:Vl(0),autorecallInterval:Vl(0),autoreleaseInterval:Vl(0),daiAmount:"",fiatAmount:"",fiatType:"USD",paymentMethod:"",userRole:lo},Hl=function(e){return{$:"TokenValue",a:e}},jl=function(e){return e.a},ql=r(function(e,t){return f(xc,hs,f(Bo,Qa,f(Ts,e,t)))}),Gl=r(function(e,t){return Hl(f(ql,jl(e),qu(t)))}),zl=function(e){return f(Gl,e,12)},Yl=function(e){return f(Gl,e,3)},Wl=Hl(qu(0)),Jl=r(function(e,t){var r=Wl;return{abortPunishment:zl(t.tradeAmount),autoabortInterval:t.autoabortInterval,autorecallInterval:t.autorecallInterval,autoreleaseInterval:t.autoreleaseInterval,buyerDeposit:Yl(t.tradeAmount),initiatorAddress:e.address,initiatorCommPubkey:e.commPubkey,initiatorRole:t.initiatorRole,paymentMethods:t.paymentMethods,pokeReward:r,price:t.price,tradeAmount:t.tradeAmount}}),Ql=function(e){if(e.b){var t=e.a;e.b;return si(t)}return ci},Xl=qr,Zl=function(e){var t=Ql(f(Xl,".",e));if("Nothing"===t.$)return L(e,0);var r=t.a,n=Qo(e)-1-r;return L(U(f(ru,r,e),f(Zo,r+1,e)),n)},ed=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 yr}}),td=function(e){var t=e.a,r=f(ed,Ja(0),t);return yu(r.b?t:yr)},rd=Z,nd=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}}}),ad=n(function(e,t,r){var n=f(nd,t,r),a=Ti(r)>0;return e>0&&t>0&&a?f(ka,f(lc,e,r),l(ad,e,t,n)):yr}),id=r(function(e,t){return l(ad,e,e,t)}),od=function(e){var t=r(function(t,r){var n=e(t);if("Nothing"===n.$)return ci;var a=n.a;return f(Bo,ka(a),r)});return f(La,t,si(yr))}(Ua),ud=function(e){return f(Bo,f(Da,td,yu),od(f(xa,f(zo,$a,f(zo,$s,rd)),f(id,7,$a(e)))))},sd=Q,cd=function(e){var t=Zs(sd(e));if(!t.b)return ci;switch(t.a.valueOf()){case"-":if(t.b.b){var r=t.b;return f(Bo,Au(Uu),ud(r))}return ci;case"+":if(t.b.b){var r=t.b;return f(Bo,Au(Ou),ud(r))}return ci;default:var r=t;return f(Bo,Au(Ou),ud(r))}},fd=function(e){var t=function(e){return!f(_s,2,e)};switch(e.$){case"Zer":return!0;case"Pos":default:var r=e.a.a;return t(f(xc,0,Ql(r)))}},ld=function(e){return f(fs,e,e)},dd=qu(2),hd=n(function(e,t,r){e:for(;;)switch(r.$){case"Zer":return ys;case"Neg":return wu;default:if(R(r,ys))return f(fs,e,t);if(fd(r)){var n=e,a=ld(t),i=f(ql,r,dd);e=n,t=a,r=i;continue e}var n=f(fs,t,e),a=ld(t),i=f(ql,f(ds,r,ys),dd);e=n,t=a,r=i;continue e}}),pd=r(function(e,t){return l(hd,ys,e,t)}),gd=function(e){if(""===e)return ci;var t=Zl(e),r=t.a,n=t.b,a=cd(r),i=18-n;if(i<0)return ci;if("Nothing"===a.$)return ci;var o=a.a,u=f(fs,o,f(pd,qu(10),qu(i)));return si(u)},vd=function(e){return f(Bo,Hl,gd(e))},yd=jr,md=function(e){for(;;){if(f(yd,".",e))return l(Xo,0,-1,e);{if(!f(yd,"0",e))return""===e?"0":e;e=l(Xo,0,-1,e)}}},bd=f(Da,f(Rs,7,P("0")),Ni),Cd=function(e){return f(Ri,"",e)},Ed=function(e){var t=e.a,r=$a(t);if(r.b){var n=r.a,a=r.b;return Cd(f(ka,Ni(n),f(xa,bd,a)))}return"0"},Sd=function(e){switch(e.$){case"Zer":return"0";case"Pos":var t=e.a;return Ed(t);default:var t=e.a;return"-"+Ed(t)}},Td=r(function(e,t){return e<1?t:l(Xo,0,-e,t)}),wd=function(e){var t=l(Rs,18,P("0"),Sd(e)),r=f(Td,18,t)+"."+f(ou,18,t);return function(e){return""===e?"0":e}(md(r))},Id=r(function(e,t){var r=wd(t),n=Ql(f(Xl,".",r));if("Nothing"===n.$)return r;var a=n.a;return e?f(ru,a+1+e,r):f(ru,a,r)}),Ad=r(function(e,t){if("Nothing"===e.$)return wd(jl(t));var r=e.a;return f(Id,r,jl(t))}),Bd=ee,kd=function(e){var t=Bd(f(Ad,ci,e));if("Just"===t.$){return t.a}f(cl,"Error converting tokenValue to float: string -> float failed",e);return 0},Nd=function(e){if(""===e)return fi("You must specify a trade amount.");var t=vd(e);if("Nothing"===t.$)return fi("I don't understand this number.");var r=t.a;return kd(r)<1?fi("Trade amount can't be less than 1."):li(r)},Rd=function(e){if(""===e)return fi("You must specify a fiat price.");var t=cd(e);if("Nothing"===t.$){var r=Bd(e);return fi("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 li(n)},$d=r(function(e,t){if("Just"===t.$){var r=t.a;return li(r)}return fi(e)}),_d=function(e){return""===e},Ld=function(e){return _d(e)?ci:si(e)},xd=function(e){return f($d,"You must specify a fiat type.",Ld(e))},Pd=function(e){return""===e?fi("Must specify a payment method."):li(e)},Dd=u(function(e,t,r,n,a,i,o){return{autoabortInterval:i,autorecallInterval:a,autoreleaseInterval:o,daiAmount:e,fiatAmount:t,fiatType:r,paymentMethod:n}}),Ud=g(Dd,ci,ci,ci,ci,ci,ci,ci),Od=function(e){var t=e.a,r=e.b,n=e.c,a=x(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 li(x(i,o,u))}var s=a.c.a;return fi(s)}var c=a.b.a;return fi(c)}var f=a.a.a;return fi(f)},Md=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(e(a),t(i),r(o))}),Fd={$:"Custom"},Vd=r(function(e,t){return{info:t,type_:e}}),Kd=o(function(e,t,r,n,a,i){if("Err"===t.$){var o=t.a;return fi(o)}var u=t.a;if("Err"===r.$){var o=r.a;return fi(o)}var s=r.a;if("Err"===n.$){var o=n.a;return fi(o)}var c=n.a;if("Err"===a.$){var o=a.a;return fi(o)}var f=a.a;if("Err"===i.$){var o=i.a;return fi(o)}var l=i.a;return li(h(e,u,s,c,f,l))}),Hd=r(function(e,t){if("Ok"===t.$){var r=t.a;return li(r)}var n=t.a;return fi(e(n))}),jd=function(e){return e.a},qd=function(e){return p(Kd,i(function(t,r,n,a,i){var o=i.a;return{autoabortInterval:i.b,autorecallInterval:o,autoreleaseInterval:i.c,initiatorRole:e.userRole,paymentMethods:M([f(Vd,Fd,a)]),price:{amount:r,fiatType:n},tradeAmount:t}}),f(Hd,function(e){return D(Ud,{daiAmount:si(e)})},Nd(e.daiAmount)),f(Hd,function(e){return D(Ud,{fiatAmount:si(e)})},Rd(e.fiatAmount)),f(Hd,function(e){return D(Ud,{fiatType:si(e)})},xd(e.fiatType)),f(Hd,function(e){return D(Ud,{paymentMethod:si(e)})},Pd(e.paymentMethod)),Od(d(Md,function(e){return jd(e)>0?li(e):fi(D(Ud,{autorecallInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoabortInterval:si("Must specify a non-zero time for this window")}))},function(e){return jd(e)>0?li(e):fi(D(Ud,{autoreleaseInterval:si("Must specify a non-zero time for this window")}))},x(e.autorecallInterval,e.autoabortInterval,e.autoreleaseInterval))))},Gd=function(e){if("Active"===e.$){var t=e.a;return si(t)}return ci},zd=n(function(e,t,r){if("Nothing"===t.$)return ci;var n=t.a;if("Nothing"===r.$)return ci;var a=r.a;return si(f(e,n,a))}),Yd=function(e){if("Ok"===e.$){var t=e.a;return si(t)}return ci},Wd=function(e){var t=qd(e.inputs),r=function(){return R(e.errors,Ud)?Ud:"Ok"===t.$?Ud:t.a}();return D(e,{createParameters:l(zd,Jl,Gd(e.wallet),Yd(t)),errors:r})},Jd=r(function(e,t){return Wd(D(t,{inputs:e}))}),Qd=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),Xd=function(e){return d(Qd,f(Jd,Kl,{allowance:ci,createParameters:ci,depositAmount:ci,errors:Ud,inputs:Kl,showFiatTypeDropdown:!1,txChainStatus:ci,wallet:e}),Do,Fo,yr)},Zd=a(function(e,t,r,n){return la(d(Ol,e,t,r,n))}),eh=function(e){return{$:"Address",a:e}},th=f(zo,cu,f(zo,sd,eh)),rh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x5677CFbA35a0Db0469d3d56020d556B942E9ce90")}e.a;return th("0xbC69Aff9d93C5EA4a841166C46C68518D02aF818")}switch(e.a.$){case"Eth":e.a;return th("0xD3b1e8F2bDe0a2DdfC9F6e2EB6e2589e5Ba955b6");case"Kovan":e.a;return th("0xA30773FD520cdf845E1a00441aB09cE39B31F676");default:e.a;return th("0x7E370099a7a789dC28810a72381bcd7Be834Ad74")}},nh=function(e){return th("EthDai"===e.$?"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359":"0xC4375B7De8af5a38a93548eb8453a498222C4fF2")},ah=function(e){return{$:"AddressE",a:e}},ih=ah,oh=function(e){return{$:"UintE",a:e}},uh=oh,sh=n(function(e,t,r){return{data:si(f(Gf,"approve(address,uint256)",M([ih(t),uh(r)]))),decoder:vu(uu),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),ch=function(e){return f(Gl,e,200)},fh=r(function(e,t){return Hl(f(Xu,jl(e),jl(t)))}),lh=function(e){var t=f(Gl,e.tradeAmount,200);return f(fh,e.pokeReward,f(fh,ch(e.tradeAmount),f(fh,t,function(){return"Buyer"===e.initiatorRole.$?Yl(e.tradeAmount):e.tradeAmount}())))},dh=Mi(ya),hh=n(function(e,t,r){return{id:e,initiator:r,tradeAddress:t}}),ph=a(function(e,t,r,n){return{index:t,match:e,number:r,submatches:n}}),gh=Xn,vh=Qn,yh=function(e){return f(vh,{caseInsensitive:!1,multiline:!1},e)},mh=Jn,bh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-Fa-f]{40}$"))),Ch=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}}),Eh=r(function(e,t){return!f(Ch,f(Da,ns,e),t)}),Sh=Eh(Ua),Th=q,wh=r(function(e,t){if("Ok"===t.$){return t.a}return e}),Ih=n(function(e,t,r){if("Err"===t.$){var n=t.a;return fi(n)}var a=t.a;if("Err"===r.$){var n=r.a;return fi(n)}var i=r.a;return li(f(e,a,i))}),Ah=f(La,Ih(ka),li(yr)),Bh=function(e){if(e.b){var t=(e.a,e.b);return si(t)}return ci},kh=n(function(e,t,r){e:for(;;){if(!t.b)return li(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(Nu,16,e);e=i,t=o,r=u;continue e;case"2":var i=e-1,o=a,u=r+2*f(Nu,16,e);e=i,t=o,r=u;continue e;case"3":var i=e-1,o=a,u=r+3*f(Nu,16,e);e=i,t=o,r=u;continue e;case"4":var i=e-1,o=a,u=r+4*f(Nu,16,e);e=i,t=o,r=u;continue e;case"5":var i=e-1,o=a,u=r+5*f(Nu,16,e);e=i,t=o,r=u;continue e;case"6":var i=e-1,o=a,u=r+6*f(Nu,16,e);e=i,t=o,r=u;continue e;case"7":var i=e-1,o=a,u=r+7*f(Nu,16,e);e=i,t=o,r=u;continue e;case"8":var i=e-1,o=a,u=r+8*f(Nu,16,e);e=i,t=o,r=u;continue e;case"9":var i=e-1,o=a,u=r+9*f(Nu,16,e);e=i,t=o,r=u;continue e;case"a":var i=e-1,o=a,u=r+10*f(Nu,16,e);e=i,t=o,r=u;continue e;case"b":var i=e-1,o=a,u=r+11*f(Nu,16,e);e=i,t=o,r=u;continue e;case"c":var i=e-1,o=a,u=r+12*f(Nu,16,e);e=i,t=o,r=u;continue e;case"d":var i=e-1,o=a,u=r+13*f(Nu,16,e);e=i,t=o,r=u;continue e;case"e":var i=e-1,o=a,u=r+14*f(Nu,16,e);e=i,t=o,r=u;continue e;case"f":var i=e-1,o=a,u=r+15*f(Nu,16,e);e=i,t=o,r=u;continue e;default:var s=n;return fi(As(s)+" is not a valid hexadecimal character.")}}}),Nh=function(e){if(_d(e))return fi("Empty strings are not valid hexadecimal strings.");var t=function(){if(f(su,"-",e)){var t=f(xc,yr,Bh(Zs(e)));return f(au,iu,l(kh,Ti(t)-1,t,0))}return l(kh,Qo(e)-1,Zs(e),0)}();return f(Hd,function(t){return f(Ri," ",M(['"'+e+'"',"is not a valid hexadecimal string because",t]))},t)},Rh=function(e){var t=Zs(e);return function(e){return L(t,e)}(f(wh,yr,Ah(f(xa,Nh,f(_i,"",f(Ri,"",f(xa,f(zo,Ps,uc),f(lc,20,Kf(f(xa,f(zo,Th,yi),t))))))))))},$h=function(e){var t=r(function(e,t){return!(t>=8&&mi(e)||t<8&&bi(e))}),n=Rh(cu(e)),a=n.a,i=n.b,o=l(wi,t,a,i);return!!bh(e)&&Sh(o)},_h=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-f]{40}$"))),Lh=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9A-F]{40}$"))),xh=function(e){return'"'+e+'"'},Ph=function(e){var t=cu(e),r=f(ru,24,t),n=f(ou,40,e);return 64===Qo(t)&&f(ki,Ja(P("0")),r)?Lh(n)||_h(n)?li(eh(n)):$h(n)?li(eh(n)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):40!==Qo(t)?fi("Given address "+xh(e)+" is not the correct length."):bh(t)?Lh(t)||_h(t)?li(eh(t)):$h(t)?li(eh(t)):fi("Given address "+xh(e)+" failed the EIP-55 checksum test."):fi("Given address "+xh(e)+" contains invalid hex characters.")},Dh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),Ph(nu(r)))}),Uh=r(function(e,t){var r=t.a;return Wo(function(t){var n=t.a,a=t.b;return r(f(Jo,n,f(Zo,64*e,a)))})}),Oh=Jr,Mh=r(function(e,t){return f(Oh,"data",vu(f(Uh,e,t)))}),Fh=Qr,Vh=r(function(e,t){return f(Oh,"topics",f(Fh,e,vu(t)))}),Kh=function(e){return f(Bo,f(zo,$a,f(Ra,r(function(e,t){return f(Xu,qu(e),f(fs,t,ws))}),hs)),od(f(xa,f(zo,$a,f(zo,$s,f(zo,Nh,Yd))),f(id,8,$a(e)))))},Hh=function(e){var t=Zs(sd(e));e:for(;;){if(!t.b)return ci;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(Bo,fs(qu(-1)),Kh(a))}var i=t.b;i.b;return ci}var a=t.b;return f(Bo,fs(qu(-1)),Kh(a))}return ci;case"+":if(t.b.b){var a=t.b;return Kh(a)}return ci;case"0":if(t.b.b&&"x"===t.b.a.valueOf()){if(t.b.b.b){var o=t.b,a=o.b;return Kh(a)}t.b;return ci}break e;default:break e}}var a=t;return Kh(a)},jh=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f($d,"Error Decoding Uint into BigInt",Hh(jf(nu(r)))))}),qh=f(dh,f(Vh,1,Dh),f(dh,f(Mh,1,Dh),f(dh,f(Mh,0,jh),Fi(hh)))),Gh=nn,zh=r(function(e,t){return ye(l(Ra,Ee(e),be(),t))}),Yh=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(Gh,e,Cl(M([L("data",hl(t.data)),L("topics",f(zh,vl,t.topics))]))),topics:t.topics,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex}}),Wh=r(function(e,t){if("Ok"===t.$){return e(t.a)}var r=t.a;return fi(r)}),Jh=r(function(e,t){return f(au,function(e){return e.id},f(Wh,function(e){return f(Hd,Di,f(Yh,qh,e).returnData)},f($d,"No log found from that factoryAddress in that txReceipt",Ql(f(ml,function(t){return R(f(zo,dl,sd)(t.address),f(zo,dl,sd)(rh(e)))},t.logs)))))}),Qh=n(function(e,t,r){return{data:si(f(Gf,"allowance(address,address)",M([ih(t),ih(r)]))),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),Xh=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9"}switch(e.a.$){case"Eth":e.a;return"https://mainnet.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";case"Kovan":e.a;return"https://kovan.infura.io/v3/e3eef0e2435349bf9164e6f465bd7cf9";default:e.a;return"https://dai.poa.network"}},Zh=function(e){switch(e.$){case"BlockNum":var t=e.a;return hl(jf(Ps(t)));case"EarliestBlock":return hl("earliest");case"LatestBlock":return hl("latest");default:return hl("pending")}},ep=function(e){var t=e.to,r=e.from,n=e.gas,a=e.gasPrice,i=e.value,o=e.data;return El(M([L("to",f(Bo,pl,t)),L("from",f(Bo,pl,r)),L("gas",f(Bo,yl,n)),L("gasPrice",f(Bo,gl,a)),L("value",f(Bo,gl,i)),L("data",f(Bo,vl,o))]))},tp=function(e){return{$:"BadBody",a:e}},rp=function(e){return{$:"BadStatus",a:e}},np=function(e){return{$:"BadUrl",a:e}},ap={$:"NetworkError"},ip={$:"Timeout"},op=rn,up=r(function(e,t){switch(t.$){case"BadUrl_":var r=t.a;return fi(np(r));case"Timeout_":return fi(ip);case"NetworkError_":return fi(ap);case"BadStatus_":var n=t.a,a=t.b;return fi(rp(n.statusCode));default:var n=t.a,a=t.b,i=f(op,f(Oh,"result",e),a);if("Ok"===i.$){var o=i.a;return li(o)}var u=i.a;return fi(tp(Di(u)))}}),sp=n(function(e,t,r){return Cl(M([L("id",wl(e)),L("jsonrpc",hl("2.0")),L("method",hl(t)),L("params",f(zh,Ua,r))]))}),cp=Rl,fp=r(function(e,t){e:for(;;){if("RBEmpty_elm_builtin"===t.$)return ci;var r=t.b,n=t.c,a=t.d,i=t.e,o=f(Ku,e,r);switch(o.$){case"LT":var u=e,s=a;e=u,t=s;continue e;case"EQ":return si(n);default:var u=e,s=i;e=u,t=s;continue e}}}),lp=function(e){for(;;){if("RBNode_elm_builtin"!==e.$||"RBNode_elm_builtin"!==e.d.$)return e;e=e.d}},dp=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(Nl,$l,p,g,h(Nl,kl,r,n,h(Nl,$l,i,o,u,s),v),h(Nl,kl,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(Nl,kl,r,n,h(Nl,$l,i,o,u,s),h(Nl,$l,f,l,d,m))}return e},hp=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(Nl,$l,i,o,h(Nl,kl,s,c,f,l),h(Nl,kl,r,n,d,h(Nl,$l,g,v,y,m)))}var t=e.a,r=e.b,n=e.c,b=e.d,i=(b.a,b.b),o=b.c,C=b.d,d=b.e,E=e.e,g=(E.a,E.b),v=E.c,y=E.d,m=E.e;return t.$,h(Nl,kl,r,n,h(Nl,$l,i,o,C,d),h(Nl,$l,g,v,y,m))}return e},pp=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(Nl,r,u,s,c,h(Nl,$l,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 hp(t)}break e}o.a,o.d;return hp(t)}break e}return t}),gp=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(Nl,t,r,n,gp(a),u)}var s=dp(e);if("RBNode_elm_builtin"===s.$){var c=s.a,f=s.b,l=s.c,d=s.d,p=s.e;return h(_l,c,f,l,gp(d),p)}return Rl}return h(Nl,t,r,n,gp(a),u)}return Rl},vp=r(function(e,t){if("RBEmpty_elm_builtin"===t.$)return Rl;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(Nl,r,n,a,f(vp,e,i),o)}var s=dp(t);if("RBNode_elm_builtin"===s.$){var c=s.a,l=s.b,d=s.c,p=s.d,v=s.e;return h(_l,c,l,d,f(vp,e,p),v)}return Rl}return h(Nl,r,n,a,f(vp,e,i),o)}return f(yp,e,g(pp,e,t,r,n,a,i,o))}),yp=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(R(e,n)){var u=lp(o);if("RBNode_elm_builtin"===u.$){var s=u.b,c=u.c;return h(_l,r,s,c,i,gp(o))}return Rl}return h(_l,r,n,a,i,f(vp,e,o))}return Rl}),mp=r(function(e,t){var r=f(vp,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(Nl,kl,n,a,i,o)}return r}),bp=n(function(e,t,r){var n=t(f(fp,e,r));if("Just"===n.$){var a=n.a;return l(xl,e,a,r)}return f(mp,e,r)}),Cp=function(e){return"Just"===e.$},Ep=gn,Sp=vn,Tp=r(function(e,t){return{$:"BadStatus_",a:e,b:t}}),wp=function(e){return{$:"BadUrl_",a:e}},Ip=r(function(e,t){return{$:"GoodStatus_",a:e,b:t}}),Ap={$:"NetworkError_"},Bp=function(e){return{$:"Receiving",a:e}},kp=function(e){return{$:"Sending",a:e}},Np={$:"Timeout_"},Rp=function(e){return f(ta,"application/json",f(xi,0,e))},$p=n(function(e,t,r){return Rp(l(sp,e,t,r))}),_p=f(ea,"",Ua),Lp=Te,xp=Se,Pp=function(e){if("Ok"===e.$){var t=e.a;return xp(t)}var r=e.a;return Lp(r)},Dp=function(e){return l(Zn,gr,Pp,{allowCookiesFromOtherDomains:!1,body:e.body,expect:e.resolver,headers:e.headers,method:e.method,timeout:e.timeout,tracker:ci,url:e.url})},Up=function(e){var t=e.url,r=e.method,n=e.params,a=e.decoder;return Dp({body:l($p,1,r,n),headers:yr,method:"POST",resolver:_p(up(a)),timeout:ci,url:t})},Op=n(function(e,t,r){return Up({decoder:t.decoder,method:"eth_call",params:M([ep(t),Zh(r)]),url:e})}),Mp={$:"LatestBlock"},Fp=r(function(e,t){return l(Op,e,t,Mp)}),Vp=function(e){return{$:"Perform",a:e}},Kp=sn,Hp=xp(gr),jp=r(function(e,t){return f(Kp,function(t){return xp(e(t))},t)}),qp=n(function(e,t,r){return f(Kp,function(t){return f(Kp,function(r){return xp(f(e,t,r))},r)},t)}),Gp=function(e){return l(La,qp(ka),xp(yr),e)},zp=r(function(e,t){var r=t.a;return Be(f(Kp,Ep(e),r))}),Yp=n(function(e,t,r){return f(jp,function(e){return gr},Gp(f(xa,zp(e),t)))}),Wp=n(function(e,t,r){return xp(gr)}),Jp=r(function(e,t){var r=t.a;return Vp(f(jp,e,r))});pn.Task=Pe(Hp,Yp,Wp,Jp);var Qp=Ue("Task"),Xp=cn,Zp=r(function(e,t){return Qp(Vp(f(Xp,f(Da,f(Da,xp,e),fi),f(Kp,f(Da,f(Da,xp,e),li),t))))}),eg=a(function(e,t,r,n){return f(Zp,n,f(Fp,Xh(eo(e)),l(Qh,nh(e),t,r)))}),tg=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35")}e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21")}switch(e.a.$){case"Eth":e.a;return th("0x61F399ED1D5AEC3Bc9d4B026352d5764181d6b35");case"Kovan":e.a;return th("0xF59ed429f9753B0498436DE1a3559AEC7a0c2a21");default:e.a;return th("0x092110996699c3E06e998d89F0f4586026e44F0F")}},rg=function(e){return{$:"BoolE",a:e}},ng=rg,ag=function(e){return{$:"StringE",a:e}},ig=ag,og=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},ug=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:si(f(Gf,"createOpenTrade(address[2],bool,uint256[8],string,string)",M([ih(t),ih(r),ng(n),uh(a),uh(i),uh(o),uh(u),uh(s),uh(c),uh(l),uh(d),ig(h),ig(p)]))),decoder:vu(Dh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}}}}}}}}}}}}}},sg=r(function(e,t){return{paymentMethods:t,price:e}}),cg=function(e){return hl(Sd(e))},fg=function(e){return f(zh,Ua,M([hl(e.fiatType),cg(e.amount)]))},lg=function(e){switch(e.$){case"Cash":return"cash";case"Bank":return"bank";default:return"custom"}},dg=function(e){return Cl(M([L("type",hl(lg(e.type_))),L("info",hl(e.info))]))},hg=function(e){var t=fg(e.price),r=f(zh,dg,e.paymentMethods);return f(xi,0,Cl(M([L("paymentmethods",r),L("price",t)])))},pg=r(function(e,t){return D(t,{value:si(e)})}),gg=function(e){return qu(jd(e))},vg=function(e){return f(ql,gg(e),qu(1e3))},yg=r(function(e,t){var r=function(){return"Token"===e.$?og:ug}();return function(){return"Native"===e.$?pg(jl(lh(t))):Ua}()(r(rh(e))(t.initiatorAddress)(tg(e))(R(t.initiatorRole,lo))(jl(t.tradeAmount))(jl(Yl(t.tradeAmount)))(jl(zl(t.tradeAmount)))(jl(t.pokeReward))(vg(t.autorecallInterval))(vg(t.autoabortInterval))(vg(t.autoreleaseInterval))(jl(ch(t.tradeAmount)))(hg(f(sg,t.price,t.paymentMethods)))(t.initiatorCommPubkey))}),mg=r(function(e,t){return{$:"CreateMined",a:e,b:t}}),bg=function(e){return{$:"CreateNeedsSig",a:e}},Cg=r(function(e,t){return{$:"CreateSigned",a:e,b:t}}),Eg=r(function(e,t){var r=al(f(yg,e,t)),n={onBroadcast:ci,onMined:si(L(mg(e),ci)),onSign:si(Cg(e))};return L(si(bg(e)),f(qo,n,r))}),Sg=r(function(e,t){return{$:"AllowanceFetched",a:e,b:t}}),Tg=n(function(e,t,r){return{$:"ApproveMining",a:e,b:t,c:r}}),wg=function(e){return{$:"ApproveNeedsSig",a:e}},Ig=n(function(e,t,r){return{$:"ApproveSigned",a:e,b:t,c:r}}),Ag=r(function(e,t){return{$:"Confirm",a:e,b:t}}),Bg=r(function(e,t){return{$:"CreateMining",a:e,b:t}}),kg={$:"NoOp"},Ng=function(e){return{appCmds:yr,chainCmd:Fo,cmd:Do,model:e}},Rg=function(e){return rd(Sd(e))},$g={$:"Error"},_g=r(function(e,t){f(cl,e+" fetch error",t);return{align:ul,label:"web3FetchError",mainParagraphs:M([M([fl('Failed to fetch "'+e+'". See console output for more info.')])]),noticeType:$g}}),Lg=r(function(e,t){return{align:ul,label:"web3MiningError",mainParagraphs:M([M([fl('Error mining "'+e+'" transaction: '+t)])]),noticeType:$g}}),xg={$:"Caution"},Pg=r(function(e,t){return{align:ul,label:"web3SigError",mainParagraphs:M([M([fl('Error signing "'+e+'" transaction: '+t)])]),noticeType:xg}}),Dg={$:"KovanDai"},Ug=function(e){e:for(;;)switch(e.$){case"Mainnet":return si(eo(Xi));case"Kovan":return si(eo(Dg));case"Private":if(100===e.a)return si(Zi(to));break e;default:break e}return ci},Og=function(e){switch(e.$){case"NoneDetected":return ci;case"OnlyNetwork":var t=e.a;return si(t);default:var r=e.a;return si(r.network)}},Mg=function(e){return f(Io,Ug,Og(e))},Fg=r(function(e,t){return 1-e(1-t)}),Vg=function(e){return f(Nu,e,5)},Kg=Fg(Vg),Hg={easing:Kg,offset:12,speed:200},jg=function(e){return{$:"External",a:e}},qg=function(e){return{$:"Internal",a:e}},Gg=function(e){return{$:"NotFound",a:e}},zg=function(e){for(;;){e=e.a}},Yg=r(function(e,t){return Qp(Vp(f(jp,e,t)))}),Wg={$:"Http"},Jg={$:"Https"},Qg=Kr,Xg=o(function(e,t,r,n,a,i){return{fragment:i,host:t,path:n,port_:r,protocol:e,query:a}}),Zg=i(function(e,t,r,n,a){if(_d(a)||f(Qg,"@",a))return ci;var i=f(Xl,":",a);if(i.b){if(i.b.b)return ci;var o=i.a,u=rd(f(Zo,o+1,a));if("Nothing"===u.$)return ci;var s=u;return si(p(Xg,e,f(ru,o,a),s,t,r,n))}return si(p(Xg,e,a,ci,t,r,n))}),ev=a(function(e,t,r,n){if(_d(n))return ci;var a=f(Xl,"/",n);if(a.b){var i=a.a;return h(Zg,e,f(Zo,i,n),t,r,f(ru,i,n))}return h(Zg,e,"/",t,r,n)}),tv=n(function(e,t,r){if(_d(r))return ci;var n=f(Xl,"?",r);if(n.b){var a=n.a;return d(ev,e,si(f(Zo,a+1,r)),t,f(ru,a,r))}return d(ev,e,ci,t,r)}),rv=r(function(e,t){if(_d(t))return ci;var r=f(Xl,"#",t);if(r.b){var n=r.a;return l(tv,e,si(f(Zo,n+1,t)),f(ru,n,t))}return l(tv,e,ci,t)}),nv=function(e){return f(su,"http://",e)?f(rv,Wg,f(Zo,7,e)):f(su,"https://",e)?f(rv,Jg,f(Zo,8,e)):ci},av=Wt,iv=Gt(zt),ov=sa,uv=r(function(e,t){return L(e,t)}),sv=_r,cv=a(function(e,t,r,n){var a=_(r,n)>0?ri:Na,i=ju(r-n),o=f(ei,1,sv(i)/e|0),u=o,s=f(xa,function(e){return t(e/u)},f(Ai,0,o));return e<=0||R(r,n)?yr:f(xa,function(e){return f(a,r,e*i)},s)}),fv=r(function(e,t){var n=r(function(t,r){return Gp(f(xa,ov(0),d(cv,e.speed,e.easing,t,r-e.offset)))});return f(Kp,function(e){var t=e.a.viewport,r=e.b.element;return f(n,t.y,r.y)},l(qp,uv,iv,av(t)))}),lv=r(function(e,t){switch(e.$){case"Refresh":var r=(e.a,L(Gd(t.wallet),Mg(t.wallet)));if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$){var n=r.a.a,a=r.b.a.a,i=d(eg,a,n.address,rh(eo(a)),Sg(a));return d(Qd,t,i,Fo,yr)}return Ng(t);case"ChangeRole":var o=e.a,u=t.inputs;return d(Qd,D(t,{inputs:D(u,{userRole:o})}),Do,Fo,M([function(){return"Buyer"===o.$?d(Zd,"create offer type changed","input","sell dai",0):d(Zd,"create offer type changed","input","buy dai",0)}()]));case"TradeAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{daiAmount:s}),t));case"FiatAmountChanged":var s=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatAmount:s}),t));case"FiatTypeChanged":var c=e.a,u=t.inputs;return Ng(f(Jd,D(u,{fiatType:c}),t));case"FiatTypeLostFocus":return Ng(D(t,{showFiatTypeDropdown:!1}));case"ChangePaymentMethodText":var h=e.a,u=t.inputs;return Ng(f(Jd,D(u,{paymentMethod:h}),t));case"AutorecallIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autorecallInterval:p}),t));case"AutoabortIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoabortInterval:p}),t));case"AutoreleaseIntervalChanged":var p=e.a,u=t.inputs;return Ng(f(Jd,D(u,{autoreleaseInterval:p}),t));case"ShowCurrencyDropdown":var g=e.a,u=t.inputs;return d(Qd,(g?Jd(D(u,{fiatType:""})):Ua)(D(t,{showFiatTypeDropdown:g})),Do,Fo,g?M([d(Zd,"currency-selector-clicked","input","",0)]):yr);case"CreateClicked":var v=e.a,n=e.b,y=qd(t.inputs);if("Ok"===y.$){var m=y.a,b=f(Jl,n,m);return Ng(D(t,{depositAmount:si(jl(lh(b))),txChainStatus:si(f(Ag,v,b))}))}var C=y.a;return d(Qd,D(t,{errors:C}),f(Zp,ms(kg),function(){return f(fv,D(Hg,{offset:60}),"inputError")}()),Fo,yr);case"AbortCreate":return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([d(Zd,"abort","abort","create",0)]));case"ConfirmCreate":var v=e.a,b=e.b,E=e.c,S=function(){if("Native"===v.$)return f(Eg,v,b);var e=v.a,r=function(){var t=al(l(sh,nh(e),rh(v),E)),r={onBroadcast:ci,onMined:ci,onSign:si(f(Ig,e,b))};return f(qo,r,t)}(),n=t.allowance;if("Just"===n.$){var a=n.a;return R(f(ts,a,E),ba)?L(si(wg(e)),r):f(Eg,v,b)}return L(si(wg(e)),r)}(),T=S.a,w=S.b;return d(Qd,D(t,{txChainStatus:T}),Do,w,yr);case"ApproveSigned":var a=e.a,b=e.b,I=e.c;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(l(Tg,a,b,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"appove",B))]));case"AllowanceFetched":var a=e.a,k=e.b;if("Ok"===k.$){var N=k.a,$=D(t,{allowance:si(N)}),_=L($.txChainStatus,$.depositAmount);if("Just"===_.a.$&&"ApproveMining"===_.a.a.$&&"Just"===_.b.$){var x=_.a.a,b=x.b,P=_.b.a;if(R(f(ts,N,P),ba))return Ng($);var U=f(Eg,eo(a),b),T=U.a,w=U.b;return d(Qd,D($,{txChainStatus:T}),Do,w,yr)}return Ng($)}var O=k.a;return d(Qd,t,Do,Fo,M([pa(f(_g,"allowance",O))]));case"CreateSigned":var v=e.a,I=e.b;if("Ok"===I.$){var A=I.a;return Ng(D(t,{txChainStatus:si(f(Bg,v,A))}))}var B=I.a;return d(Qd,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"create",B))]));case"CreateMined":if("Err"===e.b.$){var v=e.a,B=e.b.a;return d(Qd,t,Do,Fo,M([pa(f(Lg,"create",B))]))}var F=e.a,V=e.b.a,K=f(Io,Rg,Yd(f(Jh,F,V)));if("Just"===K.$){var H=K.a;return d(Qd,t,Do,Fo,M([da(f(Qf,F,H))]))}return d(Qd,t,Do,Fo,M([pa(f(ll,'Error getting the ID of the created offer. Check the "My Trades" page for your open offer.',V))]));case"Web3Connect":return d(Qd,t,Do,Fo,M([ga]));case"NoOp":return Ng(t);default:var j=e.a;return d(Qd,t,Do,Fo,M([j]))}}),dv=r(function(e,t){return f(Eh,function(e){return f(Ch,function(e){return e.checked&&e.testTrade(t)},e.options)},e)}),hv=r(function(e,t){return f(Ku,jd(e),jd(t))}),pv=r(function(e,t){return R(f(hv,t.derived.phaseEndTime,e),Ta)}),gv=function(e){if(""===e)return li(ci);var t=vd(e);if("Nothing"===t.$)return fi("I can't interpret this number");var r=t.a;return li(si(r))},vv=r(function(e,t){return{maxDai:t,minDai:e}}),yv=f(vv,ci,ci),mv=function(e){return l(Ih,r(function(t,r){return{dai:{max:r,min:t},fiatType:Ld(e.fiatType),paymentMethodTerms:e.paymentMethodTerms}}),f(Hd,function(e){return D(yv,{minDai:si(e)})},gv(e.minDai)),f(Hd,function(e){return D(yv,{maxDai:si(e)})},gv(e.maxDai)))},bv=r(function(e,t){var r=function(t){return f(Eh,function(e){return f(Qg,sd(e),sd(t))},e)};return f(Ch,function(e){return r(e.info)},t)}),Cv=r(function(e,t){return D(t,{paymentMethod:e})}),Ev=r(function(e,t){return D(t,{paymentMethodTerms:e})}),Sv=r(function(e,t){return f(ts,jl(e),jl(t))}),Tv=function(e){if(""===e.inputs.paymentMethod)return e;var t=e.inputs.paymentMethod,r=f(oo,e.inputs.paymentMethodTerms,M([t]));return wv(D(e,{inputs:f(Ev,r,f(Cv,"",e.inputs))}))},wv=function(e){var t=Tv(e),n=mv(t.inputs);if("Err"===n.$){return D(e,{errors:n.a})}var a=n.a,i=r(function(e,t){var r=a.paymentMethodTerms;if(r.b){return f(bv,r,t.terms.paymentMethods)}return!0}),o=function(e){var t=a.fiatType;if("Nothing"===t.$)return!0;var r=t.a;return R(e.terms.price.fiatType,r)},u=function(e){return function(){var t=a.dai.min;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),ba)}()&&function(){var t=a.dai.max;if("Nothing"===t.$)return!0;var r=t.a;return!R(f(Sv,e.parameters.tradeAmount,r),Ta)}()},s=r(function(e,r){return f(pv,e,r)&&f(i,e,r)&&u(r)&&o(r)&&f(dv,t.filters,r)});return D(t,{filterFunc:s})},Iv={fiatType:"",maxDai:"",minDai:"",paymentMethod:"",paymentMethodTerms:yr},Av={$:"Expires"},Bv=function(e){return L(wv({errors:yv,filterFunc:pv,filters:co(M([f(vo,!0,!0),d(So,!0,!1,!1,!1)])),inputs:Iv,showCurrencyDropdown:!1,tradeTable:_o(L(Av,Lo)),wallet:e}),Do)},kv=r(function(e,t){var r=f(ml,wc(e),t.inputs.paymentMethodTerms);return wv(D(t,{inputs:f(Ev,r,t.inputs)}))}),Nv=function(e){return wv(D(e,{filterFunc:pv,inputs:Iv}))},Rv=function(e){return{$:"TradeTableMsg",a:e}},$v=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),_v=function(e){return d($v,e,Do,Fo,yr)},Lv=r(function(e,t){return D(t,{fiatType:e})}),xv=r(function(e,t){return D(t,{maxDai:e})}),Pv=r(function(e,t){return D(t,{minDai:e})}),Dv=r(function(e,t){switch(e.$){case"MinDaiChanged":var r=e.a;return _v(D(t,{inputs:f(Pv,r,t.inputs)}));case"MaxDaiChanged":var r=e.a;return _v(D(t,{inputs:f(xv,r,t.inputs)}));case"FiatTypeInputChanged":var r=e.a;return _v(D(t,{inputs:f(Lv,r,t.inputs)}));case"ShowCurrencyDropdown":var n=e.a;t.inputs;return _v(D(t,{inputs:(n?Lv(""):Ua)(t.inputs),showCurrencyDropdown:n}));case"FiatTypeLostFocus":return _v(D(t,{showCurrencyDropdown:!1}));case"PaymentMethodInputChanged":var r=e.a;return _v(D(t,{inputs:f(Cv,r,t.inputs)}));case"AddSearchTerm":return _v(Tv(t));case"RemoveTerm":var a=e.a;return _v(f(kv,a,t));case"ApplyInputs":return d($v,wv(t),Do,Fo,yr);case"ResetSearch":return _v(Nv(t));case"FiltersMsg":var i=e.a;return _v(wv(D(t,{filters:f(Jf,i,t.filters)})));case"TradeTableMsg":var o=e.a,u=f(nl,o,t.tradeTable);return d($v,D(t,{tradeTable:u.model}),f(il,Rv,u.cmd),f(Yo,Rv,u.chainCmd),f(xa,Ji(Rv),u.appCmds));case"NoOp":return _v(t);default:var s=e.a;return d($v,t,Do,Fo,M([s]))}}),Uv=a(function(e,t,r,n){return e(Cl(M([L("title",hl(t)),L("body",function(){if("Nothing"===r.$)return bl;var e=r.a;return hl(e)}()),L("image",function(){if("Nothing"===n.$)return bl;var e=n.a;return hl(e)}())])))}),Ov=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"dai"}e.a;return"kdai"}switch(e.a.$){case"Eth":e.a;return"eth";case"Kovan":e.a;return"keth";default:e.a;return"xdai"}},Mv=function(e){return e.a+"="+e.b},Fv=function(e){return e.b?"?"+f(Ri,"&",f(xa,Mv,e)):""},Vv=r(function(e,t){return"/"+(f(Ri,"/",e)+Fv(t))}),Kv=function(e){switch(e.$){case"Home":return f(Vv,M(["DAIHard"]),yr);case"Create":return f(Vv,M(["DAIHard","create"]),yr);case"Trade":var t=e.a,r=e.b;return f(Vv,M(["DAIHard","trade",Ov(t),Ni(r)]),yr);case"Marketplace":return f(Vv,M(["DAIHard","marketplace"]),yr);case"AgentHistory":var n=e.a;return f(Vv,M(["DAIHard","history",dl(n)]),yr);default:return f(Vv,yr,yr)}},Hv={$:"NotFound"},jv=function(e){return{$:"AgentHistory",a:e}},qv={$:"Create"},Gv={$:"Home"},zv={$:"Marketplace"},Yv=function(e){return{$:"Parser",a:e}},Wv=i(function(e,t,r,n,a){return{frag:n,params:r,unvisited:t,value:a,visited:e}}),Jv=r(function(e,t){return Yv(function(e){var r=e.visited,n=e.unvisited,a=e.params,i=e.frag,o=e.value;if(n.b){var u=n.a,s=n.b,c=t(u);if("Just"===c.$){var l=c.a;return M([h(Wv,f(ka,u,r),s,a,i,o(l))])}return yr}return yr})}),Qv=f(Jv,"ADDRESS",f(zo,Ph,Yd)),Xv={$:"Eth"},Zv={$:"Kovan"},ey=f(Jv,"FACTORY",function(e){switch(e){case"eth":return si(Zi(Xv));case"keth":return si(Zi(Zv));case"dai":return si(eo(Xi));case"kdai":return si(eo(Dg));case"xdai":return si(Zi(to));default:return ci}}),ty=f(Jv,"NUMBER",rd),ry=r(function(e,t){var r=t.visited,n=t.unvisited,a=t.params,i=t.frag,o=t.value;return h(Wv,r,n,a,i,e(o))}),ny=r(function(e,t){var r=t.a;return Yv(function(t){var n=t.visited,a=t.unvisited,i=t.params,o=t.frag,u=t.value;return f(xa,ry(u),r(h(Wv,n,a,i,o,e)))})}),ay=function(e){return l(La,oo,yr,e)},iy=r(function(e,t){return ay(f(xa,e,t))}),oy=function(e){return Yv(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 R(u,e)?M([h(Wv,f(ka,u,r),s,a,i,o)]):yr}return yr})},uy=r(function(e,t){var r=e.a,n=t.a;return Yv(function(e){return f(iy,n,r(e))})}),sy=Yv(function(e){return M([e])}),cy=f(uy,oy("DAIHard"),function(e){return Yv(function(t){return f(iy,function(e){return(0,e.a)(t)},e)})}(M([f(ny,Gv,sy),f(ny,qv,oy("create")),f(ny,Qf,f(uy,oy("trade"),f(uy,ey,ty))),f(ny,zv,oy("marketplace")),f(ny,jv,f(uy,oy("history"),Qv)),f(ny,function(e){return jv(e)},f(uy,oy("history"),Qv))]))),fy=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 si(t.value)}return si(t.value)}return ci}},ly=function(e){if(e.b){if(""!==e.a||e.b.b){var t=e.a,r=e.b;return f(ka,t,ly(r))}return yr}return yr},dy=function(e){var t=f(_i,"/",e);if(t.b&&""===t.a){var r=t.b;return ly(r)}var r=t;return ly(r)},hy=Qt,py=r(function(e,t){if("Nothing"===t.$)return si(M([e]));var r=t.a;return si(f(ka,e,r))}),gy=r(function(e,t){var r=f(_i,"=",e);if(r.b&&r.b.b&&!r.b.b.b){var n=r.a,a=r.b,i=a.a,o=hy(n);if("Nothing"===o.$)return t;var u=o.a,s=hy(i);if("Nothing"===s.$)return t;var c=s.a;return l(bp,u,py(c),t)}return t}),vy=function(e){if("Nothing"===e.$)return cp;var t=e.a;return l(La,gy,cp,f(_i,"&",t))},yy=r(function(e,t){var r=e.a;return fy(r(h(Wv,yr,dy(t.path),vy(t.query),t.fragment,Ua)))}),my=function(e){return f(xc,Hv,f(yy,cy,e))},by=aa,Cy=r(function(e,t){return f(by,e,Kv(t))}),Ey=je("connectToWeb3",function(e){return bl}),Sy=function(e){return Cl(M([L("event",hl(e.event)),L("category",hl(e.category)),L("label",hl(e.label)),L("value",wl(e.value))]))},Ty=r(function(e,t){return Cl(M([L("address",hl(dl(e))),L("signSeedMsg",hl(t))]))}),wy=je("gTagOut",Ua),Iy=je("genPrivkey",Ua),Ay=r(function(e,t){for(;;){if(!t.b)return ci;var r=t.a,n=t.b;if(e(r))return si(r);var a=e,i=n;e=a,t=i}}),By=n(function(e,t,r){return f(Io,Zc(t),f(Bo,function(e){return e.trades},f(Ay,function(t){return R(t.factory,e)},r)))}),ky=je("notifyPort",Ua),Ny=je("requestNotifyPermissionPort",function(e){return bl}),Ry=r(function(e,t){return D(t,{wallet:e})}),$y=r(function(e,t){return L(f(Jd,t.inputs,D(t,{wallet:e})),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$&&"Just"===t.b.$&&"Token"===t.b.a.$){var r=t.a.a,n=t.b.a.a;return d(eg,n,r.address,rh(eo(n)),Sg(n))}return Do}())}),_y=r(function(e,t){return D(t,{wallet:e})}),Ly=function(e){return{$:"AllowanceFetched",a:e}},xy=r(function(e,t){return L(D(t,{wallet:e}),function(){var r=x(Gd(e),Mg(e),t.trade);if("Just"===r.a.$&&"Just"===r.b.$&&"Token"===r.b.a.$&&"LoadedTrade"===r.c.$){var n=r.a.a,a=r.b.a.a,i=r.c.a;return R(Mg(e),si(i.factory))?d(eg,a,n.address,i.creationInfo.address,Ly):Do}return Do}())}),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{$:"TradeModel",a:e}},Fy=function(e){return{$:"TradeMsg",a:e}},Vy=r(function(e,t){switch(t.$){case"BetaLandingPage":return L(t,Do);case"CreateModel":var r=t.a,n=f($y,e,r),a=n.a,i=n.b;return L(Dy(a),f(il,Uy,i));case"TradeModel":var o=t.a,u=f(xy,e,o),s=u.a,c=u.b;return L(My(s),f(il,Fy,c));case"MarketplaceModel":var l=t.a;return L(Oy(f(_y,e,l)),Do);default:var d=t.a;return L(Py(f(Ry,e,d)),Do)}}),Ky=u(function(e,t,r,n,a,i,o){return{creationInfo:r,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),Hy=function(e){return{$:"PartiallyLoadedTrade",a:e}},jy=r(function(e,t){return Hy(g(Ky,e,t,ci,ci,ci,ci,ci))}),qy=function(e){return{$:"CurrentBlockFetched",a:e}},Gy=gu(f(zo,cu,Nh)),zy=function(e){return Up({decoder:Gy,method:"eth_blockNumber",params:yr,url:e})},Yy=function(e){return f(Zp,qy,zy(e))},Wy=r(function(e,t){return{address_:e,blocknum:t}}),Jy=function(e){return Wo(function(t){return li(L(t,e))})},Qy=n(function(e,t,r){var n=t.a,a=r.a;return Wo(function(t){return f(Wh,function(t){var r=t.a,n=t.b;return f(au,rl(e(n)),a(r))},n(t))})}),Xy=r(function(e,t){return l(Qy,r(function(e,t){return e(t)}),t,e)}),Zy=vu(f(Xy,jh,f(Xy,Dh,Jy(Wy)))),em=r(function(e,t){return{data:si(f(Gf,"createdTrades(uint256)",M([uh(t)]))),decoder:Zy,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),tm=n(function(e,t,r){return f(Zp,r,f(Fp,Xh(e),f(em,rh(e),t)))}),rm=function(e){return{$:"CreationInfoFetched",a:e}},nm=r(function(e,t){return l(tm,e,qu(t),rm)}),am=function(e){return{$:"EventSentryMsg",a:e}},im=function(e){return{$:"BlockNumber",a:e}},om=function(e){return{$:"EventSentry",a:e}},um=function(e){return{$:"Set_elm_builtin",a:e}},sm=um(cp),cm=r(function(e,t){return L(om({blockNumber:ci,errors:yr,nodePath:t,pending:sm,ref:1,requests:cp,tagger:e,watching:sm}),f(Zp,f(zo,im,e),zy(t)))}),fm=function(e){return f(cm,am,Xh(e))},lm=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),dm=function(e){return{$:"PartiallyLoadedCommInfo",a:e}},hm=dm(f(lm,ci,ci)),pm=n(function(e,t,r){return{allowance:ci,blocknumOnInit:ci,chatHistoryModel:ci,eventSentry:t,eventsWaitingForChatHistory:yr,expandedPhase:Co,secureCommInfo:hm,showChatHistory:!1,showStatsModal:!1,trade:e,txChainStatus:ci,wallet:r}}),gm=a(function(e,t,r,n){return{appCmds:n,chainCmd:r,cmd:t,model:e}}),vm=n(function(e,t,r){var n=f(nm,t,r),a=fm(t),i=a.a,o=a.b;return d(gm,l(pm,f(jy,t,r),i,e),Po(M([n,o,Yy(Xh(t))])),Fo,M([ha]))}),ym=function(e){return{$:"LoadedTrade",a:e}},mm=function(e){return{$:"EventLogFetched",a:e}},bm=r(function(e,t){return{$:"GetLogs",a:e,b:t}}),Cm=ue,Em=ce,Sm=Yr,Tm=n(function(e,t,r){var n=function(e){return Em(M([e,Cm(r)]))};return f(du,function(a){var i=f(Gh,e,a);if("Ok"===i.$){var o=i.a,u=f(Gh,n(t),o);if("Ok"===u.$){var s=u.a;return Fi(s)}var c=u.a;return hu(Di(c))}return Fi(r)},Sm)}),wm=a(function(e,t,r,n){return f(dh,l(Tm,f(Oh,e,Sm),t,r),n)}),Im=n(function(e,t,r){return f(dh,f(Oh,e,t),r)}),Am=gu(Ph),Bm=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]{64}$"))),km=function(e){return{$:"BlockHash",a:e}},Nm=function(e){return Bm(e)?li(km(cu(e))):fi("Given blockHash "+xh(e)+" is not valid.")},Rm=gu(Nm),$m=gh(f(xc,mh,yh("^((0[Xx]){1})?[0-9a-fA-F]+$"))),_m=function(e){return $m(e)?li(nc(cu(e))):fi("Something in here is not very hexy: "+xh(e))},Lm=gu(_m),xm=function(e){return{$:"TxHash",a:e}},Pm=function(e){return Bm(e)?li(xm(cu(e))):fi("Given txHash "+xh(e)+" is not valid.")},Dm=gu(Pm),Um=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}}),Om=zr,Mm=oe,Fm=l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionHash",Dm,l(Im,"transactionIndex",Gy,l(Im,"logIndex",Gy,d(wm,"removed",Om,!1,l(Im,"topics",Mm(Lm),l(Im,"data",pu,l(Im,"address",Am,Fi(Um)))))))))),Vm=function(e){return f(zh,function(e){if("Just"===e.$){var t=e.a;return hl(qf(t))}return bl},e)},Km=function(e){return Cl(M([L("fromBlock",Zh(e.fromBlock)),L("toBlock",Zh(e.toBlock)),L("address",pl(e.address)),L("topics",Vm(e.topics))]))},Hm=r(function(e,t){return Up({decoder:Mm(Fm),method:"eth_getLogs",params:M([Km(t)]),url:e})}),jm=function(e){return{$:"BlockNum",a:e}},qm=n(function(e,t,r){var n=r.a,a=r.b;return"BlockNum"===t.toBlock.$?f(Kp,function(r){return f(jp,vi(r),f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)})))},f(Hm,e,t)):f(Hm,e,t)}),Gm=r(function(e,t){var r=t.a;return um(l(xl,e,gr,r))}),zm=a(function(e,t,r,n){var a=r.a,i={logCount:0,logFilter:n,ref:a.ref,tagger:t,watchOnce:e},o=D(a,{ref:a.ref+1,requests:l(xl,a.ref,i,a.requests)}),u=a.blockNumber;if("Just"===u.$){var s=u.a;return function(e){return x(om(D(o,{watching:f(Gm,a.ref,o.watching)})),f(Zp,f(zo,bm(a.ref),a.tagger),e),a.ref)}(l(qm,a.nodePath,n,L(s,s)))}return x(om(D(o,{pending:f(Gm,a.ref,o.pending)})),Do,a.ref)}),Ym=zm(!1),Wm=r(function(e,t){var r=function(){var e=fm(t.factory),r=e.a,n=e.b;return function(e){var t=e.a,r=e.b,a=e.c;return x(t,Po(M([n,r])),a)}(l(Ym,mm,r,{address:t.creationInfo.address,fromBlock:jm(t.creationInfo.blocknum),toBlock:Mp,topics:yr}))}(),n=r.a,a=r.b;return d(gm,l(pm,ym(t),n,e),Po(M([a,Yy(Xh(t.factory))])),Fo,M([ha]))}),Jm=function(e){return{data:si(f(Gf,"abort()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Qm=function(e){return{data:si(f(Gf,"burn()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Xm=function(e){return{data:si(f(Gf,"claim()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},Zm=r(function(e,t){return{data:si(f(Gf,"initiatorStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),eb=function(e){return{data:si(f(Gf,"recall()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},tb=function(e){return{data:si(f(Gf,"release()",yr)),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},rb=r(function(e,t){return{data:si(f(Gf,"responderStatement(string)",M([ig(t)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),nb={$:"Invalid"},ab=r(function(e,t){return{amount:t,fiatType:e}}),ib=f(du,function(e){var t=cd(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("Can't convert that to a BigInt")},pu),ob=l(Mi,ab,f(Fh,0,pu),f(Fh,1,ib)),ub={$:"Bank"},sb={$:"Cash"},cb=function(e){switch(e){case"cash":return si(sb);case"bank":return si(ub);case"custom":return si(Fd);default:return ci}},fb=f(du,function(e){var t=cb(e);if("Just"===t.$){var r=t.a;return Fi(r)}return hu("")},pu),lb=l(Mi,Vd,f(Oh,"type",fb),f(Oh,"info",pu)),db=function(e){var t=l(Mi,sg,f(Oh,"price",ob),f(Oh,"paymentmethods",Mm(lb)));return f(op,t,e)},hb=r(function(e,t){return{commPubkey:t,responder:e}}),pb=r(function(e,t){var n=r(function(t,r){return l(Xo,t,t+2*r,e)}),a=f(zo,Nh,au(ti(2)));return f(Wh,function(t){return f(au,function(e){return f(n,t+64,e)},Nh(l(Xo,t,t+64,e)))},a(t))}),gb=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?x(0,0,f(e,o(t),i)):x(o(t),a-1,i):128&t?192==(224&t)?x(31&t,1,i):224==(240&t)?x(15&t,2,i):x(7&t,3,i):x(0,0,f(e,t,i))}),vb=n(function(e,t,r){var n=l(Ra,gb(e),x(0,0,t),r);if(n.b)return fi("invalid UTF-8 sequence");var a=n.c;return li(a)}),yb=j,mb=function(e){return As(yb(e))},bb=function(e){return l(vb,r(function(e,t){return U(t,mb(e))}),"",e)},Cb=Wo(function(e){var t=e.a,r=e.b;return f(au,f(tu,t,r),f(Wh,bb,f(Wh,f(zo,xa(Nh),Ah),f(au,ml(f(zo,_d,ns)),f(au,tc(2),f(pb,t,nu(r)))))))}),Eb=f(dh,f(Mh,1,Cb),f(dh,f(Mh,0,Dh),Fi(hb))),Sb=r(function(e,t){return{commPubkey:t,terms:e}}),Tb=f(dh,f(Mh,1,Cb),f(dh,f(Mh,0,Cb),Fi(Sb))),wb=function(e){return{statement:e}},Ib=f(dh,f(Mh,0,Cb),Fi(wb)),Ab=function(e){return{statement:e}},Bb=f(dh,f(Mh,0,Cb),Fi(Ab)),kb={$:"AbortedEvent"},Nb={$:"BurnedEvent"},Rb={$:"ClaimedEvent"},$b=function(e){return{$:"CommittedEvent",a:e}},_b=function(e){return{$:"InitiatedEvent",a:e}},Lb=function(e){return{$:"InitiatorStatementLogEvent",a:e}},xb={$:"PokeEvent"},Pb={$:"RecalledEvent"},Db={$:"ReleasedEvent"},Ub=function(e){return{$:"ResponderStatementLogEvent",a:e}},Ob=f(Oh,"topics",f(Fh,0,Lm)),Mb=function(e){return nc(f(Ri,"",f(xa,f(zo,Ps,uc),Kf(f(xa,yi,Zs(e))))))},Fb=f(du,function(e){return R(e,Mb("Initiated(string,string)"))?f(Oi,_b,Tb):R(e,Mb("Committed(address,string)"))?f(Oi,$b,Eb):R(e,Mb("Recalled()"))?Fi(Pb):R(e,Mb("Claimed()"))?Fi(Rb):R(e,Mb("Aborted()"))?Fi(kb):R(e,Mb("Released()"))?Fi(Db):R(e,Mb("Burned()"))?Fi(Nb):R(e,Mb("InitiatorStatementLog(string)"))?f(Oi,Lb,Ib):R(e,Mb("ResponderStatementLog(string)"))?f(Oi,Ub,Bb):R(e,Mb("Poke()"))?Fi(xb):hu("Unrecognized topic hash")},Ob),Vb=function(e){return"Buyer"===e.initiatorRole.$?e.tradeAmount:e.buyerDeposit},Kb=function(e){switch(e.$){case"Invalid":return ci;case"PartiallyLoadedTrade":var t=e.a;return si(t.factory);default:var r=e.a;return si(r.factory)}},Hb=function(e){return R(e.buyerDeposit,Yl(e.tradeAmount))&&R(e.abortPunishment,zl(e.tradeAmount))},jb=s(function(e,t,r,n,a,i,o,u){return{creationInfo:r,derived:u,factory:e,id:t,parameters:n,phaseStartInfo:o,state:a,terms:i}}),qb=r(function(e,t){return Vl(jd(t)+jd(e))}),Gb=function(e){var t=Bd(Sd(e.amount));if("Just"===t.$){return t.a}f(cl,"Error converting FiatValue to float--string -> float failed!",e);return 0},zb=r(function(e,t){return(t-e)/e}),Yb=r(function(e,t){var r=Gb(t),n=kd(e);return"USD"===t.fiatType?si(f(zb,n,r)):ci}),Wb=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 Vl(0)}}();return{margin:f(Yb,e.tradeAmount,r.price),phaseEndTime:function(){return"Closed"===t.phase.$?Vl(f(Nu,2,53)-1):f(qb,t.phaseStartTime,n)}()}}),Jb=function(e){var t=x(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 ym(v(jb,e.factory,e.id,n,a,o,u,s,l(Wb,a,o,u)))}return Hy(e)},Qb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{creationInfo:si(e)}));case"LoadedTrade":f(cl,"Trying to update creation info on a trade that's already fully loaded!","");return t;default:return nb}}),Xb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{parameters:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update parameters on a trade that's already fully loaded!","");return t;default:return nb}}),Zb=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{phaseStartInfo:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update phaseStartInfo on a trade that's already fully loaded!","");return t;default:return nb}}),eC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{state:si(e)}));case"LoadedTrade":var n=t.a;return ym(D(n,{state:e}));default:return nb}}),tC=r(function(e,t){switch(t.$){case"PartiallyLoadedTrade":var r=t.a;return Jb(D(r,{terms:si(e)}));case"LoadedTrade":t.a,f(cl,"Trying to update terms on a trade that's already fully loaded!","");return t;default:return nb}}),rC=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}}),nC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,uu,f(Xy,Dh,Jy(rC))))))))))),aC=function(e){return{data:si(f(Gf,"getParameters()",yr)),decoder:nC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},iC=function(e){return f(Bo,function(e){return Vl(1e3*e)},rd(Sd(e)))},oC=function(e){return Hl(e)},uC=a(function(e,t,r,n){if("Err"===t.$){var a=t.a;return fi(a)}var i=t.a;if("Err"===r.$){var a=r.a;return fi(a)}var o=r.a;if("Err"===n.$){var a=n.a;return fi(a)}var u=n.a;return li(l(e,i,o,u))}),sC=function(e){var t=f($d,"error converting BigInt to Time.Posix",iC(e.autoabortInterval)),r=f($d,"error converting BigInt to Time.Posix",iC(e.autoreleaseInterval)),a=f($d,"error converting BigInt to Time.Posix",iC(e.autorecallInterval));return d(uC,n(function(t,r,n){return{abortPunishment:oC(e.abortPunishment),autoabortInterval:r,autorecallInterval:t,autoreleaseInterval:n,buyerDeposit:oC(e.beneficiaryDeposit),initiatorAddress:e.initiator,initiatorRole:e.initiatedByCustodian?lo:fo,pokeReward:oC(e.pokeReward),tradeAmount:oC(e.tradeAmount)}}),a,t,r)},cC=n(function(e,t,r){return f(Zp,r,f(jp,sC,f(Fp,Xh(e),aC(t))))}),fC=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}}}}}}}}}}},lC=vu(f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(fC)))))))))))),dC=function(e){return{data:si(f(Gf,"getPhaseStartInfo()",yr)),decoder:lC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},hC=i(function(e,t,r,n,a){if("Nothing"===t.$)return ci;var i=t.a;if("Nothing"===r.$)return ci;var o=r.a;if("Nothing"===n.$)return ci;var u=n.a;if("Nothing"===a.$)return ci;var s=a.a;return si(d(e,i,o,u,s))}),pC=function(e){return h(hC,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}}),iC(e.v6),iC(e.v7),iC(e.v8),iC(e.v9))},gC=n(function(e,t,r){return f(Zp,r,f(jp,pC,f(Fp,Xh(e),dC(t))))}),vC=i(function(e,t,r,n,a){return{balance:e,closedReason:a,phase:t,phaseStartTimestamp:r,responder:n}}),yC=vu(f(Xy,jh,f(Xy,Dh,f(Xy,jh,f(Xy,jh,f(Xy,jh,Jy(vC))))))),mC=function(e){return{data:si(f(Gf,"getState()",yr)),decoder:yC,from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},bC={$:"Aborted"},CC={$:"Burned"},EC={$:"NotClosed"},SC={$:"Recalled"},TC={$:"Released"},wC=function(e){switch(f(xc,99,rd(Sd(e)))){case 0:return si(EC);case 1:return si(SC);case 2:return si(bC);case 3:return si(TC);case 4:return si(CC);default:return ci}},IC=function(e){switch(f(xc,99,rd(Sd(e)))){case 1:return si(Co);case 2:return si(mo);case 3:return si(bo);case 4:return si(yo);default:return ci}},AC=function(e){return R(e,th("0x0000000000000000000000000000000000000000"))?ci:si(e)},BC=a(function(e,t,r,n){if("Nothing"===t.$)return ci;var a=t.a;if("Nothing"===r.$)return ci;var i=r.a;if("Nothing"===n.$)return ci;var o=n.a;return si(l(e,a,i,o))}),kC=function(e){var t=iC(e.phaseStartTimestamp),r=IC(e.phase),a=wC(e.closedReason);return d(BC,n(function(t,r,n){return{balance:oC(e.balance),closedReason:n,phase:t,phaseStartTime:r,responder:AC(e.responder)}}),r,t,a)},NC=n(function(e,t,r){return f(Zp,r,f(jp,kC,f(Fp,Xh(e),mC(t))))}),RC=i(function(e,t,r,n,a){return Po(M([l(cC,e,t,r),l(NC,e,t,n),l(gC,e,t,a)]))}),$C=function(e){var t=Rg(e);if("Just"===t.$){return t.a}f(cl,"Warning! BigInt to Int conversion failed!",Sd(e));return 0},_C=a(function(e,t,r,n){return{encapsulatedKey:e,iv:t,message:n,tag:r}}),LC=n(function(e,t,r){for(;;){var n=f(Ya,32,e),a=n.a,i=n.b;if(_(ni(a),32)<0)return f(ai,!0,{nodeList:t,nodeListSize:r,tail:a});var o=i,u=f(ka,Ga(a),t),s=r+1;e=o,t=u,r=s}}),xC=function(e){return e.b?l(LC,e,yr,0):qa},PC=tn,DC=function(e){var t=h(PC,_C,f(Oh,"encapsulation",pu),f(Oh,"iv",pu),f(Oh,"tag",pu),f(Oh,"encrypted",pu)),r=Mm(t),n=f(Gh,r,e);if("Err"===n.$){var a=n.a;return fi(Di(a))}var i=n.a;return function(e){var t=L(f(Zc,0,e),f(Zc,1,e));if("Just"===t.a.$&&"Just"===t.b.$){var r=t.a.a,n=t.b.a;return li(L(r,n))}return fi("Decoded list has less than 2 items.")}(xC(i))},UC=function(e){var t=function(e){var t=Qo(e);return t>1114111?fi("string is too long"):li(f(Is,yb(t),e))};return f(au,Ri(""),Ah(f(xa,t,e)))},OC=function(e){var t=e.a,r=e.b;return UC(M([t.encapsulatedKey,t.iv,t.tag,t.message,r.encapsulatedKey,r.iv,r.tag,r.message]))},MC=r(function(e,t){return Cl(M([L("message",hl(e)),L("pubkeyHexStrings",f(zh,hl,M([t.initiatorPubkey,t.responderPubkey])))]))}),FC=function(e){return{$:"LoadedCommInfo",a:e}},VC=r(function(e,t){return{initiatorPubkey:e,responderPubkey:t}}),KC=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 FC(f(VC,r,n))}return dm(e)},HC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{initiatorPubkey:si(e)}))}var n=t.a;return FC(D(n,{initiatorPubkey:e}))}),jC=r(function(e,t){if("PartiallyLoadedCommInfo"===t.$){var r=t.a;return KC(D(r,{responderPubkey:si(e)}))}var n=t.a;return FC(D(n,{responderPubkey:e}))}),qC=r(function(e,t){var r=L(t,e);if("Initiator"===r.a.$){if("Buyer"===r.b.$){r.a,r.b;return fo}r.a,r.b;return lo}if("Buyer"===r.b.$){r.a,r.b;return lo}r.a,r.b;return fo}),GC=r(function(e,t){for(;;){if(!e.b)return t;var r=e.a,n=e.b,a=yi(r),i=f(nd,a,n),o=$s(f(lc,a,n)),u=U(t,M([o])),s=i,c=u;e=s,t=c}}),zC=function(e){var t=xC(f(GC,Zs(e),yr));return l(zd,uv,h(hC,_C,f(Zc,0,t),f(Zc,1,t),f(Zc,2,t),f(Zc,3,t)),h(hC,_C,f(Zc,4,t),f(Zc,5,t),f(Zc,6,t),f(Zc,7,t)))},YC=r(function(e,t){if("Statement"===t.$){t.a;return l(fa,"New Message from Trade",ci,ci)}var r=t.a,n=function(){switch(r.$){case"Initiated":return"Trade Opened.";case"Committed":return e?"Someone has committed to the Trade!":"You are now committed to the Trade!";case"Recalled":return"Trade recalled.";case"Claimed":return"Payment has been confirmed by the Buyer.";case"Aborted":return"Trade aborted by Buyer.";case"Released":return"Trade released by Seller.";default:return"Trade burned by Seller."}}();return l(fa,n,ci,ci)}),WC={$:"Aborted"},JC={$:"Burned"},QC={$:"Claimed"},XC=function(e){return{$:"Committed",a:e}},ZC=function(e){return{$:"Encrypted",a:e}},eE={$:"FailedDecode"},tE={$:"Initiated"},rE={$:"Recalled"},nE={$:"Released"},aE=function(e){return{$:"StateChange",a:e}},iE=function(e){return{$:"Statement",a:e}},oE=fr,uE=cr,sE=r(function(e,t){var r=ni(e),n=32-ni(t.tail)-r,a=l(oE,32,t.tail,e);return n<0?{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:l(uE,n,r,e)}:n?{nodeList:t.nodeList,nodeListSize:t.nodeListSize,tail:a}:{nodeList:f(ka,Ga(a),t.nodeList),nodeListSize:t.nodeListSize+1,tail:ja}}),cE=or,fE=y,lE=a(function(e,t,r,n){var a=Wc&t>>>e;if(_(a,ni(n))>-1){if(5===e)return f(cE,Ga(r),n);var i=za(d(lE,e-Ha,t,r,ja));return f(cE,i,n)}var o=f(Jc,a,n);if("SubTree"===o.$){var u=o.a,i=za(d(lE,e-Ha,t,r,u));return l(rf,a,i,n)}var i=za(d(lE,e-Ha,t,r,fE(o)));return l(rf,a,i,n)}),dE=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=t.d,o=ni(i),u=ni(e),s=r+(u-o);if(R(u,32)){if(_(s>>>Ha,1<0){var c=n+Ha,f=d(lE,c,r,e,fE(za(a)));return d(Ma,s,c,f,ja)}return d(Ma,s,n,d(lE,n,r,e,a),ja)}return d(Ma,s,n,a,e)}),hE=r(function(e,t){var r=(t.a,t.c,t.d),n=ni(e),a=32-ni(r)-n,i=l(oE,32,r,e),o=f(dE,i,t);if(a<0){var u=l(uE,a,n,e);return f(dE,u,o)}return o}),pE=ur,gE=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(pE,i,t,r)}return f(ka,e,t)});return{nodeList:l(pE,i,yr,n),nodeListSize:t/32|0,tail:a}},vE=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(pE,o,t,r)}var n=e.a;return f(hE,n,t)});return f(hE,i,l(pE,o,e,a))}var o=r(function(e,t){if("SubTree"===e.$){var r=e.a;return l(pE,o,t,r)}var n=e.a;return f(sE,n,t)});return f(ai,!0,f(sE,i,l(pE,o,gE(e),a)))}),yE=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return f(ka,r,t)}),mE=f(La,yE,yr),bE=n(function(e,t,r){var n=qC(r.trade.parameters.initiatorRole),a=function(){switch(t.$){case"InitiatedEvent":return si(aE(tE));case"CommittedEvent":var r=t.a;return si(aE(XC(r.responder)));case"RecalledEvent":return si(aE(rE));case"ClaimedEvent":return si(aE(QC));case"AbortedEvent":return si(aE(WC));case"ReleasedEvent":return si(aE(nE));case"BurnedEvent":return si(aE(JC));case"InitiatorStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(To)}));case"ResponderStatementLogEvent":var r=t.a;return si(iE({blocknum:e,message:function(){var e=zC(r.statement);if("Just"===e.$){var t=e.a;return ZC(t)}return eE}(),who:n(wo)}));default:return ci}}(),i=f(Bo,function(t){return{blocknum:e,eventInfo:t,time:ci}},a),o=f(vE,r.history,xC(mE(M([i])))),u=_(e,r.lastNotificationBlocknum)>0?L(f(Bo,YC(R(r.userRole,r.trade.parameters.initiatorRole)),a),e):L(ci,r.lastNotificationBlocknum),s=u.a;return x(D(r,{history:o,lastNotificationBlocknum:u.b}),function(){return"Just"===a.$&&"Statement"===a.a.$}(),mE(M([s])))}),CE=Gr,EE=function(e){var t=l(Mi,uv,f(Oh,"id",CE),f(Oh,"message",pu));return f(Hd,Di,f(Gh,t,e))},SE=function(e){return{$:"Decrypted",a:e}},TE=a(function(e,t,r,n){return{appCmds:n,maybeMessageSubmit:r,model:e,shouldCallDecrypt:t}}),wE=r(function(e,t){switch(e.$){case"NewEvent":var r=e.a,n=r.a,a=r.b,i=l(bE,n,a,t),o=i.a,u=i.b,s=i.c;return d(TE,o,u,ci,s);case"MessageInputChanged":var c=e.a;return d(TE,D(t,{messageInput:c}),!1,ci,yr);case"MessageSubmit":return d(TE,D(t,{messageInput:""}),!1,si(t.messageInput),yr);default:var h=e.a,p=EE(h);if("Ok"===p.$){var g=p.a,v=g.a,y=g.b,m=f(Zc,v,t.history);if("Just"===m.$){var b=m.a,C=b.eventInfo;if("Statement"===C.$){var E=C.a,S=D(E,{message:SE(y)}),T=D(b,{eventInfo:iE(S)}),w=l(af,v,T,t.history);return d(TE,D(t,{history:w}),!1,ci,yr)}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an event that is not a message!",b))]))}return d(TE,t,!1,ci,M([pa(f(ll,"got a decryption result, but for an id out of bounds!",L(v,t.history)))]))}var I=p.a;return d(TE,t,!1,ci,M([pa(f(ll,"Error decoding decryption result",I))]))}}),IE=r(function(e,t){return{$:"ActionMined",a:e,b:t}}),AE=r(function(e,t){return{$:"ActionSigned",a:e,b:t}}),BE=function(e){return{onBroadcast:ci,onMined:si(L(IE(e),ci)),onSign:si(AE(e))}},kE=je("encryptToPubkeys",Ua),NE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),RE=n(function(e,t,r){return{data:si(f(Gf,"commit(address,string)",M([ih(t),ig(r)]))),decoder:Fi(gr),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}}),$E=function(e){return{$:"CommitMined",a:e}},_E={$:"CommitNeedsSig"},LE=function(e){return{$:"CommitSigned",a:e}},xE=n(function(e,t,r){var n=function(){return"Token"===e.factory.$?RE:NE}(),a=al(function(){return"Token"===e.factory.$?Ua:pg(jl(Vb(e.parameters)))}()(l(n,e.creationInfo.address,t,r)));return L(si(_E),f(qo,{onBroadcast:ci,onMined:si(L($E,ci)),onSign:si(LE)},a))}),PE=r(function(e,t){return Cl(M([L("id",wl(e)),L("encapsulation",hl(t.encapsulatedKey)),L("iv",hl(t.iv)),L("tag",hl(t.tag)),L("encrypted",hl(t.message))]))}),DE=je("decryptMessage",Ua),UE=function(e){var t=e.a,n=r(function(e,t){var r=t.a,n=t.b;return L(r-1,f(ka,L(r,e),n))});return l(Ea,n,L(t-1,yr),e).b},OE=r(function(e,t){return Po(f(xa,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 DE(f(PE,r,s))}return Do}return Do},UE(e.history)))}),ME=function(e){if("Just"===e.$){return e.a}return ci},FE=function(e){var t=ME(l(zd,Ao,function(){var t=e.trade;if("LoadedTrade"===t.$){var r=t.a;return si(r)}return ci}(),f(Bo,function(e){return e.address},Gd(e.wallet)))),r=L(e.chatHistoryModel,t);if("Just"===r.a.$&&"Just"===r.b.$){var n=r.a.a,a=r.b.a;return f(OE,n,a)}return Do},VE=r(function(e,t){return f(r(function(e,t){for(;;){var r=t.a,n=t.b,a=t.c;if(!e.b)return x(r,n,a);var i=e.a,o=i.a,u=i.b,s=e.b,c=l(bE,o,u,r),d=c.a,h=c.b,p=c.c,g=s,v=x(d,n||h,f(oo,a,p));e=g,t=v}}),e,x(t,!1,yr))}),KE=o(function(e,t,r,n,a,i){return{history:n,lastNotificationBlocknum:a,messageInput:i,trade:t,userRole:r,wallet:e}}),HE=i(function(e,t,r,n,a){return f(VE,n,p(KE,e,r,t,qa,a,""))}),jE=function(e){return{$:"ChatHistoryMsg",a:e}},qE=a(function(e,t,r,n){var a=x(t,Gd(e),r);if("LoadedTrade"===a.a.$&&"Just"===a.b.$&&"Just"===a.c.$){var i=a.a.a,o=a.b.a,u=a.c.a,s=f(ko,i,o.address);if("Just"===s.$){var c=s.a;return function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r,f(xa,Ji(jE),n))}(h(HE,e,c,i,n,u))}return x(ci,!1,yr)}return x(ci,!1,yr)}),GE={$:"Abort"},zE=r(function(e,t){return{$:"ActionMining",a:e,b:t}}),YE=function(e){return{$:"ActionNeedsSig",a:e}},WE=function(e){return{$:"ApproveMining",a:e}},JE={$:"ApproveNeedsSig"},QE=function(e){return{$:"ApproveSigned",a:e}},XE={$:"Burn"},ZE={$:"Claim"},eS=function(e){return{$:"CommitMining",a:e}},tS=function(e){return{$:"ConfirmingAction",a:e}},rS=r(function(e,t){return{$:"ConfirmingCommit",a:e,b:t}}),nS=function(e){return{$:"ParametersFetched",a:e}},aS=function(e){return{$:"PhaseInfoFetched",a:e}},iS={$:"Poke"},oS={$:"Recall"},uS={$:"Release"},sS=function(e){return{$:"StartContractAction",a:e}},cS=function(e){return{$:"StateFetched",a:e}},fS=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"}},lS=function(e){return d(gm,e,Do,Fo,yr)},dS={align:ul,label:"cantFindTradeWillRetry",mainParagraphs:M([M([fl("Can't find a trade by that ID. I'll try again in half a second.")])]),noticeType:$g},hS=r(function(e,t){if("Err"===t.$){var r=t.a;return f(_g,e,r)}if("Nothing"===t.a.$){t.a;return f(ll,"Couldn't decode the fetched \""+e+'" result.',ci)}return f(ll,"fromBadFetchResultMaybe being called with an 'OK (Just a)' value",t)}),pS={align:ul,label:"tradeParametersNotDefault",mainParagraphs:M([M([fl("Sorry, I'm not yet able to deal with this kind of trade. This must have been created by some other DAIHard interface.")])]),noticeType:$g},gS=eo(Xi),vS=n(function(e,t,r){return l(bp,e,Bo(function(e){return D(e,{logCount:Ti(t)+e.logCount})}),r)}),yS=r(function(e,t){var r=t.a;return um(f(mp,e,r))}),mS=n(function(e,t,r){var n=e.a,a=f(fp,t,n.requests);if("Nothing"===a.$)return L(om(n),Do);var i=a.a,o=L(i.watchOnce,Ql(r));if("Nothing"===o.b.$){o.b;return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Do)}if(o.a){var u=o.b.a;return L(om(D(n,{requests:l(vS,t,r,n.requests),watching:f(yS,t,n.watching)})),f(Yg,i.tagger,xp(u)))}return L(om(D(n,{requests:l(vS,t,r,n.requests)})),Po(f(xa,function(e){return f(Yg,i.tagger,xp(e))},r)))}),bS=_e,CS=r(function(e,t){return f(Zp,f(zo,im,t),f(Kp,function(t){return zy(e)},bS(2e3)))}),ES=n(function(e,t,r){var n=r.a,a=r.b;return f(Hm,e,D(t,{fromBlock:jm(n),toBlock:jm(a)}))}),SS=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(SS,e,t,i)),c=o;e=u,t=s,r=c}}),TS=r(function(e,t){return l(SS,xl,t,e)}),wS=r(function(e,t){var r=e.a,n=t.a;return um(f(TS,r,n))}),IS=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 Po(f(xa,function(t){return f(Zp,f(zo,bm(t.ref),r.tagger),l(n,r.nodePath,t.logFilter,e))},mE(f(xa,function(e){return f(fp,e,r.requests)},Ba(t)))))}),o=r.blockNumber;if("Just"===o.$){var u=o.a;return a-u?L(om(D(r,{blockNumber:si(a)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(u+1,a),r.watching,ES)]))):L(t,f(CS,r.nodePath,r.tagger))}return L(om(D(r,{blockNumber:si(a),pending:sm,watching:f(wS,r.watching,r.pending)})),Po(M([f(CS,r.nodePath,r.tagger),l(i,L(a,a),r.pending,qm),l(i,L(a,a),r.watching,ES)])))}var s=e.a.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),f(CS,r.nodePath,r.tagger))}if("Ok"===e.b.$){var c=e.a,d=e.b.a;return l(mS,t,c,d)}var s=e.b.a;return L(om(D(r,{errors:f(ka,s,r.errors)})),Do)}),AS=function(e){return M([e])},BS=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(nm,r.factory,r.id):Do}}(),function(){var e=x(Gd(t.wallet),Mg(t.wallet),t.trade);if("Just"===e.a.$&&"Just"===e.b.$&&"Token"===e.b.a.$&&"LoadedTrade"===e.c.$){var r=e.a.a,n=e.b.a.a,a=e.c.a;return R(Mg(t.wallet),si(a.factory))?d(eg,n,r.address,a.creationInfo.address,Ly):Do}return Do}()),n=function(){return"Nothing"===t.chatHistoryModel.$?d(qE,t.wallet,t.trade,t.blocknumOnInit,t.eventsWaitingForChatHistory):x(t.chatHistoryModel,!1,yr)}(),a=n.a,i=n.b,o=n.c,u=D(t,{chatHistoryModel:a}),s=i?FE(t):Do,c=t.trade;if("LoadedTrade"===c.$){var p=c.a;return d(gm,u,Po(M([l(NC,p.factory,p.creationInfo.address,cS),s,r])),Fo,o)}return lS(u);case"CurrentBlockFetched":var g=e.a;if("Ok"===g.$){var v=g.a;return lS(D(t,{blocknumOnInit:si(v)}))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"blocknum",y))]));case"AllowanceFetched":var g=e.a;if("Ok"===g.$){var m=g.a,u=D(t,{allowance:si(m)}),b=x(u.txChainStatus,u.trade,u.wallet);if("Just"===b.a.$&&"ApproveMining"===b.a.a.$&&"LoadedTrade"===b.b.$&&"Active"===b.c.$){var C=b.b.a,E=b.c.a;if(R(f(ts,m,jl(Vb(C.parameters))),ba))return lS(u);var S=l(xE,C,E.address,E.commPubkey),T=S.a,w=S.b;return d(gm,D(u,{txChainStatus:T}),Do,w,yr)}return lS(u)}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"allowance",y))]));case"CreationInfoFetched":var g=e.a;if("Ok"===g.$){var I=g.a,A={address:I.address_,blocknum:$C(I.blocknum)},B=l(Ym,mm,t.eventSentry,{address:A.address,fromBlock:jm(A.blocknum),toBlock:Mp,topics:yr}),k=B.a,N=B.b,u=D(t,{eventSentry:k,trade:f(Qb,A,t.trade)}),$=f(xc,gS,Kb(u.trade)),_=Po(M([N,h(RC,$,A.address,nS,cS,aS)]));return d(gm,u,_,Fo,yr)}if("BadBody"===g.a.$){g.a.a;return d(gm,t,Do,Fo,M([pa(dS)]))}var y=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade state",y))]));case"StateFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var P=g.a.a,O=function(){var e=t.trade;switch(e.$){case"PartiallyLoadedTrade":return!0;case"LoadedTrade":return!R(e.a.state.phase,P.phase);default:return!1}}(),u=D(t,{expandedPhase:O?P.phase:t.expandedPhase,trade:f(eC,P,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"ParametersFetched":var g=e.a;if("Ok"===g.$){if("Ok"===g.a.$){var F=g.a.a;if(Hb(F)){var u=D(t,{trade:f(Xb,F,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,D(t,{trade:nb}),Do,Fo,M([pa(pS)]))}var V=g.a.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding fetched trade parameters",V))]))}var K=g.a;return d(gm,t,Do,Fo,M([pa(f(_g,"trade parameters",K))]));case"PhaseInfoFetched":var g=e.a;if("Ok"===g.$&&"Just"===g.a.$){var H=g.a.a,u=D(t,{trade:f(Zb,H,t.trade)});return d(gm,u,FE(u),Fo,yr)}return d(gm,t,Do,Fo,M([pa(f(hS,"trade state",g))]));case"EventLogFetched":var j=e.a,q=f(Yh,Fb,j),G=q.returnData;if("Err"===G.$){var z=G.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error decoding contract event",z))]))}var Y=G.a,W=function(){switch(Y.$){case"InitiatedEvent":var e=Y.a;return f(HC,e.commPubkey,t.secureCommInfo);case"CommittedEvent":var e=Y.a;return f(jC,e.commPubkey,t.secureCommInfo);default:return t.secureCommInfo}}(),J=function(){if("InitiatedEvent"===Y.$){var e=Y.a,r=db(e.terms);if("Ok"===r.$){var n=r.a;return L(f(tC,n,t.trade),ci)}var a=r.a;return L(t.trade,si(f(ll,"Couldn't decode payment methods!",a)))}return L(t.trade,ci)}(),Q=J.a,X=J.b,Z=function(){var e=t.chatHistoryModel;if("Just"===e.$){var r=e.a;return x(si(r),!1,yr)}return d(qE,t.wallet,Q,t.blocknumOnInit,t.eventsWaitingForChatHistory)}(),ee=Z.a,te=Z.b,re=Z.c,ne=function(){if("Just"===ee.$){var e=ee.a;return L(function(e){var t=e.a,r=e.b,n=e.c;return x(si(t),r||te,f(oo,re,f(xa,Ji(jE),n)))}(l(bE,q.blockNumber,Y,e)),yr)}return L(x(ci,!1,re),f(oo,t.eventsWaitingForChatHistory,M([L(q.blockNumber,Y)])))}(),ae=ne.a,ie=ae.a,oe=ae.b,ue=ae.c,se=ne.b,u=D(t,{chatHistoryModel:ie,eventsWaitingForChatHistory:se,secureCommInfo:W,trade:Q}),_=oe?FE(u):Do;return d(gm,u,_,Fo,f(oo,f(xa,pa,mE(M([X]))),ue));case"ExpandPhase":var ce=e.a;return lS(D(t,{expandedPhase:ce}));case"ToggleChat":var fe=!t.showChatHistory;return lS(D(t,{showChatHistory:fe}));case"ToggleStatsModal":var le=!t.showStatsModal;return lS(D(t,{showStatsModal:le}));case"ViewUserHistory":var de=(e.a,t.trade);if("LoadedTrade"===de.$){var C=de.a;return d(gm,t,Do,Fo,M([da(jv(C.parameters.initiatorAddress))]))}return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to view a user's history for a not-yet-loaded Trade",t.trade))]));case"CommitClicked":var C=e.a,E=e.b,he=e.c;return lS(D(t,{txChainStatus:si(f(rS,E,he))}));case"AbortAction":return lS(D(t,{txChainStatus:ci}));case"ConfirmCommit":var C=e.a,E=e.b,he=e.c,pe=function(){var e=C.factory;if("Native"===e.$)return l(xE,C,E.address,E.commPubkey);var r=e.a,n=function(){var e=al(l(sh,nh(r),C.creationInfo.address,he)),t={onBroadcast:ci,onMined:ci,onSign:si(QE)};return f(qo,t,e)}(),a=t.allowance;if("Just"===a.$){var i=a.a;return R(f(ts,i,jl(Vb(C.parameters))),ba)?L(si(JE),n):l(xE,C,E.address,E.commPubkey)}return L(si(JE),n)}(),T=pe.a,w=pe.b;return d(gm,D(t,{txChainStatus:T}),Do,w,yr);case"ContractActionClicked":var ge=e.a;if(R(ge,iS)||R(ge,oS)){var ve=sS(ge),ye=t;e=ve,t=ye;continue e}return lS(D(t,{txChainStatus:si(tS(ge))}));case"StartContractAction":var me=e.a,be=function(){var e=t.trade;if("LoadedTrade"!==e.$){var r=e;return x(t.txChainStatus,Fo,M([pa(f(ll,"Trying to handle StartContractAction msg for a not-yet-loaded Trade",r))]))}var n=e.a;switch(me.$){case"Recall":var a=al(eb(n.creationInfo.address));return x(si(YE(oS)),f(qo,BE(oS),a),yr);case"Claim":var a=al(Xm(n.creationInfo.address));return x(si(YE(ZE)),f(qo,BE(ZE),a),yr);case"Abort":var a=al(Jm(n.creationInfo.address));return x(si(YE(GE)),f(qo,BE(GE),a),yr);case"Release":var a=al(tb(n.creationInfo.address));return x(si(YE(uS)),f(qo,BE(uS),a),yr);case"Burn":var a=al(Qm(n.creationInfo.address));return x(si(YE(XE)),f(qo,BE(XE),a),yr);default:var a=al(zf(n.creationInfo.address));return x(si(YE(iS)),f(qo,BE(iS),a),yr)}}(),T=be.a,w=be.b,o=be.c;return d(gm,D(t,{txChainStatus:T}),Do,w,o);case"ApproveSigned":var Ce=e.a;if("Ok"===Ce.$){var Ee=Ce.a;return lS(D(t,{txChainStatus:si(WE(Ee))}))}var V=Ce.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"approve",V))]));case"CommitSigned":var Ce=e.a;if("Ok"===Ce.$){var Ee=Ce.a;return lS(D(t,{txChainStatus:si(eS(Ee))}))}var V=Ce.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,"commit",V))]));case"CommitMined":return lS(D(t,{txChainStatus:ci}));case"ActionSigned":var ge=e.a,Ce=e.b;if("Ok"===Ce.$){var Ee=Ce.a;return lS(D(t,{txChainStatus:si(f(zE,ge,Ee))}))}var V=Ce.a;return d(gm,D(t,{txChainStatus:ci}),Do,Fo,M([pa(f(Pg,fS(ge),V))]));case"ActionMined":var ge=e.a;return lS(D(t,{txChainStatus:ci}));case"EventSentryMsg":var Se=e.a,Te=f(IS,Se,t.eventSentry),we=Te.a,_=Te.b;return d(gm,D(t,{eventSentry:we}),_,Fo,yr);case"ChatHistoryMsg":var Ie=e.a,Ae=t.chatHistoryModel;if("Just"===Ae.$){var Be=Ae.a,ke=f(wE,Ie,Be),Ne=D(t,{chatHistoryModel:si(ke.model)}),s=ke.shouldCallDecrypt?FE(t):Do,Re=function(){var e=ke.maybeMessageSubmit;if("Just"===e.$){var r=e.a,n=t.secureCommInfo;if("LoadedCommInfo"===n.$){var a=n.a;return L(kE(f(MC,r,a)),ci)}return L(Do,si(f(ll,"Trying to encrypt, but commInfo is not loaded",n)))}return L(Do,ci)}(),$e=Re.a,_e=Re.b;return d(gm,Ne,Po(M([s,$e])),Fo,U(f(Qi,jE,ke.appCmds),f(xc,yr,f(Bo,AS,f(Bo,pa,_e)))))}return d(gm,t,Do,Fo,M([pa(f(ll,"Got a chat history message, but there is no chat history model!",Ie))]));case"EncryptionFinished":var Le=e.a,xe=f(Wh,OC,DC(Le)),Pe=x(t.wallet,t.trade,xe);if("Ok"===Pe.c.$){if("Active"===Pe.a.$&&"LoadedTrade"===Pe.b.$){var E=Pe.a.a,p=Pe.b.a,De=Pe.c.a,Ue=f(Ao,p,E.address);if("Nothing"===Ue.$)return d(gm,t,Do,Fo,M([pa(f(ll,"Trying to encrypt, but the user is not involved in this trade.",ci))]));var Oe=Ue.a,Me=function(){return al("Initiator"===Oe.$?f(Zm,p.creationInfo.address,De):f(rb,p.creationInfo.address,De))}();return d(gm,t,Do,f(qo,{onBroadcast:ci,onMined:ci,onSign:ci},Me),yr)}var Fe=Pe.a,Ve=Pe.b;return d(gm,t,Do,Fo,M([pa(f(ll,"Encryption successful, but the user or trade is no longer valid.",L(Fe,Ve)))]))}var Ke=Pe.c.a;return d(gm,t,Do,Fo,M([pa(f(ll,"Error translating JS encryption result into Elm.",Ke))]));case"MessageSubmitMined":if("Ok"===e.a.$){e.a.a;return lS(t)}var V=e.a.a;return d(gm,t,Do,Fo,M([pa(f(Lg,"message",V))]));default:return d(gm,t,Do,Fo,M([ga]))}}),kS=r(function(e,t){return{address:e,blocknum:t}}),NS=function(e){switch(e.$){case"LoadedTrade":var t=e.a;return si(t.creationInfo);case"PartiallyLoadedTrade":return e.a.creationInfo;default:return ci}},RS=n(function(e,t,r){return function(e){return L(e.a,e.b)}(d(zm,!0,e,t,r))}),$S=n(function(e,t,r){var n=function(e){return r(f(Yh,Tb,e).returnData)},a={address:t.address,fromBlock:jm(t.blocknum),toBlock:jm(t.blocknum),topics:M([si(Mb("Initiated(string,string)"))])};return l(RS,n,e,a)}),_S=function(e){return{data:si(f(Gf,"numTrades()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},LS=r(function(e,t){return f(Zp,t,f(Fp,Xh(e),_S(rh(e))))}),xS=function(e){return{data:si(f(Gf,"phase()",yr)),decoder:vu(jh),from:ci,gas:ci,gasPrice:ci,nonce:ci,to:si(e),value:ci}},PS=n(function(e,t,r){return f(Zp,r,f(jp,IC,f(Fp,Xh(e),xS(t))))}),DS=n(function(e,t,r){var n=e(t);if("Just"===n.$){var a=n.a;return f(ka,a,r)}return r}),US=r(function(e,t){return l(La,DS(e),yr,t)}),OS=function(e){return f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades))},MS=function(e){return f(Ra,r(function(t,r){return e(t)?r+1:r}),0)},FS=function(e){return f(MS,Ja(nb),Sa(e.trades))},VS=function(e){return D(e,{dataFetchState:D(e.dataFetchState,{invalid:FS(e),loaded:Ti(OS(e))})})},KS=n(function(e,t,r){return{appCmds:r,cmd:t,tradeCache:e}}),HS=r(function(e,t){var r=f(Zc,e,t.trades);if("Just"===r.$){var n=(r.a,l(af,e,nb,t.trades));return l(KS,VS(D(t,{trades:n})),Do,yr)}return l(KS,t,Do,M([pa(f(ll,"markTradeInvalid ran into an out-of-range error",L(e,t.trades)))]))}),jS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Qb,t,a),o=l(af,e,i,r.trades);return L(VS(D(r,{trades:o})),yr)}return L(r,M([f(ll,"updateTradeAddress ran into an out-of-range error",L(e,r.trades))]))}),qS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Xb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeParameters ran into an out-of-range error",L(e,r.trades)))]))}),GS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){if("LoadedTrade"===n.a.$){var a=n.a.a,i=a.state,o=l(af,e,ym(D(a,{state:D(i,{phase:t})})),r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase is trying to update a partially loaded trade",L(e,r.trades)))]))}return l(KS,r,Do,M([pa(f(ll,"updateTradePhase ran into an out-of-range error",L(e,r.trades)))]))}),zS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(Zb,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradePhaseTimeInfo ran into an out-of-range error",L(e,r.trades)))]))}),YS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(eC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTradeState ran into an out-of-range error",L(e,r.trades)))]))}),WS=n(function(e,t,r){var n=f(Zc,e,r.trades);if("Just"===n.$){var a=n.a,i=f(tC,t,a),o=l(af,e,i,r.trades);return l(KS,VS(D(r,{trades:o})),Do,yr)}return l(KS,r,Do,M([pa(f(ll,"updateTTPaymentMethods ran into an out-of-range error",L(e,r.trades)))]))}),JS=r(function(e,t){return{$:"CreationInfoFetched",a:e,b:t}}),QS=n(function(e,t,r){return{invalid:r,loaded:t,total:e}}),XS=r(function(e,t){return{$:"InitiatedEventDataFetched",a:e,b:t}}),ZS=function(e){return{$:"NumTradesFetchedAgain",a:e}},eT=r(function(e,t){return{$:"ParametersFetched",a:e,b:t}}),tT=n(function(e,t,r){return{$:"PhaseFetched",a:e,b:t,c:r}}),rT=r(function(e,t){return{$:"PhaseStartInfoFetched",a:e,b:t}}),nT=r(function(e,t){return{$:"StateFetched",a:e,b:t}}),aT=function(e){return l(KS,e,Do,yr)},iT=r(function(e,t){switch(e.$){case"InitialNumTradesFetched":var r=e.a;if("Ok"===r.$){var n=r.a,a=$C(n),i=xC(f(xa,jy(t.factory),f(Ai,0,a-1))),o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,0,a-1)));return l(KS,D(t,{dataFetchState:l(QS,si(a),0,0),trades:i}),o,yr)}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CheckForNewTrades":return l(KS,t,f(LS,t.factory,ZS),yr);case"UpdateTradePhases":var s=Po(mE(f(xa,function(e){return"Closed"===e.state.phase.$?ci:si(l(PS,e.factory,e.creationInfo.address,f(tT,e.factory,e.id)))},OS(t))));return l(KS,t,s,yr);case"PhaseFetched":var c=e.a,d=e.b,r=e.c;if("Ok"===r.$&&"Just"===r.a.$){var p=r.a.a,g=l(GS,d,p,t),v=function(){var e=L(p,f(Zc,d,t.trades));if("Just"===e.b.$){if("Committed"===e.a.$){var r=(e.a,e.b.a),n=NS(r);if("Just"===n.$){var a=n.a;return L(l(NC,c,a.address,nT(d)),yr)}return L(Do,M([pa(f(ll,"Phase fetched for a trade that has no creationInfo",r))]))}return L(Do,yr)}e.b;return L(Do,M([pa(f(ll,"Phase fetched for a trade, but then ran into an out-of-range error",ci))]))}(),y=v.a,m=v.b;return l(KS,g.tradeCache,Po(M([g.cmd,y])),f(oo,g.appCmds,m))};return l(KS,t,Do,M([pa(f(hS,"phase",r))]));case"NumTradesFetchedAgain":var r=e.a,b=L(r,t.dataFetchState.total);if("Ok"===b.a.$){if("Just"===b.b.$){var n=b.a.a,C=b.b.a,E=$C(n);if(_(C,E)<0){var S=t.dataFetchState,o=Po(f(xa,function(e){return l(tm,t.factory,qu(e),JS(e))},f(Ai,C,E-1))),T=xC(f(xa,jy(t.factory),f(Ai,C,E-1)));return l(KS,D(t,{dataFetchState:D(S,{total:si(E)}),trades:f(vE,t.trades,T)}),o,yr)}return aT(t)}b.b;return l(KS,t,Do,M([pa(f(ll,"Trying to fetch additional trades, but there is an unexpected Nothing in the existing numTrades.",""))]))}var u=b.a.a;return l(KS,t,Do,M([pa(f(_g,"Factory numTrades",u))]));case"CreationInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$){var w=r.a,I=f(kS,w.address_,$C(w.blocknum)),A=l($S,t.eventSentry,I,XS(d)),B=A.a,k=A.b,y=Po(M([h(RC,t.factory,I.address,eT(d),nT(d),rT(d)),k])),N=l(jS,d,I,t),R=N.a,$=N.b;return l(KS,VS(D(R,{eventSentry:B})),y,f(xa,pa,$))}var u=r.a;return l(KS,t,Do,M([pa(f(_g,"creationInfo",u))]));case"ParametersFetched":var d=e.a,r=e.b;if("Err"===r.$){var x=r.a;return l(KS,t,Do,M([pa(f(_g,"parameters",x))]))}if("Ok"===r.a.$){var P=r.a.a;return l(qS,d,P,t)}var U=r.a.a;return l(KS,t,Do,M([pa(f(ll,"Can't decode fetched trade parameters",U))]));case"StateFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var O=r.a.a;return l(YS,d,O,t)}return l(KS,t,Do,M([pa(f(hS,"state",r))]));case"PhaseStartInfoFetched":var d=e.a,r=e.b;if("Ok"===r.$&&"Just"===r.a.$){var F=r.a.a;return l(zS,d,F,t)}return l(KS,t,Do,M([pa(f(hS,"phaseStartInfo",r))]));case"InitiatedEventDataFetched":var d=e.a,r=e.b;if("Ok"===r.$){var V=r.a,K=db(V.terms);if("Ok"===K.$){var H=K.a;return l(WS,d,H,t)}var j=K.a;return f(HS,d,t)}var j=r.a;return l(KS,t,Do,M([pa(f(ll,"Error decoding initiated event",j))]));default:var q=e.a,G=f(IS,q,t.eventSentry),z=G.a,y=G.b;return l(KS,D(t,{eventSentry:z}),y,yr)}}),oT=function(e){return{$:"AgentHistoryMsg",a:e}},uT=function(e){return{$:"AppCmd",a:e}},sT={$:"BetaLandingPage"},cT={$:"ConnectToWeb3"},fT=function(e){return{$:"MarketplaceMsg",a:e}},lT=r(function(e,t){return{$:"TradeCacheMsg",a:e,b:t}}),dT=r(function(e,t){return f(kn,e,hl(t))}),hT=function(e){return f(dT,"href",tt(e))},pT=Nn("rel"),gT=dT("target"),vT=function(e){return{$:"Height",a:e}},yT=vT,mT={$:"Content"},bT=mT,CT=function(e){return{$:"Width",a:e}},ET=CT,ST=function(e){return{$:"Attr",a:e}},TT=function(e){return{$:"NodeName",a:e}},wT=function(e){return{$:"Unkeyed",a:e}},IT={$:"AsEl"},AT=IT,BT=r(function(e,t){return{$:"Field",a:e,b:t}}),kT=f(BT,0,0),NT={$:"NoNearbyChildren"},RT={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"},$T=RT.any+" "+RT.column,_T=RT.any+" "+RT.grid,LT=RT.any+" "+RT.page,xT=RT.any+" "+RT.paragraph,PT=RT.any+" "+RT.row,DT=RT.any+" "+RT.single,UT=function(e){switch(e.$){case"AsRow":return PT;case"AsColumn":return $T;case"AsEl":return DT;case"AsGrid":return _T;case"AsParagraph":return xT;default:return LT}},OT=function(e){return{$:"Keyed",a:e}},MT={$:"NoStyleSheet"},FT=r(function(e,t){switch(t.$){case"NoNearbyChildren":return e;case"ChildrenBehind":var r=t.a;return U(r,e);case"ChildrenInFront":var n=t.a;return U(e,n);default:var r=t.a,n=t.b;return U(r,U(e,n))}}),VT=n(function(e,t,r){switch(r.$){case"NoNearbyChildren":return t;case"ChildrenBehind":var n=r.a;return U(f(xa,function(t){return L(e,t)},n),t);case"ChildrenInFront":var a=r.a;return U(t,f(xa,function(t){return L(e,t)},a));default:var n=r.a,a=r.b;return U(f(xa,function(t){return L(e,t)},n),U(t,f(xa,function(t){return L(e,t)},a)))}}),KT={$:"AsParagraph"},HT=KT,jT=Sn("div"),qT=Sn("p"),GT=Sn("s"),zT=Sn("u"),YT=dT("className"),WT=function(e){return wn(Xe(e))},JT=function(e){return Sn(Xe(e))},QT=function(e){return{$:"Flag",a:e}},XT=function(e){return{$:"Second",a:e}},ZT=function(e){return e>31?XT(1< .ctr > ."+RT.any+" {\n border: 4px dashed rgb(0, 151, 167) !important;\n}\n\n",eI="@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {"+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+" { flex-basis: auto !important; } "+Ew(RT.any)+Ew(RT.row)+" > "+Ew(RT.any)+Ew(RT.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"+Zw,tI=function(e){return{$:"Intermediate",a:e}},rI=r(function(e,t){return tI({closing:t,others:yr,props:yr,selector:e})}),nI=r(function(e,t){var n=e.a,a=r(function(e,t){switch(e.$){case"Prop":var r=e.a,a=e.b;return D(t,{props:f(ka,L(r,a),t.props)});case"Supports":var i=e.a,o=i.a,u=i.b,s=e.b;return D(t,{others:f(ka,tI({closing:"\n}",others:yr,props:s,selector:"@supports ("+o+":"+u+") {"+n.selector}),t.others)});case"Adjacent":var c=e.a,l=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" + "+c,""),l),t.others)});case"Child":var d=e.a,h=e.b;return D(t,{others:f(ka,f(nI,f(rI,n.selector+" > "+d,""),h),t.others)});case"Descriptor":var p=e.a,g=e.b;return D(t,{others:f(ka,f(nI,f(rI,U(n.selector,p),""),g),t.others)});default:var v=e.a;return D(t,{others:f(ka,f(nI,f(rI,n.selector,""),v),t.others)})}});return tI(l(La,a,n,t))}),aI=U(eI,function(e){var t=function(e){return Cd(f(xa,function(e){return e.a+":"+e.b+";"},e))},n=function(e){return e.props.b?e.selector+"{"+t(e.props)+e.closing+"}":""},a=function(e){var t=e.a;return U(n(t),Cd(f(xa,a,t.others)))};return Cd(f(xa,a,l(La,r(function(e,t){var r=e.a,n=e.b;return f(ka,f(nI,f(rI,r,""),n),t)}),yr,e)))}(U(Jw,Xw))),iI=l(JT,"style",yr,M([Tw(aI)])),oI=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+'"'}},uI=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}},sI=function(e){if("FontWith"===e.$){var t=e.a;return f(Ch,uI,t.variants)}return!1},cI=n(function(e,t,r){var n=t.a,a=t.b;return e?r+"\n "+n+": "+a+" !important;":r+"\n "+n+": "+a+";"}),fI=r(function(e,t){return e+" {"+f(Ri,"",f(xa,function(e){return e.a+": "+e.b+";"},t))+"}"}),lI=n(function(e,t,r){var n=r.a,a=r.b;return M([f(fI,"."+e+"."+t+", ."+e+" ."+t,n),f(fI,"."+e+"."+t+"> ."+RT.text+", ."+e+" ."+t+" > ."+RT.text,a)])}),dI=n(function(e,t,r){var n=t.a,a=t.b,i=R(e,r)?e:r+" ."+e;return f(Ri," ",U(l(lI,i,RT.sizeByCapital,a),l(lI,i,RT.fullSize,n)))}),hI=r(function(e,t){var r=R(e,t)?e:t+" ."+e;return f(Ri," ",M([f(fI,"."+r+"."+RT.sizeByCapital+", ."+r+" ."+RT.sizeByCapital,M([L("line-height","1")])),f(fI,"."+r+"."+RT.sizeByCapital+"> ."+RT.text+", ."+r+" ."+RT.sizeByCapital+" > ."+RT.text,M([L("vertical-align","0"),L("line-height","1")]))]))}),pI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,ei,t,r))}return ci},gI=function(e){if(e.b){var t=e.a,r=e.b;return si(l(Ra,Tc,t,r))}return ci},vI=n(function(e,t,r){return{height:t/e,size:e,vertical:r}}),yI=function(e){var t=M([e.capital,e.baseline,e.descender,e.lowercase]),r=f(xc,e.descender,gI(t)),n=f(xc,e.baseline,gI(f(ml,function(e){return!R(e,r)},t))),a=f(xc,e.capital,pI(t)),i=1/(a-n),o=1-a,u=1/(a-r),s=1-a;return{capital:l(vI,i,a-n,o),full:l(vI,u,a-r,s)}},mI=function(e){return L(M([L("display","block")]),M([L("display","inline-block"),L("line-height",mw(e.height)),L("vertical-align",mw(e.vertical)+"em"),L("font-size",mw(e.size)+"em")]))},bI=function(e){return l(Ra,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 si(L(mI(function(e){return e.full}(yI(a))),mI(function(e){return e.capital}(yI(a)))))}return t}return t}),ci,e)},CI=function(e){var t=function(e){if("ImportFont"===e.$){var t=e.b;return si("@import url('"+t+"');")}return ci},r=function(e){var r=(e.a,e.b);return f(Ri,"\n",f(US,t,r))},n=f(xa,Qa,e),a=function(e){var t=e.a,r=e.b,a=bI(r);if("Nothing"===a.$)return f(Ri,"",f(xa,hI(t),n));var i=a.a;return f(Ri,"",f(xa,f(dI,t,i),n))};return U(f(Ri,"\n",f(xa,r,e)),f(Ri,"\n",f(xa,a,e)))},EI=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+'" '+Ni(r)}},SI=function(e){if("FontWith"===e.$){var t=e.a;return si(f(Ri,", ",f(xa,EI,t.variants)))}return ci},TI=function(e){if("FontFamily"===e.$){var t=e.a,r=e.b;return si(L(t,r))}return ci},wI=function(e){switch(e.$){case"Untransformed":return ci;case"Moved":var t=e.a,r=t.a,n=t.b,a=t.c;return si("translate3d("+mw(r)+"px, "+mw(n)+"px, "+mw(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("+mw(o)+"px, "+mw(u)+"px, "+mw(s)+"px)",b="scale3d("+mw(f)+", "+mw(l)+", "+mw(d)+")",C="rotate3d("+mw(p)+", "+mw(g)+", "+mw(v)+", "+mw(y)+"rad)";return si(m+" "+b+" "+C)}},II=r(function(e,t){var a=n(function(t,r,n){if("Nothing"===t.$)return r+"{"+l(Ra,cI(!1),"",n)+"\n}";switch(t.a.$){case"Hover":switch(e.hover.$){case"NoHover":return"";case"ForceHover":return r+"-hv {"+l(Ra,cI(!0),"",n)+"\n}";default:return r+"-hv:hover {"+l(Ra,cI(!1),"",n)+"\n}"}case"Focus":var a=l(Ra,cI(!1),"",n);return f(Ri,"\n",M([r+"-fs:focus {"+a+"\n}","."+RT.any+":focus ~ "+r+"-fs:not(.focus) {"+a+"\n}","."+RT.any+":focus "+r+"-fs {"+a+"\n}",".focusable-parent:focus ~ ."+RT.any+" "+r+"-fs {"+a+"\n}"]));default:return r+"-act:active {"+l(Ra,cI(!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,M([f(vw,"box-shadow",s)]));case"Transparency":var u=e.a,c=e.b,d=f(ei,0,f(Tc,1,1-c));return l(a,t,"."+u,M([f(vw,"opacity",mw(d))]));case"FontSize":var h=e.a;return l(a,t,".font-size-"+Ni(h),M([f(vw,"font-size",Ni(h)+"px")]));case"FontFamily":var u=e.a,p=e.b,g=f(Ri,", ",f(US,SI,p)),v=M([f(vw,"font-family",f(Ri,", ",f(xa,oI,p))),f(vw,"font-feature-settings",g),f(vw,"font-variant",f(Ch,sI,p)?"small-caps":"normal")]);return f(Ri," ",M([l(a,t,"."+u,v)]));case"Single":var y=e.a,s=e.b,m=e.c;return l(a,t,"."+y,M([f(vw,s,m)]));case"Colored":var y=e.a,s=e.b,b=e.c;return l(a,t,"."+y,M([f(vw,s,bw(b))]));case"SpacingStyle":var C=e.a,E=e.b,S=e.c,T=Ni(S)+"px",w=Ni(E)+"px",I="."+RT.row,A="."+(RT.wrapped+I),B="."+RT.alignRight,k="."+RT.paragraph,N="."+RT.page,R="."+RT.alignLeft,$=mw(S/2)+"px",_=mw(E/2)+"px",x="."+RT.column,y="."+C,P="."+RT.any;return Cd(M([l(a,t,y+(I+" > ")+P+" + "+P,M([f(vw,"margin-left",w)])),l(a,t,y+(A+" > ")+P,M([f(vw,"margin",$+" "+_)])),l(a,t,y+(x+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+P+" + "+P,M([f(vw,"margin-top",T)])),l(a,t,y+(N+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(N+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,U(y,k),M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,"textarea"+y,M([f(vw,"line-height","calc(1em + "+Ni(S)+"px)")])),l(a,t,y+(k+" > ")+R,M([f(vw,"margin-right",w)])),l(a,t,y+(k+" > ")+B,M([f(vw,"margin-left",w)])),l(a,t,y+(k+"::after"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-top",Ni(-1*(S/2|0))+"px")])),l(a,t,y+(k+"::before"),M([f(vw,"content","''"),f(vw,"display","block"),f(vw,"height","0"),f(vw,"width","0"),f(vw,"margin-bottom",Ni(-1*(S/2|0))+"px")]))]));case"PaddingStyle":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"padding",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"BorderWidth":var C=e.a,D=e.b,B=e.c,O=e.d,R=e.e,y="."+C;return l(a,t,y,M([f(vw,"border-width",Ni(D)+"px "+Ni(B)+"px "+Ni(O)+"px "+Ni(R)+"px")]));case"GridTemplateStyle":var F=e.a,V=n(function(e,t,r){e:for(;;)switch(r.$){case"Px":var n=r.a;return Ni(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, "+Ni(i)+"px)"}if("Nothing"===a.b.$){var o=a.a.a;a.b;return"minmax("+Ni(o)+"px, max-content)"}var o=a.a.a,i=a.b.a;return"minmax("+Ni(o)+"px, "+Ni(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 Ni(u)+"fr"}var i=(s.a,s.b.a);return"minmax(max-content, "+Ni(i)+"px)"}if("Nothing"===s.b.$){var o=s.a.a;s.b;return"minmax("+Ni(o)+"px, "+Ni(u)+"frfr)"}var o=s.a.a,i=s.b.a;return"minmax("+Ni(o)+"px, "+Ni(i)+"px)";case"Min":var c=r.a,f=r.b,l=si(c),d=t,h=f;e=l,t=d,r=h;continue e;default:var c=r.a,f=r.b,l=e,d=si(c),h=f;e=l,t=d,r=h;continue e}}),K=function(e){return l(V,ci,ci,e)},H=(K(F.spacing.a),K(F.spacing.b)),j=function(e){return"grid-template-rows: "+e+";"}(f(Ri," ",f(xa,K,F.rows))),q=function(e){return"-ms-grid-rows: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),G=function(e){return"-ms-grid-columns: "+e+";"}(f(Ri,H,f(xa,K,F.columns))),z="grid-row-gap:"+K(F.spacing.b)+";",Y="grid-column-gap:"+K(F.spacing.a)+";",W=function(e){return"grid-template-columns: "+e+";"}(f(Ri," ",f(xa,K,F.columns))),y=".grid-rows-"+f(Ri,"-",f(xa,lw,F.rows))+"-cols-"+f(Ri,"-",f(xa,lw,F.columns))+"-space-x-"+lw(F.spacing.a)+"-space-y-"+lw(F.spacing.b),J=y+"{"+W+j+Y+z+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+G+q+"}";return U(X,Q);case"GridPosition":var Z=e.a,ee=f(Ri," ",M(["-ms-grid-row: "+Ni(Z.row)+";","-ms-grid-row-span: "+Ni(Z.height)+";","-ms-grid-column: "+Ni(Z.col)+";","-ms-grid-column-span: "+Ni(Z.width)+";"])),te=f(Ri," ",M(["grid-row: "+Ni(Z.row)+" / "+Ni(Z.row+Z.height)+";","grid-column: "+Ni(Z.col)+" / "+Ni(Z.col+Z.width)+";"])),y=".grid-pos-"+Ni(Z.row)+"-"+Ni(Z.col)+"-"+Ni(Z.width)+"-"+Ni(Z.height),J=y+"{"+te+"}",Q="@supports (display:grid) {"+J+"}",X=y+"{"+ee+"}";return U(X,Q);case"PseudoSelector":var y=e.a,re=e.b;return f(Ri," ",f(xa,function(e){return f(i,e,si(y))},re));default:var ne=e.a,m=wI(ne),y=hw(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,M([f(vw,"transform",ie)]))}return""}}),o=r(function(e,t){return{rules:U(t.rules,f(i,e,ci)),topLevel:function(){var r=TI(e);if("Nothing"===r.$)return t.topLevel;var n=r.a;return f(ka,n,t.topLevel)}()}}),u=l(Ra,o,{rules:"",topLevel:yr},t),s=u.topLevel,c=u.rules;return U(CI(s),c)}),AI=r(function(e,t){return l(JT,"style",yr,M([Tw(f(II,e,t))]))}),BI=a(function(e,t,r,n){return e?f(ka,L("static-stylesheet",iI),f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)):f(ka,L("dynamic-stylesheet",f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b)),n)}),kI=a(function(e,t,r,n){return e?f(ka,iI,f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)):f(ka,f(AI,t,l(Ra,gw,L(sm,M([Sw(t.focus)])),r).b),n)}),NI=o(function(e,t,n,a,i,o){var u=r(function(e,t){if("Keyed"===a.$){var r=a.a;return l(WT,e,t,function(){switch(i.$){case"NoStyleSheet":return r;case"OnlyDynamic":var e=i.a,t=i.b;return d(BI,!1,e,t,r);default:var e=i.a,t=i.b;return d(BI,!0,e,t,r)}}())}var n=a.a;return f(function(){switch(e){case"div":return jT;case"p":return qT;default:return JT(e)}}(),t,function(){switch(i.$){case"NoStyleSheet":return n;case"OnlyDynamic":var e=i.a,t=i.b;return d(kI,!1,e,t,n);default:var e=i.a,t=i.b;return d(kI,!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(JT,e,n,M([f(u,r,M([YT(RT.any+" "+RT.single)]))]))}}();switch(o.$){case"AsRow":return f(ow,sw,e)&&!f(ow,uw,e)?s:f(ow,tw,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerRight])))]),M([s])):f(ow,rw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.contentCenterY,RT.alignContainerCenterX])))]),M([s])):s;case"AsColumn":return f(ow,iw,e)&&!f(ow,aw,e)?s:f(ow,nw,e)?f(GT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerCenterY])))]),M([s])):f(ow,ew,e)?f(zT,M([YT(f(Ri," ",M([RT.any,RT.single,RT.container,RT.alignContainerBottom])))]),M([s])):s;default:return s}}),RI=Tw,$I=function(e){return f(jT,M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthContent,RT.heightContent])))]),M([RI(e)]))},_I=function(e){return l(JT,"div",M([YT(f(Ri," ",M([RT.any,RT.text,RT.widthFill,RT.heightFill])))]),M([Tw(e)]))},LI=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 R(e,HT),L(f(ka,L(n,u(e)),i),o);case"Styled":var s=a.a;return R(e,HT),L(f(ka,L(n,f(s.html,MT,e)),i),Iu(o)?s.styles:U(s.styles,o));case"Text":var c=a.a;return L(f(ka,L(n,R(e,AT)?_I(c):$I(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 R(e,HT),L(f(ka,i(e),n),a);case"Styled":var o=t.a;return R(e,HT),L(f(ka,f(o.html,MT,e),n),Iu(a)?o.styles:U(o.styles,a));case"Text":var u=t.a;return L(f(ka,R(e,AT)?_I(u):$I(u),n),a);default:return L(n,a)}});if("Keyed"===t.$){var o=t.a,u=l(La,a,L(yr,yr),o),s=u.a,c=u.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,OT(l(VT,"nearby-element-pls",s,n.children)),MT))}var v=t.a,y=l(La,i,L(yr,yr),v),m=y.a,c=y.b,p=Iu(c)?n.styles:U(n.styles,c);if(p.b){var g=p;return ji({html:d(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children))),styles:g})}return Gi(h(NI,n.has,n.node,n.attributes,wT(f(FT,m,n.children)),MT))}),xI=r(function(e,t){return f(Nn,Ze(e),rt(t))}),PI=r(function(e,t){var r=t.a,n=t.b;if("Flag"===e.$){var a=e.a;return f(BT,a|r,n)}var i=e.a;return f(BT,r,i|n)}),DI=ZT(7),UI=ZT(36),OI=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return f(BT,r|a,n|i)}),MI=ZT(6),FI=ZT(38),VI=ZT(30),KI=ZT(29),HI=r(function(e,t){return{$:"Embedded",a:e,b:t}}),jI=n(function(e,t,r){return{$:"Single",a:e,b:t,c:r}}),qI=function(e){return{$:"Transform",a:e}},GI=function(e){return{$:"ChildrenBehind",a:e}},zI=r(function(e,t){return{$:"ChildrenBehindAndInFront",a:e,b:t}}),YI=function(e){return{$:"ChildrenInFront",a:e}},WI=r(function(e,t){return f(jT,M([YT(function(){switch(e.$){case"Above":return f(Ri," ",M([RT.nearby,RT.single,RT.above]));case"Below":return f(Ri," ",M([RT.nearby,RT.single,RT.below]));case"OnRight":return f(Ri," ",M([RT.nearby,RT.single,RT.onRight]));case"OnLeft":return f(Ri," ",M([RT.nearby,RT.single,RT.onLeft]));case"InFront":return f(Ri," ",M([RT.nearby,RT.single,RT.inFront]));default:return f(Ri," ",M([RT.nearby,RT.single,RT.behind]))}}())]),M([function(){switch(t.$){case"Empty":return Tw("");case"Text":var e=t.a;return $I(e);case"Unstyled":return(0,t.a)(AT);default:return f(t.a.html,MT,AT)}}()]))}),JI=n(function(e,t,r){var n=f(WI,e,t);switch(r.$){case"NoNearbyChildren":return"Behind"===e.$?GI(M([n])):YI(M([n]));case"ChildrenBehind":var a=r.a;return"Behind"===e.$?GI(f(ka,n,a)):f(zI,a,M([n]));case"ChildrenInFront":var i=r.a;return"Behind"===e.$?f(zI,M([n]),i):YI(f(ka,n,i));default:var a=r.a,i=r.b;return"Behind"===e.$?f(zI,f(ka,n,a),i):f(zI,a,f(ka,n,i))}}),QI=r(function(e,t){switch(t.$){case"Generic":return TT(e);case"NodeName":var r=t.a;return f(HI,r,e);default:var n=t.a,a=t.b;return f(HI,n,a)}}),XI=function(e){switch(e.$){case"Left":return RT.alignedHorizontally+" "+RT.alignLeft;case"Right":return RT.alignedHorizontally+" "+RT.alignRight;default:return RT.alignedHorizontally+" "+RT.alignCenterX}},ZI=function(e){switch(e.$){case"Top":return RT.alignedVertically+" "+RT.alignTop;case"Bottom":return RT.alignedVertically+" "+RT.alignBottom;default:return RT.alignedVertically+" "+RT.alignCenterY}},eA=a(function(e,t,r,n){return{$:"FullTransform",a:e,b:t,c:r,d:n}}),tA=function(e){return{$:"Moved",a:e}},rA=r(function(e,t){switch(e.$){case"Untransformed":switch(t.$){case"MoveX":var r=t.a;return tA(x(r,0,0));case"MoveY":var n=t.a;return tA(x(0,n,0));case"MoveZ":var a=t.a;return tA(x(0,0,a));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,x(0,0,0),x(1,1,1),i,o);default:var i=t.a;return d(eA,x(0,0,0),i,x(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 tA(x(s,n,a));case"MoveY":var c=t.a;return tA(x(r,c,a));case"MoveZ":var f=t.a;return tA(x(r,n,f));case"MoveXYZ":var i=t.a;return tA(i);case"Rotate":var i=t.a,o=t.b;return d(eA,u,x(1,1,1),i,o);default:var l=t.a;return d(eA,u,l,x(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(eA,x(s,n,a),h,p,o);case"MoveY":var c=t.a;return d(eA,x(r,c,a),h,p,o);case"MoveZ":var f=t.a;return d(eA,x(r,n,f),h,p,o);case"MoveXYZ":var g=t.a;return d(eA,g,h,p,o);case"Rotate":var v=t.a,y=t.b;return d(eA,u,h,v,y);default:var m=t.a;return d(eA,u,m,p,o)}}}),nA=function(e){switch(e.$){case"Px":var t=e.a,r=Ni(t),n="height-px-"+r;return x(kT,n,M([l(jI,n,"height",r+"px")]));case"Content":return x(f(PI,UI,kT),RT.heightContent,yr);case"Fill":var a=e.a;return 1===a?x(f(PI,iw,kT),RT.heightFill,yr):x(f(PI,iw,kT),RT.heightFillPortion+" height-fill-"+Ni(a),M([l(jI,RT.any+"."+RT.row+" > "+Ew("height-fill-"+Ni(a)),"flex-grow",Ni(1e5*a))]));case"Min":var i=e.a,o=e.b,u="min-height-"+Ni(i),s=l(jI,u,"min-height",Ni(i)+"px"),c=nA(o),d=c.a,h=c.b,p=c.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p));default:var g=e.a,o=e.b,u="max-height-"+Ni(g),s=l(jI,u,"max-height",Ni(g)+"px"),v=nA(o),d=v.a,h=v.b,p=v.c;return x(f(PI,aw,d),u+" "+h,f(ka,s,p))}},aA=function(e){switch(e.$){case"Px":var t=e.a;return x(kT,RT.widthExact+" width-px-"+Ni(t),M([l(jI,"width-px-"+Ni(t),"width",Ni(t)+"px")]));case"Content":return x(f(PI,FI,kT),RT.widthContent,yr);case"Fill":var r=e.a;return 1===r?x(f(PI,sw,kT),RT.widthFill,yr):x(f(PI,sw,kT),RT.widthFillPortion+" width-fill-"+Ni(r),M([l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(r)),"flex-grow",Ni(1e5*r))]));case"Min":var n=e.a,a=e.b,i="min-width-"+Ni(n),o=l(jI,i,"min-width",Ni(n)+"px"),u=aA(a),s=u.a,c=u.b,d=u.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d));default:var h=e.a,a=e.b,i="max-width-"+Ni(h),o=l(jI,i,"max-width",Ni(h)+"px"),p=aA(a),s=p.a,c=p.b,d=p.c;return x(f(PI,uw,s),i+" "+c,f(ka,o,d))}},iA=ZT(27),oA=r(function(e,t){if(R(e,iA)){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 R(n,i)&&R(n,a)&&R(n,o)&&n>=0&&n<=24;default:return!1}}),uA=s(function(e,t,r,n,a,i,o,u){e:for(;;){if(!u.b){var s=hw(n);if("Nothing"===s.$)return{attributes:f(ka,YT(e),i),children:o,has:r,node:t,styles:a};var c=s.a;return{attributes:f(ka,YT(e+" "+c),i),children:o,has:r,node:t,styles:f(ka,qI(n),a)}}var d=u.a,h=u.b;switch(d.$){case"NoAttribute":var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Class":var S=d.a,T=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=T+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Attr":var w=d.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,w,i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"StyleClass":var S=d.a,I=d.b;if(f(ow,S,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(f(oA,S,I)){var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=pw(I)+" "+e,g=t,v=f(PI,S,r),y=n,m=f(ka,I,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"TransformComponent":var S=d.a,A=d.b,p=e,g=t,v=f(PI,S,r),y=f(rA,n,A),m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Width":var B=d.a;if(f(ow,MI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(B.$){case"Px":var k=B.a,p=RT.widthExact+" width-px-"+Ni(k)+" "+e,g=t,v=f(PI,MI,r),y=n,m=f(ka,l(jI,"width-px-"+Ni(k),"width",Ni(k)+"px"),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=e+" "+RT.widthContent,g=t,v=f(PI,FI,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=B.a;if(1===N){var p=e+" "+RT.widthFill,g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.widthFillPortion+" width-fill-"+Ni(N),g=t,v=f(PI,sw,f(PI,MI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.row+" > "+Ew("width-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var R=aA(B),$=R.a,_=R.b,L=R.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Height":var x=d.a;if(f(ow,DI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}switch(x.$){case"Px":var k=x.a,P=Ni(k)+"px",D="height-px-"+P,p=D+" "+e,g=t,v=f(PI,DI,r),y=n,m=f(ka,l(jI,D,"height ",P),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Content":var p=RT.heightContent+" "+e,g=t,v=f(PI,UI,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Fill":var N=x.a;if(1===N){var p=RT.heightFill+" "+e,g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e+" "+RT.heightFillPortion+" height-fill-"+Ni(N),g=t,v=f(PI,iw,f(PI,DI,r)),y=n,m=f(ka,l(jI,RT.any+"."+RT.column+" > "+Ew("height-fill-"+Ni(N)),"flex-grow",Ni(1e5*N)),a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var O=nA(x),$=O.a,_=O.b,L=O.c,p=e+" "+_,g=t,v=f(OI,$,r),y=n,m=U(L,a),b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Describe":var M=d.a;switch(M.$){case"Main":var p=e,g=f(QI,"main",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Navigation":var p=e,g=f(QI,"nav",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"ContentInfo":var p=e,g=f(QI,"footer",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Complementary":var p=e,g=f(QI,"aside",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Heading":var F=M.a;if(F<=1){var p=e,g=f(QI,"h1",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}if(F<7){var p=e,g=f(QI,"h"+Ni(F),t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=e,g=f(QI,"h6",t),v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Paragraph":var V=function(){switch(t.$){case"Generic":return TT("p");case"NodeName":var e=t.a;return TT(e);default:var r=t.a,n=t.b;return f(HI,r,n)}}(),p=e,g=V,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Button":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"role","button"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"Label":var K=M.a,p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-label",K),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"LivePolite":var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","polite"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var p=e,g=t,v=r,y=n,m=a,b=f(ka,f(xI,"aria-live","assertive"),i),C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}case"Nearby":var H=d.a,j=d.b,L=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 U(a,e.styles)}}(),p=e,g=t,v=r,y=n,m=L,b=i,C=l(JI,H,j,o),E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;case"AlignX":var q=d.a;if(f(ow,VI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=XI(q)+" "+e,g=t,v=function(e){switch(q.$){case"CenterX":return f(PI,rw,e);case"Right":return f(PI,tw,e);default:return e}}(f(PI,VI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e;default:var G=d.a;if(f(ow,KI,r)){var p=e,g=t,v=r,y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}var p=ZI(G)+" "+e,g=t,v=function(e){switch(G.$){case"CenterY":return f(PI,nw,e);case"Bottom":return f(PI,ew,e);default:return e}}(f(PI,KI,r)),y=n,m=a,b=i,C=o,E=h;e=p,t=g,r=v,n=y,a=m,i=b,o=C,u=E;continue e}}}),sA={$:"Untransformed"},cA=sA,fA=a(function(e,t,r,n){return l(LI,e,n,v(uA,UT(e),t,kT,cA,yr,yr,NT,$a(r)))}),lA=function(e){return ST(YT(e))},dA=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ST(gT("_blank")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e)))))),wT(M([n])))}),hA=a(function(e,t,r,n){return{$:"Rgba",a:e,b:t,c:r,d:n}}),pA=n(function(e,t,r){return d(hA,e,t,r,1)}),gA=ZT(14),vA=n(function(e,t,r){return{$:"Colored",a:e,b:t,c:r}}),yA=r(function(e,t){return{$:"StyleClass",a:e,b:t}}),mA=function(e){var t=e.a,r=e.b,n=e.c,a=e.d;return dw(t)+"-"+dw(r)+"-"+dw(n)+"-"+dw(a)},bA=function(e){return f(yA,gA,l(vA,"fc-"+mA(e),"color",e))},CA={align:ul,label:"cantConnectNoWeb3",mainParagraphs:M([M([fl("You need a web3 provider (such as "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(") to Connect.")]),M([fl("Until you connect, DAIHard will operate in read-only mode.")])]),noticeType:xg},EA={align:ul,label:"invalidUrl",mainParagraphs:M([M([fl("I don't understand that URL...")]),M([fl("I'll just set you down here. Maybe check the URL and try again?")])]),noticeType:$g},SA=function(e){return{$:"Active",a:e}},TA=function(e){return{$:"OnlyNetwork",a:e}},wA=gu(f(zo,jf,f(zo,Hh,$d("Error decoding hex to BigInt")))),IA=function(){return gu(function(e){switch(e){case"0x0":return li(!1);case"0x1":return li(!0);default:return fi("Error decoding "+e+"as bool.")}})}(),AA=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}}}}}}}}}}}},BA=function(e){return Em(M([f(Oi,si,e),Fi(ci)]))},kA=f(dh,BA(f(Oh,"status",IA)),f(dh,BA(f(Oh,"root",pu)),l(Im,"logsBloom",pu,l(Im,"logs",Mm(Fm),f(dh,BA(f(Oh,"contractAddress",Am)),l(Im,"cumulativeGasUsed",wA,l(Im,"gasUsed",wA,l(Im,"blockNumber",Gy,l(Im,"blockHash",Rm,l(Im,"transactionIndex",Gy,l(Im,"transactionHash",Dm,Fi(AA)))))))))))),NA=function(e){var t=e.a;return jf(t)},RA=f(zo,NA,hl),$A=r(function(e,t){return Up({decoder:kA,method:"eth_getTransactionReceipt",params:M([RA(t)]),url:e})}),_A=n(function(e,t,r){return{$:"TrackTx",a:e,b:t,c:r}}),LA=r(function(e,t){return{$:"TxMined",a:e,b:t}}),xA=r(function(e,t){return{$:"TxSent",a:e,b:t}}),PA=r(function(e,t){return f(Bo,function(e){return e.toMsg},f(Io,function(e){return e.b},f(Io,function(e){return e.onMinedTagger},f(fp,t,e))))}),DA=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}}}}}}}}}}}},UA=function(e){return Em(M([Cm(ci),f(Oi,si,e)]))},OA=l(Im,"input",pu,l(Im,"gas",Gy,l(Im,"gasPrice",wA,l(Im,"value",wA,l(Im,"to",UA(Am),l(Im,"from",Am,l(Im,"transactionIndex",Gy,l(Im,"blockNumber",UA(Gy),l(Im,"blockHash",function(e){return f(du,function(t){return"0x"===t||"0x0"===t?Fi(ci):f(ki,function(e){return R(e,P("0"))},cu(t))?Fi(ci):f(Oi,si,e)},pu)}(Rm),l(Im,"nonce",Gy,l(Im,"hash",Dm,Fi(DA)))))))))))),MA=r(function(e,t){return Up({decoder:OA,method:"eth_getTransactionByHash",params:M([RA(t)]),url:e})}),FA=r(function(e,t){return{attempts:e,sleep:t}}),VA=r(function(e,t){var r=e.attempts,n=e.sleep,a=r-1;return f(Xp,function(e){return a>0?f(Kp,function(e){return f(VA,f(FA,a,n),t)},bS(1e3*n)):Lp(e)},t)}),KA=r(function(e,t){return f(Kp,function(r){return f(VA,{attempts:30,sleep:1},f(MA,e,t))},bS(250))}),HA=r(function(e,t){return f(VA,{attempts:60,sleep:5},f($A,e,t))}),jA=function(e){return{$:"Mined",a:e}},qA=function(e){return Bo(function(t){return D(t,{status:jA(e)})})},GA=function(e){return{$:"Sent",a:e}},zA=function(e){return Bo(function(t){return D(t,{status:GA(e)})})},YA=function(e){return{$:"Signed",a:e}},WA=function(e){return Bo(function(t){return D(t,{status:YA(e)})})},JA=function(e){return"Nothing"!==e.$},QA=r(function(e,t){var r=t.a;switch(e.$){case"NoOp":return L(Tl(r),Do);case"TxSigned":var n=e.a,a=e.b,i=f(fp,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(Yg,t,xp(a))}return Do}(),s=function(e){var t=x(o.onSignedTagger,o.onBroadcastTagger,o.onMinedTagger);if("Just"===t.a.$)return Do;if("Just"===t.b.$){var r=t.b.a;return f(Yg,r,xp(fi(e)))}if("Just"===t.c.$){var n=t.c.a,a=n.a;return f(Yg,a,xp(fi(e)))}t.a,t.b,t.c;return Do};if("Ok"===a.$){var c=a.a,d=JA(o.onBroadcastTagger)||JA(o.onMinedTagger)?f(il,r.tagger,f(Zp,xA(n),f(KA,r.nodePath,c))):Do;return L(Tl(D(r,{txs:l(bp,n,WA(c),r.txs)})),Po(M([u,d])))}var h=a.a;return L(Tl(r),Po(M([u,s(h)])))}return L(Tl(r),Do);case"TxSent":var n=e.a,p=e.b,g=f(fp,n,r.txs);if("Just"===g.$){var o=g.a;if("Ok"===p.$){var v=p.a,y=function(){return"Just"===o.onMinedTagger.$?f(il,r.tagger,f(Zp,LA(n),f(HA,r.nodePath,v.hash))):Do}(),d=function(){var e=o.onBroadcastTagger;if("Just"===e.$){var t=e.a;return f(Yg,t,xp(li(v)))}return Do}();return L(Tl(D(r,{txs:l(bp,n,zA(v),r.txs)})),Po(M([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(Yg,t,xp(fi("Error with TxSent stuff")))}if("Just"===e.b.$){var r=e.b.a,n=r.a;return f(Yg,n,xp(fi("Error with TxSent stuff")))}e.a,e.b;return Do}();return L(Tl(r),s)}return L(Tl(r),Do);case"TxMined":var n=e.a,m=e.b,b=f(fp,n,r.txs);if("Just"===b.$){var o=b.a;if("Ok"===m.$){var C=m.a,E=function(){var e=o.onMinedTagger;if("Just"===e.$){if("Nothing"===e.a.b.$){var t=e.a,a=t.a;t.b;return f(Yg,a,xp(li(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 Po(M([f(il,r.tagger,f(Zp,f(_A,n,s),zy(r.nodePath))),f(Yg,a,xp(li(C))),f(Yg,u.toMsg,xp(s))]))}return Do}();return L(Tl(D(r,{txs:l(bp,n,qA(C),r.txs)})),E)}var h=m.a,S=function(){var e=o.onMinedTagger;if("Just"===e.$){var t=e.a,r=t.a;return f(Yg,r,xp(fi("TxReceipt decoding failure")))}return Do}();return L(Tl(r),S)}return L(Tl(r),Do);case"TrackTx":if("Ok"===e.c.$){var n=e.a,T=e.b,w=e.c.a,I=D(T,{currentDepth:w-T.minedInBlock+1,lastCheckedBlock:w});if(R(w,T.stopWatchingAtBlock)){var A=f(PA,r.txs,n);if("Just"===A.$){var B=A.a;return L(Tl(r),f(Yg,B,f(Xp,function(e){return xp(D(I,{doneWatching:!0,reOrg:!0}))},f(Kp,function(e){return xp(D(I,{doneWatching:!0}))},f($A,r.nodePath,T.txHash)))))}return L(Tl(r),Do)}if(R(w,T.lastCheckedBlock))return L(Tl(r),f(il,r.tagger,f(Zp,f(_A,n,T),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))));var k=f(PA,r.txs,n);if("Just"===k.$){var B=k.a;return L(Tl(r),Po(M([f(il,r.tagger,f(Zp,f(_A,n,I),f(Kp,function(e){return zy(r.nodePath)},bS(2e3)))),f(Yg,B,xp(I))])))}return L(Tl(r),Do)}var n=e.a,h=e.c.a;return L(Tl(r),Do);default:var h=e.a;return L(Tl(r),Do)}}),XA=Jt,ZA=r(function(e,t){if("Nothing"===e.$)return t;var r=e.a;return t+":"+Ni(r)}),eB=n(function(e,t,r){return"Nothing"===t.$?r:U(r,U(e,t.a))}),tB=function(e){var t=function(){return"Http"===e.protocol.$?"http://":"https://"}();return l(eB,"#",e.fragment,l(eB,"?",e.query,U(f(ZA,e.port_,U(t,e.host)),e.path)))},rB=r(function(e,t){return e<0?ci:Ql(f(nd,e,t))}),nB=r(function(e,t){if(e<0)return t;var r=Bh(f(nd,e,t)),n=f(lc,e,t);if("Nothing"===r.$)return t;var a=r.a;return f(oo,n,a)}),aB=n(function(e,t,r){if(e<0)return r;var n=f(nd,e,r),a=f(lc,e,r);if(n.b){var i=n.a,o=n.b;return U(a,f(ka,t(i),o))}return r}),iB=r(function(e,t){return f(aB,e,ms(t))}),oB=r(function(e,t){Kv(t);switch(t.$){case"Home":return L(D(e,{submodel:sT}),Do);case"Create":var r=Xd(e.wallet),n=f(Ul,e.txSentry,f(Yo,Uy,r.chainCmd)),a=n.a,i=n.b,o=n.c;return f(sB,U(f(Qi,Uy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:Dy(r.model),txSentry:a}),Po(M([f(il,Uy,r.cmd),i]))));case"Trade":var u=t.a,s=t.b,r=function(){var t=l(By,u,s,e.tradeCaches);if("Just"===t.$&&"LoadedTrade"===t.a.$){var r=t.a.a;return f(Wm,e.wallet,r)}return l(vm,e.wallet,u,s)}(),c=f(Ul,e.txSentry,f(Yo,Fy,r.chainCmd)),a=c.a,i=c.b,o=c.c;return f(sB,U(f(Qi,Fy,r.appCmds),f(xa,pa,o)),L(D(e,{submodel:My(r.model),txSentry:a}),Po(M([f(il,Fy,r.cmd),i]))));case"Marketplace":var d=Bv(e.wallet),h=d.a,p=d.b;return L(D(e,{submodel:Oy(h)}),Po(M([f(il,fT,p)])));case"AgentHistory":var g=t.a,v=f(Uo,e.wallet,g),y=v.a,m=v.b;return L(D(e,{submodel:Py(y)}),Po(M([f(il,oT,m)])));default:return L(f(uo,EA,e),Do)}}),uB=r(function(e,t){var r=t.a,n=t.b,a=f(cB,uT(e),r),i=a.a,o=a.b;return L(i,Po(M([n,o])))}),sB=r(function(e,t){var r=t.a,n=t.b;return l(Ra,uB,L(r,n),e)}),cB=r(function(e,t){switch(e.$){case"AppCmd":var r=e.a;switch(r.$){case"Web3Connect":return f(cB,cT,t);case"GotoRoute":var n=r.a;return L(t,f(Cy,t.key,n));case"GTag":var a=r.a;return L(t,wy(Sy(a)));case"UserNotice":var i=r.a;return L(f(uo,i,t),wy(Sy(d(Ol,"user notice","user notice",i.label,0))));case"BrowserNotification":var o=r.a,u=r.b,s=r.c;return L(t,d(Uv,ky,o,u,s));default:return L(t,Ny(gr))}case"DismissNotice":var c=e.a;return L(D(t,{userNotices:f(nB,c,t.userNotices)}),Do);case"LinkClicked":var h=e.a,p=function(){if("Internal"===h.$){var e=h.a;return f(by,t.key,tB(e))}var r=h.a;return XA(r)}();return L(t,p);case"UrlChanged":var g=e.a;return f(fB,g,t);case"GotoRoute":var v=e.a;return L(t,Po(M([wy(Sy(d(Ol,"GotoRoute","navigation",Kv(v),0))),f(Cy,t.key,v)])));case"Tick":var y=e.a;return L(D(t,{time:y}),Do);case"ConnectToWeb3":return"NoneDetected"===t.wallet.$?L(f(uo,CA,t),Do):L(t,Ey(gr));case"WalletStatus":var m=e.a,b=function(){var e=m.account;if("Nothing"===e.$)return Do;var t=e.a;return Iy(f(Ty,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(D(t,{userAddress:m.account,wallet:TA(m.networkId)}),b);case"UserPubkeySet":var C=e.a,E=f(Gh,pu,C);if("Ok"===E.$){var S=E.a,T=L(t.userAddress,t.wallet);if("Just"===T.a.$){if("OnlyNetwork"===T.b.$){var w=T.a.a,I=T.b.a,A=SA(l(Ml,I,w,S)),B=f(Vy,A,t.submodel),k=B.a,p=B.b;return L(D(t,{submodel:k,wallet:A}),p)}return L(f(uo,f(ll,"Unexpected wallet state encounted when setting commPubkey!",L(t.userAddress,t.wallet)),t),Do)}T.a;return L(f(uo,f(ll,"User pubkey set, but I can no longer find the user address!",ci),t),Do)}var N=E.a;return L(l(Pa,uo,f(ll,"error decoding commPubkey from JS",N),t),Do);case"CreateMsg":var R=e.a,$=t.submodel;if("CreateModel"===$.$){var _=$.a,x=f(lv,R,_),P=f(Ul,t.txSentry,f(Yo,Uy,x.chainCmd)),O=P.a,F=P.b,V=P.c;return f(sB,U(f(Qi,Uy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Dy(x.model),txSentry:O}),Po(M([f(il,Uy,x.cmd),F]))))}return L(t,Do);case"TradeMsg":var K=e.a,H=t.submodel;if("TradeModel"===H.$){var j=H.a,x=f(BS,K,j),q=f(Ul,t.txSentry,f(Yo,Fy,x.chainCmd)),O=q.a,F=q.b,V=q.c;return f(sB,U(f(Qi,Fy,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:My(x.model),txSentry:O}),Po(M([f(il,Fy,x.cmd),F]))))}return L(t,Do);case"MarketplaceMsg":var G=e.a,z=t.submodel;if("MarketplaceModel"===z.$){var Y=z.a,x=f(Dv,G,Y);return f(sB,f(Qi,fT,x.appCmds),L(D(t,{submodel:Oy(x.model)}),f(il,fT,x.cmd)))}return L(t,Do);case"AgentHistoryMsg":var W=e.a,J=t.submodel;if("AgentHistoryModel"===J.$){var Q=J.a,x=f(ol,W,Q),X=f(Ul,t.txSentry,f(Yo,oT,x.chainCmd)),O=X.a,F=X.b,V=X.c;return f(sB,U(f(Qi,oT,x.appCmds),f(xa,pa,V)),L(D(t,{submodel:Py(x.model),txSentry:O}),Po(M([f(il,oT,x.cmd),F]))))}return L(t,Do);case"TxSentryMsg":var Z=e.a,ee=function(){var e=t.txSentry;if("Just"===e.$){var r=e.a;return f(_u,si,f(QA,Z,r))}return L(ci,Do)}(),O=ee.a,te=ee.b;return L(D(t,{txSentry:O}),te);case"TradeCacheMsg":var re=e.a,ne=e.b,ae=f(rB,re,t.tradeCaches);if("Nothing"===ae.$)return f(uB,pa(f(ll,"Encountered an out-of-range error when trying to route a TradeCacheMsg",ci)),L(t,Do));var ie=ae.a,x=f(iT,ne,ie);return L(D(t,{tradeCaches:l(iB,re,x.tradeCache,t.tradeCaches)}),f(il,lT(re),x.cmd));case"NoOp":return L(t,Do);default:var N=e.a;f(cl,"test",N);return L(t,Do)}}),fB=r(function(e,t){return f(oB,t,my(e))}),lB=Ge("txIn",Sm),dB=je("txOut",Ua),hB=function(e){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"Dai"}e.a;return"Kovan Dai"}switch(e.a.$){case"Eth":e.a;return"Ether";case"Kovan":e.a;return"Kovan Ether";default:e.a;return"xDai"}},pB=function(e){return{$:"EventSentryMsg",a:e}},gB=function(e){var t=f(cm,pB,Xh(e)),r=t.a,n=t.b;return x({dataFetchState:l(QS,ci,0,0),eventSentry:r,factory:e,trades:qa},n,M([d(Zd,"tradeCache init","processing",hB(e),0)]))},vB=function(e){return{$:"InitialNumTradesFetched",a:e}},yB=function(e){return f(LS,e.factory,vB)},mB=function(e){var t=gB(e),r=t.a,n=t.b,a=t.c;return x(r,Po(M([n,yB(r)])),a)},bB=function(e){return{$:"TxSentryMsg",a:e}},CB={align:ul,label:"noWeb3Provider",mainParagraphs:M([M([fl("No web3 provider detected. Is "),f(dA,M([bA(l(pA,0,0,1))]),{label:fl("Metamask"),url:"https://metamask.io/"}),fl(" or some other web3 provider installed and unlocked?")])]),noticeType:xg},EB={$:"TopLeft"},SB={align:EB,label:"screenToSmall",mainParagraphs:M([M([fl("Your screen is quite small--things may be very broken! We will be addressing this soon.")])]),noticeType:xg},TB={align:ul,label:"wrongWeb3Network",mainParagraphs:M([M([fl("Make sure your wallet is set to a compatible network.")]),M([fl(" At the moment DAIHard works on: xDai, the Kovan Ethereum Test Net, or Ethereum Main Net.")])]),noticeType:$g},wB={$:"NoneDetected"},IB=function(e){return f(Bo,Xh,Mg(e))},AB={$:"ETCMain"},BB={$:"ETCTest"},kB={$:"Expanse"},NB={$:"Kovan"},RB={$:"Mainnet"},$B=function(e){return{$:"Private",a:e}},_B={$:"Rinkeby"},LB={$:"Ropsten"},xB={$:"RskMain"},PB={$:"RskTest"},DB=function(e){switch(e){case 1:return RB;case 2:return kB;case 3:return LB;case 4:return _B;case 30:return xB;case 31:return PB;case 42:return NB;case 41:return AB;case 62:return BB;default:return $B(e)}},UB=n(function(e,t,r){var n=e.a,a=e.b;return Tl({inPort:a,nodePath:r,outPort:n,ref:1,tagger:t,txs:cp})}),OB=n(function(e,t,n){var a=e.networkId?TA(DB(e.networkId)):wB,i=f(Bo,function(e){return l(UB,L(dB,lB),bB,e)},IB(a)),o=e.width<1024?si(SB):ci,u=f(xa,mB,ro),s=function(){return R(a,wB)?si(CB):"Nothing"===Mg(a).$?si(TB):ci}(),c=mE(M([o,s])),d=x(f(xa,no,u),f(xa,ao,u),f(xa,io,u)),h=d.a,p=d.b,g=d.c,v=ay(f(Bi,r(function(e,t){return f(Qi,lT(e),t)}),g)),y=Po(f(Bi,r(function(e,t){return f(il,lT(e),t)}),p)),m=f(sB,v,f(fB,t,{key:n,screenWidth:e.width,submodel:sT,time:Vl(0),tradeCaches:h,txSentry:i,userAddress:ci,userNotices:yr,wallet:a})),b=m.a,C=m.b;return L(f(so,c,b),Po(M([y,C])))}),MB=Oe,FB=MB(yr),VB=function(e){return FB},KB=function(e){return{$:"Refresh",a:e}},HB=r(function(e,t){return{$:"Every",a:e,b:t}}),jB=r(function(e,t){return{processes:t,taggers:e}}),qB=xp(f(jB,cp,cp)),GB=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(SS,s,L(Ia(i),u),o),f=c.a,h=c.b;return l(Ra,r(function(t,r){var n=t.a,a=t.b;return l(e,n,a,r)}),h,f)}),zB=Ne,YB=r(function(e,t){var r=e.a,n=e.b,a=f(fp,r,t);if("Nothing"===a.$)return l(xl,r,M([n]),t);var i=a.a;return l(xl,r,f(ka,n,i),t)}),WB=Be,JB=r(function(e,t){return{$:"Zone",a:e,b:t}}),QB=ca,XB=n(function(e,t,r){if(t.b){var n=t.a,a=t.b,i=WB(f(QB,n,f(Sp,e,n)));return f(Kp,function(t){return l(XB,e,a,l(xl,n,t,r))},i)}return xp(r)}),ZB=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 x(n,a,f(Kp,function(e){return i},zB(t)))}),u=l(Ra,YB,cp,t),s=n(function(e,t,r){var n=r.a,a=r.b,i=r.c;return x(f(ka,e,n),a,i)}),c=a(function(e,t,r,n){var a=n.a,i=n.b,o=n.c;return x(a,l(xl,e,r,i),o)}),d=p(GB,s,c,o,u,i,x(yr,cp,xp(gr))),h=d.a,g=d.b,v=d.c;return f(Kp,function(e){return xp(f(jB,u,e))},f(Kp,function(t){return l(XB,e,h,g)},v))}),ek=function(e){return we(function(t){t(Se(e(Date.now())))})}(Vl),tk=n(function(e,t,r){var n=f(fp,t,r.taggers);if("Nothing"===n.$)return xp(r);var a=n.a,i=function(t){return Gp(f(xa,function(r){return f(Ep,e,r(t))},a))};return f(Kp,function(e){return xp(r)},f(Kp,i,ek))}),rk=r(function(e,t){var r=t.a,n=t.b;return f(HB,r,f(Da,e,n))});pn.Time=Pe(qB,ZB,tk,0,rk);var nk=Ue("Time"),ak=r(function(e,t){return nk(f(HB,e,t))}),ik=function(e){return f(ak,2e3,KB)},ok=function(e){return FB},uk=function(e){return{$:"DecryptionFinished",a:e}},sk=Ge("decryptionFinished",Sm),ck=Ge("encryptionFinished",Sm),fk=function(e){return{$:"EncryptionFinished",a:e}},lk=function(e){return{$:"Refresh",a:e}},dk=function(e){return MB(M([f(ak,3e3,lk),ck(fk),sk(function(e){return jE(uk(e))})]))},hk=yn,pk=function(e){var t=e.submodel;switch(t.$){case"BetaLandingPage":return FB;case"CreateModel":t.a;return f(hk,Uy,ik());case"TradeModel":t.a;return f(hk,Fy,dk());case"MarketplaceModel":t.a;return f(hk,fT,ok());default:t.a;return f(hk,oT,VB())}},gk=Ge("userPubkeyResult",Sm),vk=Ge("walletSentryPort",Sm),yk={$:"CheckForNewTrades"},mk={$:"UpdateTradePhases"},bk=function(e){return MB(M([f(ak,5e3,function(e){return yk}),f(ak,3e3,function(e){return mk})]))},Ck=function(e){return{$:"Tick",a:e}},Ek=function(e){return{$:"UserPubkeySet",a:e}},Sk=function(e){return{$:"WalletStatus",a:e}},Tk=function(e){return f(ll,"Error decoding JS walletSentry: "+e,ci)},wk=function(e){return{$:"ErrorDecoding",a:e}},Ik=r(function(e,t){return{$:"TxSigned",a:e,b:t}}),Ak=l(Mi,r(function(e,t){return{ref:e,txHash:t}}),f(Oh,"ref",CE),f(Oh,"txHash",BA(Dm))),Bk=function(e){var t=f(Gh,Ak,e);if("Ok"===t.$){var r=t.a,n=r.txHash;if("Just"===n.$){var a=n.a;return f(Ik,r.ref,li(a))}return f(Ik,r.ref,fi("Problem signing/broadcasting Tx. Ref #"+Ni(r.ref)))}t.a;return wk("Error decoding tx data")},kk=function(e){var t=e.a;return f(hk,t.tagger,t.inPort(Bk))},Nk=f(Oi,DB,CE),Rk=gu(f(zo,rd,f(zo,$d("Failure decoding stringy int"),au(DB)))),$k=Em(M([Rk,Nk])),_k=r(function(e,t){return{account:e,networkId:t}}),Lk=l(Mi,_k,f(Oh,"account",BA(Am)),f(Oh,"networkId",$k)),xk=n(function(e,t,r){var n=f(Gh,Lk,r);if("Err"===n.$){var a=n.a;return e(Di(a))}return t(n.a)}),Pk=function(e){var t=f(zo,Tk,f(zo,pa,uT));return MB(U(M([f(ak,1e3,Ck),vk(f(xk,t,Sk)),f(xc,FB,f(Bo,kk,e.txSentry)),gk(Ek),MB(f(Bi,r(function(e,t){return f(hk,lT(e),t)}),f(xa,bk,e.tradeCaches)))]),M([pk(e)])))},Dk=function(e){return{$:"LinkClicked",a:e}},Uk=function(e){return{$:"UrlChanged",a:e}},Ok=n(function(e,t,r){return d(hA,e/255,t/255,r/255,1)}),Mk=l(Ok,10,33,108),Fk={$:"Generic"},Vk=Fk,Kk=r(function(e,t){return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),e)),wT(M([t])))}),Hk=function(e){return{$:"Fill",a:e}},jk=Hk(1),qk=Hi,Gk=function(e){return{$:"Px",a:e}},zk=Gk,Yk=ZT(8),Wk=function(e){return f(yA,Yk,l(vA,"bg-"+mA(e),"background-color",e))},Jk=f(Kk,M([ET(jk),yT(zk(150)),Wk(Mk)]),qk),Qk=function(e){return{$:"GotoRoute",a:e}},Xk={$:"Active"},Zk={$:"Important"},eN={$:"Normal"},tN=l(pA,1,1,1),rN=ZT(2),nN=i(function(e,t,r,n,a){return{$:"PaddingStyle",a:e,b:t,c:r,d:n,e:a}}),aN=r(function(e,t){return R(e,t)?f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e)):f(yA,rN,h(nN,"p-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),iN=ZT(21),oN=r(function(e,t){return{$:"Class",a:e,b:t}}),uN=f(oN,iN,RT.cursorPointer),sN=ZT(17),cN=function(e){return f(yA,sN,l(jI,"br-"+Ni(e),"border-radius",Ni(e)+"px"))},fN=function(e){return{$:"Normal",a:e}},lN=An,dN=r(function(e,t){return f(lN,e,fN(t))}),hN=function(e){return f(dN,"click",Fi(e))},pN=f(Da,ST,hN),gN=ZT(13),vN=f(oN,gN,RT.textSemiBold),yN=ZT(4),mN=function(e){return{$:"FontSize",a:e}},bN=function(e){return f(yA,yN,mN(e))},CN=n(function(e,t,r){var n=function(){switch(r.$){case"Normal":return yr;case"Active":return M([cN(4),Wk(l(pA,0,0,1))]);default:return M([cN(4),Wk(l(pA,.9,0,0))])}}();return f(Kk,U(M([f(aN,23,12),bN(22),vN,bA(tN),uN,pN(t)]),n),fl(e))}),EN=l(Ok,244,0,103),SN=function(e){return{$:"AlignX",a:e}},TN={$:"CenterX"},wN=SN(TN),IN=ZT(3),AN=n(function(e,t,r){return{$:"SpacingStyle",a:e,b:t,c:r}}),BN=r(function(e,t){return"spacing-"+Ni(e)+"-"+Ni(t)}),kN=function(e){return f(yA,IN,l(AN,f(BN,e,e),e,e))},NN=function(e){return{$:"Describe",a:e}},RN={$:"Paragraph"},$N=r(function(e,t){return d(fA,HT,Vk,f(ka,NN(RN),f(ka,ET(jk),f(ka,kN(5),e))),wT(t))}),_N=f(oN,gN,RT.bold),LN=f(Kk,M([bN(29),bA(tN),_N,wN,uN,pN(Qk(Gv))]),f($N,yr,M([fl("DAI"),f(Kk,M([bA(EN)]),fl("Hard"))]))),xN={$:"Right"},PN=SN(xN),DN={$:"AsColumn"},UN=DN,ON=r(function(e,t){return d(fA,UN,Vk,f(ka,lA(RT.contentTop+" "+RT.contentLeft),f(ka,yT(bT),f(ka,ET(bT),e))),wT(t))}),MN={$:"AsRow"},FN=MN,VN=r(function(e,t){return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY),f(ka,ET(bT),f(ka,yT(bT),e))),wT(t))}),KN=function(e){return f(VN,M([ET(jk),kN(30),f(aN,30,17)]),M([l(CN,"Browse Offers",Qk(zv),function(){var t=e.submodel;if("MarketplaceModel"===t.$){t.a;return Xk}return eN}()),l(CN,"Create a New Offer",Qk(qv),function(){return"CreateModel"===e.submodel.$?Xk:eN}()),function(){var t=Gd(e.wallet);if("Just"===t.$){var r=t.a;return l(CN,"My Trades",Qk(jv(r.address)),function(){var t=e.submodel;if("AgentHistoryModel"===t.$){return R(t.a.agentAddress,r.address)?Xk:eN}return eN}())}return l(CN,"Connect to Wallet",cT,Zk)}(),f(ON,M([PN,kN(0),f(aN,8,0)]),M([LN]))]))},HN=function(e){return function(t){return R(t.parameters.initiatorAddress,e.agentAddress)||R(t.state.responder,si(e.agentAddress))}},jN=function(e){return ml(e)},qN=r(function(e,t){return f(ml,dv(e),t)}),GN=function(e){return f(ml,function(e){return Hb(e.parameters)},OS(e))},zN={$:"BurnWindow"},YN={$:"FiatPrice"},WN={$:"Margin"},JN={$:"Offer"},QN={$:"PaymentWindow"},XN=function(e){return{$:"AlignY",a:e}},ZN={$:"CenterY"},eR=XN(ZN),tR=ZT(20),rR=f(oN,tR,RT.clip),nR=Hk,aR=function(e){return f(yA,rN,h(nN,"p-"+Ni(e),e,e,e,e))},iR=r(function(e,t){return f(Kk,M([ET(nR(e)),yT(zk(60)),rR,Wk(tN)]),f(Kk,M([aR(12),eR,ET(jk)]),t))}),oR=function(e){switch(e.$){case"Phase":case"Expires":case"Offer":return 1;case"FiatPrice":return 2;case"Margin":return 1;case"PaymentWindow":default:return 2}},uR=function(e){return{$:"JustImage",a:e}},sR=uR({description:"down",src:"/DAIHard/static/img/arrow-down.svg"}),cR=dT("alt"),fR=function(e){return f(dT,"src",rt(e))},lR=r(function(e,t){var r=t.src,n=t.description,a=f(ml,function(e){switch(e.$){case"Width":case"Height":return!0;default:return!1}},e);return d(fA,AT,Vk,f(ka,lA(RT.imageContainer),e),wT(M([d(fA,AT,TT("img"),U(M([ST(fR(r)),ST(cR(n))]),a),wT(yr))])))}),dR=r(function(e,t){if("None"===t.$)return qk;var r=t.a;return f(lR,e,r)}),hR=uR({description:"up",src:"/DAIHard/static/img/arrow-up.svg"}),pR=function(e){return{$:"ChangeSort",a:e}},gR=f(oN,gN,RT.textMedium),vR=function(e){return f(Kk,M([gR,bN(17)]),fl(function(){switch(e.$){case"Phase":return"Phase";case"Expires":return"Expiring";case"Offer":return"Offer";case"FiatPrice":return"For Fiat";case"Margin":return"Margin";case"PaymentWindow":return"Payment Window";default:return"Burn Window"}}()))},yR=r(function(e,t){return f(VN,M([kN(5),uN,pN(pR(e))]),M([vR(e),function(){if("Just"===t.$){var e=t.a;return f(Kk,M([eR]),f(dR,M([ET(zk(8))]),function(){return"Ascending"===e.$?sR:hR}()))}return qk}()]))}),mR=r(function(e,t){return f(iR,oR(t),f(yR,t,e))}),bR=r(function(e,t){return f(VN,M([ET(jk)]),f(xa,function(t){var r=R(e.a,t)?si(e.b):ci;return f(mR,r,t)},t))}),CR=l(Ok,150,150,150),ER=function(e){switch(e.$){case"Open":return 1;case"Committed":return 2;case"Judgment":return 3;default:return 4}},SR=r(function(e,t){return f(ts,e.amount,t.amount)}),TR=n(function(e,t,r){return f(e,r,t)}),wR=function(e){var t=e.a;return(R(e.b,Lo)?Ua:TR)(function(){switch(t.$){case"Phase":return r(function(e,t){return R(e.state.phase,t.state.phase)?l(wR,L(Av,Zf),e,t):f(Ku,ER(e.state.phase),ER(t.state.phase))});case"Expires":return r(function(e,t){return f(hv,e.derived.phaseEndTime,t.derived.phaseEndTime)});case"Offer":return r(function(e,t){return f(Sv,e.parameters.tradeAmount,t.parameters.tradeAmount)});case"FiatPrice":return r(function(e,t){return f(SR,e.terms.price,t.terms.price)});case"Margin":return r(function(e,t){return f(xc,ma,l(zd,r(function(e,t){return f(Ku,e,t)}),e.derived.margin,t.derived.margin))});case"PaymentWindow":return r(function(e,t){return f(hv,e.parameters.autoabortInterval,t.parameters.autoabortInterval)});default:return r(function(e,t){return f(hv,e.parameters.autoreleaseInterval,t.parameters.autoreleaseInterval)})}}())},IR=l(Ok,233,237,242),AR=r(function(e,t){return{$:"TradeClicked",a:e,b:t}}),BR=function(e){return f(Kk,M([ET(jk),yT(jk),rR]),f($N,M([bN(12)]),M([fl(e.info)])))},kR=function(e){return f(xc,qk,f(Bo,BR,Ql(e)))},NR=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"}},RR=function(e){return{$:"TimeLeft",a:e}},$R=function(e){return{$:"TimeUp",a:e}},_R=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 Vl(0)}}),LR=r(function(e,t){return Vl(jd(e)-jd(t))}),xR=r(function(e,t){var r=f(_R,t.state.phase,t),n=f(LR,e,t.state.phaseStartTime),a=f(LR,r,n);return jd(a)>0?RR(L(a,r)):$R(r)}),PR=function(e){switch(e.$){case"Open":return"Open";case"Committed":return"Committed";case"Judgment":return"Judgment";default:return"Closed"}},DR=l(pA,0,0,0),UR=l(Ok,51,183,2),OR=function(e){var t=ju(100*e),r=t-Za(t),n=Ni(Za(t)),a=f(ei,0,3-Qo(n));return n+(function(){if(a){return f(ru,a+1,f(Zo,1,mw(r)))}return""}()+"%")},MR=r(function(e,t){return uR({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"}()})}),FR=n(function(e,t,r){return f(dR,f(ka,yT(zk(34)),e),f(MR,t,r))}),VR=r(function(e,t){var r=OR(t);if("0%"===r)return f(Kk,M([bN(16)]),fl("0%"));var n=r,a=t>=0,i=!(a!==e),o=i?UR:EN;return f(VN,M([kN(4)]),M([l(FR,yr,a,si(i)),f(Kk,M([bA(o),bN(16)]),fl(n))]))}),KR=uR,HR=function(e){return l(Ra,r(function(e,t){var r=e.a,n=e.b;return l(xl,r,n,t)}),cp,e)}(f(xa,function(e){var t=e.a;return L(t,L(e.b,KR({description:t,src:"/DAIHard/static/img/currencies/"+t+".svg"})))},M([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(xc,"",f(Bo,Qa,f(fp,e,HR)))},qR=function(e){return Qo(e)<=3?e:qR(f(Td,3,e))+","+f(ou,3,e)},GR=function(e){return qR(Sd(e))},zR=function(e){return U(jR(e.fiatType),GR(e.amount))},YR=hA,WR=function(e){var t=function(){var t=f(fp,e.fiatType,HR);if("Nothing"===t.$)return qk;var r=t.a,n=(r.a,r.b);return f(dR,M([yT(zk(26))]),n)}();return f(VN,M([kN(4)]),M([t,f(Kk,M([bA(d(YR,0,0,0,.5)),gR,ET(zk(50))]),fl(e.fiatType)),fl(zR(e))]))},JR=function(e){return jd(e)<0},QR=a(function(e,t,r,n){return{days:e,hours:t,min:r,sec:n}}),XR=function(e){var t=vg(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(QR,$C(t),$C(r),$C(n),$C(a))}(f(xc,L(qu(0),qu(0)),f(Ts,n,qu(60))))}(f(xc,L(qu(0),qu(0)),f(Ts,r,qu(3600))))}(f(xc,L(qu(0),qu(0)),f(Ts,t,qu(86400))))},ZR=a(function(e,t,n,a){for(;;){var i=n.a,o=n.b;if(!JR(a)){var u=r(function(e,t){return U(l(Rs,2,P("0"),Ni(e)),t)}),s=jd(a)>0?i:o,c=XR(a),d=c.days||c.hours?i:o,h=c.days?i:o;return f(VN,U(M([kN(5)]),e),M([f(Kk,U(M([bA(h)]),t),fl(f(u,c.days,"d"))),f(Kk,U(M([bA(d)]),t),fl(f(u,c.hours,"h"))),f(Kk,U(M([bA(s)]),t),fl(f(u,c.min,"m")))]))}var p=e,g=t,v=L(i,o),y=Vl(0);e=p,t=g,n=v,a=y}}),e$={$:"Behind"},t$=r(function(e,t){return{$:"Nearby",a:e,b:t}}),r$=function(e){return f(t$,e$,e)},n$=r(function(e,t){var r=sv(200*e),n=200-r,a=f(Kk,M([ET(nR(n))]),qk),i=M([yT(zk(3)),cN(20)]),o=f(Kk,U(i,M([ET(nR(r)),Wk(t)])),qk),u=f(Kk,U(i,M([ET(jk),Wk(IR)])),qk);return f(VN,M([ET(jk),r$(u)]),M([o,a]))}),a$=l(pA,1,1,0),i$=r(function(e,t){return jd(e)/jd(t)}),o$=a(function(e,t,r,n){var a=r.a,i=r.b,o=n.a,u=n.b,s=f(i$,o,u),c=(f(Kk,M([wN]),d(ZR,yr,yr,L(a,i),o)),s<.1?EN:s<.2?a$:UR);return f(ON,U(M([kN(5)]),e),M([d(ZR,M([wN]),t,L(a,i),o),f(n$,1-s,c)]))}),u$=function(e){var t=wd(jl(e)),r=f(Xl,".",t);if(!r.b)return t;if(r.b.b){cl("Error interpreting evmValueToString result. More than one decimal??");return"???"}switch(r.a){case 0:return"0"+f(ru,3,t);case 1:return f(ru,4,f(xc,t,f(Bo,mw,f(Bo,function(e){return e/100},f(Bo,Ka,f(Bo,sv,f(Bo,ti(100),Bd(t))))))));default:var n=r.a;return f(xc,f(ru,n,t),f(Bo,Ni,f(Bo,sv,Bd(t))))}},s$=n(function(e,t,r){return f(iR,oR(t),function(){switch(t.$){case"Phase":var n=PR(r.state.phase),a=L(f(xR,e,r),r.state.phase);e:for(;;){if("TimeLeft"===a.a.$){if("Closed"===a.b.$)break e;var i=a.a.a,o=f(i$,i.a,i.b)<.05?EN:DR;return f(ON,M([kN(3)]),M([fl(n),d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)]))}if("Closed"===a.b.$)break e;var u=a.a.a;return f(VN,M([kN(6),bA(CR)]),M([fl(n),f(Kk,M([bN(16)]),fl("(stale)"))]))}a.b;return fl(n);case"Expires":if("Open"===r.state.phase.$){var s=f(xR,e,r);if("TimeLeft"===s.$){var i=s.a,o=f(i$,i.a,i.b)<.05?EN:DR;return d(o$,M([ET(jk)]),M([bN(16)]),L(o,IR),i)}var u=s.a;return d(o$,M([ET(jk)]),M([bN(16)]),L(EN,IR),L(Vl(0),u))}return qk;case"Offer":return f(VN,M([kN(5)]),M([fl(function(){return"Buyer"===r.parameters.initiatorRole.$?"Buying ":"Selling "}()+(u$(r.parameters.tradeAmount)+" ")+NR(r.factory))]));case"FiatPrice":return WR(r.terms.price);case"Margin":var c=R(r.parameters.initiatorRole,fo);return f(xc,qk,f(Bo,VR(c),r.derived.margin));case"PaymentWindow":var l=function(){return"Seller"===r.parameters.initiatorRole.$?EN:UR}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoabortInterval);default:var l=function(){return"Seller"===r.parameters.initiatorRole.$?UR:EN}(),h=_(jd(r.parameters.autoabortInterval),216e5)<0?l:DR;return d(ZR,yr,yr,L(h,IR),r.parameters.autoreleaseInterval)}}())}),c$=n(function(e,t,r){return f(ON,M([ET(jk),kN(1),Wk(IR),uN,pN(f(AR,r.factory,r.id))]),M([f(VN,M([ET(jk),kN(1)]),f(xa,function(t){return l(s$,e,t,r)},t)),f(iR,1,kR(r.terms.paymentMethods))]))}),f$=Er,l$=ZT(28),d$=function(e){return f(yA,l$,l(vA,"bc-"+mA(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(yA,iA,h(h$,"b-"+Ni(e),e,e,e,e))},g$=a(function(e,t,r,n){return f(ON,M([ET(jk),p$(2),cN(8),d$(CR),kN(2),Wk(CR),rR]),f(xa,f(c$,e,r),f(f$,wR(t.orderBy),n)))}),v$=a(function(e,t,r,n){return f(ON,M([ET(jk),yT(jk),kN(5)]),M([f(bR,t.orderBy,r),d(g$,e,t,r,n)]))}),y$=a(function(e,t,r,n){return"pad-"+Ni(e)+"-"+Ni(t)+"-"+Ni(r)+"-"+Ni(n)}),m$=function(e){var t=e.top,r=e.right,n=e.bottom,a=e.left;return R(t,r)&&R(t,n)&&R(t,a)?f(yA,rN,h(nN,"p-"+Ni(t),t,t,t,t)):f(yA,rN,h(nN,d(y$,t,r,n,a),t,r,n,a))},b$=lA(RT.italic),C$=a(function(e,t,r,n){var a=f(qN,n.filters,ay(f(xa,function(e){return f(jN,HN(n),GN(e))},r)));return R(a,yr)?f(Kk,M([wN,bN(24),m$({bottom:0,left:0,right:0,top:30}),b$]),fl(t?"No trades found with those filters.":"Initializing Trade Cache...")):f(Yi,Ko,d(v$,e,n.tradeTable,M([xo,JN,YN,WN,QN,zN]),a))}),E$=r(function(e,t){return f(Kk,M([cN(4),Wk(d(YR,0,0,1,.1)),bA(l(Ok,16,7,234)),bN(e),vN,f(aN,15,13)]),fl(dl(t)))}),S$=function(e){return function(){var t=Gd(e.wallet);return"Nothing"!==t.$&&R(t.a.address,e.agentAddress)}()?qk:f(VN,M([kN(10),m$({bottom:20,left:20,right:20,top:10})]),M([f(Kk,M([bN(24),vN]),fl("Trade History for User")),f(E$,18,e.agentAddress)]))},T$=function(e){return{$:"FiltersMsg",a:e}},w$=function(e){switch(e.$){case"Phase":return"Phases";case"Role":return"Role";default:return"Offer Type"}},I$=n(function(e,t,r){return{$:"SetOption",a:e,b:t,c:r}}),A$=xI,B$={$:"Left"},k$=SN(B$),N$=n(function(e,t,r){if("HiddenLabel"===t.$){t.a;return d(fA,UN,TT("label"),e,wT(M([r])))}var n=t.a,a=t.b,i=t.c,o=d(fA,AT,Vk,a,wT(M([i])));switch(n.$){case"Above":return d(fA,UN,TT("label"),e,wT(M([o,r])));case"Below":return d(fA,UN,TT("label"),e,wT(M([r,o])));case"OnRight":return d(fA,FN,TT("label"),e,wT(M([r,o])));default:return d(fA,FN,TT("label"),e,wT(M([o,r])))}}),R$=function(e){return{$:"Label",a:e}},$$={$:"NoAttribute"},_$=function(e){if("HiddenLabel"===e.$){var t=e.a;return NN(R$(t))}return $$},L$=function(e){return"HiddenLabel"===e.$},x$=function(e){var t=function(t){var r=e(t);if("Nothing"===r.$)return hu("No key matched");var n=r.a;return Fi(n)},r=f(du,t,f(Oh,"key",pu));return ST(f(dN,"keyup",r))},P$=function(e){return f(Nn,"tabIndex",Ni(e))},D$=f(Da,ST,P$),U$={$:"LivePolite"},O$=NN(U$),M$=r(function(e,t){var r=t.label,n=t.icon,a=t.checked,i=t.onChange,o=U(M([L$(r)?$$:kN(6),ST(hN(i(!a))),O$,x$(function(e){return R(e,"Enter")?si(i(!a)):R(e," ")?si(i(!a)):ci}),D$(0),uN,k$,ET(jk)]),e);return l(N$,o,r,d(fA,AT,Vk,M([ST(f(A$,"role","checkbox")),ST(f(A$,"aria-checked",a?"true":"false")),_$(r),eR,yT(jk),ET(bT)]),wT(M([n(a)]))))}),F$=Br,V$=function(e){return e*F$/180},K$=ZT(26),H$=function(e){return{$:"MoveY",a:e}},j$=r(function(e,t){return{$:"TransformComponent",a:e,b:t}}),q$=function(e){return f(j$,K$,H$(-e))},G$=ZT(24),z$=r(function(e,t){return{$:"Rotate",a:e,b:t}}),Y$=function(e){return f(j$,G$,f(z$,x(0,0,1),e))},W$=ZT(19),J$=function(e){return Cd(M([e.inset?"box-inset":"box-",mw(e.offset.a)+"px",mw(e.offset.b)+"px",mw(e.blur)+"px",mw(e.size)+"px",mA(e.color)]))},Q$=function(e){var t={blur:e.blur,color:e.color,inset:!1,offset:e.offset,size:e.size};return f(yA,W$,l(jI,J$(t),"box-shadow",Cw(t)))},X$=r(function(e,t){return f(yA,iA,h(h$,"b-"+Ni(e)+"-"+Ni(t),t,e,t,e))}),Z$=function(e){var t=e.bottom,r=e.top,n=e.left,a=e.right;return R(r,t)&&R(n,a)?R(r,a)?p$(r):f(X$,n,r):f(yA,iA,h(h$,"b-"+Ni(r)+"-"+Ni(a)+"-"+Ni(t)+"-"+Ni(n),r,a,t,n))},e_=ZT(12),t_=f(oN,e_,RT.textCenter),r_=l(pA,1,1,1),n_=function(e){return f(Kk,M([lA("focusable"),ET(zk(14)),yT(zk(14)),bA(r_),eR,bN(9),t_,cN(3),d$(e?l(pA,59/255,.6,252/255):l(pA,211/255,211/255,211/255)),Q$({blur:1,color:e?d(YR,238/255,238/255,238/255,0):l(pA,238/255,238/255,238/255),offset:L(0,0),size:1}),Wk(e?l(pA,59/255,.6,252/255):r_),p$(e?0:1)]),e?f(Kk,M([d$(r_),yT(zk(6)),ET(zk(9)),Y$(V$(-45)),wN,eR,q$(1),Z$({bottom:2,left:2,right:0,top:0})]),qk):qk)},a_=n(function(e,t,r){return{$:"Label",a:e,b:t,c:r}}),i_={$:"OnRight"},o_=a_(i_),u_=r(function(e,t){return f(M$,yr,{checked:t.checked,icon:n_,label:f(o_,yr,fl(t.label)),onChange:f(I$,e,t.label)})}),s_={$:"Top"},c_=XN(s_),f_=function(e){return f(ON,M([kN(15),c_]),M([f(Kk,M([bN(28),gR]),fl(w$(e.type_))),f(ON,M([kN(5)]),f(xa,u_(e.type_),e.options))]))},l_=function(e){return f(VN,M([kN(20)]),f(xa,f_,e))},d_={$:"NoneFound"},h_={$:"AllFetched"},p_={$:"FetchingTrades"},g_={$:"QueryingNumTrades"},v_=function(e){var t=e.dataFetchState.total;if("Nothing"===t.$)return g_;if(t.a){var r=t.a;return _(e.dataFetchState.loaded,r-e.dataFetchState.invalid)<0?p_:h_}return d_},y_={$:"InFront"},m_=function(e){return f(t$,y_,e)},b_=r(function(e,t){var r=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},n=f(Eh,Ja(d_),f(xa,v_,e))?M([r("No trades found.")]):f(xa,r,mE(f(xa,function(e){switch(v_(e).$){case"QueryingNumTrades":return si("Querying "+hB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+hB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),m_(f(ON,M([kN(5),k$]),n))]),f(Kk,M([wN]),f(Yi,T$,l_(t.filters))))}),C_=n(function(e,t,r){return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),f(aN,30,20)]),M([S$(r),f(b_,t,r),function(){var n=f(Eh,f(zo,v_,Ja(h_)),t);return d(C$,e,n,t,r)}()]))}),E_=function(e){return{$:"ShowCurrencyDropdown",a:e}},S_={$:"AbortCreate"},T_=function(e){return{$:"AppCmd",a:e}},w_=n(function(e,t,r){return{$:"ConfirmCreate",a:e,b:t,c:r}}),I_=function(e){return f(xa,function(e){return M([f(Kk,M([bA(EN)]),fl("Caution! ")),fl(e)])},mE(M([R(f(hv,e.autoreleaseInterval,Vl(12e5)),ba)?si(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."}()):ci,R(f(hv,e.autoabortInterval,Vl(36e5)),ba)?si(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.'}()):ci])))},A_=l(pA,0,0,1),B_=function(e){return f(Kk,M([m$({bottom:5,left:5,right:5,top:0}),pN(e),cN(30),Wk(d(YR,1,1,1,.4)),p$(1),d$(d(YR,0,0,0,.3)),uN,bN(14)]),f(Kk,M([bA(d(YR,0,0,0,.7))]),fl("x")))},k_=Bn,N_=k_,R_=ST,$_=r(function(e,t){return f(Kk,M([r$(f(Kk,M([Wk(e),R_(f(N_,"position","fixed")),R_(f(N_,"z-index","1000")),R_(f(N_,"top","0")),R_(f(N_,"left","0")),R_(f(N_,"width","100%")),R_(f(N_,"height","100%"))]),qk)),ET(jk),yT(jk)]),t)}),__=r(function(e,t){return{$:"Max",a:e,b:t}}),L_=r(function(e,t){return f(__,e,t)}),x_=n(function(e,t,r){return l(Pa,$_,d(YR,0,0,.3,.6),f(Kk,U(M([wN,eR,ET(f(L_,500,bT)),Wk(tN),cN(8),m_(f(Kk,M([PN,c_]),B_(r)))]),e),t))}),P_=r(function(e,t){if("Nothing"===t.$)return qk;var r=t.a;return f(Kk,U(M([cN(5),d$(l(pA,.9,0,0)),p$(1),Wk(l(pA,1,.4,.4)),aR(5),wN,eR,ET(f(L_,200,bT)),bN(14)]),e),f($N,yr,M([fl(r)])))}),D_={$:"Above"},U_=function(e){return f(t$,D_,e)},O_=r(function(e,t){return f(Kk,M([cN(4),f(aN,25,17),bN(18),vN,Wk(IR),U_(f(P_,M([q$(5)]),t))]),fl(e))}),M_=a(function(e,t,r,n){return d(hA,e/255,t/255,r/255,n)}),F_=d(M_,1,31,52,.64),V_=ZT(32),K_={$:"Active"},H_=r(function(e,t){return{$:"PseudoSelector",a:e,b:t}}),j_=$n,q_=r(function(e,t){switch(t.$){case"NoAttribute":return $$;case"Describe":var r=t.a;return NN(r);case"AlignX":var n=t.a;return SN(n);case"AlignY":var a=t.a;return XN(a);case"Width":var n=t.a;return CT(n);case"Height":var n=t.a;return vT(n);case"Class":var n=t.a,a=t.b;return f(oN,n,a);case"StyleClass":var i=t.a,o=t.b;return f(yA,i,o);case"Nearby":var u=t.a,s=t.b;return f(t$,u,f(zi,e,s));case"Attr":var c=t.a;return ST(f(j_,e,c));default:var l=t.a,d=t.b;return f(j$,l,d)}}),G_=function(e){return f(q_,zg,e)},z_=r(function(e,t){var r=t.a,n=t.b,a=G_(e);switch(a.$){case"StyleClass":var i=a.b;return L(f(ka,i,r),n);case"TransformComponent":var o=(a.a,a.b);return L(r,f(rA,n,o));default:return L(r,n)}}),Y_=function(e){var t=l(Ra,z_,L(yr,sA),e),r=t.a,n=t.b;return f(ka,qI(n),r)},W_=function(e){return f(yA,V_,f(H_,K_,Y_(e)))},J_=ZT(33),Q_={$:"Hover"},X_=function(e){return f(yA,J_,f(H_,Q_,Y_(e)))},Z_=a(function(e,t,r,n){var a=e.a,i=e.b,o=e.c;return f(Kk,M([cN(4),uN,pN(n),f(aN,25,17),bA(t),bN(18),vN,Wk(a),W_(M([Wk(o)])),X_(M([Wk(i)]))]),fl(r))}),eL=r(function(e,t){return d(Z_,x(d(YR,1,0,0,1),d(YR,1,0,0,.8),d(YR,1,0,0,.6)),tN,e,t)}),tL=function(e){return $_(d(YR,0,0,.3,.6))(f(ON,M([kN(10),wN,eR,Wk(d(YR,0,0,0,.5)),cN(8),aR(20)]),f(xa,function(e){return f($N,M([wN,eR,bN(20),vN,bA(tN),t_]),M([e]))},e)))},rL=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/tx/"+NA(t)}e.a;return"https://kovan.etherscan.io/tx/"+NA(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/tx/"+NA(t);case"Kovan":e.a;return"https://kovan.etherscan.io/tx/"+NA(t);default:e.a;return"https://blockscout.com/poa/dai/tx/"+NA(t)}}),nL={$:"Bottom"},aL=XN(nL),iL=lA(RT.underline),oL=r(function(e,t){switch(e.$){case"Confirm":var r=e.a,n=e.b,a=function(){var e=t.depositAmount;if("Just"===e.$){var a=e.a;return L(fl(u$(oC(a))),f(eL,"Yes, I definitely want to open this trade.",l(w_,r,n,a)))}return L(fl("??"),f(O_,"(loading exact fees...)",ci))}(),i=a.a,o=a.b;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),U(I_(n),U(M([M([fl("You will deposit "),i,fl(" "+NR(r)+" (including the 1% dev fee) to open this trade.")])]),function(){return"Token"===r.$?M([M([fl("This ususally requires two Metamask signatures. Your "+NR(r)+" will not be deposited until the final transaction has been mined.")])]):yr}())))),f(Kk,M([aL,wN]),o)])),S_);case"ApproveNeedsSig":var u=e.a;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","ApproveNeedsSig",0)))]),tL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")])));case"ApproveMining":var u=e.a,n=e.b,s=e.c;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","ApproveMining",0)))]),tL(M([fl("Mining the initial approve transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,eo(u),s)}),fl("Funds will not leave your wallet until you sign the next transaction.")])));case"CreateNeedsSig":return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","CreateNeedsSig",0)))]),tL(M([fl("Waiting for user signature for the create call."),fl("(check Metamask!)")])));default:var r=e.a,s=e.b;return f(Kk,M([pN(T_(d(Zd,"txChainModal clicked","misclick","CreateMining",0)))]),tL(M([fl("Mining the final create call..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,r,s)}),fl("You will be redirected when it's mined.")])))}}),uL=function(e){var t=e.txChainStatus;if("Nothing"===t.$)return qk;var r=t.a;return f(oL,r,e)},sL=function(e){return{$:"TradeAmountChanged",a:e}},cL=dT("id"),fL=R_(cL("inputError")),lL=l(Ok,109,127,138),dL=uR({description:"DAI",src:"/DAIHard/static/img/dai-symbol.png"}),hL=function(e){return f(dR,f(ka,yT(zk(26)),e),dL)},pL=function(e){return f(VN,M([kN(4)]),M([hL(yr),f(Kk,M([bN(24),gR,bA(lL)]),fl(NR(e)))]))},gL=function(e){return{$:"HiddenLabel",a:e}},vL=gL,yL=dT("type"),mL=function(e){return L(e,!0)},bL=function(e){return{$:"MayStopPropagation",a:e}},CL=r(function(e,t){return f(lN,e,bL(t))}),EL=r(function(e,t){return l(La,Oh,t,e)}),SL=f(EL,M(["target","value"]),pu),TL=function(e){return f(CL,"input",f(Oi,mL,f(Oi,e,SL)))},wL=ZT(0),IL=r(function(e,t){return{$:"Transparency",a:e,b:t}}),AL=function(e){var t=function(e){return 1-e}(f(Tc,1,f(ei,0,e)));return f(yA,wL,f(IL,"transparency-"+dw(t),t))},BL=a(function(e,t,r,n){return{$:"Padding",a:e,b:t,c:r,d:n}}),kL=f(Da,ST,A$("autocomplete")),NL=l(pA,136/255,138/255,133/255),RL=l(pA,186/255,189/255,182/255),$L=f(aN,12,12),_L=M([$L,cN(3),d$(RL),Wk(r_),p$(1),kN(3),ET(jk)]),LL=function(e){if("StyleClass"===e.$&&"PseudoSelector"===e.b.$&&"Focus"===e.b.a.$){var t=e.b;t.a;return!0}return!1},xL=function(e){return f(Ch,LL,e)?$$:lA("focusable")},PL=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},DL=ye,UL=r(function(e,t){return f(kn,e,DL(t))}),OL=UL("spellcheck"),ML=f(Da,ST,OL),FL=W,VL=ZT(47),KL=a(function(e,t,r,n){var a=function(e){return e.a+e.c},i=function(e){return e<1?1:e}(Ti(FL(e))),o=(i-1)*t+f(xc,0,f(Bo,a,r))+f(xc,0,f(Bo,a,n));return f(yA,VL,l(jI,"textarea-height-"+Ni(i),"height",function(e){return"calc("+Ni(e)+"em + "+Ni(o)+"px) !important"}(i)))}),HL=dT("value"),jL=f(Da,ST,HL),qL=function(e){return l(La,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(ka,e,r),n);case"Attr":e.a;return L(f(ka,e,r),n);case"StyleClass":e.b;return L(f(ka,e,r),n);case"Width":e.a;return f(fw,"width",n)?L(r,n):L(f(ka,e,r),f(Gm,"width",n));case"Height":e.a;return f(fw,"height",n)?L(r,n):L(f(ka,e,r),f(Gm,"height",n));case"Describe":e.a;return f(fw,"described",n)?L(r,n):L(f(ka,e,r),f(Gm,"described",n));case"Nearby":e.a,e.b;return L(f(ka,e,r),n);case"AlignX":return f(fw,"align-x",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-x",n));case"AlignY":return f(fw,"align-y",n)?L(r,n):L(f(ka,e,r),f(Gm,"align-y",n));default:return f(fw,"transform",n)?L(r,n):L(f(ka,e,r),f(Gm,"transform",n))}}),L(yr,sm),e).a},GL=r(function(e,t){return l(La,r(function(e,r){return t(e)?f(ka,e,r):r}),yr,qL(e))}),zL=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}},YL=f(Da,Gi,ms),WL=n(function(e,t,n){var a=function(e){return"Nearby"===e.$},i=M([ST(TL(n.onChange))]),o=U(_L,t),u=f(GL,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(ml,PL,o),c=f(GL,o,function(e){return"Height"===e.$&&"Fill"===e.a.$}),h=(f(GL,o,function(e){if("StyleClass"===e.$&&"PaddingStyle"===e.b.$){e.b;return!0}return!1}),f(GL,o,function(e){return"Nearby"===e.$})),p=f(ml,f(Da,ns,a),o),g=function(){var t=e.type_;if("TextInputNode"===t.$){var a=t.a;return x("input",U(M([jL(n.text),ST(yL(a)),ML(e.spellchecked),lA(RT.inputText),function(){var t=e.autofill;if("Nothing"===t.$)return $$;var r=t.a;return kL(r)}()]),p),yr)}var i=l(La,r(function(e,t){e:for(;;)switch(e.$){case"Describe":return t;case"Height":var r=e.a,n=t.heightContent;return"Nothing"===n.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),heightContent:si(zL(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.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeBorder:si(d(BL,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.$?D(t,{adjustedAttributes:t.adjustedAttributes,maybePadding:si(d(BL,i,o,u,s))}):t;case"SpacingStyle":var p=e.b,g=(p.b,p.c),v=t.maybeSpacing;return"Nothing"===v.$?D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes),maybeSpacing:si(g)}):t;default:break e}default:break e}return D(t,{adjustedAttributes:f(ka,e,t.adjustedAttributes)})}),{adjustedAttributes:yr,heightContent:ci,maybeBorder:ci,maybePadding:ci,maybeSpacing:ci},o),u=i.maybePadding,s=i.heightContent,c=i.maybeSpacing,h=i.adjustedAttributes,g=i.maybeBorder,v=f(xc,5,c);return x("textarea",U(M([ML(e.spellchecked),lA(RT.inputMultiline),f(xc,$$,f(Bo,kL,e.autofill)),function(){if("Nothing"===u.$)return $$;var e=u.a,t=e.a,r=e.b,n=e.c,a=e.d;return m$({bottom:f(ei,0,n-(v/2|0)),left:a,right:r,top:f(ei,0,t-(v/2|0))})}(),function(){return"Nothing"===s.$?$$:s.a?d(KL,n.text,v,u,g):$$}()]),h),M([YL(RI(n.text))]))}(),v=g.a,y=g.b,m=g.c,b=d(fA,AT,Vk,f(ka,ET(jk),ay(M([h,c,function(){var e=n.placeholder;if("Nothing"===e.$)return yr;var t=e.a,r=t.a,a=t.b;return M([m_(f(Kk,f(ka,$L,U(s,U(M([bA(NL),lA(RT.noTextSelection+" "+RT.passPointerEvents),d$(d(YR,0,0,0,0)),Wk(d(YR,0,0,0,0)),yT(jk),ET(jk),AL(""===n.text?1:0)]),r))),a))])}()]))),wT(M([d(fA,AT,TT(v),ay(M([M([xL(t),_$(n.label)]),y,i])),wT(m))])));return l(N$,f(ka,f(oN,iN,RT.cursorText),f(ka,L$(n.label)?$$:kN(5),f(ka,O$,u))),n.label,b)}),JL=WL({autofill:ci,spellchecked:!1,type_:function(e){return{$:"TextInputNode",a:e}}("text")}),QL=o(function(e,t,r,n,a,i){var o=t.a,u=t.b,s=f(JL,M([ET(jk),yT(zk(40)),p$(0)]),{label:vL(r),onChange:i,placeholder:n,text:a});return f(VN,U(M([kN(5)]),e),mE(M([f(Bo,Kk(M([k$])),o),si(s),f(Bo,Kk(M([PN])),u)])))}),XL={$:"Below"},ZL=function(e){return f(t$,XL,e)},ex=function(e){return f(j$,K$,H$(e))},tx=n(function(e,t,r){return p(QL,M([ET(zk(150)),gR,bN(24),ZL(f(P_,M([fL,ex(5)]),r))]),L(ci,si(f(Kk,M([pN(T_(d(Zd,"click","misclick","dai symbol in dai input",0)))]),pL(e)))),"dai input",ci,t,sL)}),rx=Kk(M([d$(IR),Z$({bottom:2,left:0,right:0,top:0})])),nx=r(function(e,t){return f(ON,M([kN(10)]),M([f(Kk,M([bN(17),vN]),fl(e)),t]))}),ax=r(function(e,t){return rx(f(nx,function(){return"Buyer"===t.inputs.userRole.$?"You're buying":"You're selling"}(),l(tx,e,t.inputs.daiAmount,t.errors.daiAmount)))}),ix=function(e){return f(xc,gS,Mg(e))},ox=function(e){var t=function(){var t=vd(e.inputs.daiAmount);if("Just"===t.$){var r=t.a;return"There is a 1% fee of "+u$(f(Gl,r,100))+" "+NR(ix(e.wallet))+"."}return"There is a 1% fee."}();return f(VN,M([wN,f(aN,20,10),Wk(l(Ok,10,33,108)),cN(8),kN(5),pN(T_(d(Zd,"click","misclick","fee notify element",0)))]),M([f(Kk,M([bN(18),bA(l(Ok,0,226,255)),vN]),fl(t)),f(Kk,M([bN(17),bA(tN),gR]),fl("We only collect this fee when trades resolve successfully."))]))},ux=function(e){return{$:"FiatAmountChanged",a:e}},sx=function(e){return{$:"FiatTypeChanged",a:e}},cx=r(function(e,t){return l(SS,n(function(t,r,n){return f(e,t,r)?l(xl,t,r,n):n}),cp,t)}),fx=function(e){return f(cx,r(function(t,r){return f(Qg,e,t)}),HR)},lx=uR({description:"",src:"/DAIHard/static/img/qmark-circle.svg"}),dx=function(e){return f(dR,M([yT(zk(26))]),f(xc,lx,f(Bo,fu,f(fp,e,HR))))},hx=function(e){return R_(f(CL,"click",Fi(L(e,!0))))},px=YL,gx=function(e){return{$:"AppendProperty",a:e}},vx=r(function(e,t){return gx(e+":"+t)}),yx=r(function(e,t){return f(vx,e,t.value)}),mx=yx("cursor"),bx={$:"Compatible"},Cx={cursor:bx,value:"default"},Ex=r(function(e,t){return{$:"ExtendSelector",a:e,b:t}}),Sx=function(e){return{$:"PseudoClassSelector",a:e}},Tx=function(e){return Ex(Sx(e))}("hover"),wx=n(function(e,t,r){return{$:"Node",a:e,b:t,c:r}}),Ix=wx,Ax=Ix,Bx=Ax("span"),kx=r(function(e,t){return f(kn,et(e),rt(t))}),Nx=n(function(e,t,r){return{$:"Attribute",a:e,b:t,c:r}}),Rx=a(function(e,t,r,n){return{charsProcessed:n,hash:r,seed:t,shift:e}}),$x=r(function(e,t){return(65535&t)*e+(((t>>>16)*e&65535)<<16)}),_x=r(function(e,t){return t<>>32-e}),Lx=function(e){var t=e.hash?e.seed^f($x,461845907,f(_x,15,f($x,3432918353,e.hash))):e.seed,r=t^e.charsProcessed,n=f($x,2246822507,r^r>>>16),a=f($x,3266489909,n^n>>>13);return(a^a>>>16)>>>0},xx=r(function(e,t){return f($x,5,f(_x,13,e^f($x,461845907,f(_x,15,f($x,3432918353,t)))))+3864292196}),Px=r(function(e,t){var r=t.hash|(255&yi(e))<";default:return""}},HP=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+"]"}},jP=function(e){switch(e.$){case"TypeSelectorSequence":var t=e.a.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,HP,r)));case"UniversalSelectorSequence":var r=e.a;return Iu(r)?"*":f(Ri,"",f(xa,HP,r));default:var t=e.a,r=e.b;return f(Ri,"",f(ka,t,f(xa,HP,r)))}},qP=function(e){var t=e.a,r=e.b;return f(Ri," ",M([KP(t),jP(r)]))},GP=function(e){var t=e.a,r=e.b,n=e.c,a=f(ka,jP(t),f(xa,qP,r)),i=f(Ri,"",M([f(xc,"",f(Bo,VP,n))]));return f(oc,f(Ri," ",f(ml,f(Da,ns,_d),a)),i)},zP=r(function(e,t){var r=t.a,n=t.b,a=t.c,i=f(Ri,", ",f(xa,GP,f(ka,r,n)));return f(Ri,"",M([i," {\n",e,FP(a),"\n",e,"}"]))}),YP=function(e){switch(e.$){case"StyleBlockDeclaration":var t=e.a;return f(zP,"",t);case"MediaRule":var r=e.a,n=e.b;return"@media "+f(Ri,",\n",f(xa,xP,r))+" {\n"+f(Ri,"\n\n",f(xa,f(Da,OP,zP(" ")),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"}},WP=function(e){var t=e.charset,r=e.imports,n=e.namespaces,a=e.declarations;return f(Ri,"\n\n",f(ml,f(Da,ns,_d),M([$P(t),f(Ri,"\n",f(xa,DP,r)),f(Ri,"\n",f(xa,UP,n)),f(Ri,"\n\n",f(xa,YP,a))])))},JP=function(e){return WP(RP(BP(e)))},QP=function(e){return f(Ri,"\n\n",f(xa,JP,e))},XP=function(e){return{$:"Snippet",a:e}},ZP=n(function(e,t,r){return{$:"StyleBlock",a:e,b:t,c:r}}),eD=function(e){return{$:"StyleBlockDeclaration",a:e}},tD=r(function(e,t){var r=l(eP,t,yr,ci);return XP(M([eD(l(ZP,r,yr,e))]))}),rD=function(e){return Iu(e)?"unstyled":f(Is,P("_"),Ps(f(Dx,15739,QP(AS(Ux(AS(f(tD,e,dP(yr)))))))))},nD=function(e){var t=rD(e),r=f(kx,"className",hl(t));return l(Nx,r,e,t)},aD=a(function(e,t,r,n){return f(e,f(ka,nD(t),r),n)}),iD=function(e){return{$:"Unstyled",a:e}},oD=function(e){return iD(Tw(e))},uD=oD,sD=r(function(e,t){return f(Tn,e,Xe(t))}),cD=function(e){return En(Xe(e))},fD=r(function(e,t){var r=e.b,n=e.c;return Iu(r)?t:l(xl,n,r,t)}),lD=function(e){return e.a},dD=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(ka,L(r,o),a),i);case"Node":var u=n.a,s=n.b,c=n.c,h=l(Ra,fD,i,s),p=l(Ra,hD,L(yr,h),c),g=p.a,v=p.b,o=l(JT,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);case"NodeNS":var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,fD,i,s),m=l(Ra,hD,L(yr,h),c),g=m.a,v=m.b,o=d(cD,y,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);case"KeyedNode":var u=n.a,s=n.b,c=n.c,h=l(Ra,fD,i,s),b=l(Ra,dD,L(yr,h),c),g=b.a,v=b.b,o=l(WT,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v);default:var y=n.a,u=n.b,s=n.c,c=n.d,h=l(Ra,fD,i,s),C=l(Ra,dD,L(yr,h),c),g=C.a,v=C.b,o=d(sD,y,u,f(xa,lD,s),$a(g));return L(f(ka,L(r,o),a),v)}}),hD=r(function(e,t){var r=t.a,n=t.b;switch(e.$){case"Unstyled":var a=e.a;return L(f(ka,a,r),n);case"Node":var i=e.a,o=e.b,u=e.c,s=l(Ra,fD,n,o),c=l(Ra,hD,L(yr,s),u),h=c.a,p=c.b,a=l(JT,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);case"NodeNS":var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,fD,n,o),v=l(Ra,hD,L(yr,s),u),h=v.a,p=v.b,a=d(cD,g,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);case"KeyedNode":var i=e.a,o=e.b,u=e.c,s=l(Ra,fD,n,o),y=l(Ra,dD,L(yr,s),u),h=y.a,p=y.b,a=l(WT,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p);default:var g=e.a,i=e.b,o=e.c,u=e.d,s=l(Ra,fD,n,o),m=l(Ra,dD,L(yr,s),u),h=m.a,p=m.b,a=d(sD,g,i,f(xa,lD,o),$a(h));return L(f(ka,a,r),p)}}),pD=r(function(e,t){return h(Nl,kl,e,t,Rl,Rl)}),gD=r(function(e,t){for(;;){if(!t.b)return e;var r=t.a,n=r.b,a=r.c,i=t.b;if(_d(a)){var o=e,u=i;e=o,t=u}else{var o=si(L(a,n)),u=i;e=o,t=u}}}),vD=function(e){var t=f(gD,ci,e);if("Nothing"===t.$)return cp;var r=t.a,n=r.a,a=r.b;return f(pD,n,a)},yD=function(e){return{$:"ClassSelector",a:e}},mD=function(e){var t=e.a,r=e.b;return f(tD,r,dP(M([yD(t)])))},bD=function(e){return QP(AS(Ux(f(xa,mD,Ia(e)))))},CD=function(e){return l(JT,"style",yr,AS(Tw(bD(e))))},ED=n(function(e,t,r){var n=f(xa,lD,t),a=vD(t),i=l(Ra,hD,L(yr,a),r),o=i.a,u=i.b,s=CD(u);return l(JT,e,n,f(ka,s,$a(o)))}),SD=r(function(e,t){for(;;){if(!t.b)return!1;var r=t.a,n=r.a,a=t.b;if(R(e,n))return!0;var i=e,o=a;e=i,t=o}}),TD=r(function(e,t){e:for(;;){if(t.b){var r=t.a,n=r.a,a=t.b,i="_"+n;if(f(SD,i,a)){var o=i,u=a;e=o,t=u;continue e}return i}return e}}),wD=r(function(e,t){return L(f(TD,"_",t),CD(e))}),ID=n(function(e,t,r){var n=f(xa,lD,t),a=vD(t),i=l(Ra,dD,L(yr,a),r),o=i.a,u=i.b,s=f(wD,u,o);return l(WT,e,n,f(ka,s,$a(o)))}),AD=a(function(e,t,r,n){var a=f(xa,lD,r),i=vD(r),o=l(Ra,dD,L(yr,i),n),u=o.a,s=o.b,c=f(wD,s,u);return d(sD,e,t,a,f(ka,c,$a(u)))}),BD=a(function(e,t,r,n){var a=f(xa,lD,r),i=vD(r),o=l(Ra,hD,L(yr,i),n),u=o.a,s=o.b,c=CD(s);return d(cD,e,t,a,f(ka,c,$a(u)))}),kD=function(e){switch(e.$){case"Unstyled":return e.a;case"Node":var t=e.a,r=e.b,n=e.c;return l(ED,t,r,n);case"NodeNS":var a=e.a,t=e.b,r=e.c,n=e.d;return d(BD,a,t,r,n);case"KeyedNode":var t=e.a,r=e.b,n=e.c;return l(ID,t,r,n);default:var a=e.a,t=e.b,r=e.c,n=e.d;return d(AD,a,t,r,n)}},ND=kD,RD=function(e){return px(ND(d(aD,Bx,M([Tx(M([mx(Cx)]))]),yr,M([uD(e)]))))},$D=J,_D=i(function(e,t,r,n,a){return{$:"Padding",a:e,b:t,c:r,d:n,e:a}}),LD=n(function(e,t,r){return{$:"Spaced",a:e,b:t,c:r}}),xD=function(e){return l(La,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 si(h(_D,n,a,i,o,u))}return ci}(),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 si(l(LD,a,t,i))}return ci}())}),L(ci,ci),e)},PD=r(function(e,t){var r=xD(e),n=r.a,a=r.b;if("Nothing"===a.$)return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),e))),wT(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?si(m$({bottom:a-(s/2|0),left:i-(u/2|0),right:r-(u/2|0),top:t-(s/2|0)})):ci}return ci}();if("Just"===c.$){var h=c.a;return d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ET(bT),f(ka,yT(bT),U(e,M([h]))))),wT(t))}var p=-s/2,g=-u/2;return d(fA,AT,Vk,e,wT(M([d(fA,FN,Vk,f(ka,lA(RT.contentLeft+" "+RT.contentCenterY+" "+RT.wrapped),f(ka,ST(f(N_,"margin",mw(p)+"px "+mw(g)+"px")),f(ka,ST(f(N_,"width","calc(100% + "+Ni(u)+"px)")),f(ka,ST(f(N_,"height","calc(100% + "+Ni(s)+"px)")),f(ka,f(yA,IN,l(AN,o,u,s)),yr))))),wT(t))])))}),DD=i(function(e,t,r,n,a){var i=f(JL,M([ET(zk(80)),yT(zk(40)),bN(24),gR,d$(IR),hx(r)]),{label:vL("currency type"),onChange:f(zo,$D,n),placeholder:ci,text:t}),o=f(fp,t,HR),u=function(){var r=L(e,o);if(r.a){if("Just"===r.b.$)return qk;r.b;return f(PD,M([ET(zk(350)),d$(DR),p$(1),Wk(tN),aR(10),wN]),f(xa,function(e){var t=e.a,r=e.b,a=r.b;return f(VN,M([ET(zk(80)),kN(9),f(aN,0,5),hx(n(t)),X_(M([Wk(l(pA,.8,.8,1))]))]),M([f(dR,M([yT(zk(26))]),a),f(Kk,M([bN(16),vN]),RD(t))]))},Ia(fx(t))))}return qk}();return f(VN,M([kN(4),ZL(u)]),M([f(Kk,M([pN(a)]),dx(t)),i]))}),UD=i(function(e,t,r,n,a){var i=T_(d(Zd,"click","misclick","currency flag",0)),o=f(Kk,M([pN(T_(d(Zd,"click","misclick","currency symbol",0)))]),fl(jR(e))),u=f(Kk,M([ZL(f(P_,M([fL,ex(5)]),a))]),h(DD,r,e,E_(!0),sx,i));return p(QL,M([ET(zk(250)),gR,bN(24),ZL(f(P_,M([fL,ex(5)]),n))]),L(si(o),si(u)),"fiat input",ci,t,ux)}),OD=function(e){return rx(f(nx,"For fiat",h(UD,e.inputs.fiatType,e.inputs.fiatAmount,e.showFiatTypeDropdown,e.errors.fiatAmount,e.errors.fiatType)))},MD=function(e){return{$:"ChangeRole",a:e}},FD=d(M_,1,31,52,.13),VD=r(function(e,t){var r=M([bN(24),gR,uN]),n=function(){return"Buyer"===t.$?L(r,U(r,M([bA(FD)]))):L(U(r,M([bA(FD)])),r)}(),a=n.a,i=n.b;return f(VN,M([kN(20)]),M([f(Kk,U(M([pN(MD(lo))]),i),fl("Sell "+e)),f(Kk,U(M([pN(MD(fo))]),a),fl("Buy "+e))]))}),KD=r(function(e,t){return f(nx,"Trade Type",f(VD,NR(e),t.inputs.userRole))}),HD=Q$({blur:20,color:d(M_,0,0,0,.04),offset:L(0,3),size:0}),jD=f(oN,IN,RT.spaceEvenly),qD=function(e){var t=ix(e.wallet);return f(ON,M([ET(jk),kN(20),Wk(tN),cN(5),aR(20),HD]),M([f(VN,M([ET(jk),jD]),M([f(KD,t,e),f(ax,t,e),OD(e)])),ox(e)]))},GD=r(function(e,t){return{$:"CreateClicked",a:e,b:t}}),zD={$:"Web3Connect"},YD=function(e){return f(Kk,M([wN]),function(){var t=L(Gd(e),Mg(e));if("Just"===t.a.$){if("Just"===t.b.$){var r=t.a.a,n=t.b.a;return f(eL,"Open Trade",f(GD,n,r))}t.b;return f(O_,"Unsupported Network",ci)}t.a;return f(eL,"Connect to Wallet",zD)}())},WD=function(e){return{$:"AutoabortIntervalChanged",a:e}},JD=function(e){return{$:"ChangePaymentMethodText",a:e}},QD=r(function(e,t){return{$:"Placeholder",a:e,b:t}}),XD=QD,ZD=function(e){return f(XD,M([bA(d(YR,0,0,0,.2))]),function(){return fl("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")}())},eU={$:"TextArea"},tU=r(function(e,t){return l(WL,{autofill:ci,spellchecked:t.spellcheck,type_:eU},e,{label:t.label,onChange:t.onChange,placeholder:t.placeholder,text:t.text})}),rU=n(function(e,t,r){var n=f(Kk,M([bN(22),vN]),fl("Payment Method")),a=f(tU,M([ET(jk),yT(zk(150)),Wk(d(M_,155,203,255,.2)),p$(0)]),{label:vL("payment method"),onChange:JD,placeholder:""===r?si(ZD(t)):ci,spellcheck:!0,text:r});return f(ON,M([kN(20),m$({bottom:15,left:45,right:45,top:0}),ET(jk),U_(f(P_,M([fL,ex(30),aR(10),bN(20),ET(zk(400))]),e))]),M([n,a]))}),nU=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."},aU=a(function(e,t,r,n){var a=l(Rs,e,P("0"),Ni(n));return f(Kk,M([bN(22),bA(t)]),fl(U(a,r)))}),iU=function(e){return jd(e)<0?Vl(0):e},oU=n(function(e,t,n){var a=r(function(e,r){return f(ON,M([kN(4)]),M([f(Kk,M([aR(4),uN,pN(n(f(qb,t,e)))]),f(dR,M([yT(zk(10))]),hR)),r,f(Kk,M([aR(4),uN,pN(n(function(e){return jd(e)?e:Vl(3e5)}(iU(f(LR,t,e)))))]),f(dR,M([yT(zk(10))]),sR))]))}),i=XR(t);return f(VN,M([jD,kN(10)]),M([f(a,Vl(864e5),d(aU,3,e," days",i.days)),f(a,Vl(36e5),d(aU,2,e," hours",i.hours)),f(a,Vl(3e5),d(aU,2,e," min",i.min))]))}),uU=o(function(e,t,r,n,a,i){var o=f(Kk,M([Wk(d(M_,155,203,255,.2)),cN(5),aR(15),U_(f(P_,M([fL]),a))]),l(oU,DR,n,i)),u=f(VN,M([kN(30)]),M([f(dR,M([yT(zk(40)),pN(T_(d(Zd,"click","misclick","symbol for "+t,0)))]),e),f(Kk,M([bN(22),vN]),fl(t))])),s=f($N,M([bN(17),gR,bA(F_)]),M([fl(r)]));return f(ON,M([ET(jk),cN(10),Wk(l(Ok,237,237,237)),kN(2)]),f(xa,Kk(M([Wk(tN),f(aN,45,18),ET(jk)])),M([u,f(VN,M([ET(jk),kN(25),Wk(tN)]),M([o,s]))])))}),sU=uR({description:"fiat",src:"/DAIHard/static/img/fiat-bag-white.svg"}),cU=f(oN,tR,RT.clipX),fU=f(oN,tR,RT.clipY),lU=i(function(e,t,r,n,a){return f(ON,M([kN(15),cN(8),cU,fU,Wk(tN)]),M([p(uU,sU,"Payment Window",nU(a),r,n,WD),l(rU,t,a,e)]))}),dU=function(e){return{$:"AutoreleaseIntervalChanged",a:e}},hU=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."},pU=uR({description:"",src:"/DAIHard/static/img/release-window-icon.svg"}),gU=n(function(e,t,r){return f(Kk,M([cN(8),cU,fU,Wk(tN)]),p(uU,pU,"Burn/Release Window",hU(r),e,t,dU))}),vU=function(e){return{$:"AutorecallIntervalChanged",a:e}},yU=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."},mU=uR({description:"",src:"/DAIHard/static/img/open-window-icon.svg"}),bU=n(function(e,t,r){return f(Kk,M([cN(8),Wk(tN),cU,fU]),p(uU,mU,"Open Window",yU(r),e,t,vU))}),CU=function(e){return f(ON,M([ET(jk),kN(20)]),M([l(bU,e.inputs.autorecallInterval,e.errors.autorecallInterval,e.inputs.userRole),h(lU,e.inputs.paymentMethod,e.errors.paymentMethod,e.inputs.autoabortInterval,e.errors.autoabortInterval,e.inputs.userRole),l(gU,e.inputs.autoreleaseInterval,e.errors.autoreleaseInterval,e.inputs.userRole)]))},EU=function(e){return f(ON,M([ET(f(L_,1e3,jk)),wN,kN(20),m$({bottom:30,left:40,right:40,top:0}),pN(E_(!1)),m_(uL(e))]),M([qD(e),CU(e),YD(e.wallet)]))},SU=As(yb(8226)),TU=r(function(e,t){if(t.b){var n=t.a,a=t.b,i=r(function(t,r){return f(ka,e,f(ka,t,r))}),o=l(La,i,yr,a);return f(ka,n,o)}return yr}),wU=r(function(e,t){return l(Ra,ka,t,e)}),IU=n(function(e,t,r){for(;;){if(!(t>0))return e;var n=f(wU,r,e),a=t-1,i=r;e=n,t=a,r=i}}),AU=r(function(e,t){var r=Ti(t);return!r||R(r,e)?t:_(r,e)<0?$a(f(wU,f(lc,e%r,t),l(IU,yr,e/r|0,t))):f(lc,e,t)}),BU=a(function(e,t,r,n){for(;;){if(!r.b)return $a(n);var a=r.a,i=r.b,o=e(a);if(f(fw,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(Gm,o,t),c=i,l=f(ka,a,n);e=u,t=s,r=c,n=l}}}),kU=function(e){return d(BU,Ua,sm,e,yr)},NU=r(function(e,t){return f(Kk,M([ET(jk),m_(f(VN,M([kN(3),ET(nR(100)),ET(t),rR]),f(TU,f(Kk,M([bA(d(YR,0,0,0,.1)),bN(14)]),fl(SU)),f(xa,f(Da,Kk(M([bA(d(YR,0,0,0,.2))])),fl),f(AU,100,(e?$a:Ua)(kU(f(xa,f(zo,fu,Qa),Ia(HR)))))))))]),fl(" "))}),RU=r(function(e,t){var r=t.url,n=t.label;return d(fA,AT,TT("a"),f(ka,ST(hT(r)),f(ka,ST(pT("noopener noreferrer")),f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY),e))))),wT(M([n])))}),$U=function(){var e=f(Da,Kk(M([bA(l(pA,.8,.2,.2))])),fl),t=f(Da,Kk(M([_N])),fl);return f(ON,M([ET(jk),yT(jk),Wk(tN),cN(6),kN(50),Q$({blur:20,color:d(M_,0,0,0,.1),offset:L(0,3),size:0}),cN(10),aR(20)]),M([f(NU,!1,jk),f(ON,M([wN,ET(f(L_,700,jk)),kN(20)]),M([f($N,M([bN(70),_N,wN,t_]),M([fl("DAI"),e("Hard")])),f(VN,M([bN(30),vN,wN,t_,b$]),M([fl("The "),e("Global"),fl(", "),e("Unkillable"),fl(" Crypto Gateway")]))])),f(VN,M([Wk(CR),kN(2),wN,c_,ET(jk)]),M([f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([kN(60),PN]),M([f(Kk,M([bN(40),vN,wN]),fl("Want to learn more?")),f(ON,M([kN(15)]),M([f(RU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(A_),bA(tN),_N,bN(24),wN]),{label:f($N,M([t_]),M([fl("Go to the DAIHard Info page")])),url:"https://daihardhome.wpcomstaging.com/2019/07/24/re-launch-test-post/"}),f(RU,M([cN(4),ET(jk),uN,f(aN,25,17),Wk(A_),bA(tN),_N,bN(24),wN]),{label:f($N,M([t_]),M([fl("Join the Telegram Group")])),url:"https://t.me/daihardexchange_group"})]))]))),f(Kk,M([f(aN,40,10),Wk(tN),ET(jk),yT(jk)]),f(ON,M([k$,kN(60)]),M([f(Kk,M([bN(40),vN,wN]),fl("Ready to try it out?")),f(ON,M([kN(10),ET(zk(400)),wN]),M([f($N,M([bN(24),ET(jk)]),M([fl("Make sure your web3 wallet is unlocked (we recommend using Nifty Wallet over Metamask).")])),f($N,M([bN(24),ET(jk)]),M([fl("Then follow the links at the top of this page to browse "),t("Sell Offers"),fl(", browse "),t("Buy Offers"),fl(", or "),t("Create Your Own Offer"),fl(".")]))]))])))])),f(Kk,M([aL,ET(jk)]),f(NU,!0,jk))]))}(),_U=r(function(e,t){return f(Ay,f(zo,function(e){return e.type_},Ja(e)),t)}),LU=function(e){return{$:"ShowCurrencyDropdown",a:e}},xU=r(function(e,t){return ml(t(e))}),PU=i(function(e,t,r,n,a){var i=l(xU,e,a.filterFunc,ay(f(xa,GN,n)));return R(i,yr)?f(Kk,M([wN,bN(24),m$({bottom:0,left:0,right:0,top:30}),b$]),fl(r?"No trades found with those filters.":"Initializing Trade Cache...")):f(Yi,Rv,d(v$,e,a.tradeTable,M([t?Av:xo,JN,YN,WN,QN,zN]),i))}),DU=function(e){return{$:"FiltersMsg",a:e}},UU={$:"ApplyInputs"},OU=UL("disabled"),MU=function(e){return{$:"MayPreventDefault",a:e}},FU=r(function(e,t){return f(lN,e,MU(t))}),VU=r(function(e,t){var r=function(r){return R(r,e)?Fi(t):hu("Not the enter key")},n=f(du,r,f(Oh,"key",pu));return ST(f(FU,"keyup",f(Oi,function(e){return L(e,!0)},n)))}),KU=function(e){return f(VU,"Enter",e)},HU={$:"Button"},jU=r(function(e,t){var r=t.onPress,n=t.label;return d(fA,AT,Vk,f(ka,ET(bT),f(ka,yT(bT),f(ka,lA(RT.contentCenterX+" "+RT.contentCenterY+" "+RT.seButton+" "+RT.noTextSelection),f(ka,uN,f(ka,xL(e),f(ka,NN(HU),f(ka,ST(P$(0)),function(){if("Nothing"===r.$)return f(ka,ST(OU(!0)),e);var t=r.a;return f(ka,pN(t),f(ka,KU(t),e))}()))))))),wT(M([n])))}),qU=f(jU,M([Wk(A_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Apply")),onPress:si(UU)}),GU=function(e){var t=e.topLeft,r=e.topRight,n=e.bottomLeft,a=e.bottomRight;return f(yA,sN,l(jI,"br-"+Ni(t)+"-"+Ni(r)+Ni(n)+"-"+Ni(a),"border-radius",Ni(t)+"px "+Ni(r)+"px "+Ni(a)+"px "+Ni(n)+"px"))},zU=function(e){return f(dN,"focus",Fi(e))},YU=f(Da,ST,zU),WU=s(function(e,t,r,n,a,i,o,u){var s=function(){if("Nothing"===o.$)return yr;var e=o.a;return M([YU(e(!0)),hx(e(!0))])}();return f(VN,U(e,M([yT(zk(40)),Q$({blur:20,color:d(M_,233,237,242,.05),offset:L(0,3),size:0})])),M([f(Kk,M([Wk(IR),yT(zk(40)),GU({bottomLeft:4,bottomRight:0,topLeft:4,topRight:0})]),f(Kk,M([eR,f(aN,10,0)]),r)),f(JL,U(s,U(t,M([ET(zk(100)),yT(zk(40)),d$(IR),GU({bottomLeft:0,bottomRight:4,topLeft:0,topRight:4}),Z$({bottom:1,left:0,right:1,top:1})]))),{label:vL(n),onChange:u,placeholder:i,text:a})]))}),JU=function(e){return{$:"MaxDaiChanged",a:e}},QU=function(e){return{$:"MinDaiChanged",a:e}},XU=r(function(e,t){return f(ON,M([ET(jk),kN(8)]),M([f(Kk,M([bN(17),gR]),fl(e)),t]))}),ZU=ZT(25),eO=function(e){return{$:"MoveX",a:e}},tO=function(e){return f(j$,ZU,eO(-e))},rO={$:"OnLeft"},nO=function(e){return f(t$,rO,e)},aO=n(function(e,t,r){var n=hL(M([eR])),a=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("max"))])),i=f(VN,M([kN(8),eR,ET(zk(60))]),M([n,f(Kk,M([bN(16),eR]),fl("min"))]));return f(XU,"Dai Range",f(ON,M([kN(5),ET(zk(200))]),M([v(WU,M([nO(f(P_,M([tO(5),ET(zk(200))]),r.minDai))]),M([YU(LU(!1))]),i,"min Dai",e,ci,ci,QU),v(WU,M([nO(f(P_,M([tO(5),ET(zk(200))]),r.maxDai))]),M([YU(LU(!1))]),a,"max Dai",t,ci,ci,JU)])))}),iO=function(e){var t=f(fp,e,HR);if("Nothing"===t.$)return fl("*");var r=t.a,n=r.b;return f(dR,M([yT(zk(26))]),n)},oO=function(e){return{$:"AppCmd",a:e}},uO=function(e){return{$:"FiatTypeInputChanged",a:e}},sO=n(function(e,t,r){var n=oO(d(Zd,"click","misclick","currency flag",0)),a=iO(t);f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("max"))])),f(VN,M([kN(8),eR,ET(zk(60))]),M([a,f(Kk,M([bN(16),eR]),fl("min"))]));return f(Kk,M([c_,ET(zk(120))]),f(XU,"Fiat Type",h(DD,e,t,LU(!0),uO,n)))}),cO={$:"AddSearchTerm"},fO=function(e){return{$:"PaymentMethodInputChanged",a:e}},lO=f(Oh,"keyCode",CE),dO=function(e){return f(dN,"keyup",f(du,function(t){return 13===t?Fi(e):hu(Ni(t))},lO))},hO=function(e){return f(XU,"Search Payment Methods",f(JL,M([c_,ET(zk(250)),yT(zk(40)),d$(IR),Q$({blur:20,color:d(M_,233,237,242,.05),offset:L(0,3),size:0}),R_(dO(cO))]),{label:vL("payment methods search"),onChange:fO,placeholder:ci,text:e}))},pO={$:"ResetSearch"},gO=f(jU,M([Wk(A_),aR(10),cN(5)]),{label:f(Kk,M([bA(tN),wN,eR]),fl("Reset")),onPress:si(pO)}),vO=function(e){return{$:"RemoveTerm",a:e}},yO=function(e){return f(Kk,M([aR(3),c_,uN,pN(vO(e)),bN(10),bA(EN)]),fl("x"))},mO=function(e){if(e.b){var t=e;return f(VN,M([ET(jk),aR(10),kN(10)]),f(xa,function(e){return f(VN,M([Wk(d(M_,16,7,234,.2)),cN(5),aR(4),kN(3)]),M([fl(e),yO(e)]))},t))}return qk},bO=i(function(e,t,r,n,a){var i=function(e){return f(Kk,M([bN(20),vN,bA(CR),wN]),fl(e))},o=f(Eh,Ja(d_),f(xa,v_,e))?M([i("No trades found.")]):f(xa,i,mE(f(xa,function(e){switch(v_(e).$){case"QueryingNumTrades":return si("Querying "+hB(e.factory)+" Factory...");case"NoneFound":return ci;case"FetchingTrades":return si("Fetching "+hB(e.factory)+" Trades...");default:return ci}},e)));return f(Kk,M([ET(jk),m_(f(ON,M([kN(5),k$]),o))]),f(VN,M([wN,kN(50)]),M([f(Yi,DU,l_(t)),f(VN,M([ET(bT),kN(10)]),M([f(Kk,M([ET(bT),c_]),l(aO,r.minDai,r.maxDai,n)),f(Kk,M([ET(bT),c_]),l(sO,a,r.fiatType,n)),f(ON,M([ET(bT),c_,kN(5)]),M([hO(r.paymentMethod),mO(r.paymentMethodTerms)])),f(XU," ",f(ON,M([kN(5),ET(bT)]),M([qU,gO])))]))])))}),CO=n(function(e,t,r){var n=f(Eh,f(zo,v_,Ja(h_)),t),a=function(){return!f(xc,0,f(Bo,function(e){return f(MS,function(e){return e.checked&&"Open"!==e.label},e.options)},f(_U,Eo,r.filters)))}();return f(ON,M([cN(5),Wk(tN),ET(jk),yT(jk),pN(LU(!1)),aR(30)]),M([f(VN,M([ET(jk),kN(10)]),M([h(bO,t,r.filters,r.inputs,r.errors,r.showCurrencyDropdown)])),h(PU,e,a,n,t,r)]))}),EO=function(e){return{$:"MessageInputChanged",a:e}},SO={$:"MessageSubmit"},TO=function(e){return f(ON,M([ET(jk),kN(10)]),M([f(tU,M([ET(jk),yT(zk(100))]),{label:vL("messageInput"),onChange:EO,placeholder:ci,spellcheck:!1,text:e.messageInput}),f(jU,M([wN,bN(24)]),{label:fl("Submit"),onPress:si(SO)})]))},wO=f(oN,tR,RT.scrollbarsY),IO=r(function(e,t){return f(Kk,M([yT(jk),ET(jk)]),f(Kk,U(M([R_(f(N_,"position","absolute")),R_(f(N_,"top","0")),R_(f(N_,"right","0")),R_(f(N_,"bottom","0")),R_(f(N_,"left","0")),wO]),e),t))}),AO=l(Ok,200,205,210),BO=n(function(e,t,r){var n=M([PN,Wk(A_),bA(tN),GU({bottomLeft:15,bottomRight:0,topLeft:15,topRight:15})]),a=M([k$,Wk(AO),bA(DR),GU({bottomLeft:0,bottomRight:15,topLeft:15,topRight:15})]),i=r.eventInfo;if("Statement"===i.$){var o=i.a,u=R(o.who,t)?n:a;return f(Kk,U(M([aR(7)]),u),f($N,yr,M([fl(U(function(){return"Buyer"===o.who.$?"B: ":"S: "}(),function(){var e=o.message;switch(e.$){case"FailedDecode":return"DECODE FAILED";case"Encrypted":return"(encrypted data)";case"FailedDecrypt":return"DECRYPT FAILED";default:return e.a}}()))])))}var s=i.a,c=function(){switch(s.$){case"Initiated":return si(x(l(pA,0,0,1),tN,"Initiator opened the trade"));case"Recalled":return si(x(l(pA,0,0,1),tN,"Initiator recalled the trade"));case"Committed":var t=s.a,r=f(ru,8,dl(t))+"..";return si(x(l(pA,1,0,1),tN,r+" committed to the trade"));case"Aborted":return si(x(l(pA,1,0,0),tN,"Buyer aborted the trade"));case"Claimed":return si(x(l(pA,0,1,0),tN,"Buyer marked the fiat transfer complete"));case"Released":return si(x(l(pA,0,0,1),tN,"Seller released the "+NR(e)+" and closed the contract"));default:return si(x(l(pA,0,0,1),tN,"Seller burned the "+NR(e)+" and closed the contract"))}}();if("Nothing"===c.$)return qk;var d=c.a,h=d.a,p=d.b,g=d.c;return f(Kk,M([cN(3),p$(1),d$(l(pA,1,0,1)),wN,Wk(h)]),f($N,M([bA(p)]),M([fl(g)])))}),kO=n(function(e,t,r){if(r.b){var n=r;return f(IO,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),aR(10)]),f(ON,M([ET(jk),yT(jk),kN(10)]),f(xa,f(BO,e,t),n)))}return f(Kk,M([ET(jk),yT(jk),cN(5),p$(1),d$(DR),wN,bA(l(pA,.5,.5,.5)),b$]),fl("no messages found."))}),NO=Cr,RO=function(e){return f(ON,M([ET(jk),yT(jk),kN(10),p$(1),cN(5),aR(20)]),M([l(kO,e.trade.factory,e.userRole,f(NO,function(e){return e.blocknum},Sa(e.history))),TO(e)]))},$O=function(e){return f(Kk,M([Wk(tN),cN(8),HD,ET(jk),yT(jk)]),RO(e))},_O={$:"ToggleChat"},LO=function(e){if(e.showChatHistory){var t=f(xc,qk,f(Bo,$O,e.chatHistoryModel));return f(Kk,M([yT(jk),ET(zk(500)),aR(20),PN]),l(x_,M([yT(jk),ET(jk)]),f(Yi,jE,t),_O))}return qk},xO=function(e){return"Buyer"===e.initiatorRole.$?lo:fo},PO=function(e){return zR(e)+" "+e.fiatType},DO={$:"AbortAction"},UO=n(function(e,t,r){return{$:"ConfirmCommit",a:e,b:t,c:r}}),OO=function(e){var t=L(e.txChainStatus,e.trade);if("Just"!==t.a.$){t.a;return qk}if("LoadedTrade"!==t.b.$)return qk;var r=t.a.a,n=t.b.a;switch(r.$){case"ConfirmingCommit":var a=r.a,i=r.b,o=PO(n.terms.price),u=u$(oC(i)),s=u$(n.parameters.tradeAmount)+" "+NR(n.factory),c=function(){return"Buyer"===xO(n.parameters).$?L(f(Kk,M([gR,bA(DR)]),fl("buyer")),M([fl("pay the seller "),f(Kk,M([bA(A_)]),fl(o)),fl(" in exchange for the "),f(Kk,M([bA(A_)]),fl(s)),fl(" held in this contract.")])):L(f(Kk,M([gR,bA(DR)]),fl("seller")),M([fl("accept "),f(Kk,M([bA(A_)]),fl(o)),fl(" from the buyer in exchange for the "),f(Kk,M([bA(A_)]),fl(s)),fl(" held in this contract.")]))}(),d=c.a,h=c.b;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),U(M([U(M([fl("You will deposit "),f(Kk,M([bA(A_)]),fl(u+" "+NR(n.factory))),fl(", thereby becoming the "),d,fl(" of this trade. By doing so, you are agreeing to ")]),h)]),function(){return"Token"===n.factory.$?M([M([fl("(This ususally requires two Metamask signatures. Your "+NR(n.factory)+" will not be deposited until the second transaction has been mined.)")])]):yr}()))),f(Kk,M([aL,wN]),f(eL,"Yes, I definitely want to commit to this trade.",l(UO,n,a,i)))])),DO);case"ApproveNeedsSig":return tL(M([fl("Waiting for user signature for the approve call."),fl("(check Metamask!)"),fl("Note that there will be a second transaction to sign after this.")]));case"ApproveMining":var p=r.a;return tL(M([fl("Mining the initial approve transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction on Etherscan"),url:f(rL,n.factory,p)}),fl("Funds will not leave your wallet until you sign the next transaction.")]));case"CommitNeedsSig":return tL(M([fl("Waiting for user signature for the final commit call."),fl("(check Metamask!)"),fl("This will make the deposit and commit you to the trade.")]));case"CommitMining":var p=r.a;return tL(M([fl("Mining the final commit transaction..."),f(dA,M([iL,bA(A_)]),{label:fl("See the transaction"),url:f(rL,n.factory,p)})]));case"ConfirmingAction":var g=r.a;return l(x_,yr,f(ON,M([kN(20),aR(20),wN,yT(jk),t_]),M([f(Kk,M([bN(26),vN,wN,eR]),fl("Just to Confirm...")),f(ON,M([kN(20),wN,eR]),f(xa,$N(M([wN,bN(18),gR,bA(F_)])),function(){switch(g.$){case"Poke":case"Recall":return yr;case"Claim":return M([M([fl('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 '+NR(n.factory)+" rather than release it to you.")])]);case"Abort":return M([M([fl("Aborting will incur a small penalty on both parties, and refund the rest of the "+NR(n.factory)+".")])]);case"Release":return M([M([fl("Releasing the payment will irreversibly send the trade's balance to the Buyer. Only do this if you are certain you've received the full agreed-upon payment.")])]);default:return M([M([fl("This will destroy the "+NR(n.factory)+" in the payment. Only do this if the Buyer has attempted to scam you, is nonresponsive, or for some reason has failed the payment.")])])}}())),f(Kk,M([aL,wN]),function(e){return f(eL,e,sS(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 "+NR(n.factory)+".";default:return"I understand. Burn the "+NR(n.factory)+"."}}()))])),DO);case"ActionNeedsSig":var g=r.a;return tL(M([fl("Waiting for user signature for the "+fS(g)+" call."),fl("(check Metamask!)")]));default:var g=r.a,p=r.b;return qk}},MO=VN(M([ET(jk),Wk(tN),cN(5),aR(20),jD,HD])),FO=function(e){return f(VN,M([kN(8)]),M([f(dR,yr,dL),f(Kk,M([bN(24),gR]),fl(u$(e)))]))},VO=r(function(e,t){var r=f(Io,Ao(e),f(Bo,function(e){return e.address},Gd(t)));return f(nx,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"}(),FO(e.parameters.tradeAmount))}),KO=function(e){return f(VN,M([kN(5)]),M([dx(e.fiatType),f(Kk,M([bN(24),gR]),fl(PO(e)))]))},HO=function(e){return f(nx,"For Fiat",KO(e.terms.price))},jO=function(e){return"Buyer"===e.$?"Buyer":"Seller"},qO=l(Ok,250,165,22),GO=l(Ok,255,0,0),zO=l(Ok,0,255,0),YO=uR({description:"aborted",src:"/DAIHard/static/img/aborted.svg"}),WO=uR({description:"burned",src:"/DAIHard/static/img/burned.svg"}),JO=uR({description:"released",src:"/DAIHard/static/img/released.svg"}),QO={$:"ToggleStatsModal"},XO=function(e){return f(NO,Ua,e)},ZO=n(function(e,t,n){var a=ay(f(xa,function(e){return f(ml,function(e){return R(f(ko,e,n),si(t))},f(US,function(e){if("LoadedTrade"===e.$){var t=e.a;return si(t)}return ci},Sa(e.trades)))},e)),i=Ti(a),o=l(Ra,r(function(e,t){switch(e.state.closedReason.$){case"Released":return D(t,{amountReleased:f(fh,t.amountReleased,e.parameters.tradeAmount),numReleases:t.numReleases+1});case"Burned":return D(t,{amountBurned:f(fh,t.amountBurned,e.parameters.tradeAmount),numBurns:t.numBurns+1});case"Aborted":return D(t,{numAborts:t.numAborts+1});default:return t}}),{amountBurned:Wl,amountReleased:Wl,numAborts:0,numBurns:0,numReleases:0},a),u=f(Bo,Vl,Ql(XO(f(US,function(e){return function(e){return e?si(e):ci}(jd(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}}),eM=r(function(e,t){return d(Z_,x(d(YR,0,0,1,1),d(YR,0,0,1,.8),d(YR,0,0,1,.6)),tN,e,t)}),tM=function(e){return{$:"ViewUserHistory",a:e}},rM=f(JB,0,yr),nM=f(oN,gN,RT.textNormalWeight),aM=r(function(e,t){return Za(e/t)}),iM=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}}),oM=r(function(e,t){var r=e.a,n=e.b;return l(iM,r,f(aM,jd(t),6e4),n)}),uM=r(function(e,t){return f(_s,24,f(aM,f(oM,e,t),60))}),sM=r(function(e,t){return f(_s,1e3,jd(t))}),cM=r(function(e,t){return f(_s,60,f(oM,e,t))}),fM={$:"Apr"},lM={$:"Aug"},dM={$:"Dec"},hM={$:"Feb"},pM={$:"Jan"},gM={$:"Jul"},vM={$:"Jun"},yM={$:"Mar"},mM={$:"May"},bM={$:"Nov"},CM={$:"Oct"},EM={$:"Sep"},SM=function(e){var t=f(aM,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)}},TM=r(function(e,t){switch(SM(f(oM,e,t)).month){case 1:return pM;case 2:return hM;case 3:return yM;case 4:return fM;case 5:return mM;case 6:return vM;case 7:return gM;case 8:return lM;case 9:return EM;case 10:return CM;case 11:return bM;default:return dM}}),wM=r(function(e,t){return f(_s,60,f(aM,jd(t),1e3))}),IM={$:"Fri"},AM={$:"Mon"},BM={$:"Sat"},kM={$:"Sun"},NM={$:"Thu"},RM={$:"Tue"},$M={$:"Wed"},_M=r(function(e,t){switch(f(_s,7,f(aM,f(oM,e,t),1440))){case 0:return NM;case 1:return IM;case 2:return BM;case 3:return kM;case 4:return AM;case 5:return RM;default:return $M}}),LM=n(function(e,t,r){return e.toAmPm(f(uM,t,r))}),xM=r(function(e,t){return SM(f(oM,e,t)).day}),PM=xM,DM=M([kM,AM,RM,$M,NM,IM,BM]),UM=r(function(e,t){return function(e){return e.a}(f(xc,L(0,kM),Ql(f(ml,function(r){return R(r.b,f(_M,e,t))},f(Bi,r(function(e,t){return L(e,t)}),DM)))))}),OM=function(e){return l(Ra,Na,0,e)},MM=r(function(e,t){return SM(f(oM,e,t)).year}),FM=function(e){return!f(_s,4,e)&&(!!f(_s,100,e)||!f(_s,400,e))},VM=r(function(e,t){switch(t.$){case"Jan":return 31;case"Feb":return FM(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}}),KM=M([pM,hM,yM,fM,mM,vM,gM,lM,EM,CM,bM,dM]),HM=r(function(e,t){return f(xc,L(0,pM),Ql(f(ml,function(r){r.a;return R(r.b,f(TM,e,t))},f(Bi,r(function(e,t){return L(e,t)}),KM))))}),jM=r(function(e,t){return 1+function(e){var t=e.a;e.b;return t}(f(HM,e,t))}),qM=r(function(e,t){var r=f(lc,f(jM,e,t)-1,KM);return OM(f(xa,VM(f(MM,e,t)),r))+f(PM,e,t)}),GM=r(function(e,t){return f(jM,e,t)/4|0}),zM=r(function(e,t){var r=Ni(t),n=e-Qo(r);return U(f(Ri,"",f(xa,function(e){return"0"},f(Ai,1,n))),r)}),YM=function(e){return e?e<=12?e:e-12:12},WM=sv(315576e5),JM=r(function(e,t){return Vl(WM*f(MM,e,t))}),QM=r(function(e,t){var r=f(JM,e,t),n=f(UM,e,r);return 1+((f(qM,e,t)+n)/7|0)}),XM=r(function(e,t){return Ni(f(MM,e,t))}),ZM=a(function(e,t,r,n){switch(n.$){case"MonthNumber":return Ni(f(jM,t,r));case"MonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(jM,t,r));case"MonthFixed":return f(zM,2,f(jM,t,r));case"MonthNameAbbreviated":return e.toMonthAbbreviation(f(TM,t,r));case"MonthNameFull":return e.toMonthName(f(TM,t,r));case"QuarterNumber":return Ni(1+f(GM,t,r));case"QuarterSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(1+f(GM,t,r));case"DayOfMonthNumber":return Ni(f(PM,t,r));case"DayOfMonthSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(PM,t,r));case"DayOfMonthFixed":return f(zM,2,f(PM,t,r));case"DayOfYearNumber":return Ni(f(qM,t,r));case"DayOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(qM,t,r));case"DayOfYearFixed":return f(zM,3,f(qM,t,r));case"DayOfWeekNumber":return Ni(f(UM,t,r));case"DayOfWeekSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(UM,t,r));case"DayOfWeekNameAbbreviated":return e.toWeekdayAbbreviation(f(_M,t,r));case"DayOfWeekNameFull":return e.toWeekdayName(f(_M,t,r));case"WeekOfYearNumber":return Ni(f(QM,t,r));case"WeekOfYearSuffix":return function(t){return U(Ni(t),e.toOrdinalSuffix(t))}(f(QM,t,r));case"WeekOfYearFixed":return f(zM,2,f(QM,t,r));case"YearNumberLastTwo":return f(ou,2,f(XM,t,r));case"YearNumber":return f(XM,t,r);case"AmPmUppercase":return $D(l(LM,e,t,r));case"AmPmLowercase":return sd(l(LM,e,t,r));case"HourMilitaryNumber":return Ni(f(uM,t,r));case"HourMilitaryFixed":return f(zM,2,f(uM,t,r));case"HourNumber":return Ni(YM(f(uM,t,r)));case"HourFixed":return f(zM,2,YM(f(uM,t,r)));case"HourMilitaryFromOneNumber":return Ni(1+f(uM,t,r));case"HourMilitaryFromOneFixed":return f(zM,2,1+f(uM,t,r));case"MinuteNumber":return Ni(f(cM,t,r));case"MinuteFixed":return f(zM,2,f(cM,t,r));case"SecondNumber":return Ni(f(wM,t,r));case"SecondFixed":return f(zM,2,f(wM,t,r));case"MillisecondNumber":return Ni(f(sM,t,r));case"MillisecondFixed":return f(zM,3,f(sM,t,r));default:return n.a}}),eF=a(function(e,t,r,n){return f(Ri,"",f(xa,l(ZM,e,r,n),t))}),tF=o(function(e,t,r,n,a,i){return{toAmPm:a,toMonthAbbreviation:t,toMonthName:e,toOrdinalSuffix:i,toWeekdayAbbreviation:n,toWeekdayName:r}}),rF=function(e){return e>11?"pm":"am"},nF=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"}},aF=function(e){switch(f(_s,100,e)){case 11:case 12:case 13:return"th";default:switch(f(_s,10,e)){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},iF=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"}},oF=p(tF,nF,f(zo,nF,ru(3)),iF,f(zo,iF,ru(3)),rF,aF),uF=eF(oF),sF={$:"MonthNameFull"},cF=sF,fF=function(e){return{$:"Text",a:e}},lF=fF,dF={$:"YearNumber"},hF=dF,pF=n(function(e,t,n){var a=r(function(e,t){return f(ON,M([bN(18),kN(6)]),M([f(Kk,M([_N]),fl(e)),f(Kk,M([nM]),fl(t))]))}),i=uF(M([cF,lF(", "),hF])),o=f(ON,M([kN(23),ET(jk)]),U(f(xa,function(e){var t=e.a,r=e.b;return f(a,t,r)},M([L("First Trade",function(){var e=n.firstTrade;if("Just"===e.$){var t=e.a;return f(i,rM,t)}return"No Committed Trades yet!"}()),L("Release Outcomes",Ni(n.numReleases)+" trades / "+u$(n.amountReleased)+" "+NR(e)+" Released"),L("Abort Outcomes",Ni(n.numAborts)+" trades"),L("Burn Outcomes",Ni(n.numBurns)+" trades / "+u$(n.amountBurned)+" "+NR(e)+" Burned")])),M([f(Kk,M([wN]),f(eM,"View User History",tM(n.asRole)))])));return f(ON,M([cN(8),cU,fU,Wk(IR),kN(1),Q$({blur:20,color:d(YR,0,0,0,.08),offset:L(0,0),size:0})]),M([f(Kk,M([ET(jk),Wk(tN),aR(17)]),f(E$,18,t)),f(Kk,M([ET(jk),Wk(tN),aR(17)]),o)]))}),gF=n(function(e,t,r){var n=l(ZO,t,e.parameters.initiatorRole,e.parameters.initiatorAddress),a=jO(e.parameters.initiatorRole)+" Stats";return f(Kk,r?M([ZL(f(Kk,M([ex(30),PN]),l(pF,e.factory,e.parameters.initiatorAddress,n)))]):yr,f(nx,a,f(VN,M([ET(jk),kN(20),uN,pN(QO)]),f(xa,VN(M([kN(5)])),M([M([f(dR,M([yT(zk(28))]),JO),f(Kk,M([bN(24),gR,bA(zO)]),fl(l(Rs,2,P("0"),Ni(n.numReleases))))]),M([f(dR,M([yT(zk(28))]),YO),f(Kk,M([bN(24),gR,bA(qO)]),fl(l(Rs,2,P("0"),Ni(n.numAborts))))]),M([f(dR,M([yT(zk(28))]),WO),f(Kk,M([bN(24),gR,bA(GO)]),fl(l(Rs,2,P("0"),Ni(n.numBurns))))])])))))}),vF=r(function(e,t){if("Token"===e.$){if("EthDai"===e.a.$){e.a;return"https://etherscan.io/address/"+dl(t)}e.a;return"https://kovan.etherscan.io/address/"+dl(t)}switch(e.a.$){case"Eth":e.a;return"https://etherscan.io/address/"+dl(t);case"Kovan":e.a;return"https://kovan.etherscan.io/address/"+dl(t);default:e.a;return"https://blockscout.com/poa/dai/address/"+dl(t)}}),yF=n(function(e,t,r){return f(dA,e,{label:fl(dl(r)),url:f(vF,t,r)})}),mF=function(e){return f(nx,"Trade Status",f(ON,M([bN(24),gR,kN(8)]),M([fl(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(yF,M([bN(12),bA(A_),iL]),e.factory,e.creationInfo.address)])))},bF=i(function(e,t,r,n,a){return MO(M([mF(t),f(VO,t,r),HO(t),l(gF,t,n,a)]))}),CF=l(Ok,9,32,107),EF=uR({description:"chat",src:"/DAIHard/static/img/chat.svg"}),SF=f(Kk,M([cN(4),uN,pN(_O),aR(5),Wk(l(Ok,22,0,255))]),f(dR,M([ET(zk(42))]),EF)),TF=function(e){switch(e.$){case"NotClosed":return"";case"Recalled":return"Recalled";case"Aborted":return"Aborted";case"Released":return"Released";default:return"Burned"}},wF=function(e){return f(ON,M([cN(12),Wk(IR),aR(15),kN(15)]),M([f(Kk,M([bN(24),vN,b$]),fl("Fiat Payment Method")),f($N,M([bN(18),yT(bT),Wk(tN),Q$({blur:5,color:d(YR,0,0,0,.2),offset:L(-3,3),size:0}),cN(3),aR(5)]),M([f(xc,f(Kk,M([bA(FD),b$]),fl("No payment methods found.")),f(Bo,fl,f(Bo,function(e){return e.info},Ql(e))))]))]))},IF={$:"Active"},AF=function(e){return{$:"ExpandPhase",a:e}},BF=M([Wk(CF),bA(tN)]),kF=r(function(e,t){return{$:"Min",a:e,b:t}}),NF=r(function(e,t){return f(kF,e,t)}),RF=function(e){return M(e?[cN(12),c_,yT(f(NF,380,bT))]:[cN(12),wN])},$F=M([Wk(tN)]),_F=uR({description:"flame",src:"/DAIHard/static/img/flame.png"}),LF=r(function(e,t){return Hl(f(ds,jl(e),jl(t)))}),xF=r(function(e,t){return d(Z_,x(d(YR,1,.6,.2,1),d(YR,1,.6,.2,.8),d(YR,1,.6,.2,.6)),tN,e,t)}),PF=n(function(e,t,r){return{$:"CommitClicked",a:e,b:t,c:r}}),DF=function(e){return{$:"ContractActionClicked",a:e}},UF={$:"Web3Connect"},OF=n(function(e,t,r){var n=Gd(r);if("Just"===n.$){var a=n.a;return"TimeUp"===f(xR,e,t).$?qk:f(VN,M([kN(8)]),function(){var e=x(t.state.phase,f(Ao,t,a.address),f(ko,t,a.address));e:for(;;)switch(e.a.$){case"Open":if("Just"===e.b.$){if("Initiator"===e.b.a.$){e.a,e.b.a;return M([f(Yi,sS,f(eM,"Remove and Refund this Trade",oS))])}break e}var r=(e.a,e.b,jl(Vb(t.parameters)));return M([f(eL,"Deposit and Commit to Trade",l(PF,t,a,r))]);case"Committed":if("Just"===e.c.$){if("Buyer"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(xF,"Abort Trade",GE)),f(Yi,DF,f(eL,"Confirm Payment",ZE)),SF])}e.a,e.c.a;return M([SF])}break e;case"Judgment":if("Just"===e.c.$){if("Seller"===e.c.a.$){e.a,e.c.a;return M([f(Yi,DF,f(eL,"Burn it All!",XE)),f(Yi,DF,f(eM,"Release Everything",uS)),SF])}e.a,e.c.a;return M([SF])}break e;default:break e}return yr}())}return f(eL,"Connect to Wallet",UF)}),MF={$:"Finished"},FF={$:"NotStarted"},VF=r(function(e,t){var r=L(ER(t),ER(e.state.phase)),n=r.a,a=r.b;return _(n,a)>0?FF:R(n,a)?IF:MF}),KF=n(function(e,t,r){for(;;){if(t<=0)return e;var n=f(ka,r,e),a=t-1,i=r;e=n,t=a,r=i}}),HF=r(function(e,t){return l(KF,yr,e,t)}),jF=a(function(e,t,r,n){var a=u$(f(fh,r.parameters.tradeAmount,r.parameters.buyerDeposit))+" "+NR(r.factory),i=u$(r.parameters.tradeAmount)+" "+NR(r.factory),o=f(VN,yr,f(HF,3,f(dR,M([yT(zk(18))]),_F))),u=f(Da,Kk(M([bA(l(pA,1,0,0))])),fl),s=R(e,r.state.phase),c=f(Io,ko(r),f(Bo,function(e){return e.address},Gd(n))),d=s?tN:DR,h=$N(M([bA(d),bN(18),vN])),p=PO(r.terms.price),g=s?l(Ok,0,226,255):l(Ok,16,7,234),v=f(Da,Kk(M([bA(g)])),fl),y=u$(r.parameters.buyerDeposit)+" "+NR(r.factory),m=r.parameters.abortPunishment,b=u$(m)+" "+NR(r.factory),C=u$(f(LF,r.parameters.buyerDeposit,m))+" "+NR(r.factory),E=u$(f(LF,r.parameters.tradeAmount,m))+" "+NR(r.factory),S=function(){var t=L(e,c);if("Just"===t.b.$)switch(t.a.$){case"Open":var n=(t.a,t.b.a);return L("And Now, We Wait",function(){return"Buyer"===n.$?f(xa,h,M([M([fl("Your "),u("burnable deposit"),fl(" of "),v(y),fl(" is now held in this contract, and your offer to buy "),v(i),fl(" for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Seller by depositing the full "),v(i),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(y),fl(" to you.")])])):f(xa,h,M([M([fl("Your offer to sell the "),v(i),fl(" held in this contract for "),v(p),fl(" is now listed in the marketplace.")]),M([fl("If another user likes your offer, they can become the Buyer by depositing a "),u("burnable deposit"),fl(" of 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract.")]),M([fl("If no one commits within the Open Window, your offer will expire, refunding the "),v(i),fl(" to you.")])]))}());case"Committed":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Time to Pay Up",f(xa,h,M([M([fl("You must now pay the Seller "),v(p),fl(" via the Fiat Payment Method, "),f(Kk,M([vN]),fl("and then click ")),u("Confirm Payment"),fl(" before the payment window runs out. Use the chat to coordinate.")]),M([fl("If you abort the trade, or do not confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to you).")]),M([fl("This may be your last chance to clear up any ambiguity before Judgement. Do not confirm unless you're sure the "),v(p),fl(" has been unmistakably transferred.")])])))}t.a,t.b.a;return L("Time to Get Paid",f(xa,h,M([M([fl("Work and communicate with the Buyer to receive "),v(p),fl(" as described in Fiat Payment Method. Then, the Buyer should confirm the payment, moving the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(") will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to you, "),v(C),fl(" to the Buyer).")])])));case"Judgment":if("Buyer"===t.b.a.$){t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("If the Seller confirms receipt of payment, or fails to decide within the Burn/Release Window, the combined balance of "),v(a),fl(" will be released to you.")]),M([fl("If they cannot confirm they've received payment from you, they will probably instead "),u("burn the contract's balance of "),v(a),u("."),fl(" In this case the "),v(a),fl(" will be lost to both parties.")]),M([fl("These are the only options the Seller has. So, fingers crossed!")])])))}t.a,t.b.a;return L("Judgement",f(xa,h,M([M([fl("By pushing the contract to the final stage, the Buyer has indicated that the transfer has taken place, and awaits your judgement.")]),M([fl("So, have you recieved the "),v(p),fl("? If so, you can click "),v("Release Everything"),fl(".")]),M([fl("If not, the Buyer is probably trying to scam you, and you should probably "),u("burn it all"),fl(". You're not getting it back either way, and you wouldn't want the other guy to get it, would you?")]),M([fl("If you don't decide within the Burn/Release Window, the balance will be automatically released.")])])));default:t.a;return L("Contract closed.",M([h(M([fl("Check the chat log for the full history.")]))]))}else switch(t.a.$){case"Open":t.a,t.b;return L("Get it while it's hot",function(){return"Seller"===r.parameters.initiatorRole.$?f(xa,h,M([M([fl("The Seller has deposited "),v(i),fl(" into this contract, and offers to sell it for "),v(p),fl(". To become the Buyer, you must deposit 1/3 of the trade amount "),v("("+y+")"),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("If the trade is successful, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to you. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can fulfil one of the seller’s accepted payment methods below for "),v(p),fl(" within the payment window.")])])):f(xa,h,M([M([fl("The Buyer is offering to buy "),v(i),fl(" for "),v(p),fl(", and has deposited "),v(y),fl(" into this contract as a "),u("burnable deposit"),fl(". To become the Seller, deposit "),v(i),fl(" into this contract by clicking "),u("Deposit and Commit to Trade"),fl(".")]),M([fl("When you receive the "),v(p),fl(" from the Buyer, the combined "+NR(r.factory)+" balance "),v("("+a+")"),fl(" will be released to the Buyer. If anything goes wrong, there are "),u("burnable punishments "),o,fl(" for both parties (see Payment Window for more on this).")]),M([fl("Don't commit unless you can receive "),v(p),fl(" via one of the Buyer's payment methods below, within the payment window.")])]))}());case"Committed":t.a,t.b;return L("Making the Payment",f(xa,h,M([M([fl("During this phase, the Buyer is expected to transfer "),v(p),fl(" to the Seller, as described in Fiat Payment Method, "),f(Kk,M([vN]),fl("and ")),u("Confirm the Payment "),fl(" before the payment window runs out. This would move the trade to the final phase.")]),M([fl("If the Buyer aborts the trade, or doesn't confirm payment before this time is up, "),v(b),fl(" (1/4 of the "),u("burnable deposit"),fl(" amount) will be "),u("burned"),fl(" from both parties, while the remainder of each party's deposit is refunded ("),v(E),fl(" to the Seller, "),v(C),fl(" to the Buyer).")])])));case"Judgment":t.a,t.b;return L("Judgement",f(xa,h,M([M([fl("The Buyer has indicated that the transfer has taken place, and awaits the Seller's judgement on the fact of the matter.")]),M([fl("If the Seller can verify he has received the "),v(p),fl(", he will probably release the total balance of "),v(i),fl(" to the Buyer. If he cannot verify payment, he will probably instead "),u("burn it all"),fl(".")]),M([fl("If the Seller has not made a decision before the Burn/Release Window expires, the "),v(i),fl(" will be automaticall released.")])])));default:t.a,t.b;return L("Contract closed.",yr)}}(),T=S.a,w=S.b;return f(ON,M([ET(jk),yT(jk),aR(20),kN(30)]),M([f(VN,M([ET(jk)]),M([f(Kk,M([bN(24),vN,bA(g),k$]),fl(T))])),f(ON,M([ET(jk),eR,kN(13)]),w),f(Kk,M([PN]),function(){switch(f(VF,r,e).$){case"Active":return l(OF,t,r,n);case"NotStarted":return f(Kk,M([bN(20),vN,b$,bA(CR)]),fl("Phase not yet started."));default:return f(Kk,M([bN(20),vN,b$]),fl("Phase no longer active."))}}())]))}),qF=function(e){switch(e.$){case"Open":return"Expiring...";case"Committed":return"Aborting...";case"Judgment":return"Releasing...";default:return""}},GF=uR({description:"committed phase",src:"/DAIHard/static/img/phase-committed.svg"}),zF=uR({description:"judgment phase",src:"/DAIHard/static/img/time-clock-fire.svg"}),YF={$:"None"},WF=YF,JF=uR({description:"open phase",src:"/DAIHard/static/img/diamond-give-white.svg"}),QF=function(e){switch(e.$){case"Open":return JF;case"Committed":return GF;case"Judgment":return zF;default:return WF}},XF=a(function(e,t,r,n){return{$:"RgbaSpace",a:e,b:t,c:r,d:n}}),ZF=a(function(e,t,r,n){return d(XF,e,t,r,n)}),eV=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},tV=function(e){return function(e){return d(ZF,e.red,e.green,e.blue,e.alpha)}(eV(e))},rV=function(e){return{$:"Circle",a:e}},nV=rV,aV=d(XF,0,0,0,1),iV={$:"Flat"},oV={$:"Sharp"},uV=function(e){return{$:"Uniform",a:e}},sV=uV,cV={cap:iV,dashPattern:yr,dashPhase:0,fill:sV(aV),join:oV,thickness:2},fV=n(function(e,t,r){return D(cV,{dashPattern:e,fill:r,thickness:t})}),lV=fV(yr),dV={$:"Transparent"},hV=dV,pV=f(lV,0,hV),gV=r(function(e,t){return{$:"Shape",a:e,b:t}}),vV=function(e){return{basic:e,handlers:yr,name:ci,opacity:1,rotation:0,scale:L(1,1),shift:L(0,0)}},yV=function(e){return f(Da,vV,gV(e))},mV=function(e){return yV(L(e,pV))},bV=function(e){return L(-e.a,-e.b)},CV=r(function(e,t){var r=e.a,n=e.b,a=t.shift;return D(t,{shift:L(a.a+r,a.b+n)})}),EV=r(function(e,t){return f(CV,bV(e(t)),t)}),SV=function(e){var t=r(function(e,t){var r=e.a,n=e.b,a=t.a,i=t.b;return L(f(ka,r,a),f(ka,n,i))});return l(La,t,L(yr,yr),e)},TV=r(function(e,t){return{$:"Path",a:e,b:t}}),wV=kr,IV=Nr,AV=function(e){var t=e.shift,r=e.scale,n=e.rotation,a=function(e){var t=e.a,r=e.b,a=IV(n),i=wV(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(Da,f(Da,function(e){var t=e.a,r=e.b;return L(t+l,r+d)},s),a)},BV=function(e){return xa(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)})},kV=r(function(e,t){var r=t.a,n=t.b,a=n/2,i=r/2;return f(BV,e,M([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 M([L(-a,-r),L(n,-r),L(n,t),L(-a,t)])},RV=function(e){var t=$V(e.basic),r=SV(f(xa,AV(e),t)),n=r.a,a=r.b;return{toBottom:-f(xc,0,gI(a)),toLeft:-f(xc,0,gI(n)),toRight:f(xc,0,pI(n)),toTop:f(xc,0,pI(a))}},$V=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(kV,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(kV,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(kV,r,L(d,h));case"Polygon":var p=e.a,r=p.b.thickness,g=e.b.a;return f(BV,r,g);default:var v=e.a,y=v.b,m=e.b.a,b=f(TV,y,m);e=b;continue e}case"Path":var r=e.a.thickness,C=e.a.cap,g=e.b.a;return f(BV,R(C,iV)?0:r,g);case"Text":case"Image":case"Html":var E=e.a;return f(kV,0,E);case"Group":var S=e.a;return f(BV,0,ay(f(xa,f(zo,RV,NV),S)));default:var T=e.b;return f(BV,0,NV(RV(T)))}},_V=function(e){var t=RV(e);return t.toTop+t.toBottom},LV=function(e){var t=RV(e);return L(-t.toLeft,t.toTop)},xV=function(e){var t=RV(e);return t.toLeft+t.toRight},PV=En("http://www.w3.org/2000/svg"),DV=PV("svg"),UV=Nn("height"),OV=Nn("version"),MV=Nn("width"),FV=PV("circle"),VV=PV("ellipse"),KV=PV("foreignObject"),HV=PV("g"),jV=PV("image"),qV=PV("polygon"),GV=PV("polyline"),zV=PV("rect"),YV=Tw,WV=PV("text"),JV=Nn("id"),QV=Nn("points"),XV=Nn("r"),ZV=Nn("rx"),eK=Nn("ry"),tK=function(e){return l(Rn,"http://www.w3.org/1999/xlink","xlink:href",tt(e))},rK=function(e){return{$:"Group",a:e}},nK=Nn("dominant-baseline"),aK=Nn("fill"),iK=Nn("fill-opacity"),oK=Nn("font-family"),uK=Nn("font-size"),sK=Nn("font-style"),cK=Nn("font-variant"),fK=Nn("font-weight"),lK=Nn("opacity"),dK=Nn("stroke"),hK=Nn("stroke-dasharray"),pK=Nn("stroke-dashoffset"),gK=Nn("stroke-linecap"),vK=Nn("stroke-linejoin"),yK=Nn("stroke-opacity"),mK=Nn("stroke-width"),bK=Nn("text-anchor"),CK=Nn("text-decoration"),EK=Nn("transform"),SK=function(e){switch(e.$){case"Round":return"round";case"Padded":return"square";default:return"butt"}},TK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([Ni(t),Ni(r)]))},e))},wK=n(function(e,t,r){return d(XF,e,t,r,1)}),IK=function(e){var t=e.a,r=e.b,n=e.c,a=e.d,i=function(e){return sv(1e4*e)/100};return Cd(M(["rgba(",mw(i(t)),"%,",mw(i(r)),"%,",mw(i(n)),"%,",mw(function(e){return sv(1e3*e)/1e3}(a)),")"]))},AK=function(e){var t=e.a,r=e.b,n=e.c;return{alpha:e.d,blue:n,green:r,red:t}},BK=function(e){var t=AK(e),r=t.red,n=t.green,a=t.blue;return IK(l(wK,r,n,a))},kK=function(e){if("Uniform"===e.$){var t=e.a;return BK(t)}return"none"},NK=function(e){var t=AK(e),r=t.alpha;return mw(r)},RK=function(e){if("Uniform"===e.$){var t=e.a;return NK(t)}return"0"},$K=function(e){switch(e.$){case"Smooth":return"round";case"Sharp":return"miter";default:return"bevel"}},_K=function(e){var t=mw(e.scale.b),r=mw(e.scale.a),n=mw(-e.rotation/2/F$*360),a=mw(-e.shift.b),i=mw(e.shift.a);return Cd(M(["translate(",i,",",a,") scale(",r,",",t,") rotate(",n,")"]))},LK=function(e){var t=e.basic;switch(t.$){case"Path":var r=t.a;return M([dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),aK("none"),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Shape":var n=t.a,a=n.a,r=n.b;return M([aK(kK(a)),iK(RK(a)),dK(kK(r.fill)),yK(RK(r.fill)),mK(mw(r.thickness)),gK(SK(r.cap)),vK($K(r.join)),lK(mw(e.opacity)),EK(_K(e)),pK(Ni(r.dashPhase)),hK(TK(r.dashPattern))]);case"Text":var i=t.b,o=i.a;i.b;return M([aK(kK(uV(o.color))),oK(function(){var e=o.typeface;switch(e.$){case"Serif":return"serif";case"Sansserif":return"sans-serif";case"Monospace":return"monospace";default:return e.a}}()),uK(Ni(o.size)),fK(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"}}()),sK(function(){switch(o.shape.$){case"Upright":case"SmallCaps":return"normal";case"Slanted":return"oblique";default:return"italic"}}()),cK(function(){return"SmallCaps"===o.shape.$?"small-caps":"normal"}()),CK(function(){switch(o.line.$){case"None":return"none";case"Under":return"underline";case"Over":return"overline";default:return"line-through"}}()),bK("middle"),nK("middle"),EK(_K(e))]);default:return M([EK(_K(e))])}},xK=Nn("x"),PK=Nn("y"),DK=r(function(e,t){return M([MV(mw(e)),UV(mw(t)),xK(mw(-e/2)),PK(mw(-t/2))])}),UK=function(e){return f(Ri," ",f(xa,function(e){var t=e.a,r=e.b;return f(Ri,",",M([mw(t),mw(-r)]))},e))},OK=dN,MK=r(function(e,t){return f(e,t.a,t.b)}),FK=function(e){return f(xa,MK(OK),e)},VK=function(e){e:for(;;){var t=f(xc,"_unnamed_",e.name),n=e.basic;switch(n.$){case"Path":var a=(n.a,n.b),i=a.a;return f(GV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Shape":var o=n.a,u=(o.a,o.b),s=n.b;switch(s.$){case"Polygon":var i=s.a;return f(qV,U(M([JV(t),QV(UK(i))]),U(LK(e),FK(e.handlers))),yr);case"Circle":var c=s.a;return f(FV,U(M([JV(t),XV(mw(c))]),U(LK(e),FK(e.handlers))),yr);case"Ellipse":var d=s.a,h=s.b;return f(VV,U(M([JV(t),ZV(mw(d)),eK(mw(h))]),U(LK(e),FK(e.handlers))),yr);case"Rectangle":var p=s.a,g=s.b,c=s.c;return f(zV,U(M([JV(t),ZV(mw(c)),eK(mw(c))]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);default:var a=s.a,v=D(e,{basic:f(TV,u,a)});e=v;continue e}case"Text":var y=n.b,m=(y.a,y.b);return f(WV,U(M([JV(t)]),U(LK(e),FK(e.handlers))),M([YV(m)]));case"Image":var b=n.a,p=b.a,g=b.b,C=n.b;return f(jV,U(M([JV(t),tK(C)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),yr);case"Html":var E=n.a,p=E.a,g=E.b,S=n.b;return f(KV,U(M([JV(t)]),U(f(DK,p,g),U(LK(e),FK(e.handlers)))),M([S]));case"Group":var T=n.a;return f(HV,f(ka,JV(t),U(LK(e),FK(e.handlers))),l(Ra,r(function(e,t){return f(ka,VK(e),t)}),yr,T));default:var w=n.a,I=n.b,v=D(e,{basic:rK(M([w,I]))});e=v;continue e}}},KK=r(function(e,t){var r=e.a,n=e.b,a=mw(r),i=mw(n);return f(jT,yr,M([f(DV,M([MV(a),UV(i),OV("1.1")]),M([VK(t)]))]))}),HK=function(e){return f(KK,L(xV(e),_V(e)),f(EV,LV,e))},jK=r(function(e,t){var r=QF(e),n=function(){switch(t.$){case"NotStarted":return l(Ok,10,33,108);case"Active":return l(Ok,0,100,170);default:return l(Ok,1,129,104)}}(),a=px(HK(f(mV,sV(tV(n)),nV(50))));return f(Kk,M([wN,m_(f(dR,M([wN,eR,yT(zk(60))]),r))]),a)}),qK=function(e){var t=M([b$,vN,bN(20)]);switch(e.$){case"Active":return f(Kk,U(t,M([bA(EN)])),fl("Active"));case"NotStarted":return f(Kk,U(t,M([bA(CR)])),fl("Not Started"));default:return f(Kk,t,fl("Finished"))}},GK=n(function(e,t,r){var n=f(VF,t,e),a=function(){return"Active"===n.$?l(Ok,0,226,255):DR}(),i=f(Kk,M([bA(a),bN(20),vN,wN]),fl(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 qk;switch(n.$){case"NotStarted":return d(ZR,M([wN]),M([bN(22),gR]),L(DR,IR),f(_R,e,t));case"Active":var a=f(xR,r,t);if("TimeLeft"===a.$){var i=a.a;return d(o$,M([wN]),M([bN(22),gR]),L(tN,IR),i)}return f(ON,M([wN,kN(10)]),M([f(Kk,M([wN]),fl(qF(e))),f(eM,"Poke",sS(iS))]));default:return f(Kk,M([yT(zk(1))]),qk)}}();return f(ON,M([aR(20),kN(10),yT(jk)]),M([f(Kk,M([c_,wN]),i),f(Kk,M([yT(jk),wN]),f(Kk,M([eR]),f(jK,e,n))),f(ON,M([kN(10),aL,wN]),M([f(Kk,M([wN]),qK(n)),o]))]))}),zK=o(function(e,t,r,n,a,i){var o=f(VF,r,t),u=f(Kk,M([aR(10),ET(jk),yT(jk)]),d(jF,t,i,r,n)),s=function(){switch(t.$){case"Open":return r.parameters.autorecallInterval;case"Committed":return r.parameters.autoabortInterval;case"Judgment":return r.parameters.autoreleaseInterval;default:return Vl(0)}}(),c=l(GK,t,r,i),h=(function(){switch(o.$){case"NotStarted":return s;case"Active":return f(LR,f(qb,r.state.phaseStartTime,s),i);default:Vl(0)}}(),f(Kk,M([yT(jk),ET(zk(1)),Wk(function(){return"Active"===o.$?l(pA,0,0,1):IR}())]),qk)),p=a?f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([ET(jk)]))),M([c,h,u])):f(VN,U(RF(e),U(R(o,IF)?BF:$F,M([uN,pN(AF(t))]))),M([c]));return!e&&R(o,IF)?f(ON,M([ET(jk),kN(20),m$({bottom:20,left:0,right:0,top:0})]),M([p,wF(r.terms.paymentMethods)])):p}),YK=i(function(e,t,r,n,a){return"Closed"===t.state.phase.$?f(VN,M([wN,cN(12),aR(30),kN(10),Wk(CF),bN(24),vN,bA(tN)]),M([fl("Trade "+TF(t.state.closedReason)),SF])):e?f(ON,M([ET(jk),kN(10)]),M([f(VN,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)])),wF(t.terms.paymentMethods)])):f(ON,M([ET(jk),yT(bT),kN(20)]),M([p(zK,e,Co,t,n,R(r,Co),a),p(zK,e,mo,t,n,R(r,mo),a),p(zK,e,bo,t,n,R(r,bo),a)]))}),WK=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(ON,M([ET(jk),yT(jk),kN(40)]),M([h(bF,t,i,n.wallet,r,n.showStatsModal),f(Kk,M([ET(jk),f(aN,40,0),kN(40)]),h(YK,a,i,n.expandedPhase,n.wallet,t))]));case"PartiallyLoadedTrade":e.a;return f(Kk,M([wN,eR,bN(30)]),fl("Loading trade info..."));default:return f(Kk,M([wN,eR,bN(30)]),fl("Invalid trade"))}}(),M([LO(n),OO(n)]))}),JK=n(function(e,t,r){var n=r.a,a=r.b;return L(e(n),t(a))}),QK=r(function(e,t){var r=function(){var r=t.submodel;switch(r.$){case"BetaLandingPage":return L($U,yr);case"CreateModel":var n=r.a;return L(f(Yi,Uy,EU(n)),yr);case"TradeModel":var a=r.a;return l(JK,Yi(Fy),xa(Yi(Fy)),d(WK,e,t.time,t.tradeCaches,a));case"MarketplaceModel":var i=r.a;return L(f(Yi,fT,l(CO,t.time,t.tradeCaches,i)),yr);default:var o=r.a;return L(f(Yi,oT,l(C_,t.time,t.tradeCaches,o)),yr)}}(),n=r.a,a=r.b;return L(f(Kk,M([ET(jk),yT(jk),cN(10)]),n),a)}),XK=function(e){return{$:"DismissNotice",a:e}},ZK=function(e){return f(j$,ZU,eO(e))},eH=function(e){var t=e.a,n=e.b,a=function(){return"Error"===n.noticeType.$?l(pA,1,1,1):l(pA,0,0,0)}(),i=function(){switch(n.noticeType.$){case"Update":return l(Ok,100,200,255);case"Caution":return l(Ok,255,188,0);case"Error":return l(Ok,255,70,70);default:return l(Ok,200,200,200)}}(),o=f(Kk,M([PN,c_,q$(5),ZK(5)]),B_(XK(t)));return f(Kk,M([Wk(i),cN(10),aR(8),ET(jk),p$(1),d$(d(YR,0,0,0,.15)),HD]),f(ON,M([kN(4),ET(jk)]),f(Bi,r(function(e,t){return f($N,M([ET(jk),bA(a)]),e?t:f(ka,o,t))}),n.mainParagraphs)))},tH=function(e){return R(e,yr)?yr:M([f(ON,M([tO(20),q$(20),kN(10),PN,aL,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,ul)},f(Bi,r(function(e,t){return L(e,t)}),e)))),f(ON,M([ZK(20),ex(100),kN(10),k$,c_,ET(zk(300)),bN(15)]),f(xa,eH,f(ml,function(e){return R(e.b.align,EB)},f(Bi,r(function(e,t){return L(e,t)}),e))))])},rH=r(function(e,t){var r=f(QK,e,t),n=r.a,a=r.b;return L(f(ON,M([r$(Jk),m_(KN(t)),ET(jk),yT(jk),aR(30)]),M([f(Kk,M([yT(zk(50))]),qk),n])),U(a,tH(t.userNotices)))}),nH=r(function(e,t){return{$:"OnlyDynamic",a:e,b:t}}),aH=r(function(e,t){return{$:"StaticRootAndDynamic",a:e,b:t}}),iH={$:"AllowHover"},oH={$:"Layout"},uH={backgroundColor:ci,borderColor:ci,shadow:si({blur:3,color:d(hA,155/255,203/255,1,1),offset:L(0,0),size:3})},sH=function(e){var t=r(function(e,t){switch(e.$){case"HoverOption":var r=e.a;return"Nothing"===t.hover.$?D(t,{hover:si(r)}):t;case"FocusStyleOption":var n=e.a;return"Nothing"===t.focus.$?D(t,{focus:si(n)}):t;default:var a=e.a;return"Nothing"===t.mode.$?D(t,{mode:si(a)}):t}});return function(e){return{focus:function(){var t=e.focus;return"Nothing"===t.$?uH:t.a}(),hover:function(){var t=e.hover;return"Nothing"===t.$?iH:t.a}(),mode:function(){var t=e.mode;return"Nothing"===t.$?oH:t.a}()}}(l(La,t,{focus:ci,hover:ci,mode:ci},e))},cH=r(function(e,t){switch(t.$){case"Unstyled":var r=t.a;return r(AT);case"Styled":var n=t.a.styles,r=t.a.html;return f(r,e(n),AT);case"Text":var a=t.a;return $I(a);default:return $I("")}}),fH=n(function(e,t,r){var n=sH(e),a=function(){return"NoStaticStyleSheet"===n.mode.$?nH(n):aH(n)}();return f(cH,a,d(fA,AT,Vk,t,wT(M([r]))))}),lH=ZT(5),dH=r(function(e,t){return{$:"FontFamily",a:e,b:t}}),hH={$:"SansSerif"},pH=function(e){return{$:"Typeface",a:e}},gH=Y,vH=r(function(e,t){return U(t,function(){switch(e.$){case"Serif":return"serif";case"SansSerif":return"sans-serif";case"Monospace":return"monospace";case"Typeface":var t=e.a;return f(Ri,"-",gH(sd(t)));case"ImportFont":var t=e.a;e.b;return f(Ri,"-",gH(sd(t)));default:var t=e.a.name;return f(Ri,"-",gH(sd(t)))}}())}),yH=function(){var e=M([pH("Open Sans"),pH("Helvetica"),pH("Verdana"),hH]);return M([f(yA,Yk,l(vA,"bg-color-"+mA(d(hA,1,1,1,0)),"background-color",d(hA,1,1,1,0))),f(yA,gA,l(vA,"font-color-"+mA(d(hA,0,0,0,1)),"color",d(hA,0,0,0,1))),f(yA,yN,mN(20)),f(yA,lH,f(dH,l(Ra,vH,"font-",e),e))])}(),mH=n(function(e,t,r){var n=e.options;return l(fH,n,f(ka,lA(f(Ri," ",M([RT.root,RT.any,RT.single]))),U(yH,t)),r)}),bH=mH({options:yr}),CH=function(e){return f(yA,lH,f(dH,l(Ra,vH,"ff-",e),e))},EH=hH,SH=pH,TH=function(e){return{body:M([function(){var t=f(rH,e.screenWidth,e),r=t.a,n=t.b,a=U(M([ET(jk),yT(jk),CH(M([SH("Soleil"),EH]))]),f(xa,m_,n));return f(bH,a,r)}()]),title:"DAIHard"}},wH=Ht,IH=wH({init:OB,onUrlChange:Uk,onUrlRequest:Dk,subscriptions:Pk,update:cB,view:TH});!function(t){e.Elm?Ye("Elm",e.Elm,t):e.Elm=t}({App:{init:IH(f(du,function(e){return f(du,function(t){return f(du,function(r){return Fi({height:r,networkId:t,width:e})},f(Oh,"height",CE))},f(Oh,"networkId",CE))},f(Oh,"width",CE)))(0)}})}(this)},function(e,t,r){"use strict";function n(){"undefined"!=typeof web3?web3.version.getNetwork(function(e,t){var r;e?(console.log("Error initializing web3: "+e),r=0):r=parseInt(t),window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:r,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),o(app,web3)}):(window.app=c.Elm.App.init({node:document.getElementById("elm"),flags:{networkId:0,width:window.innerWidth,height:window.innerHeight}}),i(app),a(app),console.log("Metamask not detected."))}function a(e){e.ports.notifyPort.subscribe(function(e){h.notify(e.title,e.body,e.image)}),e.ports.requestNotifyPermissionPort.subscribe(function(){h.requestPermission(function(e){})})}function i(e){e.ports.gTagOut.subscribe(function(e){gtag("event",e.event,{event_category:e.category,event_label:e.label,value:e.value})})}function o(e,t){u(e,t),t.eth.getAccounts(function(r,n){n&&n.length>0&&s(e,t)})}function u(e,t){d.startWatching(e.ports.networkSentryPort,t),e.ports.connectToWeb3.subscribe(function(r){s(e,t)})}function s(e,t){window.ethereum&&!window.web3Connected&&(window.web3=new Web3(ethereum)),f.txSentry(e.ports.txOut,e.ports.txIn,t),f.walletSentry(e.ports.walletSentryPort,t),d.startWatching(e.ports.networkSentryPort,t),e.ports.genPrivkey.subscribe(function(t){l.prepareKeypair(t.signSeedMsg,t.address,function(t,r){console.log("pubkey: ",r),e.ports.userPubkeyResult.send(r)})}),e.ports.encryptToPubkeys.subscribe(function(t){var r=l.encryptToPubkeys(t.message,t.pubkeyHexStrings);e.ports.encryptionFinished.send(r)}),e.ports.decryptMessage.subscribe(function(t){var r=t.id,n=l.decryptForUser(t.encapsulation,t.iv,t.tag,t.encrypted);n||console.log("Uh oh! Decryption didn't work..."),e.ports.decryptionFinished.send({id:r,message:n})}),window.ethereum&&!window.web3Connected&&(ethereum.enable(),window.web3Connected=!0)}Object.defineProperty(t,"__esModule",{value:!0});var c=r(42),f=(r.n(c),r(41)),l=r(40),d=r(39),h=r(38);window.forge=r(22),window.web3Connected=!1,window.addEventListener("load",function(){n()})},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e){var t=n(e),r=t[0],a=t[1];return 3*(r+a)/4-a}function i(e,t,r){return 3*(t+r)/4-r}function o(e){for(var t,r=n(e),a=r[0],o=r[1],u=new d(i(e,a,o)),s=0,c=o>0?a-4:a,f=0;f>16&255,u[s++]=t>>8&255,u[s++]=255&t;return 2===o&&(t=l[e.charCodeAt(f)]<<2|l[e.charCodeAt(f+1)]>>4,u[s++]=255&t),1===o&&(t=l[e.charCodeAt(f)]<<10|l[e.charCodeAt(f+1)]<<4|l[e.charCodeAt(f+2)]>>2,u[s++]=t>>8&255,u[s++]=255&t),u}function u(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function s(e,t,r){for(var n,a=[],i=t;io?o:i+16383));return 1===n?(t=e[r-1],a.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),a.join("")}t.byteLength=a,t.toByteArray=o,t.fromByteArray=c;for(var f=[],l=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=h.length;p>1,f=-7,l=r?a-1:0,d=r?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+e[t+l],l+=d,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=256*o+e[t+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,u,s,c=8*i-a-1,f=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),t+=o+l>=1?d/s:d*Math.pow(2,1-l),t*s>=2&&(o++,s/=2),o+l>=f?(u=0,o=f):o+l>=1?(u=(t*s-1)*Math.pow(2,a),o+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&u,h+=p,u/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=u,e.write.cipherFunction=a,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=f.hmac_sha1}function a(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var a;a=e.version.minor===f.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:a}),e.version.minor>=f.Versions.TLS_1_1.minor&&o.output.putBytes(a),o.update(e.fragment),o.finish(i)&&(e.fragment=o.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),o=a-1-i;o=i?(e.fragment=a.output.getBytes(d-i),u=a.output.getBytes(i)):e.fragment=a.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var h=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=s(t.macKey,u,h)&&r}function s(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(0);r(5),r(37);var f=e.exports=c.tls;f.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},f.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=f.BulkCipherAlgorithm.aes,e.cipher_type=f.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=f.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var l=0},function(e,t,r){(function(t){function r(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(u%n),u=u/n|0}var s="";for(r=0;0===e.at(r)&&r=0;--r)s+=t[i[r]];return s}var n={};e.exports=n;var a={};n.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var i=0,o=t.length,u=t.charAt(0),s=[0];for(i=0;i0;)s.push(f%o),f=f/o|0}for(i=0;0===e[i]&&i=0;--i)a+=t[s[i]]}else a=r(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");a=a.match(l).join("\r\n")}return a},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=a[r];if(!n){n=a[r]=[];for(var i=0;i>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===u&&d=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*H[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*H[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function c(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;s(e,t)}function f(e,t){var r=B(),n=B(),a=B(),i=B(),o=B(),u=B(),s=B(),c=B(),f=B();N(r,e[1],e[0]),N(f,t[1],t[0]),$(r,r,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 E(e,t,r){var n,a;for(T(e[0],U),T(e[1],O),T(e[2],O),T(e[3],U),a=255;a>=0;--a)n=r[a/8|0]>>(7&a)&1,l(e,t,n),f(t,e),f(e,e),l(e,t,n)}function S(e,t){var r=[B(),B(),B(),B()];T(r[0],V),T(r[1],K),T(r[2],O),$(r[3],V,K),E(e,r,t)}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,t){var r,n=B();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)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(56),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,r(14))}]); \ No newline at end of file diff --git a/src/Trade/State.elm b/src/Trade/State.elm index 52f149b..f130968 100644 --- a/src/Trade/State.elm +++ b/src/Trade/State.elm @@ -378,7 +378,9 @@ update msg prevModel = else UpdateResult - prevModel + { prevModel + | trade = CTypes.Invalid + } Cmd.none ChainCmd.none [ AppCmd.UserNotice UN.tradeParametersNotDefault ]