-
Notifications
You must be signed in to change notification settings - Fork 39
/
conseiljs.min.js
2 lines (2 loc) · 345 KB
/
conseiljs.min.js
1
2
/*! For license information please see conseiljs.min.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.conseiljs=t():e.conseiljs=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=44)}([function(e,t,r){"use strict";(function(e){var n=r(46),o=r(47),s=r(32);function i(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(i()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return p(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=f(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(t,r),o=(e=a(e,n)).write(t,r);o!==n&&(e=e.slice(0,o));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|h(t.length);return 0===(e=a(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?a(e,0):f(e,t);if("Buffer"===t.type&&s(t.data))return f(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function p(e,t){if(l(t),e=a(e,t<0?0:0|h(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function f(e,t){var r=t.length<0?0:0|h(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function h(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function d(e,t){if(u.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 z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return L(e).length;default:if(n)return z(e).length;t=(""+t).toLowerCase(),n=!0}}function g(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))return"";for(e||(e="utf8");;)switch(e){case"hex":return U(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return S(this,t,r);case"latin1":case"binary":return C(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(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 y(e,t,r,n,o){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=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,o);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,o){var s,i=1,a=e.length,u=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;i=2,a/=2,u/=2,r/=2}function c(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o){var l=-1;for(s=r;s<a;s++)if(c(e,s)===c(t,-1===l?0:s-l)){if(-1===l&&(l=s),s-l+1===u)return l*i}else-1!==l&&(s-=s-l),l=-1}else for(r+u>a&&(r=a-u),s=r;s>=0;s--){for(var p=!0,f=0;f<u;f++)if(c(e,s+f)!==c(t,f)){p=!1;break}if(p)return s}return-1}function P(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var i=0;i<n;++i){var a=parseInt(t.substr(2*i,2),16);if(isNaN(a))return i;e[r+i]=a}return i}function D(e,t,r,n){return W(z(t,e.length-r),e,r,n)}function $(e,t,r,n){return W(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function v(e,t,r,n){return $(e,t,r,n)}function I(e,t,r,n){return W(L(t),e,r,n)}function _(e,t,r,n){return W(function(e,t){for(var r,n,o,s=[],i=0;i<e.length&&!((t-=2)<0);++i)r=e.charCodeAt(i),n=r>>8,o=r%256,s.push(o),s.push(n);return s}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function R(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var s,i,a,u,c=e[o],l=null,p=c>239?4:c>223?3:c>191?2:1;if(o+p<=r)switch(p){case 1:c<128&&(l=c);break;case 2:128==(192&(s=e[o+1]))&&(u=(31&c)<<6|63&s)>127&&(l=u);break;case 3:s=e[o+1],i=e[o+2],128==(192&s)&&128==(192&i)&&(u=(15&c)<<12|(63&s)<<6|63&i)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:s=e[o+1],i=e[o+2],a=e[o+3],128==(192&s)&&128==(192&i)&&128==(192&a)&&(u=(15&c)<<18|(63&s)<<12|(63&i)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,p=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=p}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.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=i(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return l(t),t<=0?a(e,t):void 0!==r?"string"==typeof n?a(e,t).fill(r,n):a(e,t).fill(r):a(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return p(null,e)},u.allocUnsafeSlow=function(e){return p(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,s=Math.min(r,n);o<s;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!s(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(!u.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?R(this,0,e):g.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,o){if(!u.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===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(n>>>=0),i=(r>>>=0)-(t>>>=0),a=Math.min(s,i),c=this.slice(n,o),l=e.slice(t,r),p=0;p<a;++p)if(c[p]!==l[p]){s=c[p],i=l[p];break}return s<i?-1:i<s?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return P(this,e,t,r);case"utf8":case"utf-8":return D(this,e,t,r);case"ascii":return $(this,e,t,r);case"latin1":case"binary":return v(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function S(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function C(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function U(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",s=t;s<r;++s)o+=k(e[s]);return o}function T(e,t,r){for(var n=e.slice(t,r),o="",s=0;s<n.length;s+=2)o+=String.fromCharCode(n[s]+256*n[s+1]);return o}function w(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function E(e,t,r,n,o,s){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function O(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,s=Math.min(e.length-r,2);o<s;++o)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function N(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,s=Math.min(e.length-r,4);o<s;++o)e[r+o]=t>>>8*(n?o:3-o)&255}function M(e,t,r,n,o,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function x(e,t,r,n,s){return s||M(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,s){return s||M(e,0,r,8),o.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var o=t-e;r=new u(o,void 0);for(var s=0;s<o;++s)r[s]=this[s+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||w(e,t,this.length);for(var n=this[e],o=1,s=0;++s<t&&(o*=256);)n+=this[e+s]*o;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||w(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},u.prototype.readUInt8=function(e,t){return t||w(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||w(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||w(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||w(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||w(e,t,this.length);for(var n=this[e],o=1,s=0;++s<t&&(o*=256);)n+=this[e+s]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||w(e,t,this.length);for(var n=t,o=1,s=this[e+--n];n>0&&(o*=256);)s+=this[e+--n]*o;return s>=(o*=128)&&(s-=Math.pow(2,8*t)),s},u.prototype.readInt8=function(e,t){return t||w(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||w(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||w(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||w(e,4,this.length),o.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||w(e,4,this.length),o.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||w(e,8,this.length),o.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||w(e,8,this.length),o.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||E(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,s=0;for(this[t]=255&e;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||E(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);E(this,e,t,r,o-1,-o)}var s=0,i=1,a=0;for(this[t]=255&e;++s<r&&(i*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/i>>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);E(this,e,t,r,o-1,-o)}var s=r-1,i=1,a=0;for(this[t+s]=255&e;--s>=0&&(i*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/i>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||E(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return x(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return x(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},u.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<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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<n-r&&(n=e.length-t+r);var o,s=n-r;if(this===e&&r<t&&t<n)for(o=s-1;o>=0;--o)e[o+t]=this[o+r];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var s;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var i=u.isBuffer(e)?e:z(new u(e,n).toString()),a=i.length;for(s=0;s<r-t;++s)this[s+t]=i[s%a]}return this};var G=/[^+\/0-9A-Za-z-_]/g;function k(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){var r;t=t||1/0;for(var n=e.length,o=null,s=[],i=0;i<n;++i){if((r=e.charCodeAt(i))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(i+1===n){(t-=3)>-1&&s.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&s.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.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;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function L(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(G,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function W(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}}).call(this,r(11))},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){var n=r(0),o=n.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function i(e,t,r){return o(e,t,r)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=i),s(o,i),i.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,r)},i.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=o(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.SeedNonceRevelation="seed_nonce_revelation",e.Delegation="delegation",e.Transaction="transaction",e.AccountActivation="activate_account",e.Origination="origination",e.Reveal="reveal",e.Endorsement="endorsement",e.Ballot="ballot",e.DoubleEndorsementEvidence="double_endorsement_evidence",e.DoubleBakingEvidence="double_baking_evidence",e.Proposal="proposals"}(t.OperationKindType||(t.OperationKindType={})),function(e){e.Michelson="michelson",e.Micheline="micheline",e.MichelsonLambda="michelsonlambda"}(t.TezosParameterFormat||(t.TezosParameterFormat={}))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(6),i=r(79),a=o(r(14)),u=o(r(10)).default.log,c=a.default.fetch;!function(e){function t(e,t){const r=`${e}/${t}`;return c(r,{method:"get"}).then(n=>{if(!n.ok)throw u.error(`TezosNodeReader.performGetRequest error: ${n.status} for ${t} on ${e}`),new i.TezosRequestError(n.status,n.statusText,r,null);return n}).then(r=>{const n=r.json();return u.debug(`TezosNodeReader.performGetRequest response: ${n} for ${t} on ${e}`),n})}function r(e,r="head",n="main"){return t(e,`chains/${n}/blocks/${r}`).then(e=>e)}function o(e,r,n,o="main"){return t(e,`chains/${o}/blocks/${r}/context/contracts/${n}`).then(e=>e)}function a(e,r,o,s="main"){return n(this,void 0,void 0,(function*(){const n=yield t(e,`chains/${s}/blocks/${r}/context/contracts/${o}/manager_key`);return n?n.toString():""}))}e.getDelegate=function(e,t){return n(this,void 0,void 0,(function*(){return(yield o(e,"head",t)).delegate}))},e.getBlock=r,e.getBlockHead=function(e){return r(e)},e.getBlockAtOffset=function(e,o,s="main"){return n(this,void 0,void 0,(function*(){if(o<=0)return r(e);const n=yield r(e);return t(e,`chains/${s}/blocks/${Number(n.header.level)-o}`).then(e=>e)}))},e.getAccountForBlock=o,e.getCounterForAccount=function(e,r,o="main"){return n(this,void 0,void 0,(function*(){const n=yield t(e,`chains/${o}/blocks/head/context/contracts/${r}/counter`).then(e=>e.toString());return parseInt(n.toString(),10)}))},e.getSpendableBalanceForAccount=function(e,r,o="main"){return n(this,void 0,void 0,(function*(){const n=yield t(e,`chains/${o}/blocks/head/context/contracts/${r}`).then(e=>e);return parseInt(n.balance.toString(),10)}))},e.getAccountManagerForBlock=a,e.isImplicitAndEmpty=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield o(e,"head",t),n=t.toLowerCase().startsWith("tz"),s=0===Number(r.balance);return n&&s}))},e.isManagerKeyRevealedForAccount=function(e,t){return n(this,void 0,void 0,(function*(){return(yield a(e,"head",t)).length>0}))},e.getContractStorage=function(e,r,n="head",o="main"){return t(e,`chains/${o}/blocks/${n}/context/contracts/${r}/storage`)},e.getValueForBigMapKey=function(e,r,n,o="head",s="main"){return t(e,`chains/${s}/blocks/${o}/context/big_maps/${r}/${n}`).catch(e=>{})},e.getMempoolOperation=function(e,r,o="main"){return n(this,void 0,void 0,(function*(){const n=yield t(e,`chains/${o}/mempool/pending_operations`).catch(()=>{});return s.JSONPath({path:`$.applied[?(@.hash=='${r}')]`,json:n})[0]}))},e.estimateBranchTimeout=function(e,t,o="main"){return n(this,void 0,void 0,(function*(){const n=r(e,t,o),s=r(e,"head",o);return 64-(yield Promise.all([n,s]).then(e=>Number(e[1].header.level)-Number(e[0].header.level)))}))},e.getMempoolOperationsForAccount=function(e,r,o="main"){return n(this,void 0,void 0,(function*(){return(yield t(e,`chains/${o}/mempool/pending_operations`).catch(()=>{})).applied.filter(e=>e.contents.some(e=>e.source===r||e.destination===r)).map(e=>(e.contents=e.contents.filter(e=>e.source===r||e.destination===r),e))}))}}(t.TezosNodeReader||(t.TezosNodeReader={}))},function(e,t,r){"use strict";(function(e){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(51)),i=n(r(24)),a=o(r(16)),u=r(9),c=r(3),l=r(43);!function(t){function r(t){if(t<0)throw new Error("Use writeSignedInt to encode negative numbers");return e.from(e.from(function(e){if(e<128)return("0"+e.toString(16)).slice(-2);let t="";if(e>2147483648){let r=i.default(e);for(;r.greater(0);)t=("0"+r.and(127).toString(16)).slice(-2)+t,r=r.shiftRight(7)}else{let r=e;for(;r>0;)t=("0"+(127&r).toString(16)).slice(-2)+t,r>>=7}return t}(t),"hex").map((e,t)=>0===t?e:128^e).reverse()).toString("hex")}function n(e){if(0===e)return"00";const t=i.default(e).abs(),r=t.bitLength().toJSNumber();let n=[],o=t;for(let t=0;t<r;t+=7){let s=i.default.zero;0===t?(s=o.and(63),o=o.shiftRight(6)):(s=o.and(127),o=o.shiftRight(7)),e<0&&0===t&&(s=s.or(64)),t+7<r&&(s=s.or(128)),n.push(s.toJSNumber())}return r%7==0&&(n[n.length-1]=128|n[n.length-1],n.push(1)),n.map(e=>("0"+e.toString(16)).slice(-2)).join("")}function o(t){return function(e){if(2===e.length)return parseInt(e,16);if(e.length<=8){let t=parseInt(e.slice(-2),16);for(let r=1;r<e.length/2;r++)t+=parseInt(e.slice(-2*r-2,-2*r),16)<<7*r;return t}let t=i.default(parseInt(e.slice(-2),16));for(let r=1;r<e.length/2;r++)t=t.add(i.default(parseInt(e.slice(-2*r-2,-2*r),16)).shiftLeft(7*r));return t.toJSNumber()}(e.from(e.from(t,"hex").reverse().map((e,t)=>0===t?e:127&e)).toString("hex"))}function p(t){const r=!(64&e.from(t.slice(0,2),"hex")[0]),n=e.from(t,"hex").map((e,t)=>0===t?63&e:127&e);let o=i.default.zero;for(let e=n.length-1;e>=0;e--)o=0===e?o.or(n[e]):o.or(i.default(n[e]).shiftLeft(7*e-1));return r?o.toJSNumber():o.negate().toJSNumber()}function f(e){return P(e.length)+e.split("").map(e=>e.charCodeAt(0).toString(16)).join("")}function h(e){if(0===parseInt(e.substring(0,8),16))return"";const t=e.slice(8);let r="";for(let e=0;e<t.length;e+=2)r+=String.fromCharCode(parseInt(t.substring(e,e+2),16));return r}function d(t){if(44!==t.length&&42!==t.length)throw new Error("Incorrect hex length to parse an address");let r=44===t.length?t.substring(0,4):"00"+t.substring(0,2),n=44===t.length?4:2;if("0000"===r)return s.default.encode(e.from("06a19f"+t.substring(n),"hex"));if("0001"===r)return s.default.encode(e.from("06a1a1"+t.substring(n),"hex"));if("0002"===r)return s.default.encode(e.from("06a1a4"+t.substring(n),"hex"));if("01"===t.substring(0,2)&&44===t.length)return s.default.encode(e.from("025a79"+t.substring(2,42),"hex"));throw new Error("Unrecognized address type")}function g(t,r){const n=t instanceof e?t:e.from(t);if("tz1"===r)return d("0000"+n.toString("hex"));if("tz2"===r)return d("0001"+n.toString("hex"));if("tz3"===r)return d("0002"+n.toString("hex"));if("kt1"===r)return d(`01${n.toString("hex")}00`);throw new Error(`Unrecognized address hint, '${r}'`)}function m(e){const t=s.default.decode(e).slice(3).toString("hex");if(e.startsWith("tz1"))return"0000"+t;if(e.startsWith("tz2"))return"0001"+t;if(e.startsWith("tz3"))return"0002"+t;if(e.startsWith("KT1"))return"01"+t+"00";throw new Error("Unrecognized address prefix: "+e.substring(0,3))}function y(t){if(66!==t.length&&68!==t.length)throw new Error(`Incorrect hex length, ${t.length} to parse a key`);let r=t.substring(0,2);if("00"===r)return s.default.encode(e.from("0d0f25d9"+t.substring(2),"hex"));if("01"===r&&68===t.length)return s.default.encode(e.from("03fee256"+t.substring(2),"hex"));if("02"===r&&68===t.length)return s.default.encode(e.from("03b28b7f"+t.substring(2),"hex"));throw new Error("Unrecognized key type")}function b(t,r){const n=t instanceof e?t:e.from(t);if("op"===r)return s.default.encode(e.from("0574"+n.toString("hex"),"hex"));if("p"===r)return s.default.encode(e.from("02aa"+n.toString("hex"),"hex"));if("expr"===r)return s.default.encode(e.from("0d2c401b"+n.toString("hex"),"hex"));if(""===r)return s.default.encode(n);throw new Error(`Unsupported hint, '${r}'`)}function P(e){return("0000000"+e.toString(16)).slice(-8)}function D(t,r){return e.from(a.blake2b(t,null,r))}t.writeBoolean=function(e){return e?"ff":"00"},t.readBoolean=function(e){return parseInt(e,16)>0},t.writeInt=r,t.writeSignedInt=n,t.readInt=o,t.readSignedInt=p,t.findInt=function(e,t,r=!1){let n="",s=0;for(;t+2*s<e.length;){let r=t+2*s,o=r+2,i=e.substring(r,o);if(n+=i,s+=1,parseInt(i,16)<128)break}return r?{value:p(n),length:2*s}:{value:o(n),length:2*s}},t.writeString=f,t.readString=h,t.readAddress=d,t.readAddressWithHint=g,t.writeAddress=m,t.readBranch=function(t){if(64!==t.length)throw new Error("Incorrect hex length to parse a branch hash");return s.default.encode(e.from("0134"+t,"hex"))},t.writeBranch=function(e){return s.default.decode(e).slice(2).toString("hex")},t.readPublicKey=y,t.writePublicKey=function(e){if(e.startsWith("edpk"))return"00"+s.default.decode(e).slice(4).toString("hex");if(e.startsWith("sppk"))return"01"+s.default.decode(e).slice(4).toString("hex");if(e.startsWith("p2pk"))return"02"+s.default.decode(e).slice(4).toString("hex");throw new Error("Unrecognized key type")},t.readKeyWithHint=function(t,r){const n=t instanceof e?t:e.from(t);if("edsk"===r)return s.default.encode(e.from("2bf64e07"+n.toString("hex"),"hex"));if("edpk"===r)return y("00"+n.toString("hex"));if("sppk"===r)return y("01"+n.toString("hex"));if("p2pk"===r)return y("02"+n.toString("hex"));throw new Error(`Unrecognized key hint, '${r}'`)},t.writeKeyWithHint=function(e,t){if("edsk"===t||"edpk"===t||"sppk"===t||"p2pk"===t)return s.default.decode(e).slice(4);throw new Error(`Unrecognized key hint, '${t}'`)},t.readSignatureWithHint=function(t,r){const n=t instanceof e?t:e.from(t);if("edsig"===r||r===l.SignerCurve.ED25519)return s.default.encode(e.from("09f5cd8612"+n.toString("hex"),"hex"));if("spsig"===r||r===l.SignerCurve.SECP256K1)return s.default.encode(e.from("0d7365133f"+n.toString("hex"),"hex"));if("p2sig"===r||r===l.SignerCurve.SECP256R1)return s.default.encode(e.from("36f02c34"+n.toString("hex"),"hex"));throw new Error(`Unrecognized signature hint, '${r}'`)},t.writeSignatureWithHint=function(e,t){if("edsig"===t||t===l.SignerCurve.ED25519)return s.default.decode(e).slice("edsig".length);if("spsig"===t||t===l.SignerCurve.SECP256K1)return s.default.decode(e).slice("spsig".length);if("p2sig"===t||t===l.SignerCurve.SECP256R1)return s.default.decode(e).slice("p2sig".length);throw new Error(`Unrecognized key hint, '${t}'`)},t.readBufferWithHint=b,t.writeBufferWithHint=function(e){return s.default.decode(e)},t.computeOperationHash=function(e){return b(D(e.bytes,32),"op")},t.computeKeyHash=function(e,t="tz1"){return g(D(e,20),t)},t.writePackedData=function(e,t,o=c.TezosParameterFormat.Micheline){switch(t){case"int":return"0500"+n(e);case"nat":return"0500"+r(e);case"string":return"0501"+f(e);case"key_hash":{const t=m(e).slice(2);return`050a${P(t.length/2)}${t}`}case"address":{const t=m(e);return`050a${P(t.length/2)}${t}`}case"bytes":{const t=e.toString("hex");return`050a${P(t.length/2)}${t}`}default:try{if(o===c.TezosParameterFormat.Micheline)return"05"+u.TezosLanguageUtil.translateMichelineToHex(e);if(o===c.TezosParameterFormat.Michelson){const t=u.TezosLanguageUtil.translateMichelsonToMicheline(e);return"05"+u.TezosLanguageUtil.translateMichelineToHex(t)}throw new Error(`Unsupported format, ${o}, provided`)}catch(e){throw new Error(`Unrecognized data type or format: '${t}', '${o}': ${e}`)}}},t.readPackedData=function(e,t){switch(t){case"int":return p(e.slice(4));case"nat":return o(e.slice(4));case"string":return h(e.slice(4));case"key_hash":return d("00"+e.slice(12));case"address":return d(e.slice(12));case"bytes":return e.slice(12);case"michelson":return u.TezosLanguageUtil.normalizeMichelsonWhiteSpace(u.TezosLanguageUtil.hexToMichelson(e.slice(2)).code);default:return u.TezosLanguageUtil.hexToMicheline(e.slice(2)).code}},t.encodeBigMapKey=function(e){return b(D(e,32),"expr")},t.simpleHash=D,t.calculateContractAddress=function(e,t){const r=s.default.decode(e).slice(2);let n=[];for(let e=0;e<r.length;e++)n.push(r[e]);n=n.concat([(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]);const o=a.blake2b(new Uint8Array(n),null,20),i=function(e,t){const r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}(new Uint8Array([2,90,121]),o);return s.default.encode(i)}}(t.TezosMessageUtils||(t.TezosMessageUtils={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";r.r(t),function(e){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function a(e,t,r){return(a=i()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&s(o,r.prototype),o}).apply(null,arguments)}function u(e){var t="function"==typeof Map?new Map:void 0;return(u=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return a(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)})(e)}function c(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function l(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||p(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}r.d(t,"JSONPath",(function(){return b}));var h=Object.prototype.hasOwnProperty;b.nodeVMSupported=function(){try{return"[object process]"===Object.prototype.toString.call(e.process)}catch(e){return!1}}();var d=b.nodeVMSupported?r(78):{runInNewContext:function(e,t){var r=Object.keys(t),n=[];!function(e,t,r){for(var n=e.length,o=0;o<n;o++){r(e[o])&&t.push(e.splice(o--,1)[0])}}(r,n,(function(e){return"function"==typeof t[e]}));var o=r.map((function(e,r){return t[e]}));(e=n.reduce((function(e,r){var n=t[r].toString();return/function/.test(n)||(n="function "+n),"var "+r+"="+n+";"+e}),"")+e).match(/(["'])use strict\1/)||r.includes("arguments")||(e="var arguments = undefined;"+e);var s=(e=e.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"")).lastIndexOf(";"),i=s>-1?e.slice(0,s+1)+" return "+e.slice(s+1):" return "+e;return a(Function,l(r).concat([i])).apply(void 0,l(o))}};function g(e,t){return(e=e.slice()).push(t),e}function m(e,t){return(t=t.slice()).unshift(e),t}var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(n,e);var t,r=(t=n,function(){var e,r=o(t);if(i()){var n=o(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return c(this,e)});function n(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(t=r.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)')).avoidNew=!0,t.value=e,t.name="NewError",t}return n}(u(Error));function b(e,t,r,o,s){if(!(this instanceof b))try{return new b(e,t,r,o,s)}catch(e){if(!e.avoidNew)throw e;return e.value}"string"==typeof e&&(s=o,o=r,r=t,t=e,e=null);var i=e&&"object"===n(e);if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=!h.call(e,"wrap")||e.wrap,this.sandbox=e.sandbox||{},this.preventEval=e.preventEval||!1,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||o||null,this.otherTypeCallback=e.otherTypeCallback||s||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},!1!==e.autostart){var a={path:i?e.path:t};i?"json"in e&&(a.json=e.json):a.json=r;var u=this.evaluate(a);if(!u||"object"!==n(u))throw new y(u);return u}}b.prototype.evaluate=function(e,t,r,o){var s=this,i=this.parent,a=this.parentProperty,u=this.flatten,c=this.wrap;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=o||this.otherTypeCallback,t=t||this.json,(e=e||this.path)&&"object"===n(e)&&!Array.isArray(e)){if(!e.path&&""!==e.path)throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!h.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');t=e.json,u=h.call(e,"flatten")?e.flatten:u,this.currResultType=h.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=h.call(e,"sandbox")?e.sandbox:this.currSandbox,c=h.call(e,"wrap")?e.wrap:c,this.currPreventEval=h.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=h.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=h.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,i=h.call(e,"parent")?e.parent:i,a=h.call(e,"parentProperty")?e.parentProperty:a,e=e.path}if(i=i||null,a=a||null,Array.isArray(e)&&(e=b.toPathString(e)),(e||""===e)&&t){this._obj=t;var l=b.toPathArray(e);"$"===l[0]&&l.length>1&&l.shift(),this._hasParentSelector=null;var p=this._trace(l,t,["$"],i,a,r).filter((function(e){return e&&!e.isParentSelector}));return p.length?c||1!==p.length||p[0].hasArrExpr?p.reduce((function(e,t){var r=s._getPreferredOutput(t);return u&&Array.isArray(r)?e=e.concat(r):e.push(r),e}),[]):this._getPreferredOutput(p[0]):c?[]:void 0}},b.prototype._getPreferredOutput=function(e){var t=this.currResultType;switch(t){default:throw new TypeError("Unknown result type");case"all":var r=Array.isArray(e.path)?e.path:b.toPathArray(e.path);return e.pointer=b.toPointer(r),e.path="string"==typeof e.path?e.path:b.toPathString(e.path),e;case"value":case"parent":case"parentProperty":return e[t];case"path":return b.toPathString(e[t]);case"pointer":return b.toPointer(e.path)}},b.prototype._handleCallback=function(e,t,r){if(t){var n=this._getPreferredOutput(e);e.path="string"==typeof e.path?e.path:b.toPathString(e.path),t(n,r,e)}},b.prototype._trace=function(e,t,r,o,s,i,a,u){var c,l=this;if(!e.length)return c={path:r,value:t,parent:o,parentProperty:s,hasArrExpr:a},this._handleCallback(c,i,"value"),c;var f=e[0],d=e.slice(1),y=[];function b(e){Array.isArray(e)?e.forEach((function(e){y.push(e)})):y.push(e)}if(("string"!=typeof f||u)&&t&&h.call(t,f))b(this._trace(d,t[f],g(r,f),t,f,i,a));else if("*"===f)this._walk(f,d,t,r,o,s,i,(function(e,t,r,n,o,s,i,a){b(l._trace(m(e,r),n,o,s,i,a,!0,!0))}));else if(".."===f)b(this._trace(d,t,r,o,s,i,a)),this._walk(f,d,t,r,o,s,i,(function(e,t,r,o,s,i,a,u){"object"===n(o[e])&&b(l._trace(m(t,r),o[e],g(s,e),o,e,u,!0))}));else{if("^"===f)return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:d,isParentSelector:!0};if("~"===f)return c={path:g(r,f),value:s,parent:o,parentProperty:null},this._handleCallback(c,i,"property"),c;if("$"===f)b(this._trace(d,t,r,null,null,i,a));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(f))b(this._slice(f,d,t,r,o,s,i));else if(0===f.indexOf("?(")){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");this._walk(f,d,t,r,o,s,i,(function(e,t,r,n,o,s,i,a){l._eval(t.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1"),n[e],e,o,s,i)&&b(l._trace(m(e,r),n,o,s,i,a,!0))}))}else if("("===f[0]){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");b(this._trace(m(this._eval(f,t,r[r.length-1],r.slice(0,-1),o,s),d),t,r,o,s,i,a))}else if("@"===f[0]){var P=!1,D=f.slice(1,-2);switch(D){default:throw new TypeError("Unknown value type "+D);case"scalar":t&&["object","function"].includes(n(t))||(P=!0);break;case"boolean":case"string":case"undefined":case"function":n(t)===D&&(P=!0);break;case"integer":!Number.isFinite(t)||t%1||(P=!0);break;case"number":Number.isFinite(t)&&(P=!0);break;case"nonFinite":"number"!=typeof t||Number.isFinite(t)||(P=!0);break;case"object":t&&n(t)===D&&(P=!0);break;case"array":Array.isArray(t)&&(P=!0);break;case"other":P=this.currOtherTypeCallback(t,r,o,s);break;case"null":null===t&&(P=!0)}if(P)return c={path:r,value:t,parent:o,parentProperty:s},this._handleCallback(c,i,"value"),c}else if("`"===f[0]&&t&&h.call(t,f.slice(1))){var $=f.slice(1);b(this._trace(d,t[$],g(r,$),t,$,i,a,!0))}else if(f.includes(",")){var v,I=function(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=p(e))){var t=0,r=function(){};return{s:r,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o,s=!0,i=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){i=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(i)throw o}}}}(f.split(","));try{for(I.s();!(v=I.n()).done;){var _=v.value;b(this._trace(m(_,d),t,r,o,s,i,!0))}}catch(e){I.e(e)}finally{I.f()}}else!u&&t&&h.call(t,f)&&b(this._trace(d,t[f],g(r,f),t,f,i,a,!0))}if(this._hasParentSelector)for(var A=0;A<y.length;A++){var R=y[A];if(R&&R.isParentSelector){var S=l._trace(R.expr,t,R.path,o,s,i,a);if(Array.isArray(S)){y[A]=S[0];for(var C=S.length,U=1;U<C;U++)A++,y.splice(A,0,S[U])}else y[A]=S}}return y},b.prototype._walk=function(e,t,r,o,s,i,a,u){if(Array.isArray(r))for(var c=r.length,l=0;l<c;l++)u(l,e,t,r,o,s,i,a);else r&&"object"===n(r)&&Object.keys(r).forEach((function(n){u(n,e,t,r,o,s,i,a)}))},b.prototype._slice=function(e,t,r,n,o,s,i){if(Array.isArray(r)){var a=r.length,u=e.split(":"),c=u[2]&&Number.parseInt(u[2])||1,l=u[0]&&Number.parseInt(u[0])||0,p=u[1]&&Number.parseInt(u[1])||a;l=l<0?Math.max(0,l+a):Math.min(a,l),p=p<0?Math.max(0,p+a):Math.min(a,p);for(var f=[],h=l;h<p;h+=c){this._trace(m(h,t),r,n,o,s,i,!0).forEach((function(e){f.push(e)}))}return f}},b.prototype._eval=function(e,t,r,n,o,s){if(!this._obj||!t)return!1;e.includes("@parentProperty")&&(this.currSandbox._$_parentProperty=s,e=e.replace(/@parentProperty/g,"_$_parentProperty")),e.includes("@parent")&&(this.currSandbox._$_parent=o,e=e.replace(/@parent/g,"_$_parent")),e.includes("@property")&&(this.currSandbox._$_property=r,e=e.replace(/@property/g,"_$_property")),e.includes("@path")&&(this.currSandbox._$_path=b.toPathString(n.concat([r])),e=e.replace(/@path/g,"_$_path")),e.includes("@root")&&(this.currSandbox._$_root=this.json,e=e.replace(/@root/g,"_$_root")),e.match(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/)&&(this.currSandbox._$_v=t,e=e.replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1"));try{return d.runInNewContext(e,this.currSandbox)}catch(t){throw console.log(t),new Error("jsonPath: "+t.message+": "+e)}},b.cache={},b.toPathString=function(e){for(var t=e,r=t.length,n="$",o=1;o<r;o++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[o])||(n+=/^[\*0-9]+$/.test(t[o])?"["+t[o]+"]":"['"+t[o]+"']");return n},b.toPointer=function(e){for(var t=e,r=t.length,n="",o=1;o<r;o++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[o])||(n+="/"+t[o].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return n},b.toPathArray=function(e){var t=b.cache;if(t[e])return t[e].concat();var r=[],n=e.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]]/g,(function(e,t){return"[#"+(r.push(t)-1)+"]"})).replace(/\['((?:[\0-&\(-\\\^-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)'\]/g,(function(e,t){return"['"+t.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"})).replace(/~/g,";~;").replace(/'?\.'?(?!(?:[\0-Z\\-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*\])|\['?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,(function(e,t){return";"+t.split("").join(";")+";"})).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,"").split(";").map((function(e){var t=e.match(/#([0-9]+)/);return t&&t[1]?r[t[1]]:e}));return t[e]=n,t[e]}}.call(this,r(11))},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=o(r(16)),a=o(r(3)),u=r(19),c=r(22),l=r(4),p=r(80),f=r(5),h=r(9),d=r(81),g=s(r(14)).default.fetch,m=s(r(10)).default.log;let y={};!function(t){function r(e,t,r={}){const n=`${e}/${t}`,o=JSON.stringify(r);return m.debug(`TezosNodeWriter.performPostRequest sending ${o}\n->\n${n}`),g(n,{method:"post",body:o,headers:{"content-type":"application/json"}})}function o(e,t){m.debug("TezosNodeWriter.forgeOperations: "+JSON.stringify(t));let r=f.TezosMessageUtils.writeBranch(e);return t.forEach(e=>r+=p.TezosMessageCodec.encodeOperation(e)),m.debug("TezosNodeWriter.forgeOperations: "+r),r}function s(e,t,o,s,i,a="main"){return n(this,void 0,void 0,(function*(){const n=[{protocol:o,branch:t,contents:s,signature:i.signature}],u=yield r(e,`chains/${a}/blocks/head/helpers/preapply/operations`,n),c=yield u.text();let l;try{m.debug("TezosNodeWriter.preapplyOperation received "+c),l=JSON.parse(c)}catch(e){throw m.error("TezosNodeWriter.preapplyOperation failed to parse response"),new Error(`Could not parse JSON from response of chains/${a}/blocks/head/helpers/preapply/operation: '${c}' for ${n}`)}return S(c),l}))}function b(e,t,o="main"){return n(this,void 0,void 0,(function*(){const n=yield r(e,"injection/operation?chain="+o,t.bytes.toString("hex")),s=yield n.text();return S(s),s}))}function P(t,r,i,a=54){return n(this,void 0,void 0,(function*(){const n=yield l.TezosNodeReader.getBlockAtOffset(t,a),c=n.hash.slice(0,51),p=o(c,r),h=yield i.signOperation(e.from(u.TezosConstants.OperationGroupWatermark+p,"hex")),d={bytes:e.concat([e.from(p,"hex"),h]),signature:f.TezosMessageUtils.readSignatureWithHint(h,i.getSignerCurve())},g=yield s(t,c,n.protocol,r,d),m=yield b(t,d);return{results:g[0],operationGroupID:m}}))}function D(e,t,r,o,s){return n(this,void 0,void 0,(function*(){if(!(yield l.TezosNodeReader.isManagerKeyRevealedForAccount(e,r))){const e={kind:"reveal",source:r,fee:"0",counter:(o+1).toString(),gas_limit:"10600",storage_limit:"0",public_key:t};return s.forEach((e,t)=>{const r=o+2+t;e.counter=r.toString()}),[e,...s]}return s}))}function $(e,t,r,o,s=u.TezosConstants.DefaultDelegationFee,i=54){return n(this,void 0,void 0,(function*(){const n=(yield l.TezosNodeReader.getCounterForAccount(e,r.publicKeyHash))+1,a={kind:"delegation",source:r.publicKeyHash,fee:s.toString(),counter:n.toString(),storage_limit:u.TezosConstants.DefaultDelegationStorageLimit+"",gas_limit:u.TezosConstants.DefaultDelegationGasLimit+"",delegate:o},c=yield D(e,r.publicKey,r.publicKeyHash,n-1,[a]);return P(e,c,t,i)}))}function v(e,t,r,n,o,s,i,u,c,l){let p=void 0,f=void 0;return c===a.TezosParameterFormat.Michelson?(p=JSON.parse(h.TezosLanguageUtil.translateMichelsonToMicheline(i)),m.debug(`TezosNodeWriter.sendOriginationOperation code translation:\n${i}\n->\n${JSON.stringify(p)}`),f=JSON.parse(h.TezosLanguageUtil.translateMichelsonToMicheline(u)),m.debug(`TezosNodeWriter.sendOriginationOperation storage translation:\n${u}\n->\n${JSON.stringify(f)}`)):c===a.TezosParameterFormat.Micheline&&(p=JSON.parse(i),f=JSON.parse(u)),{kind:"origination",source:e.publicKeyHash,fee:n.toString(),counter:l.toString(),gas_limit:s.toString(),storage_limit:o.toString(),balance:t.toString(),delegate:r,script:{code:p,storage:f}}}function I(e,t,r,o,s,i,u,c,p,f,h=a.TezosParameterFormat.Micheline,d=54){return n(this,void 0,void 0,(function*(){const n=(yield l.TezosNodeReader.getCounterForAccount(e,r.publicKeyHash))+1,a=_(r.publicKeyHash,n,o,s,i,u,c,p,f,h),g=yield D(e,r.publicKey,r.publicKeyHash,n-1,[a]);return P(e,g,t,d)}))}function _(e,t,r,n,o,s,i,u,c,l=a.TezosParameterFormat.Micheline){let p={destination:r,amount:n.toString(),storage_limit:s.toString(),gas_limit:i.toString(),counter:t.toString(),fee:o.toString(),source:e,kind:"transaction"};if(void 0!==c){if(l===a.TezosParameterFormat.Michelson){const e=h.TezosLanguageUtil.translateParameterMichelsonToMicheline(c);p.parameters={entrypoint:u||"default",value:JSON.parse(e)}}else if(l===a.TezosParameterFormat.Micheline)p.parameters={entrypoint:u||"default",value:JSON.parse(c)};else if(l===a.TezosParameterFormat.MichelsonLambda){const e=h.TezosLanguageUtil.translateMichelsonToMicheline("code "+c);p.parameters={entrypoint:u||"default",value:JSON.parse(e)}}}else void 0!==u&&(p.parameters={entrypoint:u,value:[]});return p}function A(e,t,...r){return n(this,void 0,void 0,(function*(){const n=yield R(e,t,...r);let o=0,s=0;for(let e of n.contents){try{o+=parseInt(e.metadata.operation_result.consumed_gas)||0,s+=parseInt(e.metadata.operation_result.paid_storage_size_diff)||0}catch(e){}const t=e.metadata.internal_operation_results;if(void 0!==t)for(const e of t){const t=e.result;o+=parseInt(t.consumed_gas)||0,s+=parseInt(t.paid_storage_size_diff)||0}}return{gas:o,storageCost:s}}))}function R(e,t,...o){return n(this,void 0,void 0,(function*(){const n=yield r(e,`chains/${t}/blocks/head/helpers/scripts/run_operation`,{chain_id:"NetXdQprcVkpaWU",operation:{branch:"BL94i2ShahPx3BoNs6tJdXDdGeoJ9ukwujUA2P8WJwULYNdimmq",contents:o,signature:"edsigu6xFLH2NpJ1VcYshpjW99Yc1TAL1m2XBqJyXrxcZQgBMo8sszw2zm626yjpA3pWMhjpsahLrWdmvX9cqhd4ZEUchuBuFYy"}}),s=yield n.text();S(s);return JSON.parse(s)}))}function S(e){let t="";try{const r=JSON.parse(e),n=Array.isArray(r)?r:[r];"kind"in n[0]?t=n.map(e=>`(${e.kind}: ${e.id})`).join(", "):1===n.length&&1===n[0].contents.length&&"activate_account"===n[0].contents[0].kind||(t=n.map(e=>e.contents).map(e=>e.map(e=>e.metadata.operation_result).concat(e.flatMap(e=>e.metadata.internal_operation_results).filter(e=>!!e).map(e=>e.result)).map(e=>{return"failed"===(t=e).status?`${t.status}: ${t.errors.map(e=>`(${e.kind}: ${e.id})`).join(", ")}`:"applied"===t.status?"":t.status;var t}).filter(e=>e.length>0).join(", ")).join(", "))}catch(r){if(e.startsWith("Failed to parse the request body: "))t=e.slice(34);else{const t=e.replace(/\"/g,"").replace(/\n/,"");51===t.length&&"o"===t.charAt(0)||m.error(`failed to parse errors: '${r}' from '${e}'\n, PLEASE report this to the maintainers`)}}if(t.length>0){m.debug("errors found in response:\n"+e);let r=new c.ServiceResponseError(200,"","","",e);throw r.message=t,r}}t.forgeOperations=o,t.forgeOperationsRemotely=function(e,t,o,s="main"){return n(this,void 0,void 0,(function*(){m.debug("TezosNodeWriter.forgeOperations:"),m.debug(JSON.stringify(o)),m.warn("forgeOperationsRemotely() is not intrinsically trustless");const n=yield r(e,`chains/${s}/blocks/head/helpers/forge/operations`,{branch:t,contents:o}),i=(yield n.text()).replace(/\n/g,"").replace(/['"]+/g,"");let a=Array.from(o.map(e=>e.kind)),u=!1;for(let e of a)if(u=["reveal","transaction","delegation","origination"].includes(e),u)break;if(u){const e=p.TezosMessageCodec.parseOperationGroup(i);for(let t=0;t<o.length;t++){const r=o[t],n=e[t];if("transaction"===r.kind){if(n.kind!==r.kind||n.fee!==r.fee||n.amount!==r.amount||n.destination!==r.destination)throw new Error("Forged transaction failed validation.")}else if("delegation"===r.kind){if(n.kind!==r.kind||n.fee!==r.fee||n.delegate!==r.delegate)throw new Error("Forged delegation failed validation.")}else if("origination"===r.kind&&(n.kind!==r.kind||n.fee!==r.fee||n.balance!==r.balance||n.spendable!==r.spendable||n.delegatable!==r.delegatable||n.delegate!==r.delegate||void 0!==n.script))throw new Error("Forged origination failed validation.")}}return i}))},t.preapplyOperation=s,t.injectOperation=b,t.sendOperation=P,t.queueOperation=function(e,t,r,n,o=25){const s=i.blake2s(`${e}${n.publicKeyHash}`,null,16);y[s]||(y[s]=d.TezosOperationQueue.createQueue(e,r,n,o)),y[s].addOperations(...t)},t.getQueueStatus=function(e,t){const r=i.blake2s(`${e}${t.publicKeyHash}`,null,16);return y[r]?y[r].getStatus():-1},t.appendRevealOperation=D,t.sendTransactionOperation=function(e,t,r,o,s,i,a=54){return n(this,void 0,void 0,(function*(){const n=(yield l.TezosNodeReader.getCounterForAccount(e,r.publicKeyHash))+1,c={destination:o,amount:s.toString(),storage_limit:u.TezosConstants.DefaultTransactionStorageLimit+"",gas_limit:u.TezosConstants.DefaultTransactionGasLimit+"",counter:n.toString(),fee:i.toString(),source:r.publicKeyHash,kind:"transaction"},p=yield D(e,r.publicKey,r.publicKeyHash,n-1,[c]);return P(e,p,t,a)}))},t.sendDelegationOperation=$,t.sendUndelegationOperation=function(e,t,r,o=u.TezosConstants.DefaultDelegationFee,s=54){return n(this,void 0,void 0,(function*(){return $(e,t,r,void 0,o,s)}))},t.sendContractOriginationOperation=function(e,t,r,o,s,i,u,c,p,f,h=a.TezosParameterFormat.Micheline,d=54){return n(this,void 0,void 0,(function*(){const n=(yield l.TezosNodeReader.getCounterForAccount(e,r.publicKeyHash))+1,a=v(r,o,s,i,u,c,p,f,h,n),g=yield D(e,r.publicKey,r.publicKeyHash,n-1,[a]);return P(e,g,t,d)}))},t.constructContractOriginationOperation=v,t.sendContractInvocationOperation=I,t.constructContractInvocationOperation=_,t.sendContractPing=function(e,t,r,o,s,i,a,u){return n(this,void 0,void 0,(function*(){return I(e,t,r,o,0,s,i,a,u,void 0)}))},t.sendKeyRevealOperation=function(e,t,r,o=u.TezosConstants.DefaultKeyRevealFee,s=54){return n(this,void 0,void 0,(function*(){const n=(yield l.TezosNodeReader.getCounterForAccount(e,r.publicKeyHash))+1,i={kind:"reveal",source:r.publicKeyHash,fee:o+"",counter:n.toString(),gas_limit:"10000",storage_limit:"0",public_key:r.publicKey};return P(e,[i],t,s)}))},t.sendIdentityActivationOperation=function(e,t,r,n){return P(e,[{kind:"activate_account",pkh:r.publicKeyHash,secret:n}],t)},t.testContractInvocationOperation=function(e,t,r,o,s,i,u,c,p,f,h=a.TezosParameterFormat.Micheline){return n(this,void 0,void 0,(function*(){const n=(yield l.TezosNodeReader.getCounterForAccount(e,r.publicKeyHash))+1,a=_(r.publicKeyHash,n,o,s,i,u,c,p,f,h);return A(e,t,a)}))},t.testContractDeployOperation=function(e,t,r,o,s,i,u,c,p,f,h=a.TezosParameterFormat.Micheline){return n(this,void 0,void 0,(function*(){const n=(yield l.TezosNodeReader.getCounterForAccount(e,r.publicKeyHash))+1,a=v(r,o,s,i,u,c,p,f,h,n),d=yield A(e,t,a);return{gas:d.gas,storageCost:d.storageCost+257}}))},t.estimateOperation=A,t.dryRunOperation=R,t.parseRPCError=S}(t.TezosNodeWriter||(t.TezosNodeWriter={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=o(r(16)),i=r(9),a=r(4);!function(t){t.verifyDestination=function(t,r,o){return n(this,void 0,void 0,(function*(){const n=yield a.TezosNodeReader.getAccountForBlock(t,"head",r);if(!n.script)throw new Error("No code found at "+r);const i=e.from(s.blake2s(JSON.stringify(n.script.code),null,16)).toString("hex");if(i!==o)throw new Error(`Contract code hash "${i}" doesn't match expected ${o}`);return!0}))},t.verifyScript=function(t,r){const n=e.from(s.blake2s(i.TezosLanguageUtil.preProcessMichelsonScript(t).join("\n"),null,16)).toString("hex");if(n!==r)throw new Error(`Contract code hash "${n}" doesn't match expected ${r}`);return!0},t.clearRPCOperationGroupHash=function(e){return e.replace(/\"/g,"").replace(/\n/,"")}}(t.TezosContractUtils||(t.TezosContractUtils={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const o=n(r(48)),s=n(r(50)),i=n(r(33)),a=r(5);!function(t){function r(e){const t=new i.Parser(i.Grammar.fromCompiled(s.default));return h(e).forEach(e=>{t.feed(e)}),t.results[0]}function n(e,t){let r=e;e.script&&(r=e.script);for(let e=0;e<r.length;e++)if(r[e].prim===t)return JSON.stringify(r[e],null,1);throw new Error(t+" key was not found")}function u(e){const t=new i.Parser(i.Grammar.fromCompiled(o.default));return t.feed(d(e)),t.results.join("")}function c(t){let r=0;const n=parseInt(t.substring(r,r+8),16);r+=8;const o=e.from(t.substring(r,r+2*n),"hex").toString();return r+=2*n,{code:o,consumed:r}}function l(e,t){return o.getKeywordForCode(parseInt(e.substring(t,t+2),16))}function p(e,t){return l(e,t).slice(1,-1)}function f(e,t=!0){const r=c(e);return{code:t?r.code.split(" ").map(e=>`"${e}"`).join(", "):r.code,consumed:r.consumed}}function h(e){let t=new Map;t.parameter=e.search(/(^|\s+)parameter/m),t.storage=e.search(/(^|\s+)storage/m),t.code=e.search(/(^|\s+)code/m);const r=Object.values(t).sort((e,t)=>Number(e)-Number(t));t[Object.keys(t).find(e=>t[e]===r[0])+""]=e.substring(r[0],r[1]),t[Object.keys(t).find(e=>t[e]===r[1])+""]=e.substring(r[1],r[2]),t[Object.keys(t).find(e=>t[e]===r[2])+""]=e.substring(r[2]);return[t.parameter,t.storage,t.code].map(e=>e.trim().split("\n").map(e=>e.replace(/\#[\s\S]+$/,"").trim()).filter(e=>e.length>0).join(" "))}function d(e){return e.replace(/\n/g," ").replace(/ +/g," ").replace(/\[{/g,"[ {").replace(/}\]/g,"} ]").replace(/},{/g,"}, {").replace(/\]}/g,"] }").replace(/":"/g,'": "').replace(/":\[/g,'": [').replace(/{"/g,'{ "').replace(/"}/g,'" }').replace(/,"/g,', "').replace(/","/g,'", "').replace(/\[\[/g,"[ [").replace(/\]\]/g,"] ]").replace(/\["/g,'[ "').replace(/"\]/g,'" ]').replace(/\[ +\]/g,"[]").trim()}t.hexToMicheline=function e(t){if(t.length<2)throw new Error(`Malformed Micheline fragment '${t}'`);let r="",n=0,o=t.substring(n,n+2);n+=2;try{switch(o){case"00":{const e=a.TezosMessageUtils.findInt(t.substring(n),0,!0);r+=`{ "int": "${e.value}" }`,n+=e.length;break}case"01":{const e=c(t.substring(n));r+=`{ "string": "${e.code}" }`,n+=e.consumed;break}case"02":{const o=parseInt(t.substring(n,n+8),16);n+=8;let s=[],i=0;for(;i<o;){let r=e(t.substring(n));s.push(r.code),i+=r.consumed/2,n+=r.consumed}r+=0===o?"[]":`[ ${s.join(", ")} ]`;break}case"03":r+=`{ "prim": ${l(t,n)} }`,n+=2;break;case"04":{r+=`{ "prim": ${l(t,n)}, `,n+=2;const e=f(t.substring(n));r+=`"annots": [ ${e.code} ] }`,n+=e.consumed;break}case"05":{r+=`{ "prim": ${l(t,n)}, `,n+=2;const o=e(t.substring(n));r+=`"args": [ ${o.code} ] }`,n+=o.consumed;break}case"06":{r+=`{ "prim": ${l(t,n)}, `,n+=2;const o=e(t.substring(n));r+=`"args": [ ${o.code} ], `,n+=o.consumed;const s=f(t.substring(n));r+=`"annots": [ ${s.code} ] }`,n+=s.consumed;break}case"07":{r+=`{ "prim": ${l(t,n)}, `,n+=2;let o=[],s=e(t.substring(n));o.push(s.code),n+=s.consumed,s=e(t.substring(n)),o.push(s.code),n+=s.consumed,r+=`"args": [ ${o.join(", ")} ] }`;break}case"08":{r+=`{ "prim": ${l(t,n)}, `,n+=2;const o=e(t.substring(n));n+=o.consumed;const s=e(t.substring(n));n+=s.consumed,r+=`"args": [ ${o.code}, ${s.code} ], `;const i=f(t.substring(n));r+=`"annots": [ ${i.code} ] }`,n+=i.consumed;break}case"09":{r+=`{ "prim": ${l(t,n)}, `,n+=2;let o=e("02"+t.substring(n));if(r+='"args": '+o.code,n+=o.consumed-2,"00000000"!==t.substring(n,n+8)){const e=f(t.substring(n));e.code.length>2&&(r+=`, "annots": [ ${e.code} ] }`),n+=e.consumed}else r+=" }",n+=8;break}case"0a":{const e=parseInt(t.substring(n,n+8),16);n+=8,r+=`{ "bytes": "${t.substring(n,n+2*e)}" }`,n+=2*e;break}default:throw new Error(`Unknown Micheline field type '${o}' at offset ${n} of '${t}'`)}}catch(e){const o=`Nested hex parsing error (${e.message}) after: ${t}, ${n}, ${r}`;throw new Error(o)}return{code:r,consumed:n}},t.hexToMichelson=function e(t){if(t.length<2)throw new Error(`Malformed Michelson fragment '${t}'`);let r="",n=0,o=t.substring(n,n+2);n+=2;try{switch(o){case"00":{const e=a.TezosMessageUtils.findInt(t.substring(n),0,!0);r+=""+e.value,n+=e.length;break}case"01":{const e=c(t.substring(n));r+=`"${e.code}"`,n+=e.consumed;break}case"02":{const o=parseInt(t.substring(n,n+8),16);n+=8;let s=[],i=0;for(;i<o;){let r=e(t.substring(n));s.push(r.code),i+=r.consumed/2,n+=r.consumed}r+=0===o?"[]":`[ ${s.join(" ")} ]`;break}case"03":r+=`( ${p(t,n)} )`,n+=2;break;case"04":{r+=`( ${p(t,n)} `,n+=2;const e=f(t.substring(n),!1);r+=` ${e.code} )`,n+=e.consumed;break}case"05":{r+=`( ${p(t,n)} `,n+=2;const o=e(t.substring(n));r+=` ${o.code} )`,n+=o.consumed;break}case"06":{r+=`( ${p(t,n)} `,n+=2;const o=e(t.substring(n));r+=` ${o.code} `,n+=o.consumed;const s=f(t.substring(n),!1);r+=` ${s.code} )`,n+=s.consumed;break}case"07":{r+=`( ${p(t,n)} `,n+=2;let o=[],s=e(t.substring(n));o.push(s.code),n+=s.consumed,s=e(t.substring(n)),o.push(s.code),n+=s.consumed,r+=` ${o.join(" ")} )`;break}case"08":{r+=`( ${p(t,n)} `,n+=2;const o=e(t.substring(n));n+=o.consumed;const s=e(t.substring(n));n+=s.consumed,r+=` ${o.code} ${s.code} `;const i=f(t.substring(n),!1);r+=` ${i.code} )`,n+=i.consumed;break}case"09":{r+=`( ${p(t,n)} `,n+=2;let o=e("02"+t.substring(n));if(r+='"args": '+o.code,n+=o.consumed-2,"00000000"!==t.substring(n,n+8)){const e=f(t.substring(n),!1);e.code.length>2&&(r+=` ${e.code} )`),n+=e.consumed}else r+=" )",n+=8;break}case"0a":{const e=parseInt(t.substring(n,n+8),16);n+=8,r+="0x"+t.substring(n,n+2*e),n+=2*e;break}default:throw new Error(`Unknown Michelson field type '${o}' at offset ${n} of '${t}'`)}}catch(e){const o=`Nested hex parsing error (${e.message}) after: ${t}, ${n}, ${r}`;throw new Error(o)}return{code:r,consumed:n}},t.translateMichelsonToMicheline=r,t.translateParameterMichelsonToMicheline=function(e){return r(e)},t.translateMichelsonToHex=function(e){return function(e){const t=JSON.parse(e);let r=[];return r.push(n(t,"code")),r.push(n(t,"storage")),r}(r(e)).map(e=>d(e)).map(e=>u(e)).reduce((e,t)=>e+("0000000"+(t.length/2).toString(16)).slice(-8)+t,"")},t.translateMichelineToHex=u,t.overrideKeywordList=function(e){o.setKeywordList(e)},t.restoreKeywordList=function(){o.setKeywordList(o.DefaultMichelsonKeywords)},t.preProcessMichelsonScript=h,t.normalizeMichelineWhiteSpace=d,t.normalizeMichelsonWhiteSpace=function(e){return e.replace(/\s{2,}/g," ").replace(/\( /g,"(").replace(/ \)/g,")")},t.stripComments=function(e){return e.trim().split("\n").map(e=>e.replace(/\#[\s\S]+$/,"").trim()).filter(e=>e.length>0).join(" ")}}(t.TezosLanguageUtil||(t.TezosLanguageUtil={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{static setLogger(e){Object.assign(this.log,e)}}t.default=n,n.log={}},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n=r(18),o=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=p;var s=r(15);s.inherits=r(1);var i=r(36),a=r(27);s.inherits(p,i);for(var u=o(a.prototype),c=0;c<u.length;c++){var l=u[c];p.prototype[l]||(p.prototype[l]=a.prototype[l])}function p(e){if(!(this instanceof p))return new p(e);i.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",f)}function f(){this.allowHalfOpen||this._writableState.ended||n.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),p.prototype._destroy=function(e,t){this.push(null),this.end(),n.nextTick(t,e)}},function(e,t,r){var n=r(2).Buffer;function o(e,t){this._block=n.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}o.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=n.from(e,t));for(var r=this._block,o=this._blockSize,s=e.length,i=this._len,a=0;a<s;){for(var u=i%o,c=Math.min(s-a,o-u),l=0;l<c;l++)r[u+l]=e[a+l];a+=c,(i+=c)%o==0&&this._update(r)}return this._len+=s,this},o.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,o=(r-n)/4294967296;this._block.writeUInt32BE(o,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s},o.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{static setFetch(e){this.actualFetch=e}}t.default=n,n.fetch=(e,t)=>n.actualFetch(e,t)},function(e,t,r){(function(e){function r(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===r(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===r(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===r(e)},t.isError=function(e){return"[object Error]"===r(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,r(0).Buffer)},function(e,t,r){var n=r(75),o=r(76);e.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:o.blake2s,blake2sHex:o.blake2sHex,blake2sInit:o.blake2sInit,blake2sUpdate:o.blake2sUpdate,blake2sFinal:o.blake2sFinal}},function(e,t){var r,n,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var u,c=[],l=!1,p=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):p=-1,c.length&&h())}function h(){if(!l){var e=a(f);l=!0;for(var t=c.length;t;){for(u=c,c=[];++p<t;)u&&u[p].run();p=-1,t=c.length}u=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function g(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new d(e,t)),1!==c.length||l||a(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,r){"use strict";(function(t){void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,o){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,i,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,n)}));case 4:return t.nextTick((function(){e.call(null,r,n,o)}));default:for(s=new Array(a-1),i=0;i<s.length;)s[i++]=arguments[i];return t.nextTick((function(){e.apply(null,s)}))}}}:e.exports=t}).call(this,r(17))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.OperationGroupWatermark="03",e.DefaultTransactionStorageLimit=496,e.DefaultTransactionGasLimit=10600,e.DefaultDelegationStorageLimit=0,e.DefaultDelegationGasLimit=1101,e.DefaultAccountOriginationStorageLimit=496,e.DefaultAccountOriginationGasLimit=10600,e.DefaultAccountOriginationFee=1266,e.DefaultKeyRevealFee=1270,e.DefaultDelegationFee=1258,e.P005ManagerContractWithdrawalGasLimit=26283,e.P005ManagerContractDepositGasLimit=15285,e.P005ManagerContractWithdrawalStorageLimit=496,e.DefaultBatchDelay=25,e.DefaultBlockTime=60}(t.TezosConstants||(t.TezosConstants={}))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(21),i=o(r(10)),a=r(29),u=r(31),c=i.default.log;!function(e){function t(e,t,r,o){return n(this,void 0,void 0,(function*(){return a.ConseilDataClient.executeEntityQuery(e,"tezos",t,r,o)}))}function r(e,r){return n(this,void 0,void 0,(function*(){const n=u.ConseilQueryBuilder.setLimit(u.ConseilQueryBuilder.addOrdering(u.ConseilQueryBuilder.blankQuery(),"level",s.ConseilSortDirection.DESC),1);return(yield t(e,r,"blocks",n))[0]}))}function o(e,r,o){return n(this,void 0,void 0,(function*(){return t(e,r,"blocks",o)}))}function i(e,r,o){return n(this,void 0,void 0,(function*(){return t(e,r,"operations",o)}))}function l(e,t,o,a,l=60){return n(this,void 0,void 0,(function*(){if(a<=0)throw new Error("Invalid duration");const n=(yield r(e,t)).level,p=(new Date).getTime()-18e4,f=p+18e4+a*l*1e3;c.debug(`TezosConseilClient.awaitOperationConfirmation looking for ${o} since ${n} at ${new Date(p).toUTCString()}, +${a}`);let h=n,d=u.ConseilQueryBuilder.blankQuery();for(d=u.ConseilQueryBuilder.addPredicate(d,"operation_group_hash",s.ConseilOperator.EQ,[o],!1),d=u.ConseilQueryBuilder.addPredicate(d,"timestamp",s.ConseilOperator.AFTER,[p],!1),d=u.ConseilQueryBuilder.setLimit(d,1);n+a>h;){const o=yield i(e,t,d);if(o.length>0)return o[0];if(h=(yield r(e,t)).level,n+a<h)break;if((new Date).getTime()>f)break;yield new Promise(e=>setTimeout(e,1e3*l))}throw new Error(`Did not observe ${o} on ${t} in ${a} block${a>1?"s":""} since ${n}`)}))}e.getTezosEntityData=t,e.getBlockHead=r,e.getBlock=function(e,o,i){return n(this,void 0,void 0,(function*(){if("head"===i)return r(e,o);const n=u.ConseilQueryBuilder.setLimit(u.ConseilQueryBuilder.addPredicate(u.ConseilQueryBuilder.blankQuery(),"hash",s.ConseilOperator.EQ,[i],!1),1);return(yield t(e,o,"blocks",n))[0]}))},e.getBlockByLevel=function(e,r,o){return n(this,void 0,void 0,(function*(){const n=u.ConseilQueryBuilder.setLimit(u.ConseilQueryBuilder.addPredicate(u.ConseilQueryBuilder.blankQuery(),"level",s.ConseilOperator.EQ,[o],!1),1);return(yield t(e,r,"blocks",n))[0]}))},e.getAccount=function(e,r,o){return n(this,void 0,void 0,(function*(){const n=u.ConseilQueryBuilder.setLimit(u.ConseilQueryBuilder.addPredicate(u.ConseilQueryBuilder.blankQuery(),"account_id",s.ConseilOperator.EQ,[o],!1),1);return(yield t(e,r,"accounts",n))[0]}))},e.getOperationGroup=function(e,r,o){return n(this,void 0,void 0,(function*(){const n=u.ConseilQueryBuilder.setLimit(u.ConseilQueryBuilder.addPredicate(u.ConseilQueryBuilder.blankQuery(),"hash",s.ConseilOperator.EQ,[o],!1),1);return(yield t(e,r,"operation_groups",n))[0]}))},e.getOperation=function(e,r,o){return n(this,void 0,void 0,(function*(){const n=u.ConseilQueryBuilder.setLimit(u.ConseilQueryBuilder.addPredicate(u.ConseilQueryBuilder.blankQuery(),"operation_group_hash",s.ConseilOperator.EQ,[o],!1),1);return(yield t(e,r,"operations",n))[0]}))},e.getBlocks=o,e.getAccounts=function(e,r,o){return n(this,void 0,void 0,(function*(){return t(e,r,"accounts",o)}))},e.getOperationGroups=function(e,r,o){return n(this,void 0,void 0,(function*(){return t(e,r,"operation_groups",o)}))},e.getOperations=i,e.getFeeStatistics=function(e,r,o){return n(this,void 0,void 0,(function*(){let n=u.ConseilQueryBuilder.blankQuery();return n=u.ConseilQueryBuilder.addPredicate(n,"kind",s.ConseilOperator.EQ,[o]),n=u.ConseilQueryBuilder.addOrdering(n,"timestamp",s.ConseilSortDirection.DESC),n=u.ConseilQueryBuilder.setLimit(n,1),t(e,r,"fees",n)}))},e.getProposals=function(e,r,o){return n(this,void 0,void 0,(function*(){return t(e,r,"proposals",o)}))},e.getBakers=function(e,r,o){return n(this,void 0,void 0,(function*(){return t(e,r,"bakers",o)}))},e.getBallots=function(e,r,o){return n(this,void 0,void 0,(function*(){return t(e,r,"ballots",o)}))},e.awaitOperationConfirmation=l,e.awaitOperationForkConfirmation=function(e,t,i,a,c){return n(this,void 0,void 0,(function*(){const n=yield l(e,t,i,a),p=n.block_level,f=n.block_hash;let h=p;for(yield new Promise(e=>setTimeout(e,50*c*1e3));h<p+c;){if(h=(yield r(e,t)).level,h>=p+c)break;yield new Promise(e=>setTimeout(e,6e4))}let d=u.ConseilQueryBuilder.blankQuery();d=u.ConseilQueryBuilder.addFields(d,"level","hash","predecessor"),d=u.ConseilQueryBuilder.addPredicate(d,"level",s.ConseilOperator.BETWEEN,[p-1,p+c]),d=u.ConseilQueryBuilder.setLimit(d,2*c);const g=yield o(e,t,d);return g.length===c+2?function(e,t,r){try{return e.sort((e,t)=>parseInt(e.level)-parseInt(t.level)).reduce((n,o,s)=>{if(!n)throw new Error("Block sequence mismatch");return s>1?o.predecessor===e[s-1].hash:1===s?n&&o.level===t&&o.hash===r&&o.predecessor===e[s-1].hash:0===s||void 0},!0)}catch(e){return!1}}(g,p,f):function(e,t,r,n){throw new Error("Not implemented")}()}))},e.getBigMapData=function(e,r){return n(this,void 0,void 0,(function*(){if(!r.startsWith("KT1"))throw new Error("Invalid address");const n=u.ConseilQueryBuilder.setLimit(u.ConseilQueryBuilder.addFields(u.ConseilQueryBuilder.addPredicate(u.ConseilQueryBuilder.blankQuery(),"account_id",s.ConseilOperator.EQ,[r],!1),"big_map_id"),100),o=yield t(e,e.network,"originated_account_maps",n);if(o.length<1)return;const i=u.ConseilQueryBuilder.setLimit(u.ConseilQueryBuilder.addPredicate(u.ConseilQueryBuilder.blankQuery(),"big_map_id",o.length>1?s.ConseilOperator.IN:s.ConseilOperator.EQ,o.map(e=>e.big_map_id),!1),100),a=yield t(e,e.network,"big_maps",i),c=u.ConseilQueryBuilder.setLimit(u.ConseilQueryBuilder.addFields(u.ConseilQueryBuilder.addPredicate(u.ConseilQueryBuilder.blankQuery(),"big_map_id",o.length>1?s.ConseilOperator.IN:s.ConseilOperator.EQ,o.map(e=>e.big_map_id),!1),"big_map_id","key","value"),1e3),l=yield t(e,e.network,"big_map_contents",c);let p=[];for(const e of a){const t={index:Number(e.big_map_id),key:e.key_type,value:e.value_type};let r=[];for(const e of l.filter(e=>e.big_map_id===t.index))r.push({key:JSON.stringify(e.key),value:JSON.stringify(e.value)});p.push({definition:t,content:r})}return{contract:r,maps:p}}))},e.getBigMapValueForKey=function(e,r,o="",i=-1){return n(this,void 0,void 0,(function*(){if(!o.startsWith("KT1"))throw new Error("Invalid address");if(r.length<1)throw new Error("Invalid key");if(i<0&&0===o.length)throw new Error("One of contract or mapIndex must be specified");if(i<0&&o.length>0){let r=u.ConseilQueryBuilder.setLimit(u.ConseilQueryBuilder.blankQuery(),1);r=u.ConseilQueryBuilder.addFields(r,"big_map_id"),r=u.ConseilQueryBuilder.addPredicate(r,"account_id",s.ConseilOperator.EQ,[o],!1),r=u.ConseilQueryBuilder.addOrdering(r,"big_map_id",s.ConseilSortDirection.DESC);const n=yield t(e,e.network,"originated_account_maps",r);if(n.length<1)throw new Error("Could not find any maps for "+o);i=n[0]}let n=u.ConseilQueryBuilder.setLimit(u.ConseilQueryBuilder.blankQuery(),1);n=u.ConseilQueryBuilder.addFields(n,"value"),n=u.ConseilQueryBuilder.addPredicate(n,"key",s.ConseilOperator.EQ,[r],!1),n=u.ConseilQueryBuilder.addPredicate(n,"big_map_id",s.ConseilOperator.EQ,[i],!1);const a=yield t(e,e.network,"big_map_contents",n);if(a.length<1)throw new Error(`Could not a value for key ${r} in map ${i}`);return a[0]}))},e.getEntityQueryForId=function(e){let t=u.ConseilQueryBuilder.setLimit(u.ConseilQueryBuilder.blankQuery(),1);if("number"==typeof e){if(Number(e)<0)throw new Error("Invalid numeric id parameter");return{entity:"blocks",query:u.ConseilQueryBuilder.addPredicate(t,"level",s.ConseilOperator.EQ,[e],!1)}}if("string"==typeof e){const r=String(e);if(r.startsWith("tz1")||r.startsWith("tz2")||r.startsWith("tz3")||r.startsWith("KT1"))return{entity:"accounts",query:u.ConseilQueryBuilder.addPredicate(t,"account_id",s.ConseilOperator.EQ,[e],!1)};if(r.startsWith("B"))return{entity:"blocks",query:u.ConseilQueryBuilder.addPredicate(t,"hash",s.ConseilOperator.EQ,[e],!1)};if(r.startsWith("o"))return t=u.ConseilQueryBuilder.setLimit(t,1e3),{entity:"operations",query:u.ConseilQueryBuilder.addPredicate(t,"operation_group_hash",s.ConseilOperator.EQ,[e],!1)}}throw new Error("Invalid id parameter")}}(t.TezosConseilClient||(t.TezosConseilClient={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.ASC="asc",e.DESC="desc"}(t.ConseilSortDirection||(t.ConseilSortDirection={})),function(e){e.BETWEEN="between",e.EQ="eq",e.IN="in",e.LIKE="like",e.LT="lt",e.BEFORE="before",e.GT="gt",e.AFTER="after",e.STARTSWITH="startsWith",e.ENDSWITH="endsWith",e.ISNULL="isnull"}(t.ConseilOperator||(t.ConseilOperator={})),function(e){e.avg="avg",e.count="count",e.max="max",e.min="min",e.sum="sum"}(t.ConseilFunction||(t.ConseilFunction={})),function(e){e.csv="csv",e.json="json"}(t.ConseilOutput||(t.ConseilOutput={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n extends Error{constructor(e,t,r,n){super(),this.httpStatus=e,this.httpMessage=t,this.serverURL=r,this.request=n}}t.ServiceRequestError=n;class o extends Error{constructor(e,t,r,n,o){super(),this.httpStatus=e,this.httpMessage=t,this.serverURL=r,this.request=n,this.response=o}}t.ServiceResponseError=o},function(e,t,r){var n,o,s;o=[],void 0===(s="function"==typeof(n=function(){"use strict";var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r="boolean"==typeof(new RegExp).sticky;function n(e){return e&&"[object RegExp]"===t.call(e)}function o(e){return e&&"object"==typeof e&&!n(e)&&!Array.isArray(e)}function s(e){return"("+e+")"}function i(e){return e.length?"(?:"+e.map((function(e){return"(?:"+e+")"})).join("|")+")":"(?!)"}function a(e){if("string"==typeof e)return"(?:"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+")";if(n(e)){if(e.ignoreCase)throw new Error("RegExp /i flag not allowed");if(e.global)throw new Error("RegExp /g flag is implied");if(e.sticky)throw new Error("RegExp /y flag is implied");if(e.multiline)throw new Error("RegExp /m flag is implied");if(e.unicode)throw new Error("RegExp /u flag is not allowed");return e.source}throw new Error("Not a pattern: "+e)}function u(t,r){if(o(r)||(r={match:r}),r.include)throw new Error("Matching rules cannot also include states");var s={defaultType:t,lineBreaks:!!r.error||!!r.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var i in r)e.call(r,i)&&(s[i]=r[i]);if("string"==typeof s.type&&t!==s.type)throw new Error("Type transform cannot be a string (type '"+s.type+"' for token '"+t+"')");var a=s.match;return s.match=Array.isArray(a)?a:a?[a]:[],s.match.sort((function(e,t){return n(e)&&n(t)?0:n(t)?-1:n(e)?1:t.length-e.length})),s}function c(e){return Array.isArray(e)?function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];if(n.include)for(var o=[].concat(n.include),s=0;s<o.length;s++)t.push({include:o[s]});else{if(!n.type)throw new Error("Rule has no type: "+JSON.stringify(n));t.push(u(n.type,n))}}return t}(e):function(e){for(var t=Object.getOwnPropertyNames(e),r=[],n=0;n<t.length;n++){var s=t[n],i=e[s],a=[].concat(i);if("include"!==s){var c=[];a.forEach((function(e){o(e)?(c.length&&r.push(u(s,c)),r.push(u(s,e)),c=[]):c.push(e)})),c.length&&r.push(u(s,c))}else for(var l=0;l<a.length;l++)r.push({include:a[l]})}return r}(e)}var l=u("error",{lineBreaks:!0,shouldThrow:!0});function p(e,t){for(var n=null,o=Object.create(null),u=!0,c=[],p=[],f=0;f<e.length;f++)e[f].fallback&&(u=!1);for(f=0;f<e.length;f++){var h=e[f];if(h.include)throw new Error("Inheritance is not allowed in stateless lexers");if(h.error||h.fallback){if(n)throw!h.fallback==!n.fallback?new Error("Multiple "+(h.fallback?"fallback":"error")+" rules not allowed (for token '"+h.defaultType+"')"):new Error("fallback and error are mutually exclusive (for token '"+h.defaultType+"')");n=h}var d=h.match;if(u)for(;d.length&&"string"==typeof d[0]&&1===d[0].length;)o[d.shift().charCodeAt(0)]=h;if(h.pop||h.push||h.next){if(!t)throw new Error("State-switching options are not allowed in stateless lexers (for token '"+h.defaultType+"')");if(h.fallback)throw new Error("State-switching options are not allowed on fallback tokens (for token '"+h.defaultType+"')")}if(0!==d.length){u=!1,c.push(h);var g=i(d.map(a)),m=new RegExp(g);if(m.test(""))throw new Error("RegExp matches empty string: "+m);if(new RegExp("|"+g).exec("").length-1>0)throw new Error("RegExp has capture groups: "+m+"\nUse (?: … ) instead");if(!h.lineBreaks&&m.test("\n"))throw new Error("Rule should declare lineBreaks: "+m);p.push(s(g))}}var y=n&&n.fallback,b=r&&!y?"ym":"gm",P=r||y?"":"|";return{regexp:new RegExp(i(p)+P,b),groups:c,fast:o,error:n||l}}function f(e,t,r){var n=e&&(e.push||e.next);if(n&&!r[n])throw new Error("Missing state '"+n+"' (in token '"+e.defaultType+"' of state '"+t+"')");if(e&&e.pop&&1!=+e.pop)throw new Error("pop must be 1 (in token '"+e.defaultType+"' of state '"+t+"')")}var h=function(e,t){this.startState=t,this.states=e,this.buffer="",this.stack=[],this.reset()};h.prototype.reset=function(e,t){return this.buffer=e||"",this.index=0,this.line=t?t.line:1,this.col=t?t.col:1,this.queuedToken=t?t.queuedToken:null,this.queuedThrow=t?t.queuedThrow:null,this.setState(t?t.state:this.startState),this.stack=t&&t.stack?t.stack.slice():[],this},h.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),queuedToken:this.queuedToken,queuedThrow:this.queuedThrow}},h.prototype.setState=function(e){if(e&&this.state!==e){this.state=e;var t=this.states[e];this.groups=t.groups,this.error=t.error,this.re=t.regexp,this.fast=t.fast}},h.prototype.popState=function(){this.setState(this.stack.pop())},h.prototype.pushState=function(e){this.stack.push(this.state),this.setState(e)};var d=r?function(e,t){return e.exec(t)}:function(e,t){var r=e.exec(t);return 0===r[0].length?null:r};function g(){return this.value}if(h.prototype._getGroup=function(e){for(var t=this.groups.length,r=0;r<t;r++)if(void 0!==e[r+1])return this.groups[r];throw new Error("Cannot find token type for matched text")},h.prototype.next=function(){var e=this.index;if(this.queuedGroup){var t=this._token(this.queuedGroup,this.queuedText,e);return this.queuedGroup=null,this.queuedText="",t}var r=this.buffer;if(e!==r.length){if(i=this.fast[r.charCodeAt(e)])return this._token(i,r.charAt(e),e);var n=this.re;n.lastIndex=e;var o=d(n,r),s=this.error;if(null==o)return this._token(s,r.slice(e,r.length),e);var i=this._getGroup(o),a=o[0];return s.fallback&&o.index!==e?(this.queuedGroup=i,this.queuedText=a,this._token(s,r.slice(e,o.index),e)):this._token(i,a,e)}},h.prototype._token=function(e,t,r){var n=0;if(e.lineBreaks){var o=/\n/g,s=1;if("\n"===t)n=1;else for(;o.exec(t);)n++,s=o.lastIndex}var i={type:"function"==typeof e.type&&e.type(t)||e.defaultType,value:"function"==typeof e.value?e.value(t):t,text:t,toString:g,offset:r,lineBreaks:n,line:this.line,col:this.col},a=t.length;if(this.index+=a,this.line+=n,0!==n?this.col=a-s+1:this.col+=a,e.shouldThrow)throw new Error(this.formatError(i,"invalid syntax"));return e.pop?this.popState():e.push?this.pushState(e.push):e.next&&this.setState(e.next),i},"undefined"!=typeof Symbol&&Symbol.iterator){var m=function(e){this.lexer=e};m.prototype.next=function(){var e=this.lexer.next();return{value:e,done:!e}},m.prototype[Symbol.iterator]=function(){return this},h.prototype[Symbol.iterator]=function(){return new m(this)}}return h.prototype.formatError=function(e,t){var r=e.text,n=e.offset,o=e.lineBreaks?r.indexOf("\n"):r.length,s=Math.max(0,n-e.col+1),i=this.buffer.substring(s,n+o);return t+=" at line "+e.line+" col "+e.col+":\n\n",t+=" "+i+"\n",t+=" "+Array(e.col).join(" ")+"^"},h.prototype.clone=function(){return new h(this.states,this.state)},h.prototype.has=function(e){return!0},{compile:function(e){var t=p(c(e));return new h({start:t},"start")},states:function(e,t){var r=e.$all?c(e.$all):[];delete e.$all;var n=Object.getOwnPropertyNames(e);t||(t=n[0]);for(var o=Object.create(null),s=0;s<n.length;s++){var i=n[s];o[i]=c(e[i]).concat(r)}for(s=0;s<n.length;s++){i=n[s];for(var a=o[i],u=Object.create(null),l=0;l<a.length;l++){var d=a[l];if(d.include){var g=[l,1];if(d.include!==i&&!u[d.include]){u[d.include]=!0;var m=o[d.include];if(!m)throw new Error("Cannot include nonexistent state '"+d.include+"' (in state '"+i+"')");for(var y=0;y<m.length;y++){var b=m[y];-1===a.indexOf(b)&&g.push(b)}}a.splice.apply(a,g),l--}}}var P=Object.create(null);for(s=0;s<n.length;s++)i=n[s],P[i]=p(o[i],!0);for(s=0;s<n.length;s++){var D=n[s],$=P[D],v=$.groups;for(l=0;l<v.length;l++)f(v[l],D,P);var I=Object.getOwnPropertyNames($.fast);for(l=0;l<I.length;l++)f($.fast[I[l]],D,P)}return new h(P,t)},error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:function(e){for(var t=Object.create(null),r=Object.create(null),n=Object.getOwnPropertyNames(e),o=0;o<n.length;o++){var s=n[o],i=e[s];(Array.isArray(i)?i:[i]).forEach((function(e){if((r[e.length]=r[e.length]||[]).push(e),"string"!=typeof e)throw new Error("keyword must be string (in keyword '"+s+"')");t[e]=s}))}function a(e){return JSON.stringify(e)}var u="";for(var c in u+="switch (value.length) {\n",r){var l=r[c];u+="case "+c+":\n",u+="switch (value) {\n",l.forEach((function(e){var r=t[e];u+="case "+a(e)+": return "+a(r)+"\n"})),u+="}\n"}return u+="}\n",Function("value",u)}}})?n.apply(t,o):n)||(e.exports=s)},function(e,t,r){(function(e){var n,o=function(e){"use strict";var t=1e7,r=9007199254740992,n=p(r),s="function"==typeof BigInt;function i(e,t,r,n){return void 0===e?i[0]:void 0!==t&&(10!=+t||r)?z(e,t,r,n):H(e)}function a(e,t){this.value=e,this.sign=t,this.isSmall=!1}function u(e){this.value=e,this.sign=e<0,this.isSmall=!0}function c(e){this.value=e}function l(e){return-r<e&&e<r}function p(e){return e<1e7?[e]:e<1e14?[e%1e7,Math.floor(e/1e7)]:[e%1e7,Math.floor(e/1e7)%1e7,Math.floor(e/1e14)]}function f(e){h(e);var r=e.length;if(r<4&&C(e,n)<0)switch(r){case 0:return 0;case 1:return e[0];case 2:return e[0]+e[1]*t;default:return e[0]+(e[1]+e[2]*t)*t}return e}function h(e){for(var t=e.length;0===e[--t];);e.length=t+1}function d(e){for(var t=new Array(e),r=-1;++r<e;)t[r]=0;return t}function g(e){return e>0?Math.floor(e):Math.ceil(e)}function m(e,r){var n,o,s=e.length,i=r.length,a=new Array(s),u=0,c=t;for(o=0;o<i;o++)u=(n=e[o]+r[o]+u)>=c?1:0,a[o]=n-u*c;for(;o<s;)u=(n=e[o]+u)===c?1:0,a[o++]=n-u*c;return u>0&&a.push(u),a}function y(e,t){return e.length>=t.length?m(e,t):m(t,e)}function b(e,r){var n,o,s=e.length,i=new Array(s),a=t;for(o=0;o<s;o++)n=e[o]-a+r,r=Math.floor(n/a),i[o]=n-r*a,r+=1;for(;r>0;)i[o++]=r%a,r=Math.floor(r/a);return i}function P(e,t){var r,n,o=e.length,s=t.length,i=new Array(o),a=0;for(r=0;r<s;r++)(n=e[r]-a-t[r])<0?(n+=1e7,a=1):a=0,i[r]=n;for(r=s;r<o;r++){if(!((n=e[r]-a)<0)){i[r++]=n;break}n+=1e7,i[r]=n}for(;r<o;r++)i[r]=e[r];return h(i),i}function D(e,t,r){var n,o,s=e.length,i=new Array(s),c=-t;for(n=0;n<s;n++)o=e[n]+c,c=Math.floor(o/1e7),o%=1e7,i[n]=o<0?o+1e7:o;return"number"==typeof(i=f(i))?(r&&(i=-i),new u(i)):new a(i,r)}function $(e,t){var r,n,o,s,i=e.length,a=t.length,u=d(i+a);for(o=0;o<i;++o){s=e[o];for(var c=0;c<a;++c)r=s*t[c]+u[o+c],n=Math.floor(r/1e7),u[o+c]=r-1e7*n,u[o+c+1]+=n}return h(u),u}function v(e,r){var n,o,s=e.length,i=new Array(s),a=t,u=0;for(o=0;o<s;o++)n=e[o]*r+u,u=Math.floor(n/a),i[o]=n-u*a;for(;u>0;)i[o++]=u%a,u=Math.floor(u/a);return i}function I(e,t){for(var r=[];t-- >0;)r.push(0);return r.concat(e)}function _(e,r,n){return new a(e<t?v(r,e):$(r,p(e)),n)}function A(e){var t,r,n,o,s=e.length,i=d(s+s);for(n=0;n<s;n++){r=0-(o=e[n])*o;for(var a=n;a<s;a++)t=o*e[a]*2+i[n+a]+r,r=Math.floor(t/1e7),i[n+a]=t-1e7*r;i[n+s]=r}return h(i),i}function R(e,t){var r,n,o,s,i=e.length,a=d(i);for(o=0,r=i-1;r>=0;--r)o=(s=1e7*o+e[r])-(n=g(s/t))*t,a[r]=0|n;return[a,0|o]}function S(e,r){var n,o=H(r);if(s)return[new c(e.value/o.value),new c(e.value%o.value)];var l,m=e.value,y=o.value;if(0===y)throw new Error("Cannot divide by zero");if(e.isSmall)return o.isSmall?[new u(g(m/y)),new u(m%y)]:[i[0],e];if(o.isSmall){if(1===y)return[e,i[0]];if(-1==y)return[e.negate(),i[0]];var b=Math.abs(y);if(b<t){l=f((n=R(m,b))[0]);var D=n[1];return e.sign&&(D=-D),"number"==typeof l?(e.sign!==o.sign&&(l=-l),[new u(l),new u(D)]):[new a(l,e.sign!==o.sign),new u(D)]}y=p(b)}var $=C(m,y);if(-1===$)return[i[0],e];if(0===$)return[i[e.sign===o.sign?1:-1],i[0]];l=(n=m.length+y.length<=200?function(e,r){var n,o,s,i,a,u,c,l=e.length,p=r.length,h=t,g=d(r.length),m=r[p-1],y=Math.ceil(h/(2*m)),b=v(e,y),P=v(r,y);for(b.length<=l&&b.push(0),P.push(0),m=P[p-1],o=l-p;o>=0;o--){for(n=h-1,b[o+p]!==m&&(n=Math.floor((b[o+p]*h+b[o+p-1])/m)),s=0,i=0,u=P.length,a=0;a<u;a++)s+=n*P[a],c=Math.floor(s/h),i+=b[o+a]-(s-c*h),s=c,i<0?(b[o+a]=i+h,i=-1):(b[o+a]=i,i=0);for(;0!==i;){for(n-=1,s=0,a=0;a<u;a++)(s+=b[o+a]-h+P[a])<0?(b[o+a]=s+h,s=0):(b[o+a]=s,s=1);i+=s}g[o]=n}return b=R(b,y)[0],[f(g),f(b)]}(m,y):function(e,t){for(var r,n,o,s,i,a=e.length,u=t.length,c=[],l=[];a;)if(l.unshift(e[--a]),h(l),C(l,t)<0)c.push(0);else{o=1e7*l[(n=l.length)-1]+l[n-2],s=1e7*t[u-1]+t[u-2],n>u&&(o=1e7*(o+1)),r=Math.ceil(o/s);do{if(C(i=v(t,r),l)<=0)break;r--}while(r);c.push(r),l=P(l,i)}return c.reverse(),[f(c),f(l)]}(m,y))[0];var I=e.sign!==o.sign,_=n[1],A=e.sign;return"number"==typeof l?(I&&(l=-l),l=new u(l)):l=new a(l,I),"number"==typeof _?(A&&(_=-_),_=new u(_)):_=new a(_,A),[l,_]}function C(e,t){if(e.length!==t.length)return e.length>t.length?1:-1;for(var r=e.length-1;r>=0;r--)if(e[r]!==t[r])return e[r]>t[r]?1:-1;return 0}function U(e){var t=e.abs();return!t.isUnit()&&(!!(t.equals(2)||t.equals(3)||t.equals(5))||!(t.isEven()||t.isDivisibleBy(3)||t.isDivisibleBy(5))&&(!!t.lesser(49)||void 0))}function T(e,t){for(var r,n,s,i=e.prev(),a=i,u=0;a.isEven();)a=a.divide(2),u++;e:for(n=0;n<t.length;n++)if(!e.lesser(t[n])&&!(s=o(t[n]).modPow(a,e)).isUnit()&&!s.equals(i)){for(r=u-1;0!=r;r--){if((s=s.square().mod(e)).isUnit())return!1;if(s.equals(i))continue e}return!1}return!0}a.prototype=Object.create(i.prototype),u.prototype=Object.create(i.prototype),c.prototype=Object.create(i.prototype),a.prototype.add=function(e){var t=H(e);if(this.sign!==t.sign)return this.subtract(t.negate());var r=this.value,n=t.value;return t.isSmall?new a(b(r,Math.abs(n)),this.sign):new a(y(r,n),this.sign)},a.prototype.plus=a.prototype.add,u.prototype.add=function(e){var t=H(e),r=this.value;if(r<0!==t.sign)return this.subtract(t.negate());var n=t.value;if(t.isSmall){if(l(r+n))return new u(r+n);n=p(Math.abs(n))}return new a(b(n,Math.abs(r)),r<0)},u.prototype.plus=u.prototype.add,c.prototype.add=function(e){return new c(this.value+H(e).value)},c.prototype.plus=c.prototype.add,a.prototype.subtract=function(e){var t=H(e);if(this.sign!==t.sign)return this.add(t.negate());var r=this.value,n=t.value;return t.isSmall?D(r,Math.abs(n),this.sign):function(e,t,r){var n;return C(e,t)>=0?n=P(e,t):(n=P(t,e),r=!r),"number"==typeof(n=f(n))?(r&&(n=-n),new u(n)):new a(n,r)}(r,n,this.sign)},a.prototype.minus=a.prototype.subtract,u.prototype.subtract=function(e){var t=H(e),r=this.value;if(r<0!==t.sign)return this.add(t.negate());var n=t.value;return t.isSmall?new u(r-n):D(n,Math.abs(r),r>=0)},u.prototype.minus=u.prototype.subtract,c.prototype.subtract=function(e){return new c(this.value-H(e).value)},c.prototype.minus=c.prototype.subtract,a.prototype.negate=function(){return new a(this.value,!this.sign)},u.prototype.negate=function(){var e=this.sign,t=new u(-this.value);return t.sign=!e,t},c.prototype.negate=function(){return new c(-this.value)},a.prototype.abs=function(){return new a(this.value,!1)},u.prototype.abs=function(){return new u(Math.abs(this.value))},c.prototype.abs=function(){return new c(this.value>=0?this.value:-this.value)},a.prototype.multiply=function(e){var r,n,o,s=H(e),u=this.value,c=s.value,l=this.sign!==s.sign;if(s.isSmall){if(0===c)return i[0];if(1===c)return this;if(-1===c)return this.negate();if((r=Math.abs(c))<t)return new a(v(u,r),l);c=p(r)}return n=u.length,o=c.length,new a(-.012*n-.012*o+15e-6*n*o>0?function e(t,r){var n=Math.max(t.length,r.length);if(n<=30)return $(t,r);n=Math.ceil(n/2);var o=t.slice(n),s=t.slice(0,n),i=r.slice(n),a=r.slice(0,n),u=e(s,a),c=e(o,i),l=e(y(s,o),y(a,i)),p=y(y(u,I(P(P(l,u),c),n)),I(c,2*n));return h(p),p}(u,c):$(u,c),l)},a.prototype.times=a.prototype.multiply,u.prototype._multiplyBySmall=function(e){return l(e.value*this.value)?new u(e.value*this.value):_(Math.abs(e.value),p(Math.abs(this.value)),this.sign!==e.sign)},a.prototype._multiplyBySmall=function(e){return 0===e.value?i[0]:1===e.value?this:-1===e.value?this.negate():_(Math.abs(e.value),this.value,this.sign!==e.sign)},u.prototype.multiply=function(e){return H(e)._multiplyBySmall(this)},u.prototype.times=u.prototype.multiply,c.prototype.multiply=function(e){return new c(this.value*H(e).value)},c.prototype.times=c.prototype.multiply,a.prototype.square=function(){return new a(A(this.value),!1)},u.prototype.square=function(){var e=this.value*this.value;return l(e)?new u(e):new a(A(p(Math.abs(this.value))),!1)},c.prototype.square=function(e){return new c(this.value*this.value)},a.prototype.divmod=function(e){var t=S(this,e);return{quotient:t[0],remainder:t[1]}},c.prototype.divmod=u.prototype.divmod=a.prototype.divmod,a.prototype.divide=function(e){return S(this,e)[0]},c.prototype.over=c.prototype.divide=function(e){return new c(this.value/H(e).value)},u.prototype.over=u.prototype.divide=a.prototype.over=a.prototype.divide,a.prototype.mod=function(e){return S(this,e)[1]},c.prototype.mod=c.prototype.remainder=function(e){return new c(this.value%H(e).value)},u.prototype.remainder=u.prototype.mod=a.prototype.remainder=a.prototype.mod,a.prototype.pow=function(e){var t,r,n,o=H(e),s=this.value,a=o.value;if(0===a)return i[1];if(0===s)return i[0];if(1===s)return i[1];if(-1===s)return o.isEven()?i[1]:i[-1];if(o.sign)return i[0];if(!o.isSmall)throw new Error("The exponent "+o.toString()+" is too large.");if(this.isSmall&&l(t=Math.pow(s,a)))return new u(g(t));for(r=this,n=i[1];!0&a&&(n=n.times(r),--a),0!==a;)a/=2,r=r.square();return n},u.prototype.pow=a.prototype.pow,c.prototype.pow=function(e){var t=H(e),r=this.value,n=t.value,o=BigInt(0),s=BigInt(1),a=BigInt(2);if(n===o)return i[1];if(r===o)return i[0];if(r===s)return i[1];if(r===BigInt(-1))return t.isEven()?i[1]:i[-1];if(t.isNegative())return new c(o);for(var u=this,l=i[1];(n&s)===s&&(l=l.times(u),--n),n!==o;)n/=a,u=u.square();return l},a.prototype.modPow=function(e,t){if(e=H(e),(t=H(t)).isZero())throw new Error("Cannot take modPow with modulus 0");var r=i[1],n=this.mod(t);for(e.isNegative()&&(e=e.multiply(i[-1]),n=n.modInv(t));e.isPositive();){if(n.isZero())return i[0];e.isOdd()&&(r=r.multiply(n).mod(t)),e=e.divide(2),n=n.square().mod(t)}return r},c.prototype.modPow=u.prototype.modPow=a.prototype.modPow,a.prototype.compareAbs=function(e){var t=H(e),r=this.value,n=t.value;return t.isSmall?1:C(r,n)},u.prototype.compareAbs=function(e){var t=H(e),r=Math.abs(this.value),n=t.value;return t.isSmall?r===(n=Math.abs(n))?0:r>n?1:-1:-1},c.prototype.compareAbs=function(e){var t=this.value,r=H(e).value;return(t=t>=0?t:-t)===(r=r>=0?r:-r)?0:t>r?1:-1},a.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var t=H(e),r=this.value,n=t.value;return this.sign!==t.sign?t.sign?1:-1:t.isSmall?this.sign?-1:1:C(r,n)*(this.sign?-1:1)},a.prototype.compareTo=a.prototype.compare,u.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var t=H(e),r=this.value,n=t.value;return t.isSmall?r==n?0:r>n?1:-1:r<0!==t.sign?r<0?-1:1:r<0?1:-1},u.prototype.compareTo=u.prototype.compare,c.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var t=this.value,r=H(e).value;return t===r?0:t>r?1:-1},c.prototype.compareTo=c.prototype.compare,a.prototype.equals=function(e){return 0===this.compare(e)},c.prototype.eq=c.prototype.equals=u.prototype.eq=u.prototype.equals=a.prototype.eq=a.prototype.equals,a.prototype.notEquals=function(e){return 0!==this.compare(e)},c.prototype.neq=c.prototype.notEquals=u.prototype.neq=u.prototype.notEquals=a.prototype.neq=a.prototype.notEquals,a.prototype.greater=function(e){return this.compare(e)>0},c.prototype.gt=c.prototype.greater=u.prototype.gt=u.prototype.greater=a.prototype.gt=a.prototype.greater,a.prototype.lesser=function(e){return this.compare(e)<0},c.prototype.lt=c.prototype.lesser=u.prototype.lt=u.prototype.lesser=a.prototype.lt=a.prototype.lesser,a.prototype.greaterOrEquals=function(e){return this.compare(e)>=0},c.prototype.geq=c.prototype.greaterOrEquals=u.prototype.geq=u.prototype.greaterOrEquals=a.prototype.geq=a.prototype.greaterOrEquals,a.prototype.lesserOrEquals=function(e){return this.compare(e)<=0},c.prototype.leq=c.prototype.lesserOrEquals=u.prototype.leq=u.prototype.lesserOrEquals=a.prototype.leq=a.prototype.lesserOrEquals,a.prototype.isEven=function(){return 0==(1&this.value[0])},u.prototype.isEven=function(){return 0==(1&this.value)},c.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},a.prototype.isOdd=function(){return 1==(1&this.value[0])},u.prototype.isOdd=function(){return 1==(1&this.value)},c.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},a.prototype.isPositive=function(){return!this.sign},u.prototype.isPositive=function(){return this.value>0},c.prototype.isPositive=u.prototype.isPositive,a.prototype.isNegative=function(){return this.sign},u.prototype.isNegative=function(){return this.value<0},c.prototype.isNegative=u.prototype.isNegative,a.prototype.isUnit=function(){return!1},u.prototype.isUnit=function(){return 1===Math.abs(this.value)},c.prototype.isUnit=function(){return this.abs().value===BigInt(1)},a.prototype.isZero=function(){return!1},u.prototype.isZero=function(){return 0===this.value},c.prototype.isZero=function(){return this.value===BigInt(0)},a.prototype.isDivisibleBy=function(e){var t=H(e);return!t.isZero()&&(!!t.isUnit()||(0===t.compareAbs(2)?this.isEven():this.mod(t).isZero()))},c.prototype.isDivisibleBy=u.prototype.isDivisibleBy=a.prototype.isDivisibleBy,a.prototype.isPrime=function(e){var t=U(this);if(void 0!==t)return t;var r=this.abs(),n=r.bitLength();if(n<=64)return T(r,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var s=Math.log(2)*n.toJSNumber(),i=Math.ceil(!0===e?2*Math.pow(s,2):s),a=[],u=0;u<i;u++)a.push(o(u+2));return T(r,a)},c.prototype.isPrime=u.prototype.isPrime=a.prototype.isPrime,a.prototype.isProbablePrime=function(e,t){var r=U(this);if(void 0!==r)return r;for(var n=this.abs(),s=void 0===e?5:e,i=[],a=0;a<s;a++)i.push(o.randBetween(2,n.minus(2),t));return T(n,i)},c.prototype.isProbablePrime=u.prototype.isProbablePrime=a.prototype.isProbablePrime,a.prototype.modInv=function(e){for(var t,r,n,s=o.zero,i=o.one,a=H(e),u=this.abs();!u.isZero();)t=a.divide(u),r=s,n=a,s=i,a=u,i=r.subtract(t.multiply(i)),u=n.subtract(t.multiply(u));if(!a.isUnit())throw new Error(this.toString()+" and "+e.toString()+" are not co-prime");return-1===s.compare(0)&&(s=s.add(e)),this.isNegative()?s.negate():s},c.prototype.modInv=u.prototype.modInv=a.prototype.modInv,a.prototype.next=function(){var e=this.value;return this.sign?D(e,1,this.sign):new a(b(e,1),this.sign)},u.prototype.next=function(){var e=this.value;return e+1<r?new u(e+1):new a(n,!1)},c.prototype.next=function(){return new c(this.value+BigInt(1))},a.prototype.prev=function(){var e=this.value;return this.sign?new a(b(e,1),!0):D(e,1,this.sign)},u.prototype.prev=function(){var e=this.value;return e-1>-r?new u(e-1):new a(n,!0)},c.prototype.prev=function(){return new c(this.value-BigInt(1))};for(var w=[1];2*w[w.length-1]<=t;)w.push(2*w[w.length-1]);var E=w.length,O=w[E-1];function N(e){return Math.abs(e)<=t}function M(e,t,r){t=H(t);for(var n=e.isNegative(),s=t.isNegative(),i=n?e.not():e,a=s?t.not():t,u=0,c=0,l=null,p=null,f=[];!i.isZero()||!a.isZero();)u=(l=S(i,O))[1].toJSNumber(),n&&(u=O-1-u),c=(p=S(a,O))[1].toJSNumber(),s&&(c=O-1-c),i=l[0],a=p[0],f.push(r(u,c));for(var h=0!==r(n?1:0,s?1:0)?o(-1):o(0),d=f.length-1;d>=0;d-=1)h=h.multiply(O).add(o(f[d]));return h}a.prototype.shiftLeft=function(e){var t=H(e).toJSNumber();if(!N(t))throw new Error(String(t)+" is too large for shifting.");if(t<0)return this.shiftRight(-t);var r=this;if(r.isZero())return r;for(;t>=E;)r=r.multiply(O),t-=E-1;return r.multiply(w[t])},c.prototype.shiftLeft=u.prototype.shiftLeft=a.prototype.shiftLeft,a.prototype.shiftRight=function(e){var t,r=H(e).toJSNumber();if(!N(r))throw new Error(String(r)+" is too large for shifting.");if(r<0)return this.shiftLeft(-r);for(var n=this;r>=E;){if(n.isZero()||n.isNegative()&&n.isUnit())return n;n=(t=S(n,O))[1].isNegative()?t[0].prev():t[0],r-=E-1}return(t=S(n,w[r]))[1].isNegative()?t[0].prev():t[0]},c.prototype.shiftRight=u.prototype.shiftRight=a.prototype.shiftRight,a.prototype.not=function(){return this.negate().prev()},c.prototype.not=u.prototype.not=a.prototype.not,a.prototype.and=function(e){return M(this,e,(function(e,t){return e&t}))},c.prototype.and=u.prototype.and=a.prototype.and,a.prototype.or=function(e){return M(this,e,(function(e,t){return e|t}))},c.prototype.or=u.prototype.or=a.prototype.or,a.prototype.xor=function(e){return M(this,e,(function(e,t){return e^t}))},c.prototype.xor=u.prototype.xor=a.prototype.xor;function x(e){var r=e.value,n="number"==typeof r?r|1<<30:"bigint"==typeof r?r|BigInt(1<<30):r[0]+r[1]*t|1073758208;return n&-n}function F(e,t){return e=H(e),t=H(t),e.greater(t)?e:t}function G(e,t){return e=H(e),t=H(t),e.lesser(t)?e:t}function k(e,t){if(e=H(e).abs(),t=H(t).abs(),e.equals(t))return e;if(e.isZero())return t;if(t.isZero())return e;for(var r,n,o=i[1];e.isEven()&&t.isEven();)r=G(x(e),x(t)),e=e.divide(r),t=t.divide(r),o=o.multiply(r);for(;e.isEven();)e=e.divide(x(e));do{for(;t.isEven();)t=t.divide(x(t));e.greater(t)&&(n=t,t=e,e=n),t=t.subtract(e)}while(!t.isZero());return o.isUnit()?e:e.multiply(o)}a.prototype.bitLength=function(){var e=this;return e.compareTo(o(0))<0&&(e=e.negate().subtract(o(1))),0===e.compareTo(o(0))?o(0):o(function e(t,r){if(r.compareTo(t)<=0){var n=e(t,r.square(r)),s=n.p,i=n.e,a=s.multiply(r);return a.compareTo(t)<=0?{p:a,e:2*i+1}:{p:s,e:2*i}}return{p:o(1),e:0}}(e,o(2)).e).add(o(1))},c.prototype.bitLength=u.prototype.bitLength=a.prototype.bitLength;var z=function(e,t,r,n){r=r||"0123456789abcdefghijklmnopqrstuvwxyz",e=String(e),n||(e=e.toLowerCase(),r=r.toLowerCase());var o,s=e.length,i=Math.abs(t),a={};for(o=0;o<r.length;o++)a[r[o]]=o;for(o=0;o<s;o++){if("-"!==(l=e[o])&&(l in a&&a[l]>=i)){if("1"===l&&1===i)continue;throw new Error(l+" is not a valid digit in base "+t+".")}}t=H(t);var u=[],c="-"===e[0];for(o=c?1:0;o<e.length;o++){var l;if((l=e[o])in a)u.push(H(a[l]));else{if("<"!==l)throw new Error(l+" is not a valid character");var p=o;do{o++}while(">"!==e[o]&&o<e.length);u.push(H(e.slice(p+1,o)))}}return L(u,t,c)};function L(e,t,r){var n,o=i[0],s=i[1];for(n=e.length-1;n>=0;n--)o=o.add(e[n].times(s)),s=s.times(t);return r?o.negate():o}function W(e,t){if((t=o(t)).isZero()){if(e.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(t.equals(-1)){if(e.isZero())return{value:[0],isNegative:!1};if(e.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-e.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(e.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var n=!1;if(e.isNegative()&&t.isPositive()&&(n=!0,e=e.abs()),t.isUnit())return e.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(e.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:n};for(var s,i=[],a=e;a.isNegative()||a.compareAbs(t)>=0;){s=a.divmod(t),a=s.quotient;var u=s.remainder;u.isNegative()&&(u=t.minus(u).abs(),a=a.next()),i.push(u.toJSNumber())}return i.push(a.toJSNumber()),{value:i.reverse(),isNegative:n}}function B(e,t,r){var n=W(e,t);return(n.isNegative?"-":"")+n.value.map((function(e){return function(e,t){return e<(t=t||"0123456789abcdefghijklmnopqrstuvwxyz").length?t[e]:"<"+e+">"}(e,r)})).join("")}function j(e){if(l(+e)){var t=+e;if(t===g(t))return s?new c(BigInt(t)):new u(t);throw new Error("Invalid integer: "+e)}var r="-"===e[0];r&&(e=e.slice(1));var n=e.split(/e/i);if(n.length>2)throw new Error("Invalid integer: "+n.join("e"));if(2===n.length){var o=n[1];if("+"===o[0]&&(o=o.slice(1)),(o=+o)!==g(o)||!l(o))throw new Error("Invalid integer: "+o+" is not a valid exponent.");var i=n[0],p=i.indexOf(".");if(p>=0&&(o-=i.length-p-1,i=i.slice(0,p)+i.slice(p+1)),o<0)throw new Error("Cannot include negative exponent part for integers");e=i+=new Array(o+1).join("0")}if(!/^([0-9][0-9]*)$/.test(e))throw new Error("Invalid integer: "+e);if(s)return new c(BigInt(r?"-"+e:e));for(var f=[],d=e.length,m=d-7;d>0;)f.push(+e.slice(m,d)),(m-=7)<0&&(m=0),d-=7;return h(f),new a(f,r)}function H(e){return"number"==typeof e?function(e){if(s)return new c(BigInt(e));if(l(e)){if(e!==g(e))throw new Error(e+" is not an integer.");return new u(e)}return j(e.toString())}(e):"string"==typeof e?j(e):"bigint"==typeof e?new c(e):e}a.prototype.toArray=function(e){return W(this,e)},u.prototype.toArray=function(e){return W(this,e)},c.prototype.toArray=function(e){return W(this,e)},a.prototype.toString=function(e,t){if(void 0===e&&(e=10),10!==e)return B(this,e,t);for(var r,n=this.value,o=n.length,s=String(n[--o]);--o>=0;)r=String(n[o]),s+="0000000".slice(r.length)+r;return(this.sign?"-":"")+s},u.prototype.toString=function(e,t){return void 0===e&&(e=10),10!=e?B(this,e,t):String(this.value)},c.prototype.toString=u.prototype.toString,c.prototype.toJSON=a.prototype.toJSON=u.prototype.toJSON=function(){return this.toString()},a.prototype.valueOf=function(){return parseInt(this.toString(),10)},a.prototype.toJSNumber=a.prototype.valueOf,u.prototype.valueOf=function(){return this.value},u.prototype.toJSNumber=u.prototype.valueOf,c.prototype.valueOf=c.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};for(var J=0;J<1e3;J++)i[J]=H(J),J>0&&(i[-J]=H(-J));return i.one=i[1],i.zero=i[0],i.minusOne=i[-1],i.max=F,i.min=G,i.gcd=k,i.lcm=function(e,t){return e=H(e).abs(),t=H(t).abs(),e.divide(k(e,t)).multiply(t)},i.isInstance=function(e){return e instanceof a||e instanceof u||e instanceof c},i.randBetween=function(e,r,n){e=H(e),r=H(r);var o=n||Math.random,s=G(e,r),a=F(e,r).subtract(s).add(1);if(a.isSmall)return s.add(Math.floor(o()*a));for(var u=W(a,t).value,c=[],l=!0,p=0;p<u.length;p++){var f=l?u[p]:t,h=g(o()*f);c.push(h),h<f&&(l=!1)}return s.add(i.fromArray(c,t,!1))},i.fromArray=function(e,t,r){return L(e.map(H),H(t||10),r)},i}();e.hasOwnProperty("exports")&&(e.exports=o),void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}).call(this,r(49)(e))},function(e,t,r){"use strict";var n,o="object"==typeof Reflect?Reflect:null,s=o&&"function"==typeof o.apply?o.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function o(){void 0!==s&&e.removeListener("error",s),r([].slice.call(arguments))}var s;"error"!==t&&(s=function(r){e.removeListener(t,o),n(r)},e.once("error",s)),e.once(t,o)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function p(e,t,r,n){var o,s,i,a;if(c(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),i=s[t]),void 0===i)i=s[t]=r,++e._eventsCount;else if("function"==typeof i?i=s[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(o=l(e))>0&&i.length>o&&!i.warned){i.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=i.length,a=u,console&&console.warn&&console.warn(a)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=f.bind(n);return o.listener=r,n.wrapFn=o,o}function d(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):m(o,o.length)}function g(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function m(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var u=o[e];if(void 0===u)return!1;if("function"==typeof u)s(u,this,t);else{var c=u.length,l=m(u,c);for(r=0;r<c;++r)s(l[r],this,t)}return!0},a.prototype.addListener=function(e,t){return p(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return p(this,e,t,!0)},a.prototype.once=function(e,t){return c(t),this.on(e,h(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,h(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,o,s,i;if(c(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){i=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(o=s[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return d(this,e,!0)},a.prototype.rawListeners=function(e){return d(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,r){(t=e.exports=r(36)).Stream=t,t.Readable=t,t.Writable=r(27),t.Duplex=r(12),t.Transform=r(39),t.PassThrough=r(60)},function(e,t,r){"use strict";(function(t,n,o){var s=r(18);function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var o=n.callback;t.pendingcb--,o(r),n=n.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=b;var a,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?n:s.nextTick;b.WritableState=y;var c=r(15);c.inherits=r(1);var l={deprecate:r(59)},p=r(37),f=r(2).Buffer,h=o.Uint8Array||function(){};var d,g=r(38);function m(){}function y(e,t){a=a||r(12),e=e||{};var n=t instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var o=e.highWaterMark,c=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:n&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var p=!1===e.decodeStrings;this.decodeStrings=!p,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,o=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,o){--t.pendingcb,r?(s.nextTick(o,n),s.nextTick(_,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(o(n),e._writableState.errorEmitted=!0,e.emit("error",n),_(e,t))}(e,r,n,t,o);else{var i=v(r);i||r.corked||r.bufferProcessing||!r.bufferedRequest||$(e,r),n?u(D,e,r,i,o):D(e,r,i,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function b(e){if(a=a||r(12),!(d.call(b,this)||this instanceof a))return new b(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),p.call(this)}function P(e,t,r,n,o,s,i){t.writelen=n,t.writecb=i,t.writing=!0,t.sync=!0,r?e._writev(o,t.onwrite):e._write(o,s,t.onwrite),t.sync=!1}function D(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),_(e,t)}function $(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,o=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)o[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;o.allBuffers=u,P(e,t,!0,t.length,o,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,p=r.callback;if(P(e,t,!1,t.objectMode?1:c.length,c,l,p),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function v(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function I(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),_(e,t)}))}function _(e,t){var r=v(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,s.nextTick(I,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}c.inherits(b,p),y.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(y.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===b&&(e&&e._writableState instanceof y)}})):d=function(e){return e instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(e,t,r){var n,o=this._writableState,i=!1,a=!o.objectMode&&(n=e,f.isBuffer(n)||n instanceof h);return a&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=m),o.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),s.nextTick(t,r)}(this,r):(a||function(e,t,r,n){var o=!0,i=!1;return null===r?i=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i&&(e.emit("error",i),s.nextTick(n,i),o=!1),o}(this,o,e,r))&&(o.pendingcb++,i=function(e,t,r,n,o,s){if(!r){var i=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,r));return t}(t,n,o);n!==i&&(r=!0,o="buffer",n=i)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:o,isBuf:r,callback:s,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else P(e,t,!1,a,n,o,s);return u}(this,o,a,e,t,r)),i},b.prototype.cork=function(){this._writableState.corked++},b.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||$(this,e))},b.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,_(e,t),r&&(t.finished?s.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),b.prototype.destroy=g.destroy,b.prototype._undestroy=g.undestroy,b.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(17),r(57).setImmediate,r(11))},function(e,t,r){"use strict";var n=r(2).Buffer,o=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=p,t=3;break;default:return this.write=f,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function i(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var o=i(t[n]);if(o>=0)return o>0&&(e.lastNeed=o-1),o;if(--n<r||-2===o)return 0;if((o=i(t[n]))>=0)return o>0&&(e.lastNeed=o-2),o;if(--n<r||-2===o)return 0;if((o=i(t[n]))>=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(30),i=o(r(14)),a=o(r(10)).default.log,u=i.default.fetch;!function(e){e.executeEntityQuery=function(e,t,r,o,i){return n(this,void 0,void 0,(function*(){const n=`${e.url}/v2/data/${t}/${r}/${o}`;return a.debug(`ConseilDataClient.executeEntityQuery request: ${n}, ${JSON.stringify(i)}`),u(n,{method:"post",headers:{apiKey:e.apiKey,"Content-Type":"application/json"},cache:"no-store",body:JSON.stringify(i)}).then(e=>{if(!e.ok)throw a.error(`ConseilDataClient.executeEntityQuery request: ${n}, ${JSON.stringify(i)}, failed with ${e.statusText}(${e.status})`),new s.ConseilRequestError(e.status,e.statusText,n,i);return e}).then(e=>{const t=e.headers.get("content-type").toLowerCase().includes("application/json"),r=t?e.json():e.text();return a.debug("ConseilDataClient.executeEntityQuery response: "+(t?JSON.stringify(r):r)),r})}))}}(t.ConseilDataClient||(t.ConseilDataClient={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(22);class o extends n.ServiceRequestError{constructor(e,t,r,n){super(e,t,r,null),this.conseilQuery=n}toString(){return`ConseilRequestError for ${this.serverURL} with ${this.httpStatus} and ${this.httpMessage}`}}t.ConseilRequestError=o;class s extends n.ServiceResponseError{constructor(e,t,r,n,o){super(e,t,r,null,o),this.conseilQuery=n}}t.ConseilResponseError=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(21);!function(e){e.blankQuery=function(){return{fields:[],predicates:[],orderBy:[],aggregation:[],limit:100}},e.addFields=function(e,...t){let r=Object.assign({},e),n=new Set(e.fields);return t.forEach(e=>n.add(e)),r.fields=Array.from(n.values()),r},e.addPredicate=function(e,t,r,o,s=!1,i){if(r===n.ConseilOperator.BETWEEN&&2!==o.length)throw new Error("BETWEEN operation requires a list of two values.");if(r===n.ConseilOperator.IN&&o.length<2)throw new Error("IN operation requires a list of two or more values.");if(1!==o.length&&r!==n.ConseilOperator.IN&&r!==n.ConseilOperator.BETWEEN&&r!==n.ConseilOperator.ISNULL)throw new Error(`invalid values list for ${r}.`);let a=Object.assign({},e);return a.predicates.push({field:t,operation:r,set:o,inverse:s,group:i}),a},e.addOrdering=function(e,t,r=n.ConseilSortDirection.ASC){let o=Object.assign({},e);return o.orderBy.push({field:t,direction:r}),o},e.setLimit=function(e,t){if(t<1)throw new Error("Limit cannot be less than one.");let r=Object.assign({},e);return r.limit=t,r},e.setOutputType=function(e,t){let r=Object.assign({},e);return r.output=t,r},e.addAggregationFunction=function(e,t,r){if(!e.fields.includes(t))throw new Error("Cannot apply an aggregation function on a field not being returned.");let n=Object.assign({},e);return n.aggregation.push({field:t,function:r}),n},e.addExtendedParameter=function(e,t,r){return e[t]=r,e},e.removeParameter=function(e,t){return e.hasOwnProperty(t)&&delete e[t],e}}(t.ConseilQueryBuilder||(t.ConseilQueryBuilder={}))},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){var n,o;n=this,o=function(){function e(t,r,n){return this.id=++e.highestId,this.name=t,this.symbols=r,this.postprocess=n,this}function t(e,t,r,n){this.rule=e,this.dot=t,this.reference=r,this.data=[],this.wantedBy=n,this.isComplete=this.dot===e.symbols.length}function r(e,t){this.grammar=e,this.index=t,this.states=[],this.wants={},this.scannable=[],this.completed={}}function n(e,t){this.rules=e,this.start=t||this.rules[0].name;var r=this.byName={};this.rules.forEach((function(e){r.hasOwnProperty(e.name)||(r[e.name]=[]),r[e.name].push(e)}))}function o(){this.reset("")}function s(e,t,s){if(e instanceof n){var i=e;s=t}else i=n.fromCompiled(e,t);for(var a in this.grammar=i,this.options={keepHistory:!1,lexer:i.lexer||new o},s||{})this.options[a]=s[a];this.lexer=this.options.lexer,this.lexerState=void 0;var u=new r(i,0);this.table=[u],u.wants[i.start]=[],u.predict(i.start),u.process(),this.current=0}return e.highestId=0,e.prototype.toString=function(e){function t(e){return e.literal?JSON.stringify(e.literal):e.type?"%"+e.type:e.toString()}var r=void 0===e?this.symbols.map(t).join(" "):this.symbols.slice(0,e).map(t).join(" ")+" ● "+this.symbols.slice(e).map(t).join(" ");return this.name+" → "+r},t.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},t.prototype.nextState=function(e){var r=new t(this.rule,this.dot+1,this.reference,this.wantedBy);return r.left=this,r.right=e,r.isComplete&&(r.data=r.build()),r},t.prototype.build=function(){var e=[],t=this;do{e.push(t.right.data),t=t.left}while(t.left);return e.reverse(),e},t.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,s.fail))},r.prototype.process=function(e){for(var t=this.states,r=this.wants,n=this.completed,o=0;o<t.length;o++){var i=t[o];if(i.isComplete){if(i.finish(),i.data!==s.fail){for(var a=i.wantedBy,u=a.length;u--;){var c=a[u];this.complete(c,i)}if(i.reference===this.index){var l=i.rule.name;(this.completed[l]=this.completed[l]||[]).push(i)}}}else{if("string"!=typeof(l=i.rule.symbols[i.dot])){this.scannable.push(i);continue}if(r[l]){if(r[l].push(i),n.hasOwnProperty(l)){var p=n[l];for(u=0;u<p.length;u++){var f=p[u];this.complete(i,f)}}}else r[l]=[i],this.predict(l)}}},r.prototype.predict=function(e){for(var r=this.grammar.byName[e]||[],n=0;n<r.length;n++){var o=r[n],s=this.wants[e],i=new t(o,0,this.index,s);this.states.push(i)}},r.prototype.complete=function(e,t){var r=e.nextState(t);this.states.push(r)},n.fromCompiled=function(t,r){var o=t.Lexer;t.ParserStart&&(r=t.ParserStart,t=t.ParserRules);var s=new n(t=t.map((function(t){return new e(t.name,t.symbols,t.postprocess)})),r);return s.lexer=o,s},o.prototype.reset=function(e,t){this.buffer=e,this.index=0,this.line=t?t.line:1,this.lastLineBreak=t?-t.col:0},o.prototype.next=function(){if(this.index<this.buffer.length){var e=this.buffer[this.index++];return"\n"===e&&(this.line+=1,this.lastLineBreak=this.index),{value:e}}},o.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},o.prototype.formatError=function(e,t){var r=this.buffer;if("string"==typeof r){var n=r.indexOf("\n",this.index);-1===n&&(n=r.length);var o=r.substring(this.lastLineBreak,n),s=this.index-this.lastLineBreak;return t+=" at line "+this.line+" col "+s+":\n\n",t+=" "+o+"\n",t+=" "+Array(s).join(" ")+"^"}return t+" at index "+(this.index-1)},s.fail={},s.prototype.feed=function(e){var t,n=this.lexer;for(n.reset(e,this.lexerState);t=n.next();){var s=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var i=this.current+1,a=new r(this.grammar,i);this.table.push(a);for(var u=void 0!==t.text?t.text:t.value,c=n.constructor===o?t.value:t,l=s.scannable,p=l.length;p--;){var f=l[p],h=f.rule.symbols[f.dot];if(h.test?h.test(c):h.type?h.type===t.type:h.literal===u){var d=f.nextState({data:c,token:t,isToken:!0,reference:i-1});a.states.push(d)}}if(a.process(),0===a.states.length){var g=new Error(this.reportError(t));throw g.offset=this.current,g.token=t,g}this.options.keepHistory&&(s.lexerState=n.save()),this.current++}return s&&(this.lexerState=n.save()),this.results=this.finish(),this},s.prototype.reportError=function(e){var t=[],r=(e.type?e.type+" token: ":"")+JSON.stringify(void 0!==e.value?e.value:e);t.push(this.lexer.formatError(e,"Syntax error")),t.push("Unexpected "+r+". Instead, I was expecting to see one of the following:\n");var n=this.table.length-2;return this.table[n].states.filter((function(e){var t=e.rule.symbols[e.dot];return t&&"string"!=typeof t})).map((function(e){return this.buildFirstStateStack(e,[])}),this).forEach((function(e){var r=e[0],n=r.rule.symbols[r.dot],o=this.getSymbolDisplay(n);t.push("A "+o+" based on:"),this.displayStateStack(e,t)}),this),t.push(""),t.join("\n")},s.prototype.displayStateStack=function(e,t){for(var r,n=0,o=0;o<e.length;o++){var s=e[o],i=s.rule.toString(s.dot);i===r?n++:(n>0&&t.push(" ⬆ ︎"+n+" more lines identical to this"),n=0,t.push(" "+i)),r=i}},s.prototype.getSymbolDisplay=function(e){var t=typeof e;if("string"===t)return e;if("object"===t&&e.literal)return JSON.stringify(e.literal);if("object"===t&&e instanceof RegExp)return"character matching "+e;if("object"===t&&e.type)return e.type+" token";throw new Error("Unknown symbol type: "+e)},s.prototype.buildFirstStateStack=function(e,t){if(-1!==t.indexOf(e))return null;if(0===e.wantedBy.length)return[e];var r=e.wantedBy[0],n=[e].concat(t),o=this.buildFirstStateStack(r,n);return null===o?null:[e].concat(o)},s.prototype.save=function(){var e=this.table[this.current];return e.lexerState=this.lexerState,e},s.prototype.restore=function(e){var t=e.index;this.current=t,this.table[t]=e,this.table.splice(t+1),this.lexerState=e.lexerState,this.results=this.finish()},s.prototype.rewind=function(e){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[e])},s.prototype.finish=function(){var e=[],t=this.grammar.start;return this.table[this.table.length-1].states.forEach((function(r){r.rule.name===t&&r.dot===r.rule.symbols.length&&0===r.reference&&r.data!==s.fail&&e.push(r)})),e.map((function(e){return e.data}))},{Parser:s,Grammar:n,Rule:e}},e.exports?e.exports=o():n.nearley=o()},function(e,t,r){"use strict";var n=r(2).Buffer,o=r(35).Transform;function s(e){o.call(this),this._block=n.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(1)(s,o),s.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},s.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},s.prototype.update=function(e,t){if(function(e,t){if(!n.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(e)||(e=n.from(e,t));for(var r=this._block,o=0;this._blockOffset+e.length-o>=this._blockSize;){for(var s=this._blockOffset;s<this._blockSize;)r[s++]=e[o++];this._update(),this._blockOffset=0}for(;o<e.length;)r[this._blockOffset++]=e[o++];for(var i=0,a=8*e.length;a>0;++i)this._length[i]+=a,(a=this._length[i]/4294967296|0)>0&&(this._length[i]-=4294967296*a);return this},s.prototype._update=function(){throw new Error("_update is not implemented")},s.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},s.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=s},function(e,t,r){e.exports=o;var n=r(25).EventEmitter;function o(){n.call(this)}r(1)(o,n),o.Readable=r(26),o.Writable=r(61),o.Duplex=r(62),o.Transform=r(63),o.PassThrough=r(64),o.Stream=o,o.prototype.pipe=function(e,t){var r=this;function o(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",o),e.on("drain",s),e._isStdio||t&&!1===t.end||(r.on("end",a),r.on("close",u));var i=!1;function a(){i||(i=!0,e.end())}function u(){i||(i=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){if(l(),0===n.listenerCount(this,"error"))throw e}function l(){r.removeListener("data",o),e.removeListener("drain",s),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",l),r.removeListener("close",l),e.removeListener("close",l)}return r.on("error",c),e.on("error",c),r.on("end",l),r.on("close",l),e.on("close",l),e.emit("pipe",r),e}},function(e,t,r){"use strict";(function(t,n){var o=r(18);e.exports=P;var s,i=r(32);P.ReadableState=b;r(25).EventEmitter;var a=function(e,t){return e.listeners(t).length},u=r(37),c=r(2).Buffer,l=t.Uint8Array||function(){};var p=r(15);p.inherits=r(1);var f=r(54),h=void 0;h=f&&f.debuglog?f.debuglog("stream"):function(){};var d,g=r(55),m=r(38);p.inherits(P,u);var y=["error","close","destroy","pause","resume"];function b(e,t){e=e||{};var n=t instanceof(s=s||r(12));this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var o=e.highWaterMark,i=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:n&&(i||0===i)?i:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=r(28).StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function P(e){if(s=s||r(12),!(this instanceof P))return new P(e);this._readableState=new b(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function D(e,t,r,n,o){var s,i=e._readableState;null===t?(i.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,I(e)}(e,i)):(o||(s=function(e,t){var r;n=t,c.isBuffer(n)||n instanceof l||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(i,t)),s?e.emit("error",s):i.objectMode||t&&t.length>0?("string"==typeof t||i.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n?i.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):$(e,i,t,!0):i.ended?e.emit("error",new Error("stream.push() after EOF")):(i.reading=!1,i.decoder&&!r?(t=i.decoder.write(t),i.objectMode||0!==t.length?$(e,i,t,!1):A(e,i)):$(e,i,t,!1))):n||(i.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(i)}function $(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&I(e)),A(e,t)}Object.defineProperty(P.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),P.prototype.destroy=m.destroy,P.prototype._undestroy=m.undestroy,P.prototype._destroy=function(e,t){this.push(null),t(e)},P.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=c.from(e,t),t=""),r=!0),D(this,e,t,!1,r)},P.prototype.unshift=function(e){return D(this,e,null,!0,!1)},P.prototype.isPaused=function(){return!1===this._readableState.flowing},P.prototype.setEncoding=function(e){return d||(d=r(28).StringDecoder),this._readableState.decoder=new d(e),this._readableState.encoding=e,this};function v(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function I(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(h("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?o.nextTick(_,e):_(e))}function _(e){h("emit readable"),e.emit("readable"),U(e)}function A(e,t){t.readingMore||(t.readingMore=!0,o.nextTick(R,e,t))}function R(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(h("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function S(e){h("readable nexttick read 0"),e.read(0)}function C(e,t){t.reading||(h("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(h("flow",t.flowing);t.flowing&&null!==e.read(););}function T(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,n=1,o=r.data;e-=o.length;for(;r=r.next;){var s=r.data,i=e>s.length?s.length:e;if(i===s.length?o+=s:o+=s.slice(0,e),0===(e-=i)){i===s.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(i));break}++n}return t.length-=n,o}(e,t):function(e,t){var r=c.allocUnsafe(e),n=t.head,o=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var s=n.data,i=e>s.length?s.length:e;if(s.copy(r,r.length-e,0,i),0===(e-=i)){i===s.length?(++o,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(i));break}++o}return t.length-=o,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function w(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,o.nextTick(E,t,e))}function E(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function O(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}P.prototype.read=function(e){h("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return h("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?w(this):I(this),null;if(0===(e=v(e,t))&&t.ended)return 0===t.length&&w(this),null;var n,o=t.needReadable;return h("need readable",o),(0===t.length||t.length-e<t.highWaterMark)&&h("length less than watermark",o=!0),t.ended||t.reading?h("reading or ended",o=!1):o&&(h("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=v(r,t))),null===(n=e>0?T(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&w(this)),null!==n&&this.emit("data",n),n},P.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},P.prototype.pipe=function(e,t){var r=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,h("pipe count=%d opts=%j",s.pipesCount,t);var u=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?l:P;function c(t,n){h("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,h("cleanup"),e.removeListener("close",y),e.removeListener("finish",b),e.removeListener("drain",p),e.removeListener("error",m),e.removeListener("unpipe",c),r.removeListener("end",l),r.removeListener("end",P),r.removeListener("data",g),f=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||p())}function l(){h("onend"),e.end()}s.endEmitted?o.nextTick(u):r.once("end",u),e.on("unpipe",c);var p=function(e){return function(){var t=e._readableState;h("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,U(e))}}(r);e.on("drain",p);var f=!1;var d=!1;function g(t){h("ondata"),d=!1,!1!==e.write(t)||d||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==O(s.pipes,e))&&!f&&(h("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function m(t){h("onerror",t),P(),e.removeListener("error",m),0===a(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",b),P()}function b(){h("onfinish"),e.removeListener("close",y),P()}function P(){h("unpipe"),r.unpipe(e)}return r.on("data",g),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?i(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",m),e.once("close",y),e.once("finish",b),e.emit("pipe",r),s.flowing||(h("pipe resume"),r.resume()),e},P.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<o;s++)n[s].emit("unpipe",this,r);return this}var i=O(t.pipes,e);return-1===i||(t.pipes.splice(i,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},P.prototype.on=function(e,t){var r=u.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&I(this):o.nextTick(S,this))}return r},P.prototype.addListener=P.prototype.on,P.prototype.resume=function(){var e=this._readableState;return e.flowing||(h("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,o.nextTick(C,e,t))}(this,e)),this},P.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this},P.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var o in e.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(o){(h("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o)||(r.objectMode||o&&o.length)&&(t.push(o)||(n=!0,e.pause()))})),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var s=0;s<y.length;s++)e.on(y[s],this.emit.bind(this,y[s]));return this._read=function(t){h("wrapped _read",t),n&&(n=!1,e.resume())},this},Object.defineProperty(P.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),P._fromList=T}).call(this,r(11),r(17))},function(e,t,r){e.exports=r(25).EventEmitter},function(e,t,r){"use strict";var n=r(18);function o(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,s=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return s||i?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||n.nextTick(o,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(n.nextTick(o,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,r){"use strict";e.exports=i;var n=r(12),o=r(15);function s(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function i(e){if(!(this instanceof i))return new i(e);n.call(this,e),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",a)}function a(){var e=this;"function"==typeof this._flush?this._flush((function(t,r){u(e,t,r)})):u(this,null,null)}function u(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}o.inherits=r(1),o.inherits(i,n),i.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},i.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},i.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var o=this._readableState;(n.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},i.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},i.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,(function(e){t(e),r.emit("close")}))}},function(e,t,r){var n=r(1),o=r(13),s=r(2).Buffer,i=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function u(){this.init(),this._w=a,o.call(this,64,56)}function c(e,t,r){return r^e&(t^r)}function l(e,t,r){return e&t|r&(e|t)}function p(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function f(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function h(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}n(u,o),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,o=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,d=0|this._f,g=0|this._g,m=0|this._h,y=0;y<16;++y)r[y]=e.readInt32BE(4*y);for(;y<64;++y)r[y]=0|(((t=r[y-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[y-7]+h(r[y-15])+r[y-16];for(var b=0;b<64;++b){var P=m+f(u)+c(u,d,g)+i[b]+r[b]|0,D=p(n)+l(n,o,s)|0;m=g,g=d,d=u,u=a+P|0,a=s,s=o,o=n,n=P+D|0}this._a=n+this._a|0,this._b=o+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0,this._f=d+this._f|0,this._g=g+this._g|0,this._h=m+this._h|0},u.prototype._hash=function(){var e=s.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=u},function(e,t,r){var n=r(1),o=r(13),s=r(2).Buffer,i=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function u(){this.init(),this._w=a,o.call(this,128,112)}function c(e,t,r){return r^e&(t^r)}function l(e,t,r){return e&t|r&(e|t)}function p(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function f(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function h(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function y(e,t){return e>>>0<t>>>0?1:0}n(u,o),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,o=0|this._ch,s=0|this._dh,a=0|this._eh,u=0|this._fh,b=0|this._gh,P=0|this._hh,D=0|this._al,$=0|this._bl,v=0|this._cl,I=0|this._dl,_=0|this._el,A=0|this._fl,R=0|this._gl,S=0|this._hl,C=0;C<32;C+=2)t[C]=e.readInt32BE(4*C),t[C+1]=e.readInt32BE(4*C+4);for(;C<160;C+=2){var U=t[C-30],T=t[C-30+1],w=h(U,T),E=d(T,U),O=g(U=t[C-4],T=t[C-4+1]),N=m(T,U),M=t[C-14],x=t[C-14+1],F=t[C-32],G=t[C-32+1],k=E+x|0,z=w+M+y(k,E)|0;z=(z=z+O+y(k=k+N|0,N)|0)+F+y(k=k+G|0,G)|0,t[C]=z,t[C+1]=k}for(var L=0;L<160;L+=2){z=t[L],k=t[L+1];var W=l(r,n,o),B=l(D,$,v),j=p(r,D),H=p(D,r),J=f(a,_),Q=f(_,a),q=i[L],K=i[L+1],Y=c(a,u,b),V=c(_,A,R),X=S+Q|0,Z=P+J+y(X,S)|0;Z=(Z=(Z=Z+Y+y(X=X+V|0,V)|0)+q+y(X=X+K|0,K)|0)+z+y(X=X+k|0,k)|0;var ee=H+B|0,te=j+W+y(ee,H)|0;P=b,S=R,b=u,R=A,u=a,A=_,a=s+Z+y(_=I+X|0,I)|0,s=o,I=v,o=n,v=$,n=r,$=D,r=Z+te+y(D=X+ee|0,X)|0}this._al=this._al+D|0,this._bl=this._bl+$|0,this._cl=this._cl+v|0,this._dl=this._dl+I|0,this._el=this._el+_|0,this._fl=this._fl+A|0,this._gl=this._gl+R|0,this._hl=this._hl+S|0,this._ah=this._ah+r+y(this._al,D)|0,this._bh=this._bh+n+y(this._bl,$)|0,this._ch=this._ch+o+y(this._cl,v)|0,this._dh=this._dh+s+y(this._dl,I)|0,this._eh=this._eh+a+y(this._el,_)|0,this._fh=this._fh+u+y(this._fl,A)|0,this._gh=this._gh+b+y(this._gl,R)|0,this._hh=this._hh+P+y(this._hl,S)|0},u.prototype._hash=function(){var e=s.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=u},function(e,t,r){(function(t){function r(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(e){var r;if(e instanceof Uint8Array)r=e;else if(e instanceof t)r=new Uint8Array(e);else{if("string"!=typeof e)throw new Error("Input must be an string, Buffer or Uint8Array");r=new Uint8Array(t.from(e,"utf8"))}return r},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,t,n){for(var o="\n"+e+" = ",s=0;s<t.length;s+=2){if(32===n)o+=r(t[s]).toUpperCase(),o+=" ",o+=r(t[s+1]).toUpperCase();else{if(64!==n)throw new Error("Invalid size "+n);o+=r(t[s+1]).toUpperCase(),o+=r(t[s]).toUpperCase()}s%6==4?o+="\n"+new Array(e.length+4).join(" "):s<t.length-2&&(o+=" ")}console.log(o)},testSpeed:function(e,t,r){for(var n=(new Date).getTime(),o=new Uint8Array(t),s=0;s<t;s++)o[s]=s%256;var i=(new Date).getTime();for(console.log("Generated random input in "+(i-n)+"ms"),n=i,s=0;s<r;s++){var a=e(o),u=(new Date).getTime(),c=u-n;n=u,console.log("Hashed in "+c+"ms: "+a.substring(0,20)+"..."),console.log(Math.round(t/(1<<20)/(c/1e3)*100)/100+" MB PER SECOND")}}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.ED25519=0]="ED25519",e[e.SECP256K1=1]="SECP256K1",e[e.SECP256R1=2]="SECP256R1"}(t.SignerCurve||(t.SignerCurve={})),function(e){e[e.Mnemonic=0]="Mnemonic",e[e.Fundraiser=1]="Fundraiser",e[e.Hardware=2]="Hardware"}(t.KeyStoreType||(t.KeyStoreType={})),function(e){e[e.ED25519=0]="ED25519",e[e.SECP256K1=1]="SECP256K1",e[e.SECP256R1=2]="SECP256R1"}(t.KeyStoreCurve||(t.KeyStoreCurve={}))},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=o(r(14)),i=o(r(10));s.default.setFetch(window.fetch.bind(window)),i.default.setLogger(console),n(r(45)),n(r(9)),n(r(5)),n(r(4)),n(r(7)),n(r(8)),n(r(82)),n(r(83)),n(r(84)),n(r(85)),n(r(86)),n(r(87)),n(r(88)),n(r(89)),n(r(90)),n(r(91)),n(r(92)),n(r(93)),n(r(20)),n(r(29)),n(r(94)),n(r(31)),n(r(95)),n(r(21)),n(r(19)),n(r(3)),n(r(96)),n(r(43))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=r(20),i=r(9),a=o(r(77)),u=o(r(33));!function(e){function t(e){const t=new u.Parser(u.Grammar.fromCompiled(a.default));t.feed(i.TezosLanguageUtil.normalizeMichelineWhiteSpace(i.TezosLanguageUtil.stripComments(e)));const r=t.results[0];return 1===r.length&&(r[0].name="default"),r}function r(e){return t(i.TezosLanguageUtil.preProcessMichelsonScript(e)[0])}e.generateEntryPointsFromParams=t,e.generateEntryPointsFromCode=r,e.generateEntryPointsFromAddress=function(e,t,o){return n(this,void 0,void 0,(function*(){return r((yield s.TezosConseilClient.getAccount(e,t,o)).script)}))}}(t.TezosContractIntrospector||(t.TezosContractIntrospector={}))},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),i=n[0],a=n[1],u=new s(function(e,t,r){return 3*(t+r)/4-r}(0,i,a)),l=0,p=a>0?i-4:i;for(r=0;r<p;r+=4)t=o[e.charCodeAt(r)]<<18|o[e.charCodeAt(r+1)]<<12|o[e.charCodeAt(r+2)]<<6|o[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===a&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,s=[],i=0,a=r-o;i<a;i+=16383)s.push(l(e,i,i+16383>a?a:i+16383));1===o?(t=e[r-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return s.join("")};for(var n=[],o=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=i.length;a<u;++a)n[a]=i[a],o[i.charCodeAt(a)]=a;function c(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 l(e,t,r){for(var o,s,i=[],a=t;a<r;a+=3)o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(n[(s=o)>>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return i.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,o){var s,i,a=8*o-n-1,u=(1<<a)-1,c=u>>1,l=-7,p=r?o-1:0,f=r?-1:1,h=e[t+p];for(p+=f,s=h&(1<<-l)-1,h>>=-l,l+=a;l>0;s=256*s+e[t+p],p+=f,l-=8);for(i=s&(1<<-l)-1,s>>=-l,l+=n;l>0;i=256*i+e[t+p],p+=f,l-=8);if(0===s)s=1-c;else{if(s===u)return i?NaN:1/0*(h?-1:1);i+=Math.pow(2,n),s-=c}return(h?-1:1)*i*Math.pow(2,s-n)},t.write=function(e,t,r,n,o,s){var i,a,u,c=8*s-o-1,l=(1<<c)-1,p=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,d=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=l):(i=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-i))<1&&(i--,u*=2),(t+=i+p>=1?f/u:f*Math.pow(2,1-p))*u>=2&&(i++,u/=2),i+p>=l?(a=0,i=l):i+p>=1?(a=(t*u-1)*Math.pow(2,o),i+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,o),i=0));o>=8;e[r+h]=255&a,h+=d,a/=256,o-=8);for(i=i<<o|a,c+=o;c>0;e[r+h]=255&i,h+=d,i/=256,c-=8);e[r+h-d]|=128*g}},function(e,t,r){"use strict";function n(e){return e[0]}Object.defineProperty(t,"__esModule",{value:!0});const o=r(23),s=r(24);t.DefaultMichelsonKeywords=['"parameter"','"storage"','"code"','"False"','"Elt"','"Left"','"None"','"Pair"','"Right"','"Some"','"True"','"Unit"','"PACK"','"UNPACK"','"BLAKE2B"','"SHA256"','"SHA512"','"ABS"','"ADD"','"AMOUNT"','"AND"','"BALANCE"','"CAR"','"CDR"','"CHECK_SIGNATURE"','"COMPARE"','"CONCAT"','"CONS"','"CREATE_ACCOUNT"','"CREATE_CONTRACT"','"IMPLICIT_ACCOUNT"','"DIP"','"DROP"','"DUP"','"EDIV"','"EMPTY_MAP"','"EMPTY_SET"','"EQ"','"EXEC"','"FAILWITH"','"GE"','"GET"','"GT"','"HASH_KEY"','"IF"','"IF_CONS"','"IF_LEFT"','"IF_NONE"','"INT"','"LAMBDA"','"LE"','"LEFT"','"LOOP"','"LSL"','"LSR"','"LT"','"MAP"','"MEM"','"MUL"','"NEG"','"NEQ"','"NIL"','"NONE"','"NOT"','"NOW"','"OR"','"PAIR"','"PUSH"','"RIGHT"','"SIZE"','"SOME"','"SOURCE"','"SENDER"','"SELF"','"STEPS_TO_QUOTA"','"SUB"','"SWAP"','"TRANSFER_TOKENS"','"SET_DELEGATE"','"UNIT"','"UPDATE"','"XOR"','"ITER"','"LOOP_LEFT"','"ADDRESS"','"CONTRACT"','"ISNAT"','"CAST"','"RENAME"','"bool"','"contract"','"int"','"key"','"key_hash"','"lambda"','"list"','"map"','"big_map"','"nat"','"option"','"or"','"pair"','"set"','"signature"','"string"','"bytes"','"mutez"','"timestamp"','"unit"','"operation"','"address"','"SLICE"','"DIG"','"DUG"','"EMPTY_BIG_MAP"','"APPLY"','"chain_id"','"CHAIN_ID"'];let i=[...t.DefaultMichelsonKeywords];t.setKeywordList=e=>{i=e},t.getCodeForKeyword=e=>i.indexOf(e),t.getKeywordForCode=e=>i[e];const a=o.compile({lbrace:"{",rbrace:"}",lbracket:"[",rbracket:"]",colon:":",comma:",",_:/[ \t]+/,quotedValue:/"(?:\\["\\]|[^\n"\\])*"/s}),u=e=>("00"+t.getCodeForKeyword(e).toString(16)).slice(-2),c=e=>("0000000"+e.toString(16)).slice(-8),l=e=>{if(0===e)return"00";const t=s(e).abs(),r=t.bitLength().toJSNumber();let n=[],o=t;for(let t=0;t<r;t+=7){let i=s.zero;0===t?(i=o.and(63),o=o.shiftRight(6)):(i=o.and(127),o=o.shiftRight(7)),e<0&&0===t&&(i=i.or(64)),t+7<r&&(i=i.or(128)),n.push(i.toJSNumber())}return r%7==0&&(n[n.length-1]=128|n[n.length-1],n.push(1)),n.map(e=>("0"+e.toString(16)).slice(-2)).join("")},p={Lexer:a,ParserRules:[{name:"main",symbols:["staticObject"],postprocess:n},{name:"main",symbols:["primBare"],postprocess:n},{name:"main",symbols:["primArg"],postprocess:n},{name:"main",symbols:["primAnn"],postprocess:n},{name:"main",symbols:["primArgAnn"],postprocess:n},{name:"main",symbols:["anyArray"],postprocess:n},{name:"staticInt$ebnf$1",symbols:[]},{name:"staticInt$ebnf$1",symbols:["staticInt$ebnf$1",a.has("_")?{type:"_"}:_],postprocess:e=>e[0].concat([e[1]])},{name:"staticInt",symbols:[a.has("lbrace")?{type:"lbrace"}:lbrace,a.has("_")?{type:"_"}:_,{literal:'"int"'},"staticInt$ebnf$1",a.has("colon")?{type:"colon"}:colon,a.has("_")?{type:"_"}:_,a.has("quotedValue")?{type:"quotedValue"}:quotedValue,a.has("_")?{type:"_"}:_,a.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>{const t=e[6].toString();return"00"+l(parseInt(t.substring(1,t.length-1)))}},{name:"staticString$ebnf$1",symbols:[]},{name:"staticString$ebnf$1",symbols:["staticString$ebnf$1",a.has("_")?{type:"_"}:_],postprocess:e=>e[0].concat([e[1]])},{name:"staticString",symbols:[a.has("lbrace")?{type:"lbrace"}:lbrace,a.has("_")?{type:"_"}:_,{literal:'"string"'},"staticString$ebnf$1",a.has("colon")?{type:"colon"}:colon,a.has("_")?{type:"_"}:_,a.has("quotedValue")?{type:"quotedValue"}:quotedValue,a.has("_")?{type:"_"}:_,a.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>{let t=e[6].toString();t=t.substring(1,t.length-1),t=t.replace(/\\"/g,'"');const r=c(t.length);return t=t.split("").map(e=>e.charCodeAt(0).toString(16)).join(""),"01"+r+t}},{name:"staticBytes$ebnf$1",symbols:[]},{name:"staticBytes$ebnf$1",symbols:["staticBytes$ebnf$1",a.has("_")?{type:"_"}:_],postprocess:e=>e[0].concat([e[1]])},{name:"staticBytes",symbols:[a.has("lbrace")?{type:"lbrace"}:lbrace,a.has("_")?{type:"_"}:_,{literal:'"bytes"'},"staticBytes$ebnf$1",a.has("colon")?{type:"colon"}:colon,a.has("_")?{type:"_"}:_,a.has("quotedValue")?{type:"quotedValue"}:quotedValue,a.has("_")?{type:"_"}:_,a.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>{let t=e[6].toString();t=t.substring(1,t.length-1);return"0a"+c(t.length/2)+t}},{name:"staticObject",symbols:["staticInt"],postprocess:n},{name:"staticObject",symbols:["staticString"],postprocess:n},{name:"staticObject",symbols:["staticBytes"],postprocess:n},{name:"primBare$ebnf$1",symbols:[]},{name:"primBare$ebnf$1",symbols:["primBare$ebnf$1",a.has("_")?{type:"_"}:_],postprocess:e=>e[0].concat([e[1]])},{name:"primBare",symbols:[a.has("lbrace")?{type:"lbrace"}:lbrace,a.has("_")?{type:"_"}:_,{literal:'"prim"'},"primBare$ebnf$1",a.has("colon")?{type:"colon"}:colon,a.has("_")?{type:"_"}:_,a.has("quotedValue")?{type:"quotedValue"}:quotedValue,a.has("_")?{type:"_"}:_,a.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>"03"+u(e[6].toString())},{name:"primArg$ebnf$1",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primArg$ebnf$1",symbols:[],postprocess:()=>null},{name:"primArg$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primArg$ebnf$2",symbols:[],postprocess:()=>null},{name:"primArg$ebnf$3$subexpression$1$ebnf$1",symbols:[a.has("comma")?{type:"comma"}:comma],postprocess:n},{name:"primArg$ebnf$3$subexpression$1$ebnf$1",symbols:[],postprocess:()=>null},{name:"primArg$ebnf$3$subexpression$1$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primArg$ebnf$3$subexpression$1$ebnf$2",symbols:[],postprocess:()=>null},{name:"primArg$ebnf$3$subexpression$1",symbols:["any","primArg$ebnf$3$subexpression$1$ebnf$1","primArg$ebnf$3$subexpression$1$ebnf$2"]},{name:"primArg$ebnf$3",symbols:["primArg$ebnf$3$subexpression$1"]},{name:"primArg$ebnf$3$subexpression$2$ebnf$1",symbols:[a.has("comma")?{type:"comma"}:comma],postprocess:n},{name:"primArg$ebnf$3$subexpression$2$ebnf$1",symbols:[],postprocess:()=>null},{name:"primArg$ebnf$3$subexpression$2$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primArg$ebnf$3$subexpression$2$ebnf$2",symbols:[],postprocess:()=>null},{name:"primArg$ebnf$3$subexpression$2",symbols:["any","primArg$ebnf$3$subexpression$2$ebnf$1","primArg$ebnf$3$subexpression$2$ebnf$2"]},{name:"primArg$ebnf$3",symbols:["primArg$ebnf$3","primArg$ebnf$3$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"primArg",symbols:[a.has("lbrace")?{type:"lbrace"}:lbrace,a.has("_")?{type:"_"}:_,{literal:'"prim"'},"primArg$ebnf$1",a.has("colon")?{type:"colon"}:colon,a.has("_")?{type:"_"}:_,a.has("quotedValue")?{type:"quotedValue"}:quotedValue,a.has("comma")?{type:"comma"}:comma,a.has("_")?{type:"_"}:_,{literal:'"args"'},"primArg$ebnf$2",a.has("colon")?{type:"colon"}:colon,a.has("_")?{type:"_"}:_,a.has("lbracket")?{type:"lbracket"}:lbracket,a.has("_")?{type:"_"}:_,"primArg$ebnf$3",a.has("_")?{type:"_"}:_,a.has("rbracket")?{type:"rbracket"}:rbracket,a.has("_")?{type:"_"}:_,a.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>{let t="05";2==e[15].length?t="07":e[15].length>2&&(t="09");const r=u(e[6].toString());let n=e[15].map(e=>e[0]).join("");return"09"===t&&(n=("0000000"+(n.length/2).toString(16)).slice(-8)+n,n+="00000000"),t+r+n}},{name:"primAnn$ebnf$1",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primAnn$ebnf$1",symbols:[],postprocess:()=>null},{name:"primAnn$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primAnn$ebnf$2",symbols:[],postprocess:()=>null},{name:"primAnn$ebnf$3$subexpression$1$ebnf$1",symbols:[a.has("comma")?{type:"comma"}:comma],postprocess:n},{name:"primAnn$ebnf$3$subexpression$1$ebnf$1",symbols:[],postprocess:()=>null},{name:"primAnn$ebnf$3$subexpression$1$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primAnn$ebnf$3$subexpression$1$ebnf$2",symbols:[],postprocess:()=>null},{name:"primAnn$ebnf$3$subexpression$1",symbols:[a.has("quotedValue")?{type:"quotedValue"}:quotedValue,"primAnn$ebnf$3$subexpression$1$ebnf$1","primAnn$ebnf$3$subexpression$1$ebnf$2"]},{name:"primAnn$ebnf$3",symbols:["primAnn$ebnf$3$subexpression$1"]},{name:"primAnn$ebnf$3$subexpression$2$ebnf$1",symbols:[a.has("comma")?{type:"comma"}:comma],postprocess:n},{name:"primAnn$ebnf$3$subexpression$2$ebnf$1",symbols:[],postprocess:()=>null},{name:"primAnn$ebnf$3$subexpression$2$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primAnn$ebnf$3$subexpression$2$ebnf$2",symbols:[],postprocess:()=>null},{name:"primAnn$ebnf$3$subexpression$2",symbols:[a.has("quotedValue")?{type:"quotedValue"}:quotedValue,"primAnn$ebnf$3$subexpression$2$ebnf$1","primAnn$ebnf$3$subexpression$2$ebnf$2"]},{name:"primAnn$ebnf$3",symbols:["primAnn$ebnf$3","primAnn$ebnf$3$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"primAnn",symbols:[a.has("lbrace")?{type:"lbrace"}:lbrace,a.has("_")?{type:"_"}:_,{literal:'"prim"'},"primAnn$ebnf$1",a.has("colon")?{type:"colon"}:colon,a.has("_")?{type:"_"}:_,a.has("quotedValue")?{type:"quotedValue"}:quotedValue,a.has("comma")?{type:"comma"}:comma,a.has("_")?{type:"_"}:_,{literal:'"annots"'},"primAnn$ebnf$2",a.has("colon")?{type:"colon"}:colon,a.has("_")?{type:"_"}:_,a.has("lbracket")?{type:"lbracket"}:lbracket,a.has("_")?{type:"_"}:_,"primAnn$ebnf$3",a.has("_")?{type:"_"}:_,a.has("rbracket")?{type:"rbracket"}:rbracket,a.has("_")?{type:"_"}:_,a.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>{const t=u(e[6].toString());let r=e[15].map(e=>{let t=e[0].toString();return t=t.substring(1,t.length-1),t}).join(" ");return r=r.split("").map(e=>e.charCodeAt(0).toString(16)).join(""),r=c(r.length/2)+r,"04"+t+r}},{name:"primArgAnn$ebnf$1",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primArgAnn$ebnf$1",symbols:[],postprocess:()=>null},{name:"primArgAnn$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primArgAnn$ebnf$2",symbols:[],postprocess:()=>null},{name:"primArgAnn$ebnf$3$subexpression$1$ebnf$1",symbols:[a.has("comma")?{type:"comma"}:comma],postprocess:n},{name:"primArgAnn$ebnf$3$subexpression$1$ebnf$1",symbols:[],postprocess:()=>null},{name:"primArgAnn$ebnf$3$subexpression$1$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primArgAnn$ebnf$3$subexpression$1$ebnf$2",symbols:[],postprocess:()=>null},{name:"primArgAnn$ebnf$3$subexpression$1",symbols:["any","primArgAnn$ebnf$3$subexpression$1$ebnf$1","primArgAnn$ebnf$3$subexpression$1$ebnf$2"]},{name:"primArgAnn$ebnf$3",symbols:["primArgAnn$ebnf$3$subexpression$1"]},{name:"primArgAnn$ebnf$3$subexpression$2$ebnf$1",symbols:[a.has("comma")?{type:"comma"}:comma],postprocess:n},{name:"primArgAnn$ebnf$3$subexpression$2$ebnf$1",symbols:[],postprocess:()=>null},{name:"primArgAnn$ebnf$3$subexpression$2$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primArgAnn$ebnf$3$subexpression$2$ebnf$2",symbols:[],postprocess:()=>null},{name:"primArgAnn$ebnf$3$subexpression$2",symbols:["any","primArgAnn$ebnf$3$subexpression$2$ebnf$1","primArgAnn$ebnf$3$subexpression$2$ebnf$2"]},{name:"primArgAnn$ebnf$3",symbols:["primArgAnn$ebnf$3","primArgAnn$ebnf$3$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"primArgAnn$ebnf$4",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primArgAnn$ebnf$4",symbols:[],postprocess:()=>null},{name:"primArgAnn$ebnf$5$subexpression$1$ebnf$1",symbols:[a.has("comma")?{type:"comma"}:comma],postprocess:n},{name:"primArgAnn$ebnf$5$subexpression$1$ebnf$1",symbols:[],postprocess:()=>null},{name:"primArgAnn$ebnf$5$subexpression$1$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primArgAnn$ebnf$5$subexpression$1$ebnf$2",symbols:[],postprocess:()=>null},{name:"primArgAnn$ebnf$5$subexpression$1",symbols:[a.has("quotedValue")?{type:"quotedValue"}:quotedValue,"primArgAnn$ebnf$5$subexpression$1$ebnf$1","primArgAnn$ebnf$5$subexpression$1$ebnf$2"]},{name:"primArgAnn$ebnf$5",symbols:["primArgAnn$ebnf$5$subexpression$1"]},{name:"primArgAnn$ebnf$5$subexpression$2$ebnf$1",symbols:[a.has("comma")?{type:"comma"}:comma],postprocess:n},{name:"primArgAnn$ebnf$5$subexpression$2$ebnf$1",symbols:[],postprocess:()=>null},{name:"primArgAnn$ebnf$5$subexpression$2$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"primArgAnn$ebnf$5$subexpression$2$ebnf$2",symbols:[],postprocess:()=>null},{name:"primArgAnn$ebnf$5$subexpression$2",symbols:[a.has("quotedValue")?{type:"quotedValue"}:quotedValue,"primArgAnn$ebnf$5$subexpression$2$ebnf$1","primArgAnn$ebnf$5$subexpression$2$ebnf$2"]},{name:"primArgAnn$ebnf$5",symbols:["primArgAnn$ebnf$5","primArgAnn$ebnf$5$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"primArgAnn",symbols:[a.has("lbrace")?{type:"lbrace"}:lbrace,a.has("_")?{type:"_"}:_,{literal:'"prim"'},"primArgAnn$ebnf$1",a.has("colon")?{type:"colon"}:colon,a.has("_")?{type:"_"}:_,a.has("quotedValue")?{type:"quotedValue"}:quotedValue,a.has("comma")?{type:"comma"}:comma,a.has("_")?{type:"_"}:_,{literal:'"args"'},"primArgAnn$ebnf$2",a.has("colon")?{type:"colon"}:colon,a.has("_")?{type:"_"}:_,a.has("lbracket")?{type:"lbracket"}:lbracket,a.has("_")?{type:"_"}:_,"primArgAnn$ebnf$3",a.has("_")?{type:"_"}:_,a.has("rbracket")?{type:"rbracket"}:rbracket,a.has("comma")?{type:"comma"}:comma,a.has("_")?{type:"_"}:_,{literal:'"annots"'},"primArgAnn$ebnf$4",a.has("colon")?{type:"colon"}:colon,a.has("_")?{type:"_"}:_,a.has("lbracket")?{type:"lbracket"}:lbracket,a.has("_")?{type:"_"}:_,"primArgAnn$ebnf$5",a.has("_")?{type:"_"}:_,a.has("rbracket")?{type:"rbracket"}:rbracket,a.has("_")?{type:"_"}:_,a.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>{let t="06";2==e[15].length?t="08":e[15].length>2&&(t="09");const r=u(e[6].toString());let n=e[15].map(e=>e[0]).join(""),o=e[26].map(e=>{let t=e[0].toString();return t=t.substring(1,t.length-1),t}).join(" ");return o=o.split("").map(e=>e.charCodeAt(0).toString(16)).join(""),o=c(o.length/2)+o,"09"===t&&(n=("0000000"+(n.length/2).toString(16)).slice(-8)+n),t+r+n+o}},{name:"primAny",symbols:["primBare"],postprocess:n},{name:"primAny",symbols:["primArg"],postprocess:n},{name:"primAny",symbols:["primAnn"],postprocess:n},{name:"primAny",symbols:["primArgAnn"],postprocess:n},{name:"any",symbols:["primAny"],postprocess:n},{name:"any",symbols:["staticObject"],postprocess:n},{name:"any",symbols:["anyArray"],postprocess:n},{name:"anyArray",symbols:[a.has("lbracket")?{type:"lbracket"}:lbracket,a.has("rbracket")?{type:"rbracket"}:rbracket],postprocess:function(e){return"0200000000"}},{name:"anyArray$ebnf$1$subexpression$1$ebnf$1",symbols:[a.has("comma")?{type:"comma"}:comma],postprocess:n},{name:"anyArray$ebnf$1$subexpression$1$ebnf$1",symbols:[],postprocess:()=>null},{name:"anyArray$ebnf$1$subexpression$1$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"anyArray$ebnf$1$subexpression$1$ebnf$2",symbols:[],postprocess:()=>null},{name:"anyArray$ebnf$1$subexpression$1",symbols:["any","anyArray$ebnf$1$subexpression$1$ebnf$1","anyArray$ebnf$1$subexpression$1$ebnf$2"]},{name:"anyArray$ebnf$1",symbols:["anyArray$ebnf$1$subexpression$1"]},{name:"anyArray$ebnf$1$subexpression$2$ebnf$1",symbols:[a.has("comma")?{type:"comma"}:comma],postprocess:n},{name:"anyArray$ebnf$1$subexpression$2$ebnf$1",symbols:[],postprocess:()=>null},{name:"anyArray$ebnf$1$subexpression$2$ebnf$2",symbols:[a.has("_")?{type:"_"}:_],postprocess:n},{name:"anyArray$ebnf$1$subexpression$2$ebnf$2",symbols:[],postprocess:()=>null},{name:"anyArray$ebnf$1$subexpression$2",symbols:["any","anyArray$ebnf$1$subexpression$2$ebnf$1","anyArray$ebnf$1$subexpression$2$ebnf$2"]},{name:"anyArray$ebnf$1",symbols:["anyArray$ebnf$1","anyArray$ebnf$1$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"anyArray",symbols:[a.has("lbracket")?{type:"lbracket"}:lbracket,a.has("_")?{type:"_"}:_,"anyArray$ebnf$1",a.has("_")?{type:"_"}:_,a.has("rbracket")?{type:"rbracket"}:rbracket],postprocess:e=>{const t=e[2].map(e=>e[0]).join("");return"02"+c(t.length/2)+t}}],ParserStart:"main"};t.default=p},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";function n(e){return e[0]}Object.defineProperty(t,"__esModule",{value:!0});const o=r(23),s=/SET_C[AD]+R/,i=/DII+P/,a=/DUU+P/,u=new RegExp(i),c=new RegExp(a),l=["ASSERT","ASSERT_EQ","ASSERT_NEQ","ASSERT_GT","ASSERT_LT","ASSERT_GE","ASSERT_LE","ASSERT_NONE","ASSERT_SOME","ASSERT_LEFT","ASSERT_RIGHT","ASSERT_CMPEQ","ASSERT_CMPNEQ","ASSERT_CMPGT","ASSERT_CMPLT","ASSERT_CMPGE","ASSERT_CMPLE"],p=["IFCMPEQ","IFCMPNEQ","IFCMPLT","IFCMPGT","IFCMPLE","IFCMPGE"],f=["CMPEQ","CMPNEQ","CMPLT","CMPGT","CMPLE","CMPGE"],h=["IFEQ","IFNEQ","IFLT","IFGT","IFLE","IFGE"],d=o.compile({annot:/[\@\%\:][a-z_A-Z0-9]+/,lparen:"(",rparen:")",lbrace:"{",rbrace:"}",ws:/[ \t]+/,semicolon:";",bytes:/0x[0-9a-fA-F]+/,number:/-?[0-9]+(?!x)/,parameter:["parameter","Parameter"],storage:["Storage","storage"],code:["Code","code"],comparableType:["int","nat","string","bytes","mutez","bool","key_hash","timestamp","chain_id"],constantType:["key","unit","signature","operation","address"],singleArgType:["option","list","set","contract"],doubleArgType:["pair","or","lambda","map","big_map"],baseInstruction:["ABS","ADD","ADDRESS","AMOUNT","AND","BALANCE","BLAKE2B","CAR","CAST","CDR","CHECK_SIGNATURE","COMPARE","CONCAT","CONS","CONTRACT","DIP","EDIV","EMPTY_SET","EQ","EXEC","FAIL","FAILWITH","GE","GET","GT","HASH_KEY","IF","IF_CONS","IF_LEFT","IF_NONE","IF_RIGHT","IMPLICIT_ACCOUNT","INT","ISNAT","ITER","LAMBDA","LE","LEFT","LOOP","LOOP_LEFT","LSL","LSR","LT","MAP","MEM","MUL","NEG","NEQ","NIL","NONE","NOT","NOW","OR","PACK","PAIR","REDUCE","RENAME","RIGHT","SELF","SENDER","SET_DELEGATE","SHA256","SHA512","SIZE","SLICE","SOME","SOURCE","STEPS_TO_QUOTA","SUB","SWAP","TRANSFER_TOKENS","UNIT","UNPACK","UPDATE","XOR","UNPAIR","UNPAPAIR","IF_SOME","IFCMPEQ","IFCMPNEQ","IFCMPLT","IFCMPGT","IFCMPLE","IFCMPGE","CMPEQ","CMPNEQ","CMPLT","CMPGT","CMPLE","CMPGE","IFEQ","NEQ","IFLT","IFGT","IFLE","IFGE","EMPTY_BIG_MAP","APPLY","CHAIN_ID"],macroCADR:/C[AD]+R/,macroDIP:i,macroDUP:a,macroSETCADR:s,macroASSERTlist:l,constantData:["Unit","True","False","None","instruction"],singleArgData:["Left","Right","Some"],doubleArgData:["Pair"],elt:"Elt",word:/[a-zA-Z_0-9]+/,string:/"(?:\\["\\]|[^\n"\\])*"/s}),g=e=>new RegExp("^C(A|D)(A|D)+R$").test(e),m=e=>f.includes(e),y=e=>c.test(e),b=e=>l.includes(e),P=e=>"FAIL"===e,D=e=>p.includes(e)||h.includes(e)||"IF_SOME"===e,$=(e,t,r,n)=>{const o=n?`, "annots": [${n}]`:"";switch(e){case"IFCMPEQ":return`[{"prim":"COMPARE"},{"prim":"EQ"},{"prim":"IF","args":[ [${t}] , [${r}]]${o}}]`;case"IFCMPGE":return`[{"prim":"COMPARE"},{"prim":"GE"},{"prim":"IF","args":[ [${t}] , [${r}]]${o}}]`;case"IFCMPGT":return`[{"prim":"COMPARE"},{"prim":"GT"},{"prim":"IF","args":[ [${t}] , [${r}]]${o}}]`;case"IFCMPLE":return`[{"prim":"COMPARE"},{"prim":"LE"},{"prim":"IF","args":[ [${t}] , [${r}]]${o}}]`;case"IFCMPLT":return`[{"prim":"COMPARE"},{"prim":"LT"},{"prim":"IF","args":[ [${t}] , [${r}]]${o}}]`;case"IFCMPNEQ":return`[{"prim":"COMPARE"},{"prim":"NEQ"},{"prim":"IF","args":[ [${t}] , [${r}]]${o}}]`;case"IFEQ":return`[{"prim":"EQ"},{"prim":"IF","args":[ [${t}] , [${r}]]${o}}]`;case"IFGE":return`[{"prim":"GE"},{"prim":"IF","args":[ [${t}] , [${r}]]${o}}]`;case"IFGT":return`[{"prim":"GT"},{"prim":"IF","args":[ [${t}] , [${r}]]${o}}]`;case"IFLE":return`[{"prim":"LE"},{"prim":"IF","args":[ [${t}] , [${r}]]${o}}]`;case"IFLT":return`[{"prim":"LT"},{"prim":"IF","args":[ [${t}] , [${r}]]${o}}]`;case"IFNEQ":return`[{"prim":"NEQ"},{"prim":"IF","args":[ [${t}] , [${r}]]${o}}]`;case"IF_SOME":return`[{"prim":"IF_NONE","args":[ [${r}], [${t}]]${o}}]`;default:throw new Error("Could not process "+e)}},v=e=>u.test(e),I=(e,t,r)=>{let n="";if(u.test(e)){const o=e.length-2;for(let e=0;e<o;e++)n+='[{ "prim": "DIP", "args": [ ';n=`${n} [ ${t} ] ]`,r&&(n=`${n}, "annots": [${r}]`),n+=" }]";for(let e=0;e<o-1;e++)n+=" ] }]";return n}throw new Error("Unexpected parameter for DIP processing: "+e)},_=e=>"UNPAIR"==e||"UNPAPAIR"==e,A=e=>s.test(e),R=e=>{if(0===e.length)return"";const t=e.charAt(0);if(1===e.length){if("A"===t)return'[{"prim": "CDR","annots":["@%%"]}, {"prim": "SWAP"}, {"prim": "PAIR","annots":["%","%@"]}]';if("D"===t)return'[{"prim": "CAR","annots":["@%%"]}, {"prim": "PAIR","annots":["%@","%"]}]'}return"A"===t?`[{"prim": "DUP"}, {"prim": "DIP", "args": [[{"prim": "CAR","annots":["@%%"]}, ${R(e.slice(1))}]]}, {"prim": "CDR","annots":["@%%"]}, {"prim": "SWAP"}, {"prim": "PAIR","annots":["%@","%@"]}]`:"D"===t?`[{"prim": "DUP"}, {"prim": "DIP", "args": [[{"prim": "CDR","annots":["@%%"]}, ${R(e.slice(1))}]]}, {"prim": "CAR","annots":["@%%"]}, {"prim": "PAIR","annots":["%@","%@"]}]`:void 0},S=e=>!!b(e)||(!!m(e)||(!!v(e)||(!!y(e)||(!!P(e)||(!!D(e)||(!!g(e)||(!!_(e)||(!!A(e)||void 0)))))))),C=(e,t)=>g(e)?((e,t)=>{var r=e.slice(1,-1).split("").map(e=>"A"===e?'{ "prim": "CAR" }':'{ "prim": "CDR" }');if(null!=t){const n=e.slice(-2,-1);"A"===n?r[r.length-1]=`{ "prim": "CAR", "annots": [${t}] }`:"D"===n&&(r[r.length-1]=`{ "prim": "CDR", "annots": [${t}] }`)}return`[${r.join(", ")}]`})(e,t):b(e)?((e,t)=>{const r=t?`, "annots": [${t}]`:"";switch(e){case"ASSERT":return`[{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]}]`;case"ASSERT_CMPEQ":return`[[{"prim":"COMPARE"},{"prim":"EQ"}],{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]}]`;case"ASSERT_CMPGE":return`[[{"prim":"COMPARE"},{"prim":"GE"}],{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]}]`;case"ASSERT_CMPGT":return`[[{"prim":"COMPARE"},{"prim":"GT"}],{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]}]`;case"ASSERT_CMPLE":return`[[{"prim":"COMPARE"},{"prim":"LE"}],{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]}]`;case"ASSERT_CMPLT":return`[[{"prim":"COMPARE"},{"prim":"LT"}],{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]}]`;case"ASSERT_CMPNEQ":return`[[{"prim":"COMPARE"},{"prim":"NEQ"}],{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]}]`;case"ASSERT_EQ":return`[{"prim":"EQ"},{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]]`;case"ASSERT_GE":return`[{"prim":"GE"},{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]}]`;case"ASSERT_GT":return`[{"prim":"GT"},{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]}]`;case"ASSERT_LE":return`[{"prim":"LE"},{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]}]`;case"ASSERT_LT":return`[{"prim":"LT"},{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]}]`;case"ASSERT_NEQ":return`[{"prim":"NEQ"},{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${r}}]]]}]`;case"ASSERT_NONE":return'[{"prim":"IF_NONE","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"}]]]}]';case"ASSERT_SOME":return'[{"prim":"IF_NONE","args":[[[{"prim":"UNIT"},{"prim":"FAILWITH"}]],[]]}]';case"ASSERT_LEFT":case"ASSERT_RIGHT":return"";default:throw new Error("Could not process "+e)}})(e,t):m(e)?((e,t)=>{var r=e.substring(3),n=w([""+r]);return null!=t&&(n=`{ "prim": "${r}", "annots": [${t}] }`),`[${w(["COMPARE"])}, ${n}]`})(e,t):v(e)?I(e,t):y(e)?((e,t)=>{let r="";if(c.test(e)){const n=e.length-3;for(let e=0;e<n;e++)r+='[{ "prim": "DIP", "args": [ ';r+=null==t?'[{ "prim": "DUP" }]':`[{ "prim": "DUP", "annots": [${t}] }]`;for(let e=0;e<n;e++)r+=' ] },{"prim":"SWAP"}]';return r}throw new Error("")})(e,t):P(e)?((e,t)=>null==t?'[ { "prim": "UNIT" }, { "prim": "FAILWITH" } ]':`[ { "prim": "UNIT" }, { "prim": "FAILWITH", "annots": [${t}] } ]`)(0,t):D(e)?$(e,t):_(e)?((e,t)=>"UNPAIR"==e?null==t?'[ [ { "prim": "DUP" }, { "prim": "CAR" }, { "prim": "DIP", "args": [ [ { "prim": "CDR" } ] ] } ] ]':1==t.length?`[ [ { "prim": "DUP" }, { "prim": "CAR", "annots": [${t}] }, { "prim": "DIP", "args": [ [ { "prim": "CDR" } ] ] } ] ]`:2==t.length?`[ [ { "prim": "DUP" }, { "prim": "CAR", "annots": [${t[0]}] }, { "prim": "DIP", "args": [ [ { "prim": "CDR", "annots": [${t[1]}] } ] ] } ] ]`:"":"UNPAPAIR"==e?null==t?'[ [ { "prim": "DUP" },\n { "prim": "CAR" },\n { "prim": "DIP", "args": [ [ { "prim": "CDR" } ] ] } ],\n {"prim":"DIP","args":[[[{"prim":"DUP"},{"prim":"CAR"},{"prim":"DIP","args":[[{"prim":"CDR"}]]}]]]}]':`[ [ { "prim": "DUP" },\n { "prim": "CAR" },\n { "prim": "DIP", "args": [ [ { "prim": "CDR" } ] ] } ],\n {"prim":"DIP","args":[[[{"prim":"DUP"},{"prim":"CAR"},{"prim":"DIP","args":[[{"prim":"CDR"}]],"annots": [${t}]}]]]}]`:void 0)(e,t):A(e)?((e,t)=>R(e.slice(5,-1)))(e):void 0,U=e=>`{ "int": "${parseInt(e[0])}" }`,T=e=>`{ "string": ${e[0]} }`,w=e=>{const t=e[0].toString();if(1==e.length)return S(t)?C(t,null):`{ "prim": "${e[0]}" }`;{const r=e[1].map(e=>`"${e[1]}"`);return S(t)?[C(t,r)]:`{ "prim": "${e[0]}", "annots": [${r}] }`}},E=e=>`{ "prim": "${e[0]}", "args": [ ${e[2]} ] }`,O=e=>{const t=e[3].map(e=>`"${e[1]}"`);return`{ "prim": "${e[2]}", "annots": [${t}] }`},N=e=>{const t=""+e[0].toString(),r=e[1].map(e=>`"${e[1]}"`);return v(t)?I(t,e[2],r):`{ "prim": "${e[0]}", "args": [ ${e[3]} ], "annots": [${r}] }`},M=e=>`{ "prim": "${e[2]}", "args": [ ${e[4+(7===e.length?0:2)]} ] }`,x=e=>`{ "prim": "${e[0]}", "args": [ ${e[2]}, ${e[4]} ] }`,F=e=>`{ "prim": "${e[2]}", "args": [ ${e[4]}, ${e[6]} ] }`,G=e=>Array.isArray(e)&&Array.isArray(e[0])?e[0]:e,k=e=>""+e[2].map(e=>e[0]).map(e=>G(e)),z=e=>`[ ${e[2].map(e=>e[0]).map(e=>G(e))} ]`,L=e=>{const t=e[1].map(e=>`"${e[1]}"`);return`{ "prim": "${e[0]}", "args": [ ${e[4]}, ${e[6]} ], "annots": [${t}] }`},W=e=>`{ "prim": "${e[0]}", "args": [ { "int": "${e[2]}" } ] }`,B={Lexer:d,ParserRules:[{name:"main",symbols:["instruction"],postprocess:n},{name:"main",symbols:["data"],postprocess:n},{name:"main",symbols:["type"],postprocess:n},{name:"main",symbols:["parameter"],postprocess:n},{name:"main",symbols:["storage"],postprocess:n},{name:"main",symbols:["code"],postprocess:n},{name:"main",symbols:["script"],postprocess:n},{name:"main",symbols:["parameterValue"],postprocess:n},{name:"main",symbols:["storageValue"],postprocess:n},{name:"main",symbols:["typeData"],postprocess:n},{name:"script",symbols:["parameter","_","storage","_","code"],postprocess:e=>`[ ${e[0]}, ${e[2]}, { "prim": "code", "args": [ [ ${e[4]} ] ] } ]`},{name:"parameterValue",symbols:[d.has("parameter")?{type:"parameter"}:parameter,"_","typeData","_","semicolons"],postprocess:E},{name:"storageValue",symbols:[d.has("storage")?{type:"storage"}:storage,"_","typeData","_","semicolons"],postprocess:E},{name:"parameter",symbols:[d.has("parameter")?{type:"parameter"}:parameter,"_","type","_","semicolons"],postprocess:E},{name:"storage",symbols:[d.has("storage")?{type:"storage"}:storage,"_","type","_","semicolons"],postprocess:E},{name:"code",symbols:[d.has("code")?{type:"code"}:code,"_","subInstruction","_","semicolons","_"],postprocess:e=>e[2]},{name:"code",symbols:[d.has("code")?{type:"code"}:code,"_",{literal:"{};"}],postprocess:e=>"code {}"},{name:"type",symbols:[d.has("comparableType")?{type:"comparableType"}:comparableType],postprocess:w},{name:"type",symbols:[d.has("constantType")?{type:"constantType"}:constantType],postprocess:w},{name:"type",symbols:[d.has("singleArgType")?{type:"singleArgType"}:singleArgType,"_","type"],postprocess:E},{name:"type",symbols:[d.has("lparen")?{type:"lparen"}:lparen,"_",d.has("singleArgType")?{type:"singleArgType"}:singleArgType,"_","type","_",d.has("rparen")?{type:"rparen"}:rparen],postprocess:M},{name:"type",symbols:[d.has("lparen")?{type:"lparen"}:lparen,"_",d.has("singleArgType")?{type:"singleArgType"}:singleArgType,"_",d.has("lparen")?{type:"lparen"}:lparen,"_","type","_",d.has("rparen")?{type:"rparen"}:rparen,"_",d.has("rparen")?{type:"rparen"}:rparen],postprocess:M},{name:"type",symbols:[d.has("doubleArgType")?{type:"doubleArgType"}:doubleArgType,"_","type","_","type"],postprocess:x},{name:"type",symbols:[d.has("lparen")?{type:"lparen"}:lparen,"_",d.has("doubleArgType")?{type:"doubleArgType"}:doubleArgType,"_","type","_","type","_",d.has("rparen")?{type:"rparen"}:rparen],postprocess:F},{name:"type$ebnf$1$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"type$ebnf$1",symbols:["type$ebnf$1$subexpression$1"]},{name:"type$ebnf$1$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"type$ebnf$1",symbols:["type$ebnf$1","type$ebnf$1$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"type",symbols:[d.has("comparableType")?{type:"comparableType"}:comparableType,"type$ebnf$1"],postprocess:w},{name:"type$ebnf$2$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"type$ebnf$2",symbols:["type$ebnf$2$subexpression$1"]},{name:"type$ebnf$2$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"type$ebnf$2",symbols:["type$ebnf$2","type$ebnf$2$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"type",symbols:[d.has("constantType")?{type:"constantType"}:constantType,"type$ebnf$2"],postprocess:w},{name:"type$ebnf$3$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"type$ebnf$3",symbols:["type$ebnf$3$subexpression$1"]},{name:"type$ebnf$3$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"type$ebnf$3",symbols:["type$ebnf$3","type$ebnf$3$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"type",symbols:[d.has("lparen")?{type:"lparen"}:lparen,"_",d.has("comparableType")?{type:"comparableType"}:comparableType,"type$ebnf$3","_",d.has("rparen")?{type:"rparen"}:rparen],postprocess:O},{name:"type$ebnf$4$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"type$ebnf$4",symbols:["type$ebnf$4$subexpression$1"]},{name:"type$ebnf$4$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"type$ebnf$4",symbols:["type$ebnf$4","type$ebnf$4$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"type",symbols:[d.has("lparen")?{type:"lparen"}:lparen,"_",d.has("constantType")?{type:"constantType"}:constantType,"type$ebnf$4","_",d.has("rparen")?{type:"rparen"}:rparen],postprocess:O},{name:"type$ebnf$5$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"type$ebnf$5",symbols:["type$ebnf$5$subexpression$1"]},{name:"type$ebnf$5$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"type$ebnf$5",symbols:["type$ebnf$5","type$ebnf$5$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"type",symbols:[d.has("lparen")?{type:"lparen"}:lparen,"_",d.has("singleArgType")?{type:"singleArgType"}:singleArgType,"type$ebnf$5","_","type",d.has("rparen")?{type:"rparen"}:rparen],postprocess:e=>{const t=e[3].map(e=>`"${e[1]}"`);return`{ "prim": "${e[2]}", "args": [ ${e[5]} ], "annots": [${t}] }`}},{name:"type$ebnf$6$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"type$ebnf$6",symbols:["type$ebnf$6$subexpression$1"]},{name:"type$ebnf$6$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"type$ebnf$6",symbols:["type$ebnf$6","type$ebnf$6$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"type",symbols:[d.has("lparen")?{type:"lparen"}:lparen,"_",d.has("doubleArgType")?{type:"doubleArgType"}:doubleArgType,"type$ebnf$6","_","type","_","type",d.has("rparen")?{type:"rparen"}:rparen],postprocess:e=>{const t=e[3].map(e=>`"${e[1]}"`);return`{ "prim": "${e[2]}", "args": [ ${e[5]}, ${e[7]} ], "annots": [${t}] }`}},{name:"typeData",symbols:[d.has("singleArgType")?{type:"singleArgType"}:singleArgType,"_","typeData"],postprocess:E},{name:"typeData",symbols:[d.has("lparen")?{type:"lparen"}:lparen,"_",d.has("singleArgType")?{type:"singleArgType"}:singleArgType,"_","typeData","_",d.has("rparen")?{type:"rparen"}:rparen],postprocess:M},{name:"typeData",symbols:[d.has("doubleArgType")?{type:"doubleArgType"}:doubleArgType,"_","typeData","_","typeData"],postprocess:x},{name:"typeData",symbols:[d.has("lparen")?{type:"lparen"}:lparen,"_",d.has("doubleArgType")?{type:"doubleArgType"}:doubleArgType,"_","typeData","_","typeData","_",d.has("rparen")?{type:"rparen"}:rparen],postprocess:F},{name:"typeData",symbols:["subTypeData"],postprocess:n},{name:"typeData",symbols:["subTypeElt"],postprocess:n},{name:"typeData",symbols:[d.has("number")?{type:"number"}:number],postprocess:U},{name:"typeData",symbols:[d.has("string")?{type:"string"}:string],postprocess:T},{name:"typeData",symbols:[d.has("lbrace")?{type:"lbrace"}:lbrace,"_",d.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>[]},{name:"data",symbols:[d.has("constantData")?{type:"constantData"}:constantData],postprocess:w},{name:"data",symbols:[d.has("singleArgData")?{type:"singleArgData"}:singleArgData,"_","data"],postprocess:E},{name:"data",symbols:[d.has("doubleArgData")?{type:"doubleArgData"}:doubleArgData,"_","data","_","data"],postprocess:x},{name:"data",symbols:["subData"],postprocess:n},{name:"data",symbols:["subElt"],postprocess:n},{name:"data",symbols:[d.has("string")?{type:"string"}:string],postprocess:T},{name:"data",symbols:[d.has("bytes")?{type:"bytes"}:bytes],postprocess:e=>`{ "bytes": "${e[0].toString().slice(2)}" }`},{name:"data",symbols:[d.has("number")?{type:"number"}:number],postprocess:U},{name:"subData",symbols:[d.has("lbrace")?{type:"lbrace"}:lbrace,"_",d.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>"[]"},{name:"subData$ebnf$1$subexpression$1",symbols:["data","_"]},{name:"subData$ebnf$1",symbols:["subData$ebnf$1$subexpression$1"]},{name:"subData$ebnf$1$subexpression$2",symbols:["data","_"]},{name:"subData$ebnf$1",symbols:["subData$ebnf$1","subData$ebnf$1$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"subData",symbols:[{literal:"("},"_","subData$ebnf$1",{literal:")"}],postprocess:k},{name:"subData$ebnf$2$subexpression$1$ebnf$1",symbols:[{literal:";"}],postprocess:n},{name:"subData$ebnf$2$subexpression$1$ebnf$1",symbols:[],postprocess:()=>null},{name:"subData$ebnf$2$subexpression$1",symbols:["data","_","subData$ebnf$2$subexpression$1$ebnf$1","_"]},{name:"subData$ebnf$2",symbols:["subData$ebnf$2$subexpression$1"]},{name:"subData$ebnf$2$subexpression$2$ebnf$1",symbols:[{literal:";"}],postprocess:n},{name:"subData$ebnf$2$subexpression$2$ebnf$1",symbols:[],postprocess:()=>null},{name:"subData$ebnf$2$subexpression$2",symbols:["data","_","subData$ebnf$2$subexpression$2$ebnf$1","_"]},{name:"subData$ebnf$2",symbols:["subData$ebnf$2","subData$ebnf$2$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"subData",symbols:[{literal:"{"},"_","subData$ebnf$2",{literal:"}"}],postprocess:z},{name:"subElt",symbols:[d.has("lbrace")?{type:"lbrace"}:lbrace,"_",d.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>"[]"},{name:"subElt$ebnf$1$subexpression$1$ebnf$1",symbols:[{literal:";"}],postprocess:n},{name:"subElt$ebnf$1$subexpression$1$ebnf$1",symbols:[],postprocess:()=>null},{name:"subElt$ebnf$1$subexpression$1",symbols:["elt","subElt$ebnf$1$subexpression$1$ebnf$1","_"]},{name:"subElt$ebnf$1",symbols:["subElt$ebnf$1$subexpression$1"]},{name:"subElt$ebnf$1$subexpression$2$ebnf$1",symbols:[{literal:";"}],postprocess:n},{name:"subElt$ebnf$1$subexpression$2$ebnf$1",symbols:[],postprocess:()=>null},{name:"subElt$ebnf$1$subexpression$2",symbols:["elt","subElt$ebnf$1$subexpression$2$ebnf$1","_"]},{name:"subElt$ebnf$1",symbols:["subElt$ebnf$1","subElt$ebnf$1$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"subElt",symbols:[{literal:"{"},"_","subElt$ebnf$1",{literal:"}"}],postprocess:z},{name:"elt",symbols:[d.has("elt")?{type:"elt"}:elt,"_","data","_","data"],postprocess:x},{name:"subTypeData",symbols:[d.has("lbrace")?{type:"lbrace"}:lbrace,"_",d.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>"[]"},{name:"subTypeData$ebnf$1$subexpression$1$ebnf$1",symbols:[{literal:";"}],postprocess:n},{name:"subTypeData$ebnf$1$subexpression$1$ebnf$1",symbols:[],postprocess:()=>null},{name:"subTypeData$ebnf$1$subexpression$1",symbols:["data","subTypeData$ebnf$1$subexpression$1$ebnf$1","_"]},{name:"subTypeData$ebnf$1",symbols:["subTypeData$ebnf$1$subexpression$1"]},{name:"subTypeData$ebnf$1$subexpression$2$ebnf$1",symbols:[{literal:";"}],postprocess:n},{name:"subTypeData$ebnf$1$subexpression$2$ebnf$1",symbols:[],postprocess:()=>null},{name:"subTypeData$ebnf$1$subexpression$2",symbols:["data","subTypeData$ebnf$1$subexpression$2$ebnf$1","_"]},{name:"subTypeData$ebnf$1",symbols:["subTypeData$ebnf$1","subTypeData$ebnf$1$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"subTypeData",symbols:[{literal:"{"},"_","subTypeData$ebnf$1",{literal:"}"}],postprocess:k},{name:"subTypeData$ebnf$2$subexpression$1$ebnf$1",symbols:[{literal:";"}],postprocess:n},{name:"subTypeData$ebnf$2$subexpression$1$ebnf$1",symbols:[],postprocess:()=>null},{name:"subTypeData$ebnf$2$subexpression$1",symbols:["data","subTypeData$ebnf$2$subexpression$1$ebnf$1","_"]},{name:"subTypeData$ebnf$2",symbols:["subTypeData$ebnf$2$subexpression$1"]},{name:"subTypeData$ebnf$2$subexpression$2$ebnf$1",symbols:[{literal:";"}],postprocess:n},{name:"subTypeData$ebnf$2$subexpression$2$ebnf$1",symbols:[],postprocess:()=>null},{name:"subTypeData$ebnf$2$subexpression$2",symbols:["data","subTypeData$ebnf$2$subexpression$2$ebnf$1","_"]},{name:"subTypeData$ebnf$2",symbols:["subTypeData$ebnf$2","subTypeData$ebnf$2$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"subTypeData",symbols:[{literal:"("},"_","subTypeData$ebnf$2",{literal:")"}],postprocess:k},{name:"subTypeElt",symbols:[d.has("lbrace")?{type:"lbrace"}:lbrace,"_",d.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>"[]"},{name:"subTypeElt$ebnf$1$subexpression$1$ebnf$1",symbols:[{literal:";"}],postprocess:n},{name:"subTypeElt$ebnf$1$subexpression$1$ebnf$1",symbols:[],postprocess:()=>null},{name:"subTypeElt$ebnf$1$subexpression$1",symbols:["typeElt","subTypeElt$ebnf$1$subexpression$1$ebnf$1","_"]},{name:"subTypeElt$ebnf$1",symbols:["subTypeElt$ebnf$1$subexpression$1"]},{name:"subTypeElt$ebnf$1$subexpression$2$ebnf$1",symbols:[{literal:";"}],postprocess:n},{name:"subTypeElt$ebnf$1$subexpression$2$ebnf$1",symbols:[],postprocess:()=>null},{name:"subTypeElt$ebnf$1$subexpression$2",symbols:["typeElt","subTypeElt$ebnf$1$subexpression$2$ebnf$1","_"]},{name:"subTypeElt$ebnf$1",symbols:["subTypeElt$ebnf$1","subTypeElt$ebnf$1$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"subTypeElt",symbols:[{literal:"[{"},"_","subTypeElt$ebnf$1",{literal:"}]"}],postprocess:k},{name:"subTypeElt$ebnf$2$subexpression$1$ebnf$1",symbols:[{literal:";"}],postprocess:n},{name:"subTypeElt$ebnf$2$subexpression$1$ebnf$1",symbols:[],postprocess:()=>null},{name:"subTypeElt$ebnf$2$subexpression$1",symbols:["typeElt","_","subTypeElt$ebnf$2$subexpression$1$ebnf$1","_"]},{name:"subTypeElt$ebnf$2",symbols:["subTypeElt$ebnf$2$subexpression$1"]},{name:"subTypeElt$ebnf$2$subexpression$2$ebnf$1",symbols:[{literal:";"}],postprocess:n},{name:"subTypeElt$ebnf$2$subexpression$2$ebnf$1",symbols:[],postprocess:()=>null},{name:"subTypeElt$ebnf$2$subexpression$2",symbols:["typeElt","_","subTypeElt$ebnf$2$subexpression$2$ebnf$1","_"]},{name:"subTypeElt$ebnf$2",symbols:["subTypeElt$ebnf$2","subTypeElt$ebnf$2$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"subTypeElt",symbols:[{literal:"[{"},"_","subTypeElt$ebnf$2",{literal:"}]"}],postprocess:k},{name:"typeElt",symbols:[d.has("elt")?{type:"elt"}:elt,"_","typeData","_","typeData"],postprocess:x},{name:"subInstruction",symbols:[d.has("lbrace")?{type:"lbrace"}:lbrace,"_",d.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>""},{name:"subInstruction",symbols:[d.has("lbrace")?{type:"lbrace"}:lbrace,"_","instruction","_",d.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>e[2]},{name:"subInstruction$ebnf$1$subexpression$1",symbols:["instruction","_",d.has("semicolon")?{type:"semicolon"}:semicolon,"_"]},{name:"subInstruction$ebnf$1",symbols:["subInstruction$ebnf$1$subexpression$1"]},{name:"subInstruction$ebnf$1$subexpression$2",symbols:["instruction","_",d.has("semicolon")?{type:"semicolon"}:semicolon,"_"]},{name:"subInstruction$ebnf$1",symbols:["subInstruction$ebnf$1","subInstruction$ebnf$1$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"subInstruction",symbols:[d.has("lbrace")?{type:"lbrace"}:lbrace,"_","subInstruction$ebnf$1","instruction","_",d.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>e[2].map(e=>e[0]).concat(e[3]).map(e=>G(e))},{name:"subInstruction$ebnf$2$subexpression$1",symbols:["instruction","_",d.has("semicolon")?{type:"semicolon"}:semicolon,"_"]},{name:"subInstruction$ebnf$2",symbols:["subInstruction$ebnf$2$subexpression$1"]},{name:"subInstruction$ebnf$2$subexpression$2",symbols:["instruction","_",d.has("semicolon")?{type:"semicolon"}:semicolon,"_"]},{name:"subInstruction$ebnf$2",symbols:["subInstruction$ebnf$2","subInstruction$ebnf$2$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"subInstruction",symbols:[d.has("lbrace")?{type:"lbrace"}:lbrace,"_","subInstruction$ebnf$2",d.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:k},{name:"instructions",symbols:[d.has("baseInstruction")?{type:"baseInstruction"}:baseInstruction]},{name:"instructions",symbols:[d.has("macroCADR")?{type:"macroCADR"}:macroCADR]},{name:"instructions",symbols:[d.has("macroDIP")?{type:"macroDIP"}:macroDIP]},{name:"instructions",symbols:[d.has("macroDUP")?{type:"macroDUP"}:macroDUP]},{name:"instructions",symbols:[d.has("macroSETCADR")?{type:"macroSETCADR"}:macroSETCADR]},{name:"instructions",symbols:[d.has("macroASSERTlist")?{type:"macroASSERTlist"}:macroASSERTlist]},{name:"instruction",symbols:["instructions"],postprocess:w},{name:"instruction",symbols:["subInstruction"],postprocess:n},{name:"instruction$ebnf$1$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$1",symbols:["instruction$ebnf$1$subexpression$1"]},{name:"instruction$ebnf$1$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$1",symbols:["instruction$ebnf$1","instruction$ebnf$1$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:["instructions","instruction$ebnf$1","_"],postprocess:w},{name:"instruction",symbols:["instructions","_","subInstruction"],postprocess:e=>{const t=""+e[0].toString();return v(t)?I(t,e[2]):`{ "prim": "${e[0]}", "args": [ [ ${e[2]} ] ] }`}},{name:"instruction$ebnf$2$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$2",symbols:["instruction$ebnf$2$subexpression$1"]},{name:"instruction$ebnf$2$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$2",symbols:["instruction$ebnf$2","instruction$ebnf$2$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:["instructions","instruction$ebnf$2","_","subInstruction"],postprocess:N},{name:"instruction",symbols:["instructions","_","type"],postprocess:E},{name:"instruction$ebnf$3$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$3",symbols:["instruction$ebnf$3$subexpression$1"]},{name:"instruction$ebnf$3$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$3",symbols:["instruction$ebnf$3","instruction$ebnf$3$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:["instructions","instruction$ebnf$3","_","type"],postprocess:N},{name:"instruction",symbols:["instructions","_","data"],postprocess:E},{name:"instruction$ebnf$4$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$4",symbols:["instruction$ebnf$4$subexpression$1"]},{name:"instruction$ebnf$4$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$4",symbols:["instruction$ebnf$4","instruction$ebnf$4$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:["instructions","instruction$ebnf$4","_","data"],postprocess:N},{name:"instruction",symbols:["instructions","_","type","_","type","_","subInstruction"],postprocess:e=>`{ "prim": "${e[0]}", "args": [ ${e[2]}, ${e[4]}, [${e[6]}] ] }`},{name:"instruction$ebnf$5$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$5",symbols:["instruction$ebnf$5$subexpression$1"]},{name:"instruction$ebnf$5$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$5",symbols:["instruction$ebnf$5","instruction$ebnf$5$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:["instructions","instruction$ebnf$5","_","type","_","type","_","subInstruction"],postprocess:e=>{const t=e[1].map(e=>`"${e[1]}"`);return`{ "prim": "${e[0]}", "args": [ ${e[3]}, ${e[5]}, ${e[7]} ], "annots": [${t}] }`}},{name:"instruction",symbols:["instructions","_","subInstruction","_","subInstruction"],postprocess:e=>{const t=""+e[0].toString();return D(t)?$(t,e[2],e[4]):`{ "prim": "${e[0]}", "args": [ [${e[2]}], [${e[4]}] ] }`}},{name:"instruction$ebnf$6$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$6",symbols:["instruction$ebnf$6$subexpression$1"]},{name:"instruction$ebnf$6$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$6",symbols:["instruction$ebnf$6","instruction$ebnf$6$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:["instructions","instruction$ebnf$6","_","subInstruction","_","subInstruction"],postprocess:L},{name:"instruction",symbols:["instructions","_","type","_","type"],postprocess:x},{name:"instruction$ebnf$7$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$7",symbols:["instruction$ebnf$7$subexpression$1"]},{name:"instruction$ebnf$7$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$7",symbols:["instruction$ebnf$7","instruction$ebnf$7$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:["instructions","instruction$ebnf$7","_","type","_","type"],postprocess:L},{name:"instruction",symbols:[{literal:"PUSH"},"_","type","_","data"],postprocess:x},{name:"instruction",symbols:[{literal:"PUSH"},"_","type","_",d.has("lbrace")?{type:"lbrace"}:lbrace,d.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>`{ "prim": "${e[0]}", "args": [${e[2]}, []] }`},{name:"instruction$ebnf$8$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$8",symbols:["instruction$ebnf$8$subexpression$1"]},{name:"instruction$ebnf$8$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$8",symbols:["instruction$ebnf$8","instruction$ebnf$8$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:[{literal:"PUSH"},"instruction$ebnf$8","_","type","_","data"],postprocess:e=>{const t=e[1].map(e=>`"${e[1]}"`);return`{ "prim": "PUSH", "args": [ ${e[3]}, ${e[5]} ], "annots": [${t}] }`}},{name:"instruction$ebnf$9",symbols:[/[0-9]/]},{name:"instruction$ebnf$9",symbols:["instruction$ebnf$9",/[0-9]/],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:[{literal:"DIP"},"_","instruction$ebnf$9","_","subInstruction"],postprocess:e=>e.length>4?`{ "prim": "${e[0]}", "args": [ { "int": "${e[2]}" }, [ ${e[4]} ] ] }`:`{ "prim": "${e[0]}", "args": [ ${e[2]} ] }`},{name:"instruction$ebnf$10",symbols:[/[0-9]/]},{name:"instruction$ebnf$10",symbols:["instruction$ebnf$10",/[0-9]/],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:[{literal:"DUP"},"_","instruction$ebnf$10"],postprocess:e=>{const t=Number(e[2]);return 1===t?'{ "prim": "DUP" }':2===t?'[{ "prim": "DIP", "args": [[ {"prim": "DUP"} ]] }, { "prim": "SWAP" }]':`[{ "prim": "DIP", "args": [ {"int": "${t-1}"}, [{ "prim": "DUP" }] ] }, { "prim": "DIG", "args": [ {"int": "${t}"} ] }]`}},{name:"instruction",symbols:[{literal:"DUP"}],postprocess:w},{name:"instruction$ebnf$11$subexpression$1",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$11",symbols:["instruction$ebnf$11$subexpression$1"]},{name:"instruction$ebnf$11$subexpression$2",symbols:["_",d.has("annot")?{type:"annot"}:annot]},{name:"instruction$ebnf$11",symbols:["instruction$ebnf$11","instruction$ebnf$11$subexpression$2"],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:[{literal:"DUP"},"instruction$ebnf$11","_"],postprocess:w},{name:"instruction$ebnf$12",symbols:[/[0-9]/]},{name:"instruction$ebnf$12",symbols:["instruction$ebnf$12",/[0-9]/],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:[{literal:"DIG"},"_","instruction$ebnf$12"],postprocess:W},{name:"instruction$ebnf$13",symbols:[/[0-9]/]},{name:"instruction$ebnf$13",symbols:["instruction$ebnf$13",/[0-9]/],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:[{literal:"DUG"},"_","instruction$ebnf$13"],postprocess:W},{name:"instruction$ebnf$14",symbols:[/[0-9]/]},{name:"instruction$ebnf$14",symbols:["instruction$ebnf$14",/[0-9]/],postprocess:e=>e[0].concat([e[1]])},{name:"instruction",symbols:[{literal:"DROP"},"_","instruction$ebnf$14"],postprocess:e=>`{ "prim": "${e[0]}", "args": [ { "int": "${e[2]}" } ] }`},{name:"instruction",symbols:[{literal:"DROP"}],postprocess:w},{name:"instruction",symbols:[{literal:"CREATE_CONTRACT"},"_",d.has("lbrace")?{type:"lbrace"}:lbrace,"_","parameter","_","storage","_","code","_",d.has("rbrace")?{type:"rbrace"}:rbrace],postprocess:e=>`{ "prim":"CREATE_CONTRACT", "args": [ [ ${e[4]}, ${e[6]}, {"prim": "code" , "args":[ [ ${e[8]} ] ] } ] ] }`},{name:"instruction",symbols:[{literal:"EMPTY_MAP"},"_","type","_","type"],postprocess:x},{name:"instruction",symbols:[{literal:"EMPTY_MAP"},"_",d.has("lparen")?{type:"lparen"}:lparen,"_","type","_",d.has("rparen")?{type:"rparen"}:rparen,"_","type"],postprocess:e=>`{ "prim": "${e[0]}", "args": [ ${e[4]}, ${e[8]} ] }`},{name:"_$ebnf$1",symbols:[]},{name:"_$ebnf$1",symbols:["_$ebnf$1",/[\s]/],postprocess:e=>e[0].concat([e[1]])},{name:"_",symbols:["_$ebnf$1"]},{name:"semicolons$ebnf$1",symbols:[/[;]/],postprocess:n},{name:"semicolons$ebnf$1",symbols:[],postprocess:()=>null},{name:"semicolons",symbols:["semicolons$ebnf$1"]}],ParserStart:"main"};t.default=B},function(e,t,r){"use strict";var n=r(52),o=r(72);e.exports=o((function(e){var t=n("sha256").update(e).digest();return n("sha256").update(t).digest()}))},function(e,t,r){"use strict";var n=r(1),o=r(53),s=r(65),i=r(66),a=r(71);function u(e){a.call(this,"digest"),this._hash=e}n(u,a),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new o:"rmd160"===e||"ripemd160"===e?new s:new u(i(e))}},function(e,t,r){"use strict";var n=r(1),o=r(34),s=r(2).Buffer,i=new Array(16);function a(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(e,t){return e<<t|e>>>32-t}function c(e,t,r,n,o,s,i){return u(e+(t&r|~t&n)+o+s|0,i)+t|0}function l(e,t,r,n,o,s,i){return u(e+(t&n|r&~n)+o+s|0,i)+t|0}function p(e,t,r,n,o,s,i){return u(e+(t^r^n)+o+s|0,i)+t|0}function f(e,t,r,n,o,s,i){return u(e+(r^(t|~n))+o+s|0,i)+t|0}n(a,o),a.prototype._update=function(){for(var e=i,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,o=this._c,s=this._d;r=c(r,n,o,s,e[0],3614090360,7),s=c(s,r,n,o,e[1],3905402710,12),o=c(o,s,r,n,e[2],606105819,17),n=c(n,o,s,r,e[3],3250441966,22),r=c(r,n,o,s,e[4],4118548399,7),s=c(s,r,n,o,e[5],1200080426,12),o=c(o,s,r,n,e[6],2821735955,17),n=c(n,o,s,r,e[7],4249261313,22),r=c(r,n,o,s,e[8],1770035416,7),s=c(s,r,n,o,e[9],2336552879,12),o=c(o,s,r,n,e[10],4294925233,17),n=c(n,o,s,r,e[11],2304563134,22),r=c(r,n,o,s,e[12],1804603682,7),s=c(s,r,n,o,e[13],4254626195,12),o=c(o,s,r,n,e[14],2792965006,17),r=l(r,n=c(n,o,s,r,e[15],1236535329,22),o,s,e[1],4129170786,5),s=l(s,r,n,o,e[6],3225465664,9),o=l(o,s,r,n,e[11],643717713,14),n=l(n,o,s,r,e[0],3921069994,20),r=l(r,n,o,s,e[5],3593408605,5),s=l(s,r,n,o,e[10],38016083,9),o=l(o,s,r,n,e[15],3634488961,14),n=l(n,o,s,r,e[4],3889429448,20),r=l(r,n,o,s,e[9],568446438,5),s=l(s,r,n,o,e[14],3275163606,9),o=l(o,s,r,n,e[3],4107603335,14),n=l(n,o,s,r,e[8],1163531501,20),r=l(r,n,o,s,e[13],2850285829,5),s=l(s,r,n,o,e[2],4243563512,9),o=l(o,s,r,n,e[7],1735328473,14),r=p(r,n=l(n,o,s,r,e[12],2368359562,20),o,s,e[5],4294588738,4),s=p(s,r,n,o,e[8],2272392833,11),o=p(o,s,r,n,e[11],1839030562,16),n=p(n,o,s,r,e[14],4259657740,23),r=p(r,n,o,s,e[1],2763975236,4),s=p(s,r,n,o,e[4],1272893353,11),o=p(o,s,r,n,e[7],4139469664,16),n=p(n,o,s,r,e[10],3200236656,23),r=p(r,n,o,s,e[13],681279174,4),s=p(s,r,n,o,e[0],3936430074,11),o=p(o,s,r,n,e[3],3572445317,16),n=p(n,o,s,r,e[6],76029189,23),r=p(r,n,o,s,e[9],3654602809,4),s=p(s,r,n,o,e[12],3873151461,11),o=p(o,s,r,n,e[15],530742520,16),r=f(r,n=p(n,o,s,r,e[2],3299628645,23),o,s,e[0],4096336452,6),s=f(s,r,n,o,e[7],1126891415,10),o=f(o,s,r,n,e[14],2878612391,15),n=f(n,o,s,r,e[5],4237533241,21),r=f(r,n,o,s,e[12],1700485571,6),s=f(s,r,n,o,e[3],2399980690,10),o=f(o,s,r,n,e[10],4293915773,15),n=f(n,o,s,r,e[1],2240044497,21),r=f(r,n,o,s,e[8],1873313359,6),s=f(s,r,n,o,e[15],4264355552,10),o=f(o,s,r,n,e[6],2734768916,15),n=f(n,o,s,r,e[13],1309151649,21),r=f(r,n,o,s,e[4],4149444226,6),s=f(s,r,n,o,e[11],3174756917,10),o=f(o,s,r,n,e[2],718787259,15),n=f(n,o,s,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+o|0,this._d=this._d+s|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=s.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=a},function(e,t){},function(e,t,r){"use strict";var n=r(2).Buffer,o=r(56);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t,r,o,s=n.allocUnsafe(e>>>0),i=this.head,a=0;i;)t=i.data,r=s,o=a,t.copy(r,o),a+=i.data.length,i=i.next;return s},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function s(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new s(o.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new s(o.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r(58),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(this,r(11))},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,o,s,i,a,u=1,c={},l=!1,p=e.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(e);f=f&&f.setTimeout?f:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick((function(){d(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((s=new MessageChannel).port1.onmessage=function(e){d(e.data)},n=function(e){s.port2.postMessage(e)}):p&&"onreadystatechange"in p.createElement("script")?(o=p.documentElement,n=function(e){var t=p.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):n=function(e){setTimeout(d,0,e)}:(i="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(i)&&d(+t.data.slice(i.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),n=function(t){e.postMessage(i+t,"*")}),f.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var o={callback:e,args:t};return c[u]=o,n(u),u++},f.clearImmediate=h}function h(e){delete c[e]}function d(e){if(l)setTimeout(d,0,e);else{var t=c[e];if(t){l=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}finally{h(e),l=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,r(11),r(17))},function(e,t,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(e){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this,r(11))},function(e,t,r){"use strict";e.exports=s;var n=r(39),o=r(15);function s(e){if(!(this instanceof s))return new s(e);n.call(this,e)}o.inherits=r(1),o.inherits(s,n),s.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){e.exports=r(27)},function(e,t,r){e.exports=r(12)},function(e,t,r){e.exports=r(26).Transform},function(e,t,r){e.exports=r(26).PassThrough},function(e,t,r){"use strict";var n=r(0).Buffer,o=r(1),s=r(34),i=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],l=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],p=[0,1518500249,1859775393,2400959708,2840853838],f=[1352829926,1548603684,1836072691,2053994217,0];function h(){s.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function d(e,t){return e<<t|e>>>32-t}function g(e,t,r,n,o,s,i,a){return d(e+(t^r^n)+s+i|0,a)+o|0}function m(e,t,r,n,o,s,i,a){return d(e+(t&r|~t&n)+s+i|0,a)+o|0}function y(e,t,r,n,o,s,i,a){return d(e+((t|~r)^n)+s+i|0,a)+o|0}function b(e,t,r,n,o,s,i,a){return d(e+(t&n|r&~n)+s+i|0,a)+o|0}function P(e,t,r,n,o,s,i,a){return d(e+(t^(r|~n))+s+i|0,a)+o|0}o(h,s),h.prototype._update=function(){for(var e=i,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,h=0|this._e,D=0|this._a,$=0|this._b,v=0|this._c,I=0|this._d,_=0|this._e,A=0;A<80;A+=1){var R,S;A<16?(R=g(r,n,o,s,h,e[a[A]],p[0],c[A]),S=P(D,$,v,I,_,e[u[A]],f[0],l[A])):A<32?(R=m(r,n,o,s,h,e[a[A]],p[1],c[A]),S=b(D,$,v,I,_,e[u[A]],f[1],l[A])):A<48?(R=y(r,n,o,s,h,e[a[A]],p[2],c[A]),S=y(D,$,v,I,_,e[u[A]],f[2],l[A])):A<64?(R=b(r,n,o,s,h,e[a[A]],p[3],c[A]),S=m(D,$,v,I,_,e[u[A]],f[3],l[A])):(R=P(r,n,o,s,h,e[a[A]],p[4],c[A]),S=g(D,$,v,I,_,e[u[A]],f[4],l[A])),r=h,h=s,s=d(o,10),o=n,n=R,D=_,_=I,I=d(v,10),v=$,$=S}var C=this._b+o+I|0;this._b=this._c+s+_|0,this._c=this._d+h+D|0,this._d=this._e+r+$|0,this._e=this._a+n+v|0,this._a=C},h.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=n.alloc?n.alloc(20):new n(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=h},function(e,t,r){(t=e.exports=function(e){e=e.toLowerCase();var r=t[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r}).sha=r(67),t.sha1=r(68),t.sha224=r(69),t.sha256=r(40),t.sha384=r(70),t.sha512=r(41)},function(e,t,r){var n=r(1),o=r(13),s=r(2).Buffer,i=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,o.call(this,64,56)}function c(e){return e<<30|e>>>2}function l(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(u,o),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,o=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,p=0;p<16;++p)r[p]=e.readInt32BE(4*p);for(;p<80;++p)r[p]=r[p-3]^r[p-8]^r[p-14]^r[p-16];for(var f=0;f<80;++f){var h=~~(f/20),d=0|((t=n)<<5|t>>>27)+l(h,o,s,a)+u+r[f]+i[h];u=a,a=s,s=c(o),o=n,n=d}this._a=n+this._a|0,this._b=o+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,r){var n=r(1),o=r(13),s=r(2).Buffer,i=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,o.call(this,64,56)}function c(e){return e<<5|e>>>27}function l(e){return e<<30|e>>>2}function p(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(u,o),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,o=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,f=0;f<16;++f)r[f]=e.readInt32BE(4*f);for(;f<80;++f)r[f]=(t=r[f-3]^r[f-8]^r[f-14]^r[f-16])<<1|t>>>31;for(var h=0;h<80;++h){var d=~~(h/20),g=c(n)+p(d,o,s,a)+u+r[h]+i[d]|0;u=a,a=s,s=l(o),o=n,n=g}this._a=n+this._a|0,this._b=o+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,r){var n=r(1),o=r(40),s=r(13),i=r(2).Buffer,a=new Array(64);function u(){this.init(),this._w=a,s.call(this,64,56)}n(u,o),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=i.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=u},function(e,t,r){var n=r(1),o=r(41),s=r(13),i=r(2).Buffer,a=new Array(160);function u(){this.init(),this._w=a,s.call(this,128,112)}n(u,o),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var e=i.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=u},function(e,t,r){var n=r(2).Buffer,o=r(35).Transform,s=r(28).StringDecoder;function i(e){o.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(1)(i,o),i.prototype.update=function(e,t,r){"string"==typeof e&&(e=n.from(e,t));var o=this._update(e);return this.hashMode?this:(r&&(o=this._toString(o,r)),o)},i.prototype.setAutoPadding=function(){},i.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},i.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},i.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},i.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},i.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},i.prototype._finalOrDigest=function(e){var t=this.__final()||n.alloc(0);return e&&(t=this._toString(t,e,!0)),t},i.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new s(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n},e.exports=i},function(e,t,r){"use strict";var n=r(73),o=r(2).Buffer;e.exports=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),o=e(r);if(!(n[0]^o[0]|n[1]^o[1]|n[2]^o[2]|n[3]^o[3]))return r}return{encode:function(t){var r=e(t);return n.encode(o.concat([t,r],t.length+4))},decode:function(e){var r=t(n.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=n.decodeUnsafe(e);if(r)return t(r)}}}},function(e,t,r){var n=r(74);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(e,t,r){"use strict";var n=r(2).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");var t=new Uint8Array(256);t.fill(255);for(var r=0;r<e.length;r++){var o=e.charAt(r),s=o.charCodeAt(0);if(255!==t[s])throw new TypeError(o+" is ambiguous");t[s]=r}var i=e.length,a=e.charAt(0),u=Math.log(i)/Math.log(256),c=Math.log(256)/Math.log(i);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return n.alloc(0);var r=0;if(" "!==e[r]){for(var o=0,s=0;e[r]===a;)o++,r++;for(var c=(e.length-r)*u+1>>>0,l=new Uint8Array(c);e[r];){var p=t[e.charCodeAt(r)];if(255===p)return;for(var f=0,h=c-1;(0!==p||f<s)&&-1!==h;h--,f++)p+=i*l[h]>>>0,l[h]=p%256>>>0,p=p/256>>>0;if(0!==p)throw new Error("Non-zero carry");s=f,r++}if(" "!==e[r]){for(var d=c-s;d!==c&&0===l[d];)d++;var g=n.allocUnsafe(o+(c-d));g.fill(0,0,o);for(var m=o;d!==c;)g[m++]=l[d++];return g}}}return{encode:function(t){if(!n.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,o=0,s=0,u=t.length;s!==u&&0===t[s];)s++,r++;for(var l=(u-s)*c+1>>>0,p=new Uint8Array(l);s!==u;){for(var f=t[s],h=0,d=l-1;(0!==f||h<o)&&-1!==d;d--,h++)f+=256*p[d]>>>0,p[d]=f%i>>>0,f=f/i>>>0;if(0!==f)throw new Error("Non-zero carry");o=h,s++}for(var g=l-o;g!==l&&0===p[g];)g++;for(var m=a.repeat(r);g<l;++g)m+=e.charAt(p[g]);return m},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+i+" character")}}}},function(e,t,r){var n=r(42);function o(e,t,r){var n=e[t]+e[r],o=e[t+1]+e[r+1];n>=4294967296&&o++,e[t]=n,e[t+1]=o}function s(e,t,r,n){var o=e[t]+r;r<0&&(o+=4294967296);var s=e[t+1]+n;o>=4294967296&&s++,e[t]=o,e[t+1]=s}function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,r,n,i,a){var u=p[i],c=p[i+1],f=p[a],h=p[a+1];o(l,e,t),s(l,e,u,c);var d=l[n]^l[e],g=l[n+1]^l[e+1];l[n]=g,l[n+1]=d,o(l,r,n),d=l[t]^l[r],g=l[t+1]^l[r+1],l[t]=d>>>24^g<<8,l[t+1]=g>>>24^d<<8,o(l,e,t),s(l,e,f,h),d=l[n]^l[e],g=l[n+1]^l[e+1],l[n]=d>>>16^g<<16,l[n+1]=g>>>16^d<<16,o(l,r,n),d=l[t]^l[r],g=l[t+1]^l[r+1],l[t]=g>>>31^d<<1,l[t+1]=d>>>31^g<<1}var u=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),l=new Uint32Array(32),p=new Uint32Array(32);function f(e,t){var r=0;for(r=0;r<16;r++)l[r]=e.h[r],l[r+16]=u[r];for(l[24]=l[24]^e.t,l[25]=l[25]^e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),r=0;r<32;r++)p[r]=i(e.b,4*r);for(r=0;r<12;r++)a(0,8,16,24,c[16*r+0],c[16*r+1]),a(2,10,18,26,c[16*r+2],c[16*r+3]),a(4,12,20,28,c[16*r+4],c[16*r+5]),a(6,14,22,30,c[16*r+6],c[16*r+7]),a(0,10,20,30,c[16*r+8],c[16*r+9]),a(2,12,22,24,c[16*r+10],c[16*r+11]),a(4,14,16,26,c[16*r+12],c[16*r+13]),a(6,8,18,28,c[16*r+14],c[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^l[r]^l[r+16]}function h(e,t){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var r={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},n=0;n<16;n++)r.h[n]=u[n];var o=t?t.length:0;return r.h[0]^=16842752^o<<8^e,t&&(d(r,t),r.c=128),r}function d(e,t){for(var r=0;r<t.length;r++)128===e.c&&(e.t+=e.c,f(e,!1),e.c=0),e.b[e.c++]=t[r]}function g(e){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;f(e,!0);for(var t=new Uint8Array(e.outlen),r=0;r<e.outlen;r++)t[r]=e.h[r>>2]>>8*(3&r);return t}function m(e,t,r){r=r||64,e=n.normalizeInput(e);var o=h(r,t);return d(o,e),g(o)}e.exports={blake2b:m,blake2bHex:function(e,t,r){var o=m(e,t,r);return n.toHex(o)},blake2bInit:h,blake2bUpdate:d,blake2bFinal:g}},function(e,t,r){var n=r(42);function o(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function s(e,t,r,n,o,s){c[e]=c[e]+c[t]+o,c[n]=i(c[n]^c[e],16),c[r]=c[r]+c[n],c[t]=i(c[t]^c[r],12),c[e]=c[e]+c[t]+s,c[n]=i(c[n]^c[e],8),c[r]=c[r]+c[n],c[t]=i(c[t]^c[r],7)}function i(e,t){return e>>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),c=new Uint32Array(16),l=new Uint32Array(16);function p(e,t){var r=0;for(r=0;r<8;r++)c[r]=e.h[r],c[r+8]=a[r];for(c[12]^=e.t,c[13]^=e.t/4294967296,t&&(c[14]=~c[14]),r=0;r<16;r++)l[r]=o(e.b,4*r);for(r=0;r<10;r++)s(0,4,8,12,l[u[16*r+0]],l[u[16*r+1]]),s(1,5,9,13,l[u[16*r+2]],l[u[16*r+3]]),s(2,6,10,14,l[u[16*r+4]],l[u[16*r+5]]),s(3,7,11,15,l[u[16*r+6]],l[u[16*r+7]]),s(0,5,10,15,l[u[16*r+8]],l[u[16*r+9]]),s(1,6,11,12,l[u[16*r+10]],l[u[16*r+11]]),s(2,7,8,13,l[u[16*r+12]],l[u[16*r+13]]),s(3,4,9,14,l[u[16*r+14]],l[u[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=c[r]^c[r+8]}function f(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var r=t?t.length:0;if(t&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");var n={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return n.h[0]^=16842752^r<<8^e,r>0&&(h(n,t),n.c=64),n}function h(e,t){for(var r=0;r<t.length;r++)64===e.c&&(e.t+=e.c,p(e,!1),e.c=0),e.b[e.c++]=t[r]}function d(e){for(e.t+=e.c;e.c<64;)e.b[e.c++]=0;p(e,!0);for(var t=new Uint8Array(e.outlen),r=0;r<e.outlen;r++)t[r]=e.h[r>>2]>>8*(3&r)&255;return t}function g(e,t,r){r=r||32,e=n.normalizeInput(e);var o=f(r,t);return h(o,e),d(o)}e.exports={blake2s:g,blake2sHex:function(e,t,r){var o=g(e,t,r);return n.toHex(o)},blake2sInit:f,blake2sUpdate:h,blake2sFinal:d}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(23).compile({wspace:/[ \t]+/,lparen:"(",rparen:")",annot:/:[^ );]+|%[^ );]+/,parameter:"parameter",or:"or",pair:"pair",data:["bytes","int","nat","bool","string","timestamp","signature","key","key_hash","mutez","address","unit","operation","chain_id"],singleArgData:["option","list","contract","set"],doubleArgData:["lambda","map","big_map"],semicolon:";"}),o=e=>{let t=void 0,r=void 0;if(e.length>=3){const n=e[2].toString();"%"===n.charAt(0)?r=a(n):t=u(n)}if(5===e.length){const n=e[4].toString();n.startsWith("%")&&void 0===r&&(r=a(n)),n.startsWith(":")&&void 0===t&&(t=u(n))}return[{name:r,parameters:[{name:t||r,type:e[0].toString()}],structure:"$PARAM",generateInvocationString(...e){if(this.parameters.length!==e.length)throw new Error(`Incorrect number of parameters provided; expected ${this.parameters.length}, got ${e.length}`);let t=this.structure;for(let r=0;r<this.parameters.length;r++){let n=e[r];if("unit"===this.parameters[r].type&&(n="Unit"),this.parameters[r].type.startsWith("list")){if(!Array.isArray(n))throw new Error(JSON.stringify(this.parameters[r])+" requires an array value");n=`{${n.join("; ")}}`}this.parameters[r].optional&&e[r]?n="Some "+n:this.parameters[r].optional&&!e[r]&&(n="None"),t=t.replace("$PARAM",n)}return t},generateInvocationPair(...e){let t=this.generateInvocationString(...e);for(;t.startsWith("(Left ")||t.startsWith("(Right ");)t.startsWith("(Left ")&&(t=t.slice(6,-1)),t.startsWith("(Right ")&&(t=t.slice(7,-1));return{entrypoint:this.name,parameters:t}},generateSampleInvocation(){const e=this.parameters.map(e=>{switch(e.type){case"string":return'"Tacos"';case"int":return-1;case"nat":return 99;case"address":return'"KT1EGbAxguaWQFkV3Egb2Z1r933MWuEYyrJS"';case"key_hash":return'"tz1SQnJaocpquTztY3zMgydTPoQBBQrDGonJ"';case"timestamp":return`"${(new Date).toISOString()}"`;case"mutez":return 5e5;case"unit":return"Unit";case"bytes":case"bool":case"signature":case"key":case"operation":case"chain_id":default:return e.type}});return this.generateInvocationString(...e)}}]},s=(...e)=>{const t=e.find(e=>e.startsWith("%"));return t?a(t):void 0},i=(...e)=>{const t=e.find(e=>e.startsWith(":"));return t?u(t):void 0},a=e=>{if(!e.startsWith("%"))throw new Error(e+" must start with '%'");return e.replace(/^%_Liq_entry_/,"").replace("%","")},u=e=>{if(!e.startsWith(":"))throw new Error(e+" must start with ':'");return e.replace(":","")},c={Lexer:n,ParserRules:[{name:"entry",symbols:[n.has("parameter")?{type:"parameter"}:parameter,"__","parameters","_",n.has("semicolon")?{type:"semicolon"}:semicolon],postprocess:e=>e[2]},{name:"parameters",symbols:[n.has("lparen")?{type:"lparen"}:lparen,"_","parameters","_",n.has("rparen")?{type:"rparen"}:rparen],postprocess:e=>e[2]},{name:"parameters",symbols:[n.has("or")?{type:"or"}:or,"_",n.has("annot")?{type:"annot"}:annot,"__",n.has("annot")?{type:"annot"}:annot,"__","parameters","__","parameters"],postprocess:e=>{e[2],e[4];const t=e[6],r=e[8],n=[];for(const e of t){const t={name:e.name,parameters:e.parameters,structure:"(Left "+e.structure+")",generateInvocationString:e.generateInvocationString,generateInvocationPair:e.generateInvocationPair,generateSampleInvocation:e.generateSampleInvocation};n.push(t)}for(const e of r){const t={name:e.name,parameters:e.parameters,structure:"(Right "+e.structure+")",generateInvocationString:e.generateInvocationString,generateInvocationPair:e.generateInvocationPair,generateSampleInvocation:e.generateSampleInvocation};n.push(t)}return n}},{name:"parameters",symbols:[n.has("or")?{type:"or"}:or,"_",n.has("annot")?{type:"annot"}:annot,"__","parameters","__","parameters"],postprocess:e=>{const t=e[2],r=e[4],n=e[6],o=[];for(const e of r){const r={name:`${t}.${e.name}`,parameters:e.parameters,structure:"(Left "+e.structure+")",generateInvocationString:e.generateInvocationString,generateInvocationPair:e.generateInvocationPair,generateSampleInvocation:e.generateSampleInvocation};o.push(r)}for(const e of n){const r={name:`${t}.${e.name}`,parameters:e.parameters,structure:"(Right "+e.structure+")",generateInvocationString:e.generateInvocationString,generateInvocationPair:e.generateInvocationPair,generateSampleInvocation:e.generateSampleInvocation};o.push(r)}return o}},{name:"parameters",symbols:[n.has("or")?{type:"or"}:or,"_","parameters","__","parameters"],postprocess:e=>{const t=e[2],r=e[4],n=[];for(const e of t)1===e.parameters.length&&e.parameters[0].name===e.name&&(e.parameters[0].name=void 0),n.push(Object.assign(Object.assign({},e),{structure:`(Left ${e.structure})`}));for(const e of r)1===e.parameters.length&&e.parameters[0].name===e.name&&(e.parameters[0].name=void 0),n.push(Object.assign(Object.assign({},e),{structure:`(Right ${e.structure})`}));return n}},{name:"parameters",symbols:[n.has("pair")?{type:"pair"}:pair,"__",n.has("annot")?{type:"annot"}:annot,"__",n.has("annot")?{type:"annot"}:annot,"__","parameters","__","parameters"],postprocess:e=>{const t=e[2],r=e[4],n=e[6],o=e[8],s=[];for(const e of n)for(const n of o){const o={name:i(t.toString(),r.toString()),parameters:e.parameters.concat(n.parameters),structure:`(Pair ${e.structure} ${n.structure})`,generateInvocationString:e.generateInvocationString,generateInvocationPair:e.generateInvocationPair,generateSampleInvocation:e.generateSampleInvocation};s.push(o)}return s}},{name:"parameters",symbols:[n.has("pair")?{type:"pair"}:pair,"__",n.has("annot")?{type:"annot"}:annot,"__","parameters","__","parameters"],postprocess:e=>{const t=e[2],r=e[4],n=e[6],o=[];for(const e of r)for(const r of n){const n={name:i(t.toString())||s(t.toString())||void 0,parameters:e.parameters.concat(r.parameters),structure:`(Pair ${e.structure} ${r.structure})`,generateInvocationString:e.generateInvocationString,generateInvocationPair:e.generateInvocationPair,generateSampleInvocation:e.generateSampleInvocation};o.push(n)}return o}},{name:"parameters",symbols:[n.has("pair")?{type:"pair"}:pair,"__","parameters","__","parameters"],postprocess:e=>{const t=e[2],r=e[4],n=[];for(const e of t)for(const t of r){const r={name:void 0,parameters:e.parameters.concat(t.parameters),structure:`(Pair ${e.structure} ${t.structure})`,generateInvocationString:e.generateInvocationString,generateInvocationPair:e.generateInvocationPair,generateSampleInvocation:e.generateSampleInvocation};n.push(r)}return n}},{name:"parameters",symbols:[n.has("singleArgData")?{type:"singleArgData"}:singleArgData,"_",n.has("annot")?{type:"annot"}:annot,"__",n.has("annot")?{type:"annot"}:annot,"__","parameters"],postprocess:e=>{const t=e[0].toString(),r=e[2].toString(),n=e[4].toString(),o=e[6];return o[0].name=s(r,n),o[0].parameters[0].constituentType=o[0].parameters[0].type,"option"===t&&(o[0].parameters[0].optional=!0),o[0].parameters[0].type=`${t} (${o[0].parameters[0].type})`,o[0].structure=`(${o[0].structure})`,o}},{name:"parameters",symbols:[n.has("singleArgData")?{type:"singleArgData"}:singleArgData,"_",n.has("annot")?{type:"annot"}:annot,"__","parameters"],postprocess:e=>{const t=e[0].toString(),r=e[2].toString(),n=e[4];return n[0].name=s(r),n[0].parameters[0].constituentType=n[0].parameters[0].type,"option"===t&&(n[0].parameters[0].optional=!0),n[0].parameters[0].type=`${t} (${n[0].parameters[0].type})`,n[0].structure=`(${n[0].structure})`,n}},{name:"parameters",symbols:[n.has("singleArgData")?{type:"singleArgData"}:singleArgData,"_","parameters"],postprocess:e=>{const t=e[0].toString(),r=e[2];return r[0].parameters[0].constituentType=r[0].parameters[0].type,"option"===t&&(r[0].parameters[0].optional=!0),r[0].parameters[0].type=`${t} (${r[0].parameters[0].type})`,r[0].structure=`(${r[0].structure})`,r}},{name:"parameters",symbols:[n.has("doubleArgData")?{type:"doubleArgData"}:doubleArgData,"_",n.has("annot")?{type:"annot"}:annot,"__",n.has("annot")?{type:"annot"}:annot,"__","parameters","__","parameters"],postprocess:e=>{const t=e[0].toString(),r=e[2].toString(),n=e[4].toString(),o=e[6],i=e[8];return o[0].name=s(r,n),o[0].parameters[0].type=`${t} (${o[0].parameters[0].type}) (${i[0].parameters[0].type})`,o[0].structure=`(${o[0].structure})`,o}},{name:"parameters",symbols:[n.has("doubleArgData")?{type:"doubleArgData"}:doubleArgData,"_",n.has("annot")?{type:"annot"}:annot,"__","parameters","__","parameters"],postprocess:e=>{const t=e[0].toString(),r=e[2].toString(),n=e[4],o=e[6];return n[0].name=s(r),n[0].parameters[0].type=`${t} (${n[0].parameters[0].type}) (${o[0].parameters[0].type})`,n[0].structure=`(${n[0].structure})`,n}},{name:"parameters",symbols:[n.has("doubleArgData")?{type:"doubleArgData"}:doubleArgData,"_","parameters","__","parameters"],postprocess:e=>{const t=e[0].toString(),r=e[2],n=e[4];return r[0].parameters[0].type=`${t} (${r[0].parameters[0].type}) (${n[0].parameters[0].type})`,r[0].structure=`(${r[0].structure})`,r}},{name:"parameters",symbols:[n.has("data")?{type:"data"}:data,"__",n.has("annot")?{type:"annot"}:annot],postprocess:o},{name:"parameters",symbols:[n.has("data")?{type:"data"}:data,"__",n.has("annot")?{type:"annot"}:annot,"__",n.has("annot")?{type:"annot"}:annot],postprocess:o},{name:"parameters",symbols:[n.has("data")?{type:"data"}:data],postprocess:o},{name:"_$ebnf$1",symbols:[]},{name:"_$ebnf$1",symbols:["_$ebnf$1",/[\s]/],postprocess:e=>e[0].concat([e[1]])},{name:"_",symbols:["_$ebnf$1"]},{name:"__",symbols:[/[\s]/]}],ParserStart:"entry"};t.default=c},function(module,exports){var indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0;r<e.length;r++)if(e[r]===t)return r;return-1},Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var r in e)t.push(r);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t(e[r],r,e)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(e,t,r){Object.defineProperty(e,t,{writable:!0,enumerable:!1,configurable:!0,value:r})}}catch(e){return function(e,t,r){e[t]=r}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(e){if(!(this instanceof Script))return new Script(e);this.code=e};Script.prototype.runInContext=function(e){if(!(e instanceof Context))throw new TypeError("needs a 'context' argument.");var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var r=t.contentWindow,n=r.eval,o=r.execScript;!n&&o&&(o.call(r,"null"),n=r.eval),forEach(Object_keys(e),(function(t){r[t]=e[t]})),forEach(globals,(function(t){e[t]&&(r[t]=e[t])}));var s=Object_keys(r),i=n.call(r,this.code);return forEach(Object_keys(r),(function(t){(t in e||-1===indexOf(s,t))&&(e[t]=r[t])})),forEach(globals,(function(t){t in e||defineProp(e,t,r[t])})),document.body.removeChild(t),i},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(e){var t=Script.createContext(e),r=this.runInContext(t);return e&&forEach(Object_keys(t),(function(r){e[r]=t[r]})),r},forEach(Object_keys(Script.prototype),(function(e){exports[e]=Script[e]=function(t){var r=Script(t);return r[e].apply(r,[].slice.call(arguments,1))}})),exports.isContext=function(e){return e instanceof Context},exports.createScript=function(e){return exports.Script(e)},exports.createContext=Script.createContext=function(e){var t=new Context;return"object"==typeof e&&forEach(Object_keys(e),(function(r){t[r]=e[r]})),t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(22);class o extends n.ServiceRequestError{constructor(e,t,r,n){super(e,t,r,null),this.requestBody=n}toString(){return`TezosRequestError for ${this.serverURL} with ${this.httpStatus} and ${this.httpMessage}`}}t.TezosRequestError=o;class s extends n.ServiceResponseError{constructor(e,t,r,n,o,s){super(e,t,r,n,o),this.kind=s}}t.TezosResponseError=s,function(e){e.TEXT="Text",e.JSONTYPE1="JSONType1",e.JSONTYPE2="JSONType2"}(t.TezosResponseErrorKind||(t.TezosResponseErrorKind={}))},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});const n=r(5),o=r(9),s=new Map([[0,"endorsement"],[1,"seedNonceRevelation"],[2,"doubleEndorsementEvidence"],[3,"doubleBakingEvidence"],[4,"accountActivation"],[5,"proposal"],[6,"ballot"],[7,"reveal"],[8,"transaction"],[9,"origination"],[10,"delegation"],[107,"reveal"],[108,"transaction"],[109,"origination"],[110,"delegation"]]),i=[...s.keys()].reduce((e,t)=>{const r=s.get(t)||"";return e[r]>t?e:Object.assign(Object.assign({},e),{[r]:t})},new Map);!function(t){function r(e){return s.get(n.TezosMessageUtils.readInt(e))||""}function a(e){return r(e.substring(64,66))}function u(e,t,r=!0){switch(t){case"endorsement":case"seedNonceRevelation":case"doubleEndorsementEvidence":case"doubleBakingEvidence":case"accountActivation":case"proposal":throw new Error("Unsupported operation type: "+t);case"ballot":return l(e,r);case"reveal":return f(e,r);case"transaction":return d(e,r);case"origination":return m(e,r);case"delegation":return b(e,r);default:throw new Error("Unsupported operation type: "+t)}}function c(e){let t=n.TezosMessageUtils.writeInt(i.accountActivation);return t+=n.TezosMessageUtils.writeAddress(e.pkh).slice(4),t+=e.secret,t}function l(t,o=!0){if("ballot"!==r(o?t.substring(64,66):t.substring(0,2)))throw new Error("Provided operation is not a ballot");let s=0,i="";o?(i=n.TezosMessageUtils.readBranch(t.substring(s,s+64)),s+=66):s+=2;const a=n.TezosMessageUtils.readAddress(t.substring(s,s+42));s+=42;const u=parseInt(t.substring(s,s+8),16);s+=8;const c=n.TezosMessageUtils.readBufferWithHint(e.from(t.substring(s,s+64),"hex"),"p");s+=64;const l=parseInt(t.substring(s,s+1),16);let p;s+=2,t.length>s&&(p=r(t.substring(s,s+2)));return{operation:{kind:"ballot",source:a,period:u,proposal:c,vote:l},branch:i,next:p,nextoffset:p?s:-1}}function p(e){let t=n.TezosMessageUtils.writeInt(i.ballot);return t+=n.TezosMessageUtils.writeAddress(e.source).slice(2),t+=("00000000"+e.period.toString(16)).slice(-8),t+=n.TezosMessageUtils.writeBufferWithHint(e.proposal).toString("hex").slice(4),t+=("00"+e.vote.toString(16)).slice(-2),t}function f(e,t=!0){let o=t?e.substring(64,66):e.substring(0,2);if("reveal"!==r(o))throw new Error("Provided operation is not a reveal.");let s=0,i="";t?(i=n.TezosMessageUtils.readBranch(e.substring(s,s+64)),s+=66):s+=2;let a="";parseInt(o,16)<100?(a=n.TezosMessageUtils.readAddress(e.substring(s,s+44)),s+=44):(a=n.TezosMessageUtils.readAddress(e.substring(s,s+42)),s+=42);let u=n.TezosMessageUtils.findInt(e,s);s+=u.length;let c=n.TezosMessageUtils.findInt(e,s);s+=c.length;let l=n.TezosMessageUtils.findInt(e,s);s+=l.length;let p=n.TezosMessageUtils.findInt(e,s);s+=p.length;let f,h=n.TezosMessageUtils.readPublicKey(e.substring(s,s+66));s+=66,e.length>s&&(f=r(e.substring(s,s+2)));return{operation:{kind:"reveal",source:a,public_key:h,fee:u.value+"",gas_limit:l.value+"",storage_limit:p.value+"",counter:c.value+""},branch:i,next:f,nextoffset:f?s:-1}}function h(e){if("reveal"!==e.kind)throw new Error("Incorrect operation type.");let t=n.TezosMessageUtils.writeInt(i.reveal);return t+=n.TezosMessageUtils.writeAddress(e.source).slice(2),t+=n.TezosMessageUtils.writeInt(parseInt(e.fee)),t+=n.TezosMessageUtils.writeInt(parseInt(e.counter)),t+=n.TezosMessageUtils.writeInt(parseInt(e.gas_limit)),t+=n.TezosMessageUtils.writeInt(parseInt(e.storage_limit)),t+=n.TezosMessageUtils.writePublicKey(e.public_key),t}function d(t,s=!0){let i=s?t.substring(64,66):t.substring(0,2);if("transaction"!==r(i))throw new Error("Provided operation is not a transaction.");let a=0,u="";s?(u=n.TezosMessageUtils.readBranch(t.substring(a,a+64)),a+=66):a+=2;let c="";parseInt(i,16)<100?(c=n.TezosMessageUtils.readAddress(t.substring(a,a+44)),a+=44):(c=n.TezosMessageUtils.readAddress(t.substring(a,a+42)),a+=42);let l=n.TezosMessageUtils.findInt(t,a);a+=l.length;let p=n.TezosMessageUtils.findInt(t,a);a+=p.length;let f=n.TezosMessageUtils.findInt(t,a);a+=f.length;let h=n.TezosMessageUtils.findInt(t,a);a+=h.length;let d=n.TezosMessageUtils.findInt(t,a);a+=d.length;let g=n.TezosMessageUtils.readAddress(t.substring(a,a+44));a+=44;let m=n.TezosMessageUtils.readBoolean(t.substring(a,a+2));a+=2;let y,b="";if(m&&parseInt(i,16)<100){const e=parseInt(t.substring(a,a+8),16);a+=8;const r=o.TezosLanguageUtil.hexToMicheline(t.substring(a));if(b=r.code,r.consumed!==2*e)throw new Error("Failed to parse transaction parameters: length mismatch");a+=2*e}else if(m&&parseInt(i,16)>100){const r=parseInt(t.substring(a,a+2),16);a+=2;let n="";if(255===r){const r=parseInt(t.substring(a,a+2),16);a+=2,n=e.from(t.substring(a,a+2*r),"hex").toString(),a+=2*r}else 0===r?n="default":1===r?n="root":2===r?n="do":3===r?n="set_delegate":4===r&&(n="remove_delegate");const s=parseInt(t.substring(a,a+8),16);a+=8;const i=o.TezosLanguageUtil.hexToMicheline(t.substring(a)),u=i.code;if(i.consumed!==2*s)throw new Error("Failed to parse transaction parameters: length mismatch");a+=2*s,b={entrypoint:n,value:u}}t.length>a&&(y=r(t.substring(a,a+2)));return{operation:{kind:"transaction",source:c,destination:g,amount:d.value.toString(),fee:l.value.toString(),gas_limit:f.value.toString(),storage_limit:h.value.toString(),counter:p.value.toString(),parameters:b},branch:u,next:y,nextoffset:y?a:-1}}function g(e){if("transaction"!==e.kind)throw new Error("Incorrect operation type");let t=n.TezosMessageUtils.writeInt(i.transaction);if(t+=n.TezosMessageUtils.writeAddress(e.source).slice(2),t+=n.TezosMessageUtils.writeInt(parseInt(e.fee)),t+=n.TezosMessageUtils.writeInt(parseInt(e.counter)),t+=n.TezosMessageUtils.writeInt(parseInt(e.gas_limit)),t+=n.TezosMessageUtils.writeInt(parseInt(e.storage_limit)),t+=n.TezosMessageUtils.writeInt(parseInt(e.amount)),t+=n.TezosMessageUtils.writeAddress(e.destination),e.parameters){const r=e.parameters,n=o.TezosLanguageUtil.normalizeMichelineWhiteSpace(JSON.stringify(r.value)),s=o.TezosLanguageUtil.translateMichelineToHex(n);"default"!==r.entrypoint&&""!==r.entrypoint||"030b"!==s?(t+="ff","default"===r.entrypoint||""===r.entrypoint?t+="00":"root"===r.entrypoint?t+="01":"do"===r.entrypoint?t+="02":"set_delegate"===r.entrypoint?t+="03":"remove_delegate"===r.entrypoint?t+="04":t+="ff"+("0"+r.entrypoint.length.toString(16)).slice(-2)+r.entrypoint.split("").map(e=>e.charCodeAt(0).toString(16)).join(""),t+=("0000000"+(s.length/2).toString(16)).slice(-8)+s):t+="00"}else t+="00";return t}function m(e,t=!0){let s=t?e.substring(64,66):e.substring(0,2);if("origination"!==r(s))throw new Error("Provided operation is not an origination.");let i=0,a="";t?(a=n.TezosMessageUtils.readBranch(e.substring(i,i+64)),i+=66):i+=2;let u="";parseInt(s,16)<100?(u=n.TezosMessageUtils.readAddress(e.substring(i,i+44)),i+=44):(u=n.TezosMessageUtils.readAddress(e.substring(i,i+42)),i+=42);let c=n.TezosMessageUtils.findInt(e,i);i+=c.length;let l=n.TezosMessageUtils.findInt(e,i);i+=l.length;let p=n.TezosMessageUtils.findInt(e,i);i+=p.length;let f=n.TezosMessageUtils.findInt(e,i);i+=f.length;let h="";parseInt(s,16)<100&&(h=n.TezosMessageUtils.readAddress(e.substring(i,i+42)),i+=42);let d=n.TezosMessageUtils.findInt(e,i);i+=d.length;let g=!1,m=!1;parseInt(s,16)<100&&(g=n.TezosMessageUtils.readBoolean(e.substring(i,i+2)),i+=2,m=n.TezosMessageUtils.readBoolean(e.substring(i,i+2)),i+=2);let y=n.TezosMessageUtils.readBoolean(e.substring(i,i+2));i+=2;let b="";y&&(b=n.TezosMessageUtils.readAddress(e.substring(i,i+42)),i+=42);let P=!0;parseInt(s,16)<100&&(P=n.TezosMessageUtils.readBoolean(e.substring(i,i+2)),i+=2);let D,$={};if(P){let t=parseInt(e.substring(i,i+8),16);i+=8;const r=o.TezosLanguageUtil.hexToMicheline(e.substring(i,i+2*t)).code;i+=2*t;let n=parseInt(e.substring(i,i+8),16);i+=8;const s=o.TezosLanguageUtil.hexToMicheline(e.substring(i,i+2*n)).code;i+=2*n,$=JSON.parse(`{ "script": [ ${r}, ${s} ] }`)}e.length>i&&(D=r(e.substring(i,i+2)));let v={kind:"origination",source:u,balance:d.value+"",delegate:y?b:void 0,fee:c.value+"",gas_limit:p.value+"",storage_limit:f.value+"",counter:l.value+"",script:P?$:void 0};parseInt(s,16)<100&&(v.manager_pubkey=h,v.spendable=g,v.delegatable=m);return{operation:v,branch:a,next:D,nextoffset:D?i:-1}}function y(e){if("origination"!==e.kind)throw new Error("Incorrect operation type");let t=n.TezosMessageUtils.writeInt(i.origination);if(t+=n.TezosMessageUtils.writeAddress(e.source).slice(2),t+=n.TezosMessageUtils.writeInt(parseInt(e.fee)),t+=n.TezosMessageUtils.writeInt(parseInt(e.counter)),t+=n.TezosMessageUtils.writeInt(parseInt(e.gas_limit)),t+=n.TezosMessageUtils.writeInt(parseInt(e.storage_limit)),t+=n.TezosMessageUtils.writeInt(parseInt(e.balance)),void 0!==e.delegate?(t+=n.TezosMessageUtils.writeBoolean(!0),t+=n.TezosMessageUtils.writeAddress(e.delegate).slice(2)):t+=n.TezosMessageUtils.writeBoolean(!1),e.script){let r=[];r.push(e.script.code),r.push(e.script.storage),t+=r.map(e=>o.TezosLanguageUtil.normalizeMichelineWhiteSpace(JSON.stringify(e))).map(e=>o.TezosLanguageUtil.translateMichelineToHex(e)).reduce((e,t)=>e+("0000000"+(t.length/2).toString(16)).slice(-8)+t,"")}return t}function b(e,t=!0){let o=t?e.substring(64,66):e.substring(0,2);if("delegation"!==r(o))throw new Error("Provided operation is not a delegation.");let s=0,i="";t?(i=n.TezosMessageUtils.readBranch(e.substring(s,s+64)),s+=66):s+=2;let a="";parseInt(o,16)<100?(a=n.TezosMessageUtils.readAddress(e.substring(s,s+44)),s+=44):(a=n.TezosMessageUtils.readAddress(e.substring(s,s+42)),s+=42);let u=n.TezosMessageUtils.findInt(e,s);s+=u.length;let c=n.TezosMessageUtils.findInt(e,s);s+=c.length;let l=n.TezosMessageUtils.findInt(e,s);s+=l.length;let p=n.TezosMessageUtils.findInt(e,s);s+=p.length;let f=n.TezosMessageUtils.readBoolean(e.substring(s,s+2));s+=2;let h,d="";f&&(d=n.TezosMessageUtils.readAddress(e.substring(s,s+42)),s+=42),e.length>s&&(h=r(e.substring(s,s+2)));return{operation:{kind:"delegation",source:a,delegate:f?d:void 0,fee:u.value+"",gas_limit:l.value+"",storage_limit:p.value+"",counter:c.value+""},branch:i,next:h,nextoffset:h?s:-1}}function P(e){if("delegation"!==e.kind)throw new Error("Incorrect operation type");let t=n.TezosMessageUtils.writeInt(i.delegation);return t+=n.TezosMessageUtils.writeAddress(e.source).slice(2),t+=n.TezosMessageUtils.writeInt(parseInt(e.fee)),t+=n.TezosMessageUtils.writeInt(parseInt(e.counter)),t+=n.TezosMessageUtils.writeInt(parseInt(e.gas_limit)),t+=n.TezosMessageUtils.writeInt(parseInt(e.storage_limit)),void 0!==e.delegate&&""!==e.delegate?(t+=n.TezosMessageUtils.writeBoolean(!0),t+=n.TezosMessageUtils.writeAddress(e.delegate).slice(2)):t+=n.TezosMessageUtils.writeBoolean(!1),t}t.getOperationType=r,t.idFirstOperation=a,t.parseOperation=u,t.encodeOperation=function(e){if(e.hasOwnProperty("pkh")&&e.hasOwnProperty("secret"))return c(e);if(e.hasOwnProperty("kind")){const t=e;if("reveal"===t.kind)return h(e);if("transaction"===t.kind)return g(e);if("origination"===t.kind)return y(e);if("delegation"===t.kind)return P(e)}if(e.hasOwnProperty("vote"))return p(e);throw new Error("Unsupported message type")},t.encodeActivation=c,t.parseBallot=l,t.encodeBallot=p,t.parseReveal=f,t.encodeReveal=h,t.parseTransaction=d,t.encodeTransaction=g,t.parseOrigination=m,t.encodeOrigination=y,t.parseDelegation=b,t.encodeDelegation=P,t.parseOperationGroup=function(e){let t=[],r=u(e,a(e));t.push(r.operation);let n=0;for(;r.next;)n+=r.nextoffset,r=u(e.substring(n),r.next,!1),t.push(r.operation);return t}}(t.TezosMessageCodec||(t.TezosMessageCodec={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(19),i=r(4),a=r(7),u=o(r(10)).default.log;class c{constructor(e,t,r,n){this.triggerTimestamp=0,this.server=e,this.keyStore=r,this.signer=t,this.delay=n,this.operations=[]}static createQueue(e,t,r,n=s.TezosConstants.DefaultBatchDelay){return new c(e,t,r,n)}addOperations(...e){0===this.operations.length&&(this.triggerTimestamp=Date.now(),setTimeout(()=>{this.sendOperations()},1e3*this.delay)),e.forEach(e=>this.operations.push(e))}getStatus(){return this.operations.length}sendOperations(){return n(this,void 0,void 0,(function*(){let e=(yield i.TezosNodeReader.getCounterForAccount(this.server,this.keyStore.publicKeyHash))+1,t=[];const r=this.operations.length;for(let n=0;n<r;n++){let r=this.operations.shift();r.counter&&(r.counter=""+e++),t.push(r)}this.operations.length>0&&(this.triggerTimestamp=Date.now(),setTimeout(()=>{this.sendOperations()},1e3*this.delay));try{yield a.TezosNodeWriter.sendOperation(this.server,t,this.signer)}catch(e){u.error("Error sending queued operations: "+e)}}))}}t.TezosOperationQueue=c},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=r(6),i=o(r(3)),a=r(19),u=r(4),c=r(7),l=r(8);!function(e){function t(e,t,r,n,o,s,u){let l=`[ { "prim": "DROP" },\n { "prim": "NIL", "args": [ { "prim": "operation" } ] },\n { "prim": "PUSH", "args": [ { "prim": "key_hash" }, { "string": "${u}" } ] },\n { "prim": "IMPLICIT_ACCOUNT" },\n { "prim": "PUSH", "args": [ { "prim": "mutez" }, { "int": "${s}" } ] },\n { "prim": "UNIT" },\n { "prim": "TRANSFER_TOKENS" },\n { "prim": "CONS" } ]`;return c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,n,0,o,a.TezosConstants.P005ManagerContractWithdrawalStorageLimit,a.TezosConstants.P005ManagerContractWithdrawalGasLimit,"do",l,i.TezosParameterFormat.Micheline)}e.verifyDestination=function(e,t){return n(this,void 0,void 0,(function*(){return l.TezosContractUtils.verifyDestination(e,t,"d99cb8b4c7e40166f59c0f3c30724225")}))},e.verifyScript=function(e){return l.TezosContractUtils.verifyScript(e,"a585489ffaee60d07077059539d5bfc8")},e.getSimpleStorage=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield u.TezosNodeReader.getContractStorage(e,t);return{administrator:s.JSONPath({path:"$.string",json:r})[0]}}))},e.setDelegate=function(e,t,r,n,o,s){if(n.startsWith("KT1")){const u=`[{ "prim": "DROP" }, { "prim": "NIL", "args": [{ "prim": "operation" }] }, { "prim": "PUSH", "args": [{ "prim": "key_hash" }, { "string": "${o}" } ] }, { "prim": "SOME" }, { "prim": "SET_DELEGATE" }, { "prim": "CONS" } ]`;return c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,n,0,s,0,a.TezosConstants.P005ManagerContractWithdrawalGasLimit,"do",u,i.TezosParameterFormat.Micheline)}return c.TezosNodeWriter.sendDelegationOperation(e,t,r,o,s)},e.unSetDelegate=function(e,t,r,n,o){if(n.startsWith("KT1")){const s='[{ "prim": "DROP" }, { "prim": "NIL", "args": [{ "prim": "operation" }] }, { "prim": "NONE", "args": [{ "prim": "key_hash" }] }, { "prim": "SET_DELEGATE" }, { "prim": "CONS" } ]';return c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,n,0,o,0,a.TezosConstants.P005ManagerContractWithdrawalGasLimit,"do",s,i.TezosParameterFormat.Micheline)}return c.TezosNodeWriter.sendUndelegationOperation(e,t,r,o)},e.withdrawDelegatedFunds=function(e,r,n,o,s,i){return t(e,r,n,o,s,i,n.publicKeyHash)},e.sendDelegatedFunds=t,e.depositDelegatedFunds=function(e,t,r,n,o,s){return c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,n,s,o,0,a.TezosConstants.P005ManagerContractDepositGasLimit,void 0,void 0)},e.deployManagerContract=function(e,t,r,n,o,s){const a=`{ "string": "${r.publicKeyHash}" }`;return c.TezosNodeWriter.sendContractOriginationOperation(e,t,r,s,n,o,600,2e4,'[ { "prim": "parameter",\n "args":\n [ { "prim": "or",\n "args":\n [ { "prim": "lambda",\n "args":\n [ { "prim": "unit" }, { "prim": "list", "args": [ { "prim": "operation" } ] } ], "annots": [ "%do" ] },\n { "prim": "unit", "annots": [ "%default" ] } ] } ] },\n { "prim": "storage", "args": [ { "prim": "key_hash" } ] },\n { "prim": "code",\n "args":\n [ [ [ [ { "prim": "DUP" }, { "prim": "CAR" },\n { "prim": "DIP", "args": [ [ { "prim": "CDR" } ] ] } ] ],\n { "prim": "IF_LEFT",\n "args":\n [ [ { "prim": "PUSH", "args": [ { "prim": "mutez" }, { "int": "0" } ] },\n { "prim": "AMOUNT" },\n [ [ { "prim": "COMPARE" }, { "prim": "EQ" } ],\n { "prim": "IF", "args": [ [], [ [ { "prim": "UNIT" }, { "prim": "FAILWITH" } ] ] ] } ],\n [ { "prim": "DIP", "args": [ [ { "prim": "DUP" } ] ] },\n { "prim": "SWAP" } ],\n { "prim": "IMPLICIT_ACCOUNT" },\n { "prim": "ADDRESS" },\n { "prim": "SENDER" },\n [ [ { "prim": "COMPARE" }, { "prim": "EQ" } ],\n { "prim": "IF", "args": [ [], [ [ { "prim": "UNIT" },{ "prim": "FAILWITH" } ] ] ] } ],\n { "prim": "UNIT" }, { "prim": "EXEC" },\n { "prim": "PAIR" } ],\n [ { "prim": "DROP" },\n { "prim": "NIL", "args": [ { "prim": "operation" } ] },\n { "prim": "PAIR" } ] ] } ] ] } ]',a,i.TezosParameterFormat.Micheline)}}(t.BabylonDelegationHelper||(t.BabylonDelegationHelper={}))},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=r(6),i=o(r(3)),a=r(5),u=r(4),c=r(7),l=r(8),p=r(3);!function(t){t.verifyDestination=function(e,t){return n(this,void 0,void 0,(function*(){return l.TezosContractUtils.verifyDestination(e,t,"c020219e31ee3b462ed93c33124f117f")}))},t.commitName=function(t,r,o,s,u,f,h,d,g){return n(this,void 0,void 0,(function*(){const n=`(Pair "${u}" (Pair ${f} 0x${a.TezosMessageUtils.writeAddress(o.publicKeyHash)}))`,m=a.TezosMessageUtils.writePackedData(n,"record",p.TezosParameterFormat.Michelson),y="0x"+a.TezosMessageUtils.simpleHash(e.from(m,"hex"),32).toString("hex");if(!d||!g){const e=yield c.TezosNodeWriter.testContractInvocationOperation(t,"main",o,s,0,h,6e3,5e5,"commit",y,i.TezosParameterFormat.Michelson);d||(d=Number(e.storageCost)||0),g||(g=Number(e.gas)+300)}const b=yield c.TezosNodeWriter.sendContractInvocationOperation(t,r,o,s,0,h,d,g,"commit",y,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(b.operationGroupID)}))},t.registerName=function(e,t,r,o,s,a,u,p,f,h,d){return n(this,void 0,void 0,(function*(){const n=`(Pair ${u} (Pair "${s}" ${a}))`;if(!h||!d){const t=yield c.TezosNodeWriter.testContractInvocationOperation(e,"main",r,o,p,f,6e3,5e5,"registerName",n,i.TezosParameterFormat.Michelson);h||(h=Number(t.storageCost)||0),d||(d=Number(t.gas)+300)}const g=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,p,f,h,d,"registerName",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(g.operationGroupID)}))},t.updateRegistrationPeriod=function(e,t,r,o,s,a,u,p,f,h){return n(this,void 0,void 0,(function*(){const n=`(Pair "${s}" ${a})`;if(!f||!h){const t=yield c.TezosNodeWriter.testContractInvocationOperation(e,"main",r,o,u,p,1e3,1e5,"updateRegistrationPeriod",n,i.TezosParameterFormat.Michelson);f||(f=Number(t.storageCost)||0),h||(h=Number(t.gas)+300)}const d=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,u,p,f,h,"updateRegistrationPeriod",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(d.operationGroupID)}))},t.setPrimaryName=function(e,t,r,o,s,a,u,p){return n(this,void 0,void 0,(function*(){const n=`"${s}"`;if(!u||!p){const t=yield c.TezosNodeWriter.testContractInvocationOperation(e,"main",r,o,0,a,1e3,1e5,"setPrimaryName",n,i.TezosParameterFormat.Michelson);u||(u=Number(t.storageCost)||0),p||(p=Number(t.gas)+300)}const f=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,a,u,p,"deleteName",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(f.operationGroupID)}))},t.deleteName=function(e,t,r,o,s,a,u,p){return n(this,void 0,void 0,(function*(){const n=`"${s}"`;if(!u||!p){const t=yield c.TezosNodeWriter.testContractInvocationOperation(e,"main",r,o,0,a,1e3,1e5,"deleteName",n,i.TezosParameterFormat.Michelson);u||(u=Number(t.storageCost)||0),p||(p=Number(t.gas)+300)}const f=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,a,u,p,"deleteName",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(f.operationGroupID)}))},t.getNameForAddress=function(t,r,o){return n(this,void 0,void 0,(function*(){const n=a.TezosMessageUtils.encodeBigMapKey(e.from(a.TezosMessageUtils.writePackedData(o,"address"),"hex"));try{const e=yield u.TezosNodeReader.getValueForBigMapKey(t,r,n);return s.JSONPath({path:"$.string",json:e})[0]}catch(e){}return""}))},t.getNameInfo=function(t,r,o){return n(this,void 0,void 0,(function*(){const n=a.TezosMessageUtils.encodeBigMapKey(e.from(a.TezosMessageUtils.writePackedData(o,"string"),"hex")),i=yield u.TezosNodeReader.getValueForBigMapKey(t,r,n);return{name:s.JSONPath({path:"$.args[0].args[1].string",json:i})[0],modified:Boolean(s.JSONPath({path:"$.args[0].args[0].prim",json:i})[0]),owner:s.JSONPath({path:"$.args[1].args[0].string",json:i})[0],registeredAt:new Date(s.JSONPath({path:"$.args[1].args[1].args[0].string",json:i})[0]),registrationPeriod:s.JSONPath({path:"$.args[1].args[1].args[1].int",json:i})[0]}}))},t.getSimpleStorage=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield u.TezosNodeReader.getContractStorage(e,t);return{addressMap:Number(s.JSONPath({path:"$.args[0].args[0].args[0].int",json:r})[0]),commitmentMap:Number(s.JSONPath({path:"$.args[0].args[0].args[1].int",json:r})[0]),manager:s.JSONPath({path:"$.args[0].args[1].args[0].string",json:r})[0],interval:Number(s.JSONPath({path:"$.args[0].args[1].args[1].int",json:r})[0]),maxCommitTime:Number(s.JSONPath({path:"$.args[1].args[0].args[0].int",json:r})[0]),maxDuration:Number(s.JSONPath({path:"$.args[1].args[0].args[1].int",json:r})[0]),minCommitTime:Number(s.JSONPath({path:"$.args[1].args[1].args[0].int",json:r})[0]),nameMap:Number(s.JSONPath({path:"$.args[1].args[1].args[1].args[0].int",json:r})[0]),intervalFee:Number(s.JSONPath({path:"$.args[1].args[1].args[1].args[1].int",json:r})[0])}}))}}(t.CryptonomicNameServiceHelper||(t.CryptonomicNameServiceHelper={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const i=o(r(24)),a=r(6),u=s(r(3)),c=r(4),l=r(7),p=r(8),f=r(5);!function(t){function r(e,t,r){return i.default(e).multiply(i.default(t)).divide(i.default(r)).toJSNumber()}t.verifyDestination=function(e,t){return n(this,void 0,void 0,(function*(){return p.TezosContractUtils.verifyDestination(e,t,"a72954311c48dcc28279590d82870611")}))},t.verifyScript=function(e){return p.TezosContractUtils.verifyScript(e,"yyy")},t.getSimpleStorage=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield c.TezosNodeReader.getContractStorage(e,t);return{balanceMap:Number(a.JSONPath({path:"$.args[0].int",json:r})[0]),administrator:a.JSONPath({path:"$.args[1].args[1].args[0].args[0].string",json:r})[0],token:a.JSONPath({path:"$.args[1].args[1].args[0].args[1].string",json:r})[0],tokenBalance:Number(a.JSONPath({path:"$.args[1].args[1].args[1].args[1].int",json:r})[0]),xtzBalance:Number(a.JSONPath({path:"$.args[1].args[1].args[1].args[0].int",json:r})[0]),selfIsUpdatingTokenPool:a.JSONPath({path:"$.args[1].args[0].args[0].prim",json:r})[0].toString().toLowerCase().startsWith("t"),freeze_baker:a.JSONPath({path:"$.args[1].args[0].args[1].args[0].prim",json:r})[0].toString().toLowerCase().startsWith("t"),lqt_total:Number(a.JSONPath({path:"$.args[1].args[0].args[1].args[1].int",json:r})[0])}}))},t.getAccountBalance=function(t,r,o){return n(this,void 0,void 0,(function*(){try{const n=f.TezosMessageUtils.encodeBigMapKey(e.from(f.TezosMessageUtils.writePackedData(o,"address"),"hex")),s=yield c.TezosNodeReader.getValueForBigMapKey(t,r,n);if(void 0===s)throw new Error(`Map ${r} does not contain a record for ${o}`);const i=a.JSONPath({path:"$.args[0].int",json:s});return Number(i[0])}catch(e){return 0}}))},t.getAccountAllowance=function(t,r,o,s){return n(this,void 0,void 0,(function*(){const n=f.TezosMessageUtils.encodeBigMapKey(e.from(f.TezosMessageUtils.writePackedData(o,"address"),"hex")),i=yield c.TezosNodeReader.getValueForBigMapKey(t,r,n);if(void 0===i)throw new Error(`Map ${r} does not contain a record for ${o}/${s}`);let u=new Map;return a.JSONPath({path:"$.args[1][*].args",json:i}).forEach(e=>u[e[0].string]=Number(e[1].int)),u[s]||0}))},t.addLiquidity=function(e,t,r,o,s,i,a,c,f){return n(this,void 0,void 0,(function*(){const n=`(Pair (Pair "${r.publicKeyHash}" ${i}) (Pair ${c} "${f.toISOString()}"))`,h=yield l.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,a,s,5e3,5e5,"addLiquidity",n,u.TezosParameterFormat.Michelson);return p.TezosContractUtils.clearRPCOperationGroupHash(h.operationGroupID)}))},t.removeLiquidity=function(e,t,r,o,s,i,a,c,f){return n(this,void 0,void 0,(function*(){const n=`(Pair (Pair "${r.publicKeyHash}" (Pair "${r.publicKeyHash}" ${i})) (Pair ${a} (Pair ${c} "${f.toISOString()}")))`,h=yield l.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,5e3,5e5,"removeLiquidity",n,u.TezosParameterFormat.Michelson);return p.TezosContractUtils.clearRPCOperationGroupHash(h.operationGroupID)}))},t.xtzToToken=function(e,t,r,o,s,i,a,c){return n(this,void 0,void 0,(function*(){const n=`(Pair "${r.publicKeyHash}" (Pair ${a} "${c.toISOString()}"))`,f=yield l.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,i,s,5e3,5e5,"xtzToToken",n,u.TezosParameterFormat.Michelson);return p.TezosContractUtils.clearRPCOperationGroupHash(f.operationGroupID)}))},t.tokenToXtz=function(e,t,r,o,s,i,a,c){return n(this,void 0,void 0,(function*(){const n=`(Pair (Pair "${r.publicKeyHash}" "${r.publicKeyHash}") (Pair ${a} (Pair ${i} "${c.toISOString()}")))`,f=yield l.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,5e3,5e5,"tokenToXtz",n,u.TezosParameterFormat.Michelson);return p.TezosContractUtils.clearRPCOperationGroupHash(f.operationGroupID)}))},t.tokenToToken=function(e,t,r,o,s,i,a,c,f){return n(this,void 0,void 0,(function*(){const n=`(Pair (Pair "${i}" (Pair ${c} "${r.publicKeyHash}")) (Pair "${r.publicKeyHash}" (Pair ${a} "${f.toISOString()}")))`,h=yield l.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,5e3,1e6,"tokenToToken",n,u.TezosParameterFormat.Michelson);return p.TezosContractUtils.clearRPCOperationGroupHash(h.operationGroupID)}))},t.approve=function(e,t,r,o,s,i,a,c){return n(this,void 0,void 0,(function*(){const n=`(Pair "${i}" (Pair ${a} ${c}))`,f=yield l.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,5e3,5e5,"approve",n,u.TezosParameterFormat.Michelson);return p.TezosContractUtils.clearRPCOperationGroupHash(f.operationGroupID)}))},t.previewTransactions=function(){return n(this,void 0,void 0,(function*(){}))},t.calcTokenLiquidityRequirement=r,t.getTokenExchangeRate=function(e,t,r,n=6){const o=i.default(e).multiply(i.default(t)).multiply(i.default(997)),s=i.default(r).multiply(i.default(1e3)).add(i.default(e).multiply(i.default(997))),a=o.divide(s),u=a.divmod(i.default(e)),c=u.remainder.multiply(i.default(10**n)).divide(i.default(e));return{tokenAmount:a.toJSNumber(),rate:parseFloat(`${u.quotient.toJSNumber()}.${c.toJSNumber()}`)}},t.getXTZExchangeRate=function(e,t,r,n=6){const o=i.default(e).multiply(i.default(r)).multiply(i.default(997)),s=i.default(t).multiply(i.default(1e3)).add(i.default(e).multiply(i.default(997))),a=o.divide(s),u=a.divmod(i.default(e)),c=u.remainder.multiply(i.default(10**n)).divide(i.default(e));return{xtzAmount:a.toJSNumber(),rate:parseFloat(`${u.quotient.toJSNumber()}.${c.toJSNumber()}`)}},t.estimateLiquidityAmount=function(e,t,r){return i.default(e).multiply(i.default(t)).divide(i.default(r)).toJSNumber()},t.estimateShareCost=function(e,t,n){const o=i.default(e).divide(i.default(99)).toJSNumber();return{xtzCost:o,tokenCost:r(o,t,e)}}}(t.DexterPoolHelper||(t.DexterPoolHelper={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=o(r(16)),i=r(6),a=r(9),u=r(4),c=r(7),l=o(r(3));!function(t){t.verifyDestination=function(t,r){return n(this,void 0,void 0,(function*(){const n=yield u.TezosNodeReader.getAccountForBlock(t,"head",r);if(!n.script)throw new Error("No code found at "+r);const o=e.from(s.blake2s(JSON.stringify(n.script.code),null,16)).toString("hex");if("914629850cfdad7b54a8c5a661d10bd0"!==o)throw new Error(`Contract does not match the expected code hash: ${o}, '914629850cfdad7b54a8c5a661d10bd0'`);return!0}))},t.verifyScript=function(t){const r=e.from(s.blake2s(a.TezosLanguageUtil.preProcessMichelsonScript(t).join("\n"),null,16)).toString("hex");if("ffcad1e376a6c8915780fe6676aceec6"!==r)throw new Error(`Contract does not match the expected code hash: ${r}, 'ffcad1e376a6c8915780fe6676aceec6'`);return!0},t.getSimpleStorage=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield u.TezosNodeReader.getContractStorage(e,t);return{counter:Number(i.JSONPath({path:"$.args[0].int",json:r})[0]),threshold:Number(i.JSONPath({path:"$.args[1].args[0].int",json:r})[0]),keys:i.JSONPath({path:"$.args[1].args[1]..string",json:r})}}))},t.deployContract=function(e,t,r,o,s,i,a,u,p){return n(this,void 0,void 0,(function*(){if(u>p.length)throw new Error("Number of keys provided is lower than the threshold");const n=`(Pair ${a} (Pair ${u} { "${p.join('" ; "')}" } ) )`,f=yield c.TezosNodeWriter.sendContractOriginationOperation(e,t,r,i,o,s,5e3,12e4,"parameter (pair (pair :payload (nat %counter) (or :action (pair :transfer (mutez %amount) (contract %dest unit)) (or (option %delegate key_hash) (pair %change_keys (nat %threshold) (list %keys key))))) (list %sigs (option signature)));\n storage (pair (nat %stored_counter) (pair (nat %threshold) (list %keys key)));\n code\n {\n UNPAIR ; SWAP ; DUP ; DIP { SWAP } ;\n DIP\n {\n UNPAIR ;\n DUP ; SELF ; ADDRESS ; CHAIN_ID ; PAIR ; PAIR ;\n PACK ;\n DIP { UNPAIR @counter ; DIP { SWAP } } ; SWAP\n } ;\n UNPAIR @stored_counter; DIP { SWAP };\n ASSERT_CMPEQ ;\n DIP { SWAP } ; UNPAIR @threshold @keys;\n DIP\n {\n PUSH @valid nat 0; SWAP ;\n ITER\n {\n DIP { SWAP } ; SWAP ;\n IF_CONS\n {\n IF_SOME\n { SWAP ;\n DIP\n {\n SWAP ; DIIP { DUUP } ;\n CHECK_SIGNATURE ; ASSERT ;\n PUSH nat 1 ; ADD @valid } }\n { SWAP ; DROP }\n }\n {\n FAIL\n } ;\n SWAP\n }\n } ;\n ASSERT_CMPLE ;\n DROP ; DROP ;\n DIP { UNPAIR ; PUSH nat 1 ; ADD @new_counter ; PAIR} ;\n NIL operation ; SWAP ;\n IF_LEFT\n {\n UNPAIR ; UNIT ; TRANSFER_TOKENS ; CONS }\n { IF_LEFT {\n SET_DELEGATE ; CONS }\n {\n DIP { SWAP ; CAR } ; SWAP ; PAIR ; SWAP }} ;\n PAIR }",n,l.TezosParameterFormat.Michelson);return f.operationGroupID.replace(/\"/g,"").replace(/\n/,"")}))}}(t.MurbardMultisigHelper||(t.MurbardMultisigHelper={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=r(6),i=o(r(3)),a=r(5),u=r(4),c=r(7),l=r(8);!function(t){t.verifyDestination=function(e,t){return n(this,void 0,void 0,(function*(){return l.TezosContractUtils.verifyDestination(e,t,"0e3e137841a959521324b4ce20ca2df7")}))},t.verifyScript=function(e){return l.TezosContractUtils.verifyScript(e,"b77ada691b1d630622bea243696c84d7")},t.getAccountBalance=function(t,r,o){return n(this,void 0,void 0,(function*(){const n=a.TezosMessageUtils.encodeBigMapKey(e.from(a.TezosMessageUtils.writePackedData(o,"address"),"hex")),i=yield u.TezosNodeReader.getValueForBigMapKey(t,r,n);if(void 0===i)throw new Error(`Map ${r} does not contain a record for ${o}`);return Number(s.JSONPath({path:"$.int",json:i})[0])}))},t.getSimpleStorage=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield u.TezosNodeReader.getContractStorage(e,t);return{mapid:Number(s.JSONPath({path:"$.args[1].args[1].args[0].int",json:r})[0]),council:s.JSONPath({path:"$.args[0].args[0].args[1]..string",json:r}),stage:Number(s.JSONPath({path:"$.args[1].args[0].args[0].int",json:r})[0]),phase:Number(s.JSONPath({path:"$.args[1].args[0].args[0].int",json:r})[0])%4,supply:Number(s.JSONPath({path:"$.args[1].args[0].args[1].int",json:r})[0]),paused:s.JSONPath({path:"$.args[1].args[1].args[1].args[0].prim",json:r})[0].toString().toLowerCase().startsWith("t")}}))},t.transferBalance=function(e,t,r,o,s,a,u,p,f,h){return n(this,void 0,void 0,(function*(){const n=`(Right (Left (Left (Right (Pair "${a}" (Pair "${u}" ${p}))))))`,d=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,h,f,"",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(d.operationGroupID)}))}}(t.StakerDAOTokenHelper||(t.StakerDAOTokenHelper={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=o(r(16)),i=r(6),a=r(5),u=r(4);!function(t){t.verifyDestination=function(t,r){return n(this,void 0,void 0,(function*(){const n=yield u.TezosNodeReader.getAccountForBlock(t,"head",r);if(!n.script)throw new Error("No code found at "+r);if("1527ddf08bdf582dce0b28c051044897"!==e.from(s.blake2s(n.script.toString(),null,16)).toString("hex"))throw new Error(`Contract at ${r} does not match the expected code hash`);return!0}))},t.getSimpleStorage=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield u.TezosNodeReader.getContractStorage(e,t);return{mapid:parseInt(i.JSONPath({path:"$.args[0].int",json:r})[0]),owner:i.JSONPath({path:"$.args[1].args[0].string",json:r})[0],signupFee:parseInt(i.JSONPath({path:"$.args[1].args[1].args[0].int",json:r})[0]),updateFee:parseInt(i.JSONPath({path:"$.args[1].args[1].args[1].int",json:r})[0])}}))},t.updateRegistration=function(e,t,r,o,s,i,a){return n(this,void 0,void 0,(function*(){}))},t.queryRegistration=function(t,r,o){return n(this,void 0,void 0,(function*(){const n=a.TezosMessageUtils.encodeBigMapKey(e.from(a.TezosMessageUtils.writePackedData(o,"key_hash"),"hex")),s=yield u.TezosNodeReader.getValueForBigMapKey(t,r,n);if(!s)return;const c=new TextDecoder,l=Number(i.JSONPath({path:"$.args[0].args[0].args[0].args[1].args[1].args[1].args[0].args[1].int",json:s})[0]);return{name:c.decode(e.from(i.JSONPath({path:"$.args[0].args[0].args[0].args[0].args[0].args[0].bytes",json:s})[0],"hex")),isAcceptingDelegation:Boolean(i.JSONPath({path:"$.args[0].args[0].args[0].args[0].args[0].args[1].prim",json:s})[0]),externalDataURL:c.decode(e.from(i.JSONPath({path:"$.args[0].args[0].args[0].args[0].args[1].bytes",json:s})[0],"hex")),split:Number(i.JSONPath({path:"$.args[0].args[0].args[0].args[1].args[0].args[0].int",json:s})[0])/1e4,paymentAccounts:i.JSONPath({path:"$.args[0].args[0].args[0].args[1].args[0].args[1]..string",json:s}),minimumDelegation:Number(i.JSONPath({path:"$.args[0].args[0].args[0].args[1].args[1].args[0].args[0].args[0].int",json:s})[0]),isGreedy:Boolean(i.JSONPath({path:"$.args[0].args[0].args[0].args[1].args[1].args[0].args[0].args[1].prim",json:s})[0]),payoutDelay:Number(i.JSONPath({path:"$.args[0].args[0].args[0].args[1].args[1].args[0].args[1].args[0].int",json:s})[0]),payoutFrequency:Number(i.JSONPath({path:"$.args[0].args[0].args[0].args[1].args[1].args[0].args[1].args[1].args[0].int",json:s})[0]),minimumPayout:Number(i.JSONPath({path:"$.args[0].args[0].args[0].args[1].args[1].args[0].args[1].args[1].args[1].int",json:s})[0]),isCheap:Boolean(i.JSONPath({path:"$.args[0].args[0].args[0].args[1].args[1].args[1].args[0].args[0].prim",json:s})[0]),paymentConfig:{payForOwnBlocks:Boolean(1&l),payForEndorsements:Boolean(2&l),payGainedFees:Boolean(4&l),payForAccusationGains:Boolean(8&l),subtractLostDepositsWhenAccused:Boolean(16&l),subtractLostRewardsWhenAccused:Boolean(32&l),subtractLostFeesWhenAccused:Boolean(64&l),payForRevelation:Boolean(128&l),subtractLostRewardsWhenMissRevelation:Boolean(256&l),subtractLostFeesWhenMissRevelation:Boolean(512&l),compensateMissedBlocks:!Boolean(1024&l),payForStolenBlocks:Boolean(2048&l),compensateMissedEndorsements:!Boolean(4096&l),compensateLowPriorityEndorsementLoss:!Boolean(8192&l)},overdelegationThreshold:Number(i.JSONPath({path:"$.args[0].args[0].args[0].args[1].args[1].args[1].args[1].args[0].int",json:s})[0]),subtractRewardsFromUninvitedDelegation:Boolean(i.JSONPath({path:"$.args[0].args[0].args[0].args[1].args[1].args[1].args[1].args[1].prim",json:s})[0]),recordManager:i.JSONPath({path:"$.args[0].args[1].args[0].string",json:s})[0],timestamp:new Date(i.JSONPath({path:"$.args[1].string",json:s})[0])}}))}}(t.TCFBakerRegistryHelper||(t.TCFBakerRegistryHelper={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=r(6),i=o(r(3)),a=r(5),u=r(4),c=r(7),l=r(8);!function(t){t.verifyDestination=function(e,t){return n(this,void 0,void 0,(function*(){return l.TezosContractUtils.verifyDestination(e,t,"0e3e137841a959521324b4ce20ca2df7")}))},t.verifyScript=function(e){return l.TezosContractUtils.verifyScript(e,"b77ada691b1d630622bea243696c84d7")},t.deployContract=function(e,t,r,o,s,a=!0,u=0,p=15e4,f=5e3){return n(this,void 0,void 0,(function*(){const n=`Pair {} (Pair "${s}" (Pair ${a?"True":"False"} ${u}))`,h=yield c.TezosNodeWriter.sendContractOriginationOperation(e,t,r,0,void 0,o,f,p,'parameter (or (or (or (pair %transfer (address :from) (pair (address :to) (nat :value))) (pair %approve (address :spender) (nat :value))) (or (pair %getAllowance (pair (address :owner) (address :spender)) (contract nat)) (or (pair %getBalance (address :owner) (contract nat)) (pair %getTotalSupply unit (contract nat))))) (or (or (bool %setPause) (address %setAdministrator)) (or (pair %getAdministrator unit (contract address)) (or (pair %mint (address :to) (nat :value)) (pair %burn (address :from) (nat :value))))));\n storage (pair (big_map %ledger (address :user) (pair (nat :balance) (map :approvals (address :spender) (nat :value)))) (pair (address %admin) (pair (bool %paused) (nat %totalSupply))));\n code { CAST (pair (or (or (or (pair address (pair address nat)) (pair address nat)) (or (pair (pair address address) (contract nat)) (or (pair address (contract nat)) (pair unit (contract nat))))) (or (or bool address) (or (pair unit (contract address)) (or (pair address nat) (pair address nat))))) (pair (big_map address (pair nat (map address nat))) (pair address (pair bool nat)))); DUP; CAR; DIP { CDR }; IF_LEFT { IF_LEFT { IF_LEFT { DIP { DUP; CDR; CDR; CAR; IF { UNIT; PUSH string "TokenOperationsArePaused"; PAIR; FAILWITH } { } }; DUP; DUP; CDR; CAR; DIP { CAR }; COMPARE; EQ; IF { DROP } { DUP; CAR; SENDER; COMPARE; EQ; IF { } { DUP; DIP { DUP; DIP { DIP { DUP }; CAR; SENDER; PAIR; DUP; DIP { CDR; DIP { CAR }; GET; IF_NONE { EMPTY_MAP (address) nat } { CDR } }; CAR; GET; IF_NONE { PUSH nat 0 } { } }; DUP; CAR; DIP { SENDER; DIP { DUP; CDR; CDR; DIP { DIP { DUP }; SWAP }; SWAP; SUB; ISNAT; IF_NONE { DIP { DUP }; SWAP; DIP { DUP }; SWAP; CDR; CDR; PAIR; PUSH string "NotEnoughAllowance"; PAIR; FAILWITH } { } }; PAIR }; PAIR; DIP { DROP; DROP }; DIP { DUP }; SWAP; DIP { DUP; CAR }; SWAP; DIP { CAR }; GET; IF_NONE { PUSH nat 0; DIP { EMPTY_MAP (address) nat }; PAIR; EMPTY_MAP (address) nat } { DUP; CDR }; DIP { DIP { DUP }; SWAP }; SWAP; CDR; CDR; DUP; INT; EQ; IF { DROP; NONE nat } { SOME }; DIP { DIP { DIP { DUP }; SWAP }; SWAP }; SWAP; CDR; CAR; UPDATE; DIP { DUP; DIP { CAR }; CDR }; DIP { DROP }; SWAP; PAIR; SWAP; CAR; DIP { SOME }; DIP { DIP { DUP; CAR } }; UPDATE; DIP { DUP; DIP { CDR }; CAR }; DIP { DROP }; PAIR } }; DIP { DUP }; SWAP; DIP { DUP }; SWAP; CDR; CAR; DIP { CAR }; GET; IF_NONE { DUP; CDR; CDR; INT; EQ; IF { NONE (pair nat (map address nat)) } { DUP; CDR; CDR; DIP { EMPTY_MAP (address) nat }; PAIR; SOME } } { DIP { DUP }; SWAP; CDR; CDR; DIP { DUP; CAR }; ADD; DIP { DUP; DIP { CDR }; CAR }; DIP { DROP }; PAIR; SOME }; SWAP; DUP; DIP { CDR; CAR; DIP { DIP { DUP; CAR } }; UPDATE; DIP { DUP; DIP { CDR }; CAR }; DIP { DROP }; PAIR }; DUP; DIP { CDR; CDR; INT; DIP { DUP; CDR; CDR; CDR }; ADD; ISNAT; IF_NONE { PUSH string "Internal: Negative total supply"; FAILWITH } { }; DIP { DUP; CDR }; DIP { DUP; DIP { CAR }; CDR }; DIP { DUP; DIP { CAR }; CDR }; DIP { DROP }; SWAP; PAIR; SWAP; PAIR; DIP { DUP; DIP { CAR }; CDR }; DIP { DROP }; SWAP; PAIR }; DIP { DUP }; SWAP; DIP { DUP }; SWAP; CAR; DIP { CAR }; GET; IF_NONE { CDR; CDR; PUSH nat 0; SWAP; PAIR; PUSH string "NotEnoughBalance"; PAIR; FAILWITH } { }; DUP; CAR; DIP { DIP { DUP }; SWAP }; SWAP; CDR; CDR; SWAP; SUB; ISNAT; IF_NONE { CAR; DIP { DUP }; SWAP; CDR; CDR; PAIR; PUSH string "NotEnoughBalance"; PAIR; FAILWITH } { }; DIP { DUP; DIP { CDR }; CAR }; DIP { DROP }; PAIR; DIP { DUP }; SWAP; DIP { DUP; CAR; INT; EQ; IF { DUP; CDR; SIZE; INT; EQ; IF { DROP; NONE (pair nat (map address nat)) } { SOME } } { SOME }; SWAP; CAR; DIP { DIP { DUP; CAR } }; UPDATE; DIP { DUP; DIP { CDR }; CAR }; DIP { DROP }; PAIR }; DUP; DIP { CDR; CDR; NEG; DIP { DUP; CDR; CDR; CDR }; ADD; ISNAT; IF_NONE { PUSH string "Internal: Negative total supply"; FAILWITH } { }; DIP { DUP; CDR }; DIP { DUP; DIP { CAR }; CDR }; DIP { DUP; DIP { CAR }; CDR }; DIP { DROP }; SWAP; PAIR; SWAP; PAIR; DIP { DUP; DIP { CAR }; CDR }; DIP { DROP }; SWAP; PAIR }; DROP }; NIL operation; PAIR } { SENDER; PAIR; DIP { DUP; CDR; CDR; CAR; IF { UNIT; PUSH string "TokenOperationsArePaused"; PAIR; FAILWITH } { } }; DIP { DUP }; SWAP; DIP { DUP }; SWAP; DUP; DIP { CAR; DIP { CAR }; GET; IF_NONE { EMPTY_MAP (address) nat } { CDR } }; CDR; CAR; GET; IF_NONE { PUSH nat 0 } { }; DUP; INT; EQ; IF { DROP } { DIP { DUP }; SWAP; CDR; CDR; INT; EQ; IF { DROP } { PUSH string "UnsafeAllowanceChange"; PAIR; FAILWITH } }; DIP { DUP }; SWAP; DIP { DUP; CAR }; SWAP; DIP { CAR }; GET; IF_NONE { PUSH nat 0; DIP { EMPTY_MAP (address) nat }; PAIR; EMPTY_MAP (address) nat } { DUP; CDR }; DIP { DIP { DUP }; SWAP }; SWAP; CDR; CDR; DUP; INT; EQ; IF { DROP; NONE nat } { SOME }; DIP { DIP { DIP { DUP }; SWAP }; SWAP }; SWAP; CDR; CAR; UPDATE; DIP { DUP; DIP { CAR }; CDR }; DIP { DROP }; SWAP; PAIR; SWAP; CAR; DIP { SOME }; DIP { DIP { DUP; CAR } }; UPDATE; DIP { DUP; DIP { CDR }; CAR }; DIP { DROP }; PAIR; NIL operation; PAIR } } { IF_LEFT { DUP; CAR; DIP { CDR }; DIP { DIP { DUP }; SWAP }; PAIR; DUP; CAR; DIP { CDR }; DUP; DIP { CAR; DIP { CAR }; GET; IF_NONE { EMPTY_MAP (address) nat } { CDR } }; CDR; GET; IF_NONE { PUSH nat 0 } { }; DIP { AMOUNT }; TRANSFER_TOKENS; NIL operation; SWAP; CONS; PAIR } { IF_LEFT { DUP; CAR; DIP { CDR }; DIP { DIP { DUP }; SWAP }; PAIR; DUP; CAR; DIP { CDR }; DIP { CAR }; GET; IF_NONE { PUSH nat 0 } { CAR }; DIP { AMOUNT }; TRANSFER_TOKENS; NIL operation; SWAP; CONS; PAIR } { DUP; CAR; DIP { CDR }; DIP { DIP { DUP }; SWAP }; PAIR; CDR; CDR; CDR; CDR; DIP { AMOUNT }; TRANSFER_TOKENS; NIL operation; SWAP; CONS; PAIR } } } } { IF_LEFT { IF_LEFT { DIP { DUP; CDR; CAR; SENDER; COMPARE; EQ; IF { } { UNIT; PUSH string "SenderIsNotAdmin"; PAIR; FAILWITH } }; DIP { DUP; CDR }; DIP { DUP; DIP { CAR }; CDR }; DIP { DUP; DIP { CDR }; CAR }; DIP { DROP }; PAIR; SWAP; PAIR; DIP { DUP; DIP { CAR }; CDR }; DIP { DROP }; SWAP; PAIR; NIL operation; PAIR } { DIP { DUP; CDR; CAR; SENDER; COMPARE; EQ; IF { } { UNIT; PUSH string "SenderIsNotAdmin"; PAIR; FAILWITH } }; DIP { DUP; CDR }; DIP { DUP; DIP { CDR }; CAR }; DIP { DROP }; PAIR; DIP { DUP; DIP { CAR }; CDR }; DIP { DROP }; SWAP; PAIR; NIL operation; PAIR } } { IF_LEFT { DUP; CAR; DIP { CDR }; DIP { DIP { DUP }; SWAP }; PAIR; CDR; CDR; CAR; DIP { AMOUNT }; TRANSFER_TOKENS; NIL operation; SWAP; CONS; PAIR } { IF_LEFT { DIP { DUP; CDR; CAR; SENDER; COMPARE; EQ; IF { } { UNIT; PUSH string "SenderIsNotAdmin"; PAIR; FAILWITH } }; DIP { DUP }; SWAP; DIP { DUP }; SWAP; CAR; DIP { CAR }; GET; IF_NONE { DUP; CDR; INT; EQ; IF { NONE (pair nat (map address nat)) } { DUP; CDR; DIP { EMPTY_MAP (address) nat }; PAIR; SOME } } { DIP { DUP }; SWAP; CDR; DIP { DUP; CAR }; ADD; DIP { DUP; DIP { CDR }; CAR }; DIP { DROP }; PAIR; SOME }; SWAP; DUP; DIP { CAR; DIP { DIP { DUP; CAR } }; UPDATE; DIP { DUP; DIP { CDR }; CAR }; DIP { DROP }; PAIR }; DUP; DIP { CDR; INT; DIP { DUP; CDR; CDR; CDR }; ADD; ISNAT; IF_NONE { PUSH string "Internal: Negative total supply"; FAILWITH } { }; DIP { DUP; CDR }; DIP { DUP; DIP { CAR }; CDR }; DIP { DUP; DIP { CAR }; CDR }; DIP { DROP }; SWAP; PAIR; SWAP; PAIR; DIP { DUP; DIP { CAR }; CDR }; DIP { DROP }; SWAP; PAIR }; DROP; NIL operation; PAIR } { DIP { DUP; CDR; CAR; SENDER; COMPARE; EQ; IF { } { UNIT; PUSH string "SenderIsNotAdmin"; PAIR; FAILWITH } }; DIP { DUP }; SWAP; DIP { DUP }; SWAP; CAR; DIP { CAR }; GET; IF_NONE { CDR; PUSH nat 0; SWAP; PAIR; PUSH string "NotEnoughBalance"; PAIR; FAILWITH } { }; DUP; CAR; DIP { DIP { DUP }; SWAP }; SWAP; CDR; SWAP; SUB; ISNAT; IF_NONE { CAR; DIP { DUP }; SWAP; CDR; PAIR; PUSH string "NotEnoughBalance"; PAIR; FAILWITH } { }; DIP { DUP; DIP { CDR }; CAR }; DIP { DROP }; PAIR; DIP { DUP }; SWAP; DIP { DUP; CAR; INT; EQ; IF { DUP; CDR; SIZE; INT; EQ; IF { DROP; NONE (pair nat (map address nat)) } { SOME } } { SOME }; SWAP; CAR; DIP { DIP { DUP; CAR } }; UPDATE; DIP { DUP; DIP { CDR }; CAR }; DIP { DROP }; PAIR }; DUP; DIP { CDR; NEG; DIP { DUP; CDR; CDR; CDR }; ADD; ISNAT; IF_NONE { PUSH string "Internal: Negative total supply"; FAILWITH } { }; DIP { DUP; CDR }; DIP { DUP; DIP { CAR }; CDR }; DIP { DUP; DIP { CAR }; CDR }; DIP { DROP }; SWAP; PAIR; SWAP; PAIR; DIP { DUP; DIP { CAR }; CDR }; DIP { DROP }; SWAP; PAIR }; DROP; NIL operation; PAIR } } } } };',n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(h.operationGroupID)}))},t.getAccountBalance=function(t,r,o){return n(this,void 0,void 0,(function*(){const n=a.TezosMessageUtils.encodeBigMapKey(e.from(a.TezosMessageUtils.writePackedData(o,"address"),"hex")),i=yield u.TezosNodeReader.getValueForBigMapKey(t,r,n);if(void 0===i)throw new Error(`Map ${r} does not contain a record for ${o}`);const c=s.JSONPath({path:"$.args[0].int",json:i});return Number(c[0])}))},t.getAccountAllowance=function(t,r,o,i){return n(this,void 0,void 0,(function*(){const n=a.TezosMessageUtils.encodeBigMapKey(e.from(a.TezosMessageUtils.writePackedData(i,"address"),"hex")),c=yield u.TezosNodeReader.getValueForBigMapKey(t,r,n);if(void 0===c)throw new Error(`Map ${r} does not contain a record for ${i}/${o}`);let l=new Map;return s.JSONPath({path:"$.args[1][*].args",json:c}).forEach(e=>l[e[0].string]=Number(e[1].int)),l[o]}))},t.getSimpleStorage=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield u.TezosNodeReader.getContractStorage(e,t);return{mapid:Number(s.JSONPath({path:"$.args[0].int",json:r})[0]),supply:Number(s.JSONPath({path:"$.args[1].args[1].args[1].int",json:r})[0]),administrator:s.JSONPath({path:"$.args[1].args[0].string",json:r})[0],paused:s.JSONPath({path:"$.args[1].args[1].args[0].prim",json:r})[0].toString().toLowerCase().startsWith("t")}}))},t.getTokenSupply=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield u.TezosNodeReader.getContractStorage(e,t);return Number(s.JSONPath({path:"$.args[1].args[1].args[1].int",json:r})[0])}))},t.getAdministrator=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield u.TezosNodeReader.getContractStorage(e,t);return s.JSONPath({path:"$.args[1].args[0].string",json:r})[0]}))},t.getPaused=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield u.TezosNodeReader.getContractStorage(e,t);return s.JSONPath({path:"$.args[1].args[1].args[0].prim",json:r})[0].toString().toLowerCase().startsWith("t")}))},t.transferBalance=function(e,t,r,o,s,a,u,p,f,h){return n(this,void 0,void 0,(function*(){const n=`(Left (Left (Left (Pair "${a}" (Pair "${u}" ${p})))))`,d=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,h,f,"",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(d.operationGroupID)}))},t.approveBalance=function(e,t,r,o,s,a,u,p,f){return n(this,void 0,void 0,(function*(){const n=`(Left (Left (Right (Pair "${a}" ${u}))))`,h=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,f,p,"",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(h.operationGroupID)}))},t.activateLedger=function(e,t,r,o,s,a,u){return n(this,void 0,void 0,(function*(){const n=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,u,a,"","(Right (Left (Left False)))",i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(n.operationGroupID)}))},t.deactivateLedger=function(e,t,r,o,s,a,u){return n(this,void 0,void 0,(function*(){const n=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,u,a,"","(Right (Left (Left True)))",i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(n.operationGroupID)}))},t.setAdministrator=function(e,t,r,o,s,a,u,p){return n(this,void 0,void 0,(function*(){const n=`(Right (Left (Right "${s}")))`,f=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,a,p,u,"",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(f.operationGroupID)}))},t.mint=function(e,t,r,o,s,a,u,p=15e4,f=5e3){return n(this,void 0,void 0,(function*(){const n=`(Right (Right (Right (Left (Pair "${a}" ${u})))))`,h=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,f,p,"",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(h.operationGroupID)}))},t.burn=function(e,t,r,o,s,a,u,p,f){return n(this,void 0,void 0,(function*(){const n=`(Right (Right (Right (Right (Pair "${a}" ${u})))))`,h=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,f,p,"",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(h.operationGroupID)}))}}(t.Tzip7ReferenceTokenHelper||(t.Tzip7ReferenceTokenHelper={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=r(6),i=o(r(3)),a=r(5),u=r(4),c=r(7),l=r(8);!function(t){t.verifyDestination=function(e,t){return n(this,void 0,void 0,(function*(){return l.TezosContractUtils.verifyDestination(e,t,"cdf4fb6303d606686694d80bd485b6a1")}))},t.verifyScript=function(e){return l.TezosContractUtils.verifyScript(e,"000")},t.getSimpleStorage=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield u.TezosNodeReader.getContractStorage(e,t);return{administrator:s.JSONPath({path:"$.args[0].args[0].string",json:r})[0],tokens:Number(s.JSONPath({path:"$.args[0].args[1].args[0].int",json:r})[0]),balanceMap:Number(s.JSONPath({path:"$.args[0].args[1].args[1].int",json:r})[0]),operatorMap:Number(s.JSONPath({path:"$.args[1].args[0].args[1].int",json:r})[0]),paused:s.JSONPath({path:"$.args[1].args[1].args[0].prim",json:r})[0].toString().toLowerCase().startsWith("t"),metadataMap:Number(s.JSONPath({path:"$.args[1].args[1].args[1].int",json:r})[0])}}))},t.getTokenDefinition=function(t,r,o=0){return n(this,void 0,void 0,(function*(){const n=a.TezosMessageUtils.encodeBigMapKey(e.from(a.TezosMessageUtils.writePackedData(o,"nat"),"hex")),i=yield u.TezosNodeReader.getValueForBigMapKey(t,r,n);if(void 0===i)throw new Error(`Map ${r} does not contain a record for token ${o}`);return{tokenid:Number(s.JSONPath({path:"$.args[0].int",json:i})[0]),symbol:s.JSONPath({path:"$.args[1].args[0].string",json:i})[0],name:s.JSONPath({path:"$.args[1].args[1].args[0].string",json:i})[0],scale:Number(s.JSONPath({path:"$.args[1].args[1].args[1].args[0].int",json:i})[0])}}))},t.transfer=function(e,t,r,o,s,a,u,p=2e5,f=1e3){return n(this,void 0,void 0,(function*(){const n=`{ Pair "${a}" { ${u.map(e=>`(Pair "${e.address}" (Pair ${e.tokenid} ${e.balance}))`).join(" ; ")} } }`,h=yield c.TezosNodeWriter.sendContractInvocationOperation(e,r,o,t,0,s,f,p,"transfer",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(h.operationGroupID)}))},t.getAccountBalance=function(t,r,o){return n(this,void 0,void 0,(function*(){const n="0x"+a.TezosMessageUtils.writeAddress(o),c=a.TezosMessageUtils.encodeBigMapKey(e.from(a.TezosMessageUtils.writePackedData(""+n,"",i.TezosParameterFormat.Michelson),"hex")),l=yield u.TezosNodeReader.getValueForBigMapKey(t,r,c);if(void 0===l)throw new Error(`Map ${r} does not contain a record for ${o}`);const p=s.JSONPath({path:"$.int",json:l});return Number(p[0])}))}}(t.ChainlinkTokenHelper||(t.ChainlinkTokenHelper={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=r(6),i=o(r(3)),a=r(5),u=r(4),c=r(7),l=r(8);!function(t){t.verifyDestination=function(e,t){return n(this,void 0,void 0,(function*(){return l.TezosContractUtils.verifyDestination(e,t,"cdf4fb6303d606686694d80bd485b6a1")}))},t.verifyScript=function(e){return l.TezosContractUtils.verifyScript(e,"000")},t.deployContract=function(e,t,r,o,s,a,u,p,f,h=!0,d=0,g=8e5,m=2e4){return n(this,void 0,void 0,(function*(){const n=`( Pair ( Pair "${s}" ( Pair 0 { } ) ) ( Pair ( Pair Unit { } ) ( Pair ${h?"True":"False"} { Elt ${p} ( Pair ( Pair ${p} ( Pair "${u}" ( Pair "${a}" ( Pair ${f} { } ) ) ) ) ${d} ) } ) ) )`,y=yield c.TezosNodeWriter.sendContractOriginationOperation(e,t,r,0,void 0,o,m,g,'parameter (or (or (or (pair %balance_of (list %requests (pair (address %owner) (nat %token_id))) (contract %callback (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) (pair %mint (pair (address %address) (nat %amount)) (pair (string %symbol) (nat %token_id)))) (or (address %set_administrator) (bool %set_pause))) (or (or (pair %token_metadata (list %token_ids nat) (lambda %handler (list (pair (nat %token_id) (pair (string %symbol) (pair (string %name) (pair (nat %decimals) (map %extras string string)))))) unit)) (contract %token_metadata_regitry address)) (or (list %transfer (pair (address %from_) (list %txs (pair (address %to_) (pair (nat %token_id) (nat %amount)))))) (list %update_operators (or (pair %add_operator (address %owner) (address %operator)) (pair %remove_operator (address %owner) (address %operator))))))) ;\n storage (pair (pair (address %administrator) (pair (nat %all_tokens) (big_map %ledger (pair address nat) nat))) (pair (pair (unit %version_20200615_tzip_a57dfe86_contract) (big_map %operators (pair (address %owner) (address %operator)) unit)) (pair (bool %paused) (big_map %tokens nat (pair (pair %metadata (nat %token_id) (pair (string %symbol) (pair (string %name) (pair (nat %decimals) (map %extras string string))))) (nat %total_supply)))))) ;\n code { DUP ; CDR ; SWAP ; CAR ; IF_LEFT { IF_LEFT { IF_LEFT { SWAP ; DUP ; DUG 2 ; { CDR ; CDR ; CAR } ; IF { PUSH string "WrongCondition: ~ self.data.paused" ; FAILWITH } {} ; NIL (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; SWAP ; DUP ; DUG 2 ; CAR ; ITER { SWAP ; DIG 3 ; DUP ; DUG 4 ; { CAR ; CDR ; CDR } ; DIG 2 ; DUP ; DUG 3 ; CDR ; DIG 3 ; DUP ; DUG 4 ; CAR ; PAIR ; GET ; { IF_NONE { PUSH string "Get-item:190" ; FAILWITH } {} } ; DIG 2 ; DUP ; DUG 3 ; CDR ; DIG 3 ; CAR ; PAIR %owner %token_id ; PAIR %request %balance ; CONS } ; NIL operation ; DIG 2 ; DUP ; DUG 3 ; CDR ; PUSH mutez 0 ; DIG 3 ; DUP ; DUG 4 ; NIL (pair (pair %request (address %owner) (nat %token_id)) (nat %balance)) ; SWAP ; ITER { CONS } ; DIG 4 ; DROP ; DIG 4 ; DROP ; TRANSFER_TOKENS ; CONS } { SWAP ; DUP ; DUG 2 ; { CAR ; CAR } ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "WrongCondition: sp.sender == self.data.administrator" ; FAILWITH } ; SWAP ; DUP ; DUG 2 ; DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; { CDR ; CDR } ; DIG 4 ; DUP ; DUG 5 ; { CAR ; CDR ; CAR } ; DUP ; PUSH nat 1 ; DIG 6 ; DUP ; DUG 7 ; { CDR ; CDR } ; ADD ; DUP ; DUG 2 ; COMPARE ; LE ; IF { DROP } { SWAP ; DROP } ; DIG 5 ; DROP ; PAIR ; SWAP ; PAIR ; PAIR ; SWAP ; SWAP ; DUP ; DUG 2 ; { CAR ; CDR ; CDR } ; SWAP ; DUP ; DUG 2 ; { CDR ; CDR } ; DIG 2 ; DUP ; DUG 3 ; { CAR ; CAR } ; PAIR ; MEM ; IF { SWAP ; DUP ; DUG 2 ; DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; SWAP ; CDR ; DUP ; DIG 5 ; DUP ; DUG 6 ; { CDR ; CDR } ; DIG 6 ; DUP ; DUG 7 ; { CAR ; CAR } ; PAIR ; DUP ; DUG 2 ; GET ; { IF_NONE { PUSH string "set_in_top-any" ; FAILWITH } {} } ; DROP ; DIG 5 ; DUP ; DUG 6 ; { CAR ; CDR } ; DIG 7 ; { CAR ; CDR ; CDR } ; DIG 7 ; DUP ; DUG 8 ; { CDR ; CDR } ; DIG 8 ; DUP ; DUG 9 ; { CAR ; CAR } ; PAIR ; GET ; { IF_NONE { PUSH string "Get-item:190" ; FAILWITH } {} } ; ADD ; SOME ; SWAP ; UPDATE ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR ; SWAP } { SWAP ; DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; SWAP ; CDR ; DIG 4 ; DUP ; DUG 5 ; { CAR ; CDR } ; SOME ; DIG 5 ; DUP ; DUG 6 ; { CDR ; CDR } ; DIG 6 ; DUP ; DUG 7 ; { CAR ; CAR } ; PAIR ; UPDATE ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR ; SWAP } ; SWAP ; DUP ; DUG 2 ; { CDR ; CDR ; CDR } ; SWAP ; DUP ; DUG 2 ; { CDR ; CDR } ; MEM ; IF { SWAP ; DUP ; DUG 2 ; DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; SWAP ; CDR ; DUP ; DIG 5 ; DUP ; DUG 6 ; { CDR ; CDR } ; DUP ; DUG 2 ; GET ; { IF_NONE { PUSH string "set_in_top-any" ; FAILWITH } {} } ; CAR ; DIG 6 ; DUP ; DUG 7 ; { CAR ; CDR } ; DIG 8 ; { CDR ; CDR ; CDR } ; DIG 8 ; DUP ; DUG 9 ; { CDR ; CDR } ; GET ; { IF_NONE { PUSH string "Get-item:431" ; FAILWITH } {} } ; CDR ; ADD ; SWAP ; PAIR ; SOME ; SWAP ; UPDATE ; SWAP ; PAIR ; SWAP ; PAIR ; SWAP ; PAIR ; SWAP } { SWAP ; DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; SWAP ; CDR ; DIG 4 ; DUP ; DUG 5 ; { CAR ; CDR } ; PUSH (pair (string %name) (pair (nat %decimals) (map %extras string string))) (Pair "" (Pair 0 {})) ; DIG 6 ; DUP ; DUG 7 ; { CDR ; CAR } ; PAIR %symbol ; DIG 6 ; DUP ; DUG 7 ; { CDR ; CDR } ; PAIR %token_id ; PAIR %metadata %total_supply ; SOME ; DIG 5 ; DUP ; DUG 6 ; { CDR ; CDR } ; UPDATE ; SWAP ; PAIR ; SWAP ; PAIR ; SWAP ; PAIR ; SWAP } ; DROP ; NIL operation } } { IF_LEFT { SWAP ; DUP ; DUG 2 ; { CAR ; CAR } ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "WrongCondition: sp.sender == self.data.administrator" ; FAILWITH } ; SWAP ; DUP ; CDR ; SWAP ; { CAR ; CDR } ; DIG 2 ; PAIR ; PAIR } { SWAP ; DUP ; DUG 2 ; { CAR ; CAR } ; SENDER ; COMPARE ; EQ ; IF {} { PUSH string "WrongCondition: sp.sender == self.data.administrator" ; FAILWITH } ; SWAP ; DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; SWAP ; { CDR ; CDR } ; DIG 3 ; PAIR ; SWAP ; PAIR ; SWAP ; PAIR } ; NIL operation } } { IF_LEFT { IF_LEFT { SWAP ; DUP ; DUG 2 ; { CDR ; CDR ; CAR } ; IF { PUSH string "WrongCondition: ~ self.data.paused" ; FAILWITH } {} ; NIL (pair (nat %token_id) (pair (string %symbol) (pair (string %name) (pair (nat %decimals) (map %extras string string))))) ; SWAP ; DUP ; DUG 2 ; CAR ; ITER { SWAP ; DIG 3 ; DUP ; DUG 4 ; { CDR ; CDR ; CDR } ; DIG 2 ; GET ; { IF_NONE { PUSH string "Get-item:523" ; FAILWITH } {} } ; CAR ; CONS } ; SWAP ; DUP ; DUG 2 ; CDR ; SWAP ; DUP ; DUG 2 ; NIL (pair (nat %token_id) (pair (string %symbol) (pair (string %name) (pair (nat %decimals) (map %extras string string))))) ; SWAP ; ITER { CONS } ; EXEC ; DROP 3 ; NIL operation } { SWAP ; DUP ; DUG 2 ; { CDR ; CDR ; CAR } ; IF { PUSH string "WrongCondition: ~ self.data.paused" ; FAILWITH } {} ; DUP ; NIL operation ; SWAP ; PUSH mutez 0 ; SELF ; DIG 4 ; DROP ; ADDRESS ; TRANSFER_TOKENS ; CONS } } { IF_LEFT { SWAP ; DUP ; DUG 2 ; { CDR ; CDR ; CAR } ; IF { PUSH string "WrongCondition: ~ self.data.paused" ; FAILWITH } {} ; DUP ; ITER { DIG 2 ; DUP ; DUG 3 ; { CAR ; CAR } ; SENDER ; COMPARE ; EQ ; IF { PUSH bool True } { DUP ; CAR ; SENDER ; COMPARE ; EQ } ; IF { PUSH bool True } { DIG 2 ; DUP ; DUG 3 ; { CDR ; CAR ; CDR } ; SENDER ; DIG 2 ; DUP ; DUG 3 ; CAR ; PAIR %owner %operator ; MEM } ; IF {} { PUSH string "WrongCondition: ((sp.sender == self.data.administrator) | (transfer.from_ == sp.sender)) | (self.data.operators.contains(sp.record(operator = sp.sender, owner = transfer.from_)))" ; FAILWITH } ; DUP ; CDR ; ITER { DUP ; { CDR ; CDR } ; PUSH nat 0 ; COMPARE ; LT ; IF {} { PUSH string "TRANSFER_OF_ZERO" ; FAILWITH } ; DUP ; { CDR ; CDR } ; DIG 4 ; DUP ; DUG 5 ; { CAR ; CDR ; CDR } ; DIG 2 ; DUP ; DUG 3 ; { CDR ; CAR } ; DIG 4 ; DUP ; DUG 5 ; CAR ; PAIR ; GET ; { IF_NONE { PUSH string "Get-item:190" ; FAILWITH } {} } ; COMPARE ; GE ; IF {} { PUSH string "WrongCondition: self.data.ledger[(transfer.from_, tx.token_id)].balance >= tx.amount" ; FAILWITH } ; DIG 3 ; DUP ; DUG 4 ; DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; SWAP ; CDR ; DUP ; DIG 5 ; DUP ; DUG 6 ; { CDR ; CAR } ; DIG 7 ; DUP ; DUG 8 ; CAR ; PAIR ; DUP ; DUG 2 ; GET ; { IF_NONE { PUSH string "set_in_top-any" ; FAILWITH } {} } ; DROP ; DIG 5 ; DUP ; DUG 6 ; { CDR ; CDR } ; DIG 9 ; { CAR ; CDR ; CDR } ; DIG 7 ; DUP ; DUG 8 ; { CDR ; CAR } ; DIG 9 ; DUP ; DUG 10 ; CAR ; PAIR ; GET ; { IF_NONE { PUSH string "Get-item:190" ; FAILWITH } {} } ; SUB ; ISNAT ; { IF_NONE { PUSH unit Unit ; FAILWITH } {} } ; SOME ; SWAP ; UPDATE ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR ; DUG 3 ; DIG 3 ; DUP ; DUG 4 ; { CAR ; CDR ; CDR } ; SWAP ; DUP ; DUG 2 ; { CDR ; CAR } ; DIG 2 ; DUP ; DUG 3 ; CAR ; PAIR ; MEM ; IF { DIG 3 ; DUP ; DUG 4 ; DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; SWAP ; CDR ; DUP ; DIG 5 ; DUP ; DUG 6 ; { CDR ; CAR } ; DIG 6 ; DUP ; DUG 7 ; CAR ; PAIR ; DUP ; DUG 2 ; GET ; { IF_NONE { PUSH string "set_in_top-any" ; FAILWITH } {} } ; DROP ; DIG 5 ; DUP ; DUG 6 ; { CDR ; CDR } ; DIG 9 ; { CAR ; CDR ; CDR } ; DIG 7 ; DUP ; DUG 8 ; { CDR ; CAR } ; DIG 8 ; DUP ; DUG 9 ; CAR ; PAIR ; GET ; { IF_NONE { PUSH string "Get-item:190" ; FAILWITH } {} } ; ADD ; SOME ; SWAP ; UPDATE ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR ; DUG 3 } { DIG 3 ; DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; SWAP ; CDR ; DIG 4 ; DUP ; DUG 5 ; { CDR ; CDR } ; SOME ; DIG 5 ; DUP ; DUG 6 ; { CDR ; CAR } ; DIG 6 ; DUP ; DUG 7 ; CAR ; PAIR ; UPDATE ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR ; DUG 3 } ; DROP } ; DROP } ; DROP } { DUP ; ITER { DUP ; IF_LEFT { DROP ; DUP ; SENDER ; SWAP ; IF_LEFT {} { DROP ; PUSH unit Unit ; FAILWITH } ; CAR ; COMPARE ; EQ ; IF { PUSH bool True } { DIG 2 ; DUP ; DUG 3 ; { CAR ; CAR } ; SENDER ; COMPARE ; EQ } ; IF {} { PUSH string "WrongCondition: (update.open_variant(\'add_operator\').owner == sp.sender) | (sp.sender == self.data.administrator)" ; FAILWITH } ; DIG 2 ; DUP ; DUG 3 ; DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; PUSH (option unit) (Some Unit) ; DIG 5 ; DUP ; DUG 6 ; IF_LEFT {} { DROP ; PUSH unit Unit ; FAILWITH } ; CDR ; DIG 6 ; DUP ; DUG 7 ; IF_LEFT {} { DROP ; PUSH unit Unit ; FAILWITH } ; DIG 9 ; DROP ; CAR ; PAIR %owner %operator ; UPDATE ; SWAP ; PAIR ; PAIR ; SWAP ; PAIR ; DUG 2 } { DROP ; DUP ; SENDER ; SWAP ; IF_LEFT { DROP ; PUSH unit Unit ; FAILWITH } {} ; CAR ; COMPARE ; EQ ; IF { PUSH bool True } { DIG 2 ; DUP ; DUG 3 ; { CAR ; CAR } ; SENDER ; COMPARE ; EQ } ; IF {} { PUSH string "WrongCondition: (update.open_variant(\'remove_operator\').owner == sp.sender) | (sp.sender == self.data.administrator)" ; FAILWITH } ; DIG 2 ; DUP ; DUG 3 ; DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; NONE unit ; DIG 5 ; DUP ; DUG 6 ; IF_LEFT { DROP ; PUSH unit Unit ; FAILWITH } {} ; CDR ; DIG 6 ; DUP ; DUG 7 ; IF_LEFT { DROP ; PUSH unit Unit ; FAILWITH } {} ; DIG 9 ; DROP ; CAR ; PAIR %owner %operator ; UPDATE ; SWAP ; PAIR ; PAIR ; SWAP ; PAIR ; DUG 2 } ; DROP } ; DROP } ; NIL operation } } ; PAIR } ;',n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(y.operationGroupID)}))},t.getSimpleStorage=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield u.TezosNodeReader.getContractStorage(e,t);return{administrator:s.JSONPath({path:"$.args[0].args[0].string",json:r})[0],tokens:Number(s.JSONPath({path:"$.args[0].args[1].args[0].int",json:r})[0]),balanceMap:Number(s.JSONPath({path:"$.args[0].args[1].args[1].int",json:r})[0]),operatorMap:Number(s.JSONPath({path:"$.args[1].args[0].args[1].int",json:r})[0]),paused:s.JSONPath({path:"$.args[1].args[1].args[0].prim",json:r})[0].toString().toLowerCase().startsWith("t"),metadataMap:Number(s.JSONPath({path:"$.args[1].args[1].args[1].int",json:r})[0])}}))},t.getTokenDefinition=function(t,r,o=0){return n(this,void 0,void 0,(function*(){const n=a.TezosMessageUtils.encodeBigMapKey(e.from(a.TezosMessageUtils.writePackedData(o,"nat"),"hex")),i=yield u.TezosNodeReader.getValueForBigMapKey(t,r,n);if(void 0===i)throw new Error(`Map ${r} does not contain a record for token ${o}`);return{tokenid:Number(s.JSONPath({path:"$.args[0].args[0].int",json:i})[0]),symbol:s.JSONPath({path:"$.args[0].args[1].args[0].string",json:i})[0],name:s.JSONPath({path:"$.args[0].args[1].args[1].args[0].string",json:i})[0],scale:Number(s.JSONPath({path:"$.args[0].args[1].args[1].args[1].args[0].int",json:i})[0]),supply:Number(s.JSONPath({path:"$.args[1].int",json:i})[0])}}))},t.activate=function(e,t,r,o,s,a=8e5,u=2e4){return n(this,void 0,void 0,(function*(){const n=yield c.TezosNodeWriter.sendContractInvocationOperation(e,r,o,t,0,s,u,a,"set_pause","False",i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(n.operationGroupID)}))},t.deactivate=function(e,t,r,o,s,a=8e5,u=2e4){return n(this,void 0,void 0,(function*(){const n=yield c.TezosNodeWriter.sendContractInvocationOperation(e,r,o,t,0,s,u,a,"set_pause","True",i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(n.operationGroupID)}))},t.changeAdministrator=function(e,t,r,o,s,a,u=8e5,p=2e4){return n(this,void 0,void 0,(function*(){const n=`"${a}"`,f=yield c.TezosNodeWriter.sendContractInvocationOperation(e,r,o,t,0,s,p,u,"set_administrator",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(f.operationGroupID)}))},t.mint=function(e,t,r,o,s,a,u,p,f,h=8e5,d=2e4){return n(this,void 0,void 0,(function*(){const n=`(Pair (Pair "${a}" ${u}) (Pair "${p}" ${f}))`,g=yield c.TezosNodeWriter.sendContractInvocationOperation(e,r,o,t,0,s,d,h,"mint",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(g.operationGroupID)}))},t.transfer=function(e,t,r,o,s,a,u,p=8e5,f=2e4){return n(this,void 0,void 0,(function*(){const n=`{ Pair "${a}" { ${u.map(e=>'( Pair "'+e.address+'" ( Pair '+e.tokenid+" "+e.balance+" ) )").join(" ; ")} } }`,h=yield c.TezosNodeWriter.sendContractInvocationOperation(e,r,o,t,0,s,f,p,"transfer",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(h.operationGroupID)}))},t.getAccountBalance=function(t,r,o,c){return n(this,void 0,void 0,(function*(){const n="0x"+a.TezosMessageUtils.writeAddress(o),l=a.TezosMessageUtils.encodeBigMapKey(e.from(a.TezosMessageUtils.writePackedData(`(Pair ${n} ${c})`,"",i.TezosParameterFormat.Michelson),"hex")),p=yield u.TezosNodeReader.getValueForBigMapKey(t,r,l);if(void 0===p)throw new Error(`Map ${r} does not contain a record for ${o}/${c}`);const f=s.JSONPath({path:"$.int",json:p});return Number(f[0])}))}}(t.MultiAssetTokenHelper||(t.MultiAssetTokenHelper={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=r(6),i=r(5),a=r(4),u=r(7),c=o(r(3)),l=r(8);!function(t){t.verifyDestination=function(e,t){return n(this,void 0,void 0,(function*(){return l.TezosContractUtils.verifyDestination(e,t,"17aab0975df6139f4ff29be76a67f348")}))},t.verifyScript=function(e){return l.TezosContractUtils.verifyScript(e,"000")},t.deployContract=function(e,t,r,o,s,i,a,p,f,h=!0,d=0,g=8e5,m=2e4){return n(this,void 0,void 0,(function*(){const n=`( Pair ( Pair ( Pair "${s}" ${h?"True":"False"} ) None ) ( Pair ( Pair { } { } ) ( Pair { Elt ${p} ( Pair ${p} ( Pair "${a}" ( Pair "${i}" ( Pair ${f} { } ) ) ) ) } ${d} ) ) )`,y=yield u.TezosNodeWriter.sendContractOriginationOperation(e,t,r,0,void 0,o,m,g,'parameter (or (or (or %admin (or (unit %confirm_admin) (bool %pause)) (address %set_admin)) (or %assets (or (pair %balance_of (list %requests (pair (address %owner) (nat %token_id))) (contract %callback (list (pair (pair %request (address %owner) (nat %token_id)) (nat %balance))))) (contract %token_metadata_registry address)) (or (list %transfer (pair (address %from_) (list %txs (pair (address %to_) (pair (nat %token_id) (nat %amount)))))) (list %update_operators (or (pair %add_operator (address %owner) (address %operator)) (pair %remove_operator (address %owner) (address %operator))))))) (or %tokens (list %burn_tokens (pair (nat %amount) (address %owner))) (list %mint_tokens (pair (nat %amount) (address %owner))))) ;\n storage (pair (pair %admin (pair (address %admin) (bool %paused)) (option %pending_admin address)) (pair %assets (pair (big_map %ledger address nat) (big_map %operators (pair address address) unit)) (pair (big_map %token_metadata nat (pair (nat %token_id) (pair (string %symbol) (pair (string %name) (pair (nat %decimals) (map %extras string string)))))) (nat %total_supply)))) ;\n code { PUSH string "FA2_TOKEN_UNDEFINED" ; PUSH string "FA2_INSUFFICIENT_BALANCE" ; LAMBDA (pair address address) (pair address address) { DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; PAIR ; DIP { DROP } } ; LAMBDA (pair address (big_map address nat)) nat { DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; GET ; IF_NONE { PUSH nat 0 } { DUP ; DIP { DROP } } ; DIP { DROP } } ; DUP ; LAMBDA (pair (lambda (pair address (big_map address nat)) nat) (pair (pair address nat) (big_map address nat))) (big_map address nat) { DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DUP ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DIG 4 ; DUP ; DUG 5 ; SWAP ; EXEC ; DIG 3 ; DUP ; DUG 4 ; CAR ; CDR ; DIG 1 ; DUP ; DUG 2 ; ADD ; DIG 2 ; DUP ; DUG 3 ; DIG 1 ; DUP ; DUG 2 ; SOME ; DIG 5 ; DUP ; DUG 6 ; UPDATE ; DIP { DROP 6 } } ; SWAP ; APPLY ; DIP { DIP { DIP { DUP } ; SWAP } ; DUP ; DIP { PAIR } ; SWAP } ; SWAP ; LAMBDA (pair (pair (lambda (pair address (big_map address nat)) nat) string) (pair (pair address nat) (big_map address nat))) (big_map address nat) { DUP ; CAR ; SWAP ; CDR ; DIP { DUP ; CDR ; SWAP ; CAR } ; DUP ; CAR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DUP ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DIG 4 ; DUP ; DUG 5 ; SWAP ; EXEC ; DIG 3 ; DUP ; DUG 4 ; CAR ; CDR ; DIG 1 ; DUP ; DUG 2 ; SUB ; ISNAT ; IF_NONE { DIG 5 ; DUP ; DUG 6 ; FAILWITH } { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; COMPARE ; EQ ; IF { DIG 2 ; DUP ; DUG 3 ; DIG 4 ; DUP ; DUG 5 ; NONE nat ; SWAP ; UPDATE } { DIG 2 ; DUP ; DUG 3 ; DIG 1 ; DUP ; DUG 2 ; SOME ; DIG 5 ; DUP ; DUG 6 ; UPDATE } ; DIP { DROP } } ; DIP { DROP 6 } } ; SWAP ; APPLY ; LAMBDA (list (pair nat address)) nat { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; ITER { SWAP ; PAIR ; DUP ; CDR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CAR ; ADD ; DIP { DROP } } ; DIP { DROP } } ; LAMBDA (pair (pair address bool) (option address)) unit { DUP ; CAR ; CAR ; SENDER ; COMPARE ; NEQ ; IF { PUSH string "NOT_AN_ADMIN" ; FAILWITH } { UNIT } ; DIP { DROP } } ; DIG 8 ; DUP ; DUG 9 ; CDR ; DIG 9 ; DUP ; DUG 10 ; CAR ; IF_LEFT { DUP ; IF_LEFT { DIG 2 ; DUP ; DUG 3 ; CAR ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DUP ; IF_LEFT { DIG 2 ; DUP ; DUG 3 ; CDR ; IF_NONE { PUSH string "NO_PENDING_ADMIN" ; FAILWITH } { DUP ; SENDER ; COMPARE ; EQ ; IF { DIG 3 ; DUP ; DUG 4 ; CAR ; NONE address ; SWAP ; PAIR ; DUP ; CDR ; SWAP ; CAR ; CDR ; SENDER ; PAIR ; PAIR } { PUSH string "NOT_AN_ADMIN" ; FAILWITH } ; DIP { DROP } } ; DUP ; NIL operation ; PAIR ; DIP { DROP 2 } } { DIG 2 ; DUP ; DUG 3 ; DIG 8 ; DUP ; DUG 9 ; SWAP ; EXEC ; DIG 3 ; DUP ; DUG 4 ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIP { DUP ; CDR ; SWAP ; CAR ; CAR } ; SWAP ; PAIR ; PAIR ; DIP { DROP } ; NIL operation ; PAIR ; DIP { DROP 2 } } ; DIP { DROP } } { DIG 1 ; DUP ; DUG 2 ; DIG 7 ; DUP ; DUG 8 ; SWAP ; EXEC ; DIG 2 ; DUP ; DUG 3 ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; SOME ; SWAP ; CAR ; PAIR ; DIP { DROP } ; NIL operation ; PAIR ; DIP { DROP 2 } } ; DIP { DROP 2 } ; DIG 3 ; DUP ; DUG 4 ; DIG 1 ; DUP ; DUG 2 ; CDR ; SWAP ; CDR ; SWAP ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIP { DROP 2 } } { DIG 2 ; DUP ; DUG 3 ; CAR ; CAR ; CDR ; IF { PUSH string "PAUSED" ; FAILWITH } { UNIT } ; DIG 3 ; DUP ; DUG 4 ; CDR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DUP ; IF_LEFT { DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; PAIR ; DUP ; CDR ; MAP { DUP ; DIP { DROP } } ; DUP ; DIG 2 ; DUP ; DUG 3 ; CAR ; PAIR ; DIP { DROP 2 } ; DIG 3 ; DUP ; DUG 4 ; CAR ; CAR ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CAR ; DUP ; CDR ; MAP { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; CDR ; COMPARE ; NEQ ; IF { DIG 19 ; DUP ; DUG 20 ; FAILWITH } { DIG 2 ; DUP ; DUG 3 ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIG 17 ; DUP ; DUG 18 ; SWAP ; EXEC ; DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CDR ; CDR ; DIG 1 ; DUP ; DUG 2 ; CDR ; CAR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; PAIR ; DIP { DROP 3 } } ; DIP { DROP } } ; DIG 1 ; DUP ; DUG 2 ; CAR ; PUSH mutez 0 ; DIG 2 ; DUP ; DUG 3 ; TRANSFER_TOKENS ; DIP { DROP 3 } ; DIG 4 ; DUP ; DUG 5 ; NIL operation ; DIG 2 ; DUP ; DUG 3 ; CONS ; PAIR ; DIP { DROP 3 } } { DUP ; PUSH mutez 0 ; SELF ; ADDRESS ; TRANSFER_TOKENS ; DIG 3 ; DUP ; DUG 4 ; NIL operation ; DIG 2 ; DUP ; DUG 3 ; CONS ; PAIR ; DIP { DROP 2 } } ; DIP { DROP } } { DUP ; IF_LEFT { DUP ; MAP { DUP ; CDR ; MAP { DUP ; CDR ; CAR ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 2 ; DUP ; DUG 3 ; CDR ; CDR ; PAIR ; PAIR ; DIP { DROP } } ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIP { DROP } } ; DUP ; MAP { DUP ; CDR ; MAP { PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; CDR ; COMPARE ; NEQ ; IF { DIG 18 ; DUP ; DUG 19 ; FAILWITH } { DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; CDR ; SOME ; DIG 2 ; DUP ; DUG 3 ; CAR ; CAR ; PAIR ; PAIR } ; DIP { DROP } } ; DUP ; DIG 2 ; DUP ; DUG 3 ; CAR ; SOME ; PAIR ; DIP { DROP 2 } } ; SENDER ; DUP ; LAMBDA (pair address (pair address (big_map (pair address address) unit))) unit { DUP ; CAR ; SWAP ; CDR ; DUP ; CAR ; DIG 2 ; DUP ; DUG 3 ; DIG 1 ; DUP ; DUG 2 ; COMPARE ; EQ ; IF { UNIT } { DIG 1 ; DUP ; DUG 2 ; CDR ; DIG 3 ; DUP ; DUG 4 ; DIG 2 ; DUP ; DUG 3 ; PAIR ; MEM ; IF { UNIT } { PUSH string "FA2_NOT_OPERATOR" ; FAILWITH } } ; DIP { DROP 3 } } ; SWAP ; APPLY ; DIP { DROP } ; DIG 5 ; DUP ; DUG 6 ; CAR ; CAR ; DIG 6 ; DUP ; DUG 7 ; CAR ; CDR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; DIG 3 ; DUP ; DUG 4 ; PAIR ; PAIR ; DUP ; CDR ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; CAR ; ITER { SWAP ; PAIR ; DUP ; CDR ; DUP ; CAR ; IF_NONE { UNIT } { DIG 3 ; DUP ; DUG 4 ; CDR ; CAR ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DIG 4 ; DUP ; DUG 5 ; CAR ; CDR ; SWAP ; EXEC ; DIP { DROP } } ; DIG 2 ; DUP ; DUG 3 ; CAR ; DIG 2 ; DUP ; DUG 3 ; CDR ; ITER { SWAP ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; PUSH nat 0 ; DIG 1 ; DUP ; DUG 2 ; CDR ; COMPARE ; NEQ ; IF { DIG 25 ; DUP ; DUG 26 ; FAILWITH } { DIG 4 ; DUP ; DUG 5 ; CAR ; IF_NONE { DIG 1 ; DUP ; DUG 2 } { DIG 2 ; DUP ; DUG 3 ; DIG 2 ; DUP ; DUG 3 ; CAR ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; PAIR ; DIG 22 ; DUP ; DUG 23 ; SWAP ; EXEC ; DIP { DROP } } ; DIG 1 ; DUP ; DUG 2 ; CAR ; CDR ; IF_NONE { DUP } { DIG 1 ; DUP ; DUG 2 ; DIG 3 ; DUP ; DUG 4 ; CAR ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; PAIR ; DIG 24 ; DUP ; DUG 25 ; SWAP ; EXEC ; DIP { DROP } } ; DIP { DROP } } ; DIP { DROP 3 } } ; DIP { DROP 3 } } ; DIP { DROP } ; DIG 6 ; DUP ; DUG 7 ; DIG 1 ; DUP ; DUG 2 ; DIP { DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; NIL operation ; PAIR ; DIP { DROP 5 } } { DUP ; MAP { DUP ; IF_LEFT { DUP ; LEFT (pair (address %owner) (address %operator)) ; DIP { DROP } } { DUP ; RIGHT (pair (address %owner) (address %operator)) ; DIP { DROP } } ; DUP ; IF_LEFT { DUP ; DIG 17 ; DUP ; DUG 18 ; SWAP ; EXEC ; LEFT (pair (address %operator) (address %owner)) ; DIP { DROP } } { DUP ; DIG 17 ; DUP ; DUG 18 ; SWAP ; EXEC ; RIGHT (pair (address %operator) (address %owner)) ; DIP { DROP } } ; DIP { DROP 2 } } ; SENDER ; DIG 4 ; DUP ; DUG 5 ; CAR ; CDR ; DIG 2 ; DUP ; DUG 3 ; ITER { SWAP ; PAIR ; DUP ; CDR ; DIG 2 ; DUP ; DUG 3 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DUP ; DIP { DROP } } { DUP ; DIP { DROP } } ; CDR ; COMPARE ; EQ ; IF { UNIT } { PUSH string "FA2_NOT_OWNER" ; FAILWITH } ; DIP { DROP } ; DIG 2 ; DUP ; DUG 3 ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DIG 1 ; DUP ; DUG 2 ; UNIT ; SOME ; DIG 2 ; DUP ; DUG 3 ; CAR ; DIG 3 ; DUP ; DUG 4 ; CDR ; PAIR ; UPDATE ; DIP { DROP } } { DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 2 ; DUP ; DUG 3 ; CDR ; PAIR ; NONE unit ; SWAP ; UPDATE ; DIP { DROP } } ; DIP { DROP 5 } } ; DIG 5 ; DUP ; DUG 6 ; DIG 1 ; DUP ; DUG 2 ; DIP { DUP ; CDR ; SWAP ; CAR ; CAR } ; SWAP ; PAIR ; PAIR ; NIL operation ; PAIR ; DIP { DROP 4 } } ; DIP { DROP } } ; DIP { DROP 2 } ; DIG 4 ; DUP ; DUG 5 ; DIG 1 ; DUP ; DUG 2 ; CDR ; SWAP ; CAR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIP { DROP 3 } } ; DIP { DROP } } { DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 3 ; DUP ; DUG 4 ; SWAP ; EXEC ; DIG 2 ; DUP ; DUG 3 ; CDR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; IF_LEFT { DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DUP ; CAR ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; ITER { SWAP ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 2 ; DUP ; DUG 3 ; CDR ; PAIR ; PAIR ; DIG 15 ; DUP ; DUG 16 ; SWAP ; EXEC ; DIP { DROP 2 } } ; DIP { DROP } ; DIG 2 ; DUP ; DUG 3 ; DIG 12 ; DUP ; DUG 13 ; SWAP ; EXEC ; DUP ; DIG 3 ; DUP ; DUG 4 ; CDR ; CDR ; SUB ; ISNAT ; DUP ; IF_NONE { DIG 18 ; DUP ; DUG 19 ; FAILWITH } { DUP ; DIP { DROP } } ; DIG 4 ; DUP ; DUG 5 ; DIG 4 ; DUP ; DUG 5 ; DIP { DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; DIP { DUP ; CAR ; SWAP ; CDR ; CAR } ; SWAP ; PAIR ; SWAP ; PAIR ; NIL operation ; PAIR ; DIP { DROP 8 } } { DIG 1 ; DUP ; DUG 2 ; DIG 1 ; DUP ; DUG 2 ; PAIR ; DUP ; CAR ; DIG 1 ; DUP ; DUG 2 ; CDR ; DUP ; CAR ; CAR ; DIG 2 ; DUP ; DUG 3 ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; ITER { SWAP ; PAIR ; DUP ; CDR ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 1 ; DUP ; DUG 2 ; CAR ; DIG 2 ; DUP ; DUG 3 ; CDR ; PAIR ; PAIR ; DIG 16 ; DUP ; DUG 17 ; SWAP ; EXEC ; DIP { DROP 2 } } ; DIP { DROP } ; DIG 2 ; DUP ; DUG 3 ; DIG 12 ; DUP ; DUG 13 ; SWAP ; EXEC ; DIG 2 ; DUP ; DUG 3 ; DIG 2 ; DUP ; DUG 3 ; DIP { DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; DIG 4 ; DUP ; DUG 5 ; CDR ; CDR ; ADD ; DIP { DUP ; CAR ; SWAP ; CDR ; CAR } ; SWAP ; PAIR ; SWAP ; PAIR ; DUP ; NIL operation ; PAIR ; DIP { DROP 7 } } ; DIP { DROP 2 } ; DIG 3 ; DUP ; DUG 4 ; DIG 1 ; DUP ; DUG 2 ; CDR ; SWAP ; CAR ; PAIR ; DIG 1 ; DUP ; DUG 2 ; CAR ; PAIR ; DIP { DROP 3 } } ; DIP { DROP 10 } } ; ',n,c.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(y.operationGroupID)}))},t.getSimpleStorage=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield a.TezosNodeReader.getContractStorage(e,t);return{administrator:s.JSONPath({path:"$.args[0].args[0].args[0].string",json:r})[0],paused:s.JSONPath({path:"$.args[0].args[0].args[1].prim",json:r})[0].toString().toLowerCase().startsWith("t"),pendingAdmin:s.JSONPath({path:"$.args[0].args[1].prim",json:r})[0],balanceMap:Number(s.JSONPath({path:"$.args[1].args[0].args[0].int",json:r})[0]),operatorMap:Number(s.JSONPath({path:"$.args[1].args[0].args[1].int",json:r})[0]),metadataMap:Number(s.JSONPath({path:"$.args[1].args[1].args[0].int",json:r})[0]),supply:Number(s.JSONPath({path:"$.args[1].args[1].args[1].int",json:r})[0])}}))},t.getTokenDefinition=function(t,r,o=0){return n(this,void 0,void 0,(function*(){const n=i.TezosMessageUtils.encodeBigMapKey(e.from(i.TezosMessageUtils.writePackedData(o,"nat"),"hex")),u=yield a.TezosNodeReader.getValueForBigMapKey(t,r,n);if(void 0===u)throw new Error(`Map ${r} does not contain a record for token ${o}`);return{tokenid:Number(s.JSONPath({path:"$.args[0].int",json:u})[0]),symbol:s.JSONPath({path:"$.args[1].args[0].string",json:u})[0],name:s.JSONPath({path:"$.args[1].args[1].args[0].string",json:u})[0],scale:Number(s.JSONPath({path:"$.args[1].args[1].args[1].args[0].int",json:u})[0])}}))},t.activate=function(e,t,r,o,s,i=8e5,a=2e4){return n(this,void 0,void 0,(function*(){const n=yield u.TezosNodeWriter.sendContractInvocationOperation(e,r,o,t,0,s,a,i,"pause","False",c.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(n.operationGroupID)}))},t.deactivate=function(e,t,r,o,s,i=8e5,a=2e4){return n(this,void 0,void 0,(function*(){const n=yield u.TezosNodeWriter.sendContractInvocationOperation(e,r,o,t,0,s,a,i,"pause","True",c.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(n.operationGroupID)}))},t.mint=function(e,t,r,o,s,i,a=8e5,p=2e4){return n(this,void 0,void 0,(function*(){const n=`{ ${i.map(e=>"( Pair "+e.balance+' "'+e.address+'" )').join(" ; ")} }`,f=yield u.TezosNodeWriter.sendContractInvocationOperation(e,r,o,t,0,s,p,a,"mint_tokens",n,c.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(f.operationGroupID)}))},t.transfer=function(e,t,r,o,s,i,a,p=8e5,f=2e4){return n(this,void 0,void 0,(function*(){const n=`{ Pair "${i}" { ${a.map(e=>'( Pair "'+e.address+'" ( Pair '+e.tokenid+" "+e.balance+" ) )").join(" ; ")} } }`,h=yield u.TezosNodeWriter.sendContractInvocationOperation(e,r,o,t,0,s,f,p,"transfer",n,c.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(h.operationGroupID)}))},t.getAccountBalance=function(t,r,o){return n(this,void 0,void 0,(function*(){const n=i.TezosMessageUtils.encodeBigMapKey(e.from(i.TezosMessageUtils.writePackedData(o,"address"),"hex")),u=yield a.TezosNodeReader.getValueForBigMapKey(t,r,n);if(void 0===u)throw new Error(`Map ${r} does not contain a record for ${o}`);const c=s.JSONPath({path:"$.int",json:u});return Number(c[0])}))}}(t.SingleAssetTokenHelper||(t.SingleAssetTokenHelper={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=r(6),i=o(r(3)),a=r(9),u=r(5),c=r(4),l=r(7),p=r(8);!function(t){function r(t,r,o){return n(this,void 0,void 0,(function*(){const n=e.from(u.TezosMessageUtils.writePackedData(o,"",i.TezosParameterFormat.Michelson),"hex"),l=u.TezosMessageUtils.writePackedData(n,"bytes"),p=u.TezosMessageUtils.encodeBigMapKey(e.from(l,"hex")),f=yield c.TezosNodeReader.getValueForBigMapKey(t,r,p);if(void 0===f)throw new Error(`Could not get data from map ${r} for '${o}'`);const h=s.JSONPath({path:"$.bytes",json:f})[0];return JSON.parse(a.TezosLanguageUtil.hexToMicheline(h.slice(2)).code)}))}t.verifyDestination=function(e,t){return n(this,void 0,void 0,(function*(){return p.TezosContractUtils.verifyDestination(e,t,"187c967006ca95a648c770fdd76947ef")}))},t.verifyScript=function(e){return p.TezosContractUtils.verifyScript(e,"ffcad1e376a6c8915780fe6676aceec6")},t.getAccountBalance=function(e,t,o){return n(this,void 0,void 0,(function*(){const n=yield r(e,t,`(Pair "ledger" 0x${u.TezosMessageUtils.writeAddress(o)})`);return Number(s.JSONPath({path:"$.args[0].int",json:n})[0])}))},t.getOperatorList=function(e,t){return n(this,void 0,void 0,(function*(){const n=yield r(e,t,'"operators"');let o=[];for(const e of n)o.push(u.TezosMessageUtils.readAddress(e.bytes));return o}))},t.getTokenMetadata=function(e,t){return n(this,void 0,void 0,(function*(){return yield r(e,t,'"tokenMetadata"')}))},t.getSimpleStorage=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield c.TezosNodeReader.getContractStorage(e,t);return{mapid:Number(s.JSONPath({path:"$.args[0].int",json:r})[0]),scale:8}}))},t.transferBalance=function(e,t,r,o,s,a,u,c,f=25e4,h=1e3){return n(this,void 0,void 0,(function*(){const n=`(Pair "${a}" (Pair "${u}" ${c}))`,d=yield l.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,h,f,"transfer",n,i.TezosParameterFormat.Michelson);return p.TezosContractUtils.clearRPCOperationGroupHash(d.operationGroupID)}))},t.approveBalance=function(e,t,r,o,s,a,u,c=25e4,f=1e3){return n(this,void 0,void 0,(function*(){const n=`(Right (Right (Right (Right (Left (Right (Right (Right (Pair "${a}" ${u})))))))))`,h=yield l.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,f,c,"",n,i.TezosParameterFormat.Michelson);return p.TezosContractUtils.clearRPCOperationGroupHash(h.operationGroupID)}))},t.mintBalance=function(e,t,r,o,s,a,u,c=25e4,f=1e3){return n(this,void 0,void 0,(function*(){const n=`(Right (Right (Right (Right (Right (Left (Left (Left (Pair "${a}" ${u})))))))))`,h=yield l.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,f,c,"",n,i.TezosParameterFormat.Michelson);return p.TezosContractUtils.clearRPCOperationGroupHash(h.operationGroupID)}))},t.addOperator=function(e,t,r,o,s,a,u=25e4,c=1e3){return n(this,void 0,void 0,(function*(){const n=`(Right (Right (Right (Right (Right (Left (Right (Left "${a}" ))))))))`,f=yield l.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,c,u,"",n,i.TezosParameterFormat.Michelson);return p.TezosContractUtils.clearRPCOperationGroupHash(f.operationGroupID)}))}}(t.TzbtcTokenHelper||(t.TzbtcTokenHelper={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const s=r(6),i=o(r(3)),a=r(5),u=r(4),c=r(7),l=r(8),p=r(20),f=r(3),h="d48b45bd77d2300026fe617c5ba7670e",d="5e3c30607da21a0fc30f7be61afb15c7",g="7b9b5b7e7f0283ff6388eb783e23c452",m="",y="",b="";!function(t){t.verifyDestination=function(e,t,r,o){return n(this,void 0,void 0,(function*(){const n=l.TezosContractUtils.verifyDestination(e,t,h),s=l.TezosContractUtils.verifyDestination(e,r,d),i=l.TezosContractUtils.verifyDestination(e,o,g);return n&&s&&i}))},t.verifyScript=function(e,t,r){const n=l.TezosContractUtils.verifyScript(e,m),o=l.TezosContractUtils.verifyScript(t,y),s=l.TezosContractUtils.verifyScript(r,b);return n&&o&&s},t.getSimpleStorage=function(e,t){return n(this,void 0,void 0,(function*(){const r=yield u.TezosNodeReader.getContractStorage(e,t);return console.log(JSON.stringify(r)),{balanceMap:Number(s.JSONPath({path:"$.args[1].args[0].args[1].args[0].int",json:r})[0]),approvalsMap:Number(s.JSONPath({path:"$.args[1].args[0].args[0].args[1].int",json:r})[0]),supply:Number(s.JSONPath({path:"$.args[1].args[1].args[1].int",json:r})[0]),administrator:s.JSONPath({path:"$.args[1].args[0].args[0].args[0].string",json:r})[0],paused:s.JSONPath({path:"$.args[1].args[1].args[0].prim",json:r})[0].toString().toLowerCase().startsWith("t"),pauseGuardian:s.JSONPath({path:"$.args[1].args[0].args[1].args[1].string",json:r})[0],outcomeMap:Number(s.JSONPath({path:"$.args[0].args[0].int",json:r})[0]),swapMap:Number(s.JSONPath({path:"$.args[0].args[1].int",json:r})[0])}}))},t.getAccountBalance=function(t,r,o){return n(this,void 0,void 0,(function*(){const n=a.TezosMessageUtils.encodeBigMapKey(e.from(a.TezosMessageUtils.writePackedData(o,"address"),"hex")),i=yield u.TezosNodeReader.getValueForBigMapKey(t,r,n);if(void 0===i)return 0;const c=s.JSONPath({path:"$.int",json:i});return Number(c)}))},t.transferBalance=function(e,t,r,o,s,a,u,p,f=51300,h=70){return n(this,void 0,void 0,(function*(){const n=`Pair "${a}" (Pair "${u}" ${p})`,d=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,h,f,"transfer",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(d.operationGroupID)}))},t.depositToOven=function(e,t,r,o,s,a,u=15e4,p=10){return n(this,void 0,void 0,(function*(){const n=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,a,s,p,u,"","Unit",i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(n.operationGroupID)}))},t.withdrawFromOven=function(e,t,r,o,s,a,u=121e3,p=0){return n(this,void 0,void 0,(function*(){const n=""+a,f=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,o,0,s,p,u,"withdraw",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(f.operationGroupID)}))},t.listOvens=function(e,t,r,o){return n(this,void 0,void 0,(function*(){const n=yield p.TezosConseilClient.getBigMapData(e,t);if(void 0===n)throw new Error("Could not fetch map data!");const{maps:s}=n;let i=void 0;for(let e=0;e<s.length;e++)if(s[e].definition.index===o){i=s[e];break}if(void 0===i)throw new Error("Could not find specified map ID!");const{content:u}=i;return u.map(e=>({key:a.TezosMessageUtils.readAddress(e.key.replace(/\"/g,"").replace(/\n/,"").replace("0x","")),value:a.TezosMessageUtils.readAddress(e.value.replace(/\"/g,"").replace(/\n/,"").replace("0x",""))})).filter(e=>r===e.value).map(e=>e.key)}))},t.deployOven=function(e,t,r,o,s,u,p=115e3,h=1100){return n(this,void 0,void 0,(function*(){const n=void 0!==u?`Some "${u}"`:"None",d='Pair "createOven" 0x'+a.TezosMessageUtils.writePackedData(`Pair ${n} "${r.publicKeyHash}"`,"pair (option key_hash) address",f.TezosParameterFormat.Michelson),g=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,s,0,o,h,p,"runEntrypointLambda",d,i.TezosParameterFormat.Michelson),m=l.TezosContractUtils.clearRPCOperationGroupHash(g.operationGroupID);return{operationHash:m,ovenAddress:a.TezosMessageUtils.calculateContractAddress(m,0)}}))},t.setOvenBaker=function(e,t,r,o,s,a,u=23500,p=0){return n(this,void 0,void 0,(function*(){const n=`Some "${a}"`,f=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,s,0,o,p,u,"setDelegate",n,i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(f.operationGroupID)}))},t.clearOvenBaker=function(e,t,r,o,s,a=23500,u=0){return n(this,void 0,void 0,(function*(){const n=yield c.TezosNodeWriter.sendContractInvocationOperation(e,t,r,s,0,o,u,a,"setDelegate","None",i.TezosParameterFormat.Michelson);return l.TezosContractUtils.clearRPCOperationGroupHash(n.operationGroupID)}))}}(t.WrappedTezosHelper||(t.WrappedTezosHelper={}))}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(30),i=o(r(14)),a=o(r(10)).default.log,u=i.default.fetch;!function(e){function t(e,t){return n(this,void 0,void 0,(function*(){return u(`${e.url}/v2/metadata/${t}`,{method:"GET",headers:{apiKey:e.apiKey}}).then(r=>{if(!r.ok)throw new s.ConseilRequestError(r.status,r.statusText,`${e.url}/v2/metadata/${t}`,null);return r}).then(r=>r.json().catch(r=>{a.error(`ConseilMetadataClient.executeMetadataQuery parsing failed for ${e.url}/v2/metadata/${t} with ${r}`)}))}))}e.executeMetadataQuery=t,e.getPlatforms=function(e){return n(this,void 0,void 0,(function*(){return t(e,"platforms")}))},e.getNetworks=function(e,r){return n(this,void 0,void 0,(function*(){return t(e,r+"/networks")}))},e.getEntities=function(e,r,o){return n(this,void 0,void 0,(function*(){return t(e,`${r}/${o}/entities`)}))},e.getAttributes=function(e,r,o,s){return n(this,void 0,void 0,(function*(){return t(e,`${r}/${o}/${s}/attributes`)}))},e.getAttributeValues=function(e,r,o,s,i){return n(this,void 0,void 0,(function*(){return t(e,`${r}/${o}/${s}/${i}`)}))},e.getAttributeValuesForPrefix=function(e,r,o,s,i,a){return n(this,void 0,void 0,(function*(){return t(e,`${r}/${o}/${s}/${i}/${encodeURIComponent(a)}`)}))}}(t.ConseilMetadataClient||(t.ConseilMetadataClient={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.STRING="String",e.INT="Int",e.DECIMAL="Decimal",e.BOOLEAN="Boolean",e.ACCOUNT_ADDRESS="AccountAddress",e.HASH="Hash",e.DATETIME="DateTime",e.CURRENCY="Currency"}(t.AttrbuteDataType||(t.AttrbuteDataType={})),function(e){e.PRIMARYKEY="PrimaryKey",e.UNIQUEKEY="UniqueKey",e.NONKEY="NonKey"}(t.AttrbuteKeyType||(t.AttrbuteKeyType={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Yay=0]="Yay",e[e.Nay=1]="Nay",e[e.Pass=2]="Pass"}(t.BallotVote||(t.BallotVote={}))}])}));