@dfinity/nns 8.2.2 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ import{a as De,b as _i,c as Fo}from"./chunk-IIFH2XLR.js";var Go=De(ot=>{"use strict";ot.byteLength=pi;ot.toByteArray=mi;ot.fromByteArray=gi;var G=[],M=[],di=typeof Uint8Array<"u"?Uint8Array:Array,co="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Oe=0,qo=co.length;Oe<qo;++Oe)G[Oe]=co[Oe],M[co.charCodeAt(Oe)]=Oe;var Oe,qo;M[45]=62;M[95]=63;function Uo(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var o=n===t?0:4-n%4;return[n,o]}function pi(e){var t=Uo(e),n=t[0],o=t[1];return(n+o)*3/4-o}function li(e,t,n){return(t+n)*3/4-n}function mi(e){var t,n=Uo(e),o=n[0],r=n[1],i=new di(li(e,o,r)),s=0,u=r>0?o-4:o,_;for(_=0;_<u;_+=4)t=M[e.charCodeAt(_)]<<18|M[e.charCodeAt(_+1)]<<12|M[e.charCodeAt(_+2)]<<6|M[e.charCodeAt(_+3)],i[s++]=t>>16&255,i[s++]=t>>8&255,i[s++]=t&255;return r===2&&(t=M[e.charCodeAt(_)]<<2|M[e.charCodeAt(_+1)]>>4,i[s++]=t&255),r===1&&(t=M[e.charCodeAt(_)]<<10|M[e.charCodeAt(_+1)]<<4|M[e.charCodeAt(_+2)]>>2,i[s++]=t>>8&255,i[s++]=t&255),i}function fi(e){return G[e>>18&63]+G[e>>12&63]+G[e>>6&63]+G[e&63]}function Ni(e,t,n){for(var o,r=[],i=t;i<n;i+=3)o=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),r.push(fi(o));return r.join("")}function gi(e){for(var t,n=e.length,o=n%3,r=[],i=16383,s=0,u=n-o;s<u;s+=i)r.push(Ni(e,s,s+i>u?u:s+i));return o===1?(t=e[n-1],r.push(G[t>>2]+G[t<<4&63]+"==")):o===2&&(t=(e[n-2]<<8)+e[n-1],r.push(G[t>>10]+G[t>>4&63]+G[t<<2&63]+"=")),r.join("")}});var Ko=De(uo=>{uo.read=function(e,t,n,o,r){var i,s,u=r*8-o-1,_=(1<<u)-1,m=_>>1,l=-7,p=n?r-1:0,g=n?-1:1,N=e[t+p];for(p+=g,i=N&(1<<-l)-1,N>>=-l,l+=u;l>0;i=i*256+e[t+p],p+=g,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=o;l>0;s=s*256+e[t+p],p+=g,l-=8);if(i===0)i=1-m;else{if(i===_)return s?NaN:(N?-1:1)*(1/0);s=s+Math.pow(2,o),i=i-m}return(N?-1:1)*s*Math.pow(2,i-o)};uo.write=function(e,t,n,o,r,i){var s,u,_,m=i*8-r-1,l=(1<<m)-1,p=l>>1,g=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=o?0:i-1,U=o?1:-1,z=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(_=Math.pow(2,-s))<1&&(s--,_*=2),s+p>=1?t+=g/_:t+=g*Math.pow(2,1-p),t*_>=2&&(s++,_/=2),s+p>=l?(u=0,s=l):s+p>=1?(u=(t*_-1)*Math.pow(2,r),s=s+p):(u=t*Math.pow(2,p-1)*Math.pow(2,r),s=0));r>=8;e[n+N]=u&255,N+=U,u/=256,r-=8);for(s=s<<r|u,m+=r;m>0;e[n+N]=s&255,N+=U,s/=256,m-=8);e[n+N-U]|=z*128}});var or=De(xe=>{"use strict";var _o=Go(),ve=Ko(),Ho=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;xe.Buffer=a;xe.SlowBuffer=vi;xe.INSPECT_MAX_BYTES=50;var rt=2147483647;xe.kMaxLength=rt;a.TYPED_ARRAY_SUPPORT=wi();!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function wi(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}});Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function ne(e){if(e>rt)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return fo(e)}return zo(e,t,n)}a.poolSize=8192;function zo(e,t,n){if(typeof e=="string")return Oi(e,t);if(ArrayBuffer.isView(e))return yi(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return lo(e,t,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return a.from(o,t,n);let r=hi(e);if(r)return r;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return a.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}a.from=function(e,t,n){return zo(e,t,n)};Object.setPrototypeOf(a.prototype,Uint8Array.prototype);Object.setPrototypeOf(a,Uint8Array);function Xo(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function Ri(e,t,n){return Xo(e),e<=0?ne(e):t!==void 0?typeof n=="string"?ne(e).fill(t,n):ne(e).fill(t):ne(e)}a.alloc=function(e,t,n){return Ri(e,t,n)};function fo(e){return Xo(e),ne(e<0?0:No(e)|0)}a.allocUnsafe=function(e){return fo(e)};a.allocUnsafeSlow=function(e){return fo(e)};function Oi(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let n=Jo(e,t)|0,o=ne(n),r=o.write(e,t);return r!==n&&(o=o.slice(0,r)),o}function po(e){let t=e.length<0?0:No(e.length)|0,n=ne(t);for(let o=0;o<t;o+=1)n[o]=e[o]&255;return n}function yi(e){if(K(e,Uint8Array)){let t=new Uint8Array(e);return lo(t.buffer,t.byteOffset,t.byteLength)}return po(e)}function lo(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let o;return t===void 0&&n===void 0?o=new Uint8Array(e):n===void 0?o=new Uint8Array(e,t):o=new Uint8Array(e,t,n),Object.setPrototypeOf(o,a.prototype),o}function hi(e){if(a.isBuffer(e)){let t=No(e.length)|0,n=ne(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!="number"||wo(e.length)?ne(0):po(e);if(e.type==="Buffer"&&Array.isArray(e.data))return po(e.data)}function No(e){if(e>=rt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+rt.toString(16)+" bytes");return e|0}function vi(e){return+e!=e&&(e=0),a.alloc(+e)}a.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==a.prototype};a.compare=function(t,n){if(K(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),K(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),!a.isBuffer(t)||!a.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===n)return 0;let o=t.length,r=n.length;for(let i=0,s=Math.min(o,r);i<s;++i)if(t[i]!==n[i]){o=t[i],r=n[i];break}return o<r?-1:r<o?1:0};a.isEncoding=function(t){switch(String(t).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}};a.concat=function(t,n){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);let o;if(n===void 0)for(n=0,o=0;o<t.length;++o)n+=t[o].length;let r=a.allocUnsafe(n),i=0;for(o=0;o<t.length;++o){let s=t[o];if(K(s,Uint8Array))i+s.length>r.length?(a.isBuffer(s)||(s=a.from(s)),s.copy(r,i)):Uint8Array.prototype.set.call(r,s,i);else if(a.isBuffer(s))s.copy(r,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=s.length}return r};function Jo(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&n===0)return 0;let r=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return mo(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return nr(e).length;default:if(r)return o?-1:mo(e).length;t=(""+t).toLowerCase(),r=!0}}a.byteLength=Jo;function bi(e,t,n){let o=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return Bi(this,t,n);case"utf8":case"utf-8":return Qo(this,t,n);case"ascii":return Mi(this,t,n);case"latin1":case"binary":return Ai(this,t,n);case"base64":return Ci(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ei(this,t,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}a.prototype._isBuffer=!0;function ye(e,t,n){let o=e[t];e[t]=e[n],e[n]=o}a.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<t;n+=2)ye(this,n,n+1);return this};a.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<t;n+=4)ye(this,n,n+3),ye(this,n+1,n+2);return this};a.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<t;n+=8)ye(this,n,n+7),ye(this,n+1,n+6),ye(this,n+2,n+5),ye(this,n+3,n+4);return this};a.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?Qo(this,0,t):bi.apply(this,arguments)};a.prototype.toLocaleString=a.prototype.toString;a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.inspect=function(){let t="",n=xe.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"};Ho&&(a.prototype[Ho]=a.prototype.inspect);a.prototype.compare=function(t,n,o,r,i){if(K(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(n===void 0&&(n=0),o===void 0&&(o=t?t.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),n<0||o>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&n>=o)return 0;if(r>=i)return-1;if(n>=o)return 1;if(n>>>=0,o>>>=0,r>>>=0,i>>>=0,this===t)return 0;let s=i-r,u=o-n,_=Math.min(s,u),m=this.slice(r,i),l=t.slice(n,o);for(let p=0;p<_;++p)if(m[p]!==l[p]){s=m[p],u=l[p];break}return s<u?-1:u<s?1:0};function Yo(e,t,n,o,r){if(e.length===0)return-1;if(typeof n=="string"?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,wo(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0)if(r)n=0;else return-1;if(typeof t=="string"&&(t=a.from(t,o)),a.isBuffer(t))return t.length===0?-1:jo(e,t,n,o,r);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):jo(e,[t],n,o,r);throw new TypeError("val must be string, number or Buffer")}function jo(e,t,n,o,r){let i=1,s=e.length,u=t.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(e.length<2||t.length<2)return-1;i=2,s/=2,u/=2,n/=2}function _(l,p){return i===1?l[p]:l.readUInt16BE(p*i)}let m;if(r){let l=-1;for(m=n;m<s;m++)if(_(e,m)===_(t,l===-1?0:m-l)){if(l===-1&&(l=m),m-l+1===u)return l*i}else l!==-1&&(m-=m-l),l=-1}else for(n+u>s&&(n=s-u),m=n;m>=0;m--){let l=!0;for(let p=0;p<u;p++)if(_(e,m+p)!==_(t,p)){l=!1;break}if(l)return m}return-1}a.prototype.includes=function(t,n,o){return this.indexOf(t,n,o)!==-1};a.prototype.indexOf=function(t,n,o){return Yo(this,t,n,o,!0)};a.prototype.lastIndexOf=function(t,n,o){return Yo(this,t,n,o,!1)};function xi(e,t,n,o){n=Number(n)||0;let r=e.length-n;o?(o=Number(o),o>r&&(o=r)):o=r;let i=t.length;o>i/2&&(o=i/2);let s;for(s=0;s<o;++s){let u=parseInt(t.substr(s*2,2),16);if(wo(u))return s;e[n+s]=u}return s}function Si(e,t,n,o){return it(mo(t,e.length-n),e,n,o)}function ki(e,t,n,o){return it(Gi(t),e,n,o)}function Pi(e,t,n,o){return it(nr(t),e,n,o)}function Ti(e,t,n,o){return it(Ki(t,e.length-n),e,n,o)}a.prototype.write=function(t,n,o,r){if(n===void 0)r="utf8",o=this.length,n=0;else if(o===void 0&&typeof n=="string")r=n,o=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(o)?(o=o>>>0,r===void 0&&(r="utf8")):(r=o,o=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let i=this.length-n;if((o===void 0||o>i)&&(o=i),t.length>0&&(o<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let s=!1;for(;;)switch(r){case"hex":return xi(this,t,n,o);case"utf8":case"utf-8":return Si(this,t,n,o);case"ascii":case"latin1":case"binary":return ki(this,t,n,o);case"base64":return Pi(this,t,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ti(this,t,n,o);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ci(e,t,n){return t===0&&n===e.length?_o.fromByteArray(e):_o.fromByteArray(e.slice(t,n))}function Qo(e,t,n){n=Math.min(e.length,n);let o=[],r=t;for(;r<n;){let i=e[r],s=null,u=i>239?4:i>223?3:i>191?2:1;if(r+u<=n){let _,m,l,p;switch(u){case 1:i<128&&(s=i);break;case 2:_=e[r+1],(_&192)===128&&(p=(i&31)<<6|_&63,p>127&&(s=p));break;case 3:_=e[r+1],m=e[r+2],(_&192)===128&&(m&192)===128&&(p=(i&15)<<12|(_&63)<<6|m&63,p>2047&&(p<55296||p>57343)&&(s=p));break;case 4:_=e[r+1],m=e[r+2],l=e[r+3],(_&192)===128&&(m&192)===128&&(l&192)===128&&(p=(i&15)<<18|(_&63)<<12|(m&63)<<6|l&63,p>65535&&p<1114112&&(s=p))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,o.push(s>>>10&1023|55296),s=56320|s&1023),o.push(s),r+=u}return Vi(o)}var Wo=4096;function Vi(e){let t=e.length;if(t<=Wo)return String.fromCharCode.apply(String,e);let n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=Wo));return n}function Mi(e,t,n){let o="";n=Math.min(e.length,n);for(let r=t;r<n;++r)o+=String.fromCharCode(e[r]&127);return o}function Ai(e,t,n){let o="";n=Math.min(e.length,n);for(let r=t;r<n;++r)o+=String.fromCharCode(e[r]);return o}function Bi(e,t,n){let o=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>o)&&(n=o);let r="";for(let i=t;i<n;++i)r+=Hi[e[i]];return r}function Ei(e,t,n){let o=e.slice(t,n),r="";for(let i=0;i<o.length-1;i+=2)r+=String.fromCharCode(o[i]+o[i+1]*256);return r}a.prototype.slice=function(t,n){let o=this.length;t=~~t,n=n===void 0?o:~~n,t<0?(t+=o,t<0&&(t=0)):t>o&&(t=o),n<0?(n+=o,n<0&&(n=0)):n>o&&(n=o),n<t&&(n=t);let r=this.subarray(t,n);return Object.setPrototypeOf(r,a.prototype),r};function v(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(t,n,o){t=t>>>0,n=n>>>0,o||v(t,n,this.length);let r=this[t],i=1,s=0;for(;++s<n&&(i*=256);)r+=this[t+s]*i;return r};a.prototype.readUintBE=a.prototype.readUIntBE=function(t,n,o){t=t>>>0,n=n>>>0,o||v(t,n,this.length);let r=this[t+--n],i=1;for(;n>0&&(i*=256);)r+=this[t+--n]*i;return r};a.prototype.readUint8=a.prototype.readUInt8=function(t,n){return t=t>>>0,n||v(t,1,this.length),this[t]};a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,n){return t=t>>>0,n||v(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,n){return t=t>>>0,n||v(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,n){return t=t>>>0,n||v(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,n){return t=t>>>0,n||v(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readBigUInt64LE=ie(function(t){t=t>>>0,be(t,"offset");let n=this[t],o=this[t+7];(n===void 0||o===void 0)&&Le(t,this.length-8);let r=n+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,i=this[++t]+this[++t]*2**8+this[++t]*2**16+o*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))});a.prototype.readBigUInt64BE=ie(function(t){t=t>>>0,be(t,"offset");let n=this[t],o=this[t+7];(n===void 0||o===void 0)&&Le(t,this.length-8);let r=n*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],i=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+o;return(BigInt(r)<<BigInt(32))+BigInt(i)});a.prototype.readIntLE=function(t,n,o){t=t>>>0,n=n>>>0,o||v(t,n,this.length);let r=this[t],i=1,s=0;for(;++s<n&&(i*=256);)r+=this[t+s]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*n)),r};a.prototype.readIntBE=function(t,n,o){t=t>>>0,n=n>>>0,o||v(t,n,this.length);let r=n,i=1,s=this[t+--r];for(;r>0&&(i*=256);)s+=this[t+--r]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*n)),s};a.prototype.readInt8=function(t,n){return t=t>>>0,n||v(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,n){t=t>>>0,n||v(t,2,this.length);let o=this[t]|this[t+1]<<8;return o&32768?o|4294901760:o};a.prototype.readInt16BE=function(t,n){t=t>>>0,n||v(t,2,this.length);let o=this[t+1]|this[t]<<8;return o&32768?o|4294901760:o};a.prototype.readInt32LE=function(t,n){return t=t>>>0,n||v(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,n){return t=t>>>0,n||v(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readBigInt64LE=ie(function(t){t=t>>>0,be(t,"offset");let n=this[t],o=this[t+7];(n===void 0||o===void 0)&&Le(t,this.length-8);let r=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(o<<24);return(BigInt(r)<<BigInt(32))+BigInt(n+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});a.prototype.readBigInt64BE=ie(function(t){t=t>>>0,be(t,"offset");let n=this[t],o=this[t+7];(n===void 0||o===void 0)&&Le(t,this.length-8);let r=(n<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+o)});a.prototype.readFloatLE=function(t,n){return t=t>>>0,n||v(t,4,this.length),ve.read(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,n){return t=t>>>0,n||v(t,4,this.length),ve.read(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,n){return t=t>>>0,n||v(t,8,this.length),ve.read(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,n){return t=t>>>0,n||v(t,8,this.length),ve.read(this,t,!1,52,8)};function T(e,t,n,o,r,i){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<i)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,n,o,r){if(t=+t,n=n>>>0,o=o>>>0,!r){let u=Math.pow(2,8*o)-1;T(this,t,n,o,u,0)}let i=1,s=0;for(this[n]=t&255;++s<o&&(i*=256);)this[n+s]=t/i&255;return n+o};a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,n,o,r){if(t=+t,n=n>>>0,o=o>>>0,!r){let u=Math.pow(2,8*o)-1;T(this,t,n,o,u,0)}let i=o-1,s=1;for(this[n+i]=t&255;--i>=0&&(s*=256);)this[n+i]=t/s&255;return n+o};a.prototype.writeUint8=a.prototype.writeUInt8=function(t,n,o){return t=+t,n=n>>>0,o||T(this,t,n,1,255,0),this[n]=t&255,n+1};a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,n,o){return t=+t,n=n>>>0,o||T(this,t,n,2,65535,0),this[n]=t&255,this[n+1]=t>>>8,n+2};a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,n,o){return t=+t,n=n>>>0,o||T(this,t,n,2,65535,0),this[n]=t>>>8,this[n+1]=t&255,n+2};a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,n,o){return t=+t,n=n>>>0,o||T(this,t,n,4,4294967295,0),this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=t&255,n+4};a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,n,o){return t=+t,n=n>>>0,o||T(this,t,n,4,4294967295,0),this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255,n+4};function Zo(e,t,n,o,r){tr(t,o,r,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i=i>>8,e[n++]=i,i=i>>8,e[n++]=i,i=i>>8,e[n++]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s=s>>8,e[n++]=s,s=s>>8,e[n++]=s,s=s>>8,e[n++]=s,n}function Io(e,t,n,o,r){tr(t,o,r,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i=i>>8,e[n+6]=i,i=i>>8,e[n+5]=i,i=i>>8,e[n+4]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s=s>>8,e[n+2]=s,s=s>>8,e[n+1]=s,s=s>>8,e[n]=s,n+8}a.prototype.writeBigUInt64LE=ie(function(t,n=0){return Zo(this,t,n,BigInt(0),BigInt("0xffffffffffffffff"))});a.prototype.writeBigUInt64BE=ie(function(t,n=0){return Io(this,t,n,BigInt(0),BigInt("0xffffffffffffffff"))});a.prototype.writeIntLE=function(t,n,o,r){if(t=+t,n=n>>>0,!r){let _=Math.pow(2,8*o-1);T(this,t,n,o,_-1,-_)}let i=0,s=1,u=0;for(this[n]=t&255;++i<o&&(s*=256);)t<0&&u===0&&this[n+i-1]!==0&&(u=1),this[n+i]=(t/s>>0)-u&255;return n+o};a.prototype.writeIntBE=function(t,n,o,r){if(t=+t,n=n>>>0,!r){let _=Math.pow(2,8*o-1);T(this,t,n,o,_-1,-_)}let i=o-1,s=1,u=0;for(this[n+i]=t&255;--i>=0&&(s*=256);)t<0&&u===0&&this[n+i+1]!==0&&(u=1),this[n+i]=(t/s>>0)-u&255;return n+o};a.prototype.writeInt8=function(t,n,o){return t=+t,n=n>>>0,o||T(this,t,n,1,127,-128),t<0&&(t=255+t+1),this[n]=t&255,n+1};a.prototype.writeInt16LE=function(t,n,o){return t=+t,n=n>>>0,o||T(this,t,n,2,32767,-32768),this[n]=t&255,this[n+1]=t>>>8,n+2};a.prototype.writeInt16BE=function(t,n,o){return t=+t,n=n>>>0,o||T(this,t,n,2,32767,-32768),this[n]=t>>>8,this[n+1]=t&255,n+2};a.prototype.writeInt32LE=function(t,n,o){return t=+t,n=n>>>0,o||T(this,t,n,4,2147483647,-2147483648),this[n]=t&255,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24,n+4};a.prototype.writeInt32BE=function(t,n,o){return t=+t,n=n>>>0,o||T(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255,n+4};a.prototype.writeBigInt64LE=ie(function(t,n=0){return Zo(this,t,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});a.prototype.writeBigInt64BE=ie(function(t,n=0){return Io(this,t,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Do(e,t,n,o,r,i){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Lo(e,t,n,o,r){return t=+t,n=n>>>0,r||Do(e,t,n,4,34028234663852886e22,-34028234663852886e22),ve.write(e,t,n,o,23,4),n+4}a.prototype.writeFloatLE=function(t,n,o){return Lo(this,t,n,!0,o)};a.prototype.writeFloatBE=function(t,n,o){return Lo(this,t,n,!1,o)};function er(e,t,n,o,r){return t=+t,n=n>>>0,r||Do(e,t,n,8,17976931348623157e292,-17976931348623157e292),ve.write(e,t,n,o,52,8),n+8}a.prototype.writeDoubleLE=function(t,n,o){return er(this,t,n,!0,o)};a.prototype.writeDoubleBE=function(t,n,o){return er(this,t,n,!1,o)};a.prototype.copy=function(t,n,o,r){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(o||(o=0),!r&&r!==0&&(r=this.length),n>=t.length&&(n=t.length),n||(n=0),r>0&&r<o&&(r=o),r===o||t.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(o<0||o>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-n<r-o&&(r=t.length-n+o);let i=r-o;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,o,r):Uint8Array.prototype.set.call(t,this.subarray(o,r),n),i};a.prototype.fill=function(t,n,o,r){if(typeof t=="string"){if(typeof n=="string"?(r=n,n=0,o=this.length):typeof o=="string"&&(r=o,o=this.length),r!==void 0&&typeof r!="string")throw new TypeError("encoding must be a string");if(typeof r=="string"&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(t.length===1){let s=t.charCodeAt(0);(r==="utf8"&&s<128||r==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(n<0||this.length<n||this.length<o)throw new RangeError("Out of range index");if(o<=n)return this;n=n>>>0,o=o===void 0?this.length:o>>>0,t||(t=0);let i;if(typeof t=="number")for(i=n;i<o;++i)this[i]=t;else{let s=a.isBuffer(t)?t:a.from(t,r),u=s.length;if(u===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<o-n;++i)this[i+n]=s[i%u]}return this};var he={};function go(e,t,n){he[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(r){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:r,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}go("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);go("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);go("ERR_OUT_OF_RANGE",function(e,t,n){let o=`The value of "${e}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=$o(String(n)):typeof n=="bigint"&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=$o(r)),r+="n"),o+=` It must be ${t}. Received ${r}`,o},RangeError);function $o(e){let t="",n=e.length,o=e[0]==="-"?1:0;for(;n>=o+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function Fi(e,t,n){be(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&Le(t,e.length-(n+1))}function tr(e,t,n,o,r,i){if(e>n||e<t){let s=typeof t=="bigint"?"n":"",u;throw i>3?t===0||t===BigInt(0)?u=`>= 0${s} and < 2${s} ** ${(i+1)*8}${s}`:u=`>= -(2${s} ** ${(i+1)*8-1}${s}) and < 2 ** ${(i+1)*8-1}${s}`:u=`>= ${t}${s} and <= ${n}${s}`,new he.ERR_OUT_OF_RANGE("value",u,e)}Fi(o,r,i)}function be(e,t){if(typeof e!="number")throw new he.ERR_INVALID_ARG_TYPE(t,"number",e)}function Le(e,t,n){throw Math.floor(e)!==e?(be(e,n),new he.ERR_OUT_OF_RANGE(n||"offset","an integer",e)):t<0?new he.ERR_BUFFER_OUT_OF_BOUNDS:new he.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}var qi=/[^+/0-9A-Za-z-_]/g;function Ui(e){if(e=e.split("=")[0],e=e.trim().replace(qi,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function mo(e,t){t=t||1/0;let n,o=e.length,r=null,i=[];for(let s=0;s<o;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}else if(s+1===o){(t-=3)>-1&&i.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),r=n;continue}n=(r-55296<<10|n-56320)+65536}else r&&(t-=3)>-1&&i.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return i}function Gi(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function Ki(e,t){let n,o,r,i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),o=n>>8,r=n%256,i.push(r),i.push(o);return i}function nr(e){return _o.toByteArray(Ui(e))}function it(e,t,n,o){let r;for(r=0;r<o&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function K(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function wo(e){return e!==e}var Hi=function(){let e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){let o=n*16;for(let r=0;r<16;++r)t[o+r]=e[n]+e[r]}return t}();function ie(e){return typeof BigInt>"u"?ji:e}function ji(){throw new Error("BigInt not supported")}});var sr=De((Ro,ir)=>{var st=or(),oe=st.Buffer;function rr(e,t){for(var n in e)t[n]=e[n]}oe.from&&oe.alloc&&oe.allocUnsafe&&oe.allocUnsafeSlow?ir.exports=st:(rr(st,Ro),Ro.Buffer=Se);function Se(e,t,n){return oe(e,t,n)}rr(oe,Se);Se.from=function(e,t,n){if(typeof e=="number")throw new TypeError("Argument must not be a number");return oe(e,t,n)};Se.alloc=function(e,t,n){if(typeof e!="number")throw new TypeError("Argument must be a number");var o=oe(e);return t!==void 0?typeof n=="string"?o.fill(t,n):o.fill(t):o.fill(0),o};Se.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return oe(e)};Se.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return st.SlowBuffer(e)}});var ar=De((Ra,yo)=>{"use strict";var Oo=65536,Wi=4294967295;function $i(){throw new Error(`Secure random number generation is not supported by this browser.
2
+ Use Chrome, Firefox or Internet Explorer 11`)}var zi=sr().Buffer,at=window.crypto||window.msCrypto;at&&at.getRandomValues?yo.exports=Xi:yo.exports=$i;function Xi(e,t){if(e>Wi)throw new RangeError("requested too many random bytes");var n=zi.allocUnsafe(e);if(e>0)if(e>Oo)for(var o=0;o<e;o+=Oo)at.getRandomValues(n.slice(o,o+Oo));else at.getRandomValues(n);return typeof t=="function"?process.nextTick(function(){t(null,n)}):n}});var ci=_i(ar());import{Actor as pa}from"@dfinity/agent";import{AccountIdentifier as ii,checkAccountId as si}from"@dfinity/ledger-icp";import{assertPercentageNumber as Eo,createServices as la,fromNullable as P,isNullish as Rt,nonNullish as $,uint8ArrayToBigInt as ma}from"@dfinity/utils";var cr=({IDL:e})=>{let t=e.Rec(),n=e.Rec(),o=e.Record({id:e.Nat64}),r=e.Record({followees:e.Vec(o)}),i=e.Record({name:e.Text,description:e.Opt(e.Text)}),s=e.Record({id:e.Opt(o),known_neuron_data:e.Opt(i)}),u=e.Record({percentage_to_spawn:e.Opt(e.Nat32),new_controller:e.Opt(e.Principal),nonce:e.Opt(e.Nat64)}),_=e.Record({amount_e8s:e.Nat64}),m=e.Record({topic:e.Int32,followees:e.Vec(o)}),l=e.Record({}),p=e.Record({controller:e.Opt(e.Principal),memo:e.Nat64}),g=e.Variant({NeuronIdOrSubaccount:e.Record({}),MemoAndController:p,Memo:e.Nat64}),N=e.Record({by:e.Opt(g)}),U=e.Record({hot_key_to_remove:e.Opt(e.Principal)}),z=e.Record({new_hot_key:e.Opt(e.Principal)}),Ot=e.Record({requested_setting_for_auto_stake_maturity:e.Bool}),yt=e.Record({additional_dissolve_delay_seconds:e.Nat32}),ht=e.Record({visibility:e.Opt(e.Int32)}),f=e.Record({dissolve_timestamp_seconds:e.Nat64}),vt=e.Variant({RemoveHotKey:U,AddHotKey:z,ChangeAutoStakeMaturity:Ot,StopDissolving:e.Record({}),StartDissolving:e.Record({}),IncreaseDissolveDelay:yt,SetVisibility:ht,JoinCommunityFund:e.Record({}),LeaveCommunityFund:e.Record({}),SetDissolveTimestamp:f}),de=e.Record({operation:e.Opt(vt)}),x=e.Record({id:e.Nat64}),Pe=e.Record({vote:e.Int32,proposal:e.Opt(x)}),pe=e.Record({source_neuron_id:e.Opt(o)}),le=e.Record({dissolve_delay_seconds:e.Nat64,kyc_verified:e.Bool,amount_e8s:e.Nat64,new_controller:e.Opt(e.Principal),nonce:e.Nat64}),Te=e.Record({percentage_to_stake:e.Opt(e.Nat32)}),me=e.Record({percentage_to_merge:e.Nat32}),X=e.Record({hash:e.Vec(e.Nat8)}),bt=e.Record({e8s:e.Nat64}),fe=e.Record({to_account:e.Opt(X),amount:e.Opt(bt)}),xt=e.Variant({Spawn:u,Split:_,Follow:m,RefreshVotingPower:l,ClaimOrRefresh:N,Configure:de,RegisterVote:Pe,Merge:pe,DisburseToNeuron:le,MakeProposal:n,StakeMaturity:Te,MergeMaturity:me,Disburse:fe}),J=e.Variant({Subaccount:e.Vec(e.Nat8),NeuronId:o}),St=e.Record({id:e.Opt(o),command:e.Opt(xt),neuron_id_or_subaccount:e.Opt(J)}),kt=e.Record({controllers:e.Vec(e.Principal)}),Pt=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),controllers:e.Opt(kt),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),Ce=e.Record({canister_id:e.Opt(e.Principal),settings:e.Opt(Pt)}),Tt=e.Record({skip_stopping_before_installing:e.Opt(e.Bool),wasm_module_hash:e.Opt(e.Vec(e.Nat8)),canister_id:e.Opt(e.Principal),arg_hash:e.Opt(e.Vec(e.Nat8)),install_mode:e.Opt(e.Int32)}),Ve=e.Record({action:e.Opt(e.Int32),canister_id:e.Opt(e.Principal)}),C=e.Record({basis_points:e.Opt(e.Nat64)}),y=e.Record({seconds:e.Opt(e.Nat64)}),w=e.Record({e8s:e.Opt(e.Nat64)}),Ct=e.Record({reward_rate_transition_duration:e.Opt(y),initial_reward_rate:e.Opt(C),final_reward_rate:e.Opt(C)}),Vt=e.Record({neuron_maximum_dissolve_delay_bonus:e.Opt(C),neuron_maximum_age_for_age_bonus:e.Opt(y),neuron_maximum_dissolve_delay:e.Opt(y),neuron_minimum_dissolve_delay_to_vote:e.Opt(y),neuron_maximum_age_bonus:e.Opt(C),neuron_minimum_stake:e.Opt(w),proposal_wait_for_quiet_deadline_increase:e.Opt(y),proposal_initial_voting_period:e.Opt(y),proposal_rejection_fee:e.Opt(w),voting_reward_parameters:e.Opt(Ct)}),Me=e.Record({base64_encoding:e.Opt(e.Text)}),Mt=e.Record({transaction_fee:e.Opt(w),token_symbol:e.Opt(e.Text),token_logo:e.Opt(Me),token_name:e.Opt(e.Text)}),At=e.Record({id:e.Opt(e.Principal)}),Bt=e.Record({dissolve_delay_interval:e.Opt(y),count:e.Opt(e.Nat64)}),Et=e.Record({seconds_after_utc_midnight:e.Opt(e.Nat64)}),Ft=e.Record({iso_codes:e.Vec(e.Text)}),qt=e.Record({minimum_participants:e.Opt(e.Nat64),neurons_fund_participation:e.Opt(e.Bool),duration:e.Opt(y),neuron_basket_construction_parameters:e.Opt(Bt),confirmation_text:e.Opt(e.Text),maximum_participant_icp:e.Opt(w),minimum_icp:e.Opt(w),minimum_direct_participation_icp:e.Opt(w),minimum_participant_icp:e.Opt(w),start_time:e.Opt(Et),maximum_direct_participation_icp:e.Opt(w),maximum_icp:e.Opt(w),neurons_fund_investment_icp:e.Opt(w),restricted_countries:e.Opt(Ft)}),Ae=e.Record({total:e.Opt(w)}),Ut=e.Record({controller:e.Opt(e.Principal),dissolve_delay:e.Opt(y),memo:e.Opt(e.Nat64),vesting_period:e.Opt(y),stake:e.Opt(w)}),c=e.Record({developer_neurons:e.Vec(Ut)}),Gt=e.Record({treasury_distribution:e.Opt(Ae),developer_distribution:e.Opt(c),swap_distribution:e.Opt(Ae)}),Be=e.Record({url:e.Opt(e.Text),governance_parameters:e.Opt(Vt),fallback_controller_principal_ids:e.Vec(e.Principal),logo:e.Opt(Me),name:e.Opt(e.Text),ledger_parameters:e.Opt(Mt),description:e.Opt(e.Text),dapp_canisters:e.Vec(At),swap_parameters:e.Opt(qt),initial_token_distribution:e.Opt(Gt)}),Ee=e.Record({nns_function:e.Int32,payload:e.Vec(e.Nat8)}),S=e.Record({id:e.Opt(e.Principal),reward_account:e.Opt(X)}),Kt=e.Record({dissolve_delay_seconds:e.Nat64}),Ht=e.Record({to_account:e.Opt(X)}),jt=e.Variant({RewardToNeuron:Kt,RewardToAccount:Ht}),Y=e.Record({node_provider:e.Opt(S),reward_mode:e.Opt(jt),amount_e8s:e.Nat64}),Wt=e.Record({dissolve_delay_interval_seconds:e.Nat64,count:e.Nat64}),$t=e.Record({min_participant_icp_e8s:e.Nat64,neuron_basket_construction_parameters:e.Opt(Wt),max_icp_e8s:e.Nat64,swap_due_timestamp_seconds:e.Nat64,min_participants:e.Nat32,sns_token_e8s:e.Nat64,sale_delay_seconds:e.Opt(e.Nat64),max_participant_icp_e8s:e.Nat64,min_direct_participation_icp_e8s:e.Opt(e.Nat64),min_icp_e8s:e.Nat64,max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),zt=e.Record({community_fund_investment_e8s:e.Opt(e.Nat64),target_swap_canister_id:e.Opt(e.Principal),params:e.Opt($t)}),Xt=e.Record({start_timestamp_seconds:e.Nat64,end_timestamp_seconds:e.Nat64}),Jt=e.Record({open_time_window:e.Opt(Xt)}),Yt=e.Record({request:e.Opt(Jt),swap_canister_id:e.Opt(e.Principal)}),Qt=e.Record({default_followees:e.Vec(e.Tuple(e.Int32,r))}),Fe=e.Record({use_registry_derived_rewards:e.Opt(e.Bool),rewards:e.Vec(Y)}),Zt=e.Record({start_reducing_voting_power_after_seconds:e.Opt(e.Nat64),clear_following_after_seconds:e.Opt(e.Nat64)}),Q=e.Record({human_readable:e.Opt(e.Text)}),It=e.Record({contribution_threshold_xdr:e.Opt(Q),one_third_participation_milestone_xdr:e.Opt(Q),full_participation_milestone_xdr:e.Opt(Q)}),Dt=e.Record({maximum_icp_xdr_rate:e.Opt(C),neurons_fund_matched_funding_curve_coefficients:e.Opt(It),max_theoretical_neurons_fund_participation_amount_xdr:e.Opt(Q),minimum_icp_xdr_rate:e.Opt(C)}),Z=e.Record({neuron_minimum_stake_e8s:e.Nat64,voting_power_economics:e.Opt(Zt),max_proposals_to_keep_per_topic:e.Nat32,neuron_management_fee_per_proposal_e8s:e.Nat64,reject_cost_e8s:e.Nat64,transaction_fee_e8s:e.Nat64,neuron_spawn_dissolve_delay_seconds:e.Nat64,minimum_icp_xdr_rate:e.Nat64,maximum_node_provider_rewards_e8s:e.Nat64,neurons_fund_economics:e.Opt(Dt)}),Ne=e.Record({principals:e.Vec(e.Principal)}),Lt=e.Variant({ToRemove:S,ToAdd:S}),qe=e.Record({change:e.Opt(Lt)}),Ue=e.Record({motion_text:e.Text}),en=e.Variant({RegisterKnownNeuron:s,ManageNeuron:St,UpdateCanisterSettings:Ce,InstallCode:Tt,StopOrStartCanister:Ve,CreateServiceNervousSystem:Be,ExecuteNnsFunction:Ee,RewardNodeProvider:Y,OpenSnsTokenSwap:zt,SetSnsTokenSwapOpenTimeWindow:Yt,SetDefaultFollowees:Qt,RewardNodeProviders:Fe,ManageNetworkEconomics:Z,ApproveGenesisKyc:Ne,AddOrRemoveNodeProvider:qe,Motion:Ue});n.fill(e.Record({url:e.Text,title:e.Opt(e.Text),action:e.Opt(en),summary:e.Text}));let tn=e.Record({proposal:e.Opt(n),caller:e.Opt(e.Principal),proposer_id:e.Opt(o)}),Ge=e.Record({xdr_permyriad_per_icp:e.Opt(e.Nat64),timestamp_seconds:e.Opt(e.Nat64)}),I=e.Record({minimum_xdr_permyriad_per_icp:e.Opt(e.Nat64),registry_version:e.Opt(e.Nat64),node_providers:e.Vec(S),timestamp:e.Nat64,rewards:e.Vec(Y),xdr_conversion_rate:e.Opt(Ge),maximum_node_provider_rewards_e8s:e.Opt(e.Nat64)}),D=e.Record({total_maturity_e8s_equivalent:e.Opt(e.Nat64),maturity_e8s_equivalent_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),voting_power_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),total_staked_e8s:e.Opt(e.Nat64),count:e.Opt(e.Nat64),deciding_voting_power_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),total_staked_maturity_e8s_equivalent:e.Opt(e.Nat64),total_potential_voting_power:e.Opt(e.Nat64),total_deciding_voting_power:e.Opt(e.Nat64),staked_maturity_e8s_equivalent_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),staked_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),total_voting_power:e.Opt(e.Nat64),potential_voting_power_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64))}),Ke=e.Record({total_maturity_e8s_equivalent:e.Nat64,not_dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),dissolving_neurons_staked_maturity_e8s_equivalent_sum:e.Nat64,garbage_collectable_neurons_count:e.Nat64,dissolving_neurons_staked_maturity_e8s_equivalent_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),neurons_with_invalid_stake_count:e.Nat64,not_dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),ect_neuron_count:e.Nat64,total_supply_icp:e.Nat64,neurons_with_less_than_6_months_dissolve_delay_count:e.Nat64,dissolved_neurons_count:e.Nat64,community_fund_total_maturity_e8s_equivalent:e.Nat64,total_staked_e8s_seed:e.Nat64,total_staked_maturity_e8s_equivalent_ect:e.Nat64,total_staked_e8s:e.Nat64,fully_lost_voting_power_neuron_subset_metrics:e.Opt(D),not_dissolving_neurons_count:e.Nat64,total_locked_e8s:e.Nat64,neurons_fund_total_active_neurons:e.Nat64,total_voting_power_non_self_authenticating_controller:e.Opt(e.Nat64),total_staked_maturity_e8s_equivalent:e.Nat64,not_dissolving_neurons_e8s_buckets_ect:e.Vec(e.Tuple(e.Nat64,e.Float64)),declining_voting_power_neuron_subset_metrics:e.Opt(D),total_staked_e8s_ect:e.Nat64,not_dissolving_neurons_staked_maturity_e8s_equivalent_sum:e.Nat64,dissolved_neurons_e8s:e.Nat64,total_staked_e8s_non_self_authenticating_controller:e.Opt(e.Nat64),dissolving_neurons_e8s_buckets_seed:e.Vec(e.Tuple(e.Nat64,e.Float64)),neurons_with_less_than_6_months_dissolve_delay_e8s:e.Nat64,not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),dissolving_neurons_e8s_buckets_ect:e.Vec(e.Tuple(e.Nat64,e.Float64)),non_self_authenticating_controller_neuron_subset_metrics:e.Opt(D),dissolving_neurons_count:e.Nat64,dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),total_staked_maturity_e8s_equivalent_seed:e.Nat64,community_fund_total_staked_e8s:e.Nat64,not_dissolving_neurons_e8s_buckets_seed:e.Vec(e.Tuple(e.Nat64,e.Float64)),public_neuron_subset_metrics:e.Opt(D),timestamp_seconds:e.Nat64,seed_neuron_count:e.Nat64}),nn=e.Record({count:e.Opt(e.Nat64),previous_total_stake_e8s:e.Opt(e.Nat64),current_total_stake_e8s:e.Opt(e.Nat64),group_type:e.Int32}),He=e.Record({groups:e.Vec(nn),timestamp_seconds:e.Opt(e.Nat64)}),je=e.Record({rounds_since_last_distribution:e.Opt(e.Nat64),day_after_genesis:e.Nat64,actual_timestamp_seconds:e.Nat64,total_available_e8s_equivalent:e.Nat64,latest_round_available_e8s_equivalent:e.Opt(e.Nat64),distributed_e8s_equivalent:e.Nat64,settled_proposals:e.Vec(x)}),We=e.Record({to_subaccount:e.Vec(e.Nat8),neuron_stake_e8s:e.Nat64,from:e.Opt(e.Principal),memo:e.Nat64,from_subaccount:e.Vec(e.Nat8),transfer_timestamp:e.Nat64,block_height:e.Nat64}),on=e.Record({followers:e.Vec(o)}),rn=e.Record({followers_map:e.Vec(e.Tuple(e.Nat64,on))}),sn=e.Variant({LastNeuronId:o}),$e=e.Record({status:e.Opt(e.Int32),failure_reason:e.Opt(e.Text),progress:e.Opt(sn)}),an=e.Record({neuron_indexes_migration:e.Opt($e),copy_inactive_neurons_to_stable_memory_migration:e.Opt($e)}),R=e.Record({error_message:e.Text,error_type:e.Int32}),ze=e.Record({vote:e.Int32,voting_power:e.Nat64}),cn=e.Record({min_participant_icp_e8s:e.Opt(e.Nat64),max_participant_icp_e8s:e.Opt(e.Nat64),min_direct_participation_icp_e8s:e.Opt(e.Nat64),max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),un=e.Record({controller:e.Opt(e.Principal),hotkeys:e.Vec(e.Principal),is_capped:e.Opt(e.Bool),maturity_equivalent_icp_e8s:e.Opt(e.Nat64),nns_neuron_id:e.Opt(o),amount_icp_e8s:e.Opt(e.Nat64)}),ge=e.Record({neurons_fund_neuron_portions:e.Vec(un)}),_n=e.Record({serialized_representation:e.Opt(e.Text)}),L=e.Record({total_maturity_equivalent_icp_e8s:e.Opt(e.Nat64),intended_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),swap_participation_limits:e.Opt(cn),max_neurons_fund_swap_participation_icp_e8s:e.Opt(e.Nat64),neurons_fund_reserves:e.Opt(ge),ideal_matched_participation_function:e.Opt(_n),allocated_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64)}),dn=e.Record({final_neurons_fund_participation:e.Opt(L),initial_neurons_fund_participation:e.Opt(L),neurons_fund_refunds:e.Opt(ge)}),pn=e.Record({status:e.Opt(e.Int32),freezing_threshold:e.Opt(e.Nat64),controllers:e.Vec(e.Principal),memory_size:e.Opt(e.Nat64),cycles:e.Opt(e.Nat64),idle_cycles_burned_per_day:e.Opt(e.Nat64),module_hash:e.Vec(e.Nat8)}),k=e.Record({status:e.Opt(pn),canister_id:e.Opt(e.Principal)}),ln=e.Record({ledger_index_canister_summary:e.Opt(k),fallback_controller_principal_ids:e.Vec(e.Principal),ledger_archive_canister_summaries:e.Vec(k),ledger_canister_summary:e.Opt(k),swap_canister_summary:e.Opt(k),governance_canister_summary:e.Opt(k),root_canister_summary:e.Opt(k),dapp_canister_summaries:e.Vec(k)}),Xe=e.Record({swap_background_information:e.Opt(ln)}),Je=e.Record({no:e.Nat64,yes:e.Nat64,total:e.Nat64,timestamp_seconds:e.Nat64}),mn=e.Record({current_deadline_timestamp_seconds:e.Nat64}),fn=e.Record({id:e.Opt(x),failure_reason:e.Opt(R),ballots:e.Vec(e.Tuple(e.Nat64,ze)),proposal_timestamp_seconds:e.Nat64,reward_event_round:e.Nat64,failed_timestamp_seconds:e.Nat64,neurons_fund_data:e.Opt(dn),reject_cost_e8s:e.Nat64,derived_proposal_information:e.Opt(Xe),latest_tally:e.Opt(Je),total_potential_voting_power:e.Opt(e.Nat64),sns_token_swap_lifecycle:e.Opt(e.Int32),decided_timestamp_seconds:e.Nat64,proposal:e.Opt(n),proposer:e.Opt(o),wait_for_quiet_state:e.Opt(mn),executed_timestamp_seconds:e.Nat64,original_total_community_fund_maturity_e8s_equivalent:e.Opt(e.Nat64)}),Nn=e.Variant({Spawn:o,Split:_,Configure:de,Merge:pe,DisburseToNeuron:le,SyncCommand:e.Record({}),ClaimOrRefreshNeuron:N,MergeMaturity:me,Disburse:fe}),gn=e.Record({command:e.Opt(Nn),timestamp:e.Nat64}),Ye=e.Record({vote:e.Int32,proposal_id:e.Opt(x)}),wn=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),F=e.Record({id:e.Opt(o),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),controller:e.Opt(e.Principal),recent_ballots:e.Vec(Ye),voting_power_refreshed_timestamp_seconds:e.Opt(e.Nat64),kyc_verified:e.Bool,potential_voting_power:e.Opt(e.Nat64),neuron_type:e.Opt(e.Int32),not_for_profit:e.Bool,maturity_e8s_equivalent:e.Nat64,deciding_voting_power:e.Opt(e.Nat64),cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,hot_keys:e.Vec(e.Principal),account:e.Vec(e.Nat8),joined_community_fund_timestamp_seconds:e.Opt(e.Nat64),dissolve_state:e.Opt(wn),followees:e.Vec(e.Tuple(e.Int32,r)),neuron_fees_e8s:e.Nat64,visibility:e.Opt(e.Int32),transfer:e.Opt(We),known_neuron_data:e.Opt(i),spawn_at_timestamp_seconds:e.Opt(e.Nat64)}),ui=e.Record({default_followees:e.Vec(e.Tuple(e.Int32,r)),making_sns_proposal:e.Opt(tn),most_recent_monthly_node_provider_rewards:e.Opt(I),maturity_modulation_last_updated_at_timestamp_seconds:e.Opt(e.Nat64),wait_for_quiet_threshold_seconds:e.Nat64,metrics:e.Opt(Ke),neuron_management_voting_period_seconds:e.Opt(e.Nat64),node_providers:e.Vec(S),cached_daily_maturity_modulation_basis_points:e.Opt(e.Int32),economics:e.Opt(Z),restore_aging_summary:e.Opt(He),spawning_neurons:e.Opt(e.Bool),latest_reward_event:e.Opt(je),to_claim_transfers:e.Vec(We),short_voting_period_seconds:e.Nat64,topic_followee_index:e.Vec(e.Tuple(e.Int32,rn)),migrations:e.Opt(an),proposals:e.Vec(e.Tuple(e.Nat64,fn)),xdr_conversion_rate:e.Opt(Ge),in_flight_commands:e.Vec(e.Tuple(e.Nat64,gn)),neurons:e.Vec(e.Tuple(e.Nat64,F)),genesis_timestamp_seconds:e.Nat64}),ee=e.Variant({Ok:e.Null,Err:R}),Rn=e.Variant({Error:R,NeuronId:o}),On=e.Record({result:e.Opt(Rn)}),Qe=e.Variant({Ok:F,Err:R}),yn=e.Variant({Ok:Ke,Err:R}),hn=e.Variant({Ok:I,Err:R}),te=e.Record({dissolve_delay_seconds:e.Nat64,recent_ballots:e.Vec(Ye),voting_power_refreshed_timestamp_seconds:e.Opt(e.Nat64),potential_voting_power:e.Opt(e.Nat64),neuron_type:e.Opt(e.Int32),deciding_voting_power:e.Opt(e.Nat64),created_timestamp_seconds:e.Nat64,state:e.Int32,stake_e8s:e.Nat64,joined_community_fund_timestamp_seconds:e.Opt(e.Nat64),retrieved_at_timestamp_seconds:e.Nat64,visibility:e.Opt(e.Int32),known_neuron_data:e.Opt(i),voting_power:e.Nat64,age_seconds:e.Nat64}),Ze=e.Variant({Ok:te,Err:R}),vn=e.Record({nns_proposal_id:e.Opt(x)}),bn=e.Record({final_neurons_fund_participation:e.Opt(L),initial_neurons_fund_participation:e.Opt(L),neurons_fund_refunds:e.Opt(ge)}),xn=e.Record({neurons_fund_audit_info:e.Opt(bn)}),Sn=e.Variant({Ok:xn,Err:R}),kn=e.Record({result:e.Opt(Sn)}),Pn=e.Variant({Ok:S,Err:R}),we=e.Record({id:e.Opt(x),status:e.Int32,topic:e.Int32,failure_reason:e.Opt(R),ballots:e.Vec(e.Tuple(e.Nat64,ze)),proposal_timestamp_seconds:e.Nat64,reward_event_round:e.Nat64,deadline_timestamp_seconds:e.Opt(e.Nat64),failed_timestamp_seconds:e.Nat64,reject_cost_e8s:e.Nat64,derived_proposal_information:e.Opt(Xe),latest_tally:e.Opt(Je),total_potential_voting_power:e.Opt(e.Nat64),reward_status:e.Int32,decided_timestamp_seconds:e.Nat64,proposal:e.Opt(n),proposer:e.Opt(o),executed_timestamp_seconds:e.Nat64}),Tn=e.Record({known_neurons:e.Vec(s)}),Cn=e.Record({subaccount:e.Vec(e.Nat8)}),Vn=e.Record({page_size:e.Opt(e.Nat64),include_public_neurons_in_full_neurons:e.Opt(e.Bool),neuron_ids:e.Vec(e.Nat64),page_number:e.Opt(e.Nat64),include_empty_neurons_readable_by_caller:e.Opt(e.Bool),neuron_subaccounts:e.Opt(e.Vec(Cn)),include_neurons_readable_by_caller:e.Bool}),Mn=e.Record({neuron_infos:e.Vec(e.Tuple(e.Nat64,te)),full_neurons:e.Vec(F),total_pages_available:e.Opt(e.Nat64)}),An=e.Record({start_timestamp_seconds:e.Opt(e.Nat64),end_timestamp_seconds:e.Opt(e.Nat64)}),Bn=e.Record({date_filter:e.Opt(An)}),En=e.Record({rewards:e.Vec(I)}),Fn=e.Record({node_providers:e.Vec(S)}),qn=e.Record({include_reward_status:e.Vec(e.Int32),omit_large_fields:e.Opt(e.Bool),before_proposal:e.Opt(x),limit:e.Nat32,exclude_topic:e.Vec(e.Int32),include_all_manage_neuron_proposals:e.Opt(e.Bool),include_status:e.Vec(e.Int32)}),Un=e.Record({proposal_info:e.Vec(we)}),Gn=e.Record({arg:e.Opt(e.Vec(e.Nat8)),wasm_module:e.Opt(e.Vec(e.Nat8)),skip_stopping_before_installing:e.Opt(e.Bool),canister_id:e.Opt(e.Principal),install_mode:e.Opt(e.Int32)}),Kn=e.Variant({RegisterKnownNeuron:s,ManageNeuron:t,UpdateCanisterSettings:Ce,InstallCode:Gn,StopOrStartCanister:Ve,CreateServiceNervousSystem:Be,ExecuteNnsFunction:Ee,RewardNodeProvider:Y,RewardNodeProviders:Fe,ManageNetworkEconomics:Z,ApproveGenesisKyc:Ne,AddOrRemoveNodeProvider:qe,Motion:Ue}),Hn=e.Record({url:e.Text,title:e.Opt(e.Text),action:e.Opt(Kn),summary:e.Text}),jn=e.Variant({Spawn:u,Split:_,Follow:m,RefreshVotingPower:l,ClaimOrRefresh:N,Configure:de,RegisterVote:Pe,Merge:pe,DisburseToNeuron:le,MakeProposal:Hn,StakeMaturity:Te,MergeMaturity:me,Disburse:fe});t.fill(e.Record({id:e.Opt(o),command:e.Opt(jn),neuron_id_or_subaccount:e.Opt(J)}));let Re=e.Record({created_neuron_id:e.Opt(o)}),Wn=e.Record({}),$n=e.Record({refreshed_neuron_id:e.Opt(o)}),zn=e.Record({target_neuron:e.Opt(F),source_neuron:e.Opt(F),target_neuron_info:e.Opt(te),source_neuron_info:e.Opt(te)}),Xn=e.Record({message:e.Opt(e.Text),proposal_id:e.Opt(x)}),Jn=e.Record({maturity_e8s:e.Nat64,staked_maturity_e8s:e.Nat64}),Yn=e.Record({merged_maturity_e8s:e.Nat64,new_stake_e8s:e.Nat64}),Qn=e.Record({transfer_block_height:e.Nat64}),Zn=e.Variant({Error:R,Spawn:Re,Split:Re,Follow:e.Record({}),RefreshVotingPower:Wn,ClaimOrRefresh:$n,Configure:e.Record({}),RegisterVote:e.Record({}),Merge:zn,DisburseToNeuron:Re,MakeProposal:Xn,StakeMaturity:Jn,MergeMaturity:Yn,Disburse:Qn}),Ie=e.Record({command:e.Opt(Zn)}),In=e.Record({total_direct_contribution_icp_e8s:e.Opt(e.Nat64),total_neurons_fund_contribution_icp_e8s:e.Opt(e.Nat64),sns_governance_canister_id:e.Opt(e.Principal)}),Dn=e.Variant({Committed:In,Aborted:e.Record({})}),Ln=e.Record({result:e.Opt(Dn),open_sns_token_swap_proposal_id:e.Opt(e.Nat64)}),eo=e.Record({total_direct_participation_icp_e8s:e.Opt(e.Nat64),total_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),sns_governance_canister_id:e.Opt(e.Principal)}),to=e.Variant({Committed:eo,Aborted:e.Record({})}),no=e.Record({result:e.Opt(to),nns_proposal_id:e.Opt(e.Nat64)}),oo=e.Record({controller:e.Opt(e.Principal),hotkeys:e.Opt(Ne),is_capped:e.Opt(e.Bool),nns_neuron_id:e.Opt(e.Nat64),amount_icp_e8s:e.Opt(e.Nat64)}),ro=e.Record({neurons_fund_neuron_portions:e.Vec(oo)}),io=e.Variant({Ok:ro,Err:R}),so=e.Record({result:e.Opt(io)}),ao=e.Record({reward_account:e.Opt(X)});return e.Service({claim_gtc_neurons:e.Func([e.Principal,e.Vec(o)],[ee],[]),claim_or_refresh_neuron_from_account:e.Func([p],[On],[]),get_build_metadata:e.Func([],[e.Text],[]),get_full_neuron:e.Func([e.Nat64],[Qe],[]),get_full_neuron_by_id_or_subaccount:e.Func([J],[Qe],[]),get_latest_reward_event:e.Func([],[je],[]),get_metrics:e.Func([],[yn],[]),get_monthly_node_provider_rewards:e.Func([],[hn],[]),get_most_recent_monthly_node_provider_rewards:e.Func([],[e.Opt(I)],[]),get_network_economics_parameters:e.Func([],[Z],[]),get_neuron_ids:e.Func([],[e.Vec(e.Nat64)],[]),get_neuron_info:e.Func([e.Nat64],[Ze],[]),get_neuron_info_by_id_or_subaccount:e.Func([J],[Ze],[]),get_neurons_fund_audit_info:e.Func([vn],[kn],[]),get_node_provider_by_caller:e.Func([e.Null],[Pn],[]),get_pending_proposals:e.Func([],[e.Vec(we)],[]),get_proposal_info:e.Func([e.Nat64],[e.Opt(we)],[]),get_restore_aging_summary:e.Func([],[He],[]),list_known_neurons:e.Func([],[Tn],[]),list_neurons:e.Func([Vn],[Mn],[]),list_node_provider_rewards:e.Func([Bn],[En],[]),list_node_providers:e.Func([],[Fn],[]),list_proposals:e.Func([qn],[Un],[]),manage_neuron:e.Func([t],[Ie],[]),settle_community_fund_participation:e.Func([Ln],[ee],[]),settle_neurons_fund_participation:e.Func([no],[so],[]),simulate_manage_neuron:e.Func([t],[Ie],[]),transfer_gtc_neuron:e.Func([o,o],[ee],[]),update_node_provider:e.Func([ao],[ee],[])})};var ur=({IDL:e})=>{let t=e.Rec(),n=e.Rec(),o=e.Record({id:e.Nat64}),r=e.Record({followees:e.Vec(o)}),i=e.Record({name:e.Text,description:e.Opt(e.Text)}),s=e.Record({id:e.Opt(o),known_neuron_data:e.Opt(i)}),u=e.Record({percentage_to_spawn:e.Opt(e.Nat32),new_controller:e.Opt(e.Principal),nonce:e.Opt(e.Nat64)}),_=e.Record({amount_e8s:e.Nat64}),m=e.Record({topic:e.Int32,followees:e.Vec(o)}),l=e.Record({}),p=e.Record({controller:e.Opt(e.Principal),memo:e.Nat64}),g=e.Variant({NeuronIdOrSubaccount:e.Record({}),MemoAndController:p,Memo:e.Nat64}),N=e.Record({by:e.Opt(g)}),U=e.Record({hot_key_to_remove:e.Opt(e.Principal)}),z=e.Record({new_hot_key:e.Opt(e.Principal)}),Ot=e.Record({requested_setting_for_auto_stake_maturity:e.Bool}),yt=e.Record({additional_dissolve_delay_seconds:e.Nat32}),ht=e.Record({visibility:e.Opt(e.Int32)}),f=e.Record({dissolve_timestamp_seconds:e.Nat64}),vt=e.Variant({RemoveHotKey:U,AddHotKey:z,ChangeAutoStakeMaturity:Ot,StopDissolving:e.Record({}),StartDissolving:e.Record({}),IncreaseDissolveDelay:yt,SetVisibility:ht,JoinCommunityFund:e.Record({}),LeaveCommunityFund:e.Record({}),SetDissolveTimestamp:f}),de=e.Record({operation:e.Opt(vt)}),x=e.Record({id:e.Nat64}),Pe=e.Record({vote:e.Int32,proposal:e.Opt(x)}),pe=e.Record({source_neuron_id:e.Opt(o)}),le=e.Record({dissolve_delay_seconds:e.Nat64,kyc_verified:e.Bool,amount_e8s:e.Nat64,new_controller:e.Opt(e.Principal),nonce:e.Nat64}),Te=e.Record({percentage_to_stake:e.Opt(e.Nat32)}),me=e.Record({percentage_to_merge:e.Nat32}),X=e.Record({hash:e.Vec(e.Nat8)}),bt=e.Record({e8s:e.Nat64}),fe=e.Record({to_account:e.Opt(X),amount:e.Opt(bt)}),xt=e.Variant({Spawn:u,Split:_,Follow:m,RefreshVotingPower:l,ClaimOrRefresh:N,Configure:de,RegisterVote:Pe,Merge:pe,DisburseToNeuron:le,MakeProposal:n,StakeMaturity:Te,MergeMaturity:me,Disburse:fe}),J=e.Variant({Subaccount:e.Vec(e.Nat8),NeuronId:o}),St=e.Record({id:e.Opt(o),command:e.Opt(xt),neuron_id_or_subaccount:e.Opt(J)}),kt=e.Record({controllers:e.Vec(e.Principal)}),Pt=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),controllers:e.Opt(kt),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),Ce=e.Record({canister_id:e.Opt(e.Principal),settings:e.Opt(Pt)}),Tt=e.Record({skip_stopping_before_installing:e.Opt(e.Bool),wasm_module_hash:e.Opt(e.Vec(e.Nat8)),canister_id:e.Opt(e.Principal),arg_hash:e.Opt(e.Vec(e.Nat8)),install_mode:e.Opt(e.Int32)}),Ve=e.Record({action:e.Opt(e.Int32),canister_id:e.Opt(e.Principal)}),C=e.Record({basis_points:e.Opt(e.Nat64)}),y=e.Record({seconds:e.Opt(e.Nat64)}),w=e.Record({e8s:e.Opt(e.Nat64)}),Ct=e.Record({reward_rate_transition_duration:e.Opt(y),initial_reward_rate:e.Opt(C),final_reward_rate:e.Opt(C)}),Vt=e.Record({neuron_maximum_dissolve_delay_bonus:e.Opt(C),neuron_maximum_age_for_age_bonus:e.Opt(y),neuron_maximum_dissolve_delay:e.Opt(y),neuron_minimum_dissolve_delay_to_vote:e.Opt(y),neuron_maximum_age_bonus:e.Opt(C),neuron_minimum_stake:e.Opt(w),proposal_wait_for_quiet_deadline_increase:e.Opt(y),proposal_initial_voting_period:e.Opt(y),proposal_rejection_fee:e.Opt(w),voting_reward_parameters:e.Opt(Ct)}),Me=e.Record({base64_encoding:e.Opt(e.Text)}),Mt=e.Record({transaction_fee:e.Opt(w),token_symbol:e.Opt(e.Text),token_logo:e.Opt(Me),token_name:e.Opt(e.Text)}),At=e.Record({id:e.Opt(e.Principal)}),Bt=e.Record({dissolve_delay_interval:e.Opt(y),count:e.Opt(e.Nat64)}),Et=e.Record({seconds_after_utc_midnight:e.Opt(e.Nat64)}),Ft=e.Record({iso_codes:e.Vec(e.Text)}),qt=e.Record({minimum_participants:e.Opt(e.Nat64),neurons_fund_participation:e.Opt(e.Bool),duration:e.Opt(y),neuron_basket_construction_parameters:e.Opt(Bt),confirmation_text:e.Opt(e.Text),maximum_participant_icp:e.Opt(w),minimum_icp:e.Opt(w),minimum_direct_participation_icp:e.Opt(w),minimum_participant_icp:e.Opt(w),start_time:e.Opt(Et),maximum_direct_participation_icp:e.Opt(w),maximum_icp:e.Opt(w),neurons_fund_investment_icp:e.Opt(w),restricted_countries:e.Opt(Ft)}),Ae=e.Record({total:e.Opt(w)}),Ut=e.Record({controller:e.Opt(e.Principal),dissolve_delay:e.Opt(y),memo:e.Opt(e.Nat64),vesting_period:e.Opt(y),stake:e.Opt(w)}),c=e.Record({developer_neurons:e.Vec(Ut)}),Gt=e.Record({treasury_distribution:e.Opt(Ae),developer_distribution:e.Opt(c),swap_distribution:e.Opt(Ae)}),Be=e.Record({url:e.Opt(e.Text),governance_parameters:e.Opt(Vt),fallback_controller_principal_ids:e.Vec(e.Principal),logo:e.Opt(Me),name:e.Opt(e.Text),ledger_parameters:e.Opt(Mt),description:e.Opt(e.Text),dapp_canisters:e.Vec(At),swap_parameters:e.Opt(qt),initial_token_distribution:e.Opt(Gt)}),Ee=e.Record({nns_function:e.Int32,payload:e.Vec(e.Nat8)}),S=e.Record({id:e.Opt(e.Principal),reward_account:e.Opt(X)}),Kt=e.Record({dissolve_delay_seconds:e.Nat64}),Ht=e.Record({to_account:e.Opt(X)}),jt=e.Variant({RewardToNeuron:Kt,RewardToAccount:Ht}),Y=e.Record({node_provider:e.Opt(S),reward_mode:e.Opt(jt),amount_e8s:e.Nat64}),Wt=e.Record({dissolve_delay_interval_seconds:e.Nat64,count:e.Nat64}),$t=e.Record({min_participant_icp_e8s:e.Nat64,neuron_basket_construction_parameters:e.Opt(Wt),max_icp_e8s:e.Nat64,swap_due_timestamp_seconds:e.Nat64,min_participants:e.Nat32,sns_token_e8s:e.Nat64,sale_delay_seconds:e.Opt(e.Nat64),max_participant_icp_e8s:e.Nat64,min_direct_participation_icp_e8s:e.Opt(e.Nat64),min_icp_e8s:e.Nat64,max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),zt=e.Record({community_fund_investment_e8s:e.Opt(e.Nat64),target_swap_canister_id:e.Opt(e.Principal),params:e.Opt($t)}),Xt=e.Record({start_timestamp_seconds:e.Nat64,end_timestamp_seconds:e.Nat64}),Jt=e.Record({open_time_window:e.Opt(Xt)}),Yt=e.Record({request:e.Opt(Jt),swap_canister_id:e.Opt(e.Principal)}),Qt=e.Record({default_followees:e.Vec(e.Tuple(e.Int32,r))}),Fe=e.Record({use_registry_derived_rewards:e.Opt(e.Bool),rewards:e.Vec(Y)}),Zt=e.Record({start_reducing_voting_power_after_seconds:e.Opt(e.Nat64),clear_following_after_seconds:e.Opt(e.Nat64)}),Q=e.Record({human_readable:e.Opt(e.Text)}),It=e.Record({contribution_threshold_xdr:e.Opt(Q),one_third_participation_milestone_xdr:e.Opt(Q),full_participation_milestone_xdr:e.Opt(Q)}),Dt=e.Record({maximum_icp_xdr_rate:e.Opt(C),neurons_fund_matched_funding_curve_coefficients:e.Opt(It),max_theoretical_neurons_fund_participation_amount_xdr:e.Opt(Q),minimum_icp_xdr_rate:e.Opt(C)}),Z=e.Record({neuron_minimum_stake_e8s:e.Nat64,voting_power_economics:e.Opt(Zt),max_proposals_to_keep_per_topic:e.Nat32,neuron_management_fee_per_proposal_e8s:e.Nat64,reject_cost_e8s:e.Nat64,transaction_fee_e8s:e.Nat64,neuron_spawn_dissolve_delay_seconds:e.Nat64,minimum_icp_xdr_rate:e.Nat64,maximum_node_provider_rewards_e8s:e.Nat64,neurons_fund_economics:e.Opt(Dt)}),Ne=e.Record({principals:e.Vec(e.Principal)}),Lt=e.Variant({ToRemove:S,ToAdd:S}),qe=e.Record({change:e.Opt(Lt)}),Ue=e.Record({motion_text:e.Text}),en=e.Variant({RegisterKnownNeuron:s,ManageNeuron:St,UpdateCanisterSettings:Ce,InstallCode:Tt,StopOrStartCanister:Ve,CreateServiceNervousSystem:Be,ExecuteNnsFunction:Ee,RewardNodeProvider:Y,OpenSnsTokenSwap:zt,SetSnsTokenSwapOpenTimeWindow:Yt,SetDefaultFollowees:Qt,RewardNodeProviders:Fe,ManageNetworkEconomics:Z,ApproveGenesisKyc:Ne,AddOrRemoveNodeProvider:qe,Motion:Ue});n.fill(e.Record({url:e.Text,title:e.Opt(e.Text),action:e.Opt(en),summary:e.Text}));let tn=e.Record({proposal:e.Opt(n),caller:e.Opt(e.Principal),proposer_id:e.Opt(o)}),Ge=e.Record({xdr_permyriad_per_icp:e.Opt(e.Nat64),timestamp_seconds:e.Opt(e.Nat64)}),I=e.Record({minimum_xdr_permyriad_per_icp:e.Opt(e.Nat64),registry_version:e.Opt(e.Nat64),node_providers:e.Vec(S),timestamp:e.Nat64,rewards:e.Vec(Y),xdr_conversion_rate:e.Opt(Ge),maximum_node_provider_rewards_e8s:e.Opt(e.Nat64)}),D=e.Record({total_maturity_e8s_equivalent:e.Opt(e.Nat64),maturity_e8s_equivalent_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),voting_power_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),total_staked_e8s:e.Opt(e.Nat64),count:e.Opt(e.Nat64),deciding_voting_power_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),total_staked_maturity_e8s_equivalent:e.Opt(e.Nat64),total_potential_voting_power:e.Opt(e.Nat64),total_deciding_voting_power:e.Opt(e.Nat64),staked_maturity_e8s_equivalent_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),staked_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),total_voting_power:e.Opt(e.Nat64),potential_voting_power_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64))}),Ke=e.Record({total_maturity_e8s_equivalent:e.Nat64,not_dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),dissolving_neurons_staked_maturity_e8s_equivalent_sum:e.Nat64,garbage_collectable_neurons_count:e.Nat64,dissolving_neurons_staked_maturity_e8s_equivalent_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),neurons_with_invalid_stake_count:e.Nat64,not_dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),ect_neuron_count:e.Nat64,total_supply_icp:e.Nat64,neurons_with_less_than_6_months_dissolve_delay_count:e.Nat64,dissolved_neurons_count:e.Nat64,community_fund_total_maturity_e8s_equivalent:e.Nat64,total_staked_e8s_seed:e.Nat64,total_staked_maturity_e8s_equivalent_ect:e.Nat64,total_staked_e8s:e.Nat64,fully_lost_voting_power_neuron_subset_metrics:e.Opt(D),not_dissolving_neurons_count:e.Nat64,total_locked_e8s:e.Nat64,neurons_fund_total_active_neurons:e.Nat64,total_voting_power_non_self_authenticating_controller:e.Opt(e.Nat64),total_staked_maturity_e8s_equivalent:e.Nat64,not_dissolving_neurons_e8s_buckets_ect:e.Vec(e.Tuple(e.Nat64,e.Float64)),declining_voting_power_neuron_subset_metrics:e.Opt(D),total_staked_e8s_ect:e.Nat64,not_dissolving_neurons_staked_maturity_e8s_equivalent_sum:e.Nat64,dissolved_neurons_e8s:e.Nat64,total_staked_e8s_non_self_authenticating_controller:e.Opt(e.Nat64),dissolving_neurons_e8s_buckets_seed:e.Vec(e.Tuple(e.Nat64,e.Float64)),neurons_with_less_than_6_months_dissolve_delay_e8s:e.Nat64,not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),dissolving_neurons_e8s_buckets_ect:e.Vec(e.Tuple(e.Nat64,e.Float64)),non_self_authenticating_controller_neuron_subset_metrics:e.Opt(D),dissolving_neurons_count:e.Nat64,dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),total_staked_maturity_e8s_equivalent_seed:e.Nat64,community_fund_total_staked_e8s:e.Nat64,not_dissolving_neurons_e8s_buckets_seed:e.Vec(e.Tuple(e.Nat64,e.Float64)),public_neuron_subset_metrics:e.Opt(D),timestamp_seconds:e.Nat64,seed_neuron_count:e.Nat64}),nn=e.Record({count:e.Opt(e.Nat64),previous_total_stake_e8s:e.Opt(e.Nat64),current_total_stake_e8s:e.Opt(e.Nat64),group_type:e.Int32}),He=e.Record({groups:e.Vec(nn),timestamp_seconds:e.Opt(e.Nat64)}),je=e.Record({rounds_since_last_distribution:e.Opt(e.Nat64),day_after_genesis:e.Nat64,actual_timestamp_seconds:e.Nat64,total_available_e8s_equivalent:e.Nat64,latest_round_available_e8s_equivalent:e.Opt(e.Nat64),distributed_e8s_equivalent:e.Nat64,settled_proposals:e.Vec(x)}),We=e.Record({to_subaccount:e.Vec(e.Nat8),neuron_stake_e8s:e.Nat64,from:e.Opt(e.Principal),memo:e.Nat64,from_subaccount:e.Vec(e.Nat8),transfer_timestamp:e.Nat64,block_height:e.Nat64}),on=e.Record({followers:e.Vec(o)}),rn=e.Record({followers_map:e.Vec(e.Tuple(e.Nat64,on))}),sn=e.Variant({LastNeuronId:o}),$e=e.Record({status:e.Opt(e.Int32),failure_reason:e.Opt(e.Text),progress:e.Opt(sn)}),an=e.Record({neuron_indexes_migration:e.Opt($e),copy_inactive_neurons_to_stable_memory_migration:e.Opt($e)}),R=e.Record({error_message:e.Text,error_type:e.Int32}),ze=e.Record({vote:e.Int32,voting_power:e.Nat64}),cn=e.Record({min_participant_icp_e8s:e.Opt(e.Nat64),max_participant_icp_e8s:e.Opt(e.Nat64),min_direct_participation_icp_e8s:e.Opt(e.Nat64),max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),un=e.Record({controller:e.Opt(e.Principal),hotkeys:e.Vec(e.Principal),is_capped:e.Opt(e.Bool),maturity_equivalent_icp_e8s:e.Opt(e.Nat64),nns_neuron_id:e.Opt(o),amount_icp_e8s:e.Opt(e.Nat64)}),ge=e.Record({neurons_fund_neuron_portions:e.Vec(un)}),_n=e.Record({serialized_representation:e.Opt(e.Text)}),L=e.Record({total_maturity_equivalent_icp_e8s:e.Opt(e.Nat64),intended_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),swap_participation_limits:e.Opt(cn),max_neurons_fund_swap_participation_icp_e8s:e.Opt(e.Nat64),neurons_fund_reserves:e.Opt(ge),ideal_matched_participation_function:e.Opt(_n),allocated_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64)}),dn=e.Record({final_neurons_fund_participation:e.Opt(L),initial_neurons_fund_participation:e.Opt(L),neurons_fund_refunds:e.Opt(ge)}),pn=e.Record({status:e.Opt(e.Int32),freezing_threshold:e.Opt(e.Nat64),controllers:e.Vec(e.Principal),memory_size:e.Opt(e.Nat64),cycles:e.Opt(e.Nat64),idle_cycles_burned_per_day:e.Opt(e.Nat64),module_hash:e.Vec(e.Nat8)}),k=e.Record({status:e.Opt(pn),canister_id:e.Opt(e.Principal)}),ln=e.Record({ledger_index_canister_summary:e.Opt(k),fallback_controller_principal_ids:e.Vec(e.Principal),ledger_archive_canister_summaries:e.Vec(k),ledger_canister_summary:e.Opt(k),swap_canister_summary:e.Opt(k),governance_canister_summary:e.Opt(k),root_canister_summary:e.Opt(k),dapp_canister_summaries:e.Vec(k)}),Xe=e.Record({swap_background_information:e.Opt(ln)}),Je=e.Record({no:e.Nat64,yes:e.Nat64,total:e.Nat64,timestamp_seconds:e.Nat64}),mn=e.Record({current_deadline_timestamp_seconds:e.Nat64}),fn=e.Record({id:e.Opt(x),failure_reason:e.Opt(R),ballots:e.Vec(e.Tuple(e.Nat64,ze)),proposal_timestamp_seconds:e.Nat64,reward_event_round:e.Nat64,failed_timestamp_seconds:e.Nat64,neurons_fund_data:e.Opt(dn),reject_cost_e8s:e.Nat64,derived_proposal_information:e.Opt(Xe),latest_tally:e.Opt(Je),total_potential_voting_power:e.Opt(e.Nat64),sns_token_swap_lifecycle:e.Opt(e.Int32),decided_timestamp_seconds:e.Nat64,proposal:e.Opt(n),proposer:e.Opt(o),wait_for_quiet_state:e.Opt(mn),executed_timestamp_seconds:e.Nat64,original_total_community_fund_maturity_e8s_equivalent:e.Opt(e.Nat64)}),Nn=e.Variant({Spawn:o,Split:_,Configure:de,Merge:pe,DisburseToNeuron:le,SyncCommand:e.Record({}),ClaimOrRefreshNeuron:N,MergeMaturity:me,Disburse:fe}),gn=e.Record({command:e.Opt(Nn),timestamp:e.Nat64}),Ye=e.Record({vote:e.Int32,proposal_id:e.Opt(x)}),wn=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),F=e.Record({id:e.Opt(o),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),controller:e.Opt(e.Principal),recent_ballots:e.Vec(Ye),voting_power_refreshed_timestamp_seconds:e.Opt(e.Nat64),kyc_verified:e.Bool,potential_voting_power:e.Opt(e.Nat64),neuron_type:e.Opt(e.Int32),not_for_profit:e.Bool,maturity_e8s_equivalent:e.Nat64,deciding_voting_power:e.Opt(e.Nat64),cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,hot_keys:e.Vec(e.Principal),account:e.Vec(e.Nat8),joined_community_fund_timestamp_seconds:e.Opt(e.Nat64),dissolve_state:e.Opt(wn),followees:e.Vec(e.Tuple(e.Int32,r)),neuron_fees_e8s:e.Nat64,visibility:e.Opt(e.Int32),transfer:e.Opt(We),known_neuron_data:e.Opt(i),spawn_at_timestamp_seconds:e.Opt(e.Nat64)}),ui=e.Record({default_followees:e.Vec(e.Tuple(e.Int32,r)),making_sns_proposal:e.Opt(tn),most_recent_monthly_node_provider_rewards:e.Opt(I),maturity_modulation_last_updated_at_timestamp_seconds:e.Opt(e.Nat64),wait_for_quiet_threshold_seconds:e.Nat64,metrics:e.Opt(Ke),neuron_management_voting_period_seconds:e.Opt(e.Nat64),node_providers:e.Vec(S),cached_daily_maturity_modulation_basis_points:e.Opt(e.Int32),economics:e.Opt(Z),restore_aging_summary:e.Opt(He),spawning_neurons:e.Opt(e.Bool),latest_reward_event:e.Opt(je),to_claim_transfers:e.Vec(We),short_voting_period_seconds:e.Nat64,topic_followee_index:e.Vec(e.Tuple(e.Int32,rn)),migrations:e.Opt(an),proposals:e.Vec(e.Tuple(e.Nat64,fn)),xdr_conversion_rate:e.Opt(Ge),in_flight_commands:e.Vec(e.Tuple(e.Nat64,gn)),neurons:e.Vec(e.Tuple(e.Nat64,F)),genesis_timestamp_seconds:e.Nat64}),ee=e.Variant({Ok:e.Null,Err:R}),Rn=e.Variant({Error:R,NeuronId:o}),On=e.Record({result:e.Opt(Rn)}),Qe=e.Variant({Ok:F,Err:R}),yn=e.Variant({Ok:Ke,Err:R}),hn=e.Variant({Ok:I,Err:R}),te=e.Record({dissolve_delay_seconds:e.Nat64,recent_ballots:e.Vec(Ye),voting_power_refreshed_timestamp_seconds:e.Opt(e.Nat64),potential_voting_power:e.Opt(e.Nat64),neuron_type:e.Opt(e.Int32),deciding_voting_power:e.Opt(e.Nat64),created_timestamp_seconds:e.Nat64,state:e.Int32,stake_e8s:e.Nat64,joined_community_fund_timestamp_seconds:e.Opt(e.Nat64),retrieved_at_timestamp_seconds:e.Nat64,visibility:e.Opt(e.Int32),known_neuron_data:e.Opt(i),voting_power:e.Nat64,age_seconds:e.Nat64}),Ze=e.Variant({Ok:te,Err:R}),vn=e.Record({nns_proposal_id:e.Opt(x)}),bn=e.Record({final_neurons_fund_participation:e.Opt(L),initial_neurons_fund_participation:e.Opt(L),neurons_fund_refunds:e.Opt(ge)}),xn=e.Record({neurons_fund_audit_info:e.Opt(bn)}),Sn=e.Variant({Ok:xn,Err:R}),kn=e.Record({result:e.Opt(Sn)}),Pn=e.Variant({Ok:S,Err:R}),we=e.Record({id:e.Opt(x),status:e.Int32,topic:e.Int32,failure_reason:e.Opt(R),ballots:e.Vec(e.Tuple(e.Nat64,ze)),proposal_timestamp_seconds:e.Nat64,reward_event_round:e.Nat64,deadline_timestamp_seconds:e.Opt(e.Nat64),failed_timestamp_seconds:e.Nat64,reject_cost_e8s:e.Nat64,derived_proposal_information:e.Opt(Xe),latest_tally:e.Opt(Je),total_potential_voting_power:e.Opt(e.Nat64),reward_status:e.Int32,decided_timestamp_seconds:e.Nat64,proposal:e.Opt(n),proposer:e.Opt(o),executed_timestamp_seconds:e.Nat64}),Tn=e.Record({known_neurons:e.Vec(s)}),Cn=e.Record({subaccount:e.Vec(e.Nat8)}),Vn=e.Record({page_size:e.Opt(e.Nat64),include_public_neurons_in_full_neurons:e.Opt(e.Bool),neuron_ids:e.Vec(e.Nat64),page_number:e.Opt(e.Nat64),include_empty_neurons_readable_by_caller:e.Opt(e.Bool),neuron_subaccounts:e.Opt(e.Vec(Cn)),include_neurons_readable_by_caller:e.Bool}),Mn=e.Record({neuron_infos:e.Vec(e.Tuple(e.Nat64,te)),full_neurons:e.Vec(F),total_pages_available:e.Opt(e.Nat64)}),An=e.Record({start_timestamp_seconds:e.Opt(e.Nat64),end_timestamp_seconds:e.Opt(e.Nat64)}),Bn=e.Record({date_filter:e.Opt(An)}),En=e.Record({rewards:e.Vec(I)}),Fn=e.Record({node_providers:e.Vec(S)}),qn=e.Record({include_reward_status:e.Vec(e.Int32),omit_large_fields:e.Opt(e.Bool),before_proposal:e.Opt(x),limit:e.Nat32,exclude_topic:e.Vec(e.Int32),include_all_manage_neuron_proposals:e.Opt(e.Bool),include_status:e.Vec(e.Int32)}),Un=e.Record({proposal_info:e.Vec(we)}),Gn=e.Record({arg:e.Opt(e.Vec(e.Nat8)),wasm_module:e.Opt(e.Vec(e.Nat8)),skip_stopping_before_installing:e.Opt(e.Bool),canister_id:e.Opt(e.Principal),install_mode:e.Opt(e.Int32)}),Kn=e.Variant({RegisterKnownNeuron:s,ManageNeuron:t,UpdateCanisterSettings:Ce,InstallCode:Gn,StopOrStartCanister:Ve,CreateServiceNervousSystem:Be,ExecuteNnsFunction:Ee,RewardNodeProvider:Y,RewardNodeProviders:Fe,ManageNetworkEconomics:Z,ApproveGenesisKyc:Ne,AddOrRemoveNodeProvider:qe,Motion:Ue}),Hn=e.Record({url:e.Text,title:e.Opt(e.Text),action:e.Opt(Kn),summary:e.Text}),jn=e.Variant({Spawn:u,Split:_,Follow:m,RefreshVotingPower:l,ClaimOrRefresh:N,Configure:de,RegisterVote:Pe,Merge:pe,DisburseToNeuron:le,MakeProposal:Hn,StakeMaturity:Te,MergeMaturity:me,Disburse:fe});t.fill(e.Record({id:e.Opt(o),command:e.Opt(jn),neuron_id_or_subaccount:e.Opt(J)}));let Re=e.Record({created_neuron_id:e.Opt(o)}),Wn=e.Record({}),$n=e.Record({refreshed_neuron_id:e.Opt(o)}),zn=e.Record({target_neuron:e.Opt(F),source_neuron:e.Opt(F),target_neuron_info:e.Opt(te),source_neuron_info:e.Opt(te)}),Xn=e.Record({message:e.Opt(e.Text),proposal_id:e.Opt(x)}),Jn=e.Record({maturity_e8s:e.Nat64,staked_maturity_e8s:e.Nat64}),Yn=e.Record({merged_maturity_e8s:e.Nat64,new_stake_e8s:e.Nat64}),Qn=e.Record({transfer_block_height:e.Nat64}),Zn=e.Variant({Error:R,Spawn:Re,Split:Re,Follow:e.Record({}),RefreshVotingPower:Wn,ClaimOrRefresh:$n,Configure:e.Record({}),RegisterVote:e.Record({}),Merge:zn,DisburseToNeuron:Re,MakeProposal:Xn,StakeMaturity:Jn,MergeMaturity:Yn,Disburse:Qn}),Ie=e.Record({command:e.Opt(Zn)}),In=e.Record({total_direct_contribution_icp_e8s:e.Opt(e.Nat64),total_neurons_fund_contribution_icp_e8s:e.Opt(e.Nat64),sns_governance_canister_id:e.Opt(e.Principal)}),Dn=e.Variant({Committed:In,Aborted:e.Record({})}),Ln=e.Record({result:e.Opt(Dn),open_sns_token_swap_proposal_id:e.Opt(e.Nat64)}),eo=e.Record({total_direct_participation_icp_e8s:e.Opt(e.Nat64),total_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),sns_governance_canister_id:e.Opt(e.Principal)}),to=e.Variant({Committed:eo,Aborted:e.Record({})}),no=e.Record({result:e.Opt(to),nns_proposal_id:e.Opt(e.Nat64)}),oo=e.Record({controller:e.Opt(e.Principal),hotkeys:e.Opt(Ne),is_capped:e.Opt(e.Bool),nns_neuron_id:e.Opt(e.Nat64),amount_icp_e8s:e.Opt(e.Nat64)}),ro=e.Record({neurons_fund_neuron_portions:e.Vec(oo)}),io=e.Variant({Ok:ro,Err:R}),so=e.Record({result:e.Opt(io)}),ao=e.Record({reward_account:e.Opt(X)});return e.Service({claim_gtc_neurons:e.Func([e.Principal,e.Vec(o)],[ee],[]),claim_or_refresh_neuron_from_account:e.Func([p],[On],[]),get_build_metadata:e.Func([],[e.Text],["query"]),get_full_neuron:e.Func([e.Nat64],[Qe],["query"]),get_full_neuron_by_id_or_subaccount:e.Func([J],[Qe],["query"]),get_latest_reward_event:e.Func([],[je],["query"]),get_metrics:e.Func([],[yn],["query"]),get_monthly_node_provider_rewards:e.Func([],[hn],[]),get_most_recent_monthly_node_provider_rewards:e.Func([],[e.Opt(I)],["query"]),get_network_economics_parameters:e.Func([],[Z],["query"]),get_neuron_ids:e.Func([],[e.Vec(e.Nat64)],["query"]),get_neuron_info:e.Func([e.Nat64],[Ze],["query"]),get_neuron_info_by_id_or_subaccount:e.Func([J],[Ze],["query"]),get_neurons_fund_audit_info:e.Func([vn],[kn],["query"]),get_node_provider_by_caller:e.Func([e.Null],[Pn],["query"]),get_pending_proposals:e.Func([],[e.Vec(we)],["query"]),get_proposal_info:e.Func([e.Nat64],[e.Opt(we)],["query"]),get_restore_aging_summary:e.Func([],[He],["query"]),list_known_neurons:e.Func([],[Tn],["query"]),list_neurons:e.Func([Vn],[Mn],["query"]),list_node_provider_rewards:e.Func([Bn],[En],["query"]),list_node_providers:e.Func([],[Fn],["query"]),list_proposals:e.Func([qn],[Un],["query"]),manage_neuron:e.Func([t],[Ie],[]),settle_community_fund_participation:e.Func([Ln],[ee],[]),settle_neurons_fund_participation:e.Func([no],[so],[]),simulate_manage_neuron:e.Func([t],[Ie],[]),transfer_gtc_neuron:e.Func([o,o],[ee],[]),update_node_provider:e.Func([ao],[ee],[])})};var _r=({IDL:e})=>{let t=e.Record({id:e.Nat64}),n=e.Record({followees:e.Vec(t)}),o=e.Record({name:e.Text,description:e.Opt(e.Text)}),r=e.Record({to_subaccount:e.Vec(e.Nat8),neuron_stake_e8s:e.Nat64,from:e.Opt(e.Principal),memo:e.Nat64,from_subaccount:e.Vec(e.Nat8),transfer_timestamp:e.Nat64,block_height:e.Nat64}),i=e.Record({vote:e.Int32,proposal_id:e.Opt(t)}),s=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),u=e.Record({id:e.Opt(t),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),controller:e.Opt(e.Principal),recent_ballots:e.Vec(i),voting_power_refreshed_timestamp_seconds:e.Opt(e.Nat64),kyc_verified:e.Bool,potential_voting_power:e.Opt(e.Nat64),neuron_type:e.Opt(e.Int32),not_for_profit:e.Bool,maturity_e8s_equivalent:e.Nat64,deciding_voting_power:e.Opt(e.Nat64),cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,hot_keys:e.Vec(e.Principal),account:e.Vec(e.Nat8),joined_community_fund_timestamp_seconds:e.Opt(e.Nat64),dissolve_state:e.Opt(s),followees:e.Vec(e.Tuple(e.Int32,n)),neuron_fees_e8s:e.Nat64,visibility:e.Opt(e.Int32),transfer:e.Opt(r),known_neuron_data:e.Opt(o),spawn_at_timestamp_seconds:e.Opt(e.Nat64)}),_=e.Record({dissolve_delay_seconds:e.Nat64,recent_ballots:e.Vec(i),voting_power_refreshed_timestamp_seconds:e.Opt(e.Nat64),potential_voting_power:e.Opt(e.Nat64),neuron_type:e.Opt(e.Int32),deciding_voting_power:e.Opt(e.Nat64),created_timestamp_seconds:e.Nat64,state:e.Int32,stake_e8s:e.Nat64,joined_community_fund_timestamp_seconds:e.Opt(e.Nat64),retrieved_at_timestamp_seconds:e.Nat64,visibility:e.Opt(e.Int32),known_neuron_data:e.Opt(o),voting_power:e.Nat64,age_seconds:e.Nat64}),m=e.Record({neuron_ids:e.Vec(e.Nat64),include_neurons_readable_by_caller:e.Bool}),l=e.Record({neuron_infos:e.Vec(e.Tuple(e.Nat64,_)),full_neurons:e.Vec(u)});return e.Service({list_neurons:e.Func([m],[l],[])})};import{accountIdentifierToBytes as Ji}from"@dfinity/ledger-icp";import{Principal as V}from"@dfinity/principal";import{arrayBufferToUint8Array as ho,isNullish as et,nonNullish as Yi,toNullable as O}from"@dfinity/utils";var ct=class extends Error{},ut=class extends ct{},_t=class extends ct{constructor(n){super();this.minimumAmount=n}},se=class extends Error{},ae=class extends Error{constructor(n){super();this.detail=n}},b=class extends Error{constructor(t){super("Unsupported value: "+t)}};var lr=e=>({id:e}),mr=e=>({id:e}),Qi=e=>{if("NeuronId"in e)return{NeuronId:{id:e.NeuronId}};if("Subaccount"in e)return{Subaccount:Uint8Array.from(e.Subaccount)};throw new b(e)},dt=e=>e.basisPoints!==void 0?{basis_points:[e.basisPoints]}:{basis_points:[]},H=e=>e.seconds!==void 0?{seconds:[e.seconds]}:{seconds:[]},Zi=e=>e.secondsAfterUtcMidnight!==void 0?{seconds_after_utc_midnight:[e.secondsAfterUtcMidnight]}:{seconds_after_utc_midnight:[]},Ii=e=>({iso_codes:e.isoCodes}),A=e=>e.e8s!==void 0?{e8s:[e.e8s]}:{e8s:[]},fr=e=>e.base64Encoding!==void 0?{base64_encoding:[e.base64Encoding]}:{base64_encoding:[]},Di=e=>({reward_rate_transition_duration:e.rewardRateTransitionDuration!==void 0?[H(e.rewardRateTransitionDuration)]:[],initial_reward_rate:e.initialRewardRate!==void 0?[dt(e.initialRewardRate)]:[],final_reward_rate:e.finalRewardRate!==void 0?[dt(e.finalRewardRate)]:[]}),Li=e=>({transaction_fee:e.transactionFee!==void 0?[A(e.transactionFee)]:[],token_symbol:e.tokenSymbol!==void 0?[e.tokenSymbol]:[],token_logo:e.tokenLogo!==void 0?[fr(e.tokenLogo)]:[],token_name:e.tokenName!==void 0?[e.tokenName]:[]}),es=e=>({minimum_participants:e.minimumParticipants!==void 0?[e.minimumParticipants]:[],duration:e.duration!==void 0?[H(e.duration)]:[],neuron_basket_construction_parameters:e.neuronBasketConstructionParameters!==void 0?[ts(e.neuronBasketConstructionParameters)]:[],confirmation_text:e.confirmationText!==void 0?[e.confirmationText]:[],maximum_participant_icp:e.maximumParticipantIcp!==void 0?[A(e.maximumParticipantIcp)]:[],neurons_fund_investment_icp:e.neuronsFundInvestmentIcp!==void 0?[A(e.neuronsFundInvestmentIcp)]:[],minimum_icp:e.minimumIcp!==void 0?[A(e.minimumIcp)]:[],minimum_participant_icp:e.minimumParticipantIcp!==void 0?[A(e.minimumParticipantIcp)]:[],start_time:e.startTime!==void 0?[Zi(e.startTime)]:[],maximum_icp:e.maximumIcp!==void 0?[A(e.maximumIcp)]:[],restricted_countries:e.restrictedCountries!==void 0?[Ii(e.restrictedCountries)]:[],maximum_direct_participation_icp:e.maxDirectParticipationIcp!==void 0?[A(e.maxDirectParticipationIcp)]:[],minimum_direct_participation_icp:e.minDirectParticipationIcp!==void 0?[A(e.minDirectParticipationIcp)]:[],neurons_fund_participation:O(e.neuronsFundParticipation)}),ts=e=>({dissolve_delay_interval:e.dissolveDelayInterval!==void 0?[H(e.dissolveDelayInterval)]:[],count:e.count!==void 0?[e.count]:[]}),ns=e=>({neuron_maximum_dissolve_delay_bonus:e.neuronMaximumDissolveDelayBonus!==void 0?[dt(e.neuronMaximumDissolveDelayBonus)]:[],neuron_maximum_age_for_age_bonus:e.neuronMaximumAgeForAgeBonus!==void 0?[H(e.neuronMaximumAgeForAgeBonus)]:[],neuron_maximum_dissolve_delay:e.neuronMaximumDissolveDelay!==void 0?[H(e.neuronMaximumDissolveDelay)]:[],neuron_minimum_dissolve_delay_to_vote:e.neuronMinimumDissolveDelayToVote!==void 0?[H(e.neuronMinimumDissolveDelayToVote)]:[],neuron_maximum_age_bonus:e.neuronMaximumAgeBonus!==void 0?[dt(e.neuronMaximumAgeBonus)]:[],neuron_minimum_stake:e.neuronMinimumStake!==void 0?[A(e.neuronMinimumStake)]:[],proposal_wait_for_quiet_deadline_increase:e.proposalWaitForQuietDeadlineIncrease!==void 0?[H(e.proposalWaitForQuietDeadlineIncrease)]:[],proposal_initial_voting_period:e.proposalInitialVotingPeriod!==void 0?[H(e.proposalInitialVotingPeriod)]:[],proposal_rejection_fee:e.proposalRejectionFee!==void 0?[A(e.proposalRejectionFee)]:[],voting_reward_parameters:e.votingRewardParameters!==void 0?[Di(e.votingRewardParameters)]:[]}),dr=e=>({total:e.total!==void 0?[A(e.total)]:[]}),os=e=>({treasury_distribution:e.treasuryDistribution!==void 0?[dr(e.treasuryDistribution)]:[],developer_distribution:e.developerDistribution!==void 0?[is(e.developerDistribution)]:[],swap_distribution:e.swapDistribution!==void 0?[dr(e.swapDistribution)]:[]}),rs=e=>({controller:e.controller!==void 0?[V.fromText(e.controller)]:[],dissolve_delay:e.dissolveDelay!==void 0?[H(e.dissolveDelay)]:[],memo:e.memo!==void 0?[e.memo]:[],vesting_period:e.vestingPeriod!==void 0?[H(e.vestingPeriod)]:[],stake:e.stake!==void 0?[A(e.stake)]:[]}),is=e=>({developer_neurons:e.developerNeurons.map(rs)}),ss=e=>({url:e.url!==void 0?[e.url]:[],governance_parameters:e.governanceParameters!==void 0?[ns(e.governanceParameters)]:[],fallback_controller_principal_ids:e.fallbackControllerPrincipalIds.map(t=>V.fromText(t)),logo:e.logo!==void 0?[fr(e.logo)]:[],name:e.name!==void 0?[e.name]:[],ledger_parameters:e.ledgerParameters!==void 0?[Li(e.ledgerParameters)]:[],description:e.description!==void 0?[e.description]:[],dapp_canisters:e.dappCanisters.map(t=>({id:[V.fromText(t)]})),swap_parameters:e.swapParameters!==void 0?[es(e.swapParameters)]:[],initial_token_distribution:e.initialTokenDistribution!==void 0?[os(e.initialTokenDistribution)]:[]}),as=e=>{if(e.wasmModule===void 0)throw new Error("wasmModule not found");return{arg:O(ho(e.arg??new ArrayBuffer(0))),wasm_module:O(ho(e.wasmModule)),skip_stopping_before_installing:O(e.skipStoppingBeforeInstalling),canister_id:O(Yi(e.canisterId)?V.fromText(e.canisterId):void 0),install_mode:O(e.installMode)}},cs=e=>e===void 0?[]:[{freezing_threshold:O(e.freezingThreshold),controllers:e.controllers?[{controllers:e.controllers.map(t=>V.fromText(t))}]:[],log_visibility:O(e.logVisibility),wasm_memory_limit:O(e.wasmMemoryLimit),compute_allocation:O(e.computeAllocation),memory_allocation:O(e.memoryAllocation),wasm_memory_threshold:O(e.wasmMemoryThreshold)}],Nr=e=>{if("ExecuteNnsFunction"in e){let t=e.ExecuteNnsFunction;if(t.payloadBytes===void 0)throw new Error("payloadBytes not found");return{ExecuteNnsFunction:{nns_function:t.nnsFunctionId,payload:ho(t.payloadBytes)}}}if("ManageNeuron"in e){let t=e.ManageNeuron;return{ManageNeuron:fs(t)}}if("ApproveGenesisKyc"in e)return{ApproveGenesisKyc:{principals:e.ApproveGenesisKyc.principals.map(V.fromText)}};if("ManageNetworkEconomics"in e){let t=e.ManageNetworkEconomics;return{ManageNetworkEconomics:{neuron_minimum_stake_e8s:t.neuronMinimumStake,max_proposals_to_keep_per_topic:t.maxProposalsToKeepPerTopic,neuron_management_fee_per_proposal_e8s:t.neuronManagementFeePerProposal,reject_cost_e8s:t.rejectCost,transaction_fee_e8s:t.transactionFee,neuron_spawn_dissolve_delay_seconds:t.neuronSpawnDissolveDelaySeconds,minimum_icp_xdr_rate:t.minimumIcpXdrRate,maximum_node_provider_rewards_e8s:t.maximumNodeProviderRewards,neurons_fund_economics:ps(t.neuronsFundEconomics),voting_power_economics:ls(t.votingPowerEconomics)}}}if("RewardNodeProvider"in e){let t=e.RewardNodeProvider;return{RewardNodeProvider:{node_provider:t.nodeProvider?[pt(t.nodeProvider)]:[],amount_e8s:t.amountE8s,reward_mode:t.rewardMode!=null?[pr(t.rewardMode)]:[]}}}if("RewardNodeProviders"in e){let t=e.RewardNodeProviders;return{RewardNodeProviders:{use_registry_derived_rewards:t.useRegistryDerivedRewards===void 0?[]:[t.useRegistryDerivedRewards],rewards:t.rewards.map(n=>({node_provider:n.nodeProvider?[pt(n.nodeProvider)]:[],amount_e8s:n.amountE8s,reward_mode:n.rewardMode!=null?[pr(n.rewardMode)]:[]}))}}}if("AddOrRemoveNodeProvider"in e){let t=e.AddOrRemoveNodeProvider;return{AddOrRemoveNodeProvider:{change:t.change?[ds(t.change)]:[]}}}if("Motion"in e)return{Motion:{motion_text:e.Motion.motionText}};if("RegisterKnownNeuron"in e){let t=e.RegisterKnownNeuron;return{RegisterKnownNeuron:{id:[{id:t.id}],known_neuron_data:[{name:t.name,description:t.description!==void 0?[t.description]:[]}]}}}if("CreateServiceNervousSystem"in e)return{CreateServiceNervousSystem:ss(e.CreateServiceNervousSystem)};if("InstallCode"in e)return{InstallCode:as(e.InstallCode)};if("StopOrStartCanister"in e){let t=e.StopOrStartCanister;return{StopOrStartCanister:{canister_id:t.canisterId?[V.fromText(t.canisterId)]:[],action:t.action?[t.action]:[]}}}if("UpdateCanisterSettings"in e){let t=e.UpdateCanisterSettings;return{UpdateCanisterSettings:{canister_id:t.canisterId?[V.fromText(t.canisterId)]:[],settings:cs(t.settings)}}}throw new b(e)},us=e=>{if("Split"in e)return{Split:{amount_e8s:e.Split.amount}};if("Follow"in e){let t=e.Follow;return{Follow:{topic:t.topic,followees:t.followees.map(mr)}}}if("ClaimOrRefresh"in e){let t=e.ClaimOrRefresh;return{ClaimOrRefresh:{by:t.by?[ms(t.by)]:[]}}}if("Configure"in e){let t=e.Configure;return{Configure:{operation:t.operation?[_s(t.operation)]:[]}}}if("RegisterVote"in e){let t=e.RegisterVote;return{RegisterVote:{vote:t.vote,proposal:t.proposal?[lr(t.proposal)]:[]}}}if("DisburseToNeuron"in e){let t=e.DisburseToNeuron;return{DisburseToNeuron:{dissolve_delay_seconds:t.dissolveDelaySeconds,kyc_verified:t.kycVerified,amount_e8s:t.amount,new_controller:t.newController?[V.fromText(t.newController)]:[],nonce:t.nonce}}}if("MergeMaturity"in e)return{MergeMaturity:{percentage_to_merge:e.MergeMaturity.percentageToMerge}};if("StakeMaturity"in e){let{percentageToStake:t}=e.StakeMaturity;return{StakeMaturity:{percentage_to_stake:O(t)}}}if("MakeProposal"in e){let t=e.MakeProposal;return{MakeProposal:{url:t.url,title:[],action:t.action?[Nr(t.action)]:[],summary:t.summary}}}if("Disburse"in e){let t=e.Disburse;return{Disburse:{to_account:t.toAccountId?[vo(t.toAccountId)]:[],amount:t.amount?[gr(t.amount)]:[]}}}if("Spawn"in e){let t=e.Spawn;return{Spawn:{percentage_to_spawn:t.percentageToSpawn===void 0?[]:[t.percentageToSpawn],new_controller:t.newController?[V.fromText(t.newController)]:[],nonce:[]}}}if("Merge"in e){let t=e.Merge;return{Merge:{source_neuron_id:t.sourceNeuronId?[{id:t.sourceNeuronId}]:[]}}}throw new b(e)},_s=e=>{if("RemoveHotKey"in e){let t=e.RemoveHotKey;return{RemoveHotKey:{hot_key_to_remove:t.hotKeyToRemove!=null?[V.fromText(t.hotKeyToRemove)]:[]}}}if("AddHotKey"in e){let t=e.AddHotKey;return{AddHotKey:{new_hot_key:t.newHotKey?[V.fromText(t.newHotKey)]:[]}}}if("StopDissolving"in e)return{StopDissolving:{}};if("StartDissolving"in e)return{StartDissolving:{}};if("IncreaseDissolveDelay"in e)return{IncreaseDissolveDelay:{additional_dissolve_delay_seconds:e.IncreaseDissolveDelay.additionalDissolveDelaySeconds}};if("JoinCommunityFund"in e||"LeaveCommunityFund"in e)return e;if("SetDissolveTimestamp"in e)return{SetDissolveTimestamp:{dissolve_timestamp_seconds:e.SetDissolveTimestamp.dissolveTimestampSeconds}};if("ChangeAutoStakeMaturity"in e){let{requestedSettingForAutoStakeMaturity:t}=e.ChangeAutoStakeMaturity;return{ChangeAutoStakeMaturity:{requested_setting_for_auto_stake_maturity:t}}}if("SetVisibility"in e){let t=e.SetVisibility;return{SetVisibility:{visibility:O(t.visibility)}}}throw new b(e)},ds=e=>{if("ToRemove"in e)return{ToRemove:pt(e.ToRemove)};if("ToAdd"in e)return{ToAdd:pt(e.ToAdd)};throw new b(e)},pt=e=>({id:e.id!=null?[V.fromText(e.id)]:[],reward_account:e.rewardAccount!=null?[vo(e.rewardAccount)]:[]}),gr=e=>({e8s:e}),vo=e=>({hash:Ji(e)}),ps=e=>{if(et(e))return[];let{maximumIcpXdrRate:t,maxTheoreticalNeuronsFundParticipationAmountXdr:n,neuronsFundMatchedFundingCurveCoefficients:o,minimumIcpXdrRate:r}=e,i=_=>et(_)?[]:[{basis_points:O(_.basisPoints)}],s=_=>et(_)?[]:[{human_readable:O(_.humanReadable)}],u=_=>et(_)?[]:[{contribution_threshold_xdr:s(_.contributionThresholdXdr),full_participation_milestone_xdr:s(_.fullParticipationMilestoneXdr),one_third_participation_milestone_xdr:s(_.oneThirdParticipationMilestoneXdr)}];return[{maximum_icp_xdr_rate:i(t),neurons_fund_matched_funding_curve_coefficients:u(o),minimum_icp_xdr_rate:i(r),max_theoretical_neurons_fund_participation_amount_xdr:s(n)}]},ls=e=>et(e)?[]:[{start_reducing_voting_power_after_seconds:O(e.startReducingVotingPowerAfterSeconds),clear_following_after_seconds:O(e.clearFollowingAfterSeconds)}],pr=e=>{if("RewardToNeuron"in e)return{RewardToNeuron:{dissolve_delay_seconds:e.RewardToNeuron.dissolveDelaySeconds}};if("RewardToAccount"in e)return{RewardToAccount:{to_account:e.RewardToAccount.toAccount!=null?[vo(e.RewardToAccount.toAccount)]:[]}};throw new b(e)},ms=e=>{if("NeuronIdOrSubaccount"in e)return{NeuronIdOrSubaccount:{}};if("Memo"in e)return{Memo:e.Memo};if("MemoAndController"in e)return{MemoAndController:{memo:e.MemoAndController.memo,controller:e.MemoAndController.controller?[e.MemoAndController.controller]:[]}};throw new b(e)},bo=({neuronIds:e,includeEmptyNeurons:t,includePublicNeurons:n,neuronSubaccounts:o,pageNumber:r,pageSize:i})=>({neuron_ids:BigUint64Array.from(e??[]),include_neurons_readable_by_caller:!e,include_empty_neurons_readable_by_caller:O(t),include_public_neurons_in_full_neurons:O(n),neuron_subaccounts:O(o),page_number:O(r),page_size:O(i)}),fs=({id:e,command:t,neuronIdOrSubaccount:n})=>({id:e?[mr(e)]:[],command:t?[us(t)]:[],neuron_id_or_subaccount:n?[Qi(n)]:[]}),wr=({includeRewardStatus:e,beforeProposal:t,excludeTopic:n,includeStatus:o,limit:r,includeAllManageNeuronProposals:i,omitLargeFields:s})=>({include_reward_status:Int32Array.from(e),before_proposal:t?[lr(t)]:[],limit:r,exclude_topic:Int32Array.from(n),include_all_manage_neuron_proposals:i!==void 0?[i]:[],include_status:Int32Array.from(o),omit_large_fields:O(s)}),Rr=e=>({id:[],command:[{ClaimOrRefresh:{by:[{NeuronIdOrSubaccount:{}}]}}],neuron_id_or_subaccount:[{NeuronId:{id:e.neuronId}}]}),Or=({memo:e,controller:t})=>{let n={ClaimOrRefresh:{by:[{MemoAndController:{controller:t==null?[]:[t],memo:e}}]}};return{id:[],command:[n],neuron_id_or_subaccount:[]}},yr=({neuronId:e,amount:t})=>({id:[],command:[{Split:{amount_e8s:t}}],neuron_id_or_subaccount:[{NeuronId:{id:e}}]});var hr=({neuronId:e,vote:t,proposalId:n})=>re({neuronId:e,command:{RegisterVote:{vote:t,proposal:[{id:n}]}}}),vr=e=>{let t={MakeProposal:{url:e.url,title:e.title!=null?[e.title]:[],summary:e.summary,action:[Nr(e.action)]}};return{id:[],command:[t],neuron_id_or_subaccount:[{NeuronId:{id:e.neuronId}}]}},br=({neuronId:e,topic:t,followees:n})=>re({neuronId:e,command:{Follow:{topic:t,followees:n.map(o=>({id:o}))}}}),xr=({neuronId:e,toAccountIdentifier:t,amount:n})=>re({neuronId:e,command:{Disburse:{to_account:t!==void 0?[t.toAccountIdentifierHash()]:[],amount:n!==void 0?[gr(n)]:[]}}}),Sr=({neuronId:e})=>re({neuronId:e,command:{RefreshVotingPower:{}}}),kr=({neuronId:e,percentageToMerge:t})=>re({neuronId:e,command:{MergeMaturity:{percentage_to_merge:t}}}),Pr=({neuronId:e,percentageToStake:t})=>re({neuronId:e,command:{StakeMaturity:{percentage_to_stake:O(t)}}}),Tr=({neuronId:e,percentageToSpawn:t,newController:n,nonce:o})=>re({neuronId:e,command:{Spawn:{percentage_to_spawn:t===void 0?[]:[t],new_controller:n===void 0?[]:[n],nonce:o===void 0?[]:[o]}}}),Cr=({neuronId:e,principal:t})=>j({neuronId:e,operation:{AddHotKey:{new_hot_key:[t]}}}),Vr=({neuronId:e,principal:t})=>j({neuronId:e,operation:{RemoveHotKey:{hot_key_to_remove:[t]}}}),Mr=({neuronId:e,additionalDissolveDelaySeconds:t})=>j({neuronId:e,operation:{IncreaseDissolveDelay:{additional_dissolve_delay_seconds:t}}}),Ar=({neuronId:e,dissolveDelaySeconds:t})=>j({neuronId:e,operation:{SetDissolveTimestamp:{dissolve_timestamp_seconds:BigInt(t)}}}),Br=e=>j({neuronId:e,operation:{JoinCommunityFund:{}}}),Er=({neuronId:e,autoStake:t})=>j({neuronId:e,operation:{ChangeAutoStakeMaturity:{requested_setting_for_auto_stake_maturity:t}}}),Fr=e=>j({neuronId:e,operation:{LeaveCommunityFund:{}}}),qr=({neuronId:e,visibility:t})=>j({neuronId:e,operation:{SetVisibility:{visibility:[t]}}}),xo=({sourceNeuronId:e,targetNeuronId:t})=>re({neuronId:t,command:{Merge:{source_neuron_id:[{id:e}]}}}),Ur=e=>j({neuronId:e,operation:{StartDissolving:{}}}),Gr=e=>j({neuronId:e,operation:{StopDissolving:{}}}),re=({neuronId:e,command:t})=>({id:[{id:e}],command:[t],neuron_id_or_subaccount:[]}),j=({neuronId:e,operation:t})=>re({neuronId:e,command:{Configure:{operation:[t]}}});import{accountIdentifierFromBytes as Ns,principalToAccountIdentifier as gs}from"@dfinity/ledger-icp";import{Principal as Kr}from"@dfinity/principal";import{fromDefinedNullable as lt,fromNullable as d,isNullish as tt,nonNullish as ke,toNullable as B,uint8ArrayToArrayOfNumber as ws,uint8ArrayToHexString as Hr}from"@dfinity/utils";var So=({neuronId:e,neuronInfo:t,rawNeuron:n,canisterId:o})=>{let r=n?Rs({neuron:n,canisterId:o}):void 0;return{neuronId:e,dissolveDelaySeconds:t.dissolve_delay_seconds,recentBallots:t.recent_ballots.map($r),neuronType:d(t.neuron_type),createdTimestampSeconds:t.created_timestamp_seconds,state:t.state,joinedCommunityFundTimestampSeconds:t.joined_community_fund_timestamp_seconds.length?t.joined_community_fund_timestamp_seconds[0]:void 0,retrievedAtTimestampSeconds:t.retrieved_at_timestamp_seconds,votingPower:t.voting_power,votingPowerRefreshedTimestampSeconds:d(t.voting_power_refreshed_timestamp_seconds),decidingVotingPower:d(t.deciding_voting_power),potentialVotingPower:d(t.potential_voting_power),ageSeconds:t.age_seconds,visibility:d(t.visibility),fullNeuron:r}},Rs=({neuron:e,canisterId:t})=>({id:e.id.length?ce(e.id[0]):void 0,stakedMaturityE8sEquivalent:d(e.staked_maturity_e8s_equivalent),controller:e.controller.length?e.controller[0].toString():void 0,recentBallots:e.recent_ballots.map($r),neuronType:d(e.neuron_type),kycVerified:e.kyc_verified,notForProfit:e.not_for_profit,cachedNeuronStake:e.cached_neuron_stake_e8s,createdTimestampSeconds:e.created_timestamp_seconds,autoStakeMaturity:d(e.auto_stake_maturity),maturityE8sEquivalent:e.maturity_e8s_equivalent,agingSinceTimestampSeconds:e.aging_since_timestamp_seconds,neuronFees:e.neuron_fees_e8s,hotKeys:e.hot_keys.map(n=>n.toString()),accountIdentifier:gs(t,Uint8Array.from(e.account)),joinedCommunityFundTimestampSeconds:e.joined_community_fund_timestamp_seconds.length?e.joined_community_fund_timestamp_seconds[0]:void 0,dissolveState:e.dissolve_state.length?Os(e.dissolve_state[0]):void 0,spawnAtTimesSeconds:e.spawn_at_timestamp_seconds[0],followees:e.followees.map(([n,o])=>zr({topic:n,followees:o})),visibility:d(e.visibility),votingPowerRefreshedTimestampSeconds:d(e.voting_power_refreshed_timestamp_seconds),potentialVotingPower:d(e.potential_voting_power),decidingVotingPower:d(e.deciding_voting_power)}),Aa=({neuron:e,account:t})=>({id:ke(e.id)?B({id:e.id}):[],staked_maturity_e8s_equivalent:B(e.stakedMaturityE8sEquivalent),controller:ke(e.controller)?B(Kr.from(e.controller)):[],recent_ballots:e.recentBallots.map(n=>({vote:n.vote,proposal_id:ke(n.proposalId)?B({id:n.proposalId}):[]})),kyc_verified:e.kycVerified,neuron_type:B(e.neuronType),not_for_profit:e.notForProfit,cached_neuron_stake_e8s:e.cachedNeuronStake,created_timestamp_seconds:e.createdTimestampSeconds,auto_stake_maturity:B(e.autoStakeMaturity),maturity_e8s_equivalent:e.maturityE8sEquivalent,aging_since_timestamp_seconds:e.agingSinceTimestampSeconds,neuron_fees_e8s:e.neuronFees,hot_keys:e.hotKeys.map(n=>Kr.from(n)),account:t,joined_community_fund_timestamp_seconds:B(e.joinedCommunityFundTimestampSeconds),dissolve_state:ke(e.dissolveState)?[e.dissolveState]:[],spawn_at_timestamp_seconds:B(e.spawnAtTimesSeconds),followees:e.followees.map(n=>[n.topic,{followees:n.followees.map(o=>({id:o}))}]),visibility:B(e.visibility),transfer:[],known_neuron_data:[],voting_power_refreshed_timestamp_seconds:B(e.votingPowerRefreshedTimestampSeconds),potential_voting_power:B(e.potentialVotingPower),deciding_voting_power:B(e.decidingVotingPower)}),$r=({vote:e,proposal_id:t})=>({vote:e,proposalId:t.length?ce(t[0]):void 0}),Os=e=>"DissolveDelaySeconds"in e?{DissolveDelaySeconds:e.DissolveDelaySeconds}:{WhenDissolvedTimestampSeconds:e.WhenDissolvedTimestampSeconds},zr=({topic:e,followees:t})=>({topic:e,followees:t.followees.map(ce)}),ce=({id:e})=>e,ys=e=>{if("NeuronId"in e)return{NeuronId:e.NeuronId.id};if("Subaccount"in e)return{Subaccount:ws(Uint8Array.from(e.Subaccount))};throw new b(e)},hs=({neuronId:e,ballot:t})=>{let{vote:n,voting_power:o}=t;return{neuronId:e,vote:n,votingPower:o}},vs=({title:e,url:t,action:n,summary:o})=>({title:e.length?e[0]:void 0,url:t,action:n.length?Xr(n[0]):void 0,summary:o}),Xr=e=>{if("ExecuteNnsFunction"in e)return{ExecuteNnsFunction:{nnsFunctionId:e.ExecuteNnsFunction.nns_function}};if("ManageNeuron"in e){let t=e.ManageNeuron;return{ManageNeuron:{id:t.id.length?ce(t.id[0]):void 0,command:t.command.length?xs(t.command[0]):void 0,neuronIdOrSubaccount:t.neuron_id_or_subaccount.length?ys(t.neuron_id_or_subaccount[0]):void 0}}}if("ApproveGenesisKyc"in e)return{ApproveGenesisKyc:{principals:e.ApproveGenesisKyc.principals.map(n=>n.toString())}};if("ManageNetworkEconomics"in e){let t=e.ManageNetworkEconomics;return{ManageNetworkEconomics:ko(t)}}if("RewardNodeProvider"in e){let t=e.RewardNodeProvider;return{RewardNodeProvider:{nodeProvider:t.node_provider.length?mt(t.node_provider[0]):void 0,amountE8s:t.amount_e8s,rewardMode:t.reward_mode.length?jr(t.reward_mode[0]):void 0}}}if("RewardNodeProviders"in e){let t=e.RewardNodeProviders;return{RewardNodeProviders:{useRegistryDerivedRewards:t.use_registry_derived_rewards.length?t.use_registry_derived_rewards[0]:void 0,rewards:t.rewards.map(n=>({nodeProvider:n.node_provider.length?mt(n.node_provider[0]):void 0,amountE8s:n.amount_e8s,rewardMode:n.reward_mode.length?jr(n.reward_mode[0]):void 0}))}}}if("AddOrRemoveNodeProvider"in e){let t=e.AddOrRemoveNodeProvider;return{AddOrRemoveNodeProvider:{change:t.change.length?ks(t.change[0]):void 0}}}if("Motion"in e)return{Motion:{motionText:e.Motion.motion_text}};if("SetDefaultFollowees"in e)return{SetDefaultFollowees:{defaultFollowees:e.SetDefaultFollowees.default_followees.map(([n,o])=>zr({topic:n,followees:o}))}};if("RegisterKnownNeuron"in e){let t=e.RegisterKnownNeuron;return{RegisterKnownNeuron:Ms(t)}}if("SetSnsTokenSwapOpenTimeWindow"in e){let t=e.SetSnsTokenSwapOpenTimeWindow,n=t.request?.length?{openTimeWindow:t.request[0].open_time_window.length?{startTimestampSeconds:t.request[0].open_time_window[0].start_timestamp_seconds,endTimestampSeconds:t.request[0].open_time_window[0].end_timestamp_seconds}:void 0}:void 0,o=t?.swap_canister_id.length?t.swap_canister_id[0].toString():void 0;return{SetSnsTokenSwapOpenTimeWindow:{request:n,swapCanisterId:o}}}if("OpenSnsTokenSwap"in e){let t=e.OpenSnsTokenSwap,n=d(t.params);return{OpenSnsTokenSwap:{communityFundInvestmentE8s:d(t.community_fund_investment_e8s),targetSwapCanisterId:d(t.target_swap_canister_id),params:n&&{minParticipantIcpE8s:n.min_participant_icp_e8s,maxIcpE8s:n.max_icp_e8s,swapDueTimestampSeconds:n.swap_due_timestamp_seconds,minParticipants:n.min_participants,snsTokenE8s:n.sns_token_e8s,maxParticipantIcpE8s:n.max_participant_icp_e8s,minIcpE8s:n.min_icp_e8s,saleDelaySeconds:d(n.sale_delay_seconds),neuronBasketConstructionParameters:d(n.neuron_basket_construction_parameters),maxDirectParticipationIcpE8s:d(n.max_direct_participation_icp_e8s),minDirectParticipationIcpE8s:d(n.min_direct_participation_icp_e8s)}}}}if("CreateServiceNervousSystem"in e){let t=e.CreateServiceNervousSystem;return{CreateServiceNervousSystem:{url:d(t.url),governanceParameters:Us(d(t.governance_parameters)),fallbackControllerPrincipalIds:t.fallback_controller_principal_ids.map(n=>n.toString()),logo:Yr(d(t.logo)),name:d(t.name),ledgerParameters:Fs(d(t.ledger_parameters)),description:d(t.description),dappCanisters:t.dapp_canisters.map(Es)??[],swapParameters:Ks(d(t.swap_parameters)),initialTokenDistribution:Ws(d(t.initial_token_distribution))}}}if("InstallCode"in e){let t=e.InstallCode;return{InstallCode:{skipStoppingBeforeInstalling:d(t.skip_stopping_before_installing),canisterId:t.canister_id.length?t.canister_id[0].toString():void 0,installMode:d(t.install_mode),wasmModuleHash:Hr(lt(t.wasm_module_hash)),argHash:Hr(lt(t.arg_hash))}}}if("StopOrStartCanister"in e){let t=e.StopOrStartCanister;return{StopOrStartCanister:{canisterId:t.canister_id.length?t.canister_id[0].toString():void 0,action:d(t.action)}}}if("UpdateCanisterSettings"in e)return{UpdateCanisterSettings:{canisterId:e.UpdateCanisterSettings.canister_id.length?e.UpdateCanisterSettings.canister_id[0].toString():void 0,settings:$s(lt(e.UpdateCanisterSettings.settings))}};throw new b(e)},bs=e=>({no:e.no,yes:e.yes,total:e.total,timestampSeconds:e.timestamp_seconds}),xs=e=>{if("Spawn"in e){let t=e.Spawn;return{Spawn:{newController:t.new_controller.length?t.new_controller[0].toString():void 0,percentageToSpawn:t.percentage_to_spawn.length?t.percentage_to_spawn[0]:0}}}if("Split"in e)return{Split:{amount:e.Split.amount_e8s}};if("Follow"in e){let t=e.Follow;return{Follow:{topic:t.topic,followees:t.followees.map(ce)}}}if("ClaimOrRefresh"in e){let t=e.ClaimOrRefresh;return{ClaimOrRefresh:{by:t.by.length?Vs(t.by[0]):void 0}}}if("Configure"in e){let t=e.Configure;return{Configure:{operation:t.operation.length?Ss(t.operation[0]):void 0}}}if("RegisterVote"in e){let t=e.RegisterVote;return{RegisterVote:{vote:t.vote,proposal:t.proposal.length?ce(t.proposal[0]):void 0}}}if("DisburseToNeuron"in e){let t=e.DisburseToNeuron;return{DisburseToNeuron:{dissolveDelaySeconds:t.dissolve_delay_seconds,kycVerified:t.kyc_verified,amount:t.amount_e8s,newController:t.new_controller.length?t.new_controller[0].toString():void 0,nonce:t.nonce}}}if("MergeMaturity"in e)return{MergeMaturity:{percentageToMerge:e.MergeMaturity.percentage_to_merge}};if("StakeMaturity"in e){let{percentage_to_stake:t}=e.StakeMaturity;return{StakeMaturity:{percentageToStake:d(t)}}}if("MakeProposal"in e){let t=e.MakeProposal;return{MakeProposal:{title:t.title.length?t.title[0]:void 0,url:t.url,action:t.action.length?Xr(t.action[0]):void 0,summary:t.summary}}}if("Disburse"in e){let t=e.Disburse;return{Disburse:{toAccountId:t.to_account.length?Po(t.to_account[0]):void 0,amount:t.amount.length?Cs(t.amount[0]):void 0}}}if("Merge"in e){let t=e.Merge;return{Merge:{sourceNeuronId:t.source_neuron_id.length?t.source_neuron_id[0].id:void 0}}}if("RefreshVotingPower"in e)return{RefreshVotingPower:{}};throw new b(e)},Ss=e=>{if("RemoveHotKey"in e){let t=e.RemoveHotKey;return{RemoveHotKey:{hotKeyToRemove:t.hot_key_to_remove.length?t.hot_key_to_remove[0].toString():void 0}}}if("AddHotKey"in e){let t=e.AddHotKey;return{AddHotKey:{newHotKey:t.new_hot_key.length?t.new_hot_key[0].toString():void 0}}}if("StopDissolving"in e)return{StopDissolving:{}};if("StartDissolving"in e)return{StartDissolving:{}};if("IncreaseDissolveDelay"in e)return{IncreaseDissolveDelay:{additionalDissolveDelaySeconds:e.IncreaseDissolveDelay.additional_dissolve_delay_seconds}};if("JoinCommunityFund"in e||"LeaveCommunityFund"in e)return e;if("SetDissolveTimestamp"in e)return{SetDissolveTimestamp:{dissolveTimestampSeconds:e.SetDissolveTimestamp.dissolve_timestamp_seconds}};if("ChangeAutoStakeMaturity"in e){let{requested_setting_for_auto_stake_maturity:t}=e.ChangeAutoStakeMaturity;return{ChangeAutoStakeMaturity:{requestedSettingForAutoStakeMaturity:t}}}if("SetVisibility"in e){let t=e.SetVisibility;return{SetVisibility:{visibility:d(t.visibility)}}}throw new b(e)},ks=e=>{if("ToRemove"in e)return{ToRemove:mt(e.ToRemove)};if("ToAdd"in e)return{ToAdd:mt(e.ToAdd)};throw new b(e)},Ps=e=>{let t=d(e);if(tt(t))return;let{maximum_icp_xdr_rate:n,neurons_fund_matched_funding_curve_coefficients:o,max_theoretical_neurons_fund_participation_amount_xdr:r,minimum_icp_xdr_rate:i}=t,s=m=>{let l=d(m);if(tt(l))return;let{basis_points:p}=l,g=d(p);return ke(g)?{basisPoints:g}:void 0},u=m=>{let l=d(m);if(tt(l))return;let{human_readable:p}=l,g=d(p);return ke(g)?{humanReadable:g}:void 0},_=m=>{let l=d(m);if(tt(l))return;let{full_participation_milestone_xdr:p,one_third_participation_milestone_xdr:g,contribution_threshold_xdr:N}=l;return{fullParticipationMilestoneXdr:u(p),oneThirdParticipationMilestoneXdr:u(g),contributionThresholdXdr:u(N)}};return{maximumIcpXdrRate:s(n),neuronsFundMatchedFundingCurveCoefficients:_(o),maxTheoreticalNeuronsFundParticipationAmountXdr:u(r),minimumIcpXdrRate:s(i)}},Ts=e=>{let t=d(e);if(!tt(t))return{startReducingVotingPowerAfterSeconds:d(t.start_reducing_voting_power_after_seconds),clearFollowingAfterSeconds:d(t.clear_following_after_seconds)}},ko=e=>({neuronMinimumStake:e.neuron_minimum_stake_e8s,maxProposalsToKeepPerTopic:e.max_proposals_to_keep_per_topic,neuronManagementFeePerProposal:e.neuron_management_fee_per_proposal_e8s,rejectCost:e.reject_cost_e8s,transactionFee:e.transaction_fee_e8s,neuronSpawnDissolveDelaySeconds:e.neuron_spawn_dissolve_delay_seconds,minimumIcpXdrRate:e.minimum_icp_xdr_rate,maximumNodeProviderRewards:e.maximum_node_provider_rewards_e8s,neuronsFundEconomics:Ps(e.neurons_fund_economics),votingPowerEconomics:Ts(e.voting_power_economics)}),mt=e=>({id:e.id.length?e.id[0].toString():void 0,rewardAccount:e.reward_account.length?Po(e.reward_account[0]):void 0}),Cs=e=>e.e8s,Po=e=>Ns(new Uint8Array(e.hash)),jr=e=>{if("RewardToNeuron"in e)return{RewardToNeuron:{dissolveDelaySeconds:e.RewardToNeuron.dissolve_delay_seconds}};if("RewardToAccount"in e)return{RewardToAccount:{toAccount:e.RewardToAccount.to_account!=null&&e.RewardToAccount.to_account.length?Po(e.RewardToAccount.to_account[0]):void 0}};throw new b(e)},Vs=e=>{if("NeuronIdOrSubaccount"in e)return{NeuronIdOrSubaccount:{}};if("Memo"in e)return{Memo:e.Memo};if("MemoAndController"in e)return{MemoAndController:{memo:e.MemoAndController.memo,controller:e.MemoAndController.controller.length?e.MemoAndController.controller[0]:void 0}};throw new b(e)},To=e=>({id:e.id.length?ce(e.id[0]):void 0,ballots:e.ballots.map(t=>hs({neuronId:t[0],ballot:t[1]})),rejectCost:e.reject_cost_e8s,proposalTimestampSeconds:e.proposal_timestamp_seconds,rewardEventRound:e.reward_event_round,failedTimestampSeconds:e.failed_timestamp_seconds,deadlineTimestampSeconds:d(e.deadline_timestamp_seconds),decidedTimestampSeconds:e.decided_timestamp_seconds,proposal:e.proposal.length?vs(e.proposal[0]):void 0,proposer:e.proposer.length?ce(e.proposer[0]):void 0,latestTally:e.latest_tally.length?bs(e.latest_tally[0]):void 0,executedTimestampSeconds:e.executed_timestamp_seconds,topic:e.topic,status:e.status,rewardStatus:e.reward_status}),Co=({response:{neuron_infos:e,full_neurons:t},canisterId:n})=>e.map(([o,r])=>So({neuronId:o,neuronInfo:r,rawNeuron:t.find(i=>i.id.length&&i.id[0].id===o),canisterId:n})),Jr=({proposal_info:e})=>({proposals:e.map(To)}),Ms=({id:e,known_neuron_data:t})=>({id:e[0]?.id??BigInt(0),name:t[0]?.name??"",description:t[0]?.description[0]??""}),ft=e=>e===void 0?void 0:{basisPoints:d(e.basis_points)},W=e=>e===void 0?void 0:{seconds:d(e.seconds)},As=e=>e===void 0?void 0:{secondsAfterUtcMidnight:d(e.seconds_after_utc_midnight)},Bs=e=>e===void 0?void 0:{isoCodes:e.iso_codes},E=e=>e===void 0?void 0:{e8s:d(e.e8s)},Es=e=>e===void 0||e.id.length===0?void 0:lt(e.id).toString(),Yr=e=>e===void 0?void 0:{base64Encoding:d(e.base64_encoding)},Fs=e=>e===void 0?void 0:{transactionFee:E(d(e.transaction_fee)),tokenSymbol:d(e.token_symbol),tokenLogo:Yr(d(e.token_logo)),tokenName:d(e.token_name)},qs=e=>e===void 0?void 0:{rewardRateTransitionDuration:W(d(e.reward_rate_transition_duration)),initialRewardRate:ft(d(e.initial_reward_rate)),finalRewardRate:ft(d(e.final_reward_rate))},Us=e=>e===void 0?void 0:{neuronMaximumDissolveDelayBonus:ft(d(e.neuron_maximum_dissolve_delay_bonus)),neuronMaximumAgeForAgeBonus:W(d(e.neuron_maximum_age_for_age_bonus)),neuronMaximumDissolveDelay:W(d(e.neuron_maximum_dissolve_delay)),neuronMinimumDissolveDelayToVote:W(d(e.neuron_minimum_dissolve_delay_to_vote)),neuronMaximumAgeBonus:ft(d(e.neuron_maximum_age_bonus)),neuronMinimumStake:E(d(e.neuron_minimum_stake)),proposalWaitForQuietDeadlineIncrease:W(d(e.proposal_wait_for_quiet_deadline_increase)),proposalInitialVotingPeriod:W(d(e.proposal_initial_voting_period)),proposalRejectionFee:E(d(e.proposal_rejection_fee)),votingRewardParameters:qs(d(e.voting_reward_parameters))},Gs=e=>e===void 0?void 0:{dissolveDelayInterval:W(d(e.dissolve_delay_interval)),count:d(e.count)},Ks=e=>e===void 0?void 0:{minimumParticipants:d(e.minimum_participants),duration:W(d(e.duration)),neuronBasketConstructionParameters:Gs(d(e.neuron_basket_construction_parameters)),confirmationText:d(e.confirmation_text),maximumParticipantIcp:E(d(e.maximum_participant_icp)),neuronsFundInvestmentIcp:E(d(e.neurons_fund_investment_icp)),minimumIcp:E(d(e.minimum_icp)),minimumParticipantIcp:E(d(e.minimum_participant_icp)),startTime:As(d(e.start_time)),maximumIcp:E(d(e.maximum_icp)),restrictedCountries:Bs(d(e.restricted_countries)),maxDirectParticipationIcp:E(d(e.maximum_direct_participation_icp)),minDirectParticipationIcp:E(d(e.minimum_direct_participation_icp)),neuronsFundParticipation:d(e.neurons_fund_participation)},Wr=e=>e===void 0?void 0:{total:E(d(e.total))},Hs=e=>e===void 0?void 0:{controller:e.controller.length===0?void 0:e.controller[0].toString(),dissolveDelay:W(d(e.dissolve_delay)),memo:d(e.memo),vestingPeriod:W(d(e.vesting_period)),stake:E(d(e.stake))},js=e=>e===void 0?void 0:{developerNeurons:e.developer_neurons.map(Hs)},Ws=e=>e===void 0?void 0:{treasuryDistribution:Wr(d(e.treasury_distribution)),developerDistribution:js(d(e.developer_distribution)),swapDistribution:Wr(d(e.swap_distribution))},$s=e=>e===void 0?void 0:{freezingThreshold:d(e.freezing_threshold),controllers:d(e.controllers)?.controllers.map(t=>t.toString()),logVisibility:d(e.log_visibility),wasmMemoryLimit:d(e.wasm_memory_limit),computeAllocation:d(e.compute_allocation),memoryAllocation:d(e.memory_allocation),wasmMemoryThreshold:d(e.wasm_memory_threshold)};var nt=e=>{let{command:t}=e,n=t[0];if(!n)throw new ae({error_message:"Error updating neuron",error_type:0});if("Error"in n)throw new ae(n.Error);return n},h=async({request:e,service:t})=>{let n=await t.manage_neuron(e);return nt(n)},Qr=async({request:e,service:t})=>{let n=await t.simulate_manage_neuron(e);return nt(n)};var Zr=BigInt(1e8);import{AccountIdentifier as ia,SubAccount as sa}from"@dfinity/ledger-icp";import{arrayOfNumberToUint8Array as aa,asciiStringToByteArray as ca,bigIntToUint8Array as ua}from"@dfinity/utils";function zs(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Vo(e,...t){if(!zs(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function Mo(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Ir(e,t){Vo(e);let n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}var gt=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),q=(e,t)=>e<<32-t|e>>>t;var Ka=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Xs(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Ao(e){return typeof e=="string"&&(e=Xs(e)),Vo(e),e}var Nt=class{clone(){return this._cloneInto()}},Ha={}.toString;function Dr(e){let t=o=>e().update(Ao(o)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Js(e,t,n,o){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,o);let r=BigInt(32),i=BigInt(4294967295),s=Number(n>>r&i),u=Number(n&i),_=o?4:0,m=o?0:4;e.setUint32(t+_,s,o),e.setUint32(t+m,u,o)}var Lr=(e,t,n)=>e&t^~e&n,ei=(e,t,n)=>e&t^e&n^t&n,wt=class extends Nt{constructor(t,n,o,r){super(),this.blockLen=t,this.outputLen=n,this.padOffset=o,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=gt(this.buffer)}update(t){Mo(this);let{view:n,buffer:o,blockLen:r}=this;t=Ao(t);let i=t.length;for(let s=0;s<i;){let u=Math.min(r-this.pos,i-s);if(u===r){let _=gt(t);for(;r<=i-s;s+=r)this.process(_,s);continue}o.set(t.subarray(s,s+u),this.pos),this.pos+=u,s+=u,this.pos===r&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Mo(this),Ir(t,this),this.finished=!0;let{buffer:n,view:o,blockLen:r,isLE:i}=this,{pos:s}=this;n[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>r-s&&(this.process(o,0),s=0);for(let p=s;p<r;p++)n[p]=0;Js(o,r-8,BigInt(this.length*8),i),this.process(o,0);let u=gt(t),_=this.outputLen;if(_%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let m=_/4,l=this.get();if(m>l.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p<m;p++)u.setUint32(4*p,l[p],i)}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let o=t.slice(0,n);return this.destroy(),o}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:n,buffer:o,length:r,finished:i,destroyed:s,pos:u}=this;return t.length=r,t.pos=u,t.finished=i,t.destroyed=s,r%n&&t.buffer.set(o),t}};var Ys=new Uint32Array([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]),ue=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),_e=new Uint32Array(64),Bo=class extends wt{constructor(){super(64,32,8,!1),this.A=ue[0]|0,this.B=ue[1]|0,this.C=ue[2]|0,this.D=ue[3]|0,this.E=ue[4]|0,this.F=ue[5]|0,this.G=ue[6]|0,this.H=ue[7]|0}get(){let{A:t,B:n,C:o,D:r,E:i,F:s,G:u,H:_}=this;return[t,n,o,r,i,s,u,_]}set(t,n,o,r,i,s,u,_){this.A=t|0,this.B=n|0,this.C=o|0,this.D=r|0,this.E=i|0,this.F=s|0,this.G=u|0,this.H=_|0}process(t,n){for(let p=0;p<16;p++,n+=4)_e[p]=t.getUint32(n,!1);for(let p=16;p<64;p++){let g=_e[p-15],N=_e[p-2],U=q(g,7)^q(g,18)^g>>>3,z=q(N,17)^q(N,19)^N>>>10;_e[p]=z+_e[p-7]+U+_e[p-16]|0}let{A:o,B:r,C:i,D:s,E:u,F:_,G:m,H:l}=this;for(let p=0;p<64;p++){let g=q(u,6)^q(u,11)^q(u,25),N=l+g+Lr(u,_,m)+Ys[p]+_e[p]|0,z=(q(o,2)^q(o,13)^q(o,22))+ei(o,r,i)|0;l=m,m=_,_=u,u=s+N|0,s=i,i=r,r=o,o=N+z|0}o=o+this.A|0,r=r+this.B|0,i=i+this.C|0,s=s+this.D|0,u=u+this.E|0,_=_+this.F|0,m=m+this.G|0,l=l+this.H|0,this.set(o,r,i,s,u,_,m,l)}roundClean(){_e.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var ti=Dr(()=>new Bo);var Qs=(i=>(i[i.Unspecified=0]="Unspecified",i[i.Locked=1]="Locked",i[i.Dissolving=2]="Dissolving",i[i.Dissolved=3]="Dissolved",i[i.Spawning=4]="Spawning",i))(Qs||{}),Zs=(f=>(f[f.Unspecified=0]="Unspecified",f[f.NeuronManagement=1]="NeuronManagement",f[f.ExchangeRate=2]="ExchangeRate",f[f.NetworkEconomics=3]="NetworkEconomics",f[f.Governance=4]="Governance",f[f.NodeAdmin=5]="NodeAdmin",f[f.ParticipantManagement=6]="ParticipantManagement",f[f.SubnetManagement=7]="SubnetManagement",f[f.NetworkCanisterManagement=8]="NetworkCanisterManagement",f[f.Kyc=9]="Kyc",f[f.NodeProviderRewards=10]="NodeProviderRewards",f[f.SnsDecentralizationSale=11]="SnsDecentralizationSale",f[f.IcOsVersionDeployment=12]="IcOsVersionDeployment",f[f.IcOsVersionElection=13]="IcOsVersionElection",f[f.SnsAndCommunityFund=14]="SnsAndCommunityFund",f[f.ApiBoundaryNodeManagement=15]="ApiBoundaryNodeManagement",f[f.SubnetRental=16]="SubnetRental",f[f.ProtocolCanisterManagement=17]="ProtocolCanisterManagement",f[f.ServiceNervousSystemManagement=18]="ServiceNervousSystemManagement",f))(Zs||{}),Is=(i=>(i[i.Unknown=0]="Unknown",i[i.AcceptVotes=1]="AcceptVotes",i[i.ReadyToSettle=2]="ReadyToSettle",i[i.Settled=3]="Settled",i[i.Ineligible=4]="Ineligible",i))(Is||{}),Ds=(s=>(s[s.Unknown=0]="Unknown",s[s.Open=1]="Open",s[s.Rejected=2]="Rejected",s[s.Accepted=3]="Accepted",s[s.Executed=4]="Executed",s[s.Failed=5]="Failed",s))(Ds||{}),ni=(o=>(o[o.Unspecified=0]="Unspecified",o[o.Yes=1]="Yes",o[o.No=2]="No",o))(ni||{}),Ls=(c=>(c[c.Unspecified=0]="Unspecified",c[c.CreateSubnet=1]="CreateSubnet",c[c.AddNodeToSubnet=2]="AddNodeToSubnet",c[c.NnsCanisterInstall=3]="NnsCanisterInstall",c[c.NnsCanisterUpgrade=4]="NnsCanisterUpgrade",c[c.BlessReplicaVersion=5]="BlessReplicaVersion",c[c.RecoverSubnet=6]="RecoverSubnet",c[c.UpdateConfigOfSubnet=7]="UpdateConfigOfSubnet",c[c.AssignNoid=8]="AssignNoid",c[c.NnsRootUpgrade=9]="NnsRootUpgrade",c[c.IcpXdrConversionRate=10]="IcpXdrConversionRate",c[c.DeployGuestosToAllSubnetNodes=11]="DeployGuestosToAllSubnetNodes",c[c.ClearProvisionalWhitelist=12]="ClearProvisionalWhitelist",c[c.RemoveNodesFromSubnet=13]="RemoveNodesFromSubnet",c[c.SetAuthorizedSubnetworks=14]="SetAuthorizedSubnetworks",c[c.SetFirewallConfig=15]="SetFirewallConfig",c[c.UpdateNodeOperatorConfig=16]="UpdateNodeOperatorConfig",c[c.StopOrStartNnsCanister=17]="StopOrStartNnsCanister",c[c.RemoveNodes=18]="RemoveNodes",c[c.UninstallCode=19]="UninstallCode",c[c.UpdateNodeRewardsTable=20]="UpdateNodeRewardsTable",c[c.AddOrRemoveDataCenters=21]="AddOrRemoveDataCenters",c[c.UpdateUnassignedNodesConfig=22]="UpdateUnassignedNodesConfig",c[c.RemoveNodeOperators=23]="RemoveNodeOperators",c[c.RerouteCanisterRanges=24]="RerouteCanisterRanges",c[c.AddFirewallRules=25]="AddFirewallRules",c[c.RemoveFirewallRules=26]="RemoveFirewallRules",c[c.UpdateFirewallRules=27]="UpdateFirewallRules",c[c.PrepareCanisterMigration=28]="PrepareCanisterMigration",c[c.CompleteCanisterMigration=29]="CompleteCanisterMigration",c[c.AddSnsWasm=30]="AddSnsWasm",c[c.ChangeSubnetMembership=31]="ChangeSubnetMembership",c[c.UpdateSubnetType=32]="UpdateSubnetType",c[c.ChangeSubnetTypeAssignment=33]="ChangeSubnetTypeAssignment",c[c.UpdateSnsWasmSnsSubnetIds=34]="UpdateSnsWasmSnsSubnetIds",c[c.UpdateAllowedPrincipals=35]="UpdateAllowedPrincipals",c[c.RetireReplicaVersion=36]="RetireReplicaVersion",c[c.InsertSnsWasmUpgradePathEntries=37]="InsertSnsWasmUpgradePathEntries",c[c.ReviseElectedGuestosVersions=38]="ReviseElectedGuestosVersions",c[c.BitcoinSetConfig=39]="BitcoinSetConfig",c[c.UpdateElectedHostosVersions=40]="UpdateElectedHostosVersions",c[c.UpdateNodesHostosVersion=41]="UpdateNodesHostosVersion",c[c.HardResetNnsRootToVersion=42]="HardResetNnsRootToVersion",c[c.AddApiBoundaryNodes=43]="AddApiBoundaryNodes",c[c.RemoveApiBoundaryNodes=44]="RemoveApiBoundaryNodes",c[c.UpdateApiBoundaryNodeDomain=45]="UpdateApiBoundaryNodeDomain",c[c.UpdateApiBoundaryNodesVersion=46]="UpdateApiBoundaryNodesVersion",c[c.DeployGuestosToSomeApiBoundaryNodes=47]="DeployGuestosToSomeApiBoundaryNodes",c[c.DeployGuestosToAllUnassignedNodes=48]="DeployGuestosToAllUnassignedNodes",c[c.UpdateSshReadOnlyAccessForAllUnassignedNodes=49]="UpdateSshReadOnlyAccessForAllUnassignedNodes",c[c.ReviseElectedHostosVersions=50]="ReviseElectedHostosVersions",c[c.DeployHostosToSomeNodes=51]="DeployHostosToSomeNodes",c[c.SubnetRentalRequest=52]="SubnetRentalRequest",c))(Ls||{}),ea=(o=>(o[o.Unspecified=0]="Unspecified",o[o.Seed=1]="Seed",o[o.Ect=2]="Ect",o))(ea||{}),ta=(o=>(o[o.Unspecified=0]="Unspecified",o[o.Controllers=1]="Controllers",o[o.Public=2]="Public",o))(ta||{}),na=(o=>(o[o.Unspecified=0]="Unspecified",o[o.Stop=1]="Stop",o[o.Start=2]="Start",o))(na||{}),oa=(o=>(o[o.Unspecified=0]="Unspecified",o[o.Private=1]="Private",o[o.Public=2]="Public",o))(oa||{}),ra=(r=>(r[r.Unspecified=0]="Unspecified",r[r.Install=1]="Install",r[r.Reinstall=2]="Reinstall",r[r.Upgrade=3]="Upgrade",r))(ra||{});var oi=({proposal:{ballots:e},neuron:{neuronId:t}})=>e.find(({neuronId:n})=>n===t)?.vote,_a=({neurons:e,proposal:t})=>{let{ballots:n,proposalTimestampSeconds:o}=t;return e.filter(({createdTimestampSeconds:r,neuronId:i})=>{let s=r>o,u=n.find(({neuronId:_})=>_===i)===void 0;return s||u})},ec=({neurons:e,proposal:t})=>e.filter(n=>oi({proposal:t,neuron:n})===0&&_a({neurons:e,proposal:t}).find(({neuronId:o})=>o===n.neuronId)===void 0),tc=({neurons:e,proposal:t})=>e.filter(n=>oi({proposal:t,neuron:n})!==0),da=({controller:e,memo:t})=>{let n=ca("neuron-stake"),o=ti.create();return o.update(aa([n.length,...n,...e.toUint8Array(),...ua(t)])),sa.fromBytes(o.digest())},ri=({controller:e,memo:t,governanceCanisterId:n})=>{let o=da({controller:e,memo:t});return ia.fromPrincipal({principal:n,subAccount:o})};var ai=class e{constructor(t,n,o,r,i){this.canisterId=t;this.service=n;this.certifiedService=o;this.oldListNeuronsCertifiedService=r;this.agent=i;this.listNeurons=async({certified:t=!0,neuronIds:n,includeEmptyNeurons:o,includePublicNeurons:r,neuronSubaccounts:i})=>{if(Rt(o)&&Rt(r)&&t)return this.fetchNeuronsWithOldMethodAndNoPagination({neuronIds:n});let u=await this.fetchNeuronsPage({certified:t,neuronIds:n,includeEmptyNeurons:o,includePublicNeurons:r,neuronSubaccounts:i,pageNumber:0n}),{neurons:_,totalPages:m}=u;if(m<2n)return _;let l=[];for(let N=1n;N<m;N++)l.push(this.fetchNeuronsPage({certified:t,neuronIds:n,includeEmptyNeurons:o,includePublicNeurons:r,pageNumber:N,neuronSubaccounts:i}));return[u,...await Promise.all(l)].flatMap(({neurons:N})=>N)};this.fetchNeuronsWithOldMethodAndNoPagination=async({neuronIds:t})=>{let n=bo({neuronIds:t}),r=await this.oldListNeuronsCertifiedService.list_neurons(n);return Co({response:r,canisterId:this.canisterId})};this.fetchNeuronsPage=async({certified:t,neuronIds:n,includeEmptyNeurons:o,includePublicNeurons:r,pageNumber:i,neuronSubaccounts:s})=>{let _=bo({neuronIds:n,includeEmptyNeurons:o,includePublicNeurons:r,neuronSubaccounts:s,pageNumber:i,pageSize:500n}),l=await this.getGovernanceService(t).list_neurons(_),p=Co({response:l,canisterId:this.canisterId}),g=P(l.total_pages_available)??1n;return{neurons:p,totalPages:g}};this.listKnownNeurons=async(t=!0)=>(await this.getGovernanceService(t).list_known_neurons()).known_neurons.map(o=>({id:P(o.id)?.id??BigInt(0),name:P(o.known_neuron_data)?.name??"",description:P(P(o.known_neuron_data)?.description??[])}));this.getLastestRewardEvent=async(t=!0)=>this.getGovernanceService(t).get_latest_reward_event();this.listProposals=async({request:t,certified:n=!0})=>{let o=wr(t),r=await this.getGovernanceService(n).list_proposals(o);return Jr(r)};this.stakeNeuron=async({stake:t,principal:n,fromSubAccount:o,ledgerCanister:r,createdAt:i,fee:s})=>{if(t<Zr)throw new _t(t);let u=new Uint8Array((0,ci.default)(8)),_=ma(u),m=ri({controller:n,memo:_,governanceCanisterId:this.canisterId});await r.transfer({memo:_,amount:t,fromSubAccount:o,to:m,createdAt:i,fee:s});let l=await this.claimOrRefreshNeuronFromAccount({controller:n,memo:_});if(Rt(l))throw new ut;return l};this.increaseDissolveDelay=async({neuronId:t,additionalDissolveDelaySeconds:n})=>{let o=Mr({neuronId:t,additionalDissolveDelaySeconds:n});await h({request:o,service:this.certifiedService})};this.setDissolveDelay=async({neuronId:t,dissolveDelaySeconds:n})=>{let o=Ar({neuronId:t,dissolveDelaySeconds:n});await h({request:o,service:this.certifiedService})};this.startDissolving=async t=>{let n=Ur(t);await h({request:n,service:this.certifiedService})};this.stopDissolving=async t=>{let n=Gr(t);await h({request:n,service:this.certifiedService})};this.joinCommunityFund=async t=>{let n=Br(t);await h({request:n,service:this.certifiedService})};this.autoStakeMaturity=async t=>{await h({request:Er(t),service:this.certifiedService})};this.leaveCommunityFund=async t=>{let n=Fr(t);await h({request:n,service:this.certifiedService})};this.setVisibility=async(t,n)=>{let o=qr({neuronId:t,visibility:n});await h({request:o,service:this.certifiedService})};this.setNodeProviderAccount=async t=>{si(t);let n=ii.fromHex(t),o=await this.certifiedService.update_node_provider({reward_account:[n.toAccountIdentifierHash()]});if("Err"in o)throw new ae(o.Err)};this.mergeNeurons=async t=>{let n=xo(t);await h({request:n,service:this.certifiedService})};this.simulateMergeNeurons=async t=>{let n=xo(t),o=await Qr({request:n,service:this.certifiedService}),r,i,s,u;if("Merge"in o&&$(r=o.Merge)&&$(i=P(r.target_neuron_info))&&$(s=P(r.target_neuron))&&$(u=P(s.id)?.id))return So({neuronId:u,neuronInfo:i,rawNeuron:s,canisterId:this.canisterId});throw new se(`simulateMergeNeurons: Unrecognized Merge error in ${JSON.stringify(o)}`)};this.splitNeuron=async({neuronId:t,amount:n})=>{let o=yr({neuronId:t,amount:n}),r=await this.certifiedService.manage_neuron(o),i=nt(r);if("Split"in i){let s=P(i.Split.created_neuron_id);if(Rt(s))throw new ae({error_message:"Unexpected error splitting neuron. No neuronId in Split response.",error_type:0});return s.id}throw new se(`Unrecognized Split error in ${JSON.stringify(r)}`)};this.getProposal=async({proposalId:t,certified:n=!0})=>{let[o]=await this.getGovernanceService(n).get_proposal_info(t);return o?To(o):void 0};this.makeProposal=async t=>{let n=vr(t),o=await h({request:n,service:this.certifiedService});return"MakeProposal"in o?P(o.MakeProposal.proposal_id)?.id:void 0};this.registerVote=async({neuronId:t,vote:n,proposalId:o})=>{let r=hr({neuronId:t,vote:n,proposalId:o});await h({request:r,service:this.certifiedService})};this.setFollowees=async t=>{let n=br(t);await h({request:n,service:this.certifiedService})};this.disburse=async({neuronId:t,toAccountId:n,amount:o})=>{$(n)&&si(n);let r=$(n)?ii.fromHex(n):void 0,i=xr({neuronId:t,toAccountIdentifier:r,amount:o});await h({request:i,service:this.certifiedService})};this.refreshVotingPower=async({neuronId:t})=>{let n=Sr({neuronId:t});await h({request:n,service:this.certifiedService})};this.mergeMaturity=async({neuronId:t,percentageToMerge:n})=>{Eo(n);let o=kr({neuronId:t,percentageToMerge:n});await h({request:o,service:this.certifiedService})};this.stakeMaturity=async({neuronId:t,percentageToStake:n})=>{Eo(n??100),await h({request:Pr({neuronId:t,percentageToStake:n}),service:this.certifiedService})};this.spawnNeuron=async({neuronId:t,percentageToSpawn:n,newController:o,nonce:r})=>{$(n)&&Eo(n);let i=Tr({neuronId:t,percentageToSpawn:n,newController:o,nonce:r}),s=await this.certifiedService.manage_neuron(i),u=nt(s),_;if("Spawn"in u&&$(_=P(u.Spawn.created_neuron_id)?.id))return _;throw new se(`Unrecognized Spawn error in ${JSON.stringify(s)}`)};this.addHotkey=async({neuronId:t,principal:n})=>{let o=Cr({neuronId:t,principal:n});await h({request:o,service:this.certifiedService})};this.removeHotkey=async({neuronId:t,principal:n})=>{let o=Vr({neuronId:t,principal:n});await h({request:o,service:this.certifiedService})};this.claimOrRefreshNeuronFromAccount=async({memo:t,controller:n})=>{let o=Or({memo:t,controller:n}),r=await this.certifiedService.manage_neuron(o),i;if($(i=P(r.command))&&"ClaimOrRefresh"in i)return P(i.ClaimOrRefresh.refreshed_neuron_id)?.id;throw new se(`Unrecognized ClaimOrRefresh error in ${JSON.stringify(r)}`)};this.claimOrRefreshNeuron=async t=>{let n=Rr(t),o=await this.service.manage_neuron(n),r;if($(r=P(o.command))&&"ClaimOrRefresh"in r)return P(r.ClaimOrRefresh.refreshed_neuron_id)?.id;throw new se(`Unrecognized ClaimOrRefresh error in ${JSON.stringify(o)}`)};this.getNeuron=async({certified:t=!0,neuronId:n})=>{let[o]=await this.listNeurons({certified:t,neuronIds:[n]});return o};this.getNetworkEconomicsParameters=async({certified:t=!0})=>{let n=await this.getGovernanceService(t).get_network_economics_parameters();return ko(n)};this.canisterId=t,this.service=n,this.certifiedService=o,this.oldListNeuronsCertifiedService=r,this.agent=i}static create(t={}){let n=t.canisterId??Fo,{service:o,certifiedService:r,agent:i}=la({options:{...t,canisterId:n},idlFactory:ur,certifiedIdlFactory:cr}),s=t.oldListNeuronsServiceOverride??pa.createActor(_r,{agent:i,canisterId:n});return new e(n,o,r,s,i)}getGovernanceService(t){return t?this.certifiedService:this.service}};export{ur as a,ct as b,ut as c,_t as d,se as e,ae as f,b as g,bo as h,Aa as i,Qs as j,Zs as k,Is as l,Ds as m,ni as n,Ls as o,ea as p,ta as q,na as r,oa as s,ra as t,_a as u,ec as v,tc as w,da as x,ri as y,ai as z};
3
+ /*! Bundled license information:
4
+
5
+ ieee754/index.js:
6
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
7
+
8
+ buffer/index.js:
9
+ (*!
10
+ * The buffer module from node.js, for the browser.
11
+ *
12
+ * @author Feross Aboukhadijeh <https://feross.org>
13
+ * @license MIT
14
+ *)
15
+
16
+ @noble/hashes/esm/utils.js:
17
+ (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
18
+ */
19
+ //# sourceMappingURL=chunk-SHZMGWWU.js.map