@stacks/storage 3.5.1-beta.2 → 4.0.0-beta.1

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.
package/dist/umd/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StacksStorage=e():t.StacksStorage=e()}(this,(()=>(()=>{var t={625:function(t,e,r){t=r.nmd(t);var n=r(4406);!function(e){"use strict";function i(t,e){e|=0;for(var r=Math.max(t.length-e,0),n=Array(r),i=0;i<r;i++)n[i]=t[e+i];return n}var o=function(t){var e=i(arguments,1);return function(){var r=i(arguments);return t.apply(null,e.concat(r))}},s=function(t){return function(){var e=i(arguments),r=e.pop();t.call(this,e,r)}};function a(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var u="function"==typeof setImmediate&&setImmediate,f="object"==typeof n&&"function"==typeof n.nextTick;function h(t){setTimeout(t,0)}function c(t){return function(e){var r=i(arguments,1);t((function(){e.apply(null,r)}))}}var l=c(u?setImmediate:f?n.nextTick:h);function d(t){return s((function(e,r){var n;try{n=t.apply(this,e)}catch(t){return r(t)}a(n)&&"function"==typeof n.then?n.then((function(t){p(r,null,t)}),(function(t){p(r,t.message?t:new Error(t))})):r(null,n)}))}function p(t,e,r){try{t(e,r)}catch(t){l(y,t)}}function y(t){throw t}var m="function"==typeof Symbol;function g(t){return m&&"AsyncFunction"===t[Symbol.toStringTag]}function b(t){return g(t)?d(t):t}function v(t){return function(e){var r=i(arguments,1),n=s((function(r,n){var i=this;return t(e,(function(t,e){b(t).apply(i,r.concat(e))}),n)}));return r.length?n.apply(this,r):n}}var w="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,_="object"==typeof self&&self&&self.Object===Object&&self,S=w||_||Function("return this")(),E=S.Symbol,M=Object.prototype,k=M.hasOwnProperty,A=M.toString,O=E?E.toStringTag:void 0;var I=Object.prototype.toString;var T=E?E.toStringTag:void 0;function x(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":T&&T in Object(t)?function(t){var e=k.call(t,O),r=t[O];try{t[O]=void 0;var n=!0}catch(t){}var i=A.call(t);return n&&(e?t[O]=r:delete t[O]),i}(t):function(t){return I.call(t)}(t)}function P(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function B(t){return null!=t&&P(t.length)&&!function(t){if(!a(t))return!1;var e=x(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}(t)}var N={};function U(){}function R(t){return function(){if(null!==t){var e=t;t=null,e.apply(this,arguments)}}}var L="function"==typeof Symbol&&Symbol.iterator;function C(t){return null!=t&&"object"==typeof t}function j(t){return C(t)&&"[object Arguments]"==x(t)}var F=Object.prototype,H=F.hasOwnProperty,D=F.propertyIsEnumerable,q=j(function(){return arguments}())?j:function(t){return C(t)&&H.call(t,"callee")&&!D.call(t,"callee")},z=Array.isArray;var $="object"==typeof e&&e&&!e.nodeType&&e,K=$&&t&&!t.nodeType&&t,W=K&&K.exports===$?S.Buffer:void 0,V=(W?W.isBuffer:void 0)||function(){return!1},G=/^(?:0|[1-9]\d*)$/;function X(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&G.test(t))&&t>-1&&t%1==0&&t<e}var J={};J["[object Float32Array]"]=J["[object Float64Array]"]=J["[object Int8Array]"]=J["[object Int16Array]"]=J["[object Int32Array]"]=J["[object Uint8Array]"]=J["[object Uint8ClampedArray]"]=J["[object Uint16Array]"]=J["[object Uint32Array]"]=!0,J["[object Arguments]"]=J["[object Array]"]=J["[object ArrayBuffer]"]=J["[object Boolean]"]=J["[object DataView]"]=J["[object Date]"]=J["[object Error]"]=J["[object Function]"]=J["[object Map]"]=J["[object Number]"]=J["[object Object]"]=J["[object RegExp]"]=J["[object Set]"]=J["[object String]"]=J["[object WeakMap]"]=!1;var Z,Y="object"==typeof e&&e&&!e.nodeType&&e,Q=Y&&t&&!t.nodeType&&t,tt=Q&&Q.exports===Y&&w.process,et=function(){try{return Q&&Q.require&&Q.require("util").types||tt&&tt.binding&&tt.binding("util")}catch(t){}}(),rt=et&&et.isTypedArray,nt=rt?(Z=rt,function(t){return Z(t)}):function(t){return C(t)&&P(t.length)&&!!J[x(t)]},it=Object.prototype.hasOwnProperty;function ot(t,e){var r=z(t),n=!r&&q(t),i=!r&&!n&&V(t),o=!r&&!n&&!i&&nt(t),s=r||n||i||o,a=s?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],u=a.length;for(var f in t)!e&&!it.call(t,f)||s&&("length"==f||i&&("offset"==f||"parent"==f)||o&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||X(f,u))||a.push(f);return a}var st=Object.prototype;var at=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),ut=Object.prototype.hasOwnProperty;function ft(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||st))return at(t);var e,r,n=[];for(var i in Object(t))ut.call(t,i)&&"constructor"!=i&&n.push(i);return n}function ht(t){return B(t)?ot(t):ft(t)}function ct(t){if(B(t))return function(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}(t);var e,r,n,i,o=function(t){return L&&t[L]&&t[L]()}(t);return o?function(t){var e=-1;return function(){var r=t.next();return r.done?null:(e++,{value:r.value,key:e})}}(o):(r=ht(e=t),n=-1,i=r.length,function(){var t=r[++n];return n<i?{value:e[t],key:t}:null})}function lt(t){return function(){if(null===t)throw new Error("Callback was already called.");var e=t;t=null,e.apply(this,arguments)}}function dt(t){return function(e,r,n){if(n=R(n||U),t<=0||!e)return n(null);var i=ct(e),o=!1,s=0,a=!1;function u(t,e){if(s-=1,t)o=!0,n(t);else{if(e===N||o&&s<=0)return o=!0,n(null);a||f()}}function f(){for(a=!0;s<t&&!o;){var e=i();if(null===e)return o=!0,void(s<=0&&n(null));s+=1,r(e.value,e.key,lt(u))}a=!1}f()}}function pt(t,e,r,n){dt(e)(t,b(r),n)}function yt(t,e){return function(r,n,i){return t(r,e,n,i)}}function mt(t,e,r){r=R(r||U);var n=0,i=0,o=t.length;function s(t,e){t?r(t):++i!==o&&e!==N||r(null)}for(0===o&&r(null);n<o;n++)e(t[n],n,lt(s))}var gt=yt(pt,1/0),bt=function(t,e,r){(B(t)?mt:gt)(t,b(e),r)};function vt(t){return function(e,r,n){return t(bt,e,b(r),n)}}function wt(t,e,r,n){n=n||U,e=e||[];var i=[],o=0,s=b(r);t(e,(function(t,e,r){var n=o++;s(t,(function(t,e){i[n]=e,r(t)}))}),(function(t){n(t,i)}))}var _t=vt(wt),St=v(_t);function Et(t){return function(e,r,n,i){return t(dt(r),e,b(n),i)}}var Mt=Et(wt),kt=yt(Mt,1),At=v(kt);function Ot(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}var It,Tt=function(t,e,r){for(var n=-1,i=Object(t),o=r(t),s=o.length;s--;){var a=o[It?s:++n];if(!1===e(i[a],a,i))break}return t};function xt(t,e){return t&&Tt(t,e,ht)}function Pt(t){return t!=t}function Bt(t,e,r){return e==e?function(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}(t,e,r):function(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}(t,Pt,r)}var Nt=function(t,e,r){"function"==typeof e&&(r=e,e=null),r=R(r||U);var n=ht(t).length;if(!n)return r(null);e||(e=n);var o={},s=0,a=!1,u=Object.create(null),f=[],h=[],c={};function l(t,e){f.push((function(){!function(t,e){if(!a){var n=lt((function(e,n){if(s--,arguments.length>2&&(n=i(arguments,1)),e){var f={};xt(o,(function(t,e){f[e]=t})),f[t]=n,a=!0,u=Object.create(null),r(e,f)}else o[t]=n,p(t)}));s++;var f=b(e[e.length-1]);e.length>1?f(o,n):f(n)}}(t,e)}))}function d(){if(0===f.length&&0===s)return r(null,o);for(;f.length&&s<e;)f.shift()()}function p(t){Ot(u[t]||[],(function(t){t()})),d()}function y(e){var r=[];return xt(t,(function(t,n){z(t)&&Bt(t,e,0)>=0&&r.push(n)})),r}xt(t,(function(e,r){if(!z(e))return l(r,[e]),void h.push(r);var n=e.slice(0,e.length-1),i=n.length;if(0===i)return l(r,e),void h.push(r);c[r]=i,Ot(n,(function(o){if(!t[o])throw new Error("async.auto task `"+r+"` has a non-existent dependency `"+o+"` in "+n.join(", "));var s,a,f;a=function(){0==--i&&l(r,e)},(f=u[s=o])||(f=u[s]=[]),f.push(a)}))})),function(){for(var t=0;h.length;)t++,Ot(y(h.pop()),(function(t){0==--c[t]&&h.push(t)}));if(t!==n)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),d()};function Ut(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var Rt=E?E.prototype:void 0,Lt=Rt?Rt.toString:void 0;function Ct(t){if("string"==typeof t)return t;if(z(t))return Ut(t,Ct)+"";if(function(t){return"symbol"==typeof t||C(t)&&"[object Symbol]"==x(t)}(t))return Lt?Lt.call(t):"";var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function jt(t,e,r){var n=t.length;return r=void 0===r?n:r,!e&&r>=n?t:function(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(r=r>i?i:r)<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}(t,e,r)}var Ft=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Ht="[\\ud800-\\udfff]",Dt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",qt="\\ud83c[\\udffb-\\udfff]",zt="[^\\ud800-\\udfff]",$t="(?:\\ud83c[\\udde6-\\uddff]){2}",Kt="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="(?:"+Dt+"|"+qt+")?",Vt="[\\ufe0e\\ufe0f]?",Gt=Vt+Wt+("(?:\\u200d(?:"+[zt,$t,Kt].join("|")+")"+Vt+Wt+")*"),Xt="(?:"+[zt+Dt+"?",Dt,$t,Kt,Ht].join("|")+")",Jt=RegExp(qt+"(?="+qt+")|"+Xt+Gt,"g");function Zt(t){return function(t){return Ft.test(t)}(t)?function(t){return t.match(Jt)||[]}(t):function(t){return t.split("")}(t)}var Yt=/^\s+|\s+$/g;function Qt(t,e,r){if((t=null==(n=t)?"":Ct(n))&&(r||void 0===e))return t.replace(Yt,"");var n;if(!t||!(e=Ct(e)))return t;var i=Zt(t),o=Zt(e);return jt(i,function(t,e){for(var r=-1,n=t.length;++r<n&&Bt(e,t[r],0)>-1;);return r}(i,o),function(t,e){for(var r=t.length;r--&&Bt(e,t[r],0)>-1;);return r}(i,o)+1).join("")}var te=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,ee=/,/,re=/(=.+)?(\s*)$/,ne=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function ie(t,e){var r={};xt(t,(function(t,e){var n,i=g(t),o=!i&&1===t.length||i&&0===t.length;if(z(t))n=t.slice(0,-1),t=t[t.length-1],r[e]=n.concat(n.length>0?s:t);else if(o)r[e]=t;else{if(n=function(t){return(t=(t=(t=t.toString().replace(ne,"")).match(te)[2].replace(" ",""))?t.split(ee):[]).map((function(t){return Qt(t.replace(re,""))}))}(t),0===t.length&&!i&&0===n.length)throw new Error("autoInject task functions require explicit parameters.");i||n.pop(),r[e]=n.concat(s)}function s(e,r){var i=Ut(n,(function(t){return e[t]}));i.push(r),b(t).apply(null,i)}})),Nt(r,e)}function oe(){this.head=this.tail=null,this.length=0}function se(t,e){t.length=1,t.head=t.tail=e}function ae(t,e,r){if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var n=b(t),i=0,o=[],s=!1;function a(t,e,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(h.started=!0,z(t)||(t=[t]),0===t.length&&h.idle())return l((function(){h.drain()}));for(var n=0,i=t.length;n<i;n++){var o={data:t[n],callback:r||U};e?h._tasks.unshift(o):h._tasks.push(o)}s||(s=!0,l((function(){s=!1,h.process()})))}function u(t){return function(e){i-=1;for(var r=0,n=t.length;r<n;r++){var s=t[r],a=Bt(o,s,0);0===a?o.shift():a>0&&o.splice(a,1),s.callback.apply(s,arguments),null!=e&&h.error(e,s.data)}i<=h.concurrency-h.buffer&&h.unsaturated(),h.idle()&&h.drain(),h.process()}}var f=!1,h={_tasks:new oe,concurrency:e,payload:r,saturated:U,unsaturated:U,buffer:e/4,empty:U,drain:U,error:U,started:!1,paused:!1,push:function(t,e){a(t,!1,e)},kill:function(){h.drain=U,h._tasks.empty()},unshift:function(t,e){a(t,!0,e)},remove:function(t){h._tasks.remove(t)},process:function(){if(!f){for(f=!0;!h.paused&&i<h.concurrency&&h._tasks.length;){var t=[],e=[],r=h._tasks.length;h.payload&&(r=Math.min(r,h.payload));for(var s=0;s<r;s++){var a=h._tasks.shift();t.push(a),o.push(a),e.push(a.data)}i+=1,0===h._tasks.length&&h.empty(),i===h.concurrency&&h.saturated();var c=lt(u(t));n(e,c)}f=!1}},length:function(){return h._tasks.length},running:function(){return i},workersList:function(){return o},idle:function(){return h._tasks.length+i===0},pause:function(){h.paused=!0},resume:function(){!1!==h.paused&&(h.paused=!1,l(h.process))}};return h}function ue(t,e){return ae(t,1,e)}oe.prototype.removeLink=function(t){return t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,t.prev=t.next=null,this.length-=1,t},oe.prototype.empty=function(){for(;this.head;)this.shift();return this},oe.prototype.insertAfter=function(t,e){e.prev=t,e.next=t.next,t.next?t.next.prev=e:this.tail=e,t.next=e,this.length+=1},oe.prototype.insertBefore=function(t,e){e.prev=t.prev,e.next=t,t.prev?t.prev.next=e:this.head=e,t.prev=e,this.length+=1},oe.prototype.unshift=function(t){this.head?this.insertBefore(this.head,t):se(this,t)},oe.prototype.push=function(t){this.tail?this.insertAfter(this.tail,t):se(this,t)},oe.prototype.shift=function(){return this.head&&this.removeLink(this.head)},oe.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},oe.prototype.toArray=function(){for(var t=Array(this.length),e=this.head,r=0;r<this.length;r++)t[r]=e.data,e=e.next;return t},oe.prototype.remove=function(t){for(var e=this.head;e;){var r=e.next;t(e)&&this.removeLink(e),e=r}return this};var fe=yt(pt,1);function he(t,e,r,n){n=R(n||U);var i=b(r);fe(t,(function(t,r,n){i(e,t,(function(t,r){e=r,n(t)}))}),(function(t){n(t,e)}))}function ce(){var t=Ut(arguments,b);return function(){var e=i(arguments),r=this,n=e[e.length-1];"function"==typeof n?e.pop():n=U,he(t,e,(function(t,e,n){e.apply(r,t.concat((function(t){var e=i(arguments,1);n(t,e)})))}),(function(t,e){n.apply(r,[t].concat(e))}))}}var le=function(){return ce.apply(null,i(arguments).reverse())},de=Array.prototype.concat,pe=function(t,e,r,n){n=n||U;var o=b(r);Mt(t,e,(function(t,e){o(t,(function(t){return t?e(t):e(null,i(arguments,1))}))}),(function(t,e){for(var r=[],i=0;i<e.length;i++)e[i]&&(r=de.apply(r,e[i]));return n(t,r)}))},ye=yt(pe,1/0),me=yt(pe,1),ge=function(){var t=i(arguments),e=[null].concat(t);return function(){return arguments[arguments.length-1].apply(this,e)}};function be(t){return t}function ve(t,e){return function(r,n,i,o){o=o||U;var s,a=!1;r(n,(function(r,n,o){i(r,(function(n,i){n?o(n):t(i)&&!s?(a=!0,s=e(!0,r),o(null,N)):o()}))}),(function(t){t?o(t):o(null,a?s:e(!1))}))}}function we(t,e){return e}var _e=vt(ve(be,we)),Se=Et(ve(be,we)),Ee=yt(Se,1);function Me(t){return function(e){var r=i(arguments,1);r.push((function(e){var r=i(arguments,1);"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&Ot(r,(function(e){console[t](e)})))})),b(e).apply(null,r)}}var ke=Me("dir");function Ae(t,e,r){r=lt(r||U);var n=b(t),o=b(e);function s(t){if(t)return r(t);var e=i(arguments,1);e.push(a),o.apply(this,e)}function a(t,e){return t?r(t):e?void n(s):r(null)}a(null,!0)}function Oe(t,e,r){r=lt(r||U);var n=b(t),o=function(t){if(t)return r(t);var s=i(arguments,1);if(e.apply(this,s))return n(o);r.apply(null,[null].concat(s))};n(o)}function Ie(t,e,r){Oe(t,(function(){return!e.apply(this,arguments)}),r)}function Te(t,e,r){r=lt(r||U);var n=b(e),i=b(t);function o(t){if(t)return r(t);i(s)}function s(t,e){return t?r(t):e?void n(o):r(null)}i(s)}function xe(t){return function(e,r,n){return t(e,n)}}function Pe(t,e,r){bt(t,xe(b(e)),r)}function Be(t,e,r,n){dt(e)(t,xe(b(r)),n)}var Ne=yt(Be,1);function Ue(t){return g(t)?t:s((function(e,r){var n=!0;e.push((function(){var t=arguments;n?l((function(){r.apply(null,t)})):r.apply(null,t)})),t.apply(this,e),n=!1}))}function Re(t){return!t}var Le=vt(ve(Re,Re)),Ce=Et(ve(Re,Re)),je=yt(Ce,1);function Fe(t){return function(e){return null==e?void 0:e[t]}}function He(t,e,r,n){var i=new Array(e.length);t(e,(function(t,e,n){r(t,(function(t,r){i[e]=!!r,n(t)}))}),(function(t){if(t)return n(t);for(var r=[],o=0;o<e.length;o++)i[o]&&r.push(e[o]);n(null,r)}))}function De(t,e,r,n){var i=[];t(e,(function(t,e,n){r(t,(function(r,o){r?n(r):(o&&i.push({index:e,value:t}),n())}))}),(function(t){t?n(t):n(null,Ut(i.sort((function(t,e){return t.index-e.index})),Fe("value")))}))}function qe(t,e,r,n){(B(e)?He:De)(t,e,b(r),n||U)}var ze=vt(qe),$e=Et(qe),Ke=yt($e,1);function We(t,e){var r=lt(e||U),n=b(Ue(t));!function t(e){if(e)return r(e);n(t)}()}var Ve=function(t,e,r,n){n=n||U;var i=b(r);Mt(t,e,(function(t,e){i(t,(function(r,n){return r?e(r):e(null,{key:n,val:t})}))}),(function(t,e){for(var r={},i=Object.prototype.hasOwnProperty,o=0;o<e.length;o++)if(e[o]){var s=e[o].key,a=e[o].val;i.call(r,s)?r[s].push(a):r[s]=[a]}return n(t,r)}))},Ge=yt(Ve,1/0),Xe=yt(Ve,1),Je=Me("log");function Ze(t,e,r,n){n=R(n||U);var i={},o=b(r);pt(t,e,(function(t,e,r){o(t,e,(function(t,n){if(t)return r(t);i[e]=n,r()}))}),(function(t){n(t,i)}))}var Ye=yt(Ze,1/0),Qe=yt(Ze,1);function tr(t,e){return e in t}function er(t,e){var r=Object.create(null),n=Object.create(null);e=e||be;var o=b(t),a=s((function(t,s){var a=e.apply(null,t);tr(r,a)?l((function(){s.apply(null,r[a])})):tr(n,a)?n[a].push(s):(n[a]=[s],o.apply(null,t.concat((function(){var t=i(arguments);r[a]=t;var e=n[a];delete n[a];for(var o=0,s=e.length;o<s;o++)e[o].apply(null,t)}))))}));return a.memo=r,a.unmemoized=t,a}var rr=c(f?n.nextTick:u?setImmediate:h);function nr(t,e,r){r=r||U;var n=B(e)?[]:{};t(e,(function(t,e,r){b(t)((function(t,o){arguments.length>2&&(o=i(arguments,1)),n[e]=o,r(t)}))}),(function(t){r(t,n)}))}function ir(t,e){nr(bt,t,e)}function or(t,e,r){nr(dt(e),t,r)}var sr=function(t,e){var r=b(t);return ae((function(t,e){r(t[0],e)}),e,1)},ar=function(t,e){var r=sr(t,e);return r.push=function(t,e,n){if(null==n&&(n=U),"function"!=typeof n)throw new Error("task callback must be a function");if(r.started=!0,z(t)||(t=[t]),0===t.length)return l((function(){r.drain()}));e=e||0;for(var i=r._tasks.head;i&&e>=i.priority;)i=i.next;for(var o=0,s=t.length;o<s;o++){var a={data:t[o],priority:e,callback:n};i?r._tasks.insertBefore(i,a):r._tasks.push(a)}l(r.process)},delete r.unshift,r};function ur(t,e){if(e=R(e||U),!z(t))return e(new TypeError("First argument to race must be an array of functions"));if(!t.length)return e();for(var r=0,n=t.length;r<n;r++)b(t[r])(e)}function fr(t,e,r,n){he(i(t).reverse(),e,r,n)}function hr(t){var e=b(t);return s((function(t,r){return t.push((function(t,e){var n;t?r(null,{error:t}):(n=arguments.length<=2?e:i(arguments,1),r(null,{value:n}))})),e.apply(this,t)}))}function cr(t){var e;return z(t)?e=Ut(t,hr):(e={},xt(t,(function(t,r){e[r]=hr.call(this,t)}))),e}function lr(t,e,r,n){qe(t,e,(function(t,e){r(t,(function(t,r){e(t,!r)}))}),n)}var dr=vt(lr),pr=Et(lr),yr=yt(pr,1);function mr(t){return function(){return t}}function gr(t,e,r){var n=5,i=0,o={times:n,intervalFunc:mr(i)};function s(t,e){if("object"==typeof e)t.times=+e.times||n,t.intervalFunc="function"==typeof e.interval?e.interval:mr(+e.interval||i),t.errorFilter=e.errorFilter;else{if("number"!=typeof e&&"string"!=typeof e)throw new Error("Invalid arguments for async.retry");t.times=+e||n}}if(arguments.length<3&&"function"==typeof t?(r=e||U,e=t):(s(o,t),r=r||U),"function"!=typeof e)throw new Error("Invalid arguments for async.retry");var a=b(e),u=1;function f(){a((function(t){t&&u++<o.times&&("function"!=typeof o.errorFilter||o.errorFilter(t))?setTimeout(f,o.intervalFunc(u)):r.apply(null,arguments)}))}f()}var br=function(t,e){e||(e=t,t=null);var r=b(e);return s((function(e,n){function i(t){r.apply(null,e.concat(t))}t?gr(t,i,n):gr(i,n)}))};function vr(t,e){nr(fe,t,e)}var wr=vt(ve(Boolean,be)),_r=Et(ve(Boolean,be)),Sr=yt(_r,1);function Er(t,e,r){var n=b(e);function i(t,e){var r=t.criteria,n=e.criteria;return r<n?-1:r>n?1:0}_t(t,(function(t,e){n(t,(function(r,n){if(r)return e(r);e(null,{value:t,criteria:n})}))}),(function(t,e){if(t)return r(t);r(null,Ut(e.sort(i),Fe("value")))}))}function Mr(t,e,r){var n=b(t);return s((function(i,o){var s,a=!1;i.push((function(){a||(o.apply(null,arguments),clearTimeout(s))})),s=setTimeout((function(){var e=t.name||"anonymous",n=new Error('Callback function "'+e+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),a=!0,o(n)}),e),n.apply(null,i)}))}var kr=Math.ceil,Ar=Math.max;function Or(t,e,r,n){var i=b(r);Mt(function(t,e,r,n){for(var i=-1,o=Ar(kr((e-t)/(r||1)),0),s=Array(o);o--;)s[n?o:++i]=t,t+=r;return s}(0,t,1),e,i,n)}var Ir=yt(Or,1/0),Tr=yt(Or,1);function xr(t,e,r,n){arguments.length<=3&&(n=r,r=e,e=z(t)?[]:{}),n=R(n||U);var i=b(r);bt(t,(function(t,r,n){i(e,t,r,n)}),(function(t){n(t,e)}))}function Pr(t,e){var r,n=null;e=e||U,Ne(t,(function(t,e){b(t)((function(t,o){r=arguments.length>2?i(arguments,1):o,n=t,e(!t)}))}),(function(){e(n,r)}))}function Br(t){return function(){return(t.unmemoized||t).apply(null,arguments)}}function Nr(t,e,r){r=lt(r||U);var n=b(e);if(!t())return r(null);var o=function(e){if(e)return r(e);if(t())return n(o);var s=i(arguments,1);r.apply(null,[null].concat(s))};n(o)}function Ur(t,e,r){Nr((function(){return!t.apply(this,arguments)}),e,r)}var Rr=function(t,e){if(e=R(e||U),!z(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var r=0;function n(e){var n=b(t[r++]);e.push(lt(o)),n.apply(null,e)}function o(o){if(o||r===t.length)return e.apply(null,arguments);n(i(arguments,1))}n([])},Lr={apply:o,applyEach:St,applyEachSeries:At,asyncify:d,auto:Nt,autoInject:ie,cargo:ue,compose:le,concat:ye,concatLimit:pe,concatSeries:me,constant:ge,detect:_e,detectLimit:Se,detectSeries:Ee,dir:ke,doDuring:Ae,doUntil:Ie,doWhilst:Oe,during:Te,each:Pe,eachLimit:Be,eachOf:bt,eachOfLimit:pt,eachOfSeries:fe,eachSeries:Ne,ensureAsync:Ue,every:Le,everyLimit:Ce,everySeries:je,filter:ze,filterLimit:$e,filterSeries:Ke,forever:We,groupBy:Ge,groupByLimit:Ve,groupBySeries:Xe,log:Je,map:_t,mapLimit:Mt,mapSeries:kt,mapValues:Ye,mapValuesLimit:Ze,mapValuesSeries:Qe,memoize:er,nextTick:rr,parallel:ir,parallelLimit:or,priorityQueue:ar,queue:sr,race:ur,reduce:he,reduceRight:fr,reflect:hr,reflectAll:cr,reject:dr,rejectLimit:pr,rejectSeries:yr,retry:gr,retryable:br,seq:ce,series:vr,setImmediate:l,some:wr,someLimit:_r,someSeries:Sr,sortBy:Er,timeout:Mr,times:Ir,timesLimit:Or,timesSeries:Tr,transform:xr,tryEach:Pr,unmemoize:Br,until:Ur,waterfall:Rr,whilst:Nr,all:Le,allLimit:Ce,allSeries:je,any:wr,anyLimit:_r,anySeries:Sr,find:_e,findLimit:Se,findSeries:Ee,forEach:Pe,forEachSeries:Ne,forEachLimit:Be,forEachOf:bt,forEachOfSeries:fe,forEachOfLimit:pt,inject:he,foldl:he,foldr:fr,select:ze,selectLimit:$e,selectSeries:Ke,wrapSync:d};e.default=Lr,e.apply=o,e.applyEach=St,e.applyEachSeries=At,e.asyncify=d,e.auto=Nt,e.autoInject=ie,e.cargo=ue,e.compose=le,e.concat=ye,e.concatLimit=pe,e.concatSeries=me,e.constant=ge,e.detect=_e,e.detectLimit=Se,e.detectSeries=Ee,e.dir=ke,e.doDuring=Ae,e.doUntil=Ie,e.doWhilst=Oe,e.during=Te,e.each=Pe,e.eachLimit=Be,e.eachOf=bt,e.eachOfLimit=pt,e.eachOfSeries=fe,e.eachSeries=Ne,e.ensureAsync=Ue,e.every=Le,e.everyLimit=Ce,e.everySeries=je,e.filter=ze,e.filterLimit=$e,e.filterSeries=Ke,e.forever=We,e.groupBy=Ge,e.groupByLimit=Ve,e.groupBySeries=Xe,e.log=Je,e.map=_t,e.mapLimit=Mt,e.mapSeries=kt,e.mapValues=Ye,e.mapValuesLimit=Ze,e.mapValuesSeries=Qe,e.memoize=er,e.nextTick=rr,e.parallel=ir,e.parallelLimit=or,e.priorityQueue=ar,e.queue=sr,e.race=ur,e.reduce=he,e.reduceRight=fr,e.reflect=hr,e.reflectAll=cr,e.reject=dr,e.rejectLimit=pr,e.rejectSeries=yr,e.retry=gr,e.retryable=br,e.seq=ce,e.series=vr,e.setImmediate=l,e.some=wr,e.someLimit=_r,e.someSeries=Sr,e.sortBy=Er,e.timeout=Mr,e.times=Ir,e.timesLimit=Or,e.timesSeries=Tr,e.transform=xr,e.tryEach=Pr,e.unmemoize=Br,e.until=Ur,e.waterfall=Rr,e.whilst=Nr,e.all=Le,e.allLimit=Ce,e.allSeries=je,e.any=wr,e.anyLimit=_r,e.anySeries=Sr,e.find=_e,e.findLimit=Se,e.findSeries=Ee,e.forEach=Pe,e.forEachSeries=Ne,e.forEachLimit=Be,e.forEachOf=bt,e.forEachOfSeries=fe,e.forEachOfLimit=pt,e.inject=he,e.foldl=he,e.foldr=fr,e.select=ze,e.selectLimit=$e,e.selectSeries=Ke,e.wrapSync=d,Object.defineProperty(e,"__esModule",{value:!0})}(e)},8166:t=>{"use strict";t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=n}var s=t.length,a=t.charAt(0),u=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return new Uint8Array;for(var r=0,n=0,i=0;t[r]===a;)n++,r++;for(var o=(t.length-r)*u+1>>>0,f=new Uint8Array(o);t[r];){var h=e[t.charCodeAt(r)];if(255===h)return;for(var c=0,l=o-1;(0!==h||c<i)&&-1!==l;l--,c++)h+=s*f[l]>>>0,f[l]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=c,r++}for(var d=o-i;d!==o&&0===f[d];)d++;for(var p=new Uint8Array(n+(o-d)),y=n;d!==o;)p[y++]=f[d++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var r=0,n=0,i=0,o=e.length;i!==o&&0===e[i];)i++,r++;for(var u=(o-i)*f+1>>>0,h=new Uint8Array(u);i!==o;){for(var c=e[i],l=0,d=u-1;(0!==c||l<n)&&-1!==d;d--,l++)c+=256*h[d]>>>0,h[d]=c%s>>>0,c=c/s>>>0;if(0!==c)throw new Error("Non-zero carry");n=l,i++}for(var p=u-n;p!==u&&0===h[p];)p++;for(var y=a.repeat(r);p<u;++p)y+=t.charAt(h[p]);return y},decodeUnsafe:h,decode:function(t){var e=h(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}},5766:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=u(t),s=o[0],a=o[1],f=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),h=0,c=a>0?s-4:s;for(r=0;r<c;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],f[h++]=e>>16&255,f[h++]=e>>8&255,f[h++]=255&e;return 2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,f[h++]=255&e),1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,f[h++]=e>>8&255,f[h++]=255&e),f},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=16383,a=0,u=n-i;a<u;a+=s)o.push(f(t,a,a+s>u?u:a+s));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,n){for(var i,o,s=[],a=e;a<n;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},2573:(t,e,r)=>{"use strict";var n=r(8834).Buffer,i=r(1329);function o(t,e){return void 0===e&&(e="utf8"),n.isBuffer(t)?a(t.toString("base64")):a(n.from(t,e).toString("base64"))}function s(t){return t=t.toString(),i.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function a(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var u=o;u.encode=o,u.decode=function(t,e){return void 0===e&&(e="utf8"),n.from(s(t),"base64").toString(e)},u.toBase64=s,u.fromBase64=a,u.toBuffer=function(t){return n.from(s(t),"base64")},e.default=u},1329:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.length,r=e%4;if(!r)return t;var i=e,o=4-r,s=e+o,a=n.alloc(s);for(a.write(t);o--;)a.write("=",i++);return a.toString()}},9487:(t,e,r)=>{t.exports=r(2573).default,t.exports.default=t.exports},1273:t=>{"use strict";for(var e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={},n=0;n<e.length;n++){var i=e.charAt(n);if(void 0!==r[i])throw new TypeError(i+" is ambiguous");r[i]=n}function o(t){var e=t>>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function s(t){for(var e=1,r=0;r<t.length;++r){var n=t.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+t+")";e=o(e)^n>>5}for(e=o(e),r=0;r<t.length;++r){var i=t.charCodeAt(r);e=o(e)^31&i}return e}function a(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var n=t.toLowerCase(),i=t.toUpperCase();if(t!==n&&t!==i)return"Mixed-case string "+t;var a=(t=n).lastIndexOf("1");if(-1===a)return"No separator character for "+t;if(0===a)return"Missing prefix for "+t;var u=t.slice(0,a),f=t.slice(a+1);if(f.length<6)return"Data too short";var h=s(u);if("string"==typeof h)return h;for(var c=[],l=0;l<f.length;++l){var d=f.charAt(l),p=r[d];if(void 0===p)return"Unknown character "+d;h=o(h)^p,l+6>=f.length||c.push(p)}return 1!==h?"Invalid checksum for "+t:{prefix:u,words:c}}function u(t,e,r,n){for(var i=0,o=0,s=(1<<r)-1,a=[],u=0;u<t.length;++u)for(i=i<<e|t[u],o+=e;o>=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<<r-o&s);else{if(o>=e)return"Excess padding";if(i<<r-o&s)return"Non-zero padding"}return a}t.exports={decodeUnsafe:function(){var t=a.apply(null,arguments);if("object"==typeof t)return t},decode:function(t){var e=a.apply(null,arguments);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,r,n){if(n=n||90,t.length+7+r.length>n)throw new TypeError("Exceeds length limit");var i=s(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var a=t+"1",u=0;u<r.length;++u){var f=r[u];if(f>>5!=0)throw new Error("Non 5-bit word");i=o(i)^f,a+=e.charAt(f)}for(u=0;u<6;++u)i=o(i);for(i^=1,u=0;u<6;++u)a+=e.charAt(i>>5*(5-u)&31);return a},toWordsUnsafe:function(t){var e=u(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=u(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=u(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=u(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}}},6989:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1425);function i(t,e,r){return n=>{if(t.has(n))return;const i=r.filter((t=>t.key.toString("hex")===n))[0];e.push(i),t.add(n)}}function o(t){return t.globalMap.unsignedTx}function s(t){const e=new Set;return t.forEach((t=>{const r=t.key.toString("hex");if(e.has(r))throw new Error("Combine: KeyValue Map keys should be unique");e.add(r)})),e}e.combine=function(t){const e=t[0],r=n.psbtToKeyVals(e),a=t.slice(1);if(0===a.length)throw new Error("Combine: Nothing to combine");const u=o(e);if(void 0===u)throw new Error("Combine: Self missing transaction");const f=s(r.globalKeyVals),h=r.inputKeyVals.map(s),c=r.outputKeyVals.map(s);for(const t of a){const e=o(t);if(void 0===e||!e.toBuffer().equals(u.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const a=n.psbtToKeyVals(t);s(a.globalKeyVals).forEach(i(f,r.globalKeyVals,a.globalKeyVals)),a.inputKeyVals.map(s).forEach(((t,e)=>t.forEach(i(h[e],r.inputKeyVals[e],a.inputKeyVals[e])))),a.outputKeyVals.map(s).forEach(((t,e)=>t.forEach(i(c[e],r.outputKeyVals[e],a.outputKeyVals[e]))))}return n.psbtFromKeyVals(u,{globalMapKeyVals:r.globalKeyVals,inputKeyVals:r.inputKeyVals,outputKeyVals:r.outputKeyVals})}},9207:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+t.key.toString("hex"));if(79!==t.key.length||![2,3].includes(t.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+t.key.toString("hex"));if(t.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const e=t.key.slice(1),r={masterFingerprint:t.value.slice(0,4),extendedPubkey:e,path:"m"};for(const e of(n=t.value.length/4-1,[...Array(n).keys()])){const n=t.value.readUInt32LE(4*e+4),i=!!(2147483648&n),o=2147483647&n;r.path+="/"+o.toString(10)+(i?"'":"")}var n;return r},e.encode=function(t){const e=n.from([i.GlobalTypes.GLOBAL_XPUB]),r=n.concat([e,t.extendedPubkey]),o=t.path.split("/"),s=n.allocUnsafe(4*o.length);t.masterFingerprint.copy(s,0);let a=4;return o.slice(1).forEach((t=>{const e="'"===t.slice(-1);let r=2147483647&parseInt(e?t.slice(0,-1):t,10);e&&(r+=2147483648),s.writeUInt32LE(r,a),a+=4})),{key:r,value:s}},e.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",e.check=function(t){const e=t.extendedPubkey,r=t.masterFingerprint,i=t.path;return n.isBuffer(e)&&78===e.length&&[2,3].indexOf(e[45])>-1&&n.isBuffer(r)&&4===r.length&&"string"==typeof i&&!!i.match(/^m(\/\d+'?)+$/)},e.canAddToArray=function(t,e,r){const n=e.extendedPubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.extendedPubkey.equals(e.extendedPubkey))).length)}},6441:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.encode=function(t){return{key:n.from([i.GlobalTypes.UNSIGNED_TX]),value:t.toBuffer()}}},1661:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(5710),i=r(9207),o=r(6441),s=r(6043),a=r(192),u=r(404),f=r(5556),h=r(5477),c=r(2860),l=r(762),d=r(3678),p=r(5630),y=r(6981),m=r(6912),g={unsignedTx:o,globalXpub:i,checkPubkey:p.makeChecker([])};e.globals=g;const b={nonWitnessUtxo:u,partialSig:f,sighashType:c,finalScriptSig:s,finalScriptWitness:a,porCommitment:h,witnessUtxo:l,bip32Derivation:d.makeConverter(n.InputTypes.BIP32_DERIVATION),redeemScript:y.makeConverter(n.InputTypes.REDEEM_SCRIPT),witnessScript:m.makeConverter(n.InputTypes.WITNESS_SCRIPT),checkPubkey:p.makeChecker([n.InputTypes.PARTIAL_SIG,n.InputTypes.BIP32_DERIVATION])};e.inputs=b;const v={bip32Derivation:d.makeConverter(n.OutputTypes.BIP32_DERIVATION),redeemScript:y.makeConverter(n.OutputTypes.REDEEM_SCRIPT),witnessScript:m.makeConverter(n.OutputTypes.WITNESS_SCRIPT),checkPubkey:p.makeChecker([n.OutputTypes.BIP32_DERIVATION])};e.outputs=v},6043:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+t.key.toString("hex"));return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.FINAL_SCRIPTSIG]),value:t}},e.expected="Buffer",e.check=function(t){return n.isBuffer(t)},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.finalScriptSig}},192:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+t.key.toString("hex"));return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.FINAL_SCRIPTWITNESS]),value:t}},e.expected="Buffer",e.check=function(t){return n.isBuffer(t)},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.finalScriptWitness}},404:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+t.key.toString("hex"));return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.NON_WITNESS_UTXO]),value:t}},e.expected="Buffer",e.check=function(t){return n.isBuffer(t)},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.nonWitnessUtxo}},5556:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+t.key.toString("hex"));if(34!==t.key.length&&66!==t.key.length||![2,3,4].includes(t.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+t.key.toString("hex"));return{pubkey:t.key.slice(1),signature:t.value}},e.encode=function(t){const e=n.from([i.InputTypes.PARTIAL_SIG]);return{key:n.concat([e,t.pubkey]),value:t.signature}},e.expected="{ pubkey: Buffer; signature: Buffer; }",e.check=function(t){return n.isBuffer(t.pubkey)&&n.isBuffer(t.signature)&&[33,65].includes(t.pubkey.length)&&[2,3,4].includes(t.pubkey[0])&&function(t){if(!n.isBuffer(t)||t.length<9)return!1;if(48!==t[0])return!1;if(t.length!==t[1]+3)return!1;if(2!==t[2])return!1;const e=t[3];if(e>33||e<1)return!1;if(2!==t[3+e+1])return!1;const r=t[3+e+2];return!(r>33||r<1)&&t.length===3+e+2+r+2}(t.signature)},e.canAddToArray=function(t,e,r){const n=e.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.pubkey.equals(e.pubkey))).length)}},5477:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+t.key.toString("hex"));return t.value.toString("utf8")},e.encode=function(t){return{key:n.from([i.InputTypes.POR_COMMITMENT]),value:n.from(t,"utf8")}},e.expected="string",e.check=function(t){return"string"==typeof t},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.porCommitment}},2860:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+t.key.toString("hex"));return t.value.readUInt32LE(0)},e.encode=function(t){const e=n.from([i.InputTypes.SIGHASH_TYPE]),r=n.allocUnsafe(4);return r.writeUInt32LE(t,0),{key:e,value:r}},e.expected="number",e.check=function(t){return"number"==typeof t},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.sighashType}},762:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710),o=r(275),s=r(9214);e.decode=function(t){if(t.key[0]!==i.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+t.key.toString("hex"));const e=o.readUInt64LE(t.value,0);let r=8;const n=s.decode(t.value,r);r+=s.encodingLength(n);const a=t.value.slice(r);if(a.length!==n)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:a,value:e}},e.encode=function(t){const{script:e,value:r}=t,a=s.encodingLength(e.length),u=n.allocUnsafe(8+a+e.length);return o.writeUInt64LE(u,r,0),s.encode(e.length,u,8),e.copy(u,8+a),{key:n.from([i.InputTypes.WITNESS_UTXO]),value:u}},e.expected="{ script: Buffer; value: number; }",e.check=function(t){return n.isBuffer(t.script)&&"number"==typeof t.value},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.witnessUtxo}},3678:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.makeConverter=function(t){return{decode:function(e){if(e.key[0]!==t)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+e.key.toString("hex"));if(34!==e.key.length&&66!==e.key.length||![2,3,4].includes(e.key[1]))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const r=e.key.slice(1),n={masterFingerprint:e.value.slice(0,4),pubkey:r,path:"m"};for(const t of(i=e.value.length/4-1,[...Array(i).keys()])){const r=e.value.readUInt32LE(4*t+4),i=!!(2147483648&r),o=2147483647&r;n.path+="/"+o.toString(10)+(i?"'":"")}var i;return n},encode:function(e){const r=n.from([t]),i=n.concat([r,e.pubkey]),o=e.path.split("/"),s=n.allocUnsafe(4*o.length);e.masterFingerprint.copy(s,0);let a=4;return o.slice(1).forEach((t=>{const e="'"===t.slice(-1);let r=2147483647&parseInt(e?t.slice(0,-1):t,10);e&&(r+=2147483648),s.writeUInt32LE(r,a),a+=4})),{key:i,value:s}},check:function(t){return n.isBuffer(t.pubkey)&&n.isBuffer(t.masterFingerprint)&&"string"==typeof t.path&&[33,65].includes(t.pubkey.length)&&[2,3,4].includes(t.pubkey[0])&&4===t.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(t,e,r){const n=e.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.pubkey.equals(e.pubkey))).length)}}}},5630:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.makeChecker=function(t){return function(e){let r;if(t.includes(e.key[0])&&(r=e.key.slice(1),33!==r.length&&65!==r.length||![2,3,4].includes(r[0])))throw new Error("Format Error: invalid pubkey in key 0x"+e.key.toString("hex"));return r}}},6981:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.makeConverter=function(t){return{decode:function(e){if(e.key[0]!==t)throw new Error("Decode Error: could not decode redeemScript with key 0x"+e.key.toString("hex"));return e.value},encode:function(e){return{key:n.from([t]),value:e}},check:function(t){return n.isBuffer(t)},expected:"Buffer",canAdd:function(t,e){return!!t&&!!e&&void 0===t.redeemScript}}}},6912:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.makeConverter=function(t){return{decode:function(e){if(e.key[0]!==t)throw new Error("Decode Error: could not decode witnessScript with key 0x"+e.key.toString("hex"));return e.value},encode:function(e){return{key:n.from([t]),value:e}},check:function(t){return n.isBuffer(t)},expected:"Buffer",canAdd:function(t,e){return!!t&&!!e&&void 0===t.witnessScript}}}},275:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9214);function o(t){const e=t.key.length,r=t.value.length,o=i.encodingLength(e),s=i.encodingLength(r),a=n.allocUnsafe(o+e+s+r);return i.encode(e,a,0),t.key.copy(a,o),i.encode(r,a,o+e),t.value.copy(a,o+e+s),a}function s(t,e){if("number"!=typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}e.range=t=>[...Array(t).keys()],e.reverseBuffer=function(t){if(t.length<1)return t;let e=t.length-1,r=0;for(let n=0;n<t.length/2;n++)r=t[n],t[n]=t[e],t[e]=r,e--;return t},e.keyValsToBuffer=function(t){const e=t.map(o);return e.push(n.from([0])),n.concat(e)},e.keyValToBuffer=o,e.readUInt64LE=function(t,e){const r=t.readUInt32LE(e);let n=t.readUInt32LE(e+4);return n*=4294967296,s(n+r,9007199254740991),n+r},e.writeUInt64LE=function(t,e,r){return s(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8}},9214:(t,e,r)=>{"use strict";var n=r(8834).Buffer;function i(t){if(t<0||t>9007199254740991||t%1!=0)throw new RangeError("value out of range")}function o(t){return i(t),t<253?1:t<=65535?3:t<=4294967295?5:9}Object.defineProperty(e,"__esModule",{value:!0}),e.encode=function t(e,r,s){if(i(e),r||(r=n.allocUnsafe(o(e))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return s||(s=0),e<253?(r.writeUInt8(e,s),Object.assign(t,{bytes:1})):e<=65535?(r.writeUInt8(253,s),r.writeUInt16LE(e,s+1),Object.assign(t,{bytes:3})):e<=4294967295?(r.writeUInt8(254,s),r.writeUInt32LE(e,s+1),Object.assign(t,{bytes:5})):(r.writeUInt8(255,s),r.writeUInt32LE(e>>>0,s+1),r.writeUInt32LE(e/4294967296|0,s+5),Object.assign(t,{bytes:9})),r},e.decode=function t(e,r){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);const o=e.readUInt8(r);if(o<253)return Object.assign(t,{bytes:1}),o;if(253===o)return Object.assign(t,{bytes:3}),e.readUInt16LE(r+1);if(254===o)return Object.assign(t,{bytes:5}),e.readUInt32LE(r+1);{Object.assign(t,{bytes:9});const n=e.readUInt32LE(r+1),o=4294967296*e.readUInt32LE(r+5)+n;return i(o),o}},e.encodingLength=o},619:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1661),o=r(275),s=r(9214),a=r(5710);function u(t,e,r){if(!e.equals(n.from([r])))throw new Error(`Format Error: Invalid ${t} key: ${e.toString("hex")}`)}function f(t,{globalMapKeyVals:e,inputKeyVals:r,outputKeyVals:n}){const s={unsignedTx:t};let f=0;for(const t of e)switch(t.key[0]){case a.GlobalTypes.UNSIGNED_TX:if(u("global",t.key,a.GlobalTypes.UNSIGNED_TX),f>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");f++;break;case a.GlobalTypes.GLOBAL_XPUB:void 0===s.globalXpub&&(s.globalXpub=[]),s.globalXpub.push(i.globals.globalXpub.decode(t));break;default:s.unknownKeyVals||(s.unknownKeyVals=[]),s.unknownKeyVals.push(t)}const h=r.length,c=n.length,l=[],d=[];for(const t of o.range(h)){const e={};for(const n of r[t])switch(i.inputs.checkPubkey(n),n.key[0]){case a.InputTypes.NON_WITNESS_UTXO:if(u("input",n.key,a.InputTypes.NON_WITNESS_UTXO),void 0!==e.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");e.nonWitnessUtxo=i.inputs.nonWitnessUtxo.decode(n);break;case a.InputTypes.WITNESS_UTXO:if(u("input",n.key,a.InputTypes.WITNESS_UTXO),void 0!==e.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");e.witnessUtxo=i.inputs.witnessUtxo.decode(n);break;case a.InputTypes.PARTIAL_SIG:void 0===e.partialSig&&(e.partialSig=[]),e.partialSig.push(i.inputs.partialSig.decode(n));break;case a.InputTypes.SIGHASH_TYPE:if(u("input",n.key,a.InputTypes.SIGHASH_TYPE),void 0!==e.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");e.sighashType=i.inputs.sighashType.decode(n);break;case a.InputTypes.REDEEM_SCRIPT:if(u("input",n.key,a.InputTypes.REDEEM_SCRIPT),void 0!==e.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");e.redeemScript=i.inputs.redeemScript.decode(n);break;case a.InputTypes.WITNESS_SCRIPT:if(u("input",n.key,a.InputTypes.WITNESS_SCRIPT),void 0!==e.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");e.witnessScript=i.inputs.witnessScript.decode(n);break;case a.InputTypes.BIP32_DERIVATION:void 0===e.bip32Derivation&&(e.bip32Derivation=[]),e.bip32Derivation.push(i.inputs.bip32Derivation.decode(n));break;case a.InputTypes.FINAL_SCRIPTSIG:u("input",n.key,a.InputTypes.FINAL_SCRIPTSIG),e.finalScriptSig=i.inputs.finalScriptSig.decode(n);break;case a.InputTypes.FINAL_SCRIPTWITNESS:u("input",n.key,a.InputTypes.FINAL_SCRIPTWITNESS),e.finalScriptWitness=i.inputs.finalScriptWitness.decode(n);break;case a.InputTypes.POR_COMMITMENT:u("input",n.key,a.InputTypes.POR_COMMITMENT),e.porCommitment=i.inputs.porCommitment.decode(n);break;default:e.unknownKeyVals||(e.unknownKeyVals=[]),e.unknownKeyVals.push(n)}l.push(e)}for(const t of o.range(c)){const e={};for(const r of n[t])switch(i.outputs.checkPubkey(r),r.key[0]){case a.OutputTypes.REDEEM_SCRIPT:if(u("output",r.key,a.OutputTypes.REDEEM_SCRIPT),void 0!==e.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");e.redeemScript=i.outputs.redeemScript.decode(r);break;case a.OutputTypes.WITNESS_SCRIPT:if(u("output",r.key,a.OutputTypes.WITNESS_SCRIPT),void 0!==e.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");e.witnessScript=i.outputs.witnessScript.decode(r);break;case a.OutputTypes.BIP32_DERIVATION:void 0===e.bip32Derivation&&(e.bip32Derivation=[]),e.bip32Derivation.push(i.outputs.bip32Derivation.decode(r));break;default:e.unknownKeyVals||(e.unknownKeyVals=[]),e.unknownKeyVals.push(r)}d.push(e)}return{globalMap:s,inputs:l,outputs:d}}e.psbtFromBuffer=function(t,e){let r=0;function n(){const e=s.decode(t,r);r+=s.encodingLength(e);const n=t.slice(r,r+e);return r+=e,n}function i(){return{key:n(),value:n()}}function u(){if(r>=t.length)throw new Error("Format Error: Unexpected End of PSBT");const e=0===t.readUInt8(r);return e&&r++,e}if(1886610036!==function(){const e=t.readUInt32BE(r);return r+=4,e}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){const e=t.readUInt8(r);return r+=1,e}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");const h=[],c={};for(;!u();){const t=i(),e=t.key.toString("hex");if(c[e])throw new Error("Format Error: Keys must be unique for global keymap: key "+e);c[e]=1,h.push(t)}const l=h.filter((t=>t.key[0]===a.GlobalTypes.UNSIGNED_TX));if(1!==l.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const d=e(l[0].value),{inputCount:p,outputCount:y}=d.getInputOutputCounts(),m=[],g=[];for(const t of o.range(p)){const e={},r=[];for(;!u();){const n=i(),o=n.key.toString("hex");if(e[o])throw new Error("Format Error: Keys must be unique for each input: input index "+t+" key "+o);e[o]=1,r.push(n)}m.push(r)}for(const t of o.range(y)){const e={},r=[];for(;!u();){const n=i(),o=n.key.toString("hex");if(e[o])throw new Error("Format Error: Keys must be unique for each output: output index "+t+" key "+o);e[o]=1,r.push(n)}g.push(r)}return f(d,{globalMapKeyVals:h,inputKeyVals:m,outputKeyVals:g})},e.checkKeyBuffer=u,e.psbtFromKeyVals=f},1425:(t,e,r)=>{"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(619)),n(r(268))},268:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1661),o=r(275);e.psbtToBuffer=function({globalMap:t,inputs:e,outputs:r}){const{globalKeyVals:i,inputKeyVals:s,outputKeyVals:a}=u({globalMap:t,inputs:e,outputs:r}),f=o.keyValsToBuffer(i),h=t=>0===t.length?[n.from([0])]:t.map(o.keyValsToBuffer),c=h(s),l=h(a),d=n.allocUnsafe(5);return d.writeUIntBE(482972169471,0,5),n.concat([d,f].concat(c,l))};const s=(t,e)=>t.key.compare(e.key);function a(t,e){const r=new Set,n=Object.entries(t).reduce(((t,[n,i])=>{if("unknownKeyVals"===n)return t;const o=e[n];if(void 0===o)return t;const s=(Array.isArray(i)?i:[i]).map(o.encode);return s.map((t=>t.key.toString("hex"))).forEach((t=>{if(r.has(t))throw new Error("Serialize Error: Duplicate key: "+t);r.add(t)})),t.concat(s)}),[]),i=t.unknownKeyVals?t.unknownKeyVals.filter((t=>!r.has(t.key.toString("hex")))):[];return n.concat(i).sort(s)}function u({globalMap:t,inputs:e,outputs:r}){return{globalKeyVals:a(t,i.globals),inputKeyVals:e.map((t=>a(t,i.inputs))),outputKeyVals:r.map((t=>a(t,i.outputs)))}}e.psbtToKeyVals=u},8174:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(6989),o=r(1425),s=r(5710),a=r(5639);e.Psbt=class{constructor(t){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:t}}static fromBase64(t,e){const r=n.from(t,"base64");return this.fromBuffer(r,e)}static fromHex(t,e){const r=n.from(t,"hex");return this.fromBuffer(r,e)}static fromBuffer(t,e){const r=o.psbtFromBuffer(t,e),n=new this(r.globalMap.unsignedTx);return Object.assign(n,r),n}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return o.psbtToBuffer(this)}updateGlobal(t){return a.updateGlobal(t,this.globalMap),this}updateInput(t,e){const r=a.checkForInput(this.inputs,t);return a.updateInput(e,r),this}updateOutput(t,e){const r=a.checkForOutput(this.outputs,t);return a.updateOutput(e,r),this}addUnknownKeyValToGlobal(t){return a.checkHasKey(t,this.globalMap.unknownKeyVals,a.getEnumLength(s.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(t),this}addUnknownKeyValToInput(t,e){const r=a.checkForInput(this.inputs,t);return a.checkHasKey(e,r.unknownKeyVals,a.getEnumLength(s.InputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(e),this}addUnknownKeyValToOutput(t,e){const r=a.checkForOutput(this.outputs,t);return a.checkHasKey(e,r.unknownKeyVals,a.getEnumLength(s.OutputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(e),this}addInput(t){this.globalMap.unsignedTx.addInput(t),this.inputs.push({unknownKeyVals:[]});const e=t.unknownKeyVals||[],r=this.inputs.length-1;if(!Array.isArray(e))throw new Error("unknownKeyVals must be an Array");return e.forEach((t=>this.addUnknownKeyValToInput(r,t))),a.addInputAttributes(this.inputs,t),this}addOutput(t){this.globalMap.unsignedTx.addOutput(t),this.outputs.push({unknownKeyVals:[]});const e=t.unknownKeyVals||[],r=this.outputs.length-1;if(!Array.isArray(e))throw new Error("unknownKeyVals must be an Array");return e.forEach((t=>this.addUnknownKeyValToInput(r,t))),a.addOutputAttributes(this.outputs,t),this}clearFinalizedInput(t){const e=a.checkForInput(this.inputs,t);a.inputCheckUncleanFinalized(t,e);for(const t of Object.keys(e))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(t)||delete e[t];return this}combine(...t){const e=i.combine([this].concat(t));return Object.assign(this,e),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}}},5710:(t,e)=>{"use strict";var r,n,i;Object.defineProperty(e,"__esModule",{value:!0}),(i=e.GlobalTypes||(e.GlobalTypes={}))[i.UNSIGNED_TX=0]="UNSIGNED_TX",i[i.GLOBAL_XPUB=1]="GLOBAL_XPUB",e.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],(n=e.InputTypes||(e.InputTypes={}))[n.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",n[n.WITNESS_UTXO=1]="WITNESS_UTXO",n[n.PARTIAL_SIG=2]="PARTIAL_SIG",n[n.SIGHASH_TYPE=3]="SIGHASH_TYPE",n[n.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",n[n.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",n[n.BIP32_DERIVATION=6]="BIP32_DERIVATION",n[n.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",n[n.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",n[n.POR_COMMITMENT=9]="POR_COMMITMENT",e.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment"],(r=e.OutputTypes||(e.OutputTypes={}))[r.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",r[r.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",r[r.BIP32_DERIVATION=2]="BIP32_DERIVATION",e.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation"]},5639:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1661);function o(t,e){const r=t[e];if(void 0===r)throw new Error(`No input #${e}`);return r}function s(t,e,r,n){throw new Error(`Data for ${t} key ${e} is incorrect: Expected ${r} and got ${JSON.stringify(n)}`)}function a(t){return(e,r)=>{for(const n of Object.keys(e)){const o=e[n],{canAdd:a,canAddToArray:u,check:f,expected:h}=i[t+"s"][n]||{},c=!!u;if(f)if(c){if(!Array.isArray(o)||r[n]&&!Array.isArray(r[n]))throw new Error(`Key type ${n} must be an array`);o.every(f)||s(t,n,h,o);const e=r[n]||[],i=new Set;if(!o.every((t=>u(e,t,i))))throw new Error("Can not add duplicate data to array");r[n]=e.concat(o)}else{if(f(o)||s(t,n,h,o),!a(r,o))throw new Error(`Can not add duplicate data to ${t}`);r[n]=o}}}}e.checkForInput=o,e.checkForOutput=function(t,e){const r=t[e];if(void 0===r)throw new Error(`No output #${e}`);return r},e.checkHasKey=function(t,e,r){if(t.key[0]<r)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(e&&0!==e.filter((e=>e.key.equals(t.key))).length)throw new Error(`Duplicate Key: ${t.key.toString("hex")}`)},e.getEnumLength=function(t){let e=0;return Object.keys(t).forEach((t=>{Number(isNaN(Number(t)))&&e++})),e},e.inputCheckUncleanFinalized=function(t,e){let r=!1;if(e.nonWitnessUtxo||e.witnessUtxo){const t=!!e.redeemScript,n=!!e.witnessScript,i=!t||!!e.finalScriptSig,o=!n||!!e.finalScriptWitness,s=!!e.finalScriptSig||!!e.finalScriptWitness;r=i&&o&&s}if(!1===r)throw new Error(`Input #${t} has too much or too little data to clean`)},e.updateGlobal=a("global"),e.updateInput=a("input"),e.updateOutput=a("output"),e.addInputAttributes=function(t,r){const n=o(t,t.length-1);e.updateInput(r,n)},e.addOutputAttributes=function(t,r){const n=o(t,t.length-1);e.updateOutput(r,n)},e.defaultVersionSetter=function(t,e){if(!n.isBuffer(e)||e.length<4)throw new Error("Set Version: Invalid Transaction");return e.writeUInt32LE(t,0),e},e.defaultLocktimeSetter=function(t,e){if(!n.isBuffer(e)||e.length<4)throw new Error("Set Locktime: Invalid Transaction");return e.writeUInt32LE(t,e.length-4),e}},6015:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(3527),o=r(4075),s=r(701),a=r(9031),u=r(1384),f=a.BufferN(32),h=a.compile({wif:a.UInt8,bip32:{public:a.UInt32,private:a.UInt32}}),c={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},l=2147483648,d=Math.pow(2,31)-1;function p(t){return a.String(t)&&null!==t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function y(t){return a.UInt32(t)&&t<=d}class m{constructor(t,e,r,n,i=0,o=0,s=0){this.__D=t,this.__Q=e,this.chainCode=r,this.network=n,this.__DEPTH=i,this.__INDEX=o,this.__PARENT_FINGERPRINT=s,a(h,n),this.lowR=!1}get depth(){return this.__DEPTH}get index(){return this.__INDEX}get parentFingerprint(){return this.__PARENT_FINGERPRINT}get publicKey(){return void 0===this.__Q&&(this.__Q=s.pointFromScalar(this.__D,!0)),this.__Q}get privateKey(){return this.__D}get identifier(){return i.hash160(this.publicKey)}get fingerprint(){return this.identifier.slice(0,4)}get compressed(){return!0}isNeutered(){return void 0===this.__D}neutered(){return v(this.publicKey,this.chainCode,this.network,this.depth,this.index,this.parentFingerprint)}toBase58(){const t=this.network,e=this.isNeutered()?t.bip32.public:t.bip32.private,r=n.allocUnsafe(78);return r.writeUInt32BE(e,0),r.writeUInt8(this.depth,4),r.writeUInt32BE(this.parentFingerprint,5),r.writeUInt32BE(this.index,9),this.chainCode.copy(r,13),this.isNeutered()?this.publicKey.copy(r,45):(r.writeUInt8(0,45),this.privateKey.copy(r,46)),o.encode(r)}toWIF(){if(!this.privateKey)throw new TypeError("Missing private key");return u.encode(this.network.wif,this.privateKey,!0)}derive(t){a(a.UInt32,t);const e=t>=l,r=n.allocUnsafe(37);if(e){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");r[0]=0,this.privateKey.copy(r,1),r.writeUInt32BE(t,33)}else this.publicKey.copy(r,0),r.writeUInt32BE(t,33);const o=i.hmacSHA512(this.chainCode,r),u=o.slice(0,32),f=o.slice(32);if(!s.isPrivate(u))return this.derive(t+1);let h;if(this.isNeutered()){const e=s.pointAddScalar(this.publicKey,u,!0);if(null===e)return this.derive(t+1);h=v(e,f,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}else{const e=s.privateAdd(this.privateKey,u);if(null==e)return this.derive(t+1);h=b(e,f,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}return h}deriveHardened(t){return a(y,t),this.derive(t+l)}derivePath(t){a(p,t);let e=t.split("/");if("m"===e[0]){if(this.parentFingerprint)throw new TypeError("Expected master, got child");e=e.slice(1)}return e.reduce(((t,e)=>{let r;return"'"===e.slice(-1)?(r=parseInt(e.slice(0,-1),10),t.deriveHardened(r)):(r=parseInt(e,10),t.derive(r))}),this)}sign(t,e){if(!this.privateKey)throw new Error("Missing private key");if(void 0===e&&(e=this.lowR),!1===e)return s.sign(t,this.privateKey);{let e=s.sign(t,this.privateKey);const r=n.alloc(32,0);let i=0;for(;e[0]>127;)i++,r.writeUIntLE(i,0,6),e=s.signWithEntropy(t,this.privateKey,r);return e}}verify(t,e){return s.verify(t,this.publicKey,e)}}function g(t,e,r){return b(t,e,r)}function b(t,e,r,n,i,o){if(a({privateKey:f,chainCode:f},{privateKey:t,chainCode:e}),r=r||c,!s.isPrivate(t))throw new TypeError("Private key not in range [1, n)");return new m(t,void 0,e,r,n,i,o)}function v(t,e,r,n,i,o){if(a({publicKey:a.BufferN(33),chainCode:f},{publicKey:t,chainCode:e}),r=r||c,!s.isPoint(t))throw new TypeError("Point is not on the curve");return new m(void 0,t,e,r,n,i,o)}e.fromBase58=function(t,e){const r=o.decode(t);if(78!==r.length)throw new TypeError("Invalid buffer length");e=e||c;const n=r.readUInt32BE(0);if(n!==e.bip32.private&&n!==e.bip32.public)throw new TypeError("Invalid network version");const i=r[4],s=r.readUInt32BE(5);if(0===i&&0!==s)throw new TypeError("Invalid parent fingerprint");const a=r.readUInt32BE(9);if(0===i&&0!==a)throw new TypeError("Invalid index");const u=r.slice(13,45);let f;if(n===e.bip32.private){if(0!==r.readUInt8(45))throw new TypeError("Invalid private key");f=b(r.slice(46,78),u,e,i,a,s)}else f=v(r.slice(45,78),u,e,i,a,s);return f},e.fromPrivateKey=g,e.fromPublicKey=function(t,e,r){return v(t,e,r)},e.fromSeed=function(t,e){if(a(a.Buffer,t),t.length<16)throw new TypeError("Seed should be at least 128 bits");if(t.length>64)throw new TypeError("Seed should be at most 512 bits");e=e||c;const r=i.hmacSHA512(n.from("Bitcoin seed","utf8"),t);return g(r.slice(0,32),r.slice(32),e)}},3527:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(6162),i=r(11);e.hash160=function(t){const e=n("sha256").update(t).digest();try{return n("rmd160").update(e).digest()}catch(t){return n("ripemd160").update(e).digest()}},e.hmacSHA512=function(t,e){return i("sha512",t).update(e).digest()}},4132:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(6015);e.fromSeed=n.fromSeed,e.fromBase58=n.fromBase58,e.fromPublicKey=n.fromPublicKey,e.fromPrivateKey=n.fromPrivateKey},9875:(t,e,r)=>{var n=r(7834).Buffer;t.exports={check:function(t){if(t.length<8)return!1;if(t.length>72)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-2)return!1;if(2!==t[2])return!1;var e=t[3];if(0===e)return!1;if(5+e>=t.length)return!1;if(2!==t[4+e])return!1;var r=t[5+e];return!(0===r||6+e+r!==t.length||128&t[4]||e>1&&0===t[4]&&!(128&t[5])||128&t[e+6]||r>1&&0===t[e+6]&&!(128&t[e+7]))},decode:function(t){if(t.length<8)throw new Error("DER sequence length is too short");if(t.length>72)throw new Error("DER sequence length is too long");if(48!==t[0])throw new Error("Expected DER sequence");if(t[1]!==t.length-2)throw new Error("DER sequence length is invalid");if(2!==t[2])throw new Error("Expected DER integer");var e=t[3];if(0===e)throw new Error("R length is zero");if(5+e>=t.length)throw new Error("R length is too long");if(2!==t[4+e])throw new Error("Expected DER integer (2)");var r=t[5+e];if(0===r)throw new Error("S length is zero");if(6+e+r!==t.length)throw new Error("S length is invalid");if(128&t[4])throw new Error("R value is negative");if(e>1&&0===t[4]&&!(128&t[5]))throw new Error("R value excessively padded");if(128&t[e+6])throw new Error("S value is negative");if(r>1&&0===t[e+6]&&!(128&t[e+7]))throw new Error("S value excessively padded");return{r:t.slice(4,4+e),s:t.slice(6+e)}},encode:function(t,e){var r=t.length,i=e.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&t[0])throw new Error("R value is negative");if(128&e[0])throw new Error("S value is negative");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("R value excessively padded");if(i>1&&0===e[0]&&!(128&e[1]))throw new Error("S value excessively padded");var o=n.allocUnsafe(6+r+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=t.length,t.copy(o,4),o[4+r]=2,o[5+r]=e.length,e.copy(o,6+r),o}}},7401:(t,e,r)=>{var n=r(196),i={};for(var o in n)i[n[o]]=o;t.exports=i},9168:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(419),o=r(6469),s=r(3016),a=r(6168),u=r(1273),f=r(4075),h=r(9031);function c(t){const e=f.decode(t);if(e.length<21)throw new TypeError(t+" is too short");if(e.length>21)throw new TypeError(t+" is too long");return{version:e.readUInt8(0),hash:e.slice(1)}}function l(t){const e=u.decode(t),r=u.fromWords(e.words.slice(1));return{version:e.words[0],prefix:e.prefix,data:n.from(r)}}e.fromBase58Check=c,e.fromBech32=l,e.toBase58Check=function(t,e){h(a.tuple(a.Hash160bit,a.UInt8),arguments);const r=n.allocUnsafe(21);return r.writeUInt8(e,0),t.copy(r,1),f.encode(r)},e.toBech32=function(t,e,r){const n=u.toWords(t);return n.unshift(e),u.encode(r,n)},e.fromOutputScript=function(t,e){e=e||i.bitcoin;try{return o.p2pkh({output:t,network:e}).address}catch(t){}try{return o.p2sh({output:t,network:e}).address}catch(t){}try{return o.p2wpkh({output:t,network:e}).address}catch(t){}try{return o.p2wsh({output:t,network:e}).address}catch(t){}throw new Error(s.toASM(t)+" has no matching Address")},e.toOutputScript=function(t,e){let r,n;e=e||i.bitcoin;try{r=c(t)}catch(t){}if(r){if(r.version===e.pubKeyHash)return o.p2pkh({hash:r.hash}).output;if(r.version===e.scriptHash)return o.p2sh({hash:r.hash}).output}else{try{n=l(t)}catch(t){}if(n){if(n.prefix!==e.bech32)throw new Error(t+" has an invalid prefix");if(0===n.version){if(20===n.data.length)return o.p2wpkh({hash:n.data}).output;if(32===n.data.length)return o.p2wsh({hash:n.data}).output}}}throw new Error(t+" has no matching Script")}},485:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9359),o=r(2572),s=r(4457),a=r(6168),u=r(7332),f=r(9031),h=r(8595),c=new TypeError("Cannot compute merkle root for zero transactions"),l=new TypeError("Cannot compute witness commit for non-segwit block");class d{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(t){if(t.length<80)throw new Error("Buffer too small (< 80 bytes)");const e=new i.BufferReader(t),r=new d;if(r.version=e.readInt32(),r.prevHash=e.readSlice(32),r.merkleRoot=e.readSlice(32),r.timestamp=e.readUInt32(),r.bits=e.readUInt32(),r.nonce=e.readUInt32(),80===t.length)return r;const n=()=>{const t=s.Transaction.fromBuffer(e.buffer.slice(e.offset),!0);return e.offset+=t.byteLength(),t},o=e.readVarInt();r.transactions=[];for(let t=0;t<o;++t){const t=n();r.transactions.push(t)}const a=r.getWitnessCommit();return a&&(r.witnessCommit=a),r}static fromHex(t){return d.fromBuffer(n.from(t,"hex"))}static calculateTarget(t){const e=((4278190080&t)>>24)-3,r=8388607&t,i=n.alloc(32,0);return i.writeUIntBE(r,29-e,3),i}static calculateMerkleRoot(t,e){if(f([{getHash:a.Function}],t),0===t.length)throw c;if(e&&!p(t))throw l;const r=t.map((t=>t.getHash(e))),i=u(r,o.hash256);return e?o.hash256(n.concat([i,t[0].ins[0].witness[0]])):i}getWitnessCommit(){if(!p(this.transactions))return null;const t=this.transactions[0].outs.filter((t=>t.script.slice(0,6).equals(n.from("6a24aa21a9ed","hex")))).map((t=>t.script.slice(6,38)));if(0===t.length)return null;const e=t[t.length-1];return e instanceof n&&32===e.length?e:null}hasWitnessCommit(){return this.witnessCommit instanceof n&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}hasWitness(){return(t=this.transactions)instanceof Array&&t.some((t=>"object"==typeof t&&t.ins instanceof Array&&t.ins.some((t=>"object"==typeof t&&t.witness instanceof Array&&t.witness.length>0))));var t}weight(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}byteLength(t,e=!0){return t||!this.transactions?80:80+h.encodingLength(this.transactions.length)+this.transactions.reduce(((t,r)=>t+r.byteLength(e)),0)}getHash(){return o.hash256(this.toBuffer(!0))}getId(){return i.reverseBuffer(this.getHash()).toString("hex")}getUTCDate(){const t=new Date(0);return t.setUTCSeconds(this.timestamp),t}toBuffer(t){const e=n.allocUnsafe(this.byteLength(t)),r=new i.BufferWriter(e);return r.writeInt32(this.version),r.writeSlice(this.prevHash),r.writeSlice(this.merkleRoot),r.writeUInt32(this.timestamp),r.writeUInt32(this.bits),r.writeUInt32(this.nonce),t||!this.transactions||(h.encode(this.transactions.length,e,r.offset),r.offset+=h.encode.bytes,this.transactions.forEach((t=>{const n=t.byteLength();t.toBuffer(e,r.offset),r.offset+=n}))),e}toHex(t){return this.toBuffer(t).toString("hex")}checkTxRoots(){const t=this.hasWitnessCommit();return!(!t&&this.hasWitness())&&this.__checkMerkleRoot()&&(!t||this.__checkWitnessCommit())}checkProofOfWork(){const t=i.reverseBuffer(this.getHash()),e=d.calculateTarget(this.bits);return t.compare(e)<=0}__checkMerkleRoot(){if(!this.transactions)throw c;const t=d.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(t)}__checkWitnessCommit(){if(!this.transactions)throw c;if(!this.hasWitnessCommit())throw l;const t=d.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(t)}}function p(t){return t instanceof Array&&t[0]&&t[0].ins&&t[0].ins instanceof Array&&t[0].ins[0]&&t[0].ins[0].witness&&t[0].ins[0].witness instanceof Array&&t[0].ins[0].witness.length>0}e.Block=d},9359:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(6168),o=r(9031),s=r(8595);function a(t,e){if("number"!=typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}function u(t,e){const r=t.readUInt32LE(e);let n=t.readUInt32LE(e+4);return n*=4294967296,a(n+r,9007199254740991),n+r}function f(t,e,r){return a(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8}e.readUInt64LE=u,e.writeUInt64LE=f,e.reverseBuffer=function(t){if(t.length<1)return t;let e=t.length-1,r=0;for(let n=0;n<t.length/2;n++)r=t[n],t[n]=t[e],t[e]=r,e--;return t},e.cloneBuffer=function(t){const e=n.allocUnsafe(t.length);return t.copy(e),e},e.BufferWriter=class{constructor(t,e=0){this.buffer=t,this.offset=e,o(i.tuple(i.Buffer,i.UInt32),[t,e])}writeUInt8(t){this.offset=this.buffer.writeUInt8(t,this.offset)}writeInt32(t){this.offset=this.buffer.writeInt32LE(t,this.offset)}writeUInt32(t){this.offset=this.buffer.writeUInt32LE(t,this.offset)}writeUInt64(t){this.offset=f(this.buffer,t,this.offset)}writeVarInt(t){s.encode(t,this.buffer,this.offset),this.offset+=s.encode.bytes}writeSlice(t){if(this.buffer.length<this.offset+t.length)throw new Error("Cannot write slice out of bounds");this.offset+=t.copy(this.buffer,this.offset)}writeVarSlice(t){this.writeVarInt(t.length),this.writeSlice(t)}writeVector(t){this.writeVarInt(t.length),t.forEach((t=>this.writeVarSlice(t)))}},e.BufferReader=class{constructor(t,e=0){this.buffer=t,this.offset=e,o(i.tuple(i.Buffer,i.UInt32),[t,e])}readUInt8(){const t=this.buffer.readUInt8(this.offset);return this.offset++,t}readInt32(){const t=this.buffer.readInt32LE(this.offset);return this.offset+=4,t}readUInt32(){const t=this.buffer.readUInt32LE(this.offset);return this.offset+=4,t}readUInt64(){const t=u(this.buffer,this.offset);return this.offset+=8,t}readVarInt(){const t=s.decode(this.buffer,this.offset);return this.offset+=s.decode.bytes,t}readSlice(t){if(this.buffer.length<this.offset+t)throw new Error("Cannot read slice out of bounds");const e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const t=this.readVarInt(),e=[];for(let r=0;r<t;r++)e.push(this.readVarSlice());return e}}},4654:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3155),o=r(9404),s=r(9177),a=r(6858),u=r(6696),f=r(2468),h=r(8387),c=r(8861),l={P2MS:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"};e.types=l,e.output=function(t){if(h.output.check(t))return l.P2WPKH;if(c.output.check(t))return l.P2WSH;if(a.output.check(t))return l.P2PKH;if(u.output.check(t))return l.P2SH;const e=n.decompile(t);if(!e)throw new TypeError("Invalid script");return i.output.check(e)?l.P2MS:s.output.check(e)?l.P2PK:f.output.check(e)?l.WITNESS_COMMITMENT:o.output.check(e)?l.NULLDATA:l.NONSTANDARD},e.input=function(t,e){const r=n.decompile(t);if(!r)throw new TypeError("Invalid script");return a.input.check(r)?l.P2PKH:u.input.check(r,e)?l.P2SH:i.input.check(r,e)?l.P2MS:s.input.check(r)?l.P2PK:l.NONSTANDARD},e.witness=function(t,e){const r=n.decompile(t);if(!r)throw new TypeError("Invalid script");return h.input.check(r)?l.P2WPKH:c.input.check(r,e)?l.P2WSH:l.NONSTANDARD}},2572:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(6162);function i(t){try{return n("rmd160").update(t).digest()}catch(e){return n("ripemd160").update(t).digest()}}function o(t){return n("sha256").update(t).digest()}e.ripemd160=i,e.sha1=function(t){return n("sha1").update(t).digest()},e.sha256=o,e.hash160=function(t){return i(o(t))},e.hash256=function(t){return o(o(t))}},8893:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(419),o=r(6168),s=r(701),a=r(5003),u=r(9031),f=r(1384),h=u.maybe(u.compile({compressed:o.maybe(o.Boolean),network:o.maybe(o.Network)}));class c{constructor(t,e,r){this.__D=t,this.__Q=e,this.lowR=!1,void 0===r&&(r={}),this.compressed=void 0===r.compressed||r.compressed,this.network=r.network||i.bitcoin,void 0!==e&&(this.__Q=s.pointCompress(e,this.compressed))}get privateKey(){return this.__D}get publicKey(){return this.__Q||(this.__Q=s.pointFromScalar(this.__D,this.compressed)),this.__Q}toWIF(){if(!this.__D)throw new Error("Missing private key");return f.encode(this.network.wif,this.__D,this.compressed)}sign(t,e){if(!this.__D)throw new Error("Missing private key");if(void 0===e&&(e=this.lowR),!1===e)return s.sign(t,this.__D);{let e=s.sign(t,this.__D);const r=n.alloc(32,0);let i=0;for(;e[0]>127;)i++,r.writeUIntLE(i,0,6),e=s.signWithEntropy(t,this.__D,r);return e}}verify(t,e){return s.verify(t,this.publicKey,e)}}function l(t,e){if(u(o.Buffer256bit,t),!s.isPrivate(t))throw new TypeError("Private key not in range [1, n)");return u(h,e),new c(t,void 0,e)}e.fromPrivateKey=l,e.fromPublicKey=function(t,e){return u(s.isPoint,t),u(h,e),new c(void 0,t,e)},e.fromWIF=function(t,e){const r=f.decode(t),n=r.version;if(o.Array(e)){if(!(e=e.filter((t=>n===t.wif)).pop()))throw new Error("Unknown network version")}else if(e=e||i.bitcoin,n!==e.wif)throw new Error("Invalid network version");return l(r.privateKey,{compressed:r.compressed,network:e})},e.makeRandom=function(t){u(h,t),void 0===t&&(t={});const e=t.rng||a;let r;do{r=e(32),u(o.Buffer256bit,r)}while(!s.isPrivate(r));return l(r,t)}},6314:(t,e,r)=>{"use strict";r(4132),r(9168),r(2572),r(8893),r(419),r(6469);const n=r(3016);e._v=n,r(485).Block,r(9468).Psbt,r(3016).OPS;var i=r(4457);e.YW=i.Transaction,r(6459).TransactionBuilder},419:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},e.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},e.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}},2916:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(419),i=r(3016),o=r(8535),s=r(9031),a=i.OPS;e.p2data=function(t,e){if(!t.data&&!t.output)throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),s({network:s.maybe(s.Object),output:s.maybe(s.Buffer),data:s.maybe(s.arrayOf(s.Buffer))},t);const r={name:"embed",network:t.network||n.bitcoin};if(o.prop(r,"output",(()=>{if(t.data)return i.compile([a.OP_RETURN].concat(t.data))})),o.prop(r,"data",(()=>{if(t.output)return i.decompile(t.output).slice(1)})),e.validate&&t.output){const e=i.decompile(t.output);if(e[0]!==a.OP_RETURN)throw new TypeError("Output is invalid");if(!e.slice(1).every(s.Buffer))throw new TypeError("Output is invalid");if(t.data&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.data,r.data))throw new TypeError("Data mismatch")}return Object.assign(r,t)}},6469:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(2916);e.embed=n.p2data;const i=r(1863);e.p2ms=i.p2ms;const o=r(8536);e.p2pk=o.p2pk;const s=r(4696);e.p2pkh=s.p2pkh;const a=r(743);e.p2sh=a.p2sh;const u=r(16);e.p2wpkh=u.p2wpkh;const f=r(5732);e.p2wsh=f.p2wsh},8535:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.prop=function(t,e,r){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){const t=r.call(this);return this[e]=t,t},set(t){Object.defineProperty(this,e,{configurable:!0,enumerable:!0,value:t,writable:!0})}})},e.value=function(t){let e;return()=>(void 0!==e||(e=t()),e)}},1863:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(419),i=r(3016),o=r(8535),s=i.OPS,a=r(9031),u=r(701),f=s.OP_RESERVED;function h(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}e.p2ms=function(t,e){if(!(t.input||t.output||t.pubkeys&&void 0!==t.m||t.signatures))throw new TypeError("Not enough data");function r(t){return i.isCanonicalScriptSignature(t)||void 0!==(e.allowIncomplete&&t===s.OP_0)}e=Object.assign({validate:!0},e||{}),a({network:a.maybe(a.Object),m:a.maybe(a.Number),n:a.maybe(a.Number),output:a.maybe(a.Buffer),pubkeys:a.maybe(a.arrayOf(u.isPoint)),signatures:a.maybe(a.arrayOf(r)),input:a.maybe(a.Buffer)},t);const c={network:t.network||n.bitcoin};let l=[],d=!1;function p(t){d||(d=!0,l=i.decompile(t),c.m=l[0]-f,c.n=l[l.length-2]-f,c.pubkeys=l.slice(1,-2))}if(o.prop(c,"output",(()=>{if(t.m&&c.n&&t.pubkeys)return i.compile([].concat(f+t.m,t.pubkeys,f+c.n,s.OP_CHECKMULTISIG))})),o.prop(c,"m",(()=>{if(c.output)return p(c.output),c.m})),o.prop(c,"n",(()=>{if(c.pubkeys)return c.pubkeys.length})),o.prop(c,"pubkeys",(()=>{if(t.output)return p(t.output),c.pubkeys})),o.prop(c,"signatures",(()=>{if(t.input)return i.decompile(t.input).slice(1)})),o.prop(c,"input",(()=>{if(t.signatures)return i.compile([s.OP_0].concat(t.signatures))})),o.prop(c,"witness",(()=>{if(c.input)return[]})),o.prop(c,"name",(()=>{if(c.m&&c.n)return`p2ms(${c.m} of ${c.n})`})),e.validate){if(t.output){if(p(t.output),!a.Number(l[0]))throw new TypeError("Output is invalid");if(!a.Number(l[l.length-2]))throw new TypeError("Output is invalid");if(l[l.length-1]!==s.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(c.m<=0||c.n>16||c.m>c.n||c.n!==l.length-3)throw new TypeError("Output is invalid");if(!c.pubkeys.every((t=>u.isPoint(t))))throw new TypeError("Output is invalid");if(void 0!==t.m&&t.m!==c.m)throw new TypeError("m mismatch");if(void 0!==t.n&&t.n!==c.n)throw new TypeError("n mismatch");if(t.pubkeys&&!h(t.pubkeys,c.pubkeys))throw new TypeError("Pubkeys mismatch")}if(t.pubkeys){if(void 0!==t.n&&t.n!==t.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(c.n=t.pubkeys.length,c.n<c.m)throw new TypeError("Pubkey count cannot be less than m")}if(t.signatures){if(t.signatures.length<c.m)throw new TypeError("Not enough signatures provided");if(t.signatures.length>c.m)throw new TypeError("Too many signatures provided")}if(t.input){if(t.input[0]!==s.OP_0)throw new TypeError("Input is invalid");if(0===c.signatures.length||!c.signatures.every(r))throw new TypeError("Input has invalid signature(s)");if(t.signatures&&!h(t.signatures,c.signatures))throw new TypeError("Signature mismatch");if(void 0!==t.m&&t.m!==t.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(c,t)}},8536:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(419),i=r(3016),o=r(8535),s=r(9031),a=i.OPS,u=r(701);e.p2pk=function(t,e){if(!(t.input||t.output||t.pubkey||t.input||t.signature))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),s({network:s.maybe(s.Object),output:s.maybe(s.Buffer),pubkey:s.maybe(u.isPoint),signature:s.maybe(i.isCanonicalScriptSignature),input:s.maybe(s.Buffer)},t);const r=o.value((()=>i.decompile(t.input))),f={name:"p2pk",network:t.network||n.bitcoin};if(o.prop(f,"output",(()=>{if(t.pubkey)return i.compile([t.pubkey,a.OP_CHECKSIG])})),o.prop(f,"pubkey",(()=>{if(t.output)return t.output.slice(1,-1)})),o.prop(f,"signature",(()=>{if(t.input)return r()[0]})),o.prop(f,"input",(()=>{if(t.signature)return i.compile([t.signature])})),o.prop(f,"witness",(()=>{if(f.input)return[]})),e.validate){if(t.output){if(t.output[t.output.length-1]!==a.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!u.isPoint(f.pubkey))throw new TypeError("Output pubkey is invalid");if(t.pubkey&&!t.pubkey.equals(f.pubkey))throw new TypeError("Pubkey mismatch")}if(t.signature&&t.input&&!t.input.equals(f.input))throw new TypeError("Signature mismatch");if(t.input){if(1!==r().length)throw new TypeError("Input is invalid");if(!i.isCanonicalScriptSignature(f.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(f,t)}},4696:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(2572),o=r(419),s=r(3016),a=r(8535),u=r(9031),f=s.OPS,h=r(701),c=r(4075);e.p2pkh=function(t,e){if(!(t.address||t.hash||t.output||t.pubkey||t.input))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),u({network:u.maybe(u.Object),address:u.maybe(u.String),hash:u.maybe(u.BufferN(20)),output:u.maybe(u.BufferN(25)),pubkey:u.maybe(h.isPoint),signature:u.maybe(s.isCanonicalScriptSignature),input:u.maybe(u.Buffer)},t);const r=a.value((()=>{const e=c.decode(t.address);return{version:e.readUInt8(0),hash:e.slice(1)}})),l=a.value((()=>s.decompile(t.input))),d=t.network||o.bitcoin,p={name:"p2pkh",network:d};if(a.prop(p,"address",(()=>{if(!p.hash)return;const t=n.allocUnsafe(21);return t.writeUInt8(d.pubKeyHash,0),p.hash.copy(t,1),c.encode(t)})),a.prop(p,"hash",(()=>t.output?t.output.slice(3,23):t.address?r().hash:t.pubkey||p.pubkey?i.hash160(t.pubkey||p.pubkey):void 0)),a.prop(p,"output",(()=>{if(p.hash)return s.compile([f.OP_DUP,f.OP_HASH160,p.hash,f.OP_EQUALVERIFY,f.OP_CHECKSIG])})),a.prop(p,"pubkey",(()=>{if(t.input)return l()[1]})),a.prop(p,"signature",(()=>{if(t.input)return l()[0]})),a.prop(p,"input",(()=>{if(t.pubkey&&t.signature)return s.compile([t.signature,t.pubkey])})),a.prop(p,"witness",(()=>{if(p.input)return[]})),e.validate){let e=n.from([]);if(t.address){if(r().version!==d.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==r().hash.length)throw new TypeError("Invalid address");e=r().hash}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(25!==t.output.length||t.output[0]!==f.OP_DUP||t.output[1]!==f.OP_HASH160||20!==t.output[2]||t.output[23]!==f.OP_EQUALVERIFY||t.output[24]!==f.OP_CHECKSIG)throw new TypeError("Output is invalid");const r=t.output.slice(3,23);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.pubkey){const r=i.hash160(t.pubkey);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.input){const r=l();if(2!==r.length)throw new TypeError("Input is invalid");if(!s.isCanonicalScriptSignature(r[0]))throw new TypeError("Input has invalid signature");if(!h.isPoint(r[1]))throw new TypeError("Input has invalid pubkey");if(t.signature&&!t.signature.equals(r[0]))throw new TypeError("Signature mismatch");if(t.pubkey&&!t.pubkey.equals(r[1]))throw new TypeError("Pubkey mismatch");const n=i.hash160(r[1]);if(e.length>0&&!e.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(p,t)}},743:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(2572),o=r(419),s=r(3016),a=r(8535),u=r(9031),f=s.OPS,h=r(4075);e.p2sh=function(t,e){if(!(t.address||t.hash||t.output||t.redeem||t.input))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),u({network:u.maybe(u.Object),address:u.maybe(u.String),hash:u.maybe(u.BufferN(20)),output:u.maybe(u.BufferN(23)),redeem:u.maybe({network:u.maybe(u.Object),output:u.maybe(u.Buffer),input:u.maybe(u.Buffer),witness:u.maybe(u.arrayOf(u.Buffer))}),input:u.maybe(u.Buffer),witness:u.maybe(u.arrayOf(u.Buffer))},t);let r=t.network;r||(r=t.redeem&&t.redeem.network||o.bitcoin);const c={network:r},l=a.value((()=>{const e=h.decode(t.address);return{version:e.readUInt8(0),hash:e.slice(1)}})),d=a.value((()=>s.decompile(t.input))),p=a.value((()=>{const e=d();return{network:r,output:e[e.length-1],input:s.compile(e.slice(0,-1)),witness:t.witness||[]}}));if(a.prop(c,"address",(()=>{if(!c.hash)return;const t=n.allocUnsafe(21);return t.writeUInt8(c.network.scriptHash,0),c.hash.copy(t,1),h.encode(t)})),a.prop(c,"hash",(()=>t.output?t.output.slice(2,22):t.address?l().hash:c.redeem&&c.redeem.output?i.hash160(c.redeem.output):void 0)),a.prop(c,"output",(()=>{if(c.hash)return s.compile([f.OP_HASH160,c.hash,f.OP_EQUAL])})),a.prop(c,"redeem",(()=>{if(t.input)return p()})),a.prop(c,"input",(()=>{if(t.redeem&&t.redeem.input&&t.redeem.output)return s.compile([].concat(s.decompile(t.redeem.input),t.redeem.output))})),a.prop(c,"witness",(()=>c.redeem&&c.redeem.witness?c.redeem.witness:c.input?[]:void 0)),a.prop(c,"name",(()=>{const t=["p2sh"];return void 0!==c.redeem&&t.push(c.redeem.name),t.join("-")})),e.validate){let e=n.from([]);if(t.address){if(l().version!==r.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==l().hash.length)throw new TypeError("Invalid address");e=l().hash}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(23!==t.output.length||t.output[0]!==f.OP_HASH160||20!==t.output[1]||t.output[22]!==f.OP_EQUAL)throw new TypeError("Output is invalid");const r=t.output.slice(2,22);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}const o=t=>{if(t.output){const r=s.decompile(t.output);if(!r||r.length<1)throw new TypeError("Redeem.output too short");const n=i.hash160(t.output);if(e.length>0&&!e.equals(n))throw new TypeError("Hash mismatch");e=n}if(t.input){const e=t.input.length>0,r=t.witness&&t.witness.length>0;if(!e&&!r)throw new TypeError("Empty input");if(e&&r)throw new TypeError("Input and witness provided");if(e){const e=s.decompile(t.input);if(!s.isPushOnly(e))throw new TypeError("Non push-only scriptSig")}}};if(t.input){const t=d();if(!t||t.length<1)throw new TypeError("Input too short");if(!n.isBuffer(p().output))throw new TypeError("Input is invalid");o(p())}if(t.redeem){if(t.redeem.network&&t.redeem.network!==r)throw new TypeError("Network mismatch");if(t.input){const e=p();if(t.redeem.output&&!t.redeem.output.equals(e.output))throw new TypeError("Redeem.output mismatch");if(t.redeem.input&&!t.redeem.input.equals(e.input))throw new TypeError("Redeem.input mismatch")}o(t.redeem)}if(t.witness&&t.redeem&&t.redeem.witness&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.redeem.witness,t.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(c,t)}},16:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(2572),o=r(419),s=r(3016),a=r(8535),u=r(9031),f=s.OPS,h=r(701),c=r(1273),l=n.alloc(0);e.p2wpkh=function(t,e){if(!(t.address||t.hash||t.output||t.pubkey||t.witness))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),u({address:u.maybe(u.String),hash:u.maybe(u.BufferN(20)),input:u.maybe(u.BufferN(0)),network:u.maybe(u.Object),output:u.maybe(u.BufferN(22)),pubkey:u.maybe(h.isPoint),signature:u.maybe(s.isCanonicalScriptSignature),witness:u.maybe(u.arrayOf(u.Buffer))},t);const r=a.value((()=>{const e=c.decode(t.address),r=e.words.shift(),i=c.fromWords(e.words);return{version:r,prefix:e.prefix,data:n.from(i)}})),d=t.network||o.bitcoin,p={name:"p2wpkh",network:d};if(a.prop(p,"address",(()=>{if(!p.hash)return;const t=c.toWords(p.hash);return t.unshift(0),c.encode(d.bech32,t)})),a.prop(p,"hash",(()=>t.output?t.output.slice(2,22):t.address?r().data:t.pubkey||p.pubkey?i.hash160(t.pubkey||p.pubkey):void 0)),a.prop(p,"output",(()=>{if(p.hash)return s.compile([f.OP_0,p.hash])})),a.prop(p,"pubkey",(()=>t.pubkey?t.pubkey:t.witness?t.witness[1]:void 0)),a.prop(p,"signature",(()=>{if(t.witness)return t.witness[0]})),a.prop(p,"input",(()=>{if(p.witness)return l})),a.prop(p,"witness",(()=>{if(t.pubkey&&t.signature)return[t.signature,t.pubkey]})),e.validate){let e=n.from([]);if(t.address){if(d&&d.bech32!==r().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw new TypeError("Invalid address version");if(20!==r().data.length)throw new TypeError("Invalid address data");e=r().data}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(22!==t.output.length||t.output[0]!==f.OP_0||20!==t.output[1])throw new TypeError("Output is invalid");if(e.length>0&&!e.equals(t.output.slice(2)))throw new TypeError("Hash mismatch");e=t.output.slice(2)}if(t.pubkey){const r=i.hash160(t.pubkey);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");if(e=r,!h.isPoint(t.pubkey)||33!==t.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(t.witness){if(2!==t.witness.length)throw new TypeError("Witness is invalid");if(!s.isCanonicalScriptSignature(t.witness[0]))throw new TypeError("Witness has invalid signature");if(!h.isPoint(t.witness[1])||33!==t.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(t.signature&&!t.signature.equals(t.witness[0]))throw new TypeError("Signature mismatch");if(t.pubkey&&!t.pubkey.equals(t.witness[1]))throw new TypeError("Pubkey mismatch");const r=i.hash160(t.witness[1]);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch")}}return Object.assign(p,t)}},5732:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(2572),o=r(419),s=r(3016),a=r(8535),u=r(9031),f=s.OPS,h=r(701),c=r(1273),l=n.alloc(0);function d(t){return!(!n.isBuffer(t)||65!==t.length||4!==t[0]||!h.isPoint(t))}e.p2wsh=function(t,e){if(!(t.address||t.hash||t.output||t.redeem||t.witness))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),u({network:u.maybe(u.Object),address:u.maybe(u.String),hash:u.maybe(u.BufferN(32)),output:u.maybe(u.BufferN(34)),redeem:u.maybe({input:u.maybe(u.Buffer),network:u.maybe(u.Object),output:u.maybe(u.Buffer),witness:u.maybe(u.arrayOf(u.Buffer))}),input:u.maybe(u.BufferN(0)),witness:u.maybe(u.arrayOf(u.Buffer))},t);const r=a.value((()=>{const e=c.decode(t.address),r=e.words.shift(),i=c.fromWords(e.words);return{version:r,prefix:e.prefix,data:n.from(i)}})),h=a.value((()=>s.decompile(t.redeem.input)));let p=t.network;p||(p=t.redeem&&t.redeem.network||o.bitcoin);const y={network:p};if(a.prop(y,"address",(()=>{if(!y.hash)return;const t=c.toWords(y.hash);return t.unshift(0),c.encode(p.bech32,t)})),a.prop(y,"hash",(()=>t.output?t.output.slice(2):t.address?r().data:y.redeem&&y.redeem.output?i.sha256(y.redeem.output):void 0)),a.prop(y,"output",(()=>{if(y.hash)return s.compile([f.OP_0,y.hash])})),a.prop(y,"redeem",(()=>{if(t.witness)return{output:t.witness[t.witness.length-1],input:l,witness:t.witness.slice(0,-1)}})),a.prop(y,"input",(()=>{if(y.witness)return l})),a.prop(y,"witness",(()=>{if(t.redeem&&t.redeem.input&&t.redeem.input.length>0&&t.redeem.output&&t.redeem.output.length>0){const e=s.toStack(h());return y.redeem=Object.assign({witness:e},t.redeem),y.redeem.input=l,[].concat(e,t.redeem.output)}if(t.redeem&&t.redeem.output&&t.redeem.witness)return[].concat(t.redeem.witness,t.redeem.output)})),a.prop(y,"name",(()=>{const t=["p2wsh"];return void 0!==y.redeem&&t.push(y.redeem.name),t.join("-")})),e.validate){let e=n.from([]);if(t.address){if(r().prefix!==p.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw new TypeError("Invalid address version");if(32!==r().data.length)throw new TypeError("Invalid address data");e=r().data}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(34!==t.output.length||t.output[0]!==f.OP_0||32!==t.output[1])throw new TypeError("Output is invalid");const r=t.output.slice(2);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.redeem){if(t.redeem.network&&t.redeem.network!==p)throw new TypeError("Network mismatch");if(t.redeem.input&&t.redeem.input.length>0&&t.redeem.witness&&t.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(t.redeem.output){if(0===s.decompile(t.redeem.output).length)throw new TypeError("Redeem.output is invalid");const r=i.sha256(t.redeem.output);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.redeem.input&&!s.isPushOnly(h()))throw new TypeError("Non push-only scriptSig");if(t.witness&&t.redeem.witness&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.witness,t.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(t.redeem.input&&h().some(d)||t.redeem.output&&(s.decompile(t.redeem.output)||[]).some(d))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(t.witness&&t.witness.length>0){const e=t.witness[t.witness.length-1];if(t.redeem&&t.redeem.output&&!t.redeem.output.equals(e))throw new TypeError("Witness and redeem.output mismatch");if(t.witness.some(d)||(s.decompile(e)||[]).some(d))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(y,t)}},9468:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8174),o=r(9214),s=r(5639),a=r(9168),u=r(9359),f=r(2572),h=r(8893),c=r(419),l=r(6469),d=r(3016),p=r(4457),y={network:c.bitcoin,maximumFeeRate:5e3};class m{constructor(t={},e=new i.Psbt(new b)){this.data=e,this.opts=Object.assign({},y,t),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},0===this.data.inputs.length&&this.setVersion(2);const r=(t,e,r,n)=>Object.defineProperty(t,e,{enumerable:r,writable:n});r(this,"__CACHE",!1,!0),r(this,"opts",!1,!0)}static fromBase64(t,e={}){const r=n.from(t,"base64");return this.fromBuffer(r,e)}static fromHex(t,e={}){const r=n.from(t,"hex");return this.fromBuffer(r,e)}static fromBuffer(t,e={}){const r=i.Psbt.fromBuffer(t,g),n=new m(e,r);var o,s;return o=n.__CACHE.__TX,s=n.__CACHE,o.ins.forEach((t=>{N(s,t)})),n}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(t){this.setVersion(t)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(t){this.setLocktime(t)}get txInputs(){return this.__CACHE.__TX.ins.map((t=>({hash:u.cloneBuffer(t.hash),index:t.index,sequence:t.sequence})))}get txOutputs(){return this.__CACHE.__TX.outs.map((t=>{let e;try{e=a.fromOutputScript(t.script,this.opts.network)}catch(t){}return{script:u.cloneBuffer(t.script),value:t.value,address:e}}))}combine(...t){return this.data.combine(...t.map((t=>t.data))),this}clone(){const t=m.fromBuffer(this.data.toBuffer());return t.opts=JSON.parse(JSON.stringify(this.opts)),t}setMaximumFeeRate(t){x(t),this.opts.maximumFeeRate=t}setVersion(t){x(t),P(this.data.inputs,"setVersion");const e=this.__CACHE;return e.__TX.version=t,e.__EXTRACTED_TX=void 0,this}setLocktime(t){x(t),P(this.data.inputs,"setLocktime");const e=this.__CACHE;return e.__TX.locktime=t,e.__EXTRACTED_TX=void 0,this}setInputSequence(t,e){x(e),P(this.data.inputs,"setInputSequence");const r=this.__CACHE;if(r.__TX.ins.length<=t)throw new Error("Input index too high");return r.__TX.ins[t].sequence=e,r.__EXTRACTED_TX=void 0,this}addInputs(t){return t.forEach((t=>this.addInput(t))),this}addInput(t){if(arguments.length>1||!t||void 0===t.hash||void 0===t.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");P(this.data.inputs,"addInput"),t.witnessScript&&X(t.witnessScript);const e=this.__CACHE;this.data.addInput(t),N(e,e.__TX.ins[e.__TX.ins.length-1]);const r=this.data.inputs.length-1,n=this.data.inputs[r];return n.nonWitnessUtxo&&z(this.__CACHE,n,r),e.__FEE=void 0,e.__FEE_RATE=void 0,e.__EXTRACTED_TX=void 0,this}addOutputs(t){return t.forEach((t=>this.addOutput(t))),this}addOutput(t){if(arguments.length>1||!t||void 0===t.value||void 0===t.address&&void 0===t.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");P(this.data.inputs,"addOutput");const{address:e}=t;if("string"==typeof e){const{network:r}=this.opts,n=a.toOutputScript(e,r);t=Object.assign(t,{script:n})}const r=this.__CACHE;return this.data.addOutput(t),r.__FEE=void 0,r.__FEE_RATE=void 0,r.__EXTRACTED_TX=void 0,this}extractTransaction(t){if(!this.data.inputs.every(_))throw new Error("Not finalized");const e=this.__CACHE;if(t||function(t,e,r){const n=e.__FEE_RATE||t.getFeeRate(),i=e.__EXTRACTED_TX.virtualSize(),o=n*i;if(n>=r.maximumFeeRate)throw new Error(`Warning: You are paying around ${(o/1e8).toFixed(8)} in fees, which is ${n} satoshi per byte for a transaction with a VSize of ${i} bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.`)}(this,e,this.opts),e.__EXTRACTED_TX)return e.__EXTRACTED_TX;const r=e.__TX.clone();return $(this.data.inputs,r,e,!0),r}getFeeRate(){return C("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return C("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return s.checkForInput(this.data.inputs,0),Y(this.data.inputs.length).forEach((t=>this.finalizeInput(t))),this}finalizeInput(t,e=j){const r=s.checkForInput(this.data.inputs,t),{script:n,isP2SH:i,isP2WSH:o,isSegwit:a}=function(t,e,r){const n=r.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!e.redeemScript,i.isP2WSH=!!e.witnessScript,e.witnessScript)i.script=e.witnessScript;else if(e.redeemScript)i.script=e.redeemScript;else if(e.nonWitnessUtxo){const o=K(r,e,t),s=n.ins[t].index;i.script=o.outs[s].script}else e.witnessUtxo&&(i.script=e.witnessUtxo.script);return(e.witnessScript||A(i.script))&&(i.isSegwit=!0),i}(t,r,this.__CACHE);if(!n)throw new Error(`No script found for input #${t}`);!function(t){if(!t.sighashType||!t.partialSig)return;const{partialSig:e,sighashType:r}=t;e.forEach((t=>{const{hashType:e}=d.signature.decode(t.signature);if(r!==e)throw new Error("Signature sighash does not match input sighash type")}))}(r);const{finalScriptSig:u,finalScriptWitness:f}=e(t,r,n,a,i,o);if(u&&this.data.updateInput(t,{finalScriptSig:u}),f&&this.data.updateInput(t,{finalScriptWitness:f}),!u&&!f)throw new Error(`Unknown error finalizing input #${t}`);return this.data.clearFinalizedInput(t),this}getInputType(t){const e=s.checkForInput(this.data.inputs,t),r=G(W(t,e,this.__CACHE),t,"input",e.redeemScript||function(t){if(!t)return;const e=d.decompile(t);if(!e)return;const r=e[e.length-1];var i;if(n.isBuffer(r)&&!V(r)&&(i=r,!d.isCanonicalScriptSignature(i))&&d.decompile(r))return r}(e.finalScriptSig),e.witnessScript||function(t){if(!t)return;const e=q(t),r=e[e.length-1];return!V(r)&&d.decompile(r)?r:void 0}(e.finalScriptWitness));return("raw"===r.type?"":r.type+"-")+Z(r.meaningfulScript)}inputHasPubkey(t,e){return function(t,e,r,n){const i=W(r,e,n),{meaningfulScript:o}=G(i,r,"input",e.redeemScript,e.witnessScript);return J(t,o)}(e,s.checkForInput(this.data.inputs,t),t,this.__CACHE)}inputHasHDKey(t,e){const r=s.checkForInput(this.data.inputs,t),n=T(e);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}outputHasPubkey(t,e){return function(t,e,r,n){const i=n.__TX.outs[r].script,{meaningfulScript:o}=G(i,r,"output",e.redeemScript,e.witnessScript);return J(t,o)}(e,s.checkForOutput(this.data.outputs,t),t,this.__CACHE)}outputHasHDKey(t,e){const r=s.checkForOutput(this.data.outputs,t),n=T(e);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}validateSignaturesOfAllInputs(){return s.checkForInput(this.data.inputs,0),Y(this.data.inputs.length).map((t=>this.validateSignaturesOfInput(t))).reduce(((t,e)=>!0===e&&t),!0)}validateSignaturesOfInput(t,e){const r=this.data.inputs[t],n=(r||{}).partialSig;if(!r||!n||n.length<1)throw new Error("No signatures to validate");const i=e?n.filter((t=>t.pubkey.equals(e))):n;if(i.length<1)throw new Error("No signatures for this pubkey");const o=[];let s,a,u;for(const e of i){const n=d.signature.decode(e.signature),{hash:i,script:f}=u!==n.hashType?H(t,Object.assign({},r,{sighashType:n.hashType}),this.__CACHE,!0):{hash:s,script:a};u=n.hashType,s=i,a=f,B(e.pubkey,f,"verify");const c=h.fromPublicKey(e.pubkey);o.push(c.verify(i,n.signature))}return o.every((t=>!0===t))}signAllInputsHD(t,e=[p.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");const r=[];for(const n of Y(this.data.inputs.length))try{this.signInputHD(n,t,e),r.push(!0)}catch(t){r.push(!1)}if(r.every((t=>!1===t)))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(t,e=[p.Transaction.SIGHASH_ALL]){return new Promise(((r,n)=>{if(!t||!t.publicKey||!t.fingerprint)return n(new Error("Need HDSigner to sign input"));const i=[],o=[];for(const r of Y(this.data.inputs.length))o.push(this.signInputHDAsync(r,t,e).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((t=>!1===t)))return n(new Error("No inputs were signed"));r()}))}))}signInputHD(t,e,r=[p.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");return D(t,this.data.inputs,e).forEach((e=>this.signInput(t,e,r))),this}signInputHDAsync(t,e,r=[p.Transaction.SIGHASH_ALL]){return new Promise(((n,i)=>{if(!e||!e.publicKey||!e.fingerprint)return i(new Error("Need HDSigner to sign input"));const o=D(t,this.data.inputs,e).map((e=>this.signInputAsync(t,e,r)));return Promise.all(o).then((()=>{n()})).catch(i)}))}signAllInputs(t,e=[p.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const r=[];for(const n of Y(this.data.inputs.length))try{this.signInput(n,t,e),r.push(!0)}catch(t){r.push(!1)}if(r.every((t=>!1===t)))throw new Error("No inputs were signed");return this}signAllInputsAsync(t,e=[p.Transaction.SIGHASH_ALL]){return new Promise(((r,n)=>{if(!t||!t.publicKey)return n(new Error("Need Signer to sign input"));const i=[],o=[];for(const[r]of this.data.inputs.entries())o.push(this.signInputAsync(r,t,e).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((t=>!1===t)))return n(new Error("No inputs were signed"));r()}))}))}signInput(t,e,r=[p.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const{hash:n,sighashType:i}=F(this.data.inputs,t,e.publicKey,this.__CACHE,r),o=[{pubkey:e.publicKey,signature:d.signature.encode(e.sign(n),i)}];return this.data.updateInput(t,{partialSig:o}),this}signInputAsync(t,e,r=[p.Transaction.SIGHASH_ALL]){return Promise.resolve().then((()=>{if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const{hash:n,sighashType:i}=F(this.data.inputs,t,e.publicKey,this.__CACHE,r);return Promise.resolve(e.sign(n)).then((r=>{const n=[{pubkey:e.publicKey,signature:d.signature.encode(r,i)}];this.data.updateInput(t,{partialSig:n})}))}))}toBuffer(){return v(this.__CACHE),this.data.toBuffer()}toHex(){return v(this.__CACHE),this.data.toHex()}toBase64(){return v(this.__CACHE),this.data.toBase64()}updateGlobal(t){return this.data.updateGlobal(t),this}updateInput(t,e){return e.witnessScript&&X(e.witnessScript),this.data.updateInput(t,e),e.nonWitnessUtxo&&z(this.__CACHE,this.data.inputs[t],t),this}updateOutput(t,e){return this.data.updateOutput(t,e),this}addUnknownKeyValToGlobal(t){return this.data.addUnknownKeyValToGlobal(t),this}addUnknownKeyValToInput(t,e){return this.data.addUnknownKeyValToInput(t,e),this}addUnknownKeyValToOutput(t,e){return this.data.addUnknownKeyValToOutput(t,e),this}clearFinalizedInput(t){return this.data.clearFinalizedInput(t),this}}e.Psbt=m;const g=t=>new b(t);class b{constructor(t=n.from([2,0,0,0,0,0,0,0,0,0])){this.tx=p.Transaction.fromBuffer(t),function(t){if(!t.ins.every((t=>t.script&&0===t.script.length&&t.witness&&0===t.witness.length)))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(t){if(void 0===t.hash||void 0===t.index||!n.isBuffer(t.hash)&&"string"!=typeof t.hash||"number"!=typeof t.index)throw new Error("Error adding input.");const e="string"==typeof t.hash?u.reverseBuffer(n.from(t.hash,"hex")):t.hash;this.tx.addInput(e,t.index,t.sequence)}addOutput(t){if(void 0===t.script||void 0===t.value||!n.isBuffer(t.script)||"number"!=typeof t.value)throw new Error("Error adding output.");this.tx.addOutput(t.script,t.value)}toBuffer(){return this.tx.toBuffer()}}function v(t){if(!1!==t.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function w(t,e,r){if(!e)return!1;let n;if(n=r?r.map((t=>{const r=h.fromPublicKey(t,{compressed:!0}).publicKey;return e.find((t=>t.pubkey.equals(r)))})).filter((t=>!!t)):e,n.length>t)throw new Error("Too many signatures");return n.length===t}function _(t){return!!t.finalScriptSig||!!t.finalScriptWitness}function S(t){return e=>{try{return t({output:e}),!0}catch(t){return!1}}}const E=S(l.p2ms),M=S(l.p2pk),k=S(l.p2pkh),A=S(l.p2wpkh),O=S(l.p2wsh),I=S(l.p2sh);function T(t){return e=>!!e.masterFingerprint.equals(t.fingerprint)&&!!t.derivePath(e.path).publicKey.equals(e.pubkey)}function x(t){if("number"!=typeof t||t!==Math.floor(t)||t>4294967295||t<0)throw new Error("Invalid 32 bit integer")}function P(t,e){t.forEach((t=>{let r=!1,i=[];if(0===(t.partialSig||[]).length){if(!t.finalScriptSig&&!t.finalScriptWitness)return;i=function(t){const e=t.finalScriptSig&&d.decompile(t.finalScriptSig)||[],r=t.finalScriptWitness&&d.decompile(t.finalScriptWitness)||[];return e.concat(r).filter((t=>n.isBuffer(t)&&d.isCanonicalScriptSignature(t))).map((t=>({signature:t})))}(t)}else i=t.partialSig;if(i.forEach((t=>{const{hashType:n}=d.signature.decode(t.signature),i=[];switch(n&p.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&n){case p.Transaction.SIGHASH_ALL:break;case p.Transaction.SIGHASH_SINGLE:case p.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}-1===i.indexOf(e)&&(r=!0)})),r)throw new Error("Can not modify transaction, signatures exist.")}))}function B(t,e,r){if(!J(t,e))throw new Error(`Can not ${r} for this input with the key ${t.toString("hex")}`)}function N(t,e){const r=u.reverseBuffer(n.from(e.hash)).toString("hex")+":"+e.index;if(t.__TX_IN_CACHE[r])throw new Error("Duplicate input detected.");t.__TX_IN_CACHE[r]=1}function U(t,e){return(r,n,i,o)=>{const s=t({redeem:{output:i}}).output;if(!n.equals(s))throw new Error(`${e} for ${o} #${r} doesn't match the scriptPubKey in the prevout`)}}const R=U(l.p2sh,"Redeem script"),L=U(l.p2wsh,"Witness script");function C(t,e,r,n){if(!r.every(_))throw new Error(`PSBT must be finalized to calculate ${e}`);if("__FEE_RATE"===t&&n.__FEE_RATE)return n.__FEE_RATE;if("__FEE"===t&&n.__FEE)return n.__FEE;let i,o=!0;return n.__EXTRACTED_TX?(i=n.__EXTRACTED_TX,o=!1):i=n.__TX.clone(),$(r,i,n,o),"__FEE_RATE"===t?n.__FEE_RATE:"__FEE"===t?n.__FEE:void 0}function j(t,e,r,i,s,a){const u=Z(r);if(!function(t,e,r){switch(r){case"pubkey":case"pubkeyhash":case"witnesspubkeyhash":return w(1,t.partialSig);case"multisig":const r=l.p2ms({output:e});return w(r.m,t.partialSig,r.pubkeys);default:return!1}}(e,r,u))throw new Error(`Can not finalize input #${t}`);return function(t,e,r,i,s,a){let u,f;const h=function(t,e,r){let n;switch(e){case"multisig":const e=function(t,e){return l.p2ms({output:t}).pubkeys.map((t=>(e.filter((e=>e.pubkey.equals(t)))[0]||{}).signature)).filter((t=>!!t))}(t,r);n=l.p2ms({output:t,signatures:e});break;case"pubkey":n=l.p2pk({output:t,signature:r[0].signature});break;case"pubkeyhash":n=l.p2pkh({output:t,pubkey:r[0].pubkey,signature:r[0].signature});break;case"witnesspubkeyhash":n=l.p2wpkh({output:t,pubkey:r[0].pubkey,signature:r[0].signature})}return n}(t,e,r),c=a?l.p2wsh({redeem:h}):null,d=s?l.p2sh({redeem:c||h}):null;return i?(f=function(t){let e=n.allocUnsafe(0);function r(t){const r=e.length,i=o.encodingLength(t);e=n.concat([e,n.allocUnsafe(i)]),o.encode(t,e,r)}function i(t){r(t.length),function(t){e=n.concat([e,n.from(t)])}(t)}var s;return r((s=t).length),s.forEach(i),e}(c?c.witness:h.witness),d&&(u=d.input)):u=d?d.input:h.input,{finalScriptSig:u,finalScriptWitness:f}}(r,u,e.partialSig,i,s,a)}function F(t,e,r,n,i){const o=s.checkForInput(t,e),{hash:a,sighashType:u,script:f}=H(e,o,n,!1,i);return B(r,f,"sign"),{hash:a,sighashType:u}}function H(t,e,r,n,i){const o=r.__TX,s=e.sighashType||p.Transaction.SIGHASH_ALL;if(i&&i.indexOf(s)<0){const t=function(t){let e=t&p.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&t){case p.Transaction.SIGHASH_ALL:e+="SIGHASH_ALL";break;case p.Transaction.SIGHASH_SINGLE:e+="SIGHASH_SINGLE";break;case p.Transaction.SIGHASH_NONE:e+="SIGHASH_NONE"}return e}(s);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${t}`)}let a,u;if(e.nonWitnessUtxo){const n=K(r,e,t),i=o.ins[t].hash,s=n.getHash();if(!i.equals(s))throw new Error(`Non-witness UTXO hash for input #${t} doesn't match the hash specified in the prevout`);const a=o.ins[t].index;u=n.outs[a]}else{if(!e.witnessUtxo)throw new Error("Need a Utxo input item for signing");u=e.witnessUtxo}const{meaningfulScript:f,type:h}=G(u.script,t,"input",e.redeemScript,e.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(h)>=0)a=o.hashForWitnessV0(t,f,u.value,s);else if(A(f)){const e=l.p2pkh({hash:f.slice(2)}).output;a=o.hashForWitnessV0(t,e,u.value,s)}else{if(void 0===e.nonWitnessUtxo&&!1===r.__UNSAFE_SIGN_NONSEGWIT)throw new Error(`Input #${t} has witnessUtxo but non-segwit script: ${f.toString("hex")}`);n||!1===r.__UNSAFE_SIGN_NONSEGWIT||console.warn("Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as the old TransactionBuilder class when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant.\n*********************\nPROCEED WITH CAUTION!\n*********************"),a=o.hashForSignature(t,f,s)}return{script:f,sighashType:s,hash:a}}function D(t,e,r){const n=s.checkForInput(e,t);if(!n.bip32Derivation||0===n.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");const i=n.bip32Derivation.map((t=>t.masterFingerprint.equals(r.fingerprint)?t:void 0)).filter((t=>!!t));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");return i.map((t=>{const e=r.derivePath(t.path);if(!t.pubkey.equals(e.publicKey))throw new Error("pubkey did not match bip32Derivation");return e}))}function q(t){let e=0;function r(){const r=o.decode(t,e);return e+=o.decode.bytes,r}return function(){const n=r(),i=[];for(let s=0;s<n;s++)i.push((o=void 0,o=r(),e+=o,t.slice(e-o,e)));var o;return i}()}function z(t,e,r){t.__NON_WITNESS_UTXO_BUF_CACHE[r]=e.nonWitnessUtxo;const n=p.Transaction.fromBuffer(e.nonWitnessUtxo);t.__NON_WITNESS_UTXO_TX_CACHE[r]=n;const i=t,o=r;delete e.nonWitnessUtxo,Object.defineProperty(e,"nonWitnessUtxo",{enumerable:!0,get(){const t=i.__NON_WITNESS_UTXO_BUF_CACHE[o],e=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==t)return t;{const t=e.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=t,t}},set(t){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=t}})}function $(t,e,r,n){let i=0;t.forEach(((t,o)=>{if(n&&t.finalScriptSig&&(e.ins[o].script=t.finalScriptSig),n&&t.finalScriptWitness&&(e.ins[o].witness=q(t.finalScriptWitness)),t.witnessUtxo)i+=t.witnessUtxo.value;else if(t.nonWitnessUtxo){const n=K(r,t,o),s=e.ins[o].index,a=n.outs[s];i+=a.value}}));const o=e.outs.reduce(((t,e)=>t+e.value),0),s=i-o;if(s<0)throw new Error("Outputs are spending more than Inputs");const a=e.virtualSize();r.__FEE=s,r.__EXTRACTED_TX=e,r.__FEE_RATE=Math.floor(s/a)}function K(t,e,r){const n=t.__NON_WITNESS_UTXO_TX_CACHE;return n[r]||z(t,e,r),n[r]}function W(t,e,r){if(void 0!==e.witnessUtxo)return e.witnessUtxo.script;if(void 0!==e.nonWitnessUtxo)return K(r,e,t).outs[r.__TX.ins[t].index].script;throw new Error("Can't find pubkey in input without Utxo data")}function V(t){return 33===t.length&&d.isCanonicalPubKey(t)}function G(t,e,r,n,i){const o=I(t),s=o&&n&&O(n),a=O(t);if(o&&void 0===n)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((a||s)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let u;return s?(u=i,R(e,t,n,r),L(e,n,i,r),X(u)):a?(u=i,L(e,t,i,r),X(u)):o?(u=n,R(e,t,n,r)):u=t,{meaningfulScript:u,type:s?"p2sh-p2wsh":o?"p2sh":a?"p2wsh":"raw"}}function X(t){if(A(t)||I(t))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function J(t,e){const r=f.hash160(t),n=d.decompile(e);if(null===n)throw new Error("Unknown script error");return n.some((e=>"number"!=typeof e&&(e.equals(t)||e.equals(r))))}function Z(t){return A(t)?"witnesspubkeyhash":k(t)?"pubkeyhash":E(t)?"multisig":M(t)?"pubkey":"nonstandard"}function Y(t){return[...Array(t).keys()]}},3016:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(7262),o=r(9394),s=r(6168),a=r(9875),u=r(701),f=r(7131),h=r(9031);e.OPS=r(196);const c=r(7401),l=e.OPS.OP_RESERVED;function d(t){return s.Buffer(t)||function(t){return s.Number(t)&&(t===e.OPS.OP_0||t>=e.OPS.OP_1&&t<=e.OPS.OP_16||t===e.OPS.OP_1NEGATE)}(t)}function p(t){return s.Array(t)&&t.every(d)}function y(t){return 0===t.length?e.OPS.OP_0:1===t.length?t[0]>=1&&t[0]<=16?l+t[0]:129===t[0]?e.OPS.OP_1NEGATE:void 0:void 0}function m(t){return n.isBuffer(t)}function g(t){return n.isBuffer(t)}function b(t){if(m(t))return t;h(s.Array,t);const e=t.reduce(((t,e)=>g(e)?1===e.length&&void 0!==y(e)?t+1:t+f.encodingLength(e.length)+e.length:t+1),0),r=n.allocUnsafe(e);let i=0;if(t.forEach((t=>{if(g(t)){const e=y(t);if(void 0!==e)return r.writeUInt8(e,i),void(i+=1);i+=f.encode(r,t.length,i),t.copy(r,i),i+=t.length}else r.writeUInt8(t,i),i+=1})),i!==r.length)throw new Error("Could not decode chunks");return r}function v(t){if(r=t,s.Array(r))return t;var r;h(s.Buffer,t);const n=[];let i=0;for(;i<t.length;){const r=t[i];if(r>e.OPS.OP_0&&r<=e.OPS.OP_PUSHDATA4){const e=f.decode(t,i);if(null===e)return null;if(i+=e.size,i+e.number>t.length)return null;const r=t.slice(i,i+e.number);i+=e.number;const o=y(r);void 0!==o?n.push(o):n.push(r)}else n.push(r),i+=1}return n}function w(t){const e=-129&t;return e>0&&e<4}e.isPushOnly=p,e.compile=b,e.decompile=v,e.toASM=function(t){return m(t)&&(t=v(t)),t.map((t=>{if(g(t)){const e=y(t);if(void 0===e)return t.toString("hex");t=e}return c[t]})).join(" ")},e.fromASM=function(t){return h(s.String,t),b(t.split(" ").map((t=>void 0!==e.OPS[t]?e.OPS[t]:(h(s.Hex,t),n.from(t,"hex")))))},e.toStack=function(t){return t=v(t),h(p,t),t.map((t=>g(t)?t:t===e.OPS.OP_0?n.allocUnsafe(0):i.encode(t-l)))},e.isCanonicalPubKey=function(t){return u.isPoint(t)},e.isDefinedHashType=w,e.isCanonicalScriptSignature=function(t){return!!n.isBuffer(t)&&!!w(t[t.length-1])&&a.check(t.slice(0,-1))},e.number=i,e.signature=o},7262:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decode=function(t,e,r){e=e||4,r=void 0===r||r;const n=t.length;if(0===n)return 0;if(n>e)throw new TypeError("Script number overflow");if(r&&0==(127&t[n-1])&&(n<=1||0==(128&t[n-2])))throw new Error("Non-minimally encoded script number");if(5===n){const e=t.readUInt32LE(0),r=t.readUInt8(4);return 128&r?-(4294967296*(-129&r)+e):4294967296*r+e}let i=0;for(let e=0;e<n;++e)i|=t[e]<<8*e;return 128&t[n-1]?-(i&~(128<<8*(n-1))):i},e.encode=function(t){let e=Math.abs(t);const r=(i=e)>2147483647?5:i>8388607?4:i>32767?3:i>127?2:i>0?1:0;var i;const o=n.allocUnsafe(r),s=t<0;for(let t=0;t<r;++t)o.writeUInt8(255&e,t),e>>=8;return 128&o[r-1]?o.writeUInt8(s?128:0,r-1):s&&(o[r-1]|=128),o}},9394:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(6168),o=r(9875),s=r(9031),a=n.alloc(1,0);function u(t){let e=0;for(;0===t[e];)++e;return e===t.length?a:128&(t=t.slice(e))[0]?n.concat([a,t],1+t.length):t}function f(t){0===t[0]&&(t=t.slice(1));const e=n.alloc(32,0),r=Math.max(0,32-t.length);return t.copy(e,r),e}e.decode=function(t){const e=t.readUInt8(t.length-1),r=-129&e;if(r<=0||r>=4)throw new Error("Invalid hashType "+e);const i=o.decode(t.slice(0,-1)),s=f(i.r),a=f(i.s);return{signature:n.concat([s,a],64),hashType:e}},e.encode=function(t,e){s({signature:i.BufferN(64),hashType:i.UInt8},{signature:t,hashType:e});const r=-129&e;if(r<=0||r>=4)throw new Error("Invalid hashType "+e);const a=n.allocUnsafe(1);a.writeUInt8(e,0);const f=u(t.slice(0,32)),h=u(t.slice(32,64));return n.concat([o.encode(f,h),a])}},3155:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(5253);e.input=n;const i=r(8731);e.output=i},5253:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016);function o(t){return t===i.OPS.OP_0||n.isCanonicalScriptSignature(t)}function s(t,e){const r=n.decompile(t);return!(r.length<2)&&r[0]===i.OPS.OP_0&&(e?r.slice(1).every(o):r.slice(1).every(n.isCanonicalScriptSignature))}e.check=s,s.toJSON=()=>"multisig input"},8731:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016),o=r(6168),s=i.OPS.OP_RESERVED;function a(t,e){const r=n.decompile(t);if(r.length<4)return!1;if(r[r.length-1]!==i.OPS.OP_CHECKMULTISIG)return!1;if(!o.Number(r[0]))return!1;if(!o.Number(r[r.length-2]))return!1;const a=r[0]-s,u=r[r.length-2]-s;return!(a<=0)&&(!(u>16)&&(!(a>u)&&(u===r.length-3&&(!!e||r.slice(1,-2).every(n.isCanonicalPubKey)))))}e.check=a,a.toJSON=()=>"multi-sig output"},9404:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=n.OPS;function o(t){const e=n.compile(t);return e.length>1&&e[0]===i.OP_RETURN}e.check=o,o.toJSON=()=>"null data output";const s={check:o};e.output=s},9177:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(435);e.input=n;const i=r(9047);e.output=i},435:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016);function i(t){const e=n.decompile(t);return 1===e.length&&n.isCanonicalScriptSignature(e[0])}e.check=i,i.toJSON=()=>"pubKey input"},9047:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016);function o(t){const e=n.decompile(t);return 2===e.length&&n.isCanonicalPubKey(e[0])&&e[1]===i.OPS.OP_CHECKSIG}e.check=o,o.toJSON=()=>"pubKey output"},6858:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1142);e.input=n;const i=r(5448);e.output=i},1142:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016);function i(t){const e=n.decompile(t);return 2===e.length&&n.isCanonicalScriptSignature(e[0])&&n.isCanonicalPubKey(e[1])}e.check=i,i.toJSON=()=>"pubKeyHash input"},5448:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016);function o(t){const e=n.compile(t);return 25===e.length&&e[0]===i.OPS.OP_DUP&&e[1]===i.OPS.OP_HASH160&&20===e[2]&&e[23]===i.OPS.OP_EQUALVERIFY&&e[24]===i.OPS.OP_CHECKSIG}e.check=o,o.toJSON=()=>"pubKeyHash output"},6696:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(8462);e.input=n;const i=r(9387);e.output=i},8462:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(3016),o=r(3155),s=r(9177),a=r(6858),u=r(3805),f=r(6226);function h(t,e){const r=i.decompile(t);if(r.length<1)return!1;const h=r[r.length-1];if(!n.isBuffer(h))return!1;const c=i.decompile(i.compile(r.slice(0,-1))),l=i.decompile(h);return!!l&&!!i.isPushOnly(c)&&(1===r.length?f.check(l)||u.check(l):!(!a.input.check(c)||!a.output.check(l))||!(!o.input.check(c,e)||!o.output.check(l))||!(!s.input.check(c)||!s.output.check(l)))}e.check=h,h.toJSON=()=>"scriptHash input"},9387:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016);function o(t){const e=n.compile(t);return 23===e.length&&e[0]===i.OPS.OP_HASH160&&20===e[1]&&e[22]===i.OPS.OP_EQUAL}e.check=o,o.toJSON=()=>"scriptHash output"},2468:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(2562);e.output=n},2562:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(3016),o=r(3016),s=r(6168),a=r(9031),u=n.from("aa21a9ed","hex");function f(t){const e=i.compile(t);return e.length>37&&e[0]===o.OPS.OP_RETURN&&36===e[1]&&e.slice(2,6).equals(u)}e.check=f,f.toJSON=()=>"Witness commitment output",e.encode=function(t){a(s.Hash256bit,t);const e=n.allocUnsafe(36);return u.copy(e,0),t.copy(e,4),i.compile([o.OPS.OP_RETURN,e])},e.decode=function(t){return a(f,t),i.decompile(t)[1].slice(4,36)}},8387:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1120);e.input=n;const i=r(3805);e.output=i},1120:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016);function i(t){const e=n.decompile(t);return 2===e.length&&n.isCanonicalScriptSignature(e[0])&&(r=e[1],n.isCanonicalPubKey(r)&&33===r.length);var r}e.check=i,i.toJSON=()=>"witnessPubKeyHash input"},3805:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016);function o(t){const e=n.compile(t);return 22===e.length&&e[0]===i.OPS.OP_0&&20===e[1]}e.check=o,o.toJSON=()=>"Witness pubKeyHash output"},8861:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3412);e.input=n;const i=r(6226);e.output=i},3412:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(3016),o=r(9031),s=r(3155),a=r(9177),u=r(6858);function f(t,e){if(o(o.Array,t),t.length<1)return!1;const r=t[t.length-1];if(!n.isBuffer(r))return!1;const f=i.decompile(r);if(!f||0===f.length)return!1;const h=i.compile(t.slice(0,-1));return!(!u.input.check(h)||!u.output.check(f))||!(!s.input.check(h,e)||!s.output.check(f))||!(!a.input.check(h)||!a.output.check(f))}e.check=f,f.toJSON=()=>"witnessScriptHash input"},6226:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016);function o(t){const e=n.compile(t);return 34===e.length&&e[0]===i.OPS.OP_0&&32===e[1]}e.check=o,o.toJSON=()=>"Witness scriptHash output"},4457:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9359),o=r(2572),s=r(3016),a=r(3016),u=r(6168),f=r(9031),h=r(8595);function c(t){const e=t.length;return h.encodingLength(e)+e}const l=n.allocUnsafe(0),d=[],p=n.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),y=n.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),m=n.from("ffffffffffffffff","hex"),g={script:l,valueBuffer:m};class b{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(t,e){const r=new i.BufferReader(t),n=new b;n.version=r.readInt32();const o=r.readUInt8(),s=r.readUInt8();let a=!1;o===b.ADVANCED_TRANSACTION_MARKER&&s===b.ADVANCED_TRANSACTION_FLAG?a=!0:r.offset-=2;const u=r.readVarInt();for(let t=0;t<u;++t)n.ins.push({hash:r.readSlice(32),index:r.readUInt32(),script:r.readVarSlice(),sequence:r.readUInt32(),witness:d});const f=r.readVarInt();for(let t=0;t<f;++t)n.outs.push({value:r.readUInt64(),script:r.readVarSlice()});if(a){for(let t=0;t<u;++t)n.ins[t].witness=r.readVector();if(!n.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(n.locktime=r.readUInt32(),e)return n;if(r.offset!==t.length)throw new Error("Transaction has unexpected data");return n}static fromHex(t){return b.fromBuffer(n.from(t,"hex"),!1)}static isCoinbaseHash(t){f(u.Hash256bit,t);for(let e=0;e<32;++e)if(0!==t[e])return!1;return!0}isCoinbase(){return 1===this.ins.length&&b.isCoinbaseHash(this.ins[0].hash)}addInput(t,e,r,n){return f(u.tuple(u.Hash256bit,u.UInt32,u.maybe(u.UInt32),u.maybe(u.Buffer)),arguments),u.Null(r)&&(r=b.DEFAULT_SEQUENCE),this.ins.push({hash:t,index:e,script:n||l,sequence:r,witness:d})-1}addOutput(t,e){return f(u.tuple(u.Buffer,u.Satoshi),arguments),this.outs.push({script:t,value:e})-1}hasWitnesses(){return this.ins.some((t=>0!==t.witness.length))}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(t=!0){const e=t&&this.hasWitnesses();return(e?10:8)+h.encodingLength(this.ins.length)+h.encodingLength(this.outs.length)+this.ins.reduce(((t,e)=>t+40+c(e.script)),0)+this.outs.reduce(((t,e)=>t+8+c(e.script)),0)+(e?this.ins.reduce(((t,e)=>t+function(t){const e=t.length;return h.encodingLength(e)+t.reduce(((t,e)=>t+c(e)),0)}(e.witness)),0):0)}clone(){const t=new b;return t.version=this.version,t.locktime=this.locktime,t.ins=this.ins.map((t=>({hash:t.hash,index:t.index,script:t.script,sequence:t.sequence,witness:t.witness}))),t.outs=this.outs.map((t=>({script:t.script,value:t.value}))),t}hashForSignature(t,e,r){if(f(u.tuple(u.UInt32,u.Buffer,u.Number),arguments),t>=this.ins.length)return y;const i=s.compile(s.decompile(e).filter((t=>t!==a.OPS.OP_CODESEPARATOR))),h=this.clone();if((31&r)===b.SIGHASH_NONE)h.outs=[],h.ins.forEach(((e,r)=>{r!==t&&(e.sequence=0)}));else if((31&r)===b.SIGHASH_SINGLE){if(t>=this.outs.length)return y;h.outs.length=t+1;for(let e=0;e<t;e++)h.outs[e]=g;h.ins.forEach(((e,r)=>{r!==t&&(e.sequence=0)}))}r&b.SIGHASH_ANYONECANPAY?(h.ins=[h.ins[t]],h.ins[0].script=i):(h.ins.forEach((t=>{t.script=l})),h.ins[t].script=i);const c=n.allocUnsafe(h.byteLength(!1)+4);return c.writeInt32LE(r,c.length-4),h.__toBuffer(c,0,!1),o.hash256(c)}hashForWitnessV0(t,e,r,s){f(u.tuple(u.UInt32,u.Buffer,u.Satoshi,u.UInt32),arguments);let a,h=n.from([]),l=p,d=p,y=p;if(s&b.SIGHASH_ANYONECANPAY||(h=n.allocUnsafe(36*this.ins.length),a=new i.BufferWriter(h,0),this.ins.forEach((t=>{a.writeSlice(t.hash),a.writeUInt32(t.index)})),d=o.hash256(h)),s&b.SIGHASH_ANYONECANPAY||(31&s)===b.SIGHASH_SINGLE||(31&s)===b.SIGHASH_NONE||(h=n.allocUnsafe(4*this.ins.length),a=new i.BufferWriter(h,0),this.ins.forEach((t=>{a.writeUInt32(t.sequence)})),y=o.hash256(h)),(31&s)!==b.SIGHASH_SINGLE&&(31&s)!==b.SIGHASH_NONE){const t=this.outs.reduce(((t,e)=>t+8+c(e.script)),0);h=n.allocUnsafe(t),a=new i.BufferWriter(h,0),this.outs.forEach((t=>{a.writeUInt64(t.value),a.writeVarSlice(t.script)})),l=o.hash256(h)}else if((31&s)===b.SIGHASH_SINGLE&&t<this.outs.length){const e=this.outs[t];h=n.allocUnsafe(8+c(e.script)),a=new i.BufferWriter(h,0),a.writeUInt64(e.value),a.writeVarSlice(e.script),l=o.hash256(h)}h=n.allocUnsafe(156+c(e)),a=new i.BufferWriter(h,0);const m=this.ins[t];return a.writeUInt32(this.version),a.writeSlice(d),a.writeSlice(y),a.writeSlice(m.hash),a.writeUInt32(m.index),a.writeVarSlice(e),a.writeUInt64(r),a.writeUInt32(m.sequence),a.writeSlice(l),a.writeUInt32(this.locktime),a.writeUInt32(s),o.hash256(h)}getHash(t){return t&&this.isCoinbase()?n.alloc(32,0):o.hash256(this.__toBuffer(void 0,void 0,t))}getId(){return i.reverseBuffer(this.getHash(!1)).toString("hex")}toBuffer(t,e){return this.__toBuffer(t,e,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(t,e){f(u.tuple(u.Number,u.Buffer),arguments),this.ins[t].script=e}setWitness(t,e){f(u.tuple(u.Number,[u.Buffer]),arguments),this.ins[t].witness=e}__toBuffer(t,e,r=!1){t||(t=n.allocUnsafe(this.byteLength(r)));const o=new i.BufferWriter(t,e||0);o.writeInt32(this.version);const s=r&&this.hasWitnesses();return s&&(o.writeUInt8(b.ADVANCED_TRANSACTION_MARKER),o.writeUInt8(b.ADVANCED_TRANSACTION_FLAG)),o.writeVarInt(this.ins.length),this.ins.forEach((t=>{o.writeSlice(t.hash),o.writeUInt32(t.index),o.writeVarSlice(t.script),o.writeUInt32(t.sequence)})),o.writeVarInt(this.outs.length),this.outs.forEach((t=>{void 0!==t.value?o.writeUInt64(t.value):o.writeSlice(t.valueBuffer),o.writeVarSlice(t.script)})),s&&this.ins.forEach((t=>{o.writeVector(t.witness)})),o.writeUInt32(this.locktime),void 0!==e?t.slice(e,o.offset):t}}b.DEFAULT_SEQUENCE=4294967295,b.SIGHASH_ALL=1,b.SIGHASH_NONE=2,b.SIGHASH_SINGLE=3,b.SIGHASH_ANYONECANPAY=128,b.ADVANCED_TRANSACTION_MARKER=0,b.ADVANCED_TRANSACTION_FLAG=1,e.Transaction=b},6459:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9168),o=r(9359),s=r(4654),a=r(2572),u=r(8893),f=r(419),h=r(6469),c=r(3016),l=r(3016),d=r(4457),p=r(6168),y=r(9031),m=s.types,g=new Set(["p2pkh","p2pk","p2wpkh","p2ms","p2sh-p2pkh","p2sh-p2pk","p2sh-p2wpkh","p2sh-p2ms","p2wsh-p2pkh","p2wsh-p2pk","p2wsh-p2ms","p2sh-p2wsh-p2pkh","p2sh-p2wsh-p2pk","p2sh-p2wsh-p2ms"]);function b(t,e,r){try{y(t,e)}catch(t){throw new Error(r)}}class v{constructor(t=f.bitcoin,e=2500){this.network=t,this.maximumFeeRate=e,this.__PREV_TX_SET={},this.__INPUTS=[],this.__TX=new d.Transaction,this.__TX.version=2,this.__USE_LOW_R=!1,console.warn("Deprecation Warning: TransactionBuilder will be removed in the future. (v6.x.x or later) Please use the Psbt class instead. Examples of usage are available in the transactions-psbt.js integration test file on our Github. A high level explanation is available in the psbt.ts and psbt.js files as well.")}static fromTransaction(t,e){const r=new v(e);return r.setVersion(t.version),r.setLockTime(t.locktime),t.outs.forEach((t=>{r.addOutput(t.script,t.value)})),t.ins.forEach((t=>{r.__addInputUnsafe(t.hash,t.index,{sequence:t.sequence,script:t.script,witness:t.witness})})),r.__INPUTS.forEach(((e,r)=>{!function(t,e,r){if(t.redeemScriptType!==m.P2MS||!t.redeemScript)return;if(t.pubkeys.length===t.signatures.length)return;const n=t.signatures.concat();t.signatures=t.pubkeys.map((i=>{const o=u.fromPublicKey(i);let s;return n.some(((i,a)=>{if(!i)return!1;const u=c.signature.decode(i),f=e.hashForSignature(r,t.redeemScript,u.hashType);return!!o.verify(f,u.signature)&&(n[a]=void 0,s=i,!0)})),s}))}(e,t,r)})),r}setLowR(t){return y(y.maybe(y.Boolean),t),void 0===t&&(t=!0),this.__USE_LOW_R=t,t}setLockTime(t){if(y(p.UInt32,t),this.__INPUTS.some((t=>!!t.signatures&&t.signatures.some((t=>void 0!==t)))))throw new Error("No, this would invalidate signatures");this.__TX.locktime=t}setVersion(t){y(p.UInt32,t),this.__TX.version=t}addInput(t,e,r,i){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");let s;if("string"==typeof(a=t)||a instanceof String)t=o.reverseBuffer(n.from(t,"hex"));else if(function(t){return t instanceof d.Transaction}(t)){const r=t.outs[e];i=r.script,s=r.value,t=t.getHash(!1)}var a;return this.__addInputUnsafe(t,e,{sequence:r,prevOutScript:i,value:s})}addOutput(t,e){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof t&&(t=i.toOutputScript(t,this.network)),this.__TX.addOutput(t,e)}build(){return this.__build(!1)}buildIncomplete(){return this.__build(!0)}sign(t,e,r,n,i,o){!function({input:t,ourPubKey:e,keyPair:r,signatureHash:n,hashType:i,useLowR:o}){let s=!1;for(const[a,u]of t.pubkeys.entries()){if(!e.equals(u))continue;if(t.signatures[a])throw new Error("Signature already exists");if(33!==e.length&&t.hasWitness)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");const f=r.sign(n,o);t.signatures[a]=c.signature.encode(f,i),s=!0}if(!s)throw new Error("Key pair cannot sign for this input")}(function(t,e,r,n,i,o,s,a,u,f,l){let v;if("number"==typeof i)console.warn("DEPRECATED: TransactionBuilder sign method arguments will change in v6, please use the TxbSignArg interface"),v=i;else{if("object"!=typeof i)throw new TypeError("TransactionBuilder sign first arg must be TxbSignArg or number");!function(t,e){if(!g.has(e.prevOutScriptType))throw new TypeError(`Unknown prevOutScriptType "${e.prevOutScriptType}"`);b(y.Number,e.vin,"sign must include vin parameter as Number (input index)"),b(p.Signer,e.keyPair,"sign must include keyPair parameter as Signer interface"),b(y.maybe(y.Number),e.hashType,"sign hashType parameter must be a number");const r=(t[e.vin]||[]).prevOutType,n=e.prevOutScriptType;switch(n){case"p2pkh":if(r&&"pubkeyhash"!==r)throw new TypeError(`input #${e.vin} is not of type p2pkh: ${r}`);b(y.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),b(y.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),b(y.value(void 0),e.witnessValue,`${n} requires NO witnessValue`);break;case"p2pk":if(r&&"pubkey"!==r)throw new TypeError(`input #${e.vin} is not of type p2pk: ${r}`);b(y.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),b(y.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),b(y.value(void 0),e.witnessValue,`${n} requires NO witnessValue`);break;case"p2wpkh":if(r&&"witnesspubkeyhash"!==r)throw new TypeError(`input #${e.vin} is not of type p2wpkh: ${r}`);b(y.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),b(y.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),b(p.Satoshi,e.witnessValue,`${n} requires witnessValue`);break;case"p2ms":if(r&&"multisig"!==r)throw new TypeError(`input #${e.vin} is not of type p2ms: ${r}`);b(y.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),b(y.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),b(y.value(void 0),e.witnessValue,`${n} requires NO witnessValue`);break;case"p2sh-p2wpkh":if(r&&"scripthash"!==r)throw new TypeError(`input #${e.vin} is not of type p2sh-p2wpkh: ${r}`);b(y.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),b(y.Buffer,e.redeemScript,`${n} requires redeemScript`),b(p.Satoshi,e.witnessValue,`${n} requires witnessValue`);break;case"p2sh-p2ms":case"p2sh-p2pk":case"p2sh-p2pkh":if(r&&"scripthash"!==r)throw new TypeError(`input #${e.vin} is not of type ${n}: ${r}`);b(y.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),b(y.Buffer,e.redeemScript,`${n} requires redeemScript`),b(y.value(void 0),e.witnessValue,`${n} requires NO witnessValue`);break;case"p2wsh-p2ms":case"p2wsh-p2pk":case"p2wsh-p2pkh":if(r&&"witnessscripthash"!==r)throw new TypeError(`input #${e.vin} is not of type ${n}: ${r}`);b(y.Buffer,e.witnessScript,`${n} requires witnessScript`),b(y.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),b(p.Satoshi,e.witnessValue,`${n} requires witnessValue`);break;case"p2sh-p2wsh-p2ms":case"p2sh-p2wsh-p2pk":case"p2sh-p2wsh-p2pkh":if(r&&"scripthash"!==r)throw new TypeError(`input #${e.vin} is not of type ${n}: ${r}`);b(y.Buffer,e.witnessScript,`${n} requires witnessScript`),b(y.Buffer,e.redeemScript,`${n} requires witnessScript`),b(p.Satoshi,e.witnessValue,`${n} requires witnessScript`)}}(e,i),({vin:v,keyPair:o,redeemScript:s,hashType:a,witnessValue:u,witnessScript:f}=i)}if(void 0===o)throw new Error("sign requires keypair");if(o.network&&o.network!==t)throw new TypeError("Inconsistent network");if(!e[v])throw new Error("No input at index: "+v);if(r(a=a||d.Transaction.SIGHASH_ALL))throw new Error("Transaction needs outputs");const w=e[v];if(void 0!==w.redeemScript&&s&&!w.redeemScript.equals(s))throw new Error("Inconsistent redeemScript");const S=o.publicKey||o.getPublicKey&&o.getPublicKey();if(!E(w)){if(void 0!==u){if(void 0!==w.value&&w.value!==u)throw new Error("Input did not match witnessValue");y(p.Satoshi,u),w.value=u}if(!E(w)){const t=function(t,e,r,n){if(r&&n){const i=h.p2wsh({redeem:{output:n}}),o=h.p2wsh({output:r}),s=h.p2sh({redeem:{output:r}}),a=h.p2sh({redeem:i});if(!i.hash.equals(o.hash))throw new Error("Witness script inconsistent with prevOutScript");if(!s.hash.equals(a.hash))throw new Error("Redeem script inconsistent with prevOutScript");const u=_(i.redeem.output,e);if(!u.pubkeys)throw new Error(u.type+" not supported as witnessScript ("+c.toASM(n)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(u.signatures=t.signatures);const f=n;if(u.type===m.P2WPKH)throw new Error("P2SH(P2WSH(P2WPKH)) is a consensus failure");return{redeemScript:r,redeemScriptType:m.P2WSH,witnessScript:n,witnessScriptType:u.type,prevOutType:m.P2SH,prevOutScript:s.output,hasWitness:!0,signScript:f,signType:u.type,pubkeys:u.pubkeys,signatures:u.signatures,maxSignatures:u.maxSignatures}}if(r){const n=h.p2sh({redeem:{output:r}});if(t.prevOutScript){let e;try{e=h.p2sh({output:t.prevOutScript})}catch(t){throw new Error("PrevOutScript must be P2SH")}if(!n.hash.equals(e.hash))throw new Error("Redeem script inconsistent with prevOutScript")}const i=_(n.redeem.output,e);if(!i.pubkeys)throw new Error(i.type+" not supported as redeemScript ("+c.toASM(r)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(i.signatures=t.signatures);let o=r;return i.type===m.P2WPKH&&(o=h.p2pkh({pubkey:i.pubkeys[0]}).output),{redeemScript:r,redeemScriptType:i.type,prevOutType:m.P2SH,prevOutScript:n.output,hasWitness:i.type===m.P2WPKH,signScript:o,signType:i.type,pubkeys:i.pubkeys,signatures:i.signatures,maxSignatures:i.maxSignatures}}if(n){const r=h.p2wsh({redeem:{output:n}});if(t.prevOutScript){const e=h.p2wsh({output:t.prevOutScript});if(!r.hash.equals(e.hash))throw new Error("Witness script inconsistent with prevOutScript")}const i=_(r.redeem.output,e);if(!i.pubkeys)throw new Error(i.type+" not supported as witnessScript ("+c.toASM(n)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(i.signatures=t.signatures);const o=n;if(i.type===m.P2WPKH)throw new Error("P2WSH(P2WPKH) is a consensus failure");return{witnessScript:n,witnessScriptType:i.type,prevOutType:m.P2WSH,prevOutScript:r.output,hasWitness:!0,signScript:o,signType:i.type,pubkeys:i.pubkeys,signatures:i.signatures,maxSignatures:i.maxSignatures}}if(t.prevOutType&&t.prevOutScript){if(t.prevOutType===m.P2SH)throw new Error("PrevOutScript is "+t.prevOutType+", requires redeemScript");if(t.prevOutType===m.P2WSH)throw new Error("PrevOutScript is "+t.prevOutType+", requires witnessScript");if(!t.prevOutScript)throw new Error("PrevOutScript is missing");const r=_(t.prevOutScript,e);if(!r.pubkeys)throw new Error(r.type+" not supported ("+c.toASM(t.prevOutScript)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(r.signatures=t.signatures);let n=t.prevOutScript;return r.type===m.P2WPKH&&(n=h.p2pkh({pubkey:r.pubkeys[0]}).output),{prevOutType:r.type,prevOutScript:t.prevOutScript,hasWitness:r.type===m.P2WPKH,signScript:n,signType:r.type,pubkeys:r.pubkeys,signatures:r.signatures,maxSignatures:r.maxSignatures}}const i=h.p2pkh({pubkey:e}).output;return{prevOutType:m.P2PKH,prevOutScript:i,hasWitness:!1,signScript:i,signType:m.P2PKH,pubkeys:[e],signatures:[void 0]}}(w,S,s,f);Object.assign(w,t)}if(!E(w))throw Error(w.prevOutType+" not supported")}let M;return M=w.hasWitness?n.hashForWitnessV0(v,w.signScript,w.value,a):n.hashForSignature(v,w.signScript,a),{input:w,ourPubKey:S,keyPair:o,signatureHash:M,hashType:a,useLowR:!!l}}(this.network,this.__INPUTS,this.__needsOutputs.bind(this),this.__TX,t,e,r,n,i,o,this.__USE_LOW_R))}__addInputUnsafe(t,e,r){if(d.Transaction.isCoinbaseHash(t))throw new Error("coinbase inputs not supported");const n=t.toString("hex")+":"+e;if(void 0!==this.__PREV_TX_SET[n])throw new Error("Duplicate TxOut: "+n);let i={};if(void 0!==r.script&&(i=w(r.script,r.witness||[])),void 0!==r.value&&(i.value=r.value),!i.prevOutScript&&r.prevOutScript){let t;if(!i.pubkeys&&!i.signatures){const e=_(r.prevOutScript);e.pubkeys&&(i.pubkeys=e.pubkeys,i.signatures=e.signatures),t=e.type}i.prevOutScript=r.prevOutScript,i.prevOutType=t||s.output(r.prevOutScript)}const o=this.__TX.addInput(t,e,r.sequence,r.scriptSig);return this.__INPUTS[o]=i,this.__PREV_TX_SET[n]=!0,o}__build(t){if(!t){if(!this.__TX.ins.length)throw new Error("Transaction has no inputs");if(!this.__TX.outs.length)throw new Error("Transaction has no outputs")}const e=this.__TX.clone();if(this.__INPUTS.forEach(((r,n)=>{if(!r.prevOutType&&!t)throw new Error("Transaction is not complete");const i=S(r.prevOutType,r,t);if(i)e.setInputScript(n,i.input),e.setWitness(n,i.witness);else{if(!t&&r.prevOutType===m.NONSTANDARD)throw new Error("Unknown input type");if(!t)throw new Error("Not enough information")}})),!t&&this.__overMaximumFees(e.virtualSize()))throw new Error("Transaction has absurd fees");return e}__canModifyInputs(){return this.__INPUTS.every((t=>!t.signatures||t.signatures.every((t=>!t||0!=(M(t)&d.Transaction.SIGHASH_ANYONECANPAY)))))}__needsOutputs(t){return t===d.Transaction.SIGHASH_ALL?0===this.__TX.outs.length:0===this.__TX.outs.length&&this.__INPUTS.some((t=>!!t.signatures&&t.signatures.some((t=>!!t&&!(M(t)&d.Transaction.SIGHASH_NONE)))))}__canModifyOutputs(){const t=this.__TX.ins.length,e=this.__TX.outs.length;return this.__INPUTS.every((r=>void 0===r.signatures||r.signatures.every((r=>{if(!r)return!0;const n=31&M(r);return n===d.Transaction.SIGHASH_NONE||n===d.Transaction.SIGHASH_SINGLE&&t<=e}))))}__overMaximumFees(t){return(this.__INPUTS.reduce(((t,e)=>t+(e.value>>>0)),0)-this.__TX.outs.reduce(((t,e)=>t+e.value),0))/t>this.maximumFeeRate}}function w(t,e,r,n){if(0===t.length&&0===e.length)return{};if(!r){let n=s.input(t,!0),i=s.witness(e,!0);n===m.NONSTANDARD&&(n=void 0),i===m.NONSTANDARD&&(i=void 0),r=n||i}switch(r){case m.P2WPKH:{const{output:t,pubkey:r,signature:n}=h.p2wpkh({witness:e});return{prevOutScript:t,prevOutType:m.P2WPKH,pubkeys:[r],signatures:[n]}}case m.P2PKH:{const{output:e,pubkey:r,signature:n}=h.p2pkh({input:t});return{prevOutScript:e,prevOutType:m.P2PKH,pubkeys:[r],signatures:[n]}}case m.P2PK:{const{signature:e}=h.p2pk({input:t});return{prevOutType:m.P2PK,pubkeys:[void 0],signatures:[e]}}case m.P2MS:{const{m:e,pubkeys:r,signatures:i}=h.p2ms({input:t,output:n},{allowIncomplete:!0});return{prevOutType:m.P2MS,pubkeys:r,signatures:i,maxSignatures:e}}}if(r===m.P2SH){const{output:r,redeem:n}=h.p2sh({input:t,witness:e}),i=s.output(n.output),o=w(n.input,n.witness,i,n.output);return o.prevOutType?{prevOutScript:r,prevOutType:m.P2SH,redeemScript:n.output,redeemScriptType:o.prevOutType,witnessScript:o.witnessScript,witnessScriptType:o.witnessScriptType,pubkeys:o.pubkeys,signatures:o.signatures}:{}}if(r===m.P2WSH){const{output:r,redeem:n}=h.p2wsh({input:t,witness:e}),i=s.output(n.output);let o;return o=i===m.P2WPKH?w(n.input,n.witness,i):w(c.compile(n.witness),[],i,n.output),o.prevOutType?{prevOutScript:r,prevOutType:m.P2WSH,witnessScript:n.output,witnessScriptType:o.prevOutType,pubkeys:o.pubkeys,signatures:o.signatures}:{}}return{prevOutType:m.NONSTANDARD,prevOutScript:t}}function _(t,e){y(p.Buffer,t);const r=s.output(t);switch(r){case m.P2PKH:{if(!e)return{type:r};const n=h.p2pkh({output:t}).hash,i=a.hash160(e);return n.equals(i)?{type:r,pubkeys:[e],signatures:[void 0]}:{type:r}}case m.P2WPKH:{if(!e)return{type:r};const n=h.p2wpkh({output:t}).hash,i=a.hash160(e);return n.equals(i)?{type:r,pubkeys:[e],signatures:[void 0]}:{type:r}}case m.P2PK:return{type:r,pubkeys:[h.p2pk({output:t}).pubkey],signatures:[void 0]};case m.P2MS:{const e=h.p2ms({output:t});return{type:r,pubkeys:e.pubkeys,signatures:e.pubkeys.map((()=>{})),maxSignatures:e.m}}}return{type:r}}function S(t,e,r){const n=e.pubkeys||[];let i=e.signatures||[];switch(t){case m.P2PKH:if(0===n.length)break;if(0===i.length)break;return h.p2pkh({pubkey:n[0],signature:i[0]});case m.P2WPKH:if(0===n.length)break;if(0===i.length)break;return h.p2wpkh({pubkey:n[0],signature:i[0]});case m.P2PK:if(0===n.length)break;if(0===i.length)break;return h.p2pk({signature:i[0]});case m.P2MS:{const t=e.maxSignatures;i=r?i.map((t=>t||l.OPS.OP_0)):i.filter((t=>t));const o=!r||t===i.length;return h.p2ms({m:t,pubkeys:n,signatures:i},{allowIncomplete:r,validate:o})}case m.P2SH:{const t=S(e.redeemScriptType,e,r);if(!t)return;return h.p2sh({redeem:{output:t.output||e.redeemScript,input:t.input,witness:t.witness}})}case m.P2WSH:{const t=S(e.witnessScriptType,e,r);if(!t)return;return h.p2wsh({redeem:{output:e.witnessScript,input:t.input,witness:t.witness}})}}}function E(t){return void 0!==t.signScript&&void 0!==t.signType&&void 0!==t.pubkeys&&void 0!==t.signatures&&t.signatures.length===t.pubkeys.length&&t.pubkeys.length>0&&(!1===t.hasWitness||void 0!==t.value)}function M(t){return t.readUInt8(t.length-1)}e.TransactionBuilder=v},6168:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(9031),i=Math.pow(2,31)-1;function o(t){return n.String(t)&&!!t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}e.UInt31=function(t){return n.UInt32(t)&&t<=i},e.BIP32Path=o,o.toJSON=()=>"BIP32 derivation path",e.Signer=function(t){return(n.Buffer(t.publicKey)||"function"==typeof t.getPublicKey)&&"function"==typeof t.sign},e.Satoshi=function(t){return n.UInt53(t)&&t<=21e14},e.ECPoint=n.quacksLike("Point"),e.Network=n.compile({messagePrefix:n.oneOf(n.Buffer,n.String),bip32:{public:n.UInt32,private:n.UInt32},pubKeyHash:n.UInt8,scriptHash:n.UInt8,wif:n.UInt8}),e.Buffer256bit=n.BufferN(32),e.Hash160bit=n.BufferN(20),e.Hash256bit=n.BufferN(32),e.Number=n.Number,e.Array=n.Array,e.Boolean=n.Boolean,e.String=n.String,e.Buffer=n.Buffer,e.Hex=n.Hex,e.maybe=n.maybe,e.tuple=n.tuple,e.UInt8=n.UInt8,e.UInt32=n.UInt32,e.Function=n.Function,e.BufferN=n.BufferN,e.Null=n.Null,e.oneOf=n.oneOf},2197:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(3196).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u<a;u++){var f=t.charCodeAt(u)-48;o*=i,s=f>=49?f-49+10:f>=17?f-17+10:f,n(f>=0&&s<i,"Invalid character"),o+=s}return o}function h(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=f(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=f(t,h,t.length,e),h=0;h<s;h++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype._move=function(t){h(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function y(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var f=1;f<n;f++){for(var h=u>>>26,c=67108863&u,l=Math.min(f,e.length-1),d=Math.max(0,f-t.length+1);d<=l;d++){var p=f-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[f]=0|c,u=0|h}return 0!==u?r.words[f]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?l[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var f=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var y=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?y+r:l[f-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,f=0,h=0|s[0],c=8191&h,l=h>>>13,d=0|s[1],p=8191&d,y=d>>>13,m=0|s[2],g=8191&m,b=m>>>13,v=0|s[3],w=8191&v,_=v>>>13,S=0|s[4],E=8191&S,M=S>>>13,k=0|s[5],A=8191&k,O=k>>>13,I=0|s[6],T=8191&I,x=I>>>13,P=0|s[7],B=8191&P,N=P>>>13,U=0|s[8],R=8191&U,L=U>>>13,C=0|s[9],j=8191&C,F=C>>>13,H=0|a[0],D=8191&H,q=H>>>13,z=0|a[1],$=8191&z,K=z>>>13,W=0|a[2],V=8191&W,G=W>>>13,X=0|a[3],J=8191&X,Z=X>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ht=0|a[8],ct=8191&ht,lt=ht>>>13,dt=0|a[9],pt=8191&dt,yt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(f+(n=Math.imul(c,D))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(l,D)|0))<<13)|0;f=((o=Math.imul(l,q))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,D),i=(i=Math.imul(p,q))+Math.imul(y,D)|0,o=Math.imul(y,q);var gt=(f+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,K)|0)+Math.imul(l,$)|0))<<13)|0;f=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,D),i=(i=Math.imul(g,q))+Math.imul(b,D)|0,o=Math.imul(b,q),n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,K)|0;var bt=(f+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(l,V)|0))<<13)|0;f=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,D),i=(i=Math.imul(w,q))+Math.imul(_,D)|0,o=Math.imul(_,q),n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,K)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,K)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,G)|0;var vt=(f+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(l,J)|0))<<13)|0;f=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(E,D),i=(i=Math.imul(E,q))+Math.imul(M,D)|0,o=Math.imul(M,q),n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Z)|0;var wt=(f+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;f=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,D),i=(i=Math.imul(A,q))+Math.imul(O,D)|0,o=Math.imul(O,q),n=n+Math.imul(E,$)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,K)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(g,J)|0,i=(i=i+Math.imul(g,Z)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0;var _t=(f+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(l,rt)|0))<<13)|0;f=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,D),i=(i=Math.imul(T,q))+Math.imul(x,D)|0,o=Math.imul(x,q),n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,K)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0;var St=(f+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(l,ot)|0))<<13)|0;f=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(B,D),i=(i=Math.imul(B,q))+Math.imul(N,D)|0,o=Math.imul(N,q),n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,K)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(E,J)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Z)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0;var Et=(f+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(l,ut)|0))<<13)|0;f=((o=o+Math.imul(l,ft)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,D),i=(i=Math.imul(R,q))+Math.imul(L,D)|0,o=Math.imul(L,q),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,K)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ft)|0;var Mt=(f+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;f=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(j,D),i=(i=Math.imul(j,q))+Math.imul(F,D)|0,o=Math.imul(F,q),n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,K)|0,n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ft)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ft)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var kt=(f+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,yt)|0)+Math.imul(l,pt)|0))<<13)|0;f=((o=o+Math.imul(l,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,K))+Math.imul(F,$)|0,o=Math.imul(F,K),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Z)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Z)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ft)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,lt)|0)+Math.imul(b,ct)|0,o=o+Math.imul(b,lt)|0;var At=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;f=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,G))+Math.imul(F,V)|0,o=Math.imul(F,G),n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ft)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ft)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var Ot=(f+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((o=o+Math.imul(b,yt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(j,J),i=(i=Math.imul(j,Z))+Math.imul(F,J)|0,o=Math.imul(F,Z),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ft)|0,n=n+Math.imul(E,ct)|0,i=(i=i+Math.imul(E,lt)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,lt)|0;var It=(f+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,yt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((o=o+Math.imul(_,yt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ft)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ft)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(O,ct)|0,o=o+Math.imul(O,lt)|0;var Tt=(f+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,yt)|0)+Math.imul(M,pt)|0))<<13)|0;f=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ft)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ft)|0,n=n+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(f+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,yt)|0)+Math.imul(O,pt)|0))<<13)|0;f=((o=o+Math.imul(O,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,ot),i=(i=Math.imul(j,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ft)|0,n=n+Math.imul(B,ct)|0,i=(i=i+Math.imul(B,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(f+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,yt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((o=o+Math.imul(x,yt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(j,ut),i=(i=Math.imul(j,ft))+Math.imul(F,ut)|0,o=Math.imul(F,ft),n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(L,ct)|0,o=o+Math.imul(L,lt)|0;var Bt=(f+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,yt)|0)+Math.imul(N,pt)|0))<<13)|0;f=((o=o+Math.imul(N,yt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,ct),i=(i=Math.imul(j,lt))+Math.imul(F,ct)|0,o=Math.imul(F,lt);var Nt=(f+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,yt)|0)+Math.imul(L,pt)|0))<<13)|0;f=((o=o+Math.imul(L,yt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Ut=(f+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,yt))+Math.imul(F,pt)|0))<<13)|0;return f=((o=Math.imul(F,yt))+(i>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,u[0]=mt,u[1]=gt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=St,u[7]=Et,u[8]=Mt,u[9]=kt,u[10]=At,u[11]=Ot,u[12]=It,u[13]=Tt,u[14]=xt,u[15]=Pt,u[16]=Bt,u[17]=Nt,u[18]=Ut,0!==f&&(u[19]=f,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),f=Math.max(0,o-t.length+1);f<=u;f++){var h=o-f,c=(0|t.words[h])*(0|e.words[f]),l=67108863&c;a=67108863&(l=l+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function b(t,e,r){return g(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(m=y),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?y(this,t,e):r<1024?g(this,t,e):b(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},v.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},v.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),f=Math.sin(2*Math.PI/a),h=0;h<i;h+=a)for(var c=u,l=f,d=0;d<s;d++){var p=r[h+d],y=n[h+d],m=r[h+d+s],g=n[h+d+s],b=c*m-l*g;g=c*g+l*m,m=b,r[h+d]=p+m,n[h+d]=y+g,r[h+d+s]=p-m,n[h+d+s]=y-g,d!==a&&(b=u*c-f*l,l=u*l+f*c,c=b)}},v.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},v.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},v.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},v.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},v.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},v.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),f=new Array(n),h=new Array(n),c=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,f,n),this.transform(s,o,a,u,n,i),this.transform(f,o,h,c,n,i);for(var d=0;d<n;d++){var p=a[d]*h[d]-u[d]*c[d];u[d]=a[d]*c[d]+u[d]*h[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),b(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var f=0;f<s;f++)u.words[f]=this.words[f];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,f=0;f<this.length;f++)this.words[f]=this.words[f+s];else this.words[0]=0,this.length=1;var h=0;for(f=this.length-1;f>=0&&(0!==h||f>=i);f--){var c=0|this.words[f];this.words[f]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var f=0;f<a.length;f++)a.words[f]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var c=u-1;c>=0;c--){var l=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=l)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),f=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++f;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(f)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function O(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},i(S,_),S.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},S.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(E,_),i(M,_),i(k,_),k.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new S;else if("p224"===t)e=new E;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return w[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,f).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var y=d,m=0;0!==y.cmp(a);m++)y=y.redSqr();n(m<p);var g=this.pow(c,new o(1).iushln(p-m-1));l=l.redMul(g),c=g.redSqr(),d=d.redMul(c),p=m}return l},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var f=e.words[n],h=u-1;h>=0;h--){var c=f>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new O(t)},i(O,A),O.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},O.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},O.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},O.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},O.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},2745:(t,e,r)=>{var n;function i(t){this.rand=t}if(t.exports=function(t){return n||(n=new i(null)),n.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=r(8087);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},7022:(t,e,r)=>{const n=r(8166);t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},8616:(t,e,r)=>{"use strict";var n=r(9587),i=r(7834).Buffer;t.exports=function(t){function e(e){var r=e.slice(0,-4),n=e.slice(-4),i=t(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(e){var r=t(e);return n.encode(i.concat([e,r],e.length+4))},decode:function(t){var r=e(n.decode(t));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(t){var r=n.decodeUnsafe(t);if(r)return e(r)}}}},4075:(t,e,r)=>{"use strict";var n=r(6162),i=r(8616);t.exports=i((function(t){var e=n("sha256").update(t).digest();return n("sha256").update(e).digest()}))},9532:(t,e,r)=>{"use strict";var n=r(7834).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(255!==e[s])throw new TypeError(o+" is ambiguous");e[s]=i}var a=t.length,u=t.charAt(0),f=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function c(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return n.alloc(0);for(var r=0,i=0,o=0;t[r]===u;)i++,r++;for(var s=(t.length-r)*f+1>>>0,h=new Uint8Array(s);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var l=0,d=s-1;(0!==c||l<o)&&-1!==d;d--,l++)c+=a*h[d]>>>0,h[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");o=l,r++}for(var p=s-o;p!==s&&0===h[p];)p++;var y=n.allocUnsafe(i+(s-p));y.fill(0,0,i);for(var m=i;p!==s;)y[m++]=h[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,o=0,s=e.length;o!==s&&0===e[o];)o++,r++;for(var f=(s-o)*h+1>>>0,c=new Uint8Array(f);o!==s;){for(var l=e[o],d=0,p=f-1;(0!==l||d<i)&&-1!==p;p--,d++)l+=256*c[p]>>>0,c[p]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,o++}for(var y=f-i;y!==f&&0===c[y];)y++;for(var m=u.repeat(r);y<f;++y)m+=t.charAt(c[y]);return m},decodeUnsafe:c,decode:function(t){var e=c(t);if(e)return e;throw new Error("Non-base"+a+" character")}}}},9587:(t,e,r)=>{var n=r(9532);t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},8834:(t,e,r)=>{"use strict";const n=r(5766),i=r(2333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return f(t,e,r)}function f(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let n=a(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(X(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(X(t,SharedArrayBuffer)||t&&X(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const i=function(t){if(u.isBuffer(t)){const e=0|p(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?a(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return h(t),a(t<0?0:0|p(t))}function l(t){const e=t.length<0?0:0|p(t.length),r=a(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function p(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(t).length;default:if(i)return n?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return k(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){let o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<a;o++)if(f(t,o)===f(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(f(t,o+n)!==f(e,n)){r=!1;break}if(r)return o}return-1}function w(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(J(n))return s;t[r+s]=n}return s}function _(t,e,r,n){return G(W(e,t.length-r),t,r,n)}function S(t,e,r,n){return G(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return G(V(e),t,r,n)}function M(t,e,r,n){return G(function(t,e){let r,n,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function k(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],a=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=O));return r}(n)}e.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return f(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),X(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.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}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=u.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(X(e,Uint8Array))i+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)g(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):m.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const a=Math.min(o,s),f=this.slice(n,i),h=t.slice(e,r);for(let t=0;t<a;++t)if(f[t]!==h[t]){o=f[t],s=h[t];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return S(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function I(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function T(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function x(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=Z[t[n]];return i}function P(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function B(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function U(t,e,r,n,i){q(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function R(t,e,r,n,i){q(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function L(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function j(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Y((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||$(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),u.prototype.readBigUInt64BE=Y((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||$(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Y((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||$(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),u.prototype.readBigInt64BE=Y((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||$(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=Y((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Y((function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=Y((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Y((function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=u.isBuffer(t)?t:u.from(t,n),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%s]}return this};const F={};function H(t,e,r){F[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function D(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function q(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new F.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||$(e,t.length-(r+1))}(n,i,o)}function z(t,e){if("number"!=typeof t)throw new F.ERR_INVALID_ARG_TYPE(e,"number",t)}function $(t,e,r){if(Math.floor(t)!==t)throw z(t,r),new F.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}H("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),H("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),H("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=D(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=D(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function W(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function V(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Y(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},8098:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32ToB58=e.b58ToC32=e.c32addressDecode=e.c32address=e.versions=void 0;var n=r(392),i=r(2716);e.versions={mainnet:{p2pkh:22,p2sh:20},testnet:{p2pkh:26,p2sh:21}};var o={};o[0]=e.versions.mainnet.p2pkh,o[5]=e.versions.mainnet.p2sh,o[111]=e.versions.testnet.p2pkh,o[196]=e.versions.testnet.p2sh;var s={};function a(t,e){if(!e.match(/^[0-9a-fA-F]{40}$/))throw new Error("Invalid argument: not a hash160 hex string");return"S"+n.c32checkEncode(t,e)}function u(t){if(t.length<=5)throw new Error("Invalid c32 address: invalid length");if("S"!=t[0])throw new Error('Invalid c32 address: must start with "S"');return n.c32checkDecode(t.slice(1))}s[e.versions.mainnet.p2pkh]=0,s[e.versions.mainnet.p2sh]=5,s[e.versions.testnet.p2pkh]=111,s[e.versions.testnet.p2sh]=196,e.c32address=a,e.c32addressDecode=u,e.b58ToC32=function(t,e){void 0===e&&(e=-1);var r,n=i.decode(t),s=n.data.toString("hex"),u=parseInt(n.prefix.toString("hex"),16);return e<0?(r=u,void 0!==o[u]&&(r=o[u])):r=e,a(r,s)},e.c32ToB58=function(t,e){void 0===e&&(e=-1);var r,n=u(t),o=n[0],a=n[1];e<0?(r=o,void 0!==s[o]&&(r=s[o])):r=e;var f=r.toString(16);return 1===f.length&&(f="0"+f),i.encode(a,f)}},2716:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=void 0;var n=r(8131),i=r(9926),o=r(9805),s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";e.encode=function(t,e,r){if(void 0===e&&(e="00"),void 0===r&&(r="hex"),"string"==typeof t&&(t=new n.Buffer(t,r)),!(t instanceof n.Buffer))throw new TypeError('"data" argument must be an Array of Buffers');e instanceof n.Buffer||(e=new n.Buffer(e,r));var a=n.Buffer.concat([e,t]);return a=i.hashSha256(a),a=i.hashSha256(a),a=n.Buffer.concat([e,t,a.slice(0,4)]),o(s).encode(a)},e.decode=function(t,e){var r=new n.Buffer(o(s).decode(t)),a=r.slice(0,1),u=r.slice(1,-4),f=n.Buffer.concat([a,u]);return f=i.hashSha256(f),f=i.hashSha256(f),r.slice(-4).forEach((function(t,e){if(t!==f[e])throw new Error("Invalid checksum")})),e&&(a=a.toString(e),u=u.toString(e)),{prefix:a,data:u}}},392:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32checkDecode=e.c32checkEncode=void 0;var n=r(8131),i=r(4103),o=r(9926);function s(t){return o.hashSha256(o.hashSha256(n.Buffer.from(t,"hex"))).slice(0,4).toString("hex")}e.c32checkEncode=function(t,e){if(t<0||t>=32)throw new Error("Invalid version (must be between 0 and 31)");if(!e.match(/^[0-9a-fA-F]*$/))throw new Error("Invalid data (not a hex string)");(e=e.toLowerCase()).length%2!=0&&(e="0"+e);var r=t.toString(16);1===r.length&&(r="0"+r);var n=s(""+r+e),o=i.c32encode(""+e+n);return""+i.c32[t]+o},e.c32checkDecode=function(t){t=i.c32normalize(t);var e=i.c32decode(t.slice(1)),r=t[0],n=i.c32.indexOf(r),o=e.slice(-8),a=n.toString(16);if(1===a.length&&(a="0"+a),s(""+a+e.substring(0,e.length-8))!==o)throw new Error("Invalid c32check string: checksum mismatch");return[n,e.substring(0,e.length-8)]}},4103:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32decode=e.c32normalize=e.c32encode=e.c32=void 0;var n=r(8131);e.c32="0123456789ABCDEFGHJKMNPQRSTVWXYZ";var i="0123456789abcdef";function o(t){return t.toUpperCase().replace(/O/g,"0").replace(/L|I/g,"1")}e.c32encode=function(t,r){if(!t.match(/^[0-9a-fA-F]*$/))throw new Error("Not a hex-encoded string");t.length%2!=0&&(t="0"+t);for(var o=[],s=0,a=(t=t.toLowerCase()).length-1;a>=0;a--)if(s<4){var u=i.indexOf(t[a])>>s,f=0;0!==a&&(f=i.indexOf(t[a-1]));var h=1+s,c=f%(1<<h)<<5-h,l=e.c32[u+c];s=h,o.unshift(l)}else s=0;var d=0;for(a=0;a<o.length&&"0"===o[a];a++)d++;o=o.slice(d);var p=n.Buffer.from(t,"hex").toString().match(/^\u0000*/),y=p?p[0].length:0;for(a=0;a<y;a++)o.unshift(e.c32[0]);if(r){var m=r-o.length;for(a=0;a<m;a++)o.unshift(e.c32[0])}return o.join("")},e.c32normalize=o,e.c32decode=function(t,r){if(!(t=o(t)).match("^["+e.c32+"]*$"))throw new Error("Not a c32-encoded string");for(var n=t.match("^"+e.c32[0]+"*"),s=n?n[0].length:0,a=[],u=0,f=0,h=t.length-1;h>=0;h--){4===f&&(a.unshift(i[u]),f=0,u=0);var c=(e.c32.indexOf(t[h])<<f)+u,l=i[c%16];if((u=c>>4)>1<<(f+=1))throw new Error("Panic error in decoding.");a.unshift(l)}a.unshift(i[u]),a.length%2==1&&a.unshift("0");var d=0;for(h=0;h<a.length&&"0"===a[h];h++)d++;var p=(a=a.slice(d-d%2)).join("");for(h=0;h<s;h++)p="00"+p;if(r){var y=2*r-p.length;for(h=0;h<y;h+=2)p="00"+p}return p}},2870:(t,e,r)=>{"use strict";e.H4=void 0;r(4103),r(392);var n=r(8098);Object.defineProperty(e,"H4",{enumerable:!0,get:function(){return n.c32address}})},9805:(t,e,r)=>{"use strict";var n=r(7834).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(255!==e[s])throw new TypeError(o+" is ambiguous");e[s]=i}var a=t.length,u=t.charAt(0),f=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function c(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return n.alloc(0);for(var r=0,i=0,o=0;t[r]===u;)i++,r++;for(var s=(t.length-r)*f+1>>>0,h=new Uint8Array(s);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var l=0,d=s-1;(0!==c||l<o)&&-1!==d;d--,l++)c+=a*h[d]>>>0,h[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");o=l,r++}for(var p=s-o;p!==s&&0===h[p];)p++;var y=n.allocUnsafe(i+(s-p));y.fill(0,0,i);for(var m=i;p!==s;)y[m++]=h[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,o=0,s=e.length;o!==s&&0===e[o];)o++,r++;for(var f=(s-o)*h+1>>>0,c=new Uint8Array(f);o!==s;){for(var l=e[o],d=0,p=f-1;(0!==l||d<i)&&-1!==p;p--,d++)l+=256*c[p]>>>0,c[p]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,o++}for(var y=f-i;y!==f&&0===c[y];)y++;for(var m=u.repeat(r);y<f;++y)m+=t.charAt(c[y]);return m},decodeUnsafe:c,decode:function(t){var e=c(t);if(e)return e;throw new Error("Non-base"+a+" character")}}}},8131:(t,e,r)=>{"use strict";var n=r(5766),i=r(2333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;var s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return f(t,e,r)}function f(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|y(t,e),n=a(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(D(t,Uint8Array)){var e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(D(t,ArrayBuffer)||t&&D(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(D(t,SharedArrayBuffer)||t&&D(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);var i=function(t){if(u.isBuffer(t)){var e=0|p(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||q(t.length)?a(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return h(t),a(t<0?0:0|p(t))}function l(t){for(var e=t.length<0?0:0|p(t.length),r=a(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function p(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||D(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(i)return n?-1:j(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return k(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;o<a;o++)if(f(t,o)===f(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var c=!0,l=0;l<u;l++)if(f(t,o+l)!==f(e,l)){c=!1;break}if(c)return o}return-1}function w(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(q(a))return s;t[r+s]=a}return s}function _(t,e,r,n){return H(j(e,t.length-r),t,r,n)}function S(t,e,r,n){return H(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return H(F(e),t,r,n)}function M(t,e,r,n){return H(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function k(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,f=t[i],h=null,c=f>239?4:f>223?3:f>191?2:1;if(i+c<=r)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&f)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=O));return r}(n)}e.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return f(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(D(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),D(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.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}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(D(o,Uint8Array))i+o.length>n.length?u.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):m.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(D(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),f=this.slice(n,i),h=t.slice(e,r),c=0;c<a;++c)if(f[c]!==h[c]){o=f[c],s=h[c];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return S(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function I(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function T(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function x(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=z[t[o]];return i}function P(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function B(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function U(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(t,e,r,n,o){return e=+e,r>>>=0,o||U(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,o){return e=+e,r>>>=0,o||U(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,r){return R(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=u.isBuffer(t)?t:u.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var C=/[^+/0-9A-Za-z-_]/g;function j(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function D(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function q(t){return t!=t}var z=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()},3973:(t,e,r)=>{var n=r(7834).Buffer,i=r(4851).Transform,o=r(214).s;function s(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(1285)(s,i),s.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},t.exports=s},6162:(t,e,r)=>{"use strict";var n=r(1285),i=r(7993),o=r(1445),s=r(9065),a=r(3973);function u(t){a.call(this,"digest"),this._hash=t}n(u,a),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},2511:(t,e,r)=>{var n=r(7993);t.exports=function(t){return(new n).update(t).digest()}},11:(t,e,r)=>{"use strict";var n=r(1285),i=r(6456),o=r(3973),s=r(7834).Buffer,a=r(2511),u=r(1445),f=r(9065),h=s.alloc(128);function c(t,e){o.call(this,"digest"),"string"==typeof e&&(e=s.from(e));var r="sha512"===t||"sha384"===t?128:64;this._alg=t,this._key=e,e.length>r?e=("rmd160"===t?new u:f(t)).update(e).digest():e.length<r&&(e=s.concat([e,h],r));for(var n=this._ipad=s.allocUnsafe(r),i=this._opad=s.allocUnsafe(r),a=0;a<r;a++)n[a]=54^e[a],i[a]=92^e[a];this._hash="rmd160"===t?new u:f(t),this._hash.update(n)}n(c,o),c.prototype._update=function(t){this._hash.update(t)},c.prototype._final=function(){var t=this._hash.digest();return("rmd160"===this._alg?new u:f(this._alg)).update(this._opad).update(t).digest()},t.exports=function(t,e){return"rmd160"===(t=t.toLowerCase())||"ripemd160"===t?new c("rmd160",e):"md5"===t?new i(a,e):new c(t,e)}},6456:(t,e,r)=>{"use strict";var n=r(1285),i=r(7834).Buffer,o=r(3973),s=i.alloc(128),a=64;function u(t,e){o.call(this,"digest"),"string"==typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>a?e=t(e):e.length<a&&(e=i.concat([e,s],a));for(var r=this._ipad=i.allocUnsafe(a),n=this._opad=i.allocUnsafe(a),u=0;u<a;u++)r[u]=54^e[u],n[u]=92^e[u];this._hash=[r]}n(u,o),u.prototype._update=function(t){this._hash.push(t)},u.prototype._final=function(){var t=this._alg(i.concat(this._hash));return this._alg(i.concat([this._opad,t]))},t.exports=u},3616:function(){!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function f(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=p(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=f(t),e=h(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[f(t)]},l.prototype.get=function(t){return t=f(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(f(t))},l.prototype.set=function(t,e){this.map[f(t)]=h(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){var r,n,i=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),b.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},g.call(v.prototype),g.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var S=[301,302,303,307,308];_.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(t,r){return new Promise((function(n,o){var s=new v(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;n(new _(i,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=l,t.Request=v,t.Response=_),e.Headers=l,e.Request=v,e.Response=_,e.fetch=E,Object.defineProperty(e,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:this)},6279:function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function f(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=p(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=f(t),e=h(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[f(t)]},l.prototype.get=function(t){return t=f(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(f(t))},l.prototype.set=function(t,e){this.map[f(t)]=h(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){var r,n,i=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),b.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},g.call(v.prototype),g.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var S=[301,302,303,307,308];_.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(t,r){return new Promise((function(n,o){var s=new v(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;n(new _(i,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=l,t.Request=v,t.Response=_),e.Headers=l,e.Request=v,e.Response=_,e.fetch=E,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},9926:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hashSha256=e.sha256=e.sha256nodeCrypto=e.sha256js=void 0;var n=r(3878),i=function(){function t(){this._blockSize=64,this._finalSize=56,this._len=0,this._w=new Array(64),this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this._block=n.Buffer.alloc(this._blockSize)}return t.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.Buffer.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,s=this._len,a=0;a<o;){for(var u=s%i,f=Math.min(o-a,i-u),h=0;h<f;h++)r[u+h]=t[a+h];a+=f,(s+=f)%i==0&&this._update(r)}return this._len+=o,this},t.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,o=(r-i)/4294967296;this._block.writeUInt32BE(o,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=n.Buffer.alloc(32);return s.writeInt32BE(this._a,0),s.writeInt32BE(this._b,4),s.writeInt32BE(this._c,8),s.writeInt32BE(this._d,12),s.writeInt32BE(this._e,16),s.writeInt32BE(this._f,20),s.writeInt32BE(this._g,24),s.writeInt32BE(this._h,28),t?s.toString(t):s},t.prototype.ch=function(t,e,r){return r^t&(e^r)},t.prototype.maj=function(t,e,r){return t&e|r&(t|e)},t.prototype.sigma0=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},t.prototype.sigma1=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},t.prototype.gamma0=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},t.prototype.gamma1=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10},t.prototype._update=function(e){for(var r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0|this._f,f=0|this._g,h=0|this._h,c=0;c<16;++c)r[c]=e.readInt32BE(4*c);for(;c<64;++c)r[c]=this.gamma1(r[c-2])+r[c-7]+this.gamma0(r[c-15])+r[c-16]|0;for(var l=0;l<64;++l){var d=h+this.sigma1(a)+this.ch(a,u,f)+t.K[l]+r[l]|0,p=this.sigma0(n)+this.maj(n,i,o)|0;h=f,f=u,u=a,a=s+d|0,s=o,o=i,i=n,n=d+p|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=u+this._f|0,this._g=f+this._g|0,this._h=h+this._h|0},t.K=[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],t}();e.sha256js=i;var o=function(){function t(){t.useCryptoModuleCache&&void 0!==t.nodeCryptoCreateHash||(t.nodeCryptoCreateHash=r(9096).createHash),this.hash=t.nodeCryptoCreateHash("sha256")}return t.prototype.update=function(t,e){return this.hash.update(t,e),this},t.prototype.digest=function(t){return t?this.hash.digest(t):this.hash.digest()},t.useCryptoModuleCache=!0,t}();e.sha256nodeCrypto=o;var s=void 0,a=function(){function t(){!function(){if(o.useCryptoModuleCache&&void 0!==s)return s;var t=!1;try{var e=r(9096);t=e&&"function"==typeof e.createHash}catch(t){}return s=t,t}()?this.instance=new i:this.instance=new o}return t.prototype.update=function(t,e){return this.instance.update(t,e),this},t.prototype.digest=function(t){return t?this.instance.digest(t):this.instance.digest()},t}();function u(t){return(new a).update(t).digest()}e.sha256=a,e.hashSha256=u,e.default=u},3878:(t,e,r)=>{"use strict";var n=r(5766),i=r(2333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;var s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return f(t,e,r)}function f(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|y(t,e),n=a(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(D(t,Uint8Array)){var e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(D(t,ArrayBuffer)||t&&D(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(D(t,SharedArrayBuffer)||t&&D(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);var i=function(t){if(u.isBuffer(t)){var e=0|p(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||q(t.length)?a(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return h(t),a(t<0?0:0|p(t))}function l(t){for(var e=t.length<0?0:0|p(t.length),r=a(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function p(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||D(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(i)return n?-1:j(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return k(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;o<a;o++)if(f(t,o)===f(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var c=!0,l=0;l<u;l++)if(f(t,o+l)!==f(e,l)){c=!1;break}if(c)return o}return-1}function w(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(q(a))return s;t[r+s]=a}return s}function _(t,e,r,n){return H(j(e,t.length-r),t,r,n)}function S(t,e,r,n){return H(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return H(F(e),t,r,n)}function M(t,e,r,n){return H(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function k(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,f=t[i],h=null,c=f>239?4:f>223?3:f>191?2:1;if(i+c<=r)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&f)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=O));return r}(n)}e.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return f(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(D(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),D(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.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}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(D(o,Uint8Array))i+o.length>n.length?u.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):m.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(D(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),f=this.slice(n,i),h=t.slice(e,r),c=0;c<a;++c)if(f[c]!==h[c]){o=f[c],s=h[c];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return S(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function I(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function T(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function x(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=z[t[o]];return i}function P(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function B(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function U(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(t,e,r,n,o){return e=+e,r>>>=0,o||U(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,o){return e=+e,r>>>=0,o||U(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,r){return R(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=u.isBuffer(t)?t:u.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var C=/[^+/0-9A-Za-z-_]/g;function j(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function D(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function q(t){return t!=t}var z=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()},6120:(t,e,r)=>{"use strict";var n=r(7834).Buffer,i=r(2221);function o(t){if(n.isBuffer(t))return t;if("string"==typeof t)return n.from(t,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function s(t,e,r){for(var n=0;e+n<r&&0===t[e+n];)++n;return t[e+n]>=128&&--n,n}t.exports={derToJose:function(t,e){t=o(t);var r=i(e),s=r+1,a=t.length,u=0;if(48!==t[u++])throw new Error('Could not find expected "seq"');var f=t[u++];if(129===f&&(f=t[u++]),a-u<f)throw new Error('"seq" specified length of "'+f+'", only "'+(a-u)+'" remaining');if(2!==t[u++])throw new Error('Could not find expected "int" for "r"');var h=t[u++];if(a-u-2<h)throw new Error('"r" specified length of "'+h+'", only "'+(a-u-2)+'" available');if(s<h)throw new Error('"r" specified length of "'+h+'", max of "'+s+'" is acceptable');var c=u;if(u+=h,2!==t[u++])throw new Error('Could not find expected "int" for "s"');var l=t[u++];if(a-u!==l)throw new Error('"s" specified length of "'+l+'", expected "'+(a-u)+'"');if(s<l)throw new Error('"s" specified length of "'+l+'", max of "'+s+'" is acceptable');var d=u;if((u+=l)!==a)throw new Error('Expected to consume entire buffer, but "'+(a-u)+'" bytes remain');var p=r-h,y=r-l,m=n.allocUnsafe(p+h+y+l);for(u=0;u<p;++u)m[u]=0;t.copy(m,u,c+Math.max(-p,0),c+h);for(var g=u=r;u<g+y;++u)m[u]=0;return t.copy(m,u,d+Math.max(-y,0),d+l),(m=m.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(t,e){t=o(t);var r=i(e),a=t.length;if(a!==2*r)throw new TypeError('"'+e+'" signatures must be "'+2*r+'" bytes, saw "'+a+'"');var u=s(t,0,r),f=s(t,r,t.length),h=r-u,c=r-f,l=2+h+1+1+c,d=l<128,p=n.allocUnsafe((d?2:3)+l),y=0;return p[y++]=48,d?p[y++]=l:(p[y++]=129,p[y++]=255&l),p[y++]=2,p[y++]=h,u<0?(p[y++]=0,y+=t.copy(p,y,0,r)):y+=t.copy(p,y,u,r),p[y++]=2,p[y++]=c,f<0?(p[y++]=0,t.copy(p,y,r)):t.copy(p,y,r+f),p}}},2221:t=>{"use strict";function e(t){return(t/8|0)+(t%8==0?0:1)}var r={ES256:e(256),ES384:e(384),ES512:e(521)};t.exports=function(t){var e=r[t];if(e)return e;throw new Error('Unknown algorithm "'+t+'"')}},7554:(t,e,r)=>{"use strict";var n=e;n.version=r(763).i8,n.utils=r(8288),n.rand=r(2745),n.curve=r(8610),n.curves=r(1479),n.ec=r(8596),n.eddsa=r(9208)},8919:(t,e,r)=>{"use strict";var n=r(2140),i=r(8288),o=i.getNAF,s=i.getJSF,a=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var s,u,f=[];for(s=0;s<n.length;s+=r.step){u=0;for(var h=s+r.step-1;h>=s;h--)u=(u<<1)+n[h];f.push(u)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s<f.length;s++)(u=f[s])===d?l=l.mixedAdd(r.points[s]):u===-d&&(l=l.mixedAdd(r.points[s].neg()));c=c.add(l)}return c.toP()},u.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=o(e,r,this._bitLength),u=this.jpoint(null,null,null),f=s.length-1;f>=0;f--){for(var h=0;f>=0&&0===s[f];f--)h++;if(f>=0&&h++,u=u.dblp(h),f<0)break;var c=s[f];a(0!==c),u="affine"===t.type?c>0?u.mixedAdd(i[c-1>>1]):u.mixedAdd(i[-c-1>>1].neg()):c>0?u.add(i[c-1>>1]):u.add(i[-c-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){var a,u,f,h=this._wnafT1,c=this._wnafT2,l=this._wnafT3,d=0;for(a=0;a<n;a++){var p=(f=e[a])._getNAFPoints(t);h[a]=p.wnd,c[a]=p.points}for(a=n-1;a>=1;a-=2){var y=a-1,m=a;if(1===h[y]&&1===h[m]){var g=[e[y],null,null,e[m]];0===e[y].y.cmp(e[m].y)?(g[1]=e[y].add(e[m]),g[2]=e[y].toJ().mixedAdd(e[m].neg())):0===e[y].y.cmp(e[m].y.redNeg())?(g[1]=e[y].toJ().mixedAdd(e[m]),g[2]=e[y].add(e[m].neg())):(g[1]=e[y].toJ().mixedAdd(e[m]),g[2]=e[y].toJ().mixedAdd(e[m].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[y],r[m]);for(d=Math.max(v[0].length,d),l[y]=new Array(d),l[m]=new Array(d),u=0;u<d;u++){var w=0|v[0][u],_=0|v[1][u];l[y][u]=b[3*(w+1)+(_+1)],l[m][u]=0,c[y]=g}}else l[y]=o(r[y],h[y],this._bitLength),l[m]=o(r[m],h[m],this._bitLength),d=Math.max(l[y].length,d),d=Math.max(l[m].length,d)}var S=this.jpoint(null,null,null),E=this._wnafT4;for(a=d;a>=0;a--){for(var M=0;a>=0;){var k=!0;for(u=0;u<n;u++)E[u]=0|l[u][a],0!==E[u]&&(k=!1);if(!k)break;M++,a--}if(a>=0&&M++,S=S.dblp(M),a<0)break;for(u=0;u<n;u++){var A=E[u];0!==A&&(A>0?f=c[u][A-1>>1]:A<0&&(f=c[u][-A-1>>1].neg()),S="affine"===f.type?S.mixedAdd(f):S.add(f))}}for(a=0;a<n;a++)c[a]=null;return i?S:S.toP()},u.BasePoint=f,f.prototype.eq=function(){throw new Error("Not implemented")},f.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(t,e){t=i.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?a(t[t.length-1]%2==0):7===t[0]&&a(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},f.prototype.encodeCompressed=function(t){return this.encode(t,!0)},f.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},f.prototype.encode=function(t,e){return i.encode(this._encode(e),t)},f.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},f.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},f.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},f.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},f.prototype._getBeta=function(){return null},f.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}},7105:(t,e,r)=>{"use strict";var n=r(8288),i=r(2140),o=r(1285),s=r(8919),a=n.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,s.call(this,"edwards",t),this.a=new i(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function f(t,e,r,n,o){s.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(e,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(u,s),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=n.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var u=a.fromRed().isOdd();return(e&&!u||!e&&u)&&(a=a.redNeg()),this.point(t,a)},u.prototype.pointFromY=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=n.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},o(f,s.BasePoint),u.prototype.pointFromJSON=function(t){return f.fromJSON(this,t)},u.prototype.point=function(t,e,r,n){return new f(this,t,e,r,n)},f.fromJSON=function(t,e){return new f(t,e[0],e[1],e[2])},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},f.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),s=o.redSub(r),a=n.redSub(e),u=i.redMul(s),f=o.redMul(a),h=i.redMul(a),c=s.redMul(o);return this.curve.point(u,f,c,h)},f.prototype._projDbl=function(){var t,e,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var f=(n=this.curve._mulA(a)).redAdd(u);this.zOne?(t=s.redSub(a).redSub(u).redMul(f.redSub(this.curve.two)),e=f.redMul(n.redSub(u)),r=f.redSqr().redSub(f).redSub(f)):(i=this.z.redSqr(),o=f.redSub(i).redISub(i),t=s.redSub(a).redISub(u).redMul(o),e=f.redMul(n.redSub(u)),r=f.redMul(o))}else n=a.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(s.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(a.redISub(u)),r=n.redMul(o);return this.curve.point(t,e,r)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),s=i.redSub(n),a=i.redAdd(n),u=r.redAdd(e),f=o.redMul(s),h=a.redMul(u),c=o.redMul(u),l=s.redMul(a);return this.curve.point(f,h,l,c)},f.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),u=i.redSub(a),f=i.redAdd(a),h=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),c=n.redMul(u).redMul(h);return this.curve.twisted?(e=n.redMul(f).redMul(s.redSub(this.curve._mulA(o))),r=u.redMul(f)):(e=n.redMul(f).redMul(s.redSub(o)),r=this.curve._mulC(u).redMul(f)),this.curve.point(c,e,r)},f.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},f.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},f.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},f.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function(){return this.normalize(),this.y.fromRed()},f.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},f.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},8610:(t,e,r)=>{"use strict";var n=e;n.base=r(8919),n.short=r(7715),n.mont=r(5125),n.edwards=r(7105)},5125:(t,e,r)=>{"use strict";var n=r(2140),i=r(1285),o=r(8919),s=r(8288);function a(t){o.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},i(u,o.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},a.prototype.point=function(t,e){return new u(this,t,e)},a.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),s=i.redMul(n),a=e.z.redMul(o.redAdd(s).redSqr()),u=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},7715:(t,e,r)=>{"use strict";var n=r(8288),i=r(2140),o=r(1285),s=r(8919),a=n.assert;function u(t){s.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function f(t,e,r,n){s.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(t,e,r,n){s.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,s),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,o,s,a,u,f,h,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=t,d=this.n.clone(),p=new i(1),y=new i(0),m=new i(0),g=new i(1),b=0;0!==l.cmpn(0);){var v=d.div(l);f=d.sub(v.mul(l)),h=m.sub(v.mul(p));var w=g.sub(v.mul(y));if(!n&&f.cmp(c)<0)e=u.neg(),r=p,n=f.neg(),o=h;else if(n&&2==++b)break;u=f,d=l,l=f,m=p,p=h,g=y,y=w}s=f.neg(),a=h;var _=n.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(_)>=0&&(s=e,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),f=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(f).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],u=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),u=u.neg(!0)),n[2*o]=a,n[2*o+1]=u,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var f=this._wnafMulAdd(1,n,i,2*o,r),h=0;h<2*o;h++)n[h]=null,i[h]=null;return f},o(f,s.BasePoint),u.prototype.point=function(t,e,r){return new f(this,t,e,r)},u.prototype.pointFromJSON=function(t,e){return f.fromJSON(this,t,e)},f.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},f.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},f.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}var o=e[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return this.inf},f.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},f.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},f.prototype.getX=function(){return this.x.fromRed()},f.prototype.getY=function(){return this.y.fromRed()},f.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},f.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},f.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},f.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(h,s.BasePoint),u.prototype.jpoint=function(t,e,r){return new h(this,t,e,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),h=f.redMul(a),c=n.redMul(f),l=u.redSqr().redIAdd(h).redISub(c).redISub(c),d=u.redMul(c.redISub(l)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(l,d,p)},h.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),f=u.redMul(s),h=r.redMul(u),c=a.redSqr().redIAdd(f).redISub(h).redISub(h),l=a.redMul(h.redISub(c)).redISub(i.redMul(f)),d=this.z.redMul(s);return this.curve.jpoint(c,l,d)},h.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,u=a.redSqr().redSqr(),f=s.redAdd(s);for(e=0;e<t;e++){var h=o.redSqr(),c=f.redSqr(),l=c.redSqr(),d=h.redAdd(h).redIAdd(h).redIAdd(n.redMul(u)),p=o.redMul(c),y=d.redSqr().redISub(p.redAdd(p)),m=p.redISub(y),g=d.redMul(m);g=g.redIAdd(g).redISub(l);var b=f.redMul(a);e+1<t&&(u=u.redMul(l)),o=y,a=b,f=g}return this.curve.jpoint(o,f.redMul(i),a)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),u=a.redSqr().redISub(s).redISub(s),f=o.redIAdd(o);f=(f=f.redIAdd(f)).redIAdd(f),t=u,e=a.redMul(s.redISub(u)).redISub(f),r=this.y.redAdd(this.y)}else{var h=this.x.redSqr(),c=this.y.redSqr(),l=c.redSqr(),d=this.x.redAdd(c).redSqr().redISub(h).redISub(l);d=d.redIAdd(d);var p=h.redAdd(h).redIAdd(h),y=p.redSqr(),m=l.redIAdd(l);m=(m=m.redIAdd(m)).redIAdd(m),t=y.redISub(d).redISub(d),e=p.redMul(d.redISub(t)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},h.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=a.redSqr().redISub(s).redISub(s);t=u;var f=o.redIAdd(o);f=(f=f.redIAdd(f)).redIAdd(f),e=a.redMul(s.redISub(u)).redISub(f),r=this.y.redAdd(this.y)}else{var h=this.z.redSqr(),c=this.y.redSqr(),l=this.x.redMul(c),d=this.x.redSub(h).redMul(this.x.redAdd(h));d=d.redAdd(d).redIAdd(d);var p=l.redIAdd(l),y=(p=p.redIAdd(p)).redAdd(p);t=d.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(c).redISub(h);var m=c.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),e=d.redMul(p.redISub(t)).redISub(m)}return this.curve.jpoint(t,e,r)},h.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),f=(u=u.redIAdd(u)).redMul(s),h=a.redSqr().redISub(f.redAdd(f)),c=f.redISub(h),l=s.redSqr();l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=a.redMul(c).redISub(l),p=r.redAdd(r).redMul(n);return this.curve.jpoint(h,d,p)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var f=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(u),h=e.redMul(f);h=(h=h.redIAdd(h)).redIAdd(h);var c=this.x.redMul(a).redISub(h);c=(c=c.redIAdd(c)).redIAdd(c);var l=this.y.redMul(f.redMul(u.redISub(f)).redISub(s.redMul(a)));l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(c,l,d)},h.prototype.mul=function(t,e){return t=new i(t,e),this.curve._wnafMul(this,t)},h.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},h.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},1479:(t,e,r)=>{"use strict";var n,i=e,o=r(4485),s=r(8610),a=r(8288).assert;function u(t){"short"===t.type?this.curve=new s.short(t):"edwards"===t.type?this.curve=new s.edwards(t):this.curve=new s.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function f(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=u,f("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),f("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),f("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(7983)}catch(t){n=void 0}f("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},8596:(t,e,r)=>{"use strict";var n=r(2140),i=r(8873),o=r(8288),s=r(1479),a=r(2745),u=o.assert,f=r(2307),h=r(1798);function c(t){if(!(this instanceof c))return new c(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(s,t),"Unknown curve "+t),t=s[t]),t instanceof s.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=c,c.prototype.keyPair=function(t){return new f(this,t)},c.prototype.keyFromPrivate=function(t,e){return f.fromPrivate(this,t,e)},c.prototype.keyFromPublic=function(t,e){return f.fromPublic(this,t,e)},c.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var s=new n(e.generate(r));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},c.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function(t,e,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray("be",s),u=t.toArray("be",s),f=new i({hash:this.hash,entropy:a,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),c=this.n.sub(new n(1)),l=0;;l++){var d=o.k?o.k(l):new n(f.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(c)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var y=p.getX(),m=y.umod(this.n);if(0!==m.cmpn(0)){var g=d.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(g=g.umod(this.n)).cmpn(0)){var b=(p.getY().isOdd()?1:0)|(0!==y.cmp(m)?2:0);return o.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),b^=1),new h({r:m,s:g,recoveryParam:b})}}}}}},c.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var o=(e=new h(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),f=u.mul(t).umod(this.n),c=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(f,r.getPublic(),c)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(f,r.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},c.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new h(e,i);var o=this.n,s=new n(t),a=e.r,f=e.s,c=1&r,l=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");a=l?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var d=e.r.invm(o),p=o.sub(s).mul(d).umod(o),y=f.mul(d).umod(o);return this.g.mulAdd(p,a,y)},c.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new h(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},2307:(t,e,r)=>{"use strict";var n=r(2140),i=r(8288).assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=o,o.fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},1798:(t,e,r)=>{"use strict";var n=r(2140),i=r(8288),o=i.assert;function s(t,e){if(t instanceof s)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o<n;o++,s++)i<<=8,i|=t[s],i>>>=0;return!(i<=127)&&(e.place=s,i)}function f(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function h(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=s,s.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var s=u(t,r);if(!1===s)return!1;var f=t.slice(r.place,s+r.place);if(r.place+=s,2!==t[r.place++])return!1;var h=u(t,r);if(!1===h)return!1;if(t.length!==h+r.place)return!1;var c=t.slice(r.place,h+r.place);if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}return this.r=new n(f),this.s=new n(c),this.recoveryParam=null,!0},s.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=f(e),r=f(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];h(n,e.length),(n=n.concat(e)).push(2),h(n,r.length);var o=n.concat(r),s=[48];return h(s,o.length),s=s.concat(o),i.encode(s,t)}},9208:(t,e,r)=>{"use strict";var n=r(4485),i=r(1479),o=r(8288),s=o.assert,a=o.parseBytes,u=r(851),f=r(6117);function h(t){if(s("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof h))return new h(t);t=i[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=n.sha512}t.exports=h,h.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),u=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},h.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},h.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return o.intFromLE(t.digest()).umod(this.curve.n)},h.prototype.keyFromPublic=function(t){return u.fromPublic(this,t)},h.prototype.keyFromSecret=function(t){return u.fromSecret(this,t)},h.prototype.makeSignature=function(t){return t instanceof f?t:new f(this,t)},h.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},h.prototype.decodePoint=function(t){var e=(t=o.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),n=0!=(128&t[e]),i=o.intFromLE(r);return this.curve.pointFromY(i,n)},h.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},h.prototype.decodeInt=function(t){return o.intFromLE(t)},h.prototype.isPoint=function(t){return t instanceof this.pointClass}},851:(t,e,r)=>{"use strict";var n=r(8288),i=n.assert,o=n.parseBytes,s=n.cachedProperty;function a(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}a.fromPublic=function(t,e){return e instanceof a?e:new a(t,{pub:e})},a.fromSecret=function(t,e){return e instanceof a?e:new a(t,{secret:e})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},a.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},a.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),t)},a.prototype.getPublic=function(t){return n.encode(this.pubBytes(),t)},t.exports=a},6117:(t,e,r)=>{"use strict";var n=r(2140),i=r(8288),o=i.assert,s=i.cachedProperty,a=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=a(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof n&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}s(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},7983:t=>{t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},8288:(t,e,r)=>{"use strict";var n=e,i=r(2140),o=r(9561),s=r(3022);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),s=0;s<n.length;s++){var a,u=o.andln(i-1);o.isOdd()?(a=u>(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,f=e.andln(3)+o&3;3===u&&(u=-1),3===f&&(f=-1),s=0==(1&u)?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==f?u:-u,r[0].push(s),a=0==(1&f)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==u?f:-f,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},2140:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(488).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=f(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=f(t,h,t.length,e),h=0;h<s;h++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var f=1;f<n;f++){for(var h=u>>>26,c=67108863&u,l=Math.min(f,e.length-1),d=Math.max(0,f-t.length+1);d<=l;d++){var p=f-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[f]=0|c,u=0|h}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var f=c[t],d=l[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?y+r:h[f-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,f=new t(o),h=this.clone();if(u){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),f[a]=s;for(;a<o;a++)f[a]=0}else{for(a=0;a<o-i;a++)f[a]=0;for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),f[o-a-1]=s}return f},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,f=0,h=0|s[0],c=8191&h,l=h>>>13,d=0|s[1],p=8191&d,y=d>>>13,m=0|s[2],g=8191&m,b=m>>>13,v=0|s[3],w=8191&v,_=v>>>13,S=0|s[4],E=8191&S,M=S>>>13,k=0|s[5],A=8191&k,O=k>>>13,I=0|s[6],T=8191&I,x=I>>>13,P=0|s[7],B=8191&P,N=P>>>13,U=0|s[8],R=8191&U,L=U>>>13,C=0|s[9],j=8191&C,F=C>>>13,H=0|a[0],D=8191&H,q=H>>>13,z=0|a[1],$=8191&z,K=z>>>13,W=0|a[2],V=8191&W,G=W>>>13,X=0|a[3],J=8191&X,Z=X>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ht=0|a[8],ct=8191&ht,lt=ht>>>13,dt=0|a[9],pt=8191&dt,yt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(f+(n=Math.imul(c,D))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(l,D)|0))<<13)|0;f=((o=Math.imul(l,q))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,D),i=(i=Math.imul(p,q))+Math.imul(y,D)|0,o=Math.imul(y,q);var gt=(f+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,K)|0)+Math.imul(l,$)|0))<<13)|0;f=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,D),i=(i=Math.imul(g,q))+Math.imul(b,D)|0,o=Math.imul(b,q),n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,K)|0;var bt=(f+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(l,V)|0))<<13)|0;f=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,D),i=(i=Math.imul(w,q))+Math.imul(_,D)|0,o=Math.imul(_,q),n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,K)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,K)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,G)|0;var vt=(f+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(l,J)|0))<<13)|0;f=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(E,D),i=(i=Math.imul(E,q))+Math.imul(M,D)|0,o=Math.imul(M,q),n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Z)|0;var wt=(f+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;f=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,D),i=(i=Math.imul(A,q))+Math.imul(O,D)|0,o=Math.imul(O,q),n=n+Math.imul(E,$)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,K)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(g,J)|0,i=(i=i+Math.imul(g,Z)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0;var _t=(f+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(l,rt)|0))<<13)|0;f=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,D),i=(i=Math.imul(T,q))+Math.imul(x,D)|0,o=Math.imul(x,q),n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,K)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0;var St=(f+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(l,ot)|0))<<13)|0;f=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(B,D),i=(i=Math.imul(B,q))+Math.imul(N,D)|0,o=Math.imul(N,q),n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,K)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(E,J)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Z)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0;var Et=(f+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(l,ut)|0))<<13)|0;f=((o=o+Math.imul(l,ft)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,D),i=(i=Math.imul(R,q))+Math.imul(L,D)|0,o=Math.imul(L,q),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,K)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ft)|0;var Mt=(f+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;f=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(j,D),i=(i=Math.imul(j,q))+Math.imul(F,D)|0,o=Math.imul(F,q),n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,K)|0,n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ft)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ft)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var kt=(f+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,yt)|0)+Math.imul(l,pt)|0))<<13)|0;f=((o=o+Math.imul(l,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,K))+Math.imul(F,$)|0,o=Math.imul(F,K),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Z)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Z)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ft)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,lt)|0)+Math.imul(b,ct)|0,o=o+Math.imul(b,lt)|0;var At=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;f=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,G))+Math.imul(F,V)|0,o=Math.imul(F,G),n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ft)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ft)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var Ot=(f+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((o=o+Math.imul(b,yt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(j,J),i=(i=Math.imul(j,Z))+Math.imul(F,J)|0,o=Math.imul(F,Z),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ft)|0,n=n+Math.imul(E,ct)|0,i=(i=i+Math.imul(E,lt)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,lt)|0;var It=(f+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,yt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((o=o+Math.imul(_,yt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ft)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ft)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(O,ct)|0,o=o+Math.imul(O,lt)|0;var Tt=(f+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,yt)|0)+Math.imul(M,pt)|0))<<13)|0;f=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ft)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ft)|0,n=n+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(f+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,yt)|0)+Math.imul(O,pt)|0))<<13)|0;f=((o=o+Math.imul(O,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,ot),i=(i=Math.imul(j,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ft)|0,n=n+Math.imul(B,ct)|0,i=(i=i+Math.imul(B,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(f+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,yt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((o=o+Math.imul(x,yt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(j,ut),i=(i=Math.imul(j,ft))+Math.imul(F,ut)|0,o=Math.imul(F,ft),n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(L,ct)|0,o=o+Math.imul(L,lt)|0;var Bt=(f+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,yt)|0)+Math.imul(N,pt)|0))<<13)|0;f=((o=o+Math.imul(N,yt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,ct),i=(i=Math.imul(j,lt))+Math.imul(F,ct)|0,o=Math.imul(F,lt);var Nt=(f+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,yt)|0)+Math.imul(L,pt)|0))<<13)|0;f=((o=o+Math.imul(L,yt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Ut=(f+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,yt))+Math.imul(F,pt)|0))<<13)|0;return f=((o=Math.imul(F,yt))+(i>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,u[0]=mt,u[1]=gt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=St,u[7]=Et,u[8]=Mt,u[9]=kt,u[10]=At,u[11]=Ot,u[12]=It,u[13]=Tt,u[14]=xt,u[15]=Pt,u[16]=Bt,u[17]=Nt,u[18]=Ut,0!==f&&(u[19]=f,r.length++),r};function y(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),f=Math.max(0,o-t.length+1);f<=u;f++){var h=o-f,c=(0|t.words[h])*(0|e.words[f]),l=67108863&c;a=67108863&(l=l+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):y(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),f=Math.sin(2*Math.PI/a),h=0;h<i;h+=a)for(var c=u,l=f,d=0;d<s;d++){var p=r[h+d],y=n[h+d],m=r[h+d+s],g=n[h+d+s],b=c*m-l*g;g=c*g+l*m,m=b,r[h+d]=p+m,n[h+d]=y+g,r[h+d+s]=p-m,n[h+d+s]=y-g,d!==a&&(b=u*c-f*l,l=u*l+f*c,c=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),f=new Array(n),h=new Array(n),c=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,f,n),this.transform(s,o,a,u,n,i),this.transform(f,o,h,c,n,i);for(var d=0;d<n;d++){var p=a[d]*h[d]-u[d]*c[d];u[d]=a[d]*c[d]+u[d]*h[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),y(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var f=0;f<s;f++)u.words[f]=this.words[f];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,f=0;f<this.length;f++)this.words[f]=this.words[f+s];else this.words[0]=0,this.length=1;var h=0;for(f=this.length-1;f>=0&&(0!==h||f>=i);f--){var c=0|this.words[f];this.words[f]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var f=0;f<a.length;f++)a.words[f]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var c=u-1;c>=0;c--){var l=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),f=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++f;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(f)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new E(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(v,b),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,b),i(_,b),i(S,b),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return g[t]=e,e},E.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,f).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var y=d,m=0;0!==y.cmp(a);m++)y=y.redSqr();n(m<p);var g=this.pow(c,new o(1).iushln(p-m-1));l=l.redMul(g),c=g.redSqr(),d=d.redMul(c),p=m}return l},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var f=e.words[n],h=u-1;h>=0;h--){var c=f>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},2699:t=>{"use strict";var e,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}y(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&y(t,"error",e,{once:!0})}(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function f(t,e,r,n){var i,o,s,f;if(a(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=u(t))>0&&s.length>i&&!s.warned){s.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=s.length,f=h,console&&console.warn&&console.warn(f)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=h.bind(n);return i.listener=r,n.wrapFn=i,i}function l(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):p(i,i.length)}function d(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function y(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){n.once&&t.removeEventListener(e,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");s=t}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var i="error"===t,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)n(u,this,e);else{var f=u.length,h=p(u,f);for(r=0;r<f;++r)n(h[r],this,e)}return!0},o.prototype.addListener=function(t,e){return f(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return f(this,t,e,!0)},o.prototype.once=function(t,e){return a(e),this.on(t,c(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,c(this,t,e)),this},o.prototype.removeListener=function(t,e){var r,n,i,o,s;if(a(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},o.prototype.listeners=function(t){return l(this,t,!0)},o.prototype.rawListeners=function(t){return l(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},5232:(t,e,r)=>{"use strict";var n=r(7834).Buffer,i=r(7525).Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(1285)(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!n.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer")}(t),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=t[i++];this._update(),this._blockOffset=0}for(;i<t.length;)r[this._blockOffset++]=t[i++];for(var s=0,a=8*t.length;a>0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},4485:(t,e,r)=>{var n=e;n.utils=r(212),n.common=r(4495),n.sha=r(5530),n.ripemd=r(1396),n.hmac=r(5047),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},4495:(t,e,r)=>{"use strict";var n=r(212),i=r(9561);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=o,o.prototype.update=function(t,e){if(t=n.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n}},5047:(t,e,r)=>{"use strict";var n=r(212),i=r(9561);function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,e){return this.inner.update(t,e),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},1396:(t,e,r)=>{"use strict";var n=r(212),i=r(4495),o=n.rotl32,s=n.sum32,a=n.sum32_3,u=n.sum32_4,f=i.BlockHash;function h(){if(!(this instanceof h))return new h;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function c(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function l(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function d(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}n.inherits(h,f),e.ripemd160=h,h.blockSize=512,h.outSize=160,h.hmacStrength=192,h.padLength=64,h.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],f=this.h[3],h=this.h[4],b=r,v=n,w=i,_=f,S=h,E=0;E<80;E++){var M=s(o(u(r,c(E,n,i,f),t[p[E]+e],l(E)),m[E]),h);r=h,h=f,f=o(i,10),i=n,n=M,M=s(o(u(b,c(79-E,v,w,_),t[y[E]+e],d(E)),g[E]),S),b=S,S=_,_=o(w,10),w=v,v=M}M=a(this.h[1],i,_),this.h[1]=a(this.h[2],f,S),this.h[2]=a(this.h[3],h,b),this.h[3]=a(this.h[4],r,v),this.h[4]=a(this.h[0],n,w),this.h[0]=M},h.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],y=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],g=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},5530:(t,e,r)=>{"use strict";e.sha1=r(5079),e.sha224=r(3823),e.sha256=r(8032),e.sha384=r(5328),e.sha512=r(168)},5079:(t,e,r)=>{"use strict";var n=r(212),i=r(4495),o=r(713),s=n.rotl32,a=n.sum32,u=n.sum32_5,f=o.ft_1,h=i.BlockHash,c=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(l,h),t.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=s(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],h=this.h[2],l=this.h[3],d=this.h[4];for(n=0;n<r.length;n++){var p=~~(n/20),y=u(s(i,5),f(p,o,h,l),d,r[n],c[p]);d=l,l=h,h=s(o,30),o=i,i=y}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],h),this.h[3]=a(this.h[3],l),this.h[4]=a(this.h[4],d)},l.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},3823:(t,e,r)=>{"use strict";var n=r(212),i=r(8032);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},8032:(t,e,r)=>{"use strict";var n=r(212),i=r(4495),o=r(713),s=r(9561),a=n.sum32,u=n.sum32_4,f=n.sum32_5,h=o.ch32,c=o.maj32,l=o.s0_256,d=o.s1_256,p=o.g0_256,y=o.g1_256,m=i.BlockHash,g=[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];function b(){if(!(this instanceof b))return new b;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}n.inherits(b,m),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=u(y(r[n-2]),r[n-7],p(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],m=this.h[2],g=this.h[3],b=this.h[4],v=this.h[5],w=this.h[6],_=this.h[7];for(s(this.k.length===r.length),n=0;n<r.length;n++){var S=f(_,d(b),h(b,v,w),this.k[n],r[n]),E=a(l(i),c(i,o,m));_=w,w=v,v=b,b=a(g,S),g=m,m=o,o=i,i=a(S,E)}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],m),this.h[3]=a(this.h[3],g),this.h[4]=a(this.h[4],b),this.h[5]=a(this.h[5],v),this.h[6]=a(this.h[6],w),this.h[7]=a(this.h[7],_)},b.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},5328:(t,e,r)=>{"use strict";var n=r(212),i=r(168);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},168:(t,e,r)=>{"use strict";var n=r(212),i=r(4495),o=r(9561),s=n.rotr64_hi,a=n.rotr64_lo,u=n.shr64_hi,f=n.shr64_lo,h=n.sum64,c=n.sum64_hi,l=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,y=n.sum64_5_hi,m=n.sum64_5_lo,g=i.BlockHash,b=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function w(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function _(t,e,r,n,i,o){var s=e&n^~e&o;return s<0&&(s+=4294967296),s}function S(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function E(t,e,r,n,i,o){var s=e&n^e&o^n&o;return s<0&&(s+=4294967296),s}function M(t,e){var r=s(t,e,28)^s(e,t,2)^s(e,t,7);return r<0&&(r+=4294967296),r}function k(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function A(t,e){var r=a(t,e,14)^a(t,e,18)^a(e,t,9);return r<0&&(r+=4294967296),r}function O(t,e){var r=s(t,e,1)^s(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function I(t,e){var r=a(t,e,1)^a(t,e,8)^f(t,e,7);return r<0&&(r+=4294967296),r}function T(t,e){var r=a(t,e,19)^a(e,t,29)^f(t,e,6);return r<0&&(r+=4294967296),r}n.inherits(v,g),t.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=(m=r[n-4],g=r[n-3],b=void 0,(b=s(m,g,19)^s(g,m,29)^u(m,g,6))<0&&(b+=4294967296),b),o=T(r[n-4],r[n-3]),a=r[n-14],f=r[n-13],h=O(r[n-30],r[n-29]),c=I(r[n-30],r[n-29]),l=r[n-32],y=r[n-31];r[n]=d(i,o,a,f,h,c,l,y),r[n+1]=p(i,o,a,f,h,c,l,y)}var m,g,b},v.prototype._update=function(t,e){this._prepareBlock(t,e);var r,n,i,a=this.W,u=this.h[0],f=this.h[1],d=this.h[2],p=this.h[3],g=this.h[4],b=this.h[5],v=this.h[6],O=this.h[7],I=this.h[8],T=this.h[9],x=this.h[10],P=this.h[11],B=this.h[12],N=this.h[13],U=this.h[14],R=this.h[15];o(this.k.length===a.length);for(var L=0;L<a.length;L+=2){var C=U,j=R,F=(i=void 0,(i=s(r=I,n=T,14)^s(r,n,18)^s(n,r,9))<0&&(i+=4294967296),i),H=A(I,T),D=w(I,0,x,0,B),q=_(0,T,0,P,0,N),z=this.k[L],$=this.k[L+1],K=a[L],W=a[L+1],V=y(C,j,F,H,D,q,z,$,K,W),G=m(C,j,F,H,D,q,z,$,K,W);C=M(u,f),j=k(u,f),F=S(u,0,d,0,g),H=E(0,f,0,p,0,b);var X=c(C,j,F,H),J=l(C,j,F,H);U=B,R=N,B=x,N=P,x=I,P=T,I=c(v,O,V,G),T=l(O,O,V,G),v=g,O=b,g=d,b=p,d=u,p=f,u=c(V,G,X,J),f=l(V,G,X,J)}h(this.h,0,u,f),h(this.h,2,d,p),h(this.h,4,g,b),h(this.h,6,v,O),h(this.h,8,I,T),h(this.h,10,x,P),h(this.h,12,B,N),h(this.h,14,U,R)},v.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},713:(t,e,r)=>{"use strict";var n=r(212).rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function s(t,e,r){return t^e^r}e.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?s(e,r,n):2===t?o(e,r,n):void 0},e.ch32=i,e.maj32=o,e.p32=s,e.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},e.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},e.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},e.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},212:(t,e,r)=>{"use strict";var n=r(9561),i=r(1285);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var s=t.charCodeAt(i);s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=63&s|128):o(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i<t.length;i++)r[i]=0|t[i];return r},e.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=a(t[r].toString(16));return e},e.htonl=s,e.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];"little"===e&&(i=s(i)),r+=u(i.toString(16))}return r},e.zero2=a,e.zero8=u,e.join32=function(t,e,r,i){var o=r-e;n(o%4==0);for(var s=new Array(o/4),a=0,u=e;a<s.length;a++,u+=4){var f;f="big"===i?t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],s[a]=f>>>0}return s},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|t>>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o<n?1:0)+r+i;t[e]=s>>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,s,a){var u=0,f=e;return u+=(f=f+n>>>0)<e?1:0,u+=(f=f+o>>>0)<o?1:0,t+r+i+s+(u+=(f=f+a>>>0)<a?1:0)>>>0},e.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,s,a,u,f){var h=0,c=e;return h+=(c=c+n>>>0)<e?1:0,h+=(c=c+o>>>0)<o?1:0,h+=(c=c+a>>>0)<a?1:0,t+r+i+s+u+(h+=(c=c+f>>>0)<f?1:0)>>>0},e.sum64_5_lo=function(t,e,r,n,i,o,s,a,u,f){return e+n+o+a+f>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},8873:(t,e,r)=>{"use strict";var n=r(4485),i=r(3022),o=r(9561);function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex"),n=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}t.exports=s,s.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},s.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},s.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},s.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=i.toArray(t,e),r=i.toArray(r,n),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},s.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<t;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var s=o.slice(0,t);return this._update(r),this._reseed++,i.encode(s,e)}},2333:(t,e)=>{e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,f=u>>1,h=-7,c=r?i-1:0,l=r?-1:1,d=t[e+c];for(c+=l,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+t[e+c],c+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+c],c+=l,h-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=f}return(d?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,f=8*o-i-1,h=(1<<f)-1,c=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(e*u-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,f+=i;f>0;t[r+d]=255&s,d+=p,s/=256,f-=8);t[r+d-p]|=128*y}},1285:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},9996:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7650);e.SECP256K1Client=n.SECP256K1Client;const i={ES256K:n.SECP256K1Client};e.cryptoClients=i},7650:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(7554),o=r(6120),s=r(8643);class a{constructor(){}static loadPrivateKey(t){return 66===t.length&&(t=t.slice(0,64)),a.ec.keyFromPrivate(t)}static loadPublicKey(t){return a.ec.keyFromPublic(t,"hex")}static derivePublicKey(t,e=!0){if("string"!=typeof t)throw Error("private key must be a string");if(!/^[0-9A-F]+$/i.test(t))throw Error("private key must be a hex string");if(66==t.length)t=t.slice(0,64);else if(!(t.length<=64))throw Error("private key must be 66 characters or less");return a.ec.keyFromPrivate(t).getPublic(e,"hex")}static signHash(t,e,r="jose"){if(!t||!e)throw new s.MissingParametersError("a signing input hash and private key are all required");const i=a.loadPrivateKey(e).sign(t),u=n.from(i.toDER());if("der"===r)return u.toString("hex");if("jose"===r)return o.derToJose(u,"ES256");throw Error("Invalid signature format")}static loadSignature(t){return o.joseToDer(t,"ES256")}static verifyHash(t,e,r){if(!(t&&e&&r))throw new s.MissingParametersError("a signing input hash, der signature, and public key are all required");return a.loadPublicKey(r).verify(t,e)}}e.SECP256K1Client=a,a.ec=new i.ec("secp256k1"),a.algorithmName="ES256K"},874:function(t,e,r){"use strict";var n=r(8834).Buffer,i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const o=r(9065);function s(t){return(new o.sha256).update(t).digest()}e.hashSha256=s,e.hashSha256Async=function(t){return i(this,void 0,void 0,(function*(){try{if("undefined"!=typeof crypto&&void 0!==crypto.subtle){const e="string"==typeof t?n.from(t):t,r=yield crypto.subtle.digest("SHA-256",e);return n.from(r)}{const e=r(1812);if(!e.createHash)throw new Error("`crypto` module does not contain `createHash`");return Promise.resolve(e.createHash("sha256").update(t).digest())}}catch(e){return console.log(e),console.log('Crypto lib not found. Neither the global `crypto.subtle` Web Crypto API, nor the or the Node.js `require("crypto").createHash` module is available. Falling back to JS implementation.'),Promise.resolve(s(t))}}))}},8917:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(9487);e.decodeToken=function(t){if("string"==typeof t){const e=t.split(".");return{header:JSON.parse(n.default.decode(e[0])),payload:JSON.parse(n.default.decode(e[1])),signature:e[2]}}if("object"==typeof t){if("string"!=typeof t.payload)throw new Error("Expected token payload to be a base64 or json string");let e=t.payload;"{"!==t.payload[0]&&(e=n.default.decode(e));const r=[];return t.header.map((t=>{const e=JSON.parse(n.default.decode(t));r.push(e)})),{header:r,payload:JSON.parse(e),signature:t.signature}}}},8643:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});class r extends Error{constructor(t){super(),this.name="MissingParametersError",this.message=t||""}}e.MissingParametersError=r;class n extends Error{constructor(t){super(),this.name="InvalidTokenError",this.message=t||""}}e.InvalidTokenError=n},7474:(t,e,r)=>{"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(5650)),n(r(7458)),n(r(8917)),n(r(8643)),n(r(9996))},5650:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const i=r(9487),o=r(9996),s=r(8643),a=r(874);function u(t,e){const r=[],n=i.default.encode(JSON.stringify(e));r.push(n);const o=i.default.encode(JSON.stringify(t));return r.push(o),r.join(".")}e.createUnsecuredToken=function(t){return u(t,{typ:"JWT",alg:"none"})+"."},e.TokenSigner=class{constructor(t,e){if(!t||!e)throw new s.MissingParametersError("a signing algorithm and private key are required");if("string"!=typeof t)throw new Error("signing algorithm parameter must be a string");if(t=t.toUpperCase(),!o.cryptoClients.hasOwnProperty(t))throw new Error("invalid signing algorithm");this.tokenType="JWT",this.cryptoClient=o.cryptoClients[t],this.rawPrivateKey=e}header(t={}){const e={typ:this.tokenType,alg:this.cryptoClient.algorithmName};return Object.assign({},e,t)}sign(t,e=!1,r={}){const n=this.header(r),i=u(t,n),o=a.hashSha256(i);return this.createWithSignedHash(t,e,n,i,o)}signAsync(t,e=!1,r={}){return n(this,void 0,void 0,(function*(){const n=this.header(r),i=u(t,n),o=yield a.hashSha256Async(i);return this.createWithSignedHash(t,e,n,i,o)}))}createWithSignedHash(t,e,r,n,o){const s=this.cryptoClient.signHash(o,this.rawPrivateKey);return e?{header:[i.default.encode(JSON.stringify(r))],payload:JSON.stringify(t),signature:[s]}:[n,s].join(".")}}},7458:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(9487),i=r(9996),o=r(8643),s=r(874);e.TokenVerifier=class{constructor(t,e){if(!t||!e)throw new o.MissingParametersError("a signing algorithm and public key are required");if("string"!=typeof t)throw"signing algorithm parameter must be a string";if(t=t.toUpperCase(),!i.cryptoClients.hasOwnProperty(t))throw"invalid signing algorithm";this.tokenType="JWT",this.cryptoClient=i.cryptoClients[t],this.rawPublicKey=e}verify(t){return"string"==typeof t?this.verifyCompact(t,!1):"object"==typeof t?this.verifyExpanded(t,!1):void 0}verifyAsync(t){return"string"==typeof t?this.verifyCompact(t,!0):"object"==typeof t?this.verifyExpanded(t,!0):Promise.resolve(!1)}verifyCompact(t,e){const r=t.split("."),n=r[0]+"."+r[1],i=t=>{const e=this.cryptoClient.loadSignature(r[2]);return this.cryptoClient.verifyHash(t,e,this.rawPublicKey)};if(e)return s.hashSha256Async(n).then((t=>i(t)));{const t=s.hashSha256(n);return i(t)}}verifyExpanded(t,e){const r=[t.header.join("."),n.default.encode(t.payload)].join(".");let i=!0;const o=e=>(t.signature.map((t=>{const r=this.cryptoClient.loadSignature(t);this.cryptoClient.verifyHash(e,r,this.rawPublicKey)||(i=!1)})),i);if(e)return s.hashSha256Async(r).then((t=>o(t)));{const t=s.hashSha256(r);return o(t)}}}},9907:(t,e,r)=>{t=r.nmd(t);var n="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Boolean]",a="[object Date]",u="[object Function]",f="[object GeneratorFunction]",h="[object Map]",c="[object Number]",l="[object Object]",d="[object Promise]",p="[object RegExp]",y="[object Set]",m="[object String]",g="[object Symbol]",b="[object WeakMap]",v="[object ArrayBuffer]",w="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",E="[object Int8Array]",M="[object Int16Array]",k="[object Int32Array]",A="[object Uint8Array]",O="[object Uint8ClampedArray]",I="[object Uint16Array]",T="[object Uint32Array]",x=/\w*$/,P=/^\[object .+?Constructor\]$/,B=/^(?:0|[1-9]\d*)$/,N={};N[o]=N["[object Array]"]=N[v]=N[w]=N[s]=N[a]=N[_]=N[S]=N[E]=N[M]=N[k]=N[h]=N[c]=N[l]=N[p]=N[y]=N[m]=N[g]=N[A]=N[O]=N[I]=N[T]=!0,N["[object Error]"]=N[u]=N[b]=!1;var U="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,R="object"==typeof self&&self&&self.Object===Object&&self,L=U||R||Function("return this")(),C=e&&!e.nodeType&&e,j=C&&t&&!t.nodeType&&t,F=j&&j.exports===C;function H(t,e){return t.set(e[0],e[1]),t}function D(t,e){return t.add(e),t}function q(t,e,r,n){var i=-1,o=t?t.length:0;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}function z(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function $(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function K(t,e){return function(r){return t(e(r))}}function W(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var V,G=Array.prototype,X=Function.prototype,J=Object.prototype,Z=L["__core-js_shared__"],Y=(V=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"",Q=X.toString,tt=J.hasOwnProperty,et=J.toString,rt=RegExp("^"+Q.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=F?L.Buffer:void 0,it=L.Symbol,ot=L.Uint8Array,st=K(Object.getPrototypeOf,Object),at=Object.create,ut=J.propertyIsEnumerable,ft=G.splice,ht=Object.getOwnPropertySymbols,ct=nt?nt.isBuffer:void 0,lt=K(Object.keys,Object),dt=Lt(L,"DataView"),pt=Lt(L,"Map"),yt=Lt(L,"Promise"),mt=Lt(L,"Set"),gt=Lt(L,"WeakMap"),bt=Lt(Object,"create"),vt=Dt(dt),wt=Dt(pt),_t=Dt(yt),St=Dt(mt),Et=Dt(gt),Mt=it?it.prototype:void 0,kt=Mt?Mt.valueOf:void 0;function At(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Ot(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function It(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Tt(t){this.__data__=new Ot(t)}function xt(t,e,r){var n=t[e];tt.call(t,e)&&qt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function Pt(t,e){for(var r=t.length;r--;)if(qt(t[r][0],e))return r;return-1}function Bt(t,e,r,n,i,d,b){var P;if(n&&(P=d?n(t,i,d,b):n(t)),void 0!==P)return P;if(!Vt(t))return t;var B=zt(t);if(B){if(P=function(t){var e=t.length,r=t.constructor(e);return e&&"string"==typeof t[0]&&tt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!e)return function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}(t,P)}else{var U=jt(t),R=U==u||U==f;if(Kt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(U==l||U==o||R&&!d){if(z(t))return d?t:{};if(P=function(t){return"function"!=typeof t.constructor||Ht(t)?{}:Vt(e=st(t))?at(e):{};var e}(R?{}:t),!e)return function(t,e){return Ut(t,Ct(t),e)}(t,function(t,e){return t&&Ut(e,Gt(e),t)}(P,t))}else{if(!N[U])return d?t:{};P=function(t,e,r,n){var i,o=t.constructor;switch(e){case v:return Nt(t);case s:case a:return new o(+t);case w:return function(t,e){var r=e?Nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case _:case S:case E:case M:case k:case A:case O:case I:case T:return function(t,e){var r=e?Nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case h:return function(t,e,r){return q(e?r($(t),!0):$(t),H,new t.constructor)}(t,n,r);case c:case m:return new o(t);case p:return function(t){var e=new t.constructor(t.source,x.exec(t));return e.lastIndex=t.lastIndex,e}(t);case y:return function(t,e,r){return q(e?r(W(t),!0):W(t),D,new t.constructor)}(t,n,r);case g:return i=t,kt?Object(kt.call(i)):{}}}(t,U,Bt,e)}}b||(b=new Tt);var L=b.get(t);if(L)return L;if(b.set(t,P),!B)var C=r?function(t){return function(t,e,r){var n=e(t);return zt(t)?n:function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}(n,r(t))}(t,Gt,Ct)}(t):Gt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r););}(C||t,(function(i,o){C&&(i=t[o=i]),xt(P,o,Bt(i,e,r,n,o,t,b))})),P}function Nt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Ut(t,e,r,n){r||(r={});for(var i=-1,o=e.length;++i<o;){var s=e[i],a=n?n(r[s],t[s],s,r,t):void 0;xt(r,s,void 0===a?t[s]:a)}return r}function Rt(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function Lt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Vt(t)||(e=t,Y&&Y in e))&&(Wt(t)||z(t)?rt:P).test(Dt(t));var e}(r)?r:void 0}At.prototype.clear=function(){this.__data__=bt?bt(null):{}},At.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},At.prototype.get=function(t){var e=this.__data__;if(bt){var r=e[t];return r===n?void 0:r}return tt.call(e,t)?e[t]:void 0},At.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:tt.call(e,t)},At.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?n:e,this},Ot.prototype.clear=function(){this.__data__=[]},Ot.prototype.delete=function(t){var e=this.__data__,r=Pt(e,t);return!(r<0||(r==e.length-1?e.pop():ft.call(e,r,1),0))},Ot.prototype.get=function(t){var e=this.__data__,r=Pt(e,t);return r<0?void 0:e[r][1]},Ot.prototype.has=function(t){return Pt(this.__data__,t)>-1},Ot.prototype.set=function(t,e){var r=this.__data__,n=Pt(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},It.prototype.clear=function(){this.__data__={hash:new At,map:new(pt||Ot),string:new At}},It.prototype.delete=function(t){return Rt(this,t).delete(t)},It.prototype.get=function(t){return Rt(this,t).get(t)},It.prototype.has=function(t){return Rt(this,t).has(t)},It.prototype.set=function(t,e){return Rt(this,t).set(t,e),this},Tt.prototype.clear=function(){this.__data__=new Ot},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Ot){var n=r.__data__;if(!pt||n.length<199)return n.push([t,e]),this;r=this.__data__=new It(n)}return r.set(t,e),this};var Ct=ht?K(ht,Object):function(){return[]},jt=function(t){return et.call(t)};function Ft(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||B.test(t))&&t>-1&&t%1==0&&t<e}function Ht(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||J)}function Dt(t){if(null!=t){try{return Q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function qt(t,e){return t===e||t!=t&&e!=e}(dt&&jt(new dt(new ArrayBuffer(1)))!=w||pt&&jt(new pt)!=h||yt&&jt(yt.resolve())!=d||mt&&jt(new mt)!=y||gt&&jt(new gt)!=b)&&(jt=function(t){var e=et.call(t),r=e==l?t.constructor:void 0,n=r?Dt(r):void 0;if(n)switch(n){case vt:return w;case wt:return h;case _t:return d;case St:return y;case Et:return b}return e});var zt=Array.isArray;function $t(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Wt(t)}var Kt=ct||function(){return!1};function Wt(t){var e=Vt(t)?et.call(t):"";return e==u||e==f}function Vt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Gt(t){return $t(t)?function(t,e){var r=zt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&$t(t)}(t)&&tt.call(t,"callee")&&(!ut.call(t,"callee")||et.call(t)==o)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,i=!!n;for(var s in t)!e&&!tt.call(t,s)||i&&("length"==s||Ft(s,n))||r.push(s);return r}(t):function(t){if(!Ht(t))return lt(t);var e=[];for(var r in Object(t))tt.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return Bt(t,!0,!0)}},7993:(t,e,r)=>{"use strict";var n=r(1285),i=r(5232),o=r(7834).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<<e|t>>>32-e}function f(t,e,r,n,i,o,s){return u(t+(e&r|~e&n)+i+o|0,s)+e|0}function h(t,e,r,n,i,o,s){return u(t+(e&n|r&~n)+i+o|0,s)+e|0}function c(t,e,r,n,i,o,s){return u(t+(e^r^n)+i+o|0,s)+e|0}function l(t,e,r,n,i,o,s){return u(t+(r^(e|~n))+i+o|0,s)+e|0}n(a,i),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=f(r,n,i,o,t[0],3614090360,7),o=f(o,r,n,i,t[1],3905402710,12),i=f(i,o,r,n,t[2],606105819,17),n=f(n,i,o,r,t[3],3250441966,22),r=f(r,n,i,o,t[4],4118548399,7),o=f(o,r,n,i,t[5],1200080426,12),i=f(i,o,r,n,t[6],2821735955,17),n=f(n,i,o,r,t[7],4249261313,22),r=f(r,n,i,o,t[8],1770035416,7),o=f(o,r,n,i,t[9],2336552879,12),i=f(i,o,r,n,t[10],4294925233,17),n=f(n,i,o,r,t[11],2304563134,22),r=f(r,n,i,o,t[12],1804603682,7),o=f(o,r,n,i,t[13],4254626195,12),i=f(i,o,r,n,t[14],2792965006,17),r=h(r,n=f(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=h(o,r,n,i,t[6],3225465664,9),i=h(i,o,r,n,t[11],643717713,14),n=h(n,i,o,r,t[0],3921069994,20),r=h(r,n,i,o,t[5],3593408605,5),o=h(o,r,n,i,t[10],38016083,9),i=h(i,o,r,n,t[15],3634488961,14),n=h(n,i,o,r,t[4],3889429448,20),r=h(r,n,i,o,t[9],568446438,5),o=h(o,r,n,i,t[14],3275163606,9),i=h(i,o,r,n,t[3],4107603335,14),n=h(n,i,o,r,t[8],1163531501,20),r=h(r,n,i,o,t[13],2850285829,5),o=h(o,r,n,i,t[2],4243563512,9),i=h(i,o,r,n,t[7],1735328473,14),r=c(r,n=h(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=c(o,r,n,i,t[8],2272392833,11),i=c(i,o,r,n,t[11],1839030562,16),n=c(n,i,o,r,t[14],4259657740,23),r=c(r,n,i,o,t[1],2763975236,4),o=c(o,r,n,i,t[4],1272893353,11),i=c(i,o,r,n,t[7],4139469664,16),n=c(n,i,o,r,t[10],3200236656,23),r=c(r,n,i,o,t[13],681279174,4),o=c(o,r,n,i,t[0],3936430074,11),i=c(i,o,r,n,t[3],3572445317,16),n=c(n,i,o,r,t[6],76029189,23),r=c(r,n,i,o,t[9],3654602809,4),o=c(o,r,n,i,t[12],3873151461,11),i=c(i,o,r,n,t[15],530742520,16),r=l(r,n=c(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=l(o,r,n,i,t[7],1126891415,10),i=l(i,o,r,n,t[14],2878612391,15),n=l(n,i,o,r,t[5],4237533241,21),r=l(r,n,i,o,t[12],1700485571,6),o=l(o,r,n,i,t[3],2399980690,10),i=l(i,o,r,n,t[10],4293915773,15),n=l(n,i,o,r,t[1],2240044497,21),r=l(r,n,i,o,t[8],1873313359,6),o=l(o,r,n,i,t[15],4264355552,10),i=l(i,o,r,n,t[6],2734768916,15),n=l(n,i,o,r,t[13],1309151649,21),r=l(r,n,i,o,t[4],4149444226,6),o=l(o,r,n,i,t[11],3174756917,10),i=l(i,o,r,n,t[2],718787259,15),n=l(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},7332:(t,e,r)=>{var n=r(8834).Buffer;t.exports=function(t,e){if(!Array.isArray(t))throw TypeError("Expected values Array");if("function"!=typeof e)throw TypeError("Expected digest Function");for(var r=t.length,i=t.concat();r>1;){for(var o=0,s=0;s<r;s+=2,++o){var a=i[s],u=s+1===r?a:i[s+1],f=n.concat([a,u]);i[o]=e(f)}r=o}return i[0]}},9561:t=>{function e(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=e,e.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},3022:(t,e)=>{"use strict";var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16));else for(n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}},4406:t=>{var e,r,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var a,u=[],f=!1,h=-1;function c(){f&&a&&(f=!1,a.length?u=a.concat(u):h=-1,u.length&&l())}function l(){if(!f){var t=s(c);f=!0;for(var e=u.length;e;){for(a=u,u=[];++h<e;)a&&a[h].run();h=-1,e=u.length}a=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function p(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new d(t,e)),1!==u.length||f||s(l)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},7131:(t,e,r)=>{var n=r(196);function i(t){return t<n.OP_PUSHDATA1?1:t<=255?2:t<=65535?3:5}t.exports={encodingLength:i,encode:function(t,e,r){var o=i(e);return 1===o?t.writeUInt8(e,r):2===o?(t.writeUInt8(n.OP_PUSHDATA1,r),t.writeUInt8(e,r+1)):3===o?(t.writeUInt8(n.OP_PUSHDATA2,r),t.writeUInt16LE(e,r+1)):(t.writeUInt8(n.OP_PUSHDATA4,r),t.writeUInt32LE(e,r+1)),o},decode:function(t,e){var r,i,o=t.readUInt8(e);if(o<n.OP_PUSHDATA1)r=o,i=1;else if(o===n.OP_PUSHDATA1){if(e+2>t.length)return null;r=t.readUInt8(e+1),i=2}else if(o===n.OP_PUSHDATA2){if(e+3>t.length)return null;r=t.readUInt16LE(e+1),i=3}else{if(e+5>t.length)return null;if(o!==n.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=t.readUInt32LE(e+1),i=5}return{opcode:o,number:r,size:i}}}},5003:(t,e,r)=>{"use strict";var n=r(4406),i=65536,o=r(7834).Buffer,s=r.g.crypto||r.g.msCrypto;s&&s.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var r=o.allocUnsafe(t);if(t>0)if(t>i)for(var a=0;a<t;a+=i)s.getRandomValues(r.slice(a,a+i));else s.getRandomValues(r);return"function"==typeof e?n.nextTick((function(){e(null,r)})):r}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}},4452:t=>{"use strict";var e={};function r(t,r,n){n||(n=Error);var i=function(t){var e,n;function i(e,n,i){return t.call(this,function(t,e,n){return"string"==typeof r?r:r(t,e,n)}(e,n,i))||this}return n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=t,e[t]=i}function n(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}r("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,o,s,a,u;if("string"==typeof e&&(o="not ",e.substr(0,o.length)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(n(e,"type"));else{var f=("number"!=typeof u&&(u=0),u+".".length>(a=t).length||-1===a.indexOf(".",u)?"argument":"property");s='The "'.concat(t,'" ').concat(f," ").concat(i," ").concat(n(e,"type"))}return s+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},7073:(t,e,r)=>{"use strict";var n=r(4406),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var o=r(8051),s=r(2557);r(1285)(h,o);for(var a=i(s.prototype),u=0;u<a.length;u++){var f=a[u];h.prototype[f]||(h.prototype[f]=s.prototype[f])}function h(t){if(!(this instanceof h))return new h(t);o.call(this,t),s.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",c)))}function c(){this._writableState.ended||n.nextTick(l,this)}function l(t){t.end()}Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(h.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(h.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(h.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})},5163:(t,e,r)=>{"use strict";t.exports=i;var n=r(7640);function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}r(1285)(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},8051:(t,e,r)=>{"use strict";var n,i=r(4406);t.exports=k,k.ReadableState=M,r(2699).EventEmitter;var o,s=function(t,e){return t.listeners(e).length},a=r(5010),u=r(8834).Buffer,f=r.g.Uint8Array||function(){},h=r(6602);o=h&&h.debuglog?h.debuglog("stream"):function(){};var c,l,d,p=r(6637),y=r(2262),m=r(7605).getHighWaterMark,g=r(4452).q,b=g.ERR_INVALID_ARG_TYPE,v=g.ERR_STREAM_PUSH_AFTER_EOF,w=g.ERR_METHOD_NOT_IMPLEMENTED,_=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(1285)(k,a);var S=y.errorOrDestroy,E=["error","close","destroy","pause","resume"];function M(t,e,i){n=n||r(7073),t=t||{},"boolean"!=typeof i&&(i=e instanceof n),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(c||(c=r(214).s),this.decoder=new c(t.encoding),this.encoding=t.encoding)}function k(t){if(n=n||r(7073),!(this instanceof k))return new k(t);var e=this instanceof n;this._readableState=new M(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function A(t,e,r,n,i){o("readableAddChunk",e);var s,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(o("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?x(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,P(t)))}}(t,a);else if(i||(s=function(t,e){var r,n;return n=e,u.isBuffer(n)||n instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e)),r}(a,e)),s)S(t,s);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),n)a.endEmitted?S(t,new _):O(t,a,e,!0);else if(a.ended)S(t,new v);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?O(t,a,e,!1):B(t,a)):O(t,a,e,!1)}else n||(a.reading=!1,B(t,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function O(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&x(t)),B(t,e)}Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),k.prototype.destroy=y.destroy,k.prototype._undestroy=y.undestroy,k.prototype._destroy=function(t,e){e(t)},k.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=u.from(t,e),e=""),r=!0),A(this,t,e,!1,r)},k.prototype.unshift=function(t){return A(this,t,null,!0,!1)},k.prototype.isPaused=function(){return!1===this._readableState.flowing},k.prototype.setEncoding=function(t){c||(c=r(214).s);var e=new c(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=e.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var I=1073741824;function T(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=I?t=I:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function x(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(P,t))}function P(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,C(t)}function B(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(N,t,e))}function N(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(o("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function U(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function R(t){o("readable nexttick read 0"),t.read(0)}function L(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),C(t),e.flowing&&!e.reading&&t.read(0)}function C(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function j(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function F(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(H,e,t))}function H(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function D(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}k.prototype.read=function(t){o("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?F(this):x(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&F(this),null;var n,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&o("length less than watermark",i=!0),e.ended||e.reading?o("reading or ended",i=!1):i&&(o("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=T(r,e))),null===(n=t>0?j(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&F(this)),null!==n&&this.emit("data",n),n},k.prototype._read=function(t){S(this,new w("_read()"))},k.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,o("pipe count=%d opts=%j",n.pipesCount,e);var a=e&&!1===e.end||t===i.stdout||t===i.stderr?y:u;function u(){o("onend"),t.end()}n.endEmitted?i.nextTick(a):r.once("end",a),t.on("unpipe",(function e(i,s){o("onunpipe"),i===r&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",f),t.removeListener("error",l),t.removeListener("unpipe",e),r.removeListener("end",u),r.removeListener("end",y),r.removeListener("data",c),h=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}));var f=function(t){return function(){var e=t._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,C(t))}}(r);t.on("drain",f);var h=!1;function c(e){o("ondata");var i=t.write(e);o("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==D(n.pipes,t))&&!h&&(o("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function l(e){o("onerror",e),y(),t.removeListener("error",l),0===s(t,"error")&&S(t,e)}function d(){t.removeListener("finish",p),y()}function p(){o("onfinish"),t.removeListener("close",d),y()}function y(){o("unpipe"),r.unpipe(t)}return r.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events.error?Array.isArray(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on(e,r)}(t,"error",l),t.once("close",d),t.once("finish",p),t.emit("pipe",r),n.flowing||(o("pipe resume"),r.resume()),t},k.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=D(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},k.prototype.on=function(t,e){var r=a.prototype.on.call(this,t,e),n=this._readableState;return"data"===t?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,o("on readable",n.length,n.reading),n.length?x(this):n.reading||i.nextTick(R,this))),r},k.prototype.addListener=k.prototype.on,k.prototype.removeListener=function(t,e){var r=a.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(U,this),r},k.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(U,this),e},k.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(L,t,e))}(this,t)),t.paused=!1,this},k.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},k.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(o("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s<E.length;s++)t.on(E[s],this.emit.bind(this,E[s]));return this._read=function(e){o("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(k.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=r(1029)),l(this)}),Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(k.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(k.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),k._fromList=j,Object.defineProperty(k.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(k.from=function(t,e){return void 0===d&&(d=r(352)),d(k,t,e)})},7640:(t,e,r)=>{"use strict";t.exports=h;var n=r(4452).q,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(7073);function f(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function h(t){if(!(this instanceof h))return new h(t);u.call(this,t),this._transformState={afterTransform:f.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",c)}function c(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?l(this,null,null):this._flush((function(e,r){l(t,e,r)}))}function l(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new a;if(t._transformState.transforming)throw new s;return t.push(null)}r(1285)(h,u),h.prototype.push=function(t,e){return this._transformState.needTransform=!1,u.prototype.push.call(this,t,e)},h.prototype._transform=function(t,e,r){r(new i("_transform()"))},h.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},h.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},h.prototype._destroy=function(t,e){u.prototype._destroy.call(this,t,(function(t){e(t)}))}},2557:(t,e,r)=>{"use strict";var n,i=r(4406);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(undefined),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=k,k.WritableState=M;var s,a={deprecate:r(5803)},u=r(5010),f=r(8834).Buffer,h=r.g.Uint8Array||function(){},c=r(2262),l=r(7605).getHighWaterMark,d=r(4452).q,p=d.ERR_INVALID_ARG_TYPE,y=d.ERR_METHOD_NOT_IMPLEMENTED,m=d.ERR_MULTIPLE_CALLBACK,g=d.ERR_STREAM_CANNOT_PIPE,b=d.ERR_STREAM_DESTROYED,v=d.ERR_STREAM_NULL_VALUES,w=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,S=c.errorOrDestroy;function E(){}function M(t,e,s){n=n||r(7073),t=t||{},"boolean"!=typeof s&&(s=e instanceof n),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=l(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,o=r.writecb;if("function"!=typeof o)throw new m;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,o){--e.pendingcb,r?(i.nextTick(o,n),i.nextTick(P,t,e),t._writableState.errorEmitted=!0,S(t,n)):(o(n),t._writableState.errorEmitted=!0,S(t,n),P(t,e))}(t,r,n,e,o);else{var s=T(r)||t.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||I(t,r),n?i.nextTick(O,t,r,s,o):O(t,r,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function k(t){var e=this instanceof(n=n||r(7073));if(!e&&!s.call(k,this))return new k(t);this._writableState=new M(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function A(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function O(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),P(t,e)}function I(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),s=e.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,A(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,h=r.encoding,c=r.callback;if(A(t,e,!1,e.objectMode?1:f.length,f,h,c),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function T(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final((function(r){e.pendingcb--,r&&S(t,r),e.prefinished=!0,t.emit("prefinish"),P(t,e)}))}function P(t,e){var r=T(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,i.nextTick(x,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var n=t._readableState;(!n||n.autoDestroy&&n.endEmitted)&&t.destroy()}return r}r(1285)(k,u),M.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(M.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===k&&t&&t._writableState instanceof M}})):s=function(t){return t instanceof this},k.prototype.pipe=function(){S(this,new g)},k.prototype.write=function(t,e,r){var n,o=this._writableState,s=!1,a=!o.objectMode&&(n=t,f.isBuffer(n)||n instanceof h);return a&&!f.isBuffer(t)&&(t=function(t){return f.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=E),o.ending?function(t,e){var r=new w;S(t,r),i.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var o;return null===r?o=new v:"string"==typeof r||e.objectMode||(o=new p("chunk",["string","Buffer"],r)),!o||(S(t,o),i.nextTick(n,o),!1)}(this,o,t,r))&&(o.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=f.from(e,r)),e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length<e.highWaterMark;if(u||(e.needDrain=!0),e.writing||e.corked){var h=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},h?h.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else A(t,e,!1,a,n,i,o);return u}(this,o,a,t,e,r)),s},k.prototype.cork=function(){this._writableState.corked++},k.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||I(this,t))},k.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),k.prototype._write=function(t,e,r){r(new y("_write()"))},k.prototype._writev=null,k.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,P(t,e),r&&(e.finished?i.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),k.prototype.destroy=c.destroy,k.prototype._undestroy=c.undestroy,k.prototype._destroy=function(t,e){e(t)}},1029:(t,e,r)=>{"use strict";var n,i=r(4406);function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s=r(9885),a=Symbol("lastResolve"),u=Symbol("lastReject"),f=Symbol("error"),h=Symbol("ended"),c=Symbol("lastPromise"),l=Symbol("handlePromise"),d=Symbol("stream");function p(t,e){return{value:t,done:e}}function y(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[c]=null,t[a]=null,t[u]=null,e(p(r,!1)))}}function m(t){i.nextTick(y,t)}var g=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(n={get stream(){return this[d]},next:function(){var t=this,e=this[f];if(null!==e)return Promise.reject(e);if(this[h])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(e,r){i.nextTick((function(){t[f]?r(t[f]):e(p(void 0,!0))}))}));var r,n=this[c];if(n)r=new Promise(function(t,e){return function(r,n){t.then((function(){e[h]?r(p(void 0,!0)):e[l](r,n)}),n)}}(n,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));r=new Promise(this[l])}return this[c]=r,r}},Symbol.asyncIterator,(function(){return this})),o(n,"return",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(p(void 0,!0))}))}))})),n),g);t.exports=function(t){var e,r=Object.create(b,(o(e={},d,{value:t,writable:!0}),o(e,a,{value:null,writable:!0}),o(e,u,{value:null,writable:!0}),o(e,f,{value:null,writable:!0}),o(e,h,{value:t._readableState.endEmitted,writable:!0}),o(e,l,{value:function(t,e){var n=r[d].read();n?(r[c]=null,r[a]=null,r[u]=null,t(p(n,!1))):(r[a]=t,r[u]=e)},writable:!0}),e));return r[c]=null,s(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[u];return null!==e&&(r[c]=null,r[a]=null,r[u]=null,e(t)),void(r[f]=t)}var n=r[a];null!==n&&(r[c]=null,r[a]=null,r[u]=null,n(p(void 0,!0))),r[h]=!0})),t.on("readable",m.bind(null,r)),r}},6637:(t,e,r)=>{"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var s=r(8834).Buffer,a=r(4854).inspect,u=a&&a.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r;return e=t,r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e,r,n,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=i,n=a,s.prototype.copy.call(e,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:u,value:function(t,e){return a(this,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}],r&&o(e.prototype,r),t}()},2262:(t,e,r)=>{"use strict";var n=r(4406);function i(t,e){s(t,e),o(t)}function o(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(s,this,t)):n.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?r._writableState?r._writableState.errorEmitted?n.nextTick(o,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,t)):n.nextTick(i,r,t):e?(n.nextTick(o,r),e(t)):n.nextTick(o,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}}},9885:(t,e,r)=>{"use strict";var n=r(4452).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var s=r.readable||!1!==r.readable&&e.readable,a=r.writable||!1!==r.writable&&e.writable,u=function(){e.writable||h()},f=e._writableState&&e._writableState.finished,h=function(){a=!1,f=!0,s||o.call(e)},c=e._readableState&&e._readableState.endEmitted,l=function(){s=!1,c=!0,a||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return s&&!c?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):a&&!f?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},y=function(){e.req.on("finish",h)};return function(t){return t.setHeader&&"function"==typeof t.abort}(e)?(e.on("complete",h),e.on("abort",p),e.req?y():e.on("request",y)):a&&!e._writableState&&(e.on("end",u),e.on("close",u)),e.on("end",l),e.on("finish",h),!1!==r.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",h),e.removeListener("abort",p),e.removeListener("request",y),e.req&&e.req.removeListener("finish",h),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",h),e.removeListener("end",l),e.removeListener("error",d),e.removeListener("close",p)}}},352:t=>{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},3495:(t,e,r)=>{"use strict";var n,i=r(4452).q,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function u(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var a=!1;t.on("close",(function(){a=!0})),void 0===n&&(n=r(9885)),n(t,{readable:e,writable:i},(function(t){if(t)return o(t);a=!0,o()}));var u=!1;return function(e){if(!a&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new s("pipe"))}}function f(t){t()}function h(t,e){return t.pipe(e)}function c(t){return t.length?"function"!=typeof t[t.length-1]?a:t.pop():a}t.exports=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=c(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var s=e.map((function(t,r){var o=r<e.length-1;return u(t,o,r>0,(function(t){n||(n=t),t&&s.forEach(f),o||(s.forEach(f),i(n))}))}));return e.reduce(h)}},7605:(t,e,r)=>{"use strict";var n=r(4452).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},5010:(t,e,r)=>{t.exports=r(2699).EventEmitter},7525:(t,e,r)=>{(e=t.exports=r(8051)).Stream=e,e.Readable=e,e.Writable=r(2557),e.Duplex=r(7073),e.Transform=r(7640),e.PassThrough=r(5163),e.finished=r(9885),e.pipeline=r(3495)},1445:(t,e,r)=>{"use strict";var n=r(8834).Buffer,i=r(1285),o=r(5232),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],f=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],h=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],c=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<<e|t>>>32-e}function y(t,e,r,n,i,o,s,a){return p(t+(e^r^n)+o+s|0,a)+i|0}function m(t,e,r,n,i,o,s,a){return p(t+(e&r|~e&n)+o+s|0,a)+i|0}function g(t,e,r,n,i,o,s,a){return p(t+((e|~r)^n)+o+s|0,a)+i|0}function b(t,e,r,n,i,o,s,a){return p(t+(e&n|r&~n)+o+s|0,a)+i|0}function v(t,e,r,n,i,o,s,a){return p(t+(e^(r|~n))+o+s|0,a)+i|0}i(d,o),d.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,d=0|this._e,w=0|this._a,_=0|this._b,S=0|this._c,E=0|this._d,M=0|this._e,k=0;k<80;k+=1){var A,O;k<16?(A=y(r,n,i,o,d,t[a[k]],c[0],f[k]),O=v(w,_,S,E,M,t[u[k]],l[0],h[k])):k<32?(A=m(r,n,i,o,d,t[a[k]],c[1],f[k]),O=b(w,_,S,E,M,t[u[k]],l[1],h[k])):k<48?(A=g(r,n,i,o,d,t[a[k]],c[2],f[k]),O=g(w,_,S,E,M,t[u[k]],l[2],h[k])):k<64?(A=b(r,n,i,o,d,t[a[k]],c[3],f[k]),O=m(w,_,S,E,M,t[u[k]],l[3],h[k])):(A=v(r,n,i,o,d,t[a[k]],c[4],f[k]),O=y(w,_,S,E,M,t[u[k]],l[4],h[k])),r=d,d=o,o=p(i,10),i=n,n=A,w=M,M=E,E=p(S,10),S=_,_=O}var I=this._b+i+E|0;this._b=this._c+o+M|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+n+S|0,this._a=I},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=d},7834:(t,e,r)=>{var n=r(8834),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},2179:(t,e,r)=>{t.exports=r(8224)},8224:(t,e,r)=>{!function(){var e={};if(e.async=r(625),"object"!=typeof e.async)throw new Error("Module async is required (https://github.com/caolan/async)");var n=e.async;function i(t,e){if(!e||"object"!=typeof e)return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function o(){var t={},e=Array.prototype.slice.call(arguments),r=null,n=null;return e.forEach((function(e){if(e&&e.constructor===Object)for(r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]]})),t}function s(){this.custom={},this.extend=function(t){return i(this.custom,t)},this.reset=function(){this.custom={}},this.remove=function(t){u.array(t)||(t=[t]),t.forEach((function(t){delete this.custom[t]}),this)}}function a(t,e){var r=["@"];if(this._schema=t,this._custom={},null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._custom["$"+n]=e[n]);this._getDepth=function(){return r.length},this._dumpStack=function(){return r.map((function(t){return t.replace(/^\[/g,"")})).join(".").replace(/\.\u001b\u001c\u001d\u001e/g,"[")},this._deeperObject=function(t){return r.push(/^[a-z$_][a-z0-9$_]*$/i.test(t)?t:'["'+t+'"]'),this},this._deeperArray=function(t){return r.push("["+t+"]"),this},this._back=function(){return r.pop(),this}}var u={function:function(t){return"function"==typeof t},string:function(t){return"string"==typeof t},number:function(t){return"number"==typeof t&&!isNaN(t)},integer:function(t){return"number"==typeof t&&t%1==0},NaN:function(t){return"number"==typeof t&&isNaN(t)},boolean:function(t){return"boolean"==typeof t},null:function(t){return null===t},date:function(t){return null!=t&&t instanceof Date},object:function(t){return"object"==typeof t&&t.constructor!==Array&&null!=t},array:function(t){return null!=t&&t.constructor===Array},any:function(){return!0}};function f(t,e){return"function"==typeof t?e instanceof t:u[t=t in u?t:"any"](e)}function h(t,e){for(var r=[],n=t.indexOf(e);-1!==n;)r.push(n),n=t.indexOf(e,n+1);return r}var c={void:/^$/,url:/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)?(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,"date-time":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z?|(-|\+)\d{2}:\d{2})$/,date:/^\d{4}-\d{2}-\d{2}$/,coolDateTime:/^\d{4}(-|\/)\d{2}(-|\/)\d{2}(T| )\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,time:/^\d{2}\:\d{2}\:\d{2}$/,color:/^#([0-9a-f])+$/i,email:new RegExp("(?:[^\\W_](?:[\\w\\.\\+]+)@(?:localhost|(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:northwesternmutual|travelersinsurance|vermögensberatung|vermögensberater|americanexpress|kerryproperties|sandvikcoromant|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|construction|lplfinancial|scholarships|versicherung|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|university|vlaanderen|volkswagen|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|موريتانيا|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|السعودية|yokohama|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|католик|الجزائر|العليان|اتصالات|پاکستان|البحرين|كاثوليك|இந்தியா|yamaxun|youtube|zuerich|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|москва|онлайн|ファッション|भारतम्|ارامكو|امارات|الاردن|المغرب|ابوظبي|مليسيا|இலங்கை|فلسطين|yachts|yandex|zappos|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|ישראל|বাংলা|భారత్|भारोत|संगठन|ایران|بازار|بھارت|سودان|همراه|سورية|ഭാരതം|嘉里大酒店|yahoo|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|duck|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|ಭಾರತ|ଭାରତ|大众汽车|ভাৰত|ভারত|موقع|香格里拉|сайт|アマゾン|дети|ポイント|ලංකා|電訊盈科|クラウド|ભારત|भारत|عمان|بارت|ڀارت|عراق|شبكة|بيتك|组织机构|تونس|グーグル|ਭਾਰਤ|yoga|zara|zero|zone|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|कॉम|セール|คอม|我爱你|қаз|срб|бел|קום|淡马锡|орг|नेट|ストア|мкд|كوم|中文网|ком|укр|亚马逊|诺基亚|飞利浦|мон|عرب|ไทย|рус|ລາວ|みんな|天主教|مصر|قطر|հայ|新加坡|xxx|xyz|you|yun|zip|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|佛山|慈善|集团|在线|한국|点看|八卦|公益|公司|网站|移动|联通|бг|时尚|微博|삼성|商标|商店|商城|ею|新闻|家電|中信|中国|中國|娱乐|谷歌|购物|通販|网店|餐厅|网络|香港|食品|台湾|台灣|手机|澳門|닷컴|政府|გე|机构|健康|招聘|рф|大拿|ευ|ελ|世界|書籍|网址|닷넷|コム|游戏|企业|信息|嘉里|广东|政务|ye|yt|za|zm|zw))))"),numeric:/^[0-9]+$/,integer:/^\-?[0-9]+$/,decimal:/^\-?[0-9]*\.?[0-9]+$/,alpha:/^[a-z]+$/i,alphaNumeric:/^[a-z0-9]+$/i,alphaDash:/^[a-z0-9_-]+$/i,javascript:/^[a-z_\$][a-z0-9_\$]*$/i,upperString:/^[A-Z ]*$/,lowerString:/^[a-z ]*$/,v4uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i},l={optional:function(t,e){!0!==("boolean"==typeof t.optional?t.optional:"true"===t.optional)&&void 0===e&&this.report("is missing and not optional",null,"optional")},type:function(t,e){if(void 0!==e&&("string"==typeof t.type||t.type instanceof Array||"function"==typeof t.type)){var r=u.array(t.type)?t.type:[t.type];r.some((function(t){return f(t,e)}))||(r=r.map((function(t){return"function"==typeof t?"an instance of "+t.name:t})),this.report("must be "+r.join(" or ")+", but is "+function(t){for(var e in u)if(f(e,t))return"any"===e||"object"===e&&t.constructor!==Object?"an instance of "+t.constructor.name:e}(e),null,"type"))}},uniqueness:function(t,e){if("string"==typeof t.uniqueness&&(t.uniqueness="true"===t.uniqueness),"boolean"==typeof t.uniqueness&&!1!==t.uniqueness&&(u.array(e)||"string"==typeof e))for(var r=[],n=0;n<e.length;n++)if(!(r.indexOf(e[n])>=0)){var i=h(e,e[n]);i.length>1&&(r.push(e[n]),this.report("has value ["+e[n]+"] more than once at indexes ["+i.join(", ")+"]",null,"uniqueness"))}},pattern:function(t,e){var r=t.pattern;if("string"==typeof e){var n=!1;u.array(r)||(r=[r]),r.forEach((function(t){"string"==typeof t&&t in c&&(t=c[t]),t instanceof RegExp&&t.test(e)&&(n=!0)})),n||this.report("must match ["+r.join(" or ")+'], but is equal to "'+e+'"',null,"pattern")}},validDate:function(t,e){"true"===String(t.validDate)&&e instanceof Date&&isNaN(e.getTime())&&this.report("must be a valid date",null,"validDate")},minLength:function(t,e){if("string"==typeof e||u.array(e)){var r=Number(t.minLength);isNaN(r)||e.length<r&&this.report("must be longer than "+r+" elements, but it has "+e.length,null,"minLength")}},maxLength:function(t,e){if("string"==typeof e||u.array(e)){var r=Number(t.maxLength);isNaN(r)||e.length>r&&this.report("must be shorter than "+r+" elements, but it has "+e.length,null,"maxLength")}},exactLength:function(t,e){if("string"==typeof e||u.array(e)){var r=Number(t.exactLength);isNaN(r)||e.length!==r&&this.report("must have exactly "+r+" elements, but it have "+e.length,null,"exactLength")}},lt:function(t,e){var r=Number(t.lt);"number"!=typeof e||isNaN(r)||e>=r&&this.report("must be less than "+r+', but is equal to "'+e+'"',null,"lt")},lte:function(t,e){var r=Number(t.lte);"number"!=typeof e||isNaN(r)||e>r&&this.report("must be less than or equal to "+r+', but is equal to "'+e+'"',null,"lte")},gt:function(t,e){var r=Number(t.gt);"number"!=typeof e||isNaN(r)||e<=r&&this.report("must be greater than "+r+', but is equal to "'+e+'"',null,"gt")},gte:function(t,e){var r=Number(t.gte);"number"!=typeof e||isNaN(r)||e<r&&this.report("must be greater than or equal to "+r+', but is equal to "'+e+'"',null,"gte")},eq:function(t,e){if("number"==typeof e||"string"==typeof e||"boolean"==typeof e){var r=t.eq;if("number"==typeof r||"string"==typeof r||"boolean"==typeof r||u.array(r))if(u.array(r)){for(var n=0;n<r.length;n++)if(e===r[n])return;this.report("must be equal to ["+r.map((function(t){return'"'+t+'"'})).join(" or ")+'], but is equal to "'+e+'"',null,"eq")}else e!==r&&this.report('must be equal to "'+r+'", but is equal to "'+e+'"',null,"eq")}},ne:function(t,e){if("number"==typeof e||"string"==typeof e){var r=t.ne;if("number"==typeof r||"string"==typeof r||u.array(r))if(u.array(r)){for(var n=0;n<r.length;n++)if(e===r[n])return void this.report('must not be equal to "'+r[n]+'"',null,"ne")}else e===r&&this.report('must not be equal to "'+r+'"',null,"ne")}},someKeys:function(t,e){var r=t.someKeys;u.object(e)&&(r.some((function(t){return t in e}))||this.report("must have at least key "+r.map((function(t){return'"'+t+'"'})).join(" or "),null,"someKeys"))},strict:function(t,e){if("string"==typeof t.strict&&(t.strict="true"===t.strict),!0===t.strict&&u.object(e)&&u.object(t.properties)&&void 0===t.properties["*"]){var r=Object.keys(e).filter((function(e){return void 0===t.properties[e]}));if(r.length>0){var n="should not contains "+(r.length>1?"properties":"property")+" ["+r.map((function(t){return'"'+t+'"'})).join(", ")+"]";this.report(n,null,"strict")}}},exec:function(t,e,r){var n=this;if("function"==typeof r)return this.asyncExec(t,e,r);(u.array(t.exec)?t.exec:[t.exec]).forEach((function(r){"function"==typeof r&&r.call(n,t,e)}))},properties:function(t,e,r){if("function"==typeof r)return this.asyncProperties(t,e,r);if(t.properties instanceof Object&&e instanceof Object){var n,i=t.properties;if(null!=i["*"])for(n in e)n in i||(this._deeperObject(n),this._validate(i["*"],e[n]),this._back());for(n in i)"*"!==n&&(this._deeperObject(n),this._validate(i[n],e[n]),this._back())}},items:function(t,e,r){if("function"==typeof r)return this.asyncItems(t,e,r);if(t.items instanceof Object&&e instanceof Object){var n,i,o=t.items;if(u.array(o)&&u.array(e))for(n=0,i=o.length;n<i;n++)this._deeperArray(n),this._validate(o[n],e[n]),this._back();else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(this._deeperArray(s),this._validate(o,e[s]),this._back())}}},d={asyncExec:function(t,e,r){var i=this;n.eachSeries(u.array(t.exec)?t.exec:[t.exec],(function(r,o){if("function"==typeof r){if(r.length>2)return r.call(i,t,e,o);r.call(i,t,e)}n.nextTick(o)}),r)},asyncProperties:function(t,e,r){if(!(t.properties instanceof Object&&u.object(e)))return r();var i=this,o=t.properties;n.series([function(t){if(null==o["*"])return t();n.eachSeries(Object.keys(e),(function(t,r){if(t in o)return n.nextTick(r);i._deeperObject(t),i._asyncValidate(o["*"],e[t],(function(t){i._back(),r(t)}))}),t)},function(t){n.eachSeries(Object.keys(o),(function(t,r){if("*"===t)return n.nextTick(r);i._deeperObject(t),i._asyncValidate(o[t],e[t],(function(t){i._back(),r(t)}))}),t)}],r)},asyncItems:function(t,e,r){if(!(t.items instanceof Object&&e instanceof Object))return r();var i=this,o=t.items;u.array(o)&&u.array(e)?n.timesSeries(o.length,(function(t,r){i._deeperArray(t),i._asyncValidate(o[t],e[t],(function(t,e){i._back(),r(t,e)})),i._back()}),r):n.eachSeries(Object.keys(e),(function(t,r){i._deeperArray(t),i._asyncValidate(o,e[t],(function(t,e){i._back(),r(t,e)}))}),r)}};function p(t,e){a.prototype.constructor.call(this,t,o(p.custom,e));var r=[];this._basicFields=Object.keys(l),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t,e,n){var i={code:e||this.userCode||null,reason:n||"unknown",message:this.userError||t||"is invalid",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};return r.push(i),this},this.result=function(){return{error:r,valid:0===r.length,format:function(){return!0===this.valid?"Candidate is valid":this.error.map((function(t){return"Property "+t.property+": "+t.message})).join("\n")}}}}i(p.prototype,l),i(p.prototype,d),i(p,new s),p.prototype.validate=function(t,e){if(this.origin=t,"function"==typeof e){var r=this;return n.nextTick((function(){r._asyncValidate(r._schema,t,(function(t){r.origin=null,e(t,r.result())}))}))}return this._validate(this._schema,t).result()},p.prototype._validate=function(t,e,r){return this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,this._basicFields.forEach((function(r){!(r in t)&&"optional"!==r||"function"!=typeof this[r]||this[r](t,e)}),this),this._customFields.forEach((function(r){r in t&&"function"==typeof this._custom[r]&&this._custom[r].call(this,t,e)}),this),this},p.prototype._asyncValidate=function(t,e,r){var i=this;this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,n.series([function(r){n.eachSeries(Object.keys(l),(function(r,o){n.nextTick((function(){if((r in t||"optional"===r)&&"function"==typeof i[r]){if(i[r].length>2)return i[r](t,e,o);i[r](t,e)}o()}))}),r)},function(r){n.eachSeries(Object.keys(i._custom),(function(r,o){n.nextTick((function(){if(r in t&&"function"==typeof i._custom[r]){if(i._custom[r].length>2)return i._custom[r].call(i,t,e,o);i._custom[r].call(i,t,e)}o()}))}),r)}],r)};var y={number:function(t,e){var r;if("number"==typeof t)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(r=parseFloat(t.replace(/,/g,".").replace(/ /g,""))))return r}else if(t instanceof Date)return+t;return null},integer:function(t,e){var r;if("number"==typeof t&&t%1==0)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(r=parseInt(t.replace(/ /g,""),10)))return r}else{if("number"==typeof t)return parseInt(t,10);if("boolean"==typeof t)return t?1:0;if(t instanceof Date)return+t}return null},string:function(t,e){return"boolean"==typeof t||"number"==typeof t||t instanceof Date?t.toString():u.array(t)?e.items||e.properties?t:t.join(String(e.joinWith||",")):t instanceof Object?e.items||e.properties?t:JSON.stringify(t):"string"==typeof t&&t.length?t:null},date:function(t,e){if(t instanceof Date)return t;var r=new Date(t);return isNaN(r.getTime())?null:r},boolean:function(t,e){return void 0===t?null:("string"!=typeof t||"false"!==t.toLowerCase())&&!!t},object:function(t,e){if("string"!=typeof t||u.object(t))return t;try{return JSON.parse(t)}catch(t){return null}},array:function(t,e){if(u.array(t))return t;if(void 0===t)return null;if("string"==typeof t){if("["===t.substring(0,1)&&"]"===t.slice(-1))try{return JSON.parse(t)}catch(t){return null}return t.split(String(e.splitWith||","))}return u.array(t)?null:[t]}},m={upper:function(t){return t.toUpperCase()},lower:function(t){return t.toLowerCase()},title:function(t){return t.replace(/\S*/g,(function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()}))},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()},ucfirst:function(t){return t.charAt(0).toUpperCase()+t.substr(1)},trim:function(t){return t.trim()}},g={strict:function(t,e){return"string"==typeof t.strict&&(t.strict="true"===t.strict),!0!==t.strict?e:u.object(t.properties)&&u.object(e)?(Object.keys(e).forEach((function(r){r in t.properties||delete e[r]})),e):e},optional:function(t,e){return!0===("boolean"==typeof t.optional?t.optional:"false"!==t.optional)||void 0!==e?e:(this.report(),t.def===Date?new Date:t.def)},type:function(t,e){if("string"!=typeof t.type||"function"!=typeof y[t.type])return e;var r,n="boolean"!=typeof t.optional||t.optional;return"function"==typeof y[t.type]?(null===(r=y[t.type](e,t))&&!n||!r&&isNaN(r)||null===r&&"string"===t.type)&&(r=t.def):n||(r=t.def),(null!=r||void 0!==t.def&&t.def===r)&&r!==e?(this.report(),r):e},rules:function(t,e){var r=t.rules;if("string"!=typeof e||"string"!=typeof r&&!u.array(r))return e;var n=!1;return(u.array(r)?r:[r]).forEach((function(t){"function"==typeof m[t]&&(e=m[t](e),n=!0)})),n&&this.report(),e},min:function(t,e){var r=Number(e);if(isNaN(r))return e;var n=Number(t.min);return isNaN(n)?e:r<n?(this.report(),n):e},max:function(t,e){var r=Number(e);if(isNaN(r))return e;var n=Number(t.max);return isNaN(n)?e:r>n?(this.report(),n):e},minLength:function(t,e){var r=Number(t.minLength);if("string"!=typeof e||isNaN(r)||r<0)return e;var n="",i=r-e.length;if(i>0){for(var o=0;o<i;o++)n+="-";return this.report(),e+n}return e},maxLength:function(t,e){var r=Number(t.maxLength);return"string"!=typeof e||isNaN(r)||r<0?e:e.length>r?(this.report(),e.slice(0,r)):e},properties:function(t,e,r){if("function"==typeof r)return this.asyncProperties(t,e,r);if(!e||"object"!=typeof e)return e;var n,i,o=t.properties;if(void 0!==o["*"])for(i in e)i in o||(this._deeperObject(i),void 0!==(n=this._sanitize(t.properties["*"],e[i]))&&(e[i]=n),this._back());for(i in t.properties)"*"!==i&&(this._deeperObject(i),void 0!==(n=this._sanitize(t.properties[i],e[i]))&&(e[i]=n),this._back());return e},items:function(t,e,r){if("function"==typeof r)return this.asyncItems(t,e,r);if(!(t.items instanceof Object&&e instanceof Object))return e;var n;if(u.array(t.items)&&u.array(e)){var i=t.items.length<e.length?t.items.length:e.length;for(n=0;n<i;n++)this._deeperArray(n),e[n]=this._sanitize(t.items[n],e[n]),this._back()}else for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._deeperArray(n),e[n]=this._sanitize(t.items,e[n]),this._back());return e},exec:function(t,e,r){return"function"==typeof r?this.asyncExec(t,e,r):((u.array(t.exec)?t.exec:[t.exec]).forEach((function(r){"function"==typeof r&&(e=r.call(this,t,e))}),this),e)}},b={asyncExec:function(t,e,r){var i=this,o=u.array(t.exec)?t.exec:[t.exec];n.eachSeries(o,(function(r,n){if("function"==typeof r){if(r.length>2)return r.call(i,t,e,(function(t,r){if(t)return n(t);e=r,n()}));e=r.call(i,t,e)}n()}),(function(t){r(t,e)}))},asyncProperties:function(t,e,r){if(!e||"object"!=typeof e)return r(null,e);var i=this,o=t.properties;n.series([function(t){if(null==o["*"])return t();var r=o["*"];n.eachSeries(Object.keys(e),(function(t,n){if(t in o)return n();i._deeperObject(t),i._asyncSanitize(r,e[t],(function(r,o){void 0!==o&&(e[t]=o),i._back(),n()}))}),t)},function(t){n.eachSeries(Object.keys(o),(function(t,r){if("*"===t)return r();i._deeperObject(t),i._asyncSanitize(o[t],e[t],(function(n,o){if(n)return r(n);void 0!==o&&(e[t]=o),i._back(),r()}))}),t)}],(function(t){return r(t,e)}))},asyncItems:function(t,e,r){if(!(t.items instanceof Object&&e instanceof Object))return r(null,e);var i=this,o=t.items;if(u.array(o)&&u.array(e)){var s=o.length<e.length?o.length:e.length;n.timesSeries(s,(function(t,r){i._deeperArray(t),i._asyncSanitize(o[t],e[t],(function(n,o){if(n)return r(n);e[t]=o,i._back(),r()}))}),(function(t){r(t,e)}))}else n.eachSeries(Object.keys(e),(function(t,r){i._deeperArray(t),i._asyncSanitize(o,e[t],(function(n,o){if(n)return r();e[t]=o,i._back(),r()}))}),(function(t){r(t,e)}));return e}};function v(t,e){a.prototype.constructor.call(this,t,o(v.custom,e));var r=[];this._basicFields=Object.keys(g),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t){var e={message:t||"was sanitized",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};r.some((function(t){return t.property===e.property}))||r.push(e)},this.result=function(t){return{data:t,reporting:r,format:function(){return this.reporting.map((function(t){return"Property "+t.property+" "+t.message})).join("\n")}}}}i(v.prototype,g),i(v.prototype,b),i(v,new s),v.prototype.sanitize=function(t,e){if(this.origin=t,"function"==typeof e){var r=this;return this._asyncSanitize(this._schema,t,(function(t,n){r.origin=null,e(t,r.result(n))}))}var n=this._sanitize(this._schema,t);return this.origin=null,this.result(n)},v.prototype._sanitize=function(t,e){return this.userAlias=t.alias||null,this._basicFields.forEach((function(r){!(r in t)&&"optional"!==r||"function"!=typeof this[r]||(e=this[r](t,e))}),this),this._customFields.forEach((function(r){r in t&&"function"==typeof this._custom[r]&&(e=this._custom[r].call(this,t,e))}),this),e},v.prototype._asyncSanitize=function(t,e,r){var i=this;this.userAlias=t.alias||null,n.waterfall([function(r){n.reduce(i._basicFields,e,(function(e,r,o){n.nextTick((function(){if((r in t||"optional"===r)&&"function"==typeof i[r]){if(i[r].length>2)return i[r](t,e,o);e=i[r](t,e)}o(null,e)}))}),r)},function(e,r){n.reduce(i._customFields,e,(function(e,r,o){n.nextTick((function(){if(r in t&&"function"==typeof i._custom[r]){if(i._custom[r].length>2)return i._custom[r].call(i,t,e,o);e=i._custom[r].call(i,t,e)}o(null,e)}))}),r)}],r)};var w=2147483647,_={int:function(t,e){return t+(0|Math.random()*(e-t+1))},float:function(t,e){return Math.random()*(e-t)+t},bool:function(){return Math.random()>.5},char:function(t,e){return String.fromCharCode(this.int(t,e))},fromList:function(t){return t[this.int(0,t.length-1)]}},S={"date-time":function(){return(new Date).toISOString()},date:function(){return(new Date).toISOString().replace(/T.*$/,"")},time:function(){return(new Date).toLocaleTimeString({},{hour12:!1})},color:function(t,e){var r="#";t<1&&(t=1);for(var n=0,i=_.int(t,e);n<i;n++)r+=_.fromList("0123456789abcdefABCDEF");return r},numeric:function(){return""+_.int(0,w)},integer:function(){return!0===_.bool()?"-"+this.numeric():this.numeric()},decimal:function(){return this.integer()+"."+this.numeric()},alpha:function(t,e){var r="";t<1&&(t=1);for(var n=0,i=_.int(t,e);n<i;n++)r+=_.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");return r},alphaNumeric:function(t,e){var r="";t<1&&(t=1);for(var n=0,i=_.int(t,e);n<i;n++)r+=_.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");return r},alphaDash:function(t,e){var r="";t<1&&(t=1);for(var n=0,i=_.int(t,e);n<i;n++)r+=_.fromList("_-abcdefghijklmnopqrstuvwxyz_-ABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789_-");return r},javascript:function(t,e){for(var r=_.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$"),n=0,i=_.int(t,e-1);n<i;n++)r+=_.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$0123456789_$");return r}};function E(t){var e=-2147483648,r=w;return null!=t.gte?e=t.gte:null!=t.gt&&(e=t.gt+1),null!=t.lte?r=t.lte:null!=t.lt&&(r=t.lt-1),{min:e,max:r}}var M={string:function(t){if(null!=t.eq)return t.eq;var e="",r=null!=t.minLength?t.minLength:0,n=null!=t.maxLength?t.maxLength:32;if("string"==typeof t.pattern&&"function"==typeof S[t.pattern])return S[t.pattern](r,n);for(var i=null!=t.exactLength?t.exactLength:_.int(r,n),o=0;o<i;o++)e+=_.char(32,126);return e},number:function(t){if(null!=t.eq)return t.eq;var e=E(t),r=_.float(e.min,e.max);if(null!=t.ne)for(var n=u.array(t.ne)?t.ne:[t.ne];-1!==n.indexOf(r);)r=_.float(e.min,e.max);return r},integer:function(t){if(null!=t.eq)return t.eq;var e=E(t),r=_.int(e.min,e.max);if(null!=t.ne)for(var n=u.array(t.ne)?t.ne:[t.ne];-1!==n.indexOf(r);)r=_.int(e.min,e.max);return r},boolean:function(t){return null!=t.eq?t.eq:_.bool()},null:function(t){return null},date:function(t){return null!=t.eq?t.eq:new Date},object:function(t){var e={},r=t.properties||{};for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){if(!0===r[n].optional&&!0===_.bool())continue;if("*"!==n)e[n]=this.generate(r[n]);else for(var i="__random_key_",o=i+0,s=_.int(1,9),a=1;a<=s;a++)o in r||(e[o]=this.generate(r[n])),o=i+a}return e},array:function(t){var e,r,n,i,o=t.items||{},s=null!=t.minLength?t.minLength:0,a=null!=t.maxLength?t.maxLength:16;if(u.array(o))for(n=o.length,null!=t.exactLength?n=t.exactLength:n<s?n=s:n>a&&(n=a),r=new Array(n),e=null,i=0;i<n;i++)e=o[i].type||"any",u.array(e)&&(e=e[_.int(0,e.length-1)]),r[i]=this[e](o[i]);else for(n=null!=t.exactLength?t.exactLength:_.int(s,a),r=new Array(n),e=o.type||"any",u.array(e)&&(e=e[_.int(0,e.length-1)]),i=0;i<n;i++)r[i]=this[e](o);return r},any:function(t){var e=Object.keys(M);return this[e[_.int(0,e.length-2)]](t)}};function k(){}i(k.prototype,M);var A=null;k.instance=function(){return A instanceof k||(A=new k),A},k.prototype.generate=function(t){var e=t.type||"any";return u.array(e)&&(e=e[_.int(0,e.length-1)]),this[e](t)};var O={};t.exports?t.exports=O:window.SchemaInspector=O,O.newSanitization=function(t,e){return new v(t,e)},O.newValidation=function(t,e){return new p(t,e)},O.Validation=p,O.Sanitization=v,O.sanitize=function(t,e,r,n){return 3===arguments.length&&"function"==typeof r&&(n=r,r=null),new v(t,r).sanitize(e,n)},O.validate=function(t,e,r,n){return 3===arguments.length&&"function"==typeof r&&(n=r,r=null),new p(t,r).validate(e,n)},O.generate=function(t,e){if("number"==typeof e){for(var r=new Array(e),n=0;n<e;n++)r[n]=k.instance().generate(t);return r}return k.instance().generate(t)}}()},3327:(t,e,r)=>{var n=r(7834).Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,s=this._len,a=0;a<o;){for(var u=s%i,f=Math.min(o-a,i-u),h=0;h<f;h++)r[u+h]=t[a+h];a+=f,(s+=f)%i==0&&this._update(r)}return this._len+=o,this},i.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},9065:(t,e,r)=>{var n=t.exports=function(t){t=t.toLowerCase();var e=n[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};n.sha=r(8820),n.sha1=r(7885),n.sha224=r(8321),n.sha256=r(4424),n.sha384=r(213),n.sha512=r(5596)},8820:(t,e,r)=>{var n=r(1285),i=r(3327),o=r(7834).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function f(t){return t<<30|t>>>2}function h(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<80;++c)r[c]=r[c-3]^r[c-8]^r[c-14]^r[c-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((e=n)<<5|e>>>27)+h(d,i,o,a)+u+r[l]+s[d];u=a,a=o,o=f(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},7885:(t,e,r)=>{var n=r(1285),i=r(3327),o=r(7834).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function f(t){return t<<5|t>>>27}function h(t){return t<<30|t>>>2}function c(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=(e=r[l-3]^r[l-8]^r[l-14]^r[l-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),y=f(n)+c(p,i,o,a)+u+r[d]+s[p]|0;u=a,a=o,o=h(i),i=n,n=y}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},8321:(t,e,r)=>{var n=r(1285),i=r(4424),o=r(3327),s=r(7834).Buffer,a=new Array(64);function u(){this.init(),this._w=a,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=s.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},4424:(t,e,r)=>{var n=r(1285),i=r(3327),o=r(7834).Buffer,s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function u(){this.init(),this._w=a,i.call(this,64,56)}function f(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function c(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function l(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}n(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,p=0|this._f,y=0|this._g,m=0|this._h,g=0;g<16;++g)r[g]=t.readInt32BE(4*g);for(;g<64;++g)r[g]=0|(((e=r[g-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[g-7]+d(r[g-15])+r[g-16];for(var b=0;b<64;++b){var v=m+l(u)+f(u,p,y)+s[b]+r[b]|0,w=c(n)+h(n,i,o)|0;m=y,y=p,p=u,u=a+v|0,a=o,o=i,i=n,n=v+w|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=y+this._g|0,this._h=m+this._h|0},u.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},213:(t,e,r)=>{var n=r(1285),i=r(5596),o=r(3327),s=r(7834).Buffer,a=new Array(160);function u(){this.init(),this._w=a,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=s.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=u},5596:(t,e,r)=>{var n=r(1285),i=r(3327),o=r(7834).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}function f(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function c(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function l(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function y(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function g(t,e){return t>>>0<e>>>0?1:0}n(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,u=0|this._fh,b=0|this._gh,v=0|this._hh,w=0|this._al,_=0|this._bl,S=0|this._cl,E=0|this._dl,M=0|this._el,k=0|this._fl,A=0|this._gl,O=0|this._hl,I=0;I<32;I+=2)e[I]=t.readInt32BE(4*I),e[I+1]=t.readInt32BE(4*I+4);for(;I<160;I+=2){var T=e[I-30],x=e[I-30+1],P=d(T,x),B=p(x,T),N=y(T=e[I-4],x=e[I-4+1]),U=m(x,T),R=e[I-14],L=e[I-14+1],C=e[I-32],j=e[I-32+1],F=B+L|0,H=P+R+g(F,B)|0;H=(H=H+N+g(F=F+U|0,U)|0)+C+g(F=F+j|0,j)|0,e[I]=H,e[I+1]=F}for(var D=0;D<160;D+=2){H=e[D],F=e[D+1];var q=h(r,n,i),z=h(w,_,S),$=c(r,w),K=c(w,r),W=l(a,M),V=l(M,a),G=s[D],X=s[D+1],J=f(a,u,b),Z=f(M,k,A),Y=O+V|0,Q=v+W+g(Y,O)|0;Q=(Q=(Q=Q+J+g(Y=Y+Z|0,Z)|0)+G+g(Y=Y+X|0,X)|0)+H+g(Y=Y+F|0,F)|0;var tt=K+z|0,et=$+q+g(tt,K)|0;v=b,O=A,b=u,A=k,u=a,k=M,a=o+Q+g(M=E+Y|0,E)|0,o=i,E=S,i=n,S=_,n=r,_=w,r=Q+et+g(w=Y+tt|0,Y)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+S|0,this._dl=this._dl+E|0,this._el=this._el+M|0,this._fl=this._fl+k|0,this._gl=this._gl+A|0,this._hl=this._hl+O|0,this._ah=this._ah+r+g(this._al,w)|0,this._bh=this._bh+n+g(this._bl,_)|0,this._ch=this._ch+i+g(this._cl,S)|0,this._dh=this._dh+o+g(this._dl,E)|0,this._eh=this._eh+a+g(this._el,M)|0,this._fh=this._fh+u+g(this._fl,k)|0,this._gh=this._gh+b+g(this._gl,A)|0,this._hh=this._hh+v+g(this._hl,O)|0},u.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u},4851:(t,e,r)=>{t.exports=i;var n=r(2699).EventEmitter;function i(){n.call(this)}r(1285)(i,n),i.Readable=r(8051),i.Writable=r(2557),i.Duplex=r(7073),i.Transform=r(7640),i.PassThrough=r(5163),i.finished=r(9885),i.pipeline=r(3495),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",u));var s=!1;function a(){s||(s=!0,t.end())}function u(){s||(s=!0,"function"==typeof t.destroy&&t.destroy())}function f(t){if(h(),0===n.listenerCount(this,"error"))throw t}function h(){r.removeListener("data",i),t.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",f),t.removeListener("error",f),r.removeListener("end",h),r.removeListener("close",h),t.removeListener("close",h)}return r.on("error",f),t.on("error",f),r.on("end",h),r.on("close",h),t.on("close",h),t.emit("pipe",r),t}},214:(t,e,r)=>{"use strict";var n=r(7834).Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=f,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=h,this.end=c,e=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function f(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function h(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function c(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.s=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var i=s(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||-2===i?0:(i=s(e[n]))>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||-2===i?0:(i=s(e[n]))>=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},701:(t,e,r)=>{var n=r(8834).Buffer;const i=r(1095),o=new(0,r(7554).ec)("secp256k1"),s=r(9624),a=n.alloc(32,0),u=n.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),f=n.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),h=o.curve.n,c=h.shrn(1),l=o.curve.g,d="Expected Private",p="Expected Point",y="Expected Tweak",m="Expected Hash";function g(t){return n.isBuffer(t)&&32===t.length}function b(t){return!!g(t)&&t.compare(u)<0}function v(t){if(!n.isBuffer(t))return!1;if(t.length<33)return!1;const e=t[0],r=t.slice(1,33);if(0===r.compare(a))return!1;if(r.compare(f)>=0)return!1;if((2===e||3===e)&&33===t.length){try{k(t)}catch(t){return!1}return!0}const i=t.slice(33);return 0!==i.compare(a)&&!(i.compare(f)>=0)&&4===e&&65===t.length}function w(t){return 4!==t[0]}function _(t){return!!g(t)&&t.compare(a)>0&&t.compare(u)<0}function S(t,e){return void 0===t&&void 0!==e?w(e):void 0===t||t}function E(t){return new i(t)}function M(t){return t.toArrayLike(n,"be",32)}function k(t){return o.curve.decodePoint(t)}function A(t,e){return n.from(t._encode(e))}function O(t,e,r){if(!g(t))throw new TypeError(m);if(!_(e))throw new TypeError(d);if(void 0!==r&&!g(r))throw new TypeError("Expected Extra Data (32 bytes)");const i=E(e),o=E(t);let a,u;s(t,e,(function(t){const e=E(t),r=l.mul(e);return!r.isInfinity()&&(a=r.x.umod(h),0!==a.isZero()&&(u=e.invm(h).mul(o.add(i.mul(a))).umod(h),0!==u.isZero()))}),_,r),u.cmp(c)>0&&(u=h.sub(u));const f=n.allocUnsafe(64);return M(a).copy(f,0),M(u).copy(f,32),f}t.exports={isPoint:v,isPointCompressed:function(t){return!!v(t)&&w(t)},isPrivate:_,pointAdd:function(t,e,r){if(!v(t))throw new TypeError(p);if(!v(e))throw new TypeError(p);const n=k(t),i=k(e),o=n.add(i);return o.isInfinity()?null:A(o,S(r,t))},pointAddScalar:function(t,e,r){if(!v(t))throw new TypeError(p);if(!b(e))throw new TypeError(y);const n=S(r,t),i=k(t);if(0===e.compare(a))return A(i,n);const o=E(e),s=l.mul(o),u=i.add(s);return u.isInfinity()?null:A(u,n)},pointCompress:function(t,e){if(!v(t))throw new TypeError(p);const r=k(t);if(r.isInfinity())throw new TypeError(p);return A(r,S(e,t))},pointFromScalar:function(t,e){if(!_(t))throw new TypeError(d);const r=E(t),n=l.mul(r);return n.isInfinity()?null:A(n,S(e))},pointMultiply:function(t,e,r){if(!v(t))throw new TypeError(p);if(!b(e))throw new TypeError(y);const n=S(r,t),i=k(t),o=E(e),s=i.mul(o);return s.isInfinity()?null:A(s,n)},privateAdd:function(t,e){if(!_(t))throw new TypeError(d);if(!b(e))throw new TypeError(y);const r=E(t),n=E(e),i=M(r.add(n).umod(h));return _(i)?i:null},privateSub:function(t,e){if(!_(t))throw new TypeError(d);if(!b(e))throw new TypeError(y);const r=E(t),n=E(e),i=M(r.sub(n).umod(h));return _(i)?i:null},sign:function(t,e){return O(t,e)},signWithEntropy:function(t,e,r){return O(t,e,r)},verify:function(t,e,r,i){if(!g(t))throw new TypeError(m);if(!v(e))throw new TypeError(p);if(!function(t){const e=t.slice(0,32),r=t.slice(32,64);return n.isBuffer(t)&&64===t.length&&e.compare(u)<0&&r.compare(u)<0}(r))throw new TypeError("Expected Signature");const o=k(e),s=E(r.slice(0,32)),a=E(r.slice(32,64));if(i&&a.cmp(c)>0)return!1;if(s.gtn(0)<=0)return!1;if(a.gtn(0)<=0)return!1;const f=E(t),d=a.invm(h),y=f.mul(d).umod(h),b=s.mul(d).umod(h),w=l.mulAdd(y,o,b);return!w.isInfinity()&&w.x.umod(h).eq(s)}}},1095:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(2728).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=f(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=f(t,h,t.length,e),h=0;h<s;h++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var f=1;f<n;f++){for(var h=u>>>26,c=67108863&u,l=Math.min(f,e.length-1),d=Math.max(0,f-t.length+1);d<=l;d++){var p=f-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[f]=0|c,u=0|h}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var f=c[t],d=l[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?y+r:h[f-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,f=new t(o),h=this.clone();if(u){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),f[a]=s;for(;a<o;a++)f[a]=0}else{for(a=0;a<o-i;a++)f[a]=0;for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),f[o-a-1]=s}return f},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,f=0,h=0|s[0],c=8191&h,l=h>>>13,d=0|s[1],p=8191&d,y=d>>>13,m=0|s[2],g=8191&m,b=m>>>13,v=0|s[3],w=8191&v,_=v>>>13,S=0|s[4],E=8191&S,M=S>>>13,k=0|s[5],A=8191&k,O=k>>>13,I=0|s[6],T=8191&I,x=I>>>13,P=0|s[7],B=8191&P,N=P>>>13,U=0|s[8],R=8191&U,L=U>>>13,C=0|s[9],j=8191&C,F=C>>>13,H=0|a[0],D=8191&H,q=H>>>13,z=0|a[1],$=8191&z,K=z>>>13,W=0|a[2],V=8191&W,G=W>>>13,X=0|a[3],J=8191&X,Z=X>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ht=0|a[8],ct=8191&ht,lt=ht>>>13,dt=0|a[9],pt=8191&dt,yt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(f+(n=Math.imul(c,D))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(l,D)|0))<<13)|0;f=((o=Math.imul(l,q))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,D),i=(i=Math.imul(p,q))+Math.imul(y,D)|0,o=Math.imul(y,q);var gt=(f+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,K)|0)+Math.imul(l,$)|0))<<13)|0;f=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,D),i=(i=Math.imul(g,q))+Math.imul(b,D)|0,o=Math.imul(b,q),n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,K)|0;var bt=(f+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(l,V)|0))<<13)|0;f=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,D),i=(i=Math.imul(w,q))+Math.imul(_,D)|0,o=Math.imul(_,q),n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,K)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,K)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,G)|0;var vt=(f+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(l,J)|0))<<13)|0;f=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(E,D),i=(i=Math.imul(E,q))+Math.imul(M,D)|0,o=Math.imul(M,q),n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Z)|0;var wt=(f+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;f=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,D),i=(i=Math.imul(A,q))+Math.imul(O,D)|0,o=Math.imul(O,q),n=n+Math.imul(E,$)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,K)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(g,J)|0,i=(i=i+Math.imul(g,Z)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0;var _t=(f+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(l,rt)|0))<<13)|0;f=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,D),i=(i=Math.imul(T,q))+Math.imul(x,D)|0,o=Math.imul(x,q),n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,K)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0;var St=(f+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(l,ot)|0))<<13)|0;f=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(B,D),i=(i=Math.imul(B,q))+Math.imul(N,D)|0,o=Math.imul(N,q),n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,K)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(E,J)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Z)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0;var Et=(f+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(l,ut)|0))<<13)|0;f=((o=o+Math.imul(l,ft)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,D),i=(i=Math.imul(R,q))+Math.imul(L,D)|0,o=Math.imul(L,q),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,K)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ft)|0;var Mt=(f+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;f=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(j,D),i=(i=Math.imul(j,q))+Math.imul(F,D)|0,o=Math.imul(F,q),n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,K)|0,n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ft)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ft)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var kt=(f+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,yt)|0)+Math.imul(l,pt)|0))<<13)|0;f=((o=o+Math.imul(l,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,K))+Math.imul(F,$)|0,o=Math.imul(F,K),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Z)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Z)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ft)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,lt)|0)+Math.imul(b,ct)|0,o=o+Math.imul(b,lt)|0;var At=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;f=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,G))+Math.imul(F,V)|0,o=Math.imul(F,G),n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ft)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ft)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var Ot=(f+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((o=o+Math.imul(b,yt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(j,J),i=(i=Math.imul(j,Z))+Math.imul(F,J)|0,o=Math.imul(F,Z),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ft)|0,n=n+Math.imul(E,ct)|0,i=(i=i+Math.imul(E,lt)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,lt)|0;var It=(f+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,yt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((o=o+Math.imul(_,yt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ft)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ft)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(O,ct)|0,o=o+Math.imul(O,lt)|0;var Tt=(f+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,yt)|0)+Math.imul(M,pt)|0))<<13)|0;f=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ft)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ft)|0,n=n+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(f+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,yt)|0)+Math.imul(O,pt)|0))<<13)|0;f=((o=o+Math.imul(O,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,ot),i=(i=Math.imul(j,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ft)|0,n=n+Math.imul(B,ct)|0,i=(i=i+Math.imul(B,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(f+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,yt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((o=o+Math.imul(x,yt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(j,ut),i=(i=Math.imul(j,ft))+Math.imul(F,ut)|0,o=Math.imul(F,ft),n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(L,ct)|0,o=o+Math.imul(L,lt)|0;var Bt=(f+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,yt)|0)+Math.imul(N,pt)|0))<<13)|0;f=((o=o+Math.imul(N,yt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,ct),i=(i=Math.imul(j,lt))+Math.imul(F,ct)|0,o=Math.imul(F,lt);var Nt=(f+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,yt)|0)+Math.imul(L,pt)|0))<<13)|0;f=((o=o+Math.imul(L,yt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Ut=(f+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,yt))+Math.imul(F,pt)|0))<<13)|0;return f=((o=Math.imul(F,yt))+(i>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,u[0]=mt,u[1]=gt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=St,u[7]=Et,u[8]=Mt,u[9]=kt,u[10]=At,u[11]=Ot,u[12]=It,u[13]=Tt,u[14]=xt,u[15]=Pt,u[16]=Bt,u[17]=Nt,u[18]=Ut,0!==f&&(u[19]=f,r.length++),r};function y(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),f=Math.max(0,o-t.length+1);f<=u;f++){var h=o-f,c=(0|t.words[h])*(0|e.words[f]),l=67108863&c;a=67108863&(l=l+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):y(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),f=Math.sin(2*Math.PI/a),h=0;h<i;h+=a)for(var c=u,l=f,d=0;d<s;d++){var p=r[h+d],y=n[h+d],m=r[h+d+s],g=n[h+d+s],b=c*m-l*g;g=c*g+l*m,m=b,r[h+d]=p+m,n[h+d]=y+g,r[h+d+s]=p-m,n[h+d+s]=y-g,d!==a&&(b=u*c-f*l,l=u*l+f*c,c=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),f=new Array(n),h=new Array(n),c=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,f,n),this.transform(s,o,a,u,n,i),this.transform(f,o,h,c,n,i);for(var d=0;d<n;d++){var p=a[d]*h[d]-u[d]*c[d];u[d]=a[d]*c[d]+u[d]*h[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),y(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var f=0;f<s;f++)u.words[f]=this.words[f];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,f=0;f<this.length;f++)this.words[f]=this.words[f+s];else this.words[0]=0,this.length=1;var h=0;for(f=this.length-1;f>=0&&(0!==h||f>=i);f--){var c=0|this.words[f];this.words[f]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var f=0;f<a.length;f++)a.words[f]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var c=u-1;c>=0;c--){var l=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),f=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++f;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(f)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new E(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(v,b),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,b),i(_,b),i(S,b),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return g[t]=e,e},E.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,f).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var y=d,m=0;0!==y.cmp(a);m++)y=y.redSqr();n(m<p);var g=this.pow(c,new o(1).iushln(p-m-1));l=l.redMul(g),c=g.redSqr(),d=d.redMul(c),p=m}return l},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var f=e.words[n],h=u-1;h>=0;h--){var c=f>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},9624:(t,e,r)=>{var n=r(8834).Buffer;const i=r(11),o=n.alloc(1,1),s=n.alloc(1,0);t.exports=function(t,e,r,a,u){let f=n.alloc(32,0),h=n.alloc(32,1);f=i("sha256",f).update(h).update(s).update(e).update(t).update(u||"").digest(),h=i("sha256",f).update(h).digest(),f=i("sha256",f).update(h).update(o).update(e).update(t).update(u||"").digest(),h=i("sha256",f).update(h).digest(),h=i("sha256",f).update(h).digest();let c=h;for(;!a(c)||!r(c);)f=i("sha256",f).update(h).update(s).digest(),h=i("sha256",f).update(h).digest(),h=i("sha256",f).update(h).digest(),c=h;return c}},1589:(t,e,r)=>{var n=r(9522);function i(t){return t.name||t.toString().match(/function (.*?)\s*\(/)[1]}function o(t){return n.Nil(t)?"":i(t.constructor)}function s(t,e){Error.captureStackTrace&&Error.captureStackTrace(t,e)}function a(t){return n.Function(t)?t.toJSON?t.toJSON():i(t):n.Array(t)?"Array":t&&n.Object(t)?"Object":void 0!==t?t:""}function u(t,e,r){var i=function(t){return n.Function(t)?"":n.String(t)?JSON.stringify(t):t&&n.Object(t)?"":t}(e);return"Expected "+a(t)+", got"+(""!==r?" "+r:"")+(""!==i?" "+i:"")}function f(t,e,r){r=r||o(e),this.message=u(t,e,r),s(this,f),this.__type=t,this.__value=e,this.__valueTypeName=r}function h(t,e,r,n,i){t?(i=i||o(n),this.message=function(t,e,r,n,i){var o='" of type ';return"key"===e&&(o='" with key type '),u('property "'+a(r)+o+a(t),n,i)}(t,r,e,n,i)):this.message='Unexpected property "'+e+'"',s(this,f),this.__label=r,this.__property=e,this.__type=t,this.__value=n,this.__valueTypeName=i}f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,h.prototype=Object.create(Error.prototype),h.prototype.constructor=f,t.exports={TfTypeError:f,TfPropertyTypeError:h,tfCustomError:function(t,e){return new f(t,{},e)},tfSubError:function(t,e,r){return t instanceof h?(e=e+"."+t.__property,t=new h(t.__type,e,t.__label,t.__value,t.__valueTypeName)):t instanceof f&&(t=new h(t.__type,e,r,t.__value,t.__valueTypeName)),s(t),t},tfJSON:a,getValueTypeName:o}},9828:(t,e,r)=>{var n=r(8834).Buffer,i=r(9522),o=r(1589);function s(t){return n.isBuffer(t)}function a(t){return"string"==typeof t&&/^([0-9a-f]{2})+$/i.test(t)}function u(t,e){var r=t.toJSON();function n(n){if(!t(n))return!1;if(n.length===e)return!0;throw o.tfCustomError(r+"(Length: "+e+")",r+"(Length: "+n.length+")")}return n.toJSON=function(){return r},n}var f=u.bind(null,i.Array),h=u.bind(null,s),c=u.bind(null,a),l=u.bind(null,i.String),d=Math.pow(2,53)-1,p={ArrayN:f,Buffer:s,BufferN:h,Finite:function(t){return"number"==typeof t&&isFinite(t)},Hex:a,HexN:c,Int8:function(t){return t<<24>>24===t},Int16:function(t){return t<<16>>16===t},Int32:function(t){return(0|t)===t},Int53:function(t){return"number"==typeof t&&t>=-d&&t<=d&&Math.floor(t)===t},Range:function(t,e,r){function n(n,i){return r(n,i)&&n>t&&n<e}return r=r||i.Number,n.toJSON=function(){return`${r.toJSON()} between [${t}, ${e}]`},n},StringN:l,UInt8:function(t){return(255&t)===t},UInt16:function(t){return(65535&t)===t},UInt32:function(t){return t>>>0===t},UInt53:function(t){return"number"==typeof t&&t>=0&&t<=d&&Math.floor(t)===t}};for(var y in p)p[y].toJSON=function(t){return t}.bind(null,y);t.exports=p},9031:(t,e,r)=>{var n=r(1589),i=r(9522),o=n.tfJSON,s=n.TfTypeError,a=n.TfPropertyTypeError,u=n.tfSubError,f=n.getValueTypeName,h={arrayOf:function(t,e){function r(r,n){return!!i.Array(r)&&!i.Nil(r)&&!(void 0!==e.minLength&&r.length<e.minLength)&&!(void 0!==e.maxLength&&r.length>e.maxLength)&&(void 0===e.length||r.length===e.length)&&r.every((function(e,r){try{return l(t,e,n)}catch(t){throw u(t,r)}}))}return t=c(t),e=e||{},r.toJSON=function(){var r="["+o(t)+"]";return void 0!==e.length?r+="{"+e.length+"}":void 0===e.minLength&&void 0===e.maxLength||(r+="{"+(void 0===e.minLength?0:e.minLength)+","+(void 0===e.maxLength?1/0:e.maxLength)+"}"),r},r},maybe:function t(e){function r(r,n){return i.Nil(r)||e(r,n,t)}return e=c(e),r.toJSON=function(){return"?"+o(e)},r},map:function(t,e){function r(r,n){if(!i.Object(r))return!1;if(i.Nil(r))return!1;for(var o in r){try{e&&l(e,o,n)}catch(t){throw u(t,o,"key")}try{var s=r[o];l(t,s,n)}catch(t){throw u(t,o)}}return!0}return t=c(t),e&&(e=c(e)),r.toJSON=e?function(){return"{"+o(e)+": "+o(t)+"}"}:function(){return"{"+o(t)+"}"},r},object:function(t){var e={};for(var r in t)e[r]=c(t[r]);function n(t,r){if(!i.Object(t))return!1;if(i.Nil(t))return!1;var n;try{for(n in e)l(e[n],t[n],r)}catch(t){throw u(t,n)}if(r)for(n in t)if(!e[n])throw new a(void 0,n);return!0}return n.toJSON=function(){return o(e)},n},anyOf:function(){var t=[].slice.call(arguments).map(c);function e(e,r){return t.some((function(t){try{return l(t,e,r)}catch(t){return!1}}))}return e.toJSON=function(){return t.map(o).join("|")},e},allOf:function(){var t=[].slice.call(arguments).map(c);function e(e,r){return t.every((function(t){try{return l(t,e,r)}catch(t){return!1}}))}return e.toJSON=function(){return t.map(o).join(" & ")},e},quacksLike:function(t){function e(e){return t===f(e)}return e.toJSON=function(){return t},e},tuple:function(){var t=[].slice.call(arguments).map(c);function e(e,r){return!i.Nil(e)&&!i.Nil(e.length)&&(!r||e.length===t.length)&&t.every((function(t,n){try{return l(t,e[n],r)}catch(t){throw u(t,n)}}))}return e.toJSON=function(){return"("+t.map(o).join(", ")+")"},e},value:function(t){function e(e){return e===t}return e.toJSON=function(){return t},e}};function c(t){if(i.String(t))return"?"===t[0]?h.maybe(t.slice(1)):i[t]||h.quacksLike(t);if(t&&i.Object(t)){if(i.Array(t)){if(1!==t.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return h.arrayOf(t[0])}return h.object(t)}return i.Function(t)?t:h.value(t)}function l(t,e,r,n){if(i.Function(t)){if(t(e,r))return!0;throw new s(n||t,e)}return l(c(t),e,r)}for(var d in h.oneOf=h.anyOf,i)l[d]=i[d];for(d in h)l[d]=h[d];var p=r(9828);for(d in p)l[d]=p[d];l.compile=c,l.TfTypeError=s,l.TfPropertyTypeError=a,t.exports=l},9522:t=>{var e={Array:function(t){return null!=t&&t.constructor===Array},Boolean:function(t){return"boolean"==typeof t},Function:function(t){return"function"==typeof t},Nil:function(t){return null==t},Number:function(t){return"number"==typeof t},Object:function(t){return"object"==typeof t},String:function(t){return"string"==typeof t},"":function(){return!0}};for(var r in e.Null=e.Nil,e)e[r].toJSON=function(t){return t}.bind(null,r);t.exports=e},5803:(t,e,r)=>{function n(t){try{if(!r.g.localStorage)return!1}catch(t){return!1}var e=r.g.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}},8595:(t,e,r)=>{"use strict";var n=r(7834).Buffer;function i(t){if(t<0||t>9007199254740991||t%1!=0)throw new RangeError("value out of range")}function o(t){return i(t),t<253?1:t<=65535?3:t<=4294967295?5:9}t.exports={encode:function t(e,r,s){if(i(e),r||(r=n.allocUnsafe(o(e))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return s||(s=0),e<253?(r.writeUInt8(e,s),t.bytes=1):e<=65535?(r.writeUInt8(253,s),r.writeUInt16LE(e,s+1),t.bytes=3):e<=4294967295?(r.writeUInt8(254,s),r.writeUInt32LE(e,s+1),t.bytes=5):(r.writeUInt8(255,s),r.writeUInt32LE(e>>>0,s+1),r.writeUInt32LE(e/4294967296|0,s+5),t.bytes=9),r},decode:function t(e,r){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var o=e.readUInt8(r);if(o<253)return t.bytes=1,o;if(253===o)return t.bytes=3,e.readUInt16LE(r+1);if(254===o)return t.bytes=5,e.readUInt32LE(r+1);t.bytes=9;var s=e.readUInt32LE(r+1),a=4294967296*e.readUInt32LE(r+5)+s;return i(a),a},encodingLength:o}},1384:(t,e,r)=>{var n=r(8834).Buffer,i=r(4075);function o(t,e){if(void 0!==e&&t[0]!==e)throw new Error("Invalid network version");if(33===t.length)return{version:t[0],privateKey:t.slice(1,33),compressed:!1};if(34!==t.length)throw new Error("Invalid WIF length");if(1!==t[33])throw new Error("Invalid compression flag");return{version:t[0],privateKey:t.slice(1,33),compressed:!0}}function s(t,e,r){var i=new n(r?34:33);return i.writeUInt8(t,0),e.copy(i,1),r&&(i[33]=1),i}t.exports={decode:function(t,e){return o(i.decode(t),e)},decodeRaw:o,encode:function(t,e,r){return"number"==typeof t?i.encode(s(t,e,r)):i.encode(s(t.version,t.privateKey,t.compressed))},encodeRaw:s}},2377:(t,e,r)=>{"use strict";t.exports=r(8613)},8613:(t,e)=>{"use strict";function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function i(t,e){return void 0===e&&(e="{$origin}\n{$ttl}\n\n; SOA Record\n{name} {ttl} IN SOA {mname}{rname}(\n{serial} ;serial\n{refresh} ;refresh\n{retry} ;retry\n{expire} ;expire\n{minimum} ;minimum ttl\n)\n\n; NS Records\n{ns}\n\n; MX Records\n{mx}\n\n; A Records\n{a}\n\n; AAAA Records\n{aaaa}\n\n; CNAME Records\n{cname}\n\n; PTR Records\n{ptr}\n\n; TXT Records\n{txt}\n\n; SRV Records\n{srv}\n\n; SPF Records\n{spf}\n\n; URI Records\n{uri}\n"),e=function(t,e){var r="";return void 0!==t&&(r+="$ORIGIN "+t),e.replace("{$origin}",r)}(t.$origin,e),e=function(t,e){var r="";return void 0!==t&&(r+="$TTL "+t),e.replace("{$ttl}",r)}(t.$ttl,e),e=function(t,e){var r=e;if(void 0!==t)for(var n in t.name=t.name||"@",t.ttl=t.ttl||"",t)r=r.replace("{"+n+"}",t[n]+"\t");return r}(t.soa,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tNS\t"+s.host+"\n"}return e.replace("{ns}",r)}(t.ns,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tA\t"+s.ip+"\n"}return e.replace("{a}",r)}(t.a,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tAAAA\t"+s.ip+"\n"}return e.replace("{aaaa}",r)}(t.aaaa,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tCNAME\t"+s.alias+"\n"}return e.replace("{cname}",r)}(t.cname,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tMX\t"+s.preference+"\t"+s.host+"\n"}return e.replace("{mx}",r)}(t.mx,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tPTR\t"+s.host+"\n"}return e.replace("{ptr}",r)}(t.ptr,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tTXT\t";var a=s.txt;"string"==typeof a?r+='"'+a+'"':a instanceof Array&&(r+=a.map((function(t){return'"'+t+'"'})).join(" ")),r+="\n"}return e.replace("{txt}",r)}(t.txt,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tSRV\t"+s.priority+"\t",r+=s.weight+"\t",r+=s.port+"\t",r+=s.target+"\n"}return e.replace("{srv}",r)}(t.srv,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tSPF\t"+s.data+"\n"}return e.replace("{spf}",r)}(t.spf,e),(e=function(t,e){e=(e=e.replace("{zone}",t.$origin||!!t.soa&&t.soa.name||"")).replace("{datetime}",(new Date).toISOString());var r=Math.round(Date.now()/1e3);return e.replace("{time}",""+r)}(t,e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tURI\t"+s.priority+"\t",r+=s.weight+"\t",r+='"'+s.target+'"\n'}return e.replace("{uri}",r)}(t.uri,e))).replace(/\n{2,}/gim,"\n\n")}function o(t){return function(t){for(var e,r={},i=n(t.split("\n"));!(e=i()).done;){var o=e.value;if(o&&o.trim()){var g=o.toUpperCase();/\s+TXT\s+/.test(g)?(r.txt=r.txt||[],r.txt.push(l(o))):0===g.indexOf("$ORIGIN")?r.$origin=o.split(/\s+/g)[1]:0===g.indexOf("$TTL")?r.$ttl=parseInt(o.split(/\s+/g)[1],10):/\s+SOA\s+/.test(g)?r.soa=s(o):/\s+NS\s+/.test(g)?(r.ns=r.ns||[],r.ns.push(a(o))):/\s+A\s+/.test(g)?(r.a=r.a||[],r.a.push(u(o,r.a))):/\s+AAAA\s+/.test(g)?(r.aaaa=r.aaaa||[],r.aaaa.push(f(o))):/\s+CNAME\s+/.test(g)?(r.cname=r.cname||[],r.cname.push(h(o))):/\s+MX\s+/.test(g)?(r.mx=r.mx||[],r.mx.push(c(o))):/\s+PTR\s+/.test(g)?(r.ptr=r.ptr||[],r.ptr.push(d(o,r.ptr,r.$origin))):/\s+SRV\s+/.test(g)?(r.srv=r.srv||[],r.srv.push(p(o))):/\s+SPF\s+/.test(g)?(r.spf=r.spf||[],r.spf.push(y(o))):/\s+URI\s+/.test(g)&&(r.uri=r.uri||[],r.uri.push(m(o)))}}return r}(t=function(t){for(var e=[],r=/\([\s\S]*?\)/gim,n=r.exec(t);null!==n;){var i=n[0].replace(/\s+/gm," ");e.push({match:n,replacement:i}),n=r.exec(t)}for(var o=t.split(""),s=0,a=e;s<a.length;s++){var u=a[s],f=u.match;o.splice(f.index,f[0].length,u.replacement)}return o.join("").replace(/\(|\)/gim," ")}(t=function(t){return t.replace(/(^|[^\\]);.*/g,(function(t,e){return e||""}))}(t)))}function s(t){var e={},r=t.trim().split(/\s+/g),n=r.length;return e.name=r[0],e.minimum=parseInt(r[n-1],10),e.expire=parseInt(r[n-2],10),e.retry=parseInt(r[n-3],10),e.refresh=parseInt(r[n-4],10),e.serial=parseInt(r[n-5],10),e.rname=r[n-6],e.mname=r[n-7],isNaN(r[1])||(e.ttl=parseInt(r[1],10)),e}function a(t){var e=t.trim().split(/\s+/g),r={name:e[0],host:e[e.length-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function u(t,e){var r=t.trim().split(/\s+/g),n=t.trim().toUpperCase().split(/\s+/g),i={name:r[0],ip:r[r.length-1]};return 0===n.lastIndexOf("A")&&(i.name=e.length?e[e.length-1].name:"@"),isNaN(r[1])||(i.ttl=parseInt(r[1],10)),i}function f(t){var e=t.trim().split(/\s+/g),r={name:e[0],ip:e[e.length-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function h(t){var e=t.trim().split(/\s+/g),r={name:e[0],alias:e[e.length-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function c(t){var e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],preference:parseInt(e[r-2],10),host:e[r-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function l(t){var e=t.trim().match(/[^\s"']+|"[^"]*"|'[^']*'/g);if(!e)throw new Error("Failure to tokenize TXT record");var r,n=e.length,i=e.indexOf("TXT");function o(t){return t.indexOf('"')>-1&&(t=t.split('"')[1]),t}r=n-i-1>1?[].concat(e.slice(i+1).map(o)):o(e[n-1]);var s={name:e[0],txt:r};return isNaN(e[1])||(s.ttl=parseInt(e[1],10)),s}function d(t,e,r){var n=t.trim().split(/\s+/g);0===t.trim().toUpperCase().split(/\s+/g).lastIndexOf("PTR")&&e[e.length-1]&&n.unshift(e[e.length-1].name);var i={name:n[0],fullname:n[0]+"."+r,host:n[n.length-1]};return isNaN(n[1])||(i.ttl=parseInt(n[1],10)),i}function p(t){var e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],target:e[r-1],priority:parseInt(e[r-4],10),weight:parseInt(e[r-3],10),port:parseInt(e[r-2],10)};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function y(t){for(var e=t.trim().split(/\s+/g),r={name:e[0],data:""},n=e.length;n-- >4;)r.data=e[n]+" "+r.data.trim();return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function m(t){var e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],target:e[r-1].replace(/"/g,""),priority:parseInt(e[r-3],10),weight:parseInt(e[r-2],10)};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}(function(){var t=function(t){this.jsonZoneFile="object"==typeof t?JSON.parse(JSON.stringify(t)):"string"==typeof t?o(t):void 0}.prototype;t.toJSON=function(){return this.jsonZoneFile},t.toString=function(){return i(this.toJSON())}})(),e.makeZoneFile=i,e.parseZoneFile=o},9314:()=>{},3196:()=>{},8087:()=>{},9096:()=>{},488:()=>{},1812:()=>{},4854:()=>{},6602:()=>{},2728:()=>{},196:t=>{"use strict";t.exports=JSON.parse('{"OP_FALSE":0,"OP_0":0,"OP_PUSHDATA1":76,"OP_PUSHDATA2":77,"OP_PUSHDATA4":78,"OP_1NEGATE":79,"OP_RESERVED":80,"OP_TRUE":81,"OP_1":81,"OP_2":82,"OP_3":83,"OP_4":84,"OP_5":85,"OP_6":86,"OP_7":87,"OP_8":88,"OP_9":89,"OP_10":90,"OP_11":91,"OP_12":92,"OP_13":93,"OP_14":94,"OP_15":95,"OP_16":96,"OP_NOP":97,"OP_VER":98,"OP_IF":99,"OP_NOTIF":100,"OP_VERIF":101,"OP_VERNOTIF":102,"OP_ELSE":103,"OP_ENDIF":104,"OP_VERIFY":105,"OP_RETURN":106,"OP_TOALTSTACK":107,"OP_FROMALTSTACK":108,"OP_2DROP":109,"OP_2DUP":110,"OP_3DUP":111,"OP_2OVER":112,"OP_2ROT":113,"OP_2SWAP":114,"OP_IFDUP":115,"OP_DEPTH":116,"OP_DROP":117,"OP_DUP":118,"OP_NIP":119,"OP_OVER":120,"OP_PICK":121,"OP_ROLL":122,"OP_ROT":123,"OP_SWAP":124,"OP_TUCK":125,"OP_CAT":126,"OP_SUBSTR":127,"OP_LEFT":128,"OP_RIGHT":129,"OP_SIZE":130,"OP_INVERT":131,"OP_AND":132,"OP_OR":133,"OP_XOR":134,"OP_EQUAL":135,"OP_EQUALVERIFY":136,"OP_RESERVED1":137,"OP_RESERVED2":138,"OP_1ADD":139,"OP_1SUB":140,"OP_2MUL":141,"OP_2DIV":142,"OP_NEGATE":143,"OP_ABS":144,"OP_NOT":145,"OP_0NOTEQUAL":146,"OP_ADD":147,"OP_SUB":148,"OP_MUL":149,"OP_DIV":150,"OP_MOD":151,"OP_LSHIFT":152,"OP_RSHIFT":153,"OP_BOOLAND":154,"OP_BOOLOR":155,"OP_NUMEQUAL":156,"OP_NUMEQUALVERIFY":157,"OP_NUMNOTEQUAL":158,"OP_LESSTHAN":159,"OP_GREATERTHAN":160,"OP_LESSTHANOREQUAL":161,"OP_GREATERTHANOREQUAL":162,"OP_MIN":163,"OP_MAX":164,"OP_WITHIN":165,"OP_RIPEMD160":166,"OP_SHA1":167,"OP_SHA256":168,"OP_HASH160":169,"OP_HASH256":170,"OP_CODESEPARATOR":171,"OP_CHECKSIG":172,"OP_CHECKSIGVERIFY":173,"OP_CHECKMULTISIG":174,"OP_CHECKMULTISIGVERIFY":175,"OP_NOP1":176,"OP_NOP2":177,"OP_CHECKLOCKTIMEVERIFY":177,"OP_NOP3":178,"OP_CHECKSEQUENCEVERIFY":178,"OP_NOP4":179,"OP_NOP5":180,"OP_NOP6":181,"OP_NOP7":182,"OP_NOP8":183,"OP_NOP9":184,"OP_NOP10":185,"OP_PUBKEYHASH":253,"OP_PUBKEY":254,"OP_INVALIDOPCODE":255}')},763:t=>{"use strict";t.exports={i8:"6.5.4"}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};return(()=>{"use strict";r.r(n),r.d(n,{BLOCKSTACK_GAIA_HUB_LABEL:()=>Ze,GaiaHubConfig:()=>t.GaiaHubConfig,Storage:()=>or,connectToGaiaHub:()=>rr,deleteFromGaiaHub:()=>Qe,getBucketUrl:()=>nr,getFullReadUrl:()=>tr,getUserAppFileUrl:()=>sr,uploadToGaiaHub:()=>Ye});var t={};r.r(t),r.d(t,{Ne:()=>Ze,cc:()=>rr,gZ:()=>Qe,CC:()=>ir,JV:()=>nr,J$:()=>tr,d_:()=>Ye});var e=r(7474);const i=["debug","info","warn","error","none"],o={},s={};for(let t=0;t<i.length;t++){const e=i[t];o[e]=t,s[t]=e}class a{static error(t){this.shouldLog("error")&&console.error(this.logMessage("error",t))}static warn(t){this.shouldLog("warn")&&console.warn(this.logMessage("warn",t))}static info(t){this.shouldLog("info")&&console.log(this.logMessage("info",t))}static debug(t){this.shouldLog("debug")&&console.log(this.logMessage("debug",t))}static logMessage(t,e){return`[${t.toUpperCase()}] ${e}`}static shouldLog(t){return o.debug<=o[t]}}var u=r(8834),f=(r(2197),r(8834).Buffer);const h=void 0!==f?f:u.Buffer;function c(t){return Number.isFinite(t)?Math.floor(1024*t*1024):0}function l(){let t=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))}function d(t,{throwIfUnavailable:e,usageDesc:n,returnEmptyObject:i}={}){let o;try{if(o=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("Unexpected runtime environment - no supported global scope (`window`, `self`, `global`) available")}(),o){const e=o[t];if(e)return e}}catch(e){a.error(`Error getting object '${t}' from global scope '${o}': ${e}`)}if(e){const e=function(t,e,r){return r?`Use of '${r}' requires \`${e}\` which is unavailable on the '${t}' object within the currently executing environment.`:`\`${e}\` is unavailable on the '${t}' object within the currently executing environment.`}(o,t.toString(),n);throw a.error(e),new Error(e)}if(i)return{}}"object"==typeof self&&"crypto"in self&&self.crypto;const p=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),y=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function m(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}function g(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0"))),(()=>{const t="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);try{if(t){const{setImmediate:e}=t("timers")}}catch(t){}})();class b{clone(){return this._cloneInto()}}class v extends b{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");g(t.outputLen),g(t.blockLen)}(t);const r=m(e);if(this.iHash=t.create(),!(this.iHash instanceof b))throw new TypeError("Expected instance of class which extends utils.Hash");const n=this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;const i=new Uint8Array(n);i.set(r.length>this.iHash.blockLen?t.create().update(r).digest():r);for(let t=0;t<i.length;t++)i[t]^=54;this.iHash.update(i),this.oHash=t.create();for(let t=0;t<i.length;t++)i[t]^=106;this.oHash.update(i),i.fill(0)}update(t){if(this.destroyed)throw new Error("instance is destroyed");return this.iHash.update(t),this}digestInto(t){if(this.destroyed)throw new Error("instance is destroyed");if(!(t instanceof Uint8Array)||t.length!==this.outputLen)throw new Error("HMAC: Invalid output buffer");if(this.finished)throw new Error("digest() was already called");this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return(t=t).finished=n,t.destroyed=i,t.blockLen=o,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const w=(t,e,r)=>new v(t,e).update(r).digest();w.create=(t,e)=>new v(t,e);class _ extends b{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=p(this.buffer)}update(t){if(this.destroyed)throw new Error("instance is destroyed");const{view:e,buffer:r,blockLen:n,finished:i}=this;if(i)throw new Error("digest() was already called");const o=(t=m(t)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s!==n)r.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=p(t);for(;n<=o-i;i+=n)this.process(e,i)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){if(this.destroyed)throw new Error("instance is destroyed");if(!(t instanceof Uint8Array)||t.length<this.outputLen)throw new Error("_Sha2: Invalid output buffer");if(this.finished)throw new Error("digest() was already called");this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let t=o;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),u=n?4:0,f=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+f,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=p(t);this.get().forEach(((t,e)=>s.setUint32(4*e,t,i)))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return t.length=n,t.pos=s,t.finished=i,t.destroyed=o,n%e&&t.buffer.set(r),t}}const S=(t,e,r)=>t&e^t&r^e&r,E=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]),M=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),k=new Uint32Array(64);class A extends _{constructor(){super(64,32,8,!1),this.A=0|M[0],this.B=0|M[1],this.C=0|M[2],this.D=0|M[3],this.E=0|M[4],this.F=0|M[5],this.G=0|M[6],this.H=0|M[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[t,e,r,n,i,o,s,a]}set(t,e,r,n,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)k[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=k[t-15],r=k[t-2],n=y(e,7)^y(e,18)^e>>>3,i=y(r,17)^y(r,19)^r>>>10;k[t]=i+k[t-7]+n+k[t-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:f}=this;for(let t=0;t<64;t++){const e=f+(y(s,6)^y(s,11)^y(s,25))+((h=s)&a^~h&u)+E[t]+k[t]|0,c=(y(r,2)^y(r,13)^y(r,22))+S(r,n,i)|0;f=u,u=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+c|0}var h;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(r,n,i,o,s,a,u,f)}roundClean(){k.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const O=function(t){const e=e=>t().update(m(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}((()=>new A));var I=r(9314);const T=BigInt(0),x=BigInt(1),P=BigInt(2),B=BigInt(3),N=BigInt(8),U=P**BigInt(256),R={a:T,b:BigInt(7),P:U-P**BigInt(32)-BigInt(977),n:U-BigInt("432420386565659656852420866394968145599"),h:x,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")};function L(t){const{a:e,b:r}=R,n=et(t*t),i=et(n*t);return et(i+e*t+r)}const C=R.a===T;class j{constructor(t,e,r){this.x=t,this.y=e,this.z=r}static fromAffine(t){if(!(t instanceof H))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new j(t.x,t.y,x)}static toAffineBatch(t){const e=function(t,e=R.P){const r=new Array(t.length),n=nt(t.reduce(((t,n,i)=>n===T?t:(r[i]=t,et(t*n,e))),x),e);return t.reduceRight(((t,n,i)=>n===T?t:(r[i]=et(t*r[i],e),et(t*n,e))),n),r}(t.map((t=>t.z)));return t.map(((t,r)=>t.toAffine(e[r])))}static normalizeZ(t){return j.toAffineBatch(t).map(j.fromAffine)}equals(t){if(!(t instanceof j))throw new TypeError("JacobianPoint expected");const{x:e,y:r,z:n}=this,{x:i,y:o,z:s}=t,a=et(n**P),u=et(s**P),f=et(e*u),h=et(i*a),c=et(et(r*s)*u),l=et(et(o*n)*a);return f===h&&c===l}negate(){return new j(this.x,et(-this.y),this.z)}double(){const{x:t,y:e,z:r}=this,n=et(t**P),i=et(e**P),o=et(i**P),s=et(P*(et((t+i)**P)-n-o)),a=et(B*n),u=et(a**P),f=et(u-P*s),h=et(a*(s-f)-N*o),c=et(P*e*r);return new j(f,h,c)}add(t){if(!(t instanceof j))throw new TypeError("JacobianPoint expected");const{x:e,y:r,z:n}=this,{x:i,y:o,z:s}=t;if(i===T||o===T)return this;if(e===T||r===T)return t;const a=et(n**P),u=et(s**P),f=et(e*u),h=et(i*a),c=et(et(r*s)*u),l=et(et(o*n)*a),d=et(h-f),p=et(l-c);if(d===T)return p===T?this.double():j.ZERO;const y=et(d**P),m=et(d*y),g=et(f*y),b=et(p**P-m-P*g),v=et(p*(g-b)-c*m),w=et(n*s*d);return new j(b,v,w)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){let e=tt(t);j.BASE;const r=j.ZERO;if(e===T)return r;if(e===x)return this;if(!C){let t=r,n=this;for(;e>T;)e&x&&(t=t.add(n)),n=n.double(),e>>=x;return t}let{k1neg:n,k1:i,k2neg:o,k2:s}=st(e),a=r,u=r,f=this;for(;i>T||s>T;)i&x&&(a=a.add(f)),s&x&&(u=u.add(f)),f=f.double(),i>>=x,s>>=x;return n&&(a=a.negate()),o&&(u=u.negate()),u=new j(et(u.x*R.beta),u.y,u.z),a.add(u)}precomputeWindow(t){const e=C?128/t+1:256/t+1,r=[];let n=this,i=n;for(let o=0;o<e;o++){i=n,r.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(t,e){!e&&this.equals(j.BASE)&&(e=H.BASE);const r=e&&e._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=e&&F.get(e);n||(n=this.precomputeWindow(r),e&&1!==r&&(n=j.normalizeZ(n),F.set(e,n)));let i=j.ZERO,o=j.ZERO;const s=1+(C?128/r:256/r),a=2**(r-1),u=BigInt(2**r-1),f=2**r,h=BigInt(r);for(let e=0;e<s;e++){const r=e*a;let s=Number(t&u);if(t>>=h,s>a&&(s-=f,t+=x),0===s){let t=n[r];e%2&&(t=t.negate()),o=o.add(t)}else{let t=n[r+Math.abs(s)-1];s<0&&(t=t.negate()),i=i.add(t)}}return{p:i,f:o}}multiply(t,e){let r,n,i=tt(t);if(C){const{k1neg:t,k1:o,k2neg:s,k2:a}=st(i);let{p:u,f}=this.wNAF(o,e),{p:h,f:c}=this.wNAF(a,e);t&&(u=u.negate()),s&&(h=h.negate()),h=new j(et(h.x*R.beta),h.y,h.z),r=u.add(h),n=f.add(c)}else{const{p:t,f:o}=this.wNAF(i,e);r=t,n=o}return j.normalizeZ([r,n])[0]}toAffine(t=nt(this.z)){const{x:e,y:r,z:n}=this,i=t,o=et(i*i),s=et(o*i),a=et(e*o),u=et(r*s);if(et(n*i)!==x)throw new Error("invZ was invalid");return new H(a,u)}}j.BASE=new j(R.Gx,R.Gy,x),j.ZERO=new j(T,x,T);const F=new WeakMap;class H{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,F.delete(this)}static fromCompressedHex(t){const e=32===t.length,r=Y(e?t:t.subarray(1));if(!ht(r))throw new Error("Point is not on curve");let n=function(t){const{P:e}=R,r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),a=BigInt(88),u=t*t*t%e,f=u*u*t%e,h=rt(f,B)*f%e,c=rt(h,B)*f%e,l=rt(c,P)*u%e,d=rt(l,n)*l%e,p=rt(d,i)*d%e,y=rt(p,s)*p%e,m=rt(y,a)*y%e,g=rt(m,s)*p%e,b=rt(g,B)*f%e,v=rt(b,o)*d%e,w=rt(v,r)*u%e;return rt(w,P)}(L(r));const i=(n&x)===x;e?i&&(n=et(-n)):1==(1&t[0])!==i&&(n=et(-n));const o=new H(r,n);return o.assertValidity(),o}static fromUncompressedHex(t){const e=Y(t.subarray(1,33)),r=Y(t.subarray(33,65)),n=new H(e,r);return n.assertValidity(),n}static fromHex(t){const e=Q(t),r=e.length,n=e[0];if(32===r||33===r&&(2===n||3===n))return this.fromCompressedHex(e);if(65===r&&4===n)return this.fromUncompressedHex(e);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${r}`)}static fromPrivateKey(t){return H.BASE.multiply(lt(t))}static fromSignature(t,e,r){const n=at(t=Q(t)),{r:i,s:o}=dt(e);if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid recovery bit");if(n===T)throw new Error("Cannot recover signature: msgHash cannot be 0");const s=1&r?"03":"02",a=H.fromHex(s+G(i)),{n:u}=R,f=nt(i,u),h=et(-n*f,u),c=et(o*f,u),l=H.BASE.multiplyAndAddUnsafe(a,h,c);if(!l)throw new Error("Cannot recover signature: point at infinify");return l.assertValidity(),l}toRawBytes(t=!1){return Z(this.toHex(t))}toHex(t=!1){const e=G(this.x);return t?`${this.y&x?"03":"02"}${e}`:`04${e}${G(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:r}=this;if(!ht(e)||!ht(r))throw new Error(t);const n=et(r*r);if(et(n-L(e))!==T)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new H(this.x,et(-this.y))}double(){return j.fromAffine(this).double().toAffine()}add(t){return j.fromAffine(this).add(j.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return j.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,r){const n=j.fromAffine(this).multiply(e),i=j.fromAffine(t).multiplyUnsafe(r),o=n.add(i);return o.equals(j.ZERO)?void 0:o.toAffine()}}function D(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function q(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${V(t)}`);const e=t[1],r=t.subarray(2,e+2);if(!e||r.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:Y(r),left:t.subarray(e+2)}}H.BASE=new H(R.Gx,R.Gy),H.ZERO=new H(T,T);class z{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=K(t),r="Signature.fromCompact";if("string"!=typeof t&&!e)throw new TypeError(`${r}: Expected string or Uint8Array`);const n=e?V(t):t;if(128!==n.length)throw new Error(`${r}: Expected 64-byte hex`);return new z(J(n.slice(0,64)),J(n.slice(64,128)))}static fromDER(t){const e=K(t);if("string"!=typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s:n}=function(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${V(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:r}=q(t.subarray(2)),{data:n,left:i}=q(r);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${V(i)}`);return{r:e,s:n}}(e?t:Z(t));return new z(r,n)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!ft(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!ft(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=R.n>>x;return this.s>t}normalizeS(){return this.hasHighS()?new z(this.r,R.n-this.s):this}toDERRawBytes(t=!1){return Z(this.toDERHex(t))}toDERHex(t=!1){const e=D(X(this.s));if(t)return e;const r=D(X(this.r)),n=X(r.length/2),i=X(e.length/2);return`30${X(r.length/2+e.length/2+4)}02${n}${r}02${i}${e}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return Z(this.toCompactHex())}toCompactHex(){return G(this.r)+G(this.s)}}function $(...t){if(!t.every(K))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}function K(t){return t instanceof Uint8Array}const W=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function V(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let r=0;r<t.length;r++)e+=W[t[r]];return e}function G(t){if(t>U)throw new Error("Expected number < 2^256");return t.toString(16).padStart(64,"0")}function X(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function J(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function Z(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+t.length);const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=2*r,i=t.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[r]=o}return e}function Y(t){return J(V(t))}function Q(t){return t instanceof Uint8Array?Uint8Array.from(t):Z(t)}function tt(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&ft(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function et(t,e=R.P){const r=t%e;return r>=T?r:e+r}function rt(t,e){const{P:r}=R;let n=t;for(;e-- >T;)n*=n,n%=r;return n}function nt(t,e=R.P){if(t===T||e<=T)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=et(t,e),n=e,i=T,o=x,s=x,a=T;for(;r!==T;){const t=n/r,e=n%r,u=i-s*t,f=o-a*t;n=r,r=e,i=s,o=a,s=u,a=f}if(n!==x)throw new Error("invert: does not exist");return et(i,e)}const it=(t,e)=>(t+e/P)/e,ot=P**BigInt(128);function st(t){const{n:e}=R,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-x*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=it(o*t,e),a=it(-n*t,e);let u=et(t-s*r-a*i,e),f=et(-s*n-a*o,e);const h=u>ot,c=f>ot;if(h&&(u=e-u),c&&(f=e-f),u>ot||f>ot)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:h,k1:u,k2neg:c,k2:f}}function at(t){const{n:e}=R,r=8*t.length-256;let n=Y(t);return r>0&&(n>>=BigInt(r)),n>=e&&(n-=e),n}class ut{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(...t){return wt.hmacSha256(this.k,...t)}hmacSync(...t){if("function"!=typeof wt.hmacSha256Sync)throw new Error("utils.hmacSha256Sync is undefined, you need to set it");const e=wt.hmacSha256Sync(this.k,...t);if(e instanceof Promise)throw new Error("To use sync sign(), ensure utils.hmacSha256 is sync");return e}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){return this.incr(),this.v=await this.hmac(this.v),this.v}generateSync(){return this.incr(),this.v=this.hmacSync(this.v),this.v}}function ft(t){return T<t&&t<R.n}function ht(t){return T<t&&t<R.P}function ct(t,e,r){const n=Y(t);if(!ft(n))return;const{n:i}=R,o=H.BASE.multiply(n),s=et(o.x,i);if(s===T)return;const a=et(nt(n,i)*et(e+r*s,i),i);if(a===T)return;const u=new z(s,a);return{sig:u,recovery:(o.x===u.r?0:2)|Number(o.y&x)}}function lt(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(64!==t.length)throw new Error("Expected 32 bytes of private key");e=J(t)}else{if(!K(t))throw new TypeError("Expected valid private key");if(32!==t.length)throw new Error("Expected 32 bytes of private key");e=Y(t)}if(!ft(e))throw new Error("Expected private key: 0 < key < n");return e}function dt(t){if(t instanceof z)return t.assertValidity(),t;try{return z.fromDER(t)}catch(e){return z.fromCompact(t)}}function pt(t){return Y(t.length>32?t.slice(0,32):t)}function yt(t){const e=pt(t),r=et(e,R.n);return mt(r<T?e:r)}function mt(t){if("bigint"!=typeof t)throw new Error("Expected bigint");return Z(G(t))}function gt(t,e,r={}){const{seed:n,m:i,d:o}=function(t,e,r){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const n=Q(t),i=lt(e),o=[mt(i),yt(n)];if(null!=r){!0===r&&(r=wt.randomBytes(32));const t=Q(r);if(32!==t.length)throw new Error("sign: Expected 32 bytes of extra data");o.push(t)}return{seed:$(...o),m:pt(n),d:i}}(t,e,r.extraEntropy);let s;const a=new ut;for(a.reseedSync(n);!(s=ct(a.generateSync(),i,o));)a.reseedSync();return function(t,e){let{sig:r,recovery:n}=t;const{canonical:i,der:o,recovered:s}=Object.assign({canonical:!0,der:!0},e);i&&r.hasHighS()&&(r=r.normalizeS(),n^=1);const a=o?r.toDERRawBytes():r.toCompactRawBytes();return s?[a,n]:a}(s,r)}const bt={strict:!0};H.BASE._setWindowSize(8);const vt={node:I,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},wt={isValidPrivateKey(t){try{return lt(t),!0}catch(t){return!1}},hashToPrivateKey:t=>{if((t=Q(t)).length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");const e=et(Y(t),R.n);if(e===T||e===x)throw new Error("Invalid private key");return function(t){return Z(G(t))}(e)},randomBytes:(t=32)=>{if(vt.web)return vt.web.getRandomValues(new Uint8Array(t));if(vt.node){const{randomBytes:e}=vt.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>wt.hashToPrivateKey(wt.randomBytes(40)),bytesToHex:V,mod:et,sha256:async t=>{if(vt.web){const e=await vt.web.subtle.digest("SHA-256",t.buffer);return new Uint8Array(e)}if(vt.node){const{createHash:e}=vt.node;return Uint8Array.from(e("sha256").update(t).digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(vt.web){const r=await vt.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=$(...e),i=await vt.web.subtle.sign("HMAC",r,n);return new Uint8Array(i)}if(vt.node){const{createHmac:r}=vt.node,n=r("sha256",t);return e.forEach((t=>n.update(t))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,precompute(t=8,e=H.BASE){const r=e===H.BASE?e:new H(e.x,e.y);return r._setWindowSize(t),r.multiply(B),r}};var _t,St,Et,Mt,kt,At,Ot,It,Tt,xt,Pt,Bt,Nt,Ut,Rt,Lt,Ct,jt,Ft,Ht,Dt=r(2870);(St=_t||(_t={}))[St.Testnet=2147483648]="Testnet",St[St.Mainnet=1]="Mainnet",_t.Mainnet,(It=Et||(Et={}))[It.Address=0]="Address",It[It.Principal=1]="Principal",It[It.LengthPrefixedString=2]="LengthPrefixedString",It[It.MemoString=3]="MemoString",It[It.AssetInfo=4]="AssetInfo",It[It.PostCondition=5]="PostCondition",It[It.PublicKey=6]="PublicKey",It[It.LengthPrefixedList=7]="LengthPrefixedList",It[It.Payload=8]="Payload",It[It.MessageSignature=9]="MessageSignature",It[It.TransactionAuthField=10]="TransactionAuthField",function(t){t[t.TokenTransfer=0]="TokenTransfer",t[t.SmartContract=1]="SmartContract",t[t.ContractCall=2]="ContractCall",t[t.PoisonMicroblock=3]="PoisonMicroblock",t[t.Coinbase=4]="Coinbase"}(Mt||(Mt={})),function(t){t[t.OnChainOnly=1]="OnChainOnly",t[t.OffChainOnly=2]="OffChainOnly",t[t.Any=3]="Any"}(kt||(kt={})),(Ot=At||(At={}))[Ot.Mainnet=0]="Mainnet",Ot[Ot.Testnet=128]="Testnet",At.Mainnet,function(t){t[t.Allow=1]="Allow",t[t.Deny=2]="Deny"}(Tt||(Tt={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(xt||(xt={})),function(t){t[t.Standard=4]="Standard",t[t.Sponsored=5]="Sponsored"}(Pt||(Pt={})),function(t){t[t.SerializeP2PKH=0]="SerializeP2PKH",t[t.SerializeP2SH=1]="SerializeP2SH",t[t.SerializeP2WPKH=2]="SerializeP2WPKH",t[t.SerializeP2WSH=3]="SerializeP2WSH"}(Bt||(Bt={})),function(t){t[t.MainnetSingleSig=22]="MainnetSingleSig",t[t.MainnetMultiSig=20]="MainnetMultiSig",t[t.TestnetSingleSig=26]="TestnetSingleSig",t[t.TestnetMultiSig=21]="TestnetMultiSig"}(Nt||(Nt={})),(Ht=Ut||(Ut={}))[Ht.Compressed=0]="Compressed",Ht[Ht.Uncompressed=1]="Uncompressed",function(t){t[t.Equal=1]="Equal",t[t.Greater=2]="Greater",t[t.GreaterEqual=3]="GreaterEqual",t[t.Less=4]="Less",t[t.LessEqual=5]="LessEqual"}(Rt||(Rt={})),function(t){t[t.DoesNotOwn=16]="DoesNotOwn",t[t.Owns=17]="Owns"}(Lt||(Lt={})),function(t){t[t.Origin=1]="Origin",t[t.Standard=2]="Standard",t[t.Contract=3]="Contract"}(Ct||(Ct={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(jt||(jt={})),function(t){t.Serialization="Serialization",t.Deserialization="Deserialization",t.SignatureValidation="SignatureValidation",t.FeeTooLow="FeeTooLow",t.BadNonce="BadNonce",t.NotEnoughFunds="NotEnoughFunds",t.NoSuchContract="NoSuchContract",t.NoSuchPublicFunction="NoSuchPublicFunction",t.BadFunctionArgument="BadFunctionArgument",t.ContractAlreadyExists="ContractAlreadyExists",t.PoisonMicroblocksDoNotConflict="PoisonMicroblocksDoNotConflict",t.PoisonMicroblockHasUnknownPubKeyHash="PoisonMicroblockHasUnknownPubKeyHash",t.PoisonMicroblockIsInvalid="PoisonMicroblockIsInvalid",t.BadAddressVersionByte="BadAddressVersionByte",t.NoCoinbaseViaMempool="NoCoinbaseViaMempool",t.ServerFailureNoSuchChainTip="ServerFailureNoSuchChainTip",t.ServerFailureDatabase="ServerFailureDatabase",t.ServerFailureOther="ServerFailureOther"}(Ft||(Ft={}));var qt=r(9065);const zt=new Array(16),$t=se([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),Kt=se([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),Wt=se([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),Vt=se([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),Gt=oe([0,1518500249,1859775393,2400959708,2840853838]),Xt=oe([1352829926,1548603684,1836072691,2053994217,0]);function Jt(t,e){return t<<e|t>>>32-e}function Zt(t,e,r,n,i,o,s,a){return Jt(t+(e^r^n)+o+s|0,a)+i|0}function Yt(t,e,r,n,i,o,s,a){return Jt(t+(e&r|~e&n)+o+s|0,a)+i|0}function Qt(t,e,r,n,i,o,s,a){return Jt(t+((e|~r)^n)+o+s|0,a)+i|0}function te(t,e,r,n,i,o,s,a){return Jt(t+(e&n|r&~n)+o+s|0,a)+i|0}function ee(t,e,r,n,i,o,s,a){return Jt(t+(e^(r|~n))+o+s|0,a)+i|0}function re(t,e){return t[e>>>=0]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24}function ne(t,e,r){return e=+e,t[3+(r>>>=0)]=e>>>24,t[r+2]=e>>>16,t[r+1]=e>>>8,t[r]=255&e,r+4}function ie(t,e,r){return e=+e,t[r>>>=0]=255&e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,r+4}function oe(t){return"undefined"!=typeof Uint32Array?new Uint32Array(t):t}function se(t){return"undefined"!=typeof Uint8Array?new Uint8Array(t):t}function ae(t){return"undefined"!=typeof Uint8Array?new Uint8Array(t):new Array(t)}const ue=class{constructor(){this._block=ae(64),this._blockSize=64,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1,this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}update(t){if(this._finalized)throw new Error("Digest already called");const e=this._block;let r=0;for(;this._blockOffset+t.length-r>=this._blockSize;){for(let n=this._blockOffset;n<this._blockSize;)e[n++]=t[r++];this._update(),this._blockOffset=0}for(;r<t.length;)e[this._blockOffset++]=t[r++];for(let e=0,r=8*t.length;r>0;++e)this._length[e]+=r,r=this._length[e]/4294967296|0,r>0&&(this._length[e]-=4294967296*r);return this}_update(){const t=zt;for(let e=0;e<16;++e)t[e]=re(this._block,4*e);let e=0|this._a,r=0|this._b,n=0|this._c,i=0|this._d,o=0|this._e,s=0|this._a,a=0|this._b,u=0|this._c,f=0|this._d,h=0|this._e;for(let c=0;c<80;c+=1){let l,d;c<16?(l=Zt(e,r,n,i,o,t[$t[c]],Gt[0],Wt[c]),d=ee(s,a,u,f,h,t[Kt[c]],Xt[0],Vt[c])):c<32?(l=Yt(e,r,n,i,o,t[$t[c]],Gt[1],Wt[c]),d=te(s,a,u,f,h,t[Kt[c]],Xt[1],Vt[c])):c<48?(l=Qt(e,r,n,i,o,t[$t[c]],Gt[2],Wt[c]),d=Qt(s,a,u,f,h,t[Kt[c]],Xt[2],Vt[c])):c<64?(l=te(e,r,n,i,o,t[$t[c]],Gt[3],Wt[c]),d=Yt(s,a,u,f,h,t[Kt[c]],Xt[3],Vt[c])):(l=ee(e,r,n,i,o,t[$t[c]],Gt[4],Wt[c]),d=Zt(s,a,u,f,h,t[Kt[c]],Xt[4],Vt[c])),e=o,o=i,i=Jt(n,10),n=r,r=l,s=h,h=f,f=Jt(u,10),u=a,a=d}const c=this._b+n+f|0;this._b=this._c+i+h|0,this._c=this._d+o+s|0,this._d=this._e+e+a|0,this._e=this._a+r+u|0,this._a=c}digest(){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),ne(this._block,this._length[0],56),ne(this._block,this._length[1],60),this._update();const t=ae(20);ie(t,this._a,0),ie(t,this._b,4),ie(t,this._c,8),ie(t,this._d,12),ie(t,this._e,16),this._block.fill(0),this._blockOffset=0;for(let t=0;t<4;++t)this._length[t]=0;return t}};r(6279),r(9907);function fe(t,e=At.Mainnet){t="string"==typeof t?t:t.toString("hex");var r,n,i;return i=(r=function(t,e){switch(t){case Bt.SerializeP2PKH:switch(e){case At.Mainnet:return Nt.MainnetSingleSig;case At.Testnet:return Nt.TestnetSingleSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}case Bt.SerializeP2SH:case Bt.SerializeP2WPKH:case Bt.SerializeP2WSH:switch(e){case At.Mainnet:return Nt.MainnetMultiSig;case At.Testnet:return Nt.TestnetMultiSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}default:throw new Error(`Unexpected hashMode ${JSON.stringify(t)}`)}}(Bt.SerializeP2PKH,e),n=(t=>{const e=(new qt.sha256).update(t).digest();return h.from((new ue).update(e).digest())})(h.from(t,"hex")).toString("hex"),{type:Et.Address,version:r,hash160:n}),(0,Dt.H4)(i.version,i.hash160).toString()}function he(t,r=null){let n;n=r?function(t,r){const n=(0,e.decodeToken)(t),i=n.payload;if("string"==typeof i)throw new Error("Unexpected token payload type of string");if(!i.hasOwnProperty("subject")||!i.subject)throw new Error("Token doesn't have a subject");if(!i.subject.hasOwnProperty("publicKey"))throw new Error("Token doesn't have a subject public key");if(!i.hasOwnProperty("issuer")||!i.issuer)throw new Error("Token doesn't have an issuer");if(!i.issuer.hasOwnProperty("publicKey"))throw new Error("Token doesn't have an issuer public key");if(!i.hasOwnProperty("claim"))throw new Error("Token doesn't have a claim");const o=i.issuer.publicKey,s=fe(o);if(r===o);else if(r!==s)throw new Error("Token issuer public key does not match the verifying value");const a=new e.TokenVerifier(n.header.alg,o);if(!a)throw new Error("Invalid token verifier");if(!a.verify(t))throw new Error("Token verification failed");return n}(t,r):(0,e.decodeToken)(t);let i={};if(n.hasOwnProperty("payload")){const t=n.payload;if("string"==typeof t)throw new Error("Unexpected token payload type of string");t.hasOwnProperty("claim")&&(i=t.claim)}return i}function ce(t,e){let r;return e.proof&&e.proof.url&&(r=e.proof.url),{"@type":"Account",service:t,identifier:e.username,proofType:"http",proofUrl:r}}wt.hmacSha256Sync=(t,...e)=>{const r=w.create(O,t);return e.forEach((t=>r.update(t))),r.digest()};var le=r(2377),de=r(2179);async function pe(t,e){const r=Object.assign({referrer:"no-referrer",referrerPolicy:"no-referrer"},e);return await fetch(t,r)}r(3616);const ye={type:"object",properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"}}};class me{constructor(t={}){this._profile=Object.assign({},{"@context":"http://schema.org/"},t)}toJSON(){return Object.assign({},this._profile)}toToken(t){return function(t,r,n,i,o="ES256K",s=new Date,a=function(){return new Date((new Date).setFullYear((new Date).getFullYear()+1))}()){if("ES256K"!==o)throw new Error("Signing algorithm not supported");const u=e.SECP256K1Client.derivePublicKey(r);n||(n={publicKey:u}),i||(i={publicKey:u});const f=new e.TokenSigner(o,r),h={jti:l(),iat:s.toISOString(),exp:a.toISOString(),subject:n,issuer:i,claim:t};return f.sign(h)}(this.toJSON(),t)}static validateSchema(t,e=!1){return ye.strict=e,de.validate(ye,t)}static fromToken(t,e=null){const r=he(t,e);return new me(r)}static makeZoneFile(t,e){return function(t,e){if(!e.includes("://"))throw new Error("Invalid token file url");const r=e.split("://")[0],n=e.split("://")[1].split("/"),i={$origin:t,$ttl:3600,uri:[{name:"_http._tcp",priority:10,weight:1,target:`${r}://${n[0]}${`/${n.slice(1).join("/")}`}`}]};return(0,le.makeZoneFile)(i,"{$origin}\n{$ttl}\n{uri}\n")}(t,e)}}const ge={type:"object",strict:!1,properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"},"@id":{type:"string",optional:!0},name:{type:"string",optional:!0},givenName:{type:"string",optional:!0},familyName:{type:"string",optional:!0},description:{type:"string",optional:!0},image:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},name:{type:"string",optional:!0},contentUrl:{type:"string",optional:!0}}}},website:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},url:{type:"string",optional:!0}}}},account:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},service:{type:"string",optional:!0},identifier:{type:"string",optional:!0},proofType:{type:"string",optional:!0},proofUrl:{type:"string",optional:!0},proofMessage:{type:"string",optional:!0},proofSignature:{type:"string",optional:!0}}}},worksFor:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},knows:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},address:{type:"object",optional:!0,properties:{"@type":{type:"string"},streetAddress:{type:"string",optional:!0},addressLocality:{type:"string",optional:!0},postalCode:{type:"string",optional:!0},addressCountry:{type:"string",optional:!0}}},birthDate:{type:"string",optional:!0},taxID:{type:"string",optional:!0}}};class be extends me{constructor(t={}){super(t),this._profile=Object.assign({},{"@type":"Person"},this._profile)}static validateSchema(t,e=!1){return ge.strict=e,de.validate(ye,t)}static fromToken(t,e=null){const r=he(t,e);return new be(r)}static fromLegacyFormat(t){const e=function(t){const e={"@type":"Person"};if(t){t.name&&t.name.formatted&&(e.name=t.name.formatted),t.bio&&(e.description=t.bio),t.location&&t.location.formatted&&(e.address={"@type":"PostalAddress",addressLocality:t.location.formatted});const r=[];t.avatar&&t.avatar.url&&r.push({"@type":"ImageObject",name:"avatar",contentUrl:t.avatar.url}),t.cover&&t.cover.url&&r.push({"@type":"ImageObject",name:"cover",contentUrl:t.cover.url}),r.length&&(e.image=r),t.website&&(e.website=[{"@type":"WebSite",url:t.website}]);const n=[];t.bitcoin&&t.bitcoin.address&&n.push({"@type":"Account",role:"payment",service:"bitcoin",identifier:t.bitcoin.address}),t.twitter&&t.twitter.username&&n.push(ce("twitter",t.twitter)),t.facebook&&t.facebook.username&&n.push(ce("facebook",t.facebook)),t.github&&t.github.username&&n.push(ce("github",t.github)),t.auth&&t.auth.length>0&&t.auth[0]&&t.auth[0].publicKeychain&&n.push({"@type":"Account",role:"key",service:"bip32",identifier:t.auth[0].publicKeychain}),t.pgp&&t.pgp.url&&n.push({"@type":"Account",role:"key",service:"pgp",identifier:t.pgp.fingerprint,contentUrl:t.pgp.url}),e.account=n}return e}(t);return new be(e)}toJSON(){return{profile:this.profile(),name:this.name(),givenName:this.givenName(),familyName:this.familyName(),description:this.description(),avatarUrl:this.avatarUrl(),verifiedAccounts:this.verifiedAccounts(),address:this.address(),birthDate:this.birthDate(),connections:this.connections(),organizations:this.organizations()}}profile(){return Object.assign({},this._profile)}name(){return function(t){if(!t)return null;let e=null;return t.name?e=t.name:(t.givenName||t.familyName)&&(e="",t.givenName&&(e=t.givenName),t.familyName&&(e+=` ${t.familyName}`)),e}(this.profile())}givenName(){return function(t){if(!t)return null;let e=null;return t.givenName?e=t.givenName:t.name&&(e=t.name.split(" ").slice(0,-1).join(" ")),e}(this.profile())}familyName(){return function(t){if(!t)return null;let e=null;return t.familyName?e=t.familyName:t.name&&(e=t.name.split(" ").pop()),e}(this.profile())}description(){return function(t){if(!t)return null;let e=null;return t.description&&(e=t.description),e}(this.profile())}avatarUrl(){return function(t){if(!t)return null;let e=null;return t.image&&t.image.map((t=>"avatar"===t.name?(e=t.contentUrl,e):null)),e}(this.profile())}verifiedAccounts(t){return function(t,e){if(!t)return null;const r=[];return t.hasOwnProperty("account")&&e&&t.account.map((t=>{let n=!1,i=null;return e.map((e=>(e.hasOwnProperty("proof_url")&&(e.proofUrl=e.proof_url),!(!e.valid||e.service!==t.service||e.identifier!==t.identifier||!e.proofUrl||(n=!0,i=e.proofUrl,0))))),n?(t.proofUrl=i,r.push(t),t):null})),r}(this.profile(),t)}address(){return function(t){if(!t)return null;let e=null;if(t.hasOwnProperty("address")){const r=[];t.address.hasOwnProperty("streetAddress")&&r.push(t.address.streetAddress),t.address.hasOwnProperty("addressLocality")&&r.push(t.address.addressLocality),t.address.hasOwnProperty("postalCode")&&r.push(t.address.postalCode),t.address.hasOwnProperty("addressCountry")&&r.push(t.address.addressCountry),r.length&&(e=r.join(", "))}return e}(this.profile())}birthDate(){return function(t){if(!t)return null;const e=["January","February","March","April","May","June","July","August","September","October","November","December"];let r=null;if(t.hasOwnProperty("birthDate")){const n=new Date(t.birthDate);r=`${e[n.getMonth()]} ${n.getDate()}, ${n.getFullYear()}`}return r}(this.profile())}connections(){return function(t){if(!t)return null;let e=[];return t.hasOwnProperty("knows")&&(e=t.knows),e}(this.profile())}organizations(){return(t=this.profile())?t.hasOwnProperty("worksFor")?t.worksFor:[]:null;var t}}var ve,we;!function(t){t[t.Testnet=2147483648]="Testnet",t[t.Mainnet=1]="Mainnet"}(ve||(ve={})),function(t){t[t.Mainnet=0]="Mainnet",t[t.Testnet=128]="Testnet"}(we||(we={}));const _e=["mainnet","testnet"];class Se{constructor(t){this.version=we.Mainnet,this.chainId=ve.Mainnet,this.bnsLookupUrl="https://stacks-node-api.mainnet.stacks.co",this.broadcastEndpoint="/v2/transactions",this.transferFeeEstimateEndpoint="/v2/fees/transfer",this.transactionFeeEstimateEndpoint="/v2/fees/transaction",this.accountEndpoint="/v2/accounts",this.contractAbiEndpoint="/v2/contracts/interface",this.readOnlyFunctionCallEndpoint="/v2/contracts/call-read",this.isMainnet=()=>this.version===we.Mainnet,this.getBroadcastApiUrl=()=>`${this.coreApiUrl}${this.broadcastEndpoint}`,this.getTransferFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transferFeeEstimateEndpoint}`,this.getTransactionFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transactionFeeEstimateEndpoint}`,this.getAccountApiUrl=t=>`${this.coreApiUrl}${this.accountEndpoint}/${t}?proof=0`,this.getAbiApiUrl=(t,e)=>`${this.coreApiUrl}${this.contractAbiEndpoint}/${t}/${e}`,this.getReadOnlyFunctionCallApiUrl=(t,e,r)=>`${this.coreApiUrl}${this.readOnlyFunctionCallEndpoint}/${t}/${e}/${encodeURIComponent(r)}`,this.getInfoUrl=()=>`${this.coreApiUrl}/v2/info`,this.getBlockTimeInfoUrl=()=>`${this.coreApiUrl}/extended/v1/info/network_block_times`,this.getPoxInfoUrl=()=>`${this.coreApiUrl}/v2/pox`,this.getRewardsUrl=(t,e)=>{let r=`${this.coreApiUrl}/extended/v1/burnchain/rewards/${t}`;return e&&(r=`${r}?limit=${e.limit}&offset=${e.offset}`),r},this.getRewardsTotalUrl=t=>`${this.coreApiUrl}/extended/v1/burnchain/rewards/${t}/total`,this.getRewardHoldersUrl=(t,e)=>{let r=`${this.coreApiUrl}/extended/v1/burnchain/reward_slot_holders/${t}`;return e&&(r=`${r}?limit=${e.limit}&offset=${e.offset}`),r},this.getStackerInfoUrl=(t,e)=>`${this.coreApiUrl}${this.readOnlyFunctionCallEndpoint}\n ${t}/${e}/get-stacker-info`,this.coreApiUrl=t.url}getNameInfo(t){return pe(`${this.bnsLookupUrl}/v1/names/${t}`).then((t=>{if(404===t.status)throw new Error("Name not found");if(200!==t.status)throw new Error(`Bad response status: ${t.status}`);return t.json()})).then((t=>t.address?Object.assign({},t,{address:t.address}):t))}}Se.fromName=t=>{switch(t){case"mainnet":return new Ee;case"testnet":return new Me;default:throw new Error(`Invalid network name provided. Must be one of the following: ${_e.join(", ")}`)}},Se.fromNameOrNetwork=t=>"string"!=typeof t&&"version"in t?t:Se.fromName(t);class Ee extends Se{constructor(t={url:"https://stacks-node-api.mainnet.stacks.co"}){super(t),this.version=we.Mainnet,this.chainId=ve.Mainnet}}class Me extends Se{constructor(t={url:"https://stacks-node-api.testnet.stacks.co"}){super(t),this.version=we.Testnet,this.chainId=ve.Testnet}}const ke={MISSING_PARAMETER:"missing_parameter",REMOTE_SERVICE_ERROR:"remote_service_error",INVALID_STATE:"invalid_state",NO_SESSION_DATA:"no_session_data",DOES_NOT_EXIST:"does_not_exist",FAILED_DECRYPTION_ERROR:"failed_decryption_error",INVALID_DID_ERROR:"invalid_did_error",NOT_ENOUGH_FUNDS_ERROR:"not_enough_error",INVALID_AMOUNT_ERROR:"invalid_amount_error",LOGIN_FAILED_ERROR:"login_failed",SIGNATURE_VERIFICATION_ERROR:"signature_verification_failure",CONFLICT_ERROR:"conflict_error",NOT_ENOUGH_PROOF_ERROR:"not_enough_proof_error",BAD_PATH_ERROR:"bad_path_error",VALIDATION_ERROR:"validation_error",PAYLOAD_TOO_LARGE_ERROR:"payload_too_large_error",PRECONDITION_FAILED_ERROR:"precondition_failed_error",UNKNOWN:"unknown"};Object.freeze(ke);class Ae extends Error{constructor(t){super();let e=t.message,r=`Error Code: ${t.code}`,n=this.stack;if(n)r+=`Stack Trace:\n${n}`;else try{throw new Error}catch(t){n=t.stack}e+=`\nIf you believe this exception is caused by a bug in stacks.js,\n please file a bug report: https://github.com/blockstack/stacks.js/issues\n\n${r}`,this.message=e,this.code=t.code,this.parameter=t.parameter?t.parameter:void 0}toString(){return`${super.toString()}\n code: ${this.code} param: ${this.parameter?this.parameter:"n/a"}`}}class Oe extends Ae{constructor(t){const e=`Failed to verify signature: ${t}`;super({code:ke.SIGNATURE_VERIFICATION_ERROR,message:e}),this.message=e,this.name="SignatureVerificationError"}}class Ie extends Ae{constructor(t){super({code:ke.INVALID_STATE,message:t}),this.message=t,this.name="InvalidStateError"}}class Te extends Ae{constructor(t,e){super(t),e&&(this.hubError={statusCode:e.status,statusText:e.statusText},"string"==typeof e.body?this.hubError.message=e.body:"object"==typeof e.body&&Object.assign(this.hubError,e.body))}}class xe extends Te{constructor(t,e){super({message:t,code:ke.DOES_NOT_EXIST},e),this.name="DoesNotExist"}}class Pe extends Te{constructor(t,e){super({message:t,code:ke.CONFLICT_ERROR},e),this.name="ConflictError"}}class Be extends Te{constructor(t,e){super({message:t,code:ke.NOT_ENOUGH_PROOF_ERROR},e),this.name="NotEnoughProofError"}}class Ne extends Te{constructor(t,e){super({message:t,code:ke.BAD_PATH_ERROR},e),this.name="BadPathError"}}class Ue extends Te{constructor(t,e){super({message:t,code:ke.VALIDATION_ERROR},e),this.name="ValidationError"}}class Re extends Te{constructor(t,e,r){super({message:t,code:ke.PAYLOAD_TOO_LARGE_ERROR},e),this.name="PayloadTooLargeError",this.maxUploadByteSize=r}}class Le extends Te{constructor(t,e){super({message:t,code:ke.PRECONDITION_FAILED_ERROR},e),this.name="PreconditionFailedError"}}function Ce(t){const e=h.isBuffer(t)?t:h.from(t,"hex");if(32!=e.length&&33!=e.length)throw new Error(`Improperly formatted private-key. Private-key byte length should be 32 or 33. Length provided: ${e.length}`);if(33==e.length&&1!==e[32])throw new Error("Improperly formatted private-key. 33 bytes indicate compressed key, but the last byte must be == 01");return e}var je=r(7022),Fe=r.n(je);class He{digest(t){const e=new ue;e.update(t);const r=e.digest();return Array.isArray(r)?h.from(r):h.from(r.buffer)}}class De{constructor(t){this.nodeCryptoCreateHash=t}digest(t){try{return this.nodeCryptoCreateHash("rmd160").update(t).digest()}catch(e){try{return this.nodeCryptoCreateHash("ripemd160").update(t).digest()}catch(r){return console.log(e),console.log("Node.js `crypto.createHash` exists but failing to digest for ripemd160, falling back to js implementation"),(new He).digest(t)}}}}function qe(t){const e=new qt.sha256;return e.update(t),e.digest()}const ze=0;function $e(t){var e,n;return e=qe(h.isBuffer(t)?t:h.from(t,"hex")),n=function(){const t=function(t){try{if(!Object(function(){var t=new Error("Cannot find module 'crypto'");throw t.code="MODULE_NOT_FOUND",t}()))return!1;const e=r(Object(function(){var t=new Error("Cannot find module 'crypto'");throw t.code="MODULE_NOT_FOUND",t}()));return!!e&&(!t||t(e))}catch(t){return!1}}((t=>"function"==typeof t.createHash&&t.createHash));return t?new De(t):new He}().digest(e),function(t){const e=O(O(t));return Fe().encode(h.concat([t,e],t.length+4))}(h.from([ze,...n].slice(0,21)))}function Ke(t){const e=Ce(t);return h.from(function(t,e=!1){return H.fromPrivateKey(t).toRawBytes(e)}(e.slice(0,32),!0)).toString("hex")}var We;function Ve(t,e,r){const n=function(t){return t instanceof h?t:(ArrayBuffer,h.from(t))}(t);return function(t,e,r,n=bt){let i;try{i=dt(t),e=Q(e)}catch(t){return!1}const{r:o,s}=i;if(n.strict&&i.hasHighS())return!1;const a=at(e);if(a===T)return!1;let u;try{u=function(t){return t instanceof H?(t.assertValidity(),t):H.fromHex(t)}(r)}catch(t){return!1}const{n:f}=R,h=nt(s,f),c=et(a*h,f),l=et(o*h,f),d=H.BASE.multiplyAndAddUnsafe(u,c,l);return!!d&&et(d.x,f)===o}(r,qe(n),e)}wt.hmacSha256Sync=(t,...e)=>{const r=w.create(O,t);return e.forEach((t=>r.update(t))),r.digest()},wt.hmacSha256Sync=(t,...e)=>{const r=w.create(O,t);return e.forEach((t=>r.update(t))),r.digest()},function(t){t.InvalidFormat="InvalidFormat",t.IsNotPoint="IsNotPoint"}(We||(We={}));const Ge=class{constructor(t,e){this.wasString="string"==typeof t,this.content=Ge.normalizeContentDataType(t,e),this.contentType=e||this.detectContentType(),this.contentByteLength=this.detectContentLength()}static normalizeContentDataType(t,e){try{if("string"==typeof t){const r=(e||"").toLowerCase().replace("-","");if(r.includes("charset")&&!r.includes("charset=utf8")&&!r.includes("charset=ascii"))throw new Error(`Unable to determine byte length with charset: ${e}`);if("undefined"!=typeof TextEncoder){const e=(new TextEncoder).encode(t);return h.from(e.buffer)}return h.from(t)}if(h.isBuffer(t))return t;if(ArrayBuffer.isView(t))return h.from(t.buffer,t.byteOffset,t.byteLength);if("undefined"!=typeof Blob&&t instanceof Blob)return t;if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer)return h.from(t);if(Array.isArray(t)){if(t.length>0&&(!Number.isInteger(t[0])||t[0]<0||t[0]>255))throw new Error(`Unexpected array values provided as file data: value "${t[0]}" at index 0 is not an octet number. ${this.supportedTypesMsg}`);return h.from(t)}{const e=Object.prototype.toString.call(t);throw new Error(`Unexpected type provided as file data: ${e}. ${this.supportedTypesMsg}`)}}catch(t){throw console.error(t),new Error(`Error processing data: ${t}`)}}detectContentType(){return this.wasString?"text/plain; charset=utf-8":"undefined"!=typeof Blob&&this.content instanceof Blob&&this.content.type?this.content.type:"application/octet-stream"}detectContentLength(){if(ArrayBuffer.isView(this.content)||h.isBuffer(this.content))return this.content.byteLength;if("undefined"!=typeof Blob&&this.content instanceof Blob)return this.content.size;const t=Object.prototype.toString.call(this.content),e=new Error(`Unexpected type "${t}" while detecting content length`);throw console.error(e),e}async loadContent(){try{if(h.isBuffer(this.content))return this.content;if(ArrayBuffer.isView(this.content))return h.from(this.content.buffer,this.content.byteOffset,this.content.byteLength);if("undefined"!=typeof Blob&&this.content instanceof Blob){const t=new FileReader,e=new Promise(((e,r)=>{t.onerror=t=>{r(t)},t.onload=()=>{const r=t.result;e(h.from(r))},t.readAsArrayBuffer(this.content)}));return await e}{const t=Object.prototype.toString.call(this.content);throw new Error(`Unexpected type ${t}`)}}catch(t){console.error(t);const e=new Error(`Error loading content: ${t}`);throw console.error(e),e}}load(){return void 0===this.loadedData&&(this.loadedData=this.loadContent()),this.loadedData}};let Xe=Ge;Xe.supportedTypesMsg="Supported types are: `string` (to be UTF8 encoded), `Buffer`, `Blob`, `File`, `ArrayBuffer`, `UInt8Array` or any other typed array buffer. ";var Je=r(6314);const Ze="blockstack-gaia-hub-config";async function Ye(t,e,r,n="application/octet-stream",i=!0,o,s){a.debug(`uploadToGaiaHub: uploading ${t} to ${r.server}`);const u={"Content-Type":n,Authorization:`bearer ${r.token}`};s||(i?u["If-None-Match"]="*":o&&(u["If-Match"]=o));const f=await pe(`${r.server}/store/${r.address}/${t}`,{method:"POST",headers:u,body:e});if(!f.ok)throw await ir(f,"Error when uploading to Gaia hub.",r);const h=await f.text();return JSON.parse(h)}async function Qe(t,e){a.debug(`deleteFromGaiaHub: deleting ${t} from ${e.server}`);const r=await pe(`${e.server}/delete/${e.address}/${t}`,{method:"DELETE",headers:{Authorization:`bearer ${e.token}`}});if(!r.ok)throw await ir(r,"Error deleting file from Gaia hub.",e)}function tr(t,e){return Promise.resolve(`${e.url_prefix}${e.address}/${t}`)}function er(t,r,n,i){const o=t.challenge_text,s=t.latest_auth_version&&parseInt(t.latest_auth_version.slice(1),10)>=1,a=Ke(r);if(!s)return function(t,e){let r;try{r=JSON.parse(t)}catch(t){throw new Error("Failed in parsing legacy challenge text from the gaia hub.")}if("gaiahub"===r[0]&&"blockstack_storage_please_sign"===r[3]){const r=(n=qe(h.from(t)),i=function(t){const e=Ce(t);return 33==e.length?e:h.concat([e,h.from([1])])}(e),h.from(gt(n,Ce(i).slice(0,32),{der:!1}))),o=Je._v.signature.encode(r,Je.YW.SIGHASH_NONE).toString("hex").slice(0,-2),s=Ke(e);return h.from(JSON.stringify({publickey:s,signature:o})).toString("base64")}throw new Error("Failed to connect to legacy gaia hub. If you operate this hub, please update.");var n,i}(o,r);const u={gaiaChallenge:o,hubUrl:n,iss:a,salt:(16,h.from(wt.randomBytes(16))).toString("hex"),associationToken:i};return`v1:${new e.TokenSigner("ES256K",r).sign(u)}`}async function rr(t,e,r){a.debug(`connectToGaiaHub: ${t}/hub_info`);const n=await pe(`${t}/hub_info`),i=await n.json(),o=i.read_url_prefix,s=er(i,e,t,r),u=$e(Ke(e));return{url_prefix:o,max_file_upload_size_megabytes:i.max_file_upload_size_megabytes,address:u,token:s,server:t}}async function nr(t,e){const r=await pe(`${t}/hub_info`),n=await r.text();return`${JSON.parse(n).read_url_prefix}${$e(Ke(e))}/`}async function ir(t,e,r){if(t.ok)throw new Error("Cannot get a BlockstackError from a valid response.");const n=await async function(t){let e,r="";try{r=await t.text();try{e=JSON.parse(r)}catch(t){}}catch(t){a.debug(`Error getting bad http response text: ${t}`)}return{status:t.status,statusText:t.statusText,body:e||r}}(t);if(401===n.status)return new Ue(e,n);if(402===n.status)return new Be(e,n);if(403===n.status)return new Ne(e,n);if(404===n.status)throw new xe(e,n);if(409===n.status)return new Pe(e,n);if(412===n.status)return new Le(e,n);if(413===n.status){const t=r&&r.max_file_upload_size_megabytes?c(r.max_file_upload_size_megabytes):0;return new Re(e,n,t)}return new Error(e)}class or{constructor(t){this.userSession=t.userSession}async getFile(t,e){const r={decrypt:!0,verify:!1,app:d("location",{returnEmptyObject:!0}).origin},n=Object.assign({},r,e);if(n.verify&&!n.decrypt)return this.getFileSignedUnencrypted(t,n);const i=await this.getFileContents(t,n.app,n.username,n.zoneFileLookupURL,!!n.decrypt);if(null===i)return i;if(n.decrypt&&!n.verify){if("string"!=typeof i)throw new Error("Expected to get back a string for the cipherText");if("string"==typeof n.decrypt){const t={privateKey:n.decrypt};return this.userSession.decryptContent(i,t)}return this.userSession.decryptContent(i)}if(n.decrypt&&n.verify){if("string"!=typeof i)throw new Error("Expected to get back a string for the cipherText");let e;return"string"==typeof n.decrypt&&(e=n.decrypt),this.handleSignedEncryptedContents(t,i,n.app,e,n.username,n.zoneFileLookupURL)}if(n.verify||n.decrypt)throw new Error("Should be unreachable.");return i}async getUserAppFileUrl(t,e,r,n){const i=await function(t){if(!t.username)return Promise.reject(new Error("No username provided"));const e={network:new Ee},r=Object.assign(e,t),n=Se.fromNameOrNetwork(r.network);let i;return i=r.zoneFileLookupURL?pe(`${r.zoneFileLookupURL.replace(/\/$/,"")}/${r.username}`).then((t=>t.json())):n.getNameInfo(r.username),i.then((t=>{if(t.hasOwnProperty("zonefile")&&t.hasOwnProperty("address"))return e=t.zonefile,r=t.address,new Promise(((t,n)=>{let i=null;try{i=(0,le.parseZoneFile)(e),i.hasOwnProperty("$origin")||(i=null)}catch(t){n(t)}let o=null;if(i&&Object.keys(i).length>0)o=function(t){if(!t.hasOwnProperty("uri"))return null;if(!Array.isArray(t.uri))return null;if(t.uri.length<1)return null;const e=t.uri.filter((t=>t.hasOwnProperty("target")&&"_http._tcp"===t.name));if(e.length<1)return null;const r=e[0];if(!r.hasOwnProperty("target"))return null;let n=r.target;return n.startsWith("https")||n.startsWith("http")||(n=`https://${n}`),n}(i);else try{return t(be.fromLegacyFormat(JSON.parse(e)).profile())}catch(t){return n(t)}o?pe(o).then((t=>t.text())).then((t=>JSON.parse(t))).then((e=>{const n=he(e[0].token,r);t(n)})).catch((t=>{a.error(`resolveZoneFileToProfile: error fetching token file ${o}: ${t}`),n(t)})):(a.debug("Token file url not found. Resolving to blank profile."),t({}))}));var e,r;throw new Error("Invalid zonefile lookup response: did not contain `address` or `zonefile` field")}))}({username:e,zoneFileLookupURL:n});let o;return i.hasOwnProperty("apps")&&i.apps.hasOwnProperty(r)&&(o=`${i.apps[r].replace(/\/?(\?|#|$)/,"/$1")}${t}`),o}async getGaiaAddress(t,e,r){const n=ar(this.userSession,{app:t,username:e,zoneFileLookupURL:r});let i;if(e)i=await this.getUserAppFileUrl("/",n.username,n.app,n.zoneFileLookupURL);else{const t=await this.getOrSetLocalGaiaHubConnection();i=await tr("/",t)}const o=i.match(/([13][a-km-zA-HJ-NP-Z0-9]{26,35})/);if(!o)throw new Error("Failed to parse gaia address");return o[o.length-1]}async getFileUrl(t,e){const r=ar(this.userSession,e);let n;if(r.username)n=await this.getUserAppFileUrl(t,r.username,r.app,r.zoneFileLookupURL);else{const e=await this.getOrSetLocalGaiaHubConnection();n=await tr(t,e)}if(n)return n;throw new Error("Missing readURL")}async getFileContents(t,e,r,n,i){const o={app:e,username:r,zoneFileLookupURL:n},s=await this.getFileUrl(t,o),a=await pe(s);if(!a.ok)throw await ir(a,`getFile ${t} failed.`,null);let u=a.headers.get("Content-Type");"string"==typeof u&&(u=u.toLowerCase());const f=a.headers.get("ETag");if(f){const e=this.userSession.store.getSessionData();e.etags[t]=f,this.userSession.store.setSessionData(e)}return i||null===u||u.startsWith("text")||u.startsWith("application/json")?a.text():a.arrayBuffer()}async getFileSignedUnencrypted(t,e){const r=`${t}.sig`;try{const[n,i,o]=await Promise.all([this.getFileContents(t,e.app,e.username,e.zoneFileLookupURL,!1),this.getFileContents(r,e.app,e.username,e.zoneFileLookupURL,!0),this.getGaiaAddress(e.app,e.username,e.zoneFileLookupURL)]);if(!n)return n;if(!o)throw new Oe(`Failed to get gaia address for verification of: ${t}`);if(!i||"string"!=typeof i)throw new Oe(`Failed to obtain signature for file: ${t} -- looked in ${t}.sig`);let s,a;try{const t=JSON.parse(i);s=t.signature,a=t.publicKey}catch(e){throw e instanceof SyntaxError?new Error(`Failed to parse signature content JSON (path: ${t}.sig) The content may be corrupted.`):e}const u=$e(a);if(o!==u)throw new Oe(`Signer pubkey address (${u}) doesn't match gaia address (${o})`);if(Ve(n,a,s))return n;throw new Oe(`Contents do not match ECDSA signature: path: ${t}, signature: ${t}.sig`)}catch(e){throw e instanceof xe&&e.message.indexOf(r)>=0?new Oe(`Failed to obtain signature for file: ${t} -- looked in ${t}.sig`):e}}async handleSignedEncryptedContents(t,e,r,n,i,o){const s=Ke(n||this.userSession.loadUserData().appPrivateKey);let a,u;if(a=i?await this.getGaiaAddress(r,i,o):$e(s),!a)throw new Oe(`Failed to get gaia address for verification of: ${t}`);try{u=JSON.parse(e)}catch(t){throw t instanceof SyntaxError?new Error("Failed to parse encrypted, signed content JSON. The content may not be encrypted. If using getFile, try passing { verify: false, decrypt: false }."):t}const f=u.signature,h=u.publicKey,c=u.cipherText,l=$e(h);if(h&&c&&f){if(l!==a)throw new Oe(`Signer pubkey address (${l}) doesn't match gaia address (${a})`);if(Ve(c,h,f)){if("string"==typeof n){const t={privateKey:n};return this.userSession.decryptContent(c,t)}return this.userSession.decryptContent(c)}throw new Oe(`Contents do not match ECDSA signature in file: ${t}`)}throw new Oe(`Failed to get signature verification data from file: ${t}`)}async putFile(t,e,r){var n,i;const o=Object.assign({},{encrypt:!0,sign:!1,cipherTextEncoding:"hex",dangerouslyIgnoreEtag:!1},r),s=await this.getOrSetLocalGaiaHubConnection(),a=c(s.max_file_upload_size_megabytes),u=a>0,f=new Xe(e,o.contentType);let l,d=f.contentType;if(!o.encrypt&&u&&f.contentByteLength>a){const t=`The max file upload size for this hub is ${a} bytes, the given content is ${f.contentByteLength} bytes`,e=new Re(t,null,a);throw console.error(e),e}if(o.encrypt&&u){const t=function(t){const{payloadShell:e,payloadValuesLength:r}=function(t){const e={iv:"",ephemeralPK:"",mac:"",cipherText:"",wasString:!!t.wasString};return"base64"===t.cipherTextEncoding&&(e.cipherTextEncoding="base64"),{payloadValuesLength:162,payloadShell:JSON.stringify(e)}}(t),n=(i=t.contentLength,16*(Math.floor(i/16)+1));var i;let o;if(t.cipherTextEncoding&&"hex"!==t.cipherTextEncoding){if("base64"!==t.cipherTextEncoding)throw new Error(`Unexpected cipherTextEncoding "${t.cipherTextEncoding}"`);o=function(t){return 4*Math.ceil(t/3)}(n)}else o=2*n;if(t.sign){const{signedPayloadShell:t,signedPayloadValuesLength:n}=function(t){const e={signature:"",publicKey:"",cipherText:t};return{signedPayloadValuesLength:210,signedPayloadShell:JSON.stringify(e)}}(e);return t.length+n+r+o}return e.length+r+o}({contentLength:f.contentByteLength,wasString:f.wasString,sign:!!o.sign,cipherTextEncoding:o.cipherTextEncoding});if(t>a){const e=new Re(`The max file upload size for this hub is ${a} bytes, the given content is ${t} bytes after encryption`,null,a);throw console.error(e),e}}let p=!0;const y=this.userSession.store.getSessionData();let m;if(o.dangerouslyIgnoreEtag||(null==(n=y.etags)?void 0:n[t])&&(p=!1,l=null==(i=y.etags)?void 0:i[t]),!o.encrypt&&o.sign){const e=await f.load();let r;r="string"==typeof o.sign?o.sign:this.userSession.loadUserData().appPrivateKey;const n=function(t,e){const r=e instanceof h?e:h.from(e),n=Ke(t),i=gt(qe(r),t);return{signature:wt.bytesToHex(i),publicKey:n}}(r,e),i=JSON.stringify(n);m=async r=>{const n=(await Promise.all([Ye(t,e,r,d,p,l,o.dangerouslyIgnoreEtag),Ye(`${t}.sig`,i,r,"application/json")]))[0];return!o.dangerouslyIgnoreEtag&&n.etag&&(y.etags[t]=n.etag,this.userSession.store.setSessionData(y)),n.publicURL}}else{let e;if(o.encrypt||o.sign){let t;t="string"==typeof o.encrypt?o.encrypt:"string"==typeof o.sign?Ke(o.sign):Ke(this.userSession.loadUserData().appPrivateKey);const r=await f.load();e=await this.userSession.encryptContent(r,{publicKey:t,wasString:f.wasString,cipherTextEncoding:o.cipherTextEncoding,sign:o.sign}),d="application/json"}else e=f.content;m=async r=>{const n=await Ye(t,e,r,d,p,l,o.dangerouslyIgnoreEtag);return n.etag&&(y.etags[t]=n.etag,this.userSession.store.setSessionData(y)),n.publicURL}}try{return await m(s)}catch(t){if(function(t){if(!t||!t.hubError||!t.hubError.statusCode)return!1;const e=t.hubError.statusCode;return 401===e||(409===e||e>=500&&e<=599)}(t)){console.error(t),console.error("Possible recoverable error during Gaia upload, retrying...");const e=await this.setLocalGaiaHubConnection();return await m(e)}throw t}}async deleteFile(t,e){const r=await this.getOrSetLocalGaiaHubConnection();if(Object.assign({},e).wasSigned)try{await Qe(t,r),await Qe(`${t}.sig`,r);const e=this.userSession.store.getSessionData();delete e.etags[t],this.userSession.store.setSessionData(e)}catch(e){const n=await this.setLocalGaiaHubConnection();await Qe(t,n),await Qe(`${t}.sig`,r);const i=this.userSession.store.getSessionData();delete i.etags[t],this.userSession.store.setSessionData(i)}else try{await Qe(t,r);const e=this.userSession.store.getSessionData();delete e.etags[t],this.userSession.store.setSessionData(e)}catch(e){const r=await this.setLocalGaiaHubConnection();await Qe(t,r);const n=this.userSession.store.getSessionData();delete n.etags[t],this.userSession.store.setSessionData(n)}}getAppBucketUrl(t,e){return nr(t,e)}async listFilesLoop(t,e,r,n,i){if(r>65536)throw new Error("Too many entries to list");let o;t=t||await this.getOrSetLocalGaiaHubConnection();try{const r=JSON.stringify({page:e}),n={method:"POST",headers:{"Content-Type":"application/json","Content-Length":`${r.length}`,Authorization:`bearer ${t.token}`},body:r};if(o=await pe(`${t.server}/list-files/${t.address}`,n),!o.ok)throw await ir(o,"ListFiles failed.",t)}catch(t){if(0===r){const t=await this.setLocalGaiaHubConnection();return this.listFilesLoop(t,e,r+1,0,i)}throw t}const s=await o.text(),a=JSON.parse(s),u=a.entries,f=a.page;if(null==u)throw new Error("Bad listFiles response: no entries");let h=0;for(let t=0;t<u.length;t++)if(null!==u[t]&&(h++,!i(u[t])))return n+t;return f&&u.length>0?this.listFilesLoop(t,f,r+1,n+h,i):n+h}listFiles(t){return this.listFilesLoop(null,null,0,0,t)}async getOrSetLocalGaiaHubConnection(){const t=this.userSession.store.getSessionData().userData;if(!t)throw new Ie("Missing userData");const e=t.gaiaHubConfig;return e?Promise.resolve(e):this.setLocalGaiaHubConnection()}async setLocalGaiaHubConnection(){const t=this.userSession.loadUserData();if(!t)throw new Ie("Missing userData");t.hubUrl||(t.hubUrl="https://hub.blockstack.org");const e=await rr(t.hubUrl,t.appPrivateKey,t.gaiaAssociationToken);t.gaiaHubConfig=e;const r=this.userSession.store.getSessionData();return r.userData.gaiaHubConfig=e,this.userSession.store.setSessionData(r),e}}function sr(t){return new or({}).getUserAppFileUrl(t.path,t.username,t.appOrigin,t.zoneFileLookupURL)}function ar(t,e){var r;const n=Object.assign({},e);if(n.username){if(!n.app){if(!t.appConfig)throw new Ie("Missing AppConfig");n.app=t.appConfig.appDomain}if(!n.zoneFileLookupURL){if(!t.appConfig)throw new Ie("Missing AppConfig");if(!t.store)throw new Ie("Missing store UserSession");const e=(null==(r=t.store.getSessionData().userData)?void 0:r.coreNode)||t.appConfig.coreNode;e&&(n.zoneFileLookupURL=`${e}/v1/names`)}}return n}})(),n})()));
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StacksStorage=e():t.StacksStorage=e()}(this,(()=>(()=>{var t={625:function(t,e,r){t=r.nmd(t);var n=r(4406);!function(e){"use strict";function i(t,e){e|=0;for(var r=Math.max(t.length-e,0),n=Array(r),i=0;i<r;i++)n[i]=t[e+i];return n}var o=function(t){var e=i(arguments,1);return function(){var r=i(arguments);return t.apply(null,e.concat(r))}},s=function(t){return function(){var e=i(arguments),r=e.pop();t.call(this,e,r)}};function a(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var u="function"==typeof setImmediate&&setImmediate,f="object"==typeof n&&"function"==typeof n.nextTick;function h(t){setTimeout(t,0)}function c(t){return function(e){var r=i(arguments,1);t((function(){e.apply(null,r)}))}}var l=c(u?setImmediate:f?n.nextTick:h);function d(t){return s((function(e,r){var n;try{n=t.apply(this,e)}catch(t){return r(t)}a(n)&&"function"==typeof n.then?n.then((function(t){p(r,null,t)}),(function(t){p(r,t.message?t:new Error(t))})):r(null,n)}))}function p(t,e,r){try{t(e,r)}catch(t){l(y,t)}}function y(t){throw t}var m="function"==typeof Symbol;function g(t){return m&&"AsyncFunction"===t[Symbol.toStringTag]}function b(t){return g(t)?d(t):t}function v(t){return function(e){var r=i(arguments,1),n=s((function(r,n){var i=this;return t(e,(function(t,e){b(t).apply(i,r.concat(e))}),n)}));return r.length?n.apply(this,r):n}}var w="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,_="object"==typeof self&&self&&self.Object===Object&&self,S=w||_||Function("return this")(),E=S.Symbol,M=Object.prototype,k=M.hasOwnProperty,A=M.toString,O=E?E.toStringTag:void 0;var I=Object.prototype.toString;var T=E?E.toStringTag:void 0;function x(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":T&&T in Object(t)?function(t){var e=k.call(t,O),r=t[O];try{t[O]=void 0;var n=!0}catch(t){}var i=A.call(t);return n&&(e?t[O]=r:delete t[O]),i}(t):function(t){return I.call(t)}(t)}function P(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function B(t){return null!=t&&P(t.length)&&!function(t){if(!a(t))return!1;var e=x(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}(t)}var N={};function U(){}function R(t){return function(){if(null!==t){var e=t;t=null,e.apply(this,arguments)}}}var L="function"==typeof Symbol&&Symbol.iterator;function C(t){return null!=t&&"object"==typeof t}function j(t){return C(t)&&"[object Arguments]"==x(t)}var F=Object.prototype,H=F.hasOwnProperty,D=F.propertyIsEnumerable,q=j(function(){return arguments}())?j:function(t){return C(t)&&H.call(t,"callee")&&!D.call(t,"callee")},z=Array.isArray;var $="object"==typeof e&&e&&!e.nodeType&&e,K=$&&t&&!t.nodeType&&t,W=K&&K.exports===$?S.Buffer:void 0,V=(W?W.isBuffer:void 0)||function(){return!1},G=/^(?:0|[1-9]\d*)$/;function X(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&G.test(t))&&t>-1&&t%1==0&&t<e}var J={};J["[object Float32Array]"]=J["[object Float64Array]"]=J["[object Int8Array]"]=J["[object Int16Array]"]=J["[object Int32Array]"]=J["[object Uint8Array]"]=J["[object Uint8ClampedArray]"]=J["[object Uint16Array]"]=J["[object Uint32Array]"]=!0,J["[object Arguments]"]=J["[object Array]"]=J["[object ArrayBuffer]"]=J["[object Boolean]"]=J["[object DataView]"]=J["[object Date]"]=J["[object Error]"]=J["[object Function]"]=J["[object Map]"]=J["[object Number]"]=J["[object Object]"]=J["[object RegExp]"]=J["[object Set]"]=J["[object String]"]=J["[object WeakMap]"]=!1;var Z,Y="object"==typeof e&&e&&!e.nodeType&&e,Q=Y&&t&&!t.nodeType&&t,tt=Q&&Q.exports===Y&&w.process,et=function(){try{return Q&&Q.require&&Q.require("util").types||tt&&tt.binding&&tt.binding("util")}catch(t){}}(),rt=et&&et.isTypedArray,nt=rt?(Z=rt,function(t){return Z(t)}):function(t){return C(t)&&P(t.length)&&!!J[x(t)]},it=Object.prototype.hasOwnProperty;function ot(t,e){var r=z(t),n=!r&&q(t),i=!r&&!n&&V(t),o=!r&&!n&&!i&&nt(t),s=r||n||i||o,a=s?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],u=a.length;for(var f in t)!e&&!it.call(t,f)||s&&("length"==f||i&&("offset"==f||"parent"==f)||o&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||X(f,u))||a.push(f);return a}var st=Object.prototype;var at=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),ut=Object.prototype.hasOwnProperty;function ft(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||st))return at(t);var e,r,n=[];for(var i in Object(t))ut.call(t,i)&&"constructor"!=i&&n.push(i);return n}function ht(t){return B(t)?ot(t):ft(t)}function ct(t){if(B(t))return function(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}(t);var e,r,n,i,o=function(t){return L&&t[L]&&t[L]()}(t);return o?function(t){var e=-1;return function(){var r=t.next();return r.done?null:(e++,{value:r.value,key:e})}}(o):(r=ht(e=t),n=-1,i=r.length,function t(){var o=r[++n];return"__proto__"===o?t():n<i?{value:e[o],key:o}:null})}function lt(t){return function(){if(null===t)throw new Error("Callback was already called.");var e=t;t=null,e.apply(this,arguments)}}function dt(t){return function(e,r,n){if(n=R(n||U),t<=0||!e)return n(null);var i=ct(e),o=!1,s=0,a=!1;function u(t,e){if(s-=1,t)o=!0,n(t);else{if(e===N||o&&s<=0)return o=!0,n(null);a||f()}}function f(){for(a=!0;s<t&&!o;){var e=i();if(null===e)return o=!0,void(s<=0&&n(null));s+=1,r(e.value,e.key,lt(u))}a=!1}f()}}function pt(t,e,r,n){dt(e)(t,b(r),n)}function yt(t,e){return function(r,n,i){return t(r,e,n,i)}}function mt(t,e,r){r=R(r||U);var n=0,i=0,o=t.length;function s(t,e){t?r(t):++i!==o&&e!==N||r(null)}for(0===o&&r(null);n<o;n++)e(t[n],n,lt(s))}var gt=yt(pt,1/0),bt=function(t,e,r){(B(t)?mt:gt)(t,b(e),r)};function vt(t){return function(e,r,n){return t(bt,e,b(r),n)}}function wt(t,e,r,n){n=n||U,e=e||[];var i=[],o=0,s=b(r);t(e,(function(t,e,r){var n=o++;s(t,(function(t,e){i[n]=e,r(t)}))}),(function(t){n(t,i)}))}var _t=vt(wt),St=v(_t);function Et(t){return function(e,r,n,i){return t(dt(r),e,b(n),i)}}var Mt=Et(wt),kt=yt(Mt,1),At=v(kt);function Ot(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}var It,Tt=function(t,e,r){for(var n=-1,i=Object(t),o=r(t),s=o.length;s--;){var a=o[It?s:++n];if(!1===e(i[a],a,i))break}return t};function xt(t,e){return t&&Tt(t,e,ht)}function Pt(t){return t!=t}function Bt(t,e,r){return e==e?function(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}(t,e,r):function(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}(t,Pt,r)}var Nt=function(t,e,r){"function"==typeof e&&(r=e,e=null),r=R(r||U);var n=ht(t).length;if(!n)return r(null);e||(e=n);var o={},s=0,a=!1,u=Object.create(null),f=[],h=[],c={};function l(t,e){f.push((function(){!function(t,e){if(!a){var n=lt((function(e,n){if(s--,arguments.length>2&&(n=i(arguments,1)),e){var f={};xt(o,(function(t,e){f[e]=t})),f[t]=n,a=!0,u=Object.create(null),r(e,f)}else o[t]=n,p(t)}));s++;var f=b(e[e.length-1]);e.length>1?f(o,n):f(n)}}(t,e)}))}function d(){if(0===f.length&&0===s)return r(null,o);for(;f.length&&s<e;)f.shift()()}function p(t){Ot(u[t]||[],(function(t){t()})),d()}function y(e){var r=[];return xt(t,(function(t,n){z(t)&&Bt(t,e,0)>=0&&r.push(n)})),r}xt(t,(function(e,r){if(!z(e))return l(r,[e]),void h.push(r);var n=e.slice(0,e.length-1),i=n.length;if(0===i)return l(r,e),void h.push(r);c[r]=i,Ot(n,(function(o){if(!t[o])throw new Error("async.auto task `"+r+"` has a non-existent dependency `"+o+"` in "+n.join(", "));var s,a,f;a=function(){0==--i&&l(r,e)},(f=u[s=o])||(f=u[s]=[]),f.push(a)}))})),function(){for(var t=0;h.length;)t++,Ot(y(h.pop()),(function(t){0==--c[t]&&h.push(t)}));if(t!==n)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),d()};function Ut(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var Rt=E?E.prototype:void 0,Lt=Rt?Rt.toString:void 0;function Ct(t){if("string"==typeof t)return t;if(z(t))return Ut(t,Ct)+"";if(function(t){return"symbol"==typeof t||C(t)&&"[object Symbol]"==x(t)}(t))return Lt?Lt.call(t):"";var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function jt(t,e,r){var n=t.length;return r=void 0===r?n:r,!e&&r>=n?t:function(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(r=r>i?i:r)<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}(t,e,r)}var Ft=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Ht="[\\ud800-\\udfff]",Dt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",qt="\\ud83c[\\udffb-\\udfff]",zt="[^\\ud800-\\udfff]",$t="(?:\\ud83c[\\udde6-\\uddff]){2}",Kt="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="(?:"+Dt+"|"+qt+")?",Vt="[\\ufe0e\\ufe0f]?",Gt=Vt+Wt+("(?:\\u200d(?:"+[zt,$t,Kt].join("|")+")"+Vt+Wt+")*"),Xt="(?:"+[zt+Dt+"?",Dt,$t,Kt,Ht].join("|")+")",Jt=RegExp(qt+"(?="+qt+")|"+Xt+Gt,"g");function Zt(t){return function(t){return Ft.test(t)}(t)?function(t){return t.match(Jt)||[]}(t):function(t){return t.split("")}(t)}var Yt=/^\s+|\s+$/g;function Qt(t,e,r){if((t=null==(n=t)?"":Ct(n))&&(r||void 0===e))return t.replace(Yt,"");var n;if(!t||!(e=Ct(e)))return t;var i=Zt(t),o=Zt(e);return jt(i,function(t,e){for(var r=-1,n=t.length;++r<n&&Bt(e,t[r],0)>-1;);return r}(i,o),function(t,e){for(var r=t.length;r--&&Bt(e,t[r],0)>-1;);return r}(i,o)+1).join("")}var te=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,ee=/,/,re=/(=.+)?(\s*)$/,ne=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function ie(t,e){var r={};xt(t,(function(t,e){var n,i=g(t),o=!i&&1===t.length||i&&0===t.length;if(z(t))n=t.slice(0,-1),t=t[t.length-1],r[e]=n.concat(n.length>0?s:t);else if(o)r[e]=t;else{if(n=function(t){return(t=(t=(t=t.toString().replace(ne,"")).match(te)[2].replace(" ",""))?t.split(ee):[]).map((function(t){return Qt(t.replace(re,""))}))}(t),0===t.length&&!i&&0===n.length)throw new Error("autoInject task functions require explicit parameters.");i||n.pop(),r[e]=n.concat(s)}function s(e,r){var i=Ut(n,(function(t){return e[t]}));i.push(r),b(t).apply(null,i)}})),Nt(r,e)}function oe(){this.head=this.tail=null,this.length=0}function se(t,e){t.length=1,t.head=t.tail=e}function ae(t,e,r){if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var n=b(t),i=0,o=[],s=!1;function a(t,e,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(h.started=!0,z(t)||(t=[t]),0===t.length&&h.idle())return l((function(){h.drain()}));for(var n=0,i=t.length;n<i;n++){var o={data:t[n],callback:r||U};e?h._tasks.unshift(o):h._tasks.push(o)}s||(s=!0,l((function(){s=!1,h.process()})))}function u(t){return function(e){i-=1;for(var r=0,n=t.length;r<n;r++){var s=t[r],a=Bt(o,s,0);0===a?o.shift():a>0&&o.splice(a,1),s.callback.apply(s,arguments),null!=e&&h.error(e,s.data)}i<=h.concurrency-h.buffer&&h.unsaturated(),h.idle()&&h.drain(),h.process()}}var f=!1,h={_tasks:new oe,concurrency:e,payload:r,saturated:U,unsaturated:U,buffer:e/4,empty:U,drain:U,error:U,started:!1,paused:!1,push:function(t,e){a(t,!1,e)},kill:function(){h.drain=U,h._tasks.empty()},unshift:function(t,e){a(t,!0,e)},remove:function(t){h._tasks.remove(t)},process:function(){if(!f){for(f=!0;!h.paused&&i<h.concurrency&&h._tasks.length;){var t=[],e=[],r=h._tasks.length;h.payload&&(r=Math.min(r,h.payload));for(var s=0;s<r;s++){var a=h._tasks.shift();t.push(a),o.push(a),e.push(a.data)}i+=1,0===h._tasks.length&&h.empty(),i===h.concurrency&&h.saturated();var c=lt(u(t));n(e,c)}f=!1}},length:function(){return h._tasks.length},running:function(){return i},workersList:function(){return o},idle:function(){return h._tasks.length+i===0},pause:function(){h.paused=!0},resume:function(){!1!==h.paused&&(h.paused=!1,l(h.process))}};return h}function ue(t,e){return ae(t,1,e)}oe.prototype.removeLink=function(t){return t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,t.prev=t.next=null,this.length-=1,t},oe.prototype.empty=function(){for(;this.head;)this.shift();return this},oe.prototype.insertAfter=function(t,e){e.prev=t,e.next=t.next,t.next?t.next.prev=e:this.tail=e,t.next=e,this.length+=1},oe.prototype.insertBefore=function(t,e){e.prev=t.prev,e.next=t,t.prev?t.prev.next=e:this.head=e,t.prev=e,this.length+=1},oe.prototype.unshift=function(t){this.head?this.insertBefore(this.head,t):se(this,t)},oe.prototype.push=function(t){this.tail?this.insertAfter(this.tail,t):se(this,t)},oe.prototype.shift=function(){return this.head&&this.removeLink(this.head)},oe.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},oe.prototype.toArray=function(){for(var t=Array(this.length),e=this.head,r=0;r<this.length;r++)t[r]=e.data,e=e.next;return t},oe.prototype.remove=function(t){for(var e=this.head;e;){var r=e.next;t(e)&&this.removeLink(e),e=r}return this};var fe=yt(pt,1);function he(t,e,r,n){n=R(n||U);var i=b(r);fe(t,(function(t,r,n){i(e,t,(function(t,r){e=r,n(t)}))}),(function(t){n(t,e)}))}function ce(){var t=Ut(arguments,b);return function(){var e=i(arguments),r=this,n=e[e.length-1];"function"==typeof n?e.pop():n=U,he(t,e,(function(t,e,n){e.apply(r,t.concat((function(t){var e=i(arguments,1);n(t,e)})))}),(function(t,e){n.apply(r,[t].concat(e))}))}}var le=function(){return ce.apply(null,i(arguments).reverse())},de=Array.prototype.concat,pe=function(t,e,r,n){n=n||U;var o=b(r);Mt(t,e,(function(t,e){o(t,(function(t){return t?e(t):e(null,i(arguments,1))}))}),(function(t,e){for(var r=[],i=0;i<e.length;i++)e[i]&&(r=de.apply(r,e[i]));return n(t,r)}))},ye=yt(pe,1/0),me=yt(pe,1),ge=function(){var t=i(arguments),e=[null].concat(t);return function(){return arguments[arguments.length-1].apply(this,e)}};function be(t){return t}function ve(t,e){return function(r,n,i,o){o=o||U;var s,a=!1;r(n,(function(r,n,o){i(r,(function(n,i){n?o(n):t(i)&&!s?(a=!0,s=e(!0,r),o(null,N)):o()}))}),(function(t){t?o(t):o(null,a?s:e(!1))}))}}function we(t,e){return e}var _e=vt(ve(be,we)),Se=Et(ve(be,we)),Ee=yt(Se,1);function Me(t){return function(e){var r=i(arguments,1);r.push((function(e){var r=i(arguments,1);"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&Ot(r,(function(e){console[t](e)})))})),b(e).apply(null,r)}}var ke=Me("dir");function Ae(t,e,r){r=lt(r||U);var n=b(t),o=b(e);function s(t){if(t)return r(t);var e=i(arguments,1);e.push(a),o.apply(this,e)}function a(t,e){return t?r(t):e?void n(s):r(null)}a(null,!0)}function Oe(t,e,r){r=lt(r||U);var n=b(t),o=function(t){if(t)return r(t);var s=i(arguments,1);if(e.apply(this,s))return n(o);r.apply(null,[null].concat(s))};n(o)}function Ie(t,e,r){Oe(t,(function(){return!e.apply(this,arguments)}),r)}function Te(t,e,r){r=lt(r||U);var n=b(e),i=b(t);function o(t){if(t)return r(t);i(s)}function s(t,e){return t?r(t):e?void n(o):r(null)}i(s)}function xe(t){return function(e,r,n){return t(e,n)}}function Pe(t,e,r){bt(t,xe(b(e)),r)}function Be(t,e,r,n){dt(e)(t,xe(b(r)),n)}var Ne=yt(Be,1);function Ue(t){return g(t)?t:s((function(e,r){var n=!0;e.push((function(){var t=arguments;n?l((function(){r.apply(null,t)})):r.apply(null,t)})),t.apply(this,e),n=!1}))}function Re(t){return!t}var Le=vt(ve(Re,Re)),Ce=Et(ve(Re,Re)),je=yt(Ce,1);function Fe(t){return function(e){return null==e?void 0:e[t]}}function He(t,e,r,n){var i=new Array(e.length);t(e,(function(t,e,n){r(t,(function(t,r){i[e]=!!r,n(t)}))}),(function(t){if(t)return n(t);for(var r=[],o=0;o<e.length;o++)i[o]&&r.push(e[o]);n(null,r)}))}function De(t,e,r,n){var i=[];t(e,(function(t,e,n){r(t,(function(r,o){r?n(r):(o&&i.push({index:e,value:t}),n())}))}),(function(t){t?n(t):n(null,Ut(i.sort((function(t,e){return t.index-e.index})),Fe("value")))}))}function qe(t,e,r,n){(B(e)?He:De)(t,e,b(r),n||U)}var ze=vt(qe),$e=Et(qe),Ke=yt($e,1);function We(t,e){var r=lt(e||U),n=b(Ue(t));!function t(e){if(e)return r(e);n(t)}()}var Ve=function(t,e,r,n){n=n||U;var i=b(r);Mt(t,e,(function(t,e){i(t,(function(r,n){return r?e(r):e(null,{key:n,val:t})}))}),(function(t,e){for(var r={},i=Object.prototype.hasOwnProperty,o=0;o<e.length;o++)if(e[o]){var s=e[o].key,a=e[o].val;i.call(r,s)?r[s].push(a):r[s]=[a]}return n(t,r)}))},Ge=yt(Ve,1/0),Xe=yt(Ve,1),Je=Me("log");function Ze(t,e,r,n){n=R(n||U);var i={},o=b(r);pt(t,e,(function(t,e,r){o(t,e,(function(t,n){if(t)return r(t);i[e]=n,r()}))}),(function(t){n(t,i)}))}var Ye=yt(Ze,1/0),Qe=yt(Ze,1);function tr(t,e){return e in t}function er(t,e){var r=Object.create(null),n=Object.create(null);e=e||be;var o=b(t),a=s((function(t,s){var a=e.apply(null,t);tr(r,a)?l((function(){s.apply(null,r[a])})):tr(n,a)?n[a].push(s):(n[a]=[s],o.apply(null,t.concat((function(){var t=i(arguments);r[a]=t;var e=n[a];delete n[a];for(var o=0,s=e.length;o<s;o++)e[o].apply(null,t)}))))}));return a.memo=r,a.unmemoized=t,a}var rr=c(f?n.nextTick:u?setImmediate:h);function nr(t,e,r){r=r||U;var n=B(e)?[]:{};t(e,(function(t,e,r){b(t)((function(t,o){arguments.length>2&&(o=i(arguments,1)),n[e]=o,r(t)}))}),(function(t){r(t,n)}))}function ir(t,e){nr(bt,t,e)}function or(t,e,r){nr(dt(e),t,r)}var sr=function(t,e){var r=b(t);return ae((function(t,e){r(t[0],e)}),e,1)},ar=function(t,e){var r=sr(t,e);return r.push=function(t,e,n){if(null==n&&(n=U),"function"!=typeof n)throw new Error("task callback must be a function");if(r.started=!0,z(t)||(t=[t]),0===t.length)return l((function(){r.drain()}));e=e||0;for(var i=r._tasks.head;i&&e>=i.priority;)i=i.next;for(var o=0,s=t.length;o<s;o++){var a={data:t[o],priority:e,callback:n};i?r._tasks.insertBefore(i,a):r._tasks.push(a)}l(r.process)},delete r.unshift,r};function ur(t,e){if(e=R(e||U),!z(t))return e(new TypeError("First argument to race must be an array of functions"));if(!t.length)return e();for(var r=0,n=t.length;r<n;r++)b(t[r])(e)}function fr(t,e,r,n){he(i(t).reverse(),e,r,n)}function hr(t){var e=b(t);return s((function(t,r){return t.push((function(t,e){var n;t?r(null,{error:t}):(n=arguments.length<=2?e:i(arguments,1),r(null,{value:n}))})),e.apply(this,t)}))}function cr(t){var e;return z(t)?e=Ut(t,hr):(e={},xt(t,(function(t,r){e[r]=hr.call(this,t)}))),e}function lr(t,e,r,n){qe(t,e,(function(t,e){r(t,(function(t,r){e(t,!r)}))}),n)}var dr=vt(lr),pr=Et(lr),yr=yt(pr,1);function mr(t){return function(){return t}}function gr(t,e,r){var n=5,i=0,o={times:n,intervalFunc:mr(i)};function s(t,e){if("object"==typeof e)t.times=+e.times||n,t.intervalFunc="function"==typeof e.interval?e.interval:mr(+e.interval||i),t.errorFilter=e.errorFilter;else{if("number"!=typeof e&&"string"!=typeof e)throw new Error("Invalid arguments for async.retry");t.times=+e||n}}if(arguments.length<3&&"function"==typeof t?(r=e||U,e=t):(s(o,t),r=r||U),"function"!=typeof e)throw new Error("Invalid arguments for async.retry");var a=b(e),u=1;function f(){a((function(t){t&&u++<o.times&&("function"!=typeof o.errorFilter||o.errorFilter(t))?setTimeout(f,o.intervalFunc(u)):r.apply(null,arguments)}))}f()}var br=function(t,e){e||(e=t,t=null);var r=b(e);return s((function(e,n){function i(t){r.apply(null,e.concat(t))}t?gr(t,i,n):gr(i,n)}))};function vr(t,e){nr(fe,t,e)}var wr=vt(ve(Boolean,be)),_r=Et(ve(Boolean,be)),Sr=yt(_r,1);function Er(t,e,r){var n=b(e);function i(t,e){var r=t.criteria,n=e.criteria;return r<n?-1:r>n?1:0}_t(t,(function(t,e){n(t,(function(r,n){if(r)return e(r);e(null,{value:t,criteria:n})}))}),(function(t,e){if(t)return r(t);r(null,Ut(e.sort(i),Fe("value")))}))}function Mr(t,e,r){var n=b(t);return s((function(i,o){var s,a=!1;i.push((function(){a||(o.apply(null,arguments),clearTimeout(s))})),s=setTimeout((function(){var e=t.name||"anonymous",n=new Error('Callback function "'+e+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),a=!0,o(n)}),e),n.apply(null,i)}))}var kr=Math.ceil,Ar=Math.max;function Or(t,e,r,n){var i=b(r);Mt(function(t,e,r,n){for(var i=-1,o=Ar(kr((e-t)/(r||1)),0),s=Array(o);o--;)s[n?o:++i]=t,t+=r;return s}(0,t,1),e,i,n)}var Ir=yt(Or,1/0),Tr=yt(Or,1);function xr(t,e,r,n){arguments.length<=3&&(n=r,r=e,e=z(t)?[]:{}),n=R(n||U);var i=b(r);bt(t,(function(t,r,n){i(e,t,r,n)}),(function(t){n(t,e)}))}function Pr(t,e){var r,n=null;e=e||U,Ne(t,(function(t,e){b(t)((function(t,o){r=arguments.length>2?i(arguments,1):o,n=t,e(!t)}))}),(function(){e(n,r)}))}function Br(t){return function(){return(t.unmemoized||t).apply(null,arguments)}}function Nr(t,e,r){r=lt(r||U);var n=b(e);if(!t())return r(null);var o=function(e){if(e)return r(e);if(t())return n(o);var s=i(arguments,1);r.apply(null,[null].concat(s))};n(o)}function Ur(t,e,r){Nr((function(){return!t.apply(this,arguments)}),e,r)}var Rr=function(t,e){if(e=R(e||U),!z(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var r=0;function n(e){var n=b(t[r++]);e.push(lt(o)),n.apply(null,e)}function o(o){if(o||r===t.length)return e.apply(null,arguments);n(i(arguments,1))}n([])},Lr={apply:o,applyEach:St,applyEachSeries:At,asyncify:d,auto:Nt,autoInject:ie,cargo:ue,compose:le,concat:ye,concatLimit:pe,concatSeries:me,constant:ge,detect:_e,detectLimit:Se,detectSeries:Ee,dir:ke,doDuring:Ae,doUntil:Ie,doWhilst:Oe,during:Te,each:Pe,eachLimit:Be,eachOf:bt,eachOfLimit:pt,eachOfSeries:fe,eachSeries:Ne,ensureAsync:Ue,every:Le,everyLimit:Ce,everySeries:je,filter:ze,filterLimit:$e,filterSeries:Ke,forever:We,groupBy:Ge,groupByLimit:Ve,groupBySeries:Xe,log:Je,map:_t,mapLimit:Mt,mapSeries:kt,mapValues:Ye,mapValuesLimit:Ze,mapValuesSeries:Qe,memoize:er,nextTick:rr,parallel:ir,parallelLimit:or,priorityQueue:ar,queue:sr,race:ur,reduce:he,reduceRight:fr,reflect:hr,reflectAll:cr,reject:dr,rejectLimit:pr,rejectSeries:yr,retry:gr,retryable:br,seq:ce,series:vr,setImmediate:l,some:wr,someLimit:_r,someSeries:Sr,sortBy:Er,timeout:Mr,times:Ir,timesLimit:Or,timesSeries:Tr,transform:xr,tryEach:Pr,unmemoize:Br,until:Ur,waterfall:Rr,whilst:Nr,all:Le,allLimit:Ce,allSeries:je,any:wr,anyLimit:_r,anySeries:Sr,find:_e,findLimit:Se,findSeries:Ee,forEach:Pe,forEachSeries:Ne,forEachLimit:Be,forEachOf:bt,forEachOfSeries:fe,forEachOfLimit:pt,inject:he,foldl:he,foldr:fr,select:ze,selectLimit:$e,selectSeries:Ke,wrapSync:d};e.default=Lr,e.apply=o,e.applyEach=St,e.applyEachSeries=At,e.asyncify=d,e.auto=Nt,e.autoInject=ie,e.cargo=ue,e.compose=le,e.concat=ye,e.concatLimit=pe,e.concatSeries=me,e.constant=ge,e.detect=_e,e.detectLimit=Se,e.detectSeries=Ee,e.dir=ke,e.doDuring=Ae,e.doUntil=Ie,e.doWhilst=Oe,e.during=Te,e.each=Pe,e.eachLimit=Be,e.eachOf=bt,e.eachOfLimit=pt,e.eachOfSeries=fe,e.eachSeries=Ne,e.ensureAsync=Ue,e.every=Le,e.everyLimit=Ce,e.everySeries=je,e.filter=ze,e.filterLimit=$e,e.filterSeries=Ke,e.forever=We,e.groupBy=Ge,e.groupByLimit=Ve,e.groupBySeries=Xe,e.log=Je,e.map=_t,e.mapLimit=Mt,e.mapSeries=kt,e.mapValues=Ye,e.mapValuesLimit=Ze,e.mapValuesSeries=Qe,e.memoize=er,e.nextTick=rr,e.parallel=ir,e.parallelLimit=or,e.priorityQueue=ar,e.queue=sr,e.race=ur,e.reduce=he,e.reduceRight=fr,e.reflect=hr,e.reflectAll=cr,e.reject=dr,e.rejectLimit=pr,e.rejectSeries=yr,e.retry=gr,e.retryable=br,e.seq=ce,e.series=vr,e.setImmediate=l,e.some=wr,e.someLimit=_r,e.someSeries=Sr,e.sortBy=Er,e.timeout=Mr,e.times=Ir,e.timesLimit=Or,e.timesSeries=Tr,e.transform=xr,e.tryEach=Pr,e.unmemoize=Br,e.until=Ur,e.waterfall=Rr,e.whilst=Nr,e.all=Le,e.allLimit=Ce,e.allSeries=je,e.any=wr,e.anyLimit=_r,e.anySeries=Sr,e.find=_e,e.findLimit=Se,e.findSeries=Ee,e.forEach=Pe,e.forEachSeries=Ne,e.forEachLimit=Be,e.forEachOf=bt,e.forEachOfSeries=fe,e.forEachOfLimit=pt,e.inject=he,e.foldl=he,e.foldr=fr,e.select=ze,e.selectLimit=$e,e.selectSeries=Ke,e.wrapSync=d,Object.defineProperty(e,"__esModule",{value:!0})}(e)},8166:t=>{"use strict";t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=n}var s=t.length,a=t.charAt(0),u=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return new Uint8Array;for(var r=0,n=0,i=0;t[r]===a;)n++,r++;for(var o=(t.length-r)*u+1>>>0,f=new Uint8Array(o);t[r];){var h=e[t.charCodeAt(r)];if(255===h)return;for(var c=0,l=o-1;(0!==h||c<i)&&-1!==l;l--,c++)h+=s*f[l]>>>0,f[l]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=c,r++}for(var d=o-i;d!==o&&0===f[d];)d++;for(var p=new Uint8Array(n+(o-d)),y=n;d!==o;)p[y++]=f[d++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var r=0,n=0,i=0,o=e.length;i!==o&&0===e[i];)i++,r++;for(var u=(o-i)*f+1>>>0,h=new Uint8Array(u);i!==o;){for(var c=e[i],l=0,d=u-1;(0!==c||l<n)&&-1!==d;d--,l++)c+=256*h[d]>>>0,h[d]=c%s>>>0,c=c/s>>>0;if(0!==c)throw new Error("Non-zero carry");n=l,i++}for(var p=u-n;p!==u&&0===h[p];)p++;for(var y=a.repeat(r);p<u;++p)y+=t.charAt(h[p]);return y},decodeUnsafe:h,decode:function(t){var e=h(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}},5766:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=u(t),s=o[0],a=o[1],f=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),h=0,c=a>0?s-4:s;for(r=0;r<c;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],f[h++]=e>>16&255,f[h++]=e>>8&255,f[h++]=255&e;return 2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,f[h++]=255&e),1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,f[h++]=e>>8&255,f[h++]=255&e),f},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=16383,a=0,u=n-i;a<u;a+=s)o.push(f(t,a,a+s>u?u:a+s));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,n){for(var i,o,s=[],a=e;a<n;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},2573:(t,e,r)=>{"use strict";var n=r(8834).Buffer,i=r(1329);function o(t,e){return void 0===e&&(e="utf8"),n.isBuffer(t)?a(t.toString("base64")):a(n.from(t,e).toString("base64"))}function s(t){return t=t.toString(),i.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function a(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var u=o;u.encode=o,u.decode=function(t,e){return void 0===e&&(e="utf8"),n.from(s(t),"base64").toString(e)},u.toBase64=s,u.fromBase64=a,u.toBuffer=function(t){return n.from(s(t),"base64")},e.default=u},1329:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.length,r=e%4;if(!r)return t;var i=e,o=4-r,s=e+o,a=n.alloc(s);for(a.write(t);o--;)a.write("=",i++);return a.toString()}},9487:(t,e,r)=>{t.exports=r(2573).default,t.exports.default=t.exports},1273:t=>{"use strict";for(var e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={},n=0;n<e.length;n++){var i=e.charAt(n);if(void 0!==r[i])throw new TypeError(i+" is ambiguous");r[i]=n}function o(t){var e=t>>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function s(t){for(var e=1,r=0;r<t.length;++r){var n=t.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+t+")";e=o(e)^n>>5}for(e=o(e),r=0;r<t.length;++r){var i=t.charCodeAt(r);e=o(e)^31&i}return e}function a(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var n=t.toLowerCase(),i=t.toUpperCase();if(t!==n&&t!==i)return"Mixed-case string "+t;var a=(t=n).lastIndexOf("1");if(-1===a)return"No separator character for "+t;if(0===a)return"Missing prefix for "+t;var u=t.slice(0,a),f=t.slice(a+1);if(f.length<6)return"Data too short";var h=s(u);if("string"==typeof h)return h;for(var c=[],l=0;l<f.length;++l){var d=f.charAt(l),p=r[d];if(void 0===p)return"Unknown character "+d;h=o(h)^p,l+6>=f.length||c.push(p)}return 1!==h?"Invalid checksum for "+t:{prefix:u,words:c}}function u(t,e,r,n){for(var i=0,o=0,s=(1<<r)-1,a=[],u=0;u<t.length;++u)for(i=i<<e|t[u],o+=e;o>=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<<r-o&s);else{if(o>=e)return"Excess padding";if(i<<r-o&s)return"Non-zero padding"}return a}t.exports={decodeUnsafe:function(){var t=a.apply(null,arguments);if("object"==typeof t)return t},decode:function(t){var e=a.apply(null,arguments);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,r,n){if(n=n||90,t.length+7+r.length>n)throw new TypeError("Exceeds length limit");var i=s(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var a=t+"1",u=0;u<r.length;++u){var f=r[u];if(f>>5!=0)throw new Error("Non 5-bit word");i=o(i)^f,a+=e.charAt(f)}for(u=0;u<6;++u)i=o(i);for(i^=1,u=0;u<6;++u)a+=e.charAt(i>>5*(5-u)&31);return a},toWordsUnsafe:function(t){var e=u(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=u(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=u(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=u(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}}},6989:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1425);function i(t,e,r){return n=>{if(t.has(n))return;const i=r.filter((t=>t.key.toString("hex")===n))[0];e.push(i),t.add(n)}}function o(t){return t.globalMap.unsignedTx}function s(t){const e=new Set;return t.forEach((t=>{const r=t.key.toString("hex");if(e.has(r))throw new Error("Combine: KeyValue Map keys should be unique");e.add(r)})),e}e.combine=function(t){const e=t[0],r=n.psbtToKeyVals(e),a=t.slice(1);if(0===a.length)throw new Error("Combine: Nothing to combine");const u=o(e);if(void 0===u)throw new Error("Combine: Self missing transaction");const f=s(r.globalKeyVals),h=r.inputKeyVals.map(s),c=r.outputKeyVals.map(s);for(const t of a){const e=o(t);if(void 0===e||!e.toBuffer().equals(u.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const a=n.psbtToKeyVals(t);s(a.globalKeyVals).forEach(i(f,r.globalKeyVals,a.globalKeyVals)),a.inputKeyVals.map(s).forEach(((t,e)=>t.forEach(i(h[e],r.inputKeyVals[e],a.inputKeyVals[e])))),a.outputKeyVals.map(s).forEach(((t,e)=>t.forEach(i(c[e],r.outputKeyVals[e],a.outputKeyVals[e]))))}return n.psbtFromKeyVals(u,{globalMapKeyVals:r.globalKeyVals,inputKeyVals:r.inputKeyVals,outputKeyVals:r.outputKeyVals})}},9207:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+t.key.toString("hex"));if(79!==t.key.length||![2,3].includes(t.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+t.key.toString("hex"));if(t.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const e=t.key.slice(1),r={masterFingerprint:t.value.slice(0,4),extendedPubkey:e,path:"m"};for(const e of(n=t.value.length/4-1,[...Array(n).keys()])){const n=t.value.readUInt32LE(4*e+4),i=!!(2147483648&n),o=2147483647&n;r.path+="/"+o.toString(10)+(i?"'":"")}var n;return r},e.encode=function(t){const e=n.from([i.GlobalTypes.GLOBAL_XPUB]),r=n.concat([e,t.extendedPubkey]),o=t.path.split("/"),s=n.allocUnsafe(4*o.length);t.masterFingerprint.copy(s,0);let a=4;return o.slice(1).forEach((t=>{const e="'"===t.slice(-1);let r=2147483647&parseInt(e?t.slice(0,-1):t,10);e&&(r+=2147483648),s.writeUInt32LE(r,a),a+=4})),{key:r,value:s}},e.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",e.check=function(t){const e=t.extendedPubkey,r=t.masterFingerprint,i=t.path;return n.isBuffer(e)&&78===e.length&&[2,3].indexOf(e[45])>-1&&n.isBuffer(r)&&4===r.length&&"string"==typeof i&&!!i.match(/^m(\/\d+'?)+$/)},e.canAddToArray=function(t,e,r){const n=e.extendedPubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.extendedPubkey.equals(e.extendedPubkey))).length)}},6441:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.encode=function(t){return{key:n.from([i.GlobalTypes.UNSIGNED_TX]),value:t.toBuffer()}}},1661:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(5710),i=r(9207),o=r(6441),s=r(6043),a=r(192),u=r(404),f=r(5556),h=r(5477),c=r(2860),l=r(762),d=r(3678),p=r(5630),y=r(6981),m=r(6912),g={unsignedTx:o,globalXpub:i,checkPubkey:p.makeChecker([])};e.globals=g;const b={nonWitnessUtxo:u,partialSig:f,sighashType:c,finalScriptSig:s,finalScriptWitness:a,porCommitment:h,witnessUtxo:l,bip32Derivation:d.makeConverter(n.InputTypes.BIP32_DERIVATION),redeemScript:y.makeConverter(n.InputTypes.REDEEM_SCRIPT),witnessScript:m.makeConverter(n.InputTypes.WITNESS_SCRIPT),checkPubkey:p.makeChecker([n.InputTypes.PARTIAL_SIG,n.InputTypes.BIP32_DERIVATION])};e.inputs=b;const v={bip32Derivation:d.makeConverter(n.OutputTypes.BIP32_DERIVATION),redeemScript:y.makeConverter(n.OutputTypes.REDEEM_SCRIPT),witnessScript:m.makeConverter(n.OutputTypes.WITNESS_SCRIPT),checkPubkey:p.makeChecker([n.OutputTypes.BIP32_DERIVATION])};e.outputs=v},6043:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+t.key.toString("hex"));return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.FINAL_SCRIPTSIG]),value:t}},e.expected="Buffer",e.check=function(t){return n.isBuffer(t)},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.finalScriptSig}},192:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+t.key.toString("hex"));return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.FINAL_SCRIPTWITNESS]),value:t}},e.expected="Buffer",e.check=function(t){return n.isBuffer(t)},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.finalScriptWitness}},404:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+t.key.toString("hex"));return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.NON_WITNESS_UTXO]),value:t}},e.expected="Buffer",e.check=function(t){return n.isBuffer(t)},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.nonWitnessUtxo}},5556:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+t.key.toString("hex"));if(34!==t.key.length&&66!==t.key.length||![2,3,4].includes(t.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+t.key.toString("hex"));return{pubkey:t.key.slice(1),signature:t.value}},e.encode=function(t){const e=n.from([i.InputTypes.PARTIAL_SIG]);return{key:n.concat([e,t.pubkey]),value:t.signature}},e.expected="{ pubkey: Buffer; signature: Buffer; }",e.check=function(t){return n.isBuffer(t.pubkey)&&n.isBuffer(t.signature)&&[33,65].includes(t.pubkey.length)&&[2,3,4].includes(t.pubkey[0])&&function(t){if(!n.isBuffer(t)||t.length<9)return!1;if(48!==t[0])return!1;if(t.length!==t[1]+3)return!1;if(2!==t[2])return!1;const e=t[3];if(e>33||e<1)return!1;if(2!==t[3+e+1])return!1;const r=t[3+e+2];return!(r>33||r<1)&&t.length===3+e+2+r+2}(t.signature)},e.canAddToArray=function(t,e,r){const n=e.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.pubkey.equals(e.pubkey))).length)}},5477:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+t.key.toString("hex"));return t.value.toString("utf8")},e.encode=function(t){return{key:n.from([i.InputTypes.POR_COMMITMENT]),value:n.from(t,"utf8")}},e.expected="string",e.check=function(t){return"string"==typeof t},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.porCommitment}},2860:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710);e.decode=function(t){if(t.key[0]!==i.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+t.key.toString("hex"));return t.value.readUInt32LE(0)},e.encode=function(t){const e=n.from([i.InputTypes.SIGHASH_TYPE]),r=n.allocUnsafe(4);return r.writeUInt32LE(t,0),{key:e,value:r}},e.expected="number",e.check=function(t){return"number"==typeof t},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.sighashType}},762:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5710),o=r(275),s=r(9214);e.decode=function(t){if(t.key[0]!==i.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+t.key.toString("hex"));const e=o.readUInt64LE(t.value,0);let r=8;const n=s.decode(t.value,r);r+=s.encodingLength(n);const a=t.value.slice(r);if(a.length!==n)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:a,value:e}},e.encode=function(t){const{script:e,value:r}=t,a=s.encodingLength(e.length),u=n.allocUnsafe(8+a+e.length);return o.writeUInt64LE(u,r,0),s.encode(e.length,u,8),e.copy(u,8+a),{key:n.from([i.InputTypes.WITNESS_UTXO]),value:u}},e.expected="{ script: Buffer; value: number; }",e.check=function(t){return n.isBuffer(t.script)&&"number"==typeof t.value},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.witnessUtxo}},3678:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.makeConverter=function(t){return{decode:function(e){if(e.key[0]!==t)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+e.key.toString("hex"));if(34!==e.key.length&&66!==e.key.length||![2,3,4].includes(e.key[1]))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const r=e.key.slice(1),n={masterFingerprint:e.value.slice(0,4),pubkey:r,path:"m"};for(const t of(i=e.value.length/4-1,[...Array(i).keys()])){const r=e.value.readUInt32LE(4*t+4),i=!!(2147483648&r),o=2147483647&r;n.path+="/"+o.toString(10)+(i?"'":"")}var i;return n},encode:function(e){const r=n.from([t]),i=n.concat([r,e.pubkey]),o=e.path.split("/"),s=n.allocUnsafe(4*o.length);e.masterFingerprint.copy(s,0);let a=4;return o.slice(1).forEach((t=>{const e="'"===t.slice(-1);let r=2147483647&parseInt(e?t.slice(0,-1):t,10);e&&(r+=2147483648),s.writeUInt32LE(r,a),a+=4})),{key:i,value:s}},check:function(t){return n.isBuffer(t.pubkey)&&n.isBuffer(t.masterFingerprint)&&"string"==typeof t.path&&[33,65].includes(t.pubkey.length)&&[2,3,4].includes(t.pubkey[0])&&4===t.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(t,e,r){const n=e.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.pubkey.equals(e.pubkey))).length)}}}},5630:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.makeChecker=function(t){return function(e){let r;if(t.includes(e.key[0])&&(r=e.key.slice(1),33!==r.length&&65!==r.length||![2,3,4].includes(r[0])))throw new Error("Format Error: invalid pubkey in key 0x"+e.key.toString("hex"));return r}}},6981:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.makeConverter=function(t){return{decode:function(e){if(e.key[0]!==t)throw new Error("Decode Error: could not decode redeemScript with key 0x"+e.key.toString("hex"));return e.value},encode:function(e){return{key:n.from([t]),value:e}},check:function(t){return n.isBuffer(t)},expected:"Buffer",canAdd:function(t,e){return!!t&&!!e&&void 0===t.redeemScript}}}},6912:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.makeConverter=function(t){return{decode:function(e){if(e.key[0]!==t)throw new Error("Decode Error: could not decode witnessScript with key 0x"+e.key.toString("hex"));return e.value},encode:function(e){return{key:n.from([t]),value:e}},check:function(t){return n.isBuffer(t)},expected:"Buffer",canAdd:function(t,e){return!!t&&!!e&&void 0===t.witnessScript}}}},275:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9214);function o(t){const e=t.key.length,r=t.value.length,o=i.encodingLength(e),s=i.encodingLength(r),a=n.allocUnsafe(o+e+s+r);return i.encode(e,a,0),t.key.copy(a,o),i.encode(r,a,o+e),t.value.copy(a,o+e+s),a}function s(t,e){if("number"!=typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}e.range=t=>[...Array(t).keys()],e.reverseBuffer=function(t){if(t.length<1)return t;let e=t.length-1,r=0;for(let n=0;n<t.length/2;n++)r=t[n],t[n]=t[e],t[e]=r,e--;return t},e.keyValsToBuffer=function(t){const e=t.map(o);return e.push(n.from([0])),n.concat(e)},e.keyValToBuffer=o,e.readUInt64LE=function(t,e){const r=t.readUInt32LE(e);let n=t.readUInt32LE(e+4);return n*=4294967296,s(n+r,9007199254740991),n+r},e.writeUInt64LE=function(t,e,r){return s(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8}},9214:(t,e,r)=>{"use strict";var n=r(8834).Buffer;function i(t){if(t<0||t>9007199254740991||t%1!=0)throw new RangeError("value out of range")}function o(t){return i(t),t<253?1:t<=65535?3:t<=4294967295?5:9}Object.defineProperty(e,"__esModule",{value:!0}),e.encode=function t(e,r,s){if(i(e),r||(r=n.allocUnsafe(o(e))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return s||(s=0),e<253?(r.writeUInt8(e,s),Object.assign(t,{bytes:1})):e<=65535?(r.writeUInt8(253,s),r.writeUInt16LE(e,s+1),Object.assign(t,{bytes:3})):e<=4294967295?(r.writeUInt8(254,s),r.writeUInt32LE(e,s+1),Object.assign(t,{bytes:5})):(r.writeUInt8(255,s),r.writeUInt32LE(e>>>0,s+1),r.writeUInt32LE(e/4294967296|0,s+5),Object.assign(t,{bytes:9})),r},e.decode=function t(e,r){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);const o=e.readUInt8(r);if(o<253)return Object.assign(t,{bytes:1}),o;if(253===o)return Object.assign(t,{bytes:3}),e.readUInt16LE(r+1);if(254===o)return Object.assign(t,{bytes:5}),e.readUInt32LE(r+1);{Object.assign(t,{bytes:9});const n=e.readUInt32LE(r+1),o=4294967296*e.readUInt32LE(r+5)+n;return i(o),o}},e.encodingLength=o},619:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1661),o=r(275),s=r(9214),a=r(5710);function u(t,e,r){if(!e.equals(n.from([r])))throw new Error(`Format Error: Invalid ${t} key: ${e.toString("hex")}`)}function f(t,{globalMapKeyVals:e,inputKeyVals:r,outputKeyVals:n}){const s={unsignedTx:t};let f=0;for(const t of e)switch(t.key[0]){case a.GlobalTypes.UNSIGNED_TX:if(u("global",t.key,a.GlobalTypes.UNSIGNED_TX),f>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");f++;break;case a.GlobalTypes.GLOBAL_XPUB:void 0===s.globalXpub&&(s.globalXpub=[]),s.globalXpub.push(i.globals.globalXpub.decode(t));break;default:s.unknownKeyVals||(s.unknownKeyVals=[]),s.unknownKeyVals.push(t)}const h=r.length,c=n.length,l=[],d=[];for(const t of o.range(h)){const e={};for(const n of r[t])switch(i.inputs.checkPubkey(n),n.key[0]){case a.InputTypes.NON_WITNESS_UTXO:if(u("input",n.key,a.InputTypes.NON_WITNESS_UTXO),void 0!==e.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");e.nonWitnessUtxo=i.inputs.nonWitnessUtxo.decode(n);break;case a.InputTypes.WITNESS_UTXO:if(u("input",n.key,a.InputTypes.WITNESS_UTXO),void 0!==e.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");e.witnessUtxo=i.inputs.witnessUtxo.decode(n);break;case a.InputTypes.PARTIAL_SIG:void 0===e.partialSig&&(e.partialSig=[]),e.partialSig.push(i.inputs.partialSig.decode(n));break;case a.InputTypes.SIGHASH_TYPE:if(u("input",n.key,a.InputTypes.SIGHASH_TYPE),void 0!==e.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");e.sighashType=i.inputs.sighashType.decode(n);break;case a.InputTypes.REDEEM_SCRIPT:if(u("input",n.key,a.InputTypes.REDEEM_SCRIPT),void 0!==e.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");e.redeemScript=i.inputs.redeemScript.decode(n);break;case a.InputTypes.WITNESS_SCRIPT:if(u("input",n.key,a.InputTypes.WITNESS_SCRIPT),void 0!==e.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");e.witnessScript=i.inputs.witnessScript.decode(n);break;case a.InputTypes.BIP32_DERIVATION:void 0===e.bip32Derivation&&(e.bip32Derivation=[]),e.bip32Derivation.push(i.inputs.bip32Derivation.decode(n));break;case a.InputTypes.FINAL_SCRIPTSIG:u("input",n.key,a.InputTypes.FINAL_SCRIPTSIG),e.finalScriptSig=i.inputs.finalScriptSig.decode(n);break;case a.InputTypes.FINAL_SCRIPTWITNESS:u("input",n.key,a.InputTypes.FINAL_SCRIPTWITNESS),e.finalScriptWitness=i.inputs.finalScriptWitness.decode(n);break;case a.InputTypes.POR_COMMITMENT:u("input",n.key,a.InputTypes.POR_COMMITMENT),e.porCommitment=i.inputs.porCommitment.decode(n);break;default:e.unknownKeyVals||(e.unknownKeyVals=[]),e.unknownKeyVals.push(n)}l.push(e)}for(const t of o.range(c)){const e={};for(const r of n[t])switch(i.outputs.checkPubkey(r),r.key[0]){case a.OutputTypes.REDEEM_SCRIPT:if(u("output",r.key,a.OutputTypes.REDEEM_SCRIPT),void 0!==e.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");e.redeemScript=i.outputs.redeemScript.decode(r);break;case a.OutputTypes.WITNESS_SCRIPT:if(u("output",r.key,a.OutputTypes.WITNESS_SCRIPT),void 0!==e.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");e.witnessScript=i.outputs.witnessScript.decode(r);break;case a.OutputTypes.BIP32_DERIVATION:void 0===e.bip32Derivation&&(e.bip32Derivation=[]),e.bip32Derivation.push(i.outputs.bip32Derivation.decode(r));break;default:e.unknownKeyVals||(e.unknownKeyVals=[]),e.unknownKeyVals.push(r)}d.push(e)}return{globalMap:s,inputs:l,outputs:d}}e.psbtFromBuffer=function(t,e){let r=0;function n(){const e=s.decode(t,r);r+=s.encodingLength(e);const n=t.slice(r,r+e);return r+=e,n}function i(){return{key:n(),value:n()}}function u(){if(r>=t.length)throw new Error("Format Error: Unexpected End of PSBT");const e=0===t.readUInt8(r);return e&&r++,e}if(1886610036!==function(){const e=t.readUInt32BE(r);return r+=4,e}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){const e=t.readUInt8(r);return r+=1,e}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");const h=[],c={};for(;!u();){const t=i(),e=t.key.toString("hex");if(c[e])throw new Error("Format Error: Keys must be unique for global keymap: key "+e);c[e]=1,h.push(t)}const l=h.filter((t=>t.key[0]===a.GlobalTypes.UNSIGNED_TX));if(1!==l.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const d=e(l[0].value),{inputCount:p,outputCount:y}=d.getInputOutputCounts(),m=[],g=[];for(const t of o.range(p)){const e={},r=[];for(;!u();){const n=i(),o=n.key.toString("hex");if(e[o])throw new Error("Format Error: Keys must be unique for each input: input index "+t+" key "+o);e[o]=1,r.push(n)}m.push(r)}for(const t of o.range(y)){const e={},r=[];for(;!u();){const n=i(),o=n.key.toString("hex");if(e[o])throw new Error("Format Error: Keys must be unique for each output: output index "+t+" key "+o);e[o]=1,r.push(n)}g.push(r)}return f(d,{globalMapKeyVals:h,inputKeyVals:m,outputKeyVals:g})},e.checkKeyBuffer=u,e.psbtFromKeyVals=f},1425:(t,e,r)=>{"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(619)),n(r(268))},268:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1661),o=r(275);e.psbtToBuffer=function({globalMap:t,inputs:e,outputs:r}){const{globalKeyVals:i,inputKeyVals:s,outputKeyVals:a}=u({globalMap:t,inputs:e,outputs:r}),f=o.keyValsToBuffer(i),h=t=>0===t.length?[n.from([0])]:t.map(o.keyValsToBuffer),c=h(s),l=h(a),d=n.allocUnsafe(5);return d.writeUIntBE(482972169471,0,5),n.concat([d,f].concat(c,l))};const s=(t,e)=>t.key.compare(e.key);function a(t,e){const r=new Set,n=Object.entries(t).reduce(((t,[n,i])=>{if("unknownKeyVals"===n)return t;const o=e[n];if(void 0===o)return t;const s=(Array.isArray(i)?i:[i]).map(o.encode);return s.map((t=>t.key.toString("hex"))).forEach((t=>{if(r.has(t))throw new Error("Serialize Error: Duplicate key: "+t);r.add(t)})),t.concat(s)}),[]),i=t.unknownKeyVals?t.unknownKeyVals.filter((t=>!r.has(t.key.toString("hex")))):[];return n.concat(i).sort(s)}function u({globalMap:t,inputs:e,outputs:r}){return{globalKeyVals:a(t,i.globals),inputKeyVals:e.map((t=>a(t,i.inputs))),outputKeyVals:r.map((t=>a(t,i.outputs)))}}e.psbtToKeyVals=u},8174:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(6989),o=r(1425),s=r(5710),a=r(5639);e.Psbt=class{constructor(t){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:t}}static fromBase64(t,e){const r=n.from(t,"base64");return this.fromBuffer(r,e)}static fromHex(t,e){const r=n.from(t,"hex");return this.fromBuffer(r,e)}static fromBuffer(t,e){const r=o.psbtFromBuffer(t,e),n=new this(r.globalMap.unsignedTx);return Object.assign(n,r),n}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return o.psbtToBuffer(this)}updateGlobal(t){return a.updateGlobal(t,this.globalMap),this}updateInput(t,e){const r=a.checkForInput(this.inputs,t);return a.updateInput(e,r),this}updateOutput(t,e){const r=a.checkForOutput(this.outputs,t);return a.updateOutput(e,r),this}addUnknownKeyValToGlobal(t){return a.checkHasKey(t,this.globalMap.unknownKeyVals,a.getEnumLength(s.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(t),this}addUnknownKeyValToInput(t,e){const r=a.checkForInput(this.inputs,t);return a.checkHasKey(e,r.unknownKeyVals,a.getEnumLength(s.InputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(e),this}addUnknownKeyValToOutput(t,e){const r=a.checkForOutput(this.outputs,t);return a.checkHasKey(e,r.unknownKeyVals,a.getEnumLength(s.OutputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(e),this}addInput(t){this.globalMap.unsignedTx.addInput(t),this.inputs.push({unknownKeyVals:[]});const e=t.unknownKeyVals||[],r=this.inputs.length-1;if(!Array.isArray(e))throw new Error("unknownKeyVals must be an Array");return e.forEach((t=>this.addUnknownKeyValToInput(r,t))),a.addInputAttributes(this.inputs,t),this}addOutput(t){this.globalMap.unsignedTx.addOutput(t),this.outputs.push({unknownKeyVals:[]});const e=t.unknownKeyVals||[],r=this.outputs.length-1;if(!Array.isArray(e))throw new Error("unknownKeyVals must be an Array");return e.forEach((t=>this.addUnknownKeyValToInput(r,t))),a.addOutputAttributes(this.outputs,t),this}clearFinalizedInput(t){const e=a.checkForInput(this.inputs,t);a.inputCheckUncleanFinalized(t,e);for(const t of Object.keys(e))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(t)||delete e[t];return this}combine(...t){const e=i.combine([this].concat(t));return Object.assign(this,e),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}}},5710:(t,e)=>{"use strict";var r,n,i;Object.defineProperty(e,"__esModule",{value:!0}),(i=e.GlobalTypes||(e.GlobalTypes={}))[i.UNSIGNED_TX=0]="UNSIGNED_TX",i[i.GLOBAL_XPUB=1]="GLOBAL_XPUB",e.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],(n=e.InputTypes||(e.InputTypes={}))[n.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",n[n.WITNESS_UTXO=1]="WITNESS_UTXO",n[n.PARTIAL_SIG=2]="PARTIAL_SIG",n[n.SIGHASH_TYPE=3]="SIGHASH_TYPE",n[n.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",n[n.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",n[n.BIP32_DERIVATION=6]="BIP32_DERIVATION",n[n.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",n[n.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",n[n.POR_COMMITMENT=9]="POR_COMMITMENT",e.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment"],(r=e.OutputTypes||(e.OutputTypes={}))[r.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",r[r.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",r[r.BIP32_DERIVATION=2]="BIP32_DERIVATION",e.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation"]},5639:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(1661);function o(t,e){const r=t[e];if(void 0===r)throw new Error(`No input #${e}`);return r}function s(t,e,r,n){throw new Error(`Data for ${t} key ${e} is incorrect: Expected ${r} and got ${JSON.stringify(n)}`)}function a(t){return(e,r)=>{for(const n of Object.keys(e)){const o=e[n],{canAdd:a,canAddToArray:u,check:f,expected:h}=i[t+"s"][n]||{},c=!!u;if(f)if(c){if(!Array.isArray(o)||r[n]&&!Array.isArray(r[n]))throw new Error(`Key type ${n} must be an array`);o.every(f)||s(t,n,h,o);const e=r[n]||[],i=new Set;if(!o.every((t=>u(e,t,i))))throw new Error("Can not add duplicate data to array");r[n]=e.concat(o)}else{if(f(o)||s(t,n,h,o),!a(r,o))throw new Error(`Can not add duplicate data to ${t}`);r[n]=o}}}}e.checkForInput=o,e.checkForOutput=function(t,e){const r=t[e];if(void 0===r)throw new Error(`No output #${e}`);return r},e.checkHasKey=function(t,e,r){if(t.key[0]<r)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(e&&0!==e.filter((e=>e.key.equals(t.key))).length)throw new Error(`Duplicate Key: ${t.key.toString("hex")}`)},e.getEnumLength=function(t){let e=0;return Object.keys(t).forEach((t=>{Number(isNaN(Number(t)))&&e++})),e},e.inputCheckUncleanFinalized=function(t,e){let r=!1;if(e.nonWitnessUtxo||e.witnessUtxo){const t=!!e.redeemScript,n=!!e.witnessScript,i=!t||!!e.finalScriptSig,o=!n||!!e.finalScriptWitness,s=!!e.finalScriptSig||!!e.finalScriptWitness;r=i&&o&&s}if(!1===r)throw new Error(`Input #${t} has too much or too little data to clean`)},e.updateGlobal=a("global"),e.updateInput=a("input"),e.updateOutput=a("output"),e.addInputAttributes=function(t,r){const n=o(t,t.length-1);e.updateInput(r,n)},e.addOutputAttributes=function(t,r){const n=o(t,t.length-1);e.updateOutput(r,n)},e.defaultVersionSetter=function(t,e){if(!n.isBuffer(e)||e.length<4)throw new Error("Set Version: Invalid Transaction");return e.writeUInt32LE(t,0),e},e.defaultLocktimeSetter=function(t,e){if(!n.isBuffer(e)||e.length<4)throw new Error("Set Locktime: Invalid Transaction");return e.writeUInt32LE(t,e.length-4),e}},6015:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(3527),o=r(4075),s=r(701),a=r(9031),u=r(1384),f=a.BufferN(32),h=a.compile({wif:a.UInt8,bip32:{public:a.UInt32,private:a.UInt32}}),c={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},l=2147483648,d=Math.pow(2,31)-1;function p(t){return a.String(t)&&null!==t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function y(t){return a.UInt32(t)&&t<=d}class m{constructor(t,e,r,n,i=0,o=0,s=0){this.__D=t,this.__Q=e,this.chainCode=r,this.network=n,this.__DEPTH=i,this.__INDEX=o,this.__PARENT_FINGERPRINT=s,a(h,n),this.lowR=!1}get depth(){return this.__DEPTH}get index(){return this.__INDEX}get parentFingerprint(){return this.__PARENT_FINGERPRINT}get publicKey(){return void 0===this.__Q&&(this.__Q=s.pointFromScalar(this.__D,!0)),this.__Q}get privateKey(){return this.__D}get identifier(){return i.hash160(this.publicKey)}get fingerprint(){return this.identifier.slice(0,4)}get compressed(){return!0}isNeutered(){return void 0===this.__D}neutered(){return v(this.publicKey,this.chainCode,this.network,this.depth,this.index,this.parentFingerprint)}toBase58(){const t=this.network,e=this.isNeutered()?t.bip32.public:t.bip32.private,r=n.allocUnsafe(78);return r.writeUInt32BE(e,0),r.writeUInt8(this.depth,4),r.writeUInt32BE(this.parentFingerprint,5),r.writeUInt32BE(this.index,9),this.chainCode.copy(r,13),this.isNeutered()?this.publicKey.copy(r,45):(r.writeUInt8(0,45),this.privateKey.copy(r,46)),o.encode(r)}toWIF(){if(!this.privateKey)throw new TypeError("Missing private key");return u.encode(this.network.wif,this.privateKey,!0)}derive(t){a(a.UInt32,t);const e=t>=l,r=n.allocUnsafe(37);if(e){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");r[0]=0,this.privateKey.copy(r,1),r.writeUInt32BE(t,33)}else this.publicKey.copy(r,0),r.writeUInt32BE(t,33);const o=i.hmacSHA512(this.chainCode,r),u=o.slice(0,32),f=o.slice(32);if(!s.isPrivate(u))return this.derive(t+1);let h;if(this.isNeutered()){const e=s.pointAddScalar(this.publicKey,u,!0);if(null===e)return this.derive(t+1);h=v(e,f,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}else{const e=s.privateAdd(this.privateKey,u);if(null==e)return this.derive(t+1);h=b(e,f,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}return h}deriveHardened(t){return a(y,t),this.derive(t+l)}derivePath(t){a(p,t);let e=t.split("/");if("m"===e[0]){if(this.parentFingerprint)throw new TypeError("Expected master, got child");e=e.slice(1)}return e.reduce(((t,e)=>{let r;return"'"===e.slice(-1)?(r=parseInt(e.slice(0,-1),10),t.deriveHardened(r)):(r=parseInt(e,10),t.derive(r))}),this)}sign(t,e){if(!this.privateKey)throw new Error("Missing private key");if(void 0===e&&(e=this.lowR),!1===e)return s.sign(t,this.privateKey);{let e=s.sign(t,this.privateKey);const r=n.alloc(32,0);let i=0;for(;e[0]>127;)i++,r.writeUIntLE(i,0,6),e=s.signWithEntropy(t,this.privateKey,r);return e}}verify(t,e){return s.verify(t,this.publicKey,e)}}function g(t,e,r){return b(t,e,r)}function b(t,e,r,n,i,o){if(a({privateKey:f,chainCode:f},{privateKey:t,chainCode:e}),r=r||c,!s.isPrivate(t))throw new TypeError("Private key not in range [1, n)");return new m(t,void 0,e,r,n,i,o)}function v(t,e,r,n,i,o){if(a({publicKey:a.BufferN(33),chainCode:f},{publicKey:t,chainCode:e}),r=r||c,!s.isPoint(t))throw new TypeError("Point is not on the curve");return new m(void 0,t,e,r,n,i,o)}e.fromBase58=function(t,e){const r=o.decode(t);if(78!==r.length)throw new TypeError("Invalid buffer length");e=e||c;const n=r.readUInt32BE(0);if(n!==e.bip32.private&&n!==e.bip32.public)throw new TypeError("Invalid network version");const i=r[4],s=r.readUInt32BE(5);if(0===i&&0!==s)throw new TypeError("Invalid parent fingerprint");const a=r.readUInt32BE(9);if(0===i&&0!==a)throw new TypeError("Invalid index");const u=r.slice(13,45);let f;if(n===e.bip32.private){if(0!==r.readUInt8(45))throw new TypeError("Invalid private key");f=b(r.slice(46,78),u,e,i,a,s)}else f=v(r.slice(45,78),u,e,i,a,s);return f},e.fromPrivateKey=g,e.fromPublicKey=function(t,e,r){return v(t,e,r)},e.fromSeed=function(t,e){if(a(a.Buffer,t),t.length<16)throw new TypeError("Seed should be at least 128 bits");if(t.length>64)throw new TypeError("Seed should be at most 512 bits");e=e||c;const r=i.hmacSHA512(n.from("Bitcoin seed","utf8"),t);return g(r.slice(0,32),r.slice(32),e)}},3527:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(6162),i=r(11);e.hash160=function(t){const e=n("sha256").update(t).digest();try{return n("rmd160").update(e).digest()}catch(t){return n("ripemd160").update(e).digest()}},e.hmacSHA512=function(t,e){return i("sha512",t).update(e).digest()}},4132:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(6015);e.fromSeed=n.fromSeed,e.fromBase58=n.fromBase58,e.fromPublicKey=n.fromPublicKey,e.fromPrivateKey=n.fromPrivateKey},9875:(t,e,r)=>{var n=r(7834).Buffer;t.exports={check:function(t){if(t.length<8)return!1;if(t.length>72)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-2)return!1;if(2!==t[2])return!1;var e=t[3];if(0===e)return!1;if(5+e>=t.length)return!1;if(2!==t[4+e])return!1;var r=t[5+e];return!(0===r||6+e+r!==t.length||128&t[4]||e>1&&0===t[4]&&!(128&t[5])||128&t[e+6]||r>1&&0===t[e+6]&&!(128&t[e+7]))},decode:function(t){if(t.length<8)throw new Error("DER sequence length is too short");if(t.length>72)throw new Error("DER sequence length is too long");if(48!==t[0])throw new Error("Expected DER sequence");if(t[1]!==t.length-2)throw new Error("DER sequence length is invalid");if(2!==t[2])throw new Error("Expected DER integer");var e=t[3];if(0===e)throw new Error("R length is zero");if(5+e>=t.length)throw new Error("R length is too long");if(2!==t[4+e])throw new Error("Expected DER integer (2)");var r=t[5+e];if(0===r)throw new Error("S length is zero");if(6+e+r!==t.length)throw new Error("S length is invalid");if(128&t[4])throw new Error("R value is negative");if(e>1&&0===t[4]&&!(128&t[5]))throw new Error("R value excessively padded");if(128&t[e+6])throw new Error("S value is negative");if(r>1&&0===t[e+6]&&!(128&t[e+7]))throw new Error("S value excessively padded");return{r:t.slice(4,4+e),s:t.slice(6+e)}},encode:function(t,e){var r=t.length,i=e.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&t[0])throw new Error("R value is negative");if(128&e[0])throw new Error("S value is negative");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("R value excessively padded");if(i>1&&0===e[0]&&!(128&e[1]))throw new Error("S value excessively padded");var o=n.allocUnsafe(6+r+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=t.length,t.copy(o,4),o[4+r]=2,o[5+r]=e.length,e.copy(o,6+r),o}}},7401:(t,e,r)=>{var n=r(196),i={};for(var o in n)i[n[o]]=o;t.exports=i},9168:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(419),o=r(6469),s=r(3016),a=r(6168),u=r(1273),f=r(4075),h=r(9031);function c(t){const e=f.decode(t);if(e.length<21)throw new TypeError(t+" is too short");if(e.length>21)throw new TypeError(t+" is too long");return{version:e.readUInt8(0),hash:e.slice(1)}}function l(t){const e=u.decode(t),r=u.fromWords(e.words.slice(1));return{version:e.words[0],prefix:e.prefix,data:n.from(r)}}e.fromBase58Check=c,e.fromBech32=l,e.toBase58Check=function(t,e){h(a.tuple(a.Hash160bit,a.UInt8),arguments);const r=n.allocUnsafe(21);return r.writeUInt8(e,0),t.copy(r,1),f.encode(r)},e.toBech32=function(t,e,r){const n=u.toWords(t);return n.unshift(e),u.encode(r,n)},e.fromOutputScript=function(t,e){e=e||i.bitcoin;try{return o.p2pkh({output:t,network:e}).address}catch(t){}try{return o.p2sh({output:t,network:e}).address}catch(t){}try{return o.p2wpkh({output:t,network:e}).address}catch(t){}try{return o.p2wsh({output:t,network:e}).address}catch(t){}throw new Error(s.toASM(t)+" has no matching Address")},e.toOutputScript=function(t,e){let r,n;e=e||i.bitcoin;try{r=c(t)}catch(t){}if(r){if(r.version===e.pubKeyHash)return o.p2pkh({hash:r.hash}).output;if(r.version===e.scriptHash)return o.p2sh({hash:r.hash}).output}else{try{n=l(t)}catch(t){}if(n){if(n.prefix!==e.bech32)throw new Error(t+" has an invalid prefix");if(0===n.version){if(20===n.data.length)return o.p2wpkh({hash:n.data}).output;if(32===n.data.length)return o.p2wsh({hash:n.data}).output}}}throw new Error(t+" has no matching Script")}},485:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9359),o=r(2572),s=r(4457),a=r(6168),u=r(7332),f=r(9031),h=r(8595),c=new TypeError("Cannot compute merkle root for zero transactions"),l=new TypeError("Cannot compute witness commit for non-segwit block");class d{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(t){if(t.length<80)throw new Error("Buffer too small (< 80 bytes)");const e=new i.BufferReader(t),r=new d;if(r.version=e.readInt32(),r.prevHash=e.readSlice(32),r.merkleRoot=e.readSlice(32),r.timestamp=e.readUInt32(),r.bits=e.readUInt32(),r.nonce=e.readUInt32(),80===t.length)return r;const n=()=>{const t=s.Transaction.fromBuffer(e.buffer.slice(e.offset),!0);return e.offset+=t.byteLength(),t},o=e.readVarInt();r.transactions=[];for(let t=0;t<o;++t){const t=n();r.transactions.push(t)}const a=r.getWitnessCommit();return a&&(r.witnessCommit=a),r}static fromHex(t){return d.fromBuffer(n.from(t,"hex"))}static calculateTarget(t){const e=((4278190080&t)>>24)-3,r=8388607&t,i=n.alloc(32,0);return i.writeUIntBE(r,29-e,3),i}static calculateMerkleRoot(t,e){if(f([{getHash:a.Function}],t),0===t.length)throw c;if(e&&!p(t))throw l;const r=t.map((t=>t.getHash(e))),i=u(r,o.hash256);return e?o.hash256(n.concat([i,t[0].ins[0].witness[0]])):i}getWitnessCommit(){if(!p(this.transactions))return null;const t=this.transactions[0].outs.filter((t=>t.script.slice(0,6).equals(n.from("6a24aa21a9ed","hex")))).map((t=>t.script.slice(6,38)));if(0===t.length)return null;const e=t[t.length-1];return e instanceof n&&32===e.length?e:null}hasWitnessCommit(){return this.witnessCommit instanceof n&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}hasWitness(){return(t=this.transactions)instanceof Array&&t.some((t=>"object"==typeof t&&t.ins instanceof Array&&t.ins.some((t=>"object"==typeof t&&t.witness instanceof Array&&t.witness.length>0))));var t}weight(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}byteLength(t,e=!0){return t||!this.transactions?80:80+h.encodingLength(this.transactions.length)+this.transactions.reduce(((t,r)=>t+r.byteLength(e)),0)}getHash(){return o.hash256(this.toBuffer(!0))}getId(){return i.reverseBuffer(this.getHash()).toString("hex")}getUTCDate(){const t=new Date(0);return t.setUTCSeconds(this.timestamp),t}toBuffer(t){const e=n.allocUnsafe(this.byteLength(t)),r=new i.BufferWriter(e);return r.writeInt32(this.version),r.writeSlice(this.prevHash),r.writeSlice(this.merkleRoot),r.writeUInt32(this.timestamp),r.writeUInt32(this.bits),r.writeUInt32(this.nonce),t||!this.transactions||(h.encode(this.transactions.length,e,r.offset),r.offset+=h.encode.bytes,this.transactions.forEach((t=>{const n=t.byteLength();t.toBuffer(e,r.offset),r.offset+=n}))),e}toHex(t){return this.toBuffer(t).toString("hex")}checkTxRoots(){const t=this.hasWitnessCommit();return!(!t&&this.hasWitness())&&this.__checkMerkleRoot()&&(!t||this.__checkWitnessCommit())}checkProofOfWork(){const t=i.reverseBuffer(this.getHash()),e=d.calculateTarget(this.bits);return t.compare(e)<=0}__checkMerkleRoot(){if(!this.transactions)throw c;const t=d.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(t)}__checkWitnessCommit(){if(!this.transactions)throw c;if(!this.hasWitnessCommit())throw l;const t=d.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(t)}}function p(t){return t instanceof Array&&t[0]&&t[0].ins&&t[0].ins instanceof Array&&t[0].ins[0]&&t[0].ins[0].witness&&t[0].ins[0].witness instanceof Array&&t[0].ins[0].witness.length>0}e.Block=d},9359:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(6168),o=r(9031),s=r(8595);function a(t,e){if("number"!=typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}function u(t,e){const r=t.readUInt32LE(e);let n=t.readUInt32LE(e+4);return n*=4294967296,a(n+r,9007199254740991),n+r}function f(t,e,r){return a(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8}e.readUInt64LE=u,e.writeUInt64LE=f,e.reverseBuffer=function(t){if(t.length<1)return t;let e=t.length-1,r=0;for(let n=0;n<t.length/2;n++)r=t[n],t[n]=t[e],t[e]=r,e--;return t},e.cloneBuffer=function(t){const e=n.allocUnsafe(t.length);return t.copy(e),e},e.BufferWriter=class{constructor(t,e=0){this.buffer=t,this.offset=e,o(i.tuple(i.Buffer,i.UInt32),[t,e])}writeUInt8(t){this.offset=this.buffer.writeUInt8(t,this.offset)}writeInt32(t){this.offset=this.buffer.writeInt32LE(t,this.offset)}writeUInt32(t){this.offset=this.buffer.writeUInt32LE(t,this.offset)}writeUInt64(t){this.offset=f(this.buffer,t,this.offset)}writeVarInt(t){s.encode(t,this.buffer,this.offset),this.offset+=s.encode.bytes}writeSlice(t){if(this.buffer.length<this.offset+t.length)throw new Error("Cannot write slice out of bounds");this.offset+=t.copy(this.buffer,this.offset)}writeVarSlice(t){this.writeVarInt(t.length),this.writeSlice(t)}writeVector(t){this.writeVarInt(t.length),t.forEach((t=>this.writeVarSlice(t)))}},e.BufferReader=class{constructor(t,e=0){this.buffer=t,this.offset=e,o(i.tuple(i.Buffer,i.UInt32),[t,e])}readUInt8(){const t=this.buffer.readUInt8(this.offset);return this.offset++,t}readInt32(){const t=this.buffer.readInt32LE(this.offset);return this.offset+=4,t}readUInt32(){const t=this.buffer.readUInt32LE(this.offset);return this.offset+=4,t}readUInt64(){const t=u(this.buffer,this.offset);return this.offset+=8,t}readVarInt(){const t=s.decode(this.buffer,this.offset);return this.offset+=s.decode.bytes,t}readSlice(t){if(this.buffer.length<this.offset+t)throw new Error("Cannot read slice out of bounds");const e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const t=this.readVarInt(),e=[];for(let r=0;r<t;r++)e.push(this.readVarSlice());return e}}},4654:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3155),o=r(9404),s=r(9177),a=r(6858),u=r(6696),f=r(2468),h=r(8387),c=r(8861),l={P2MS:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"};e.types=l,e.output=function(t){if(h.output.check(t))return l.P2WPKH;if(c.output.check(t))return l.P2WSH;if(a.output.check(t))return l.P2PKH;if(u.output.check(t))return l.P2SH;const e=n.decompile(t);if(!e)throw new TypeError("Invalid script");return i.output.check(e)?l.P2MS:s.output.check(e)?l.P2PK:f.output.check(e)?l.WITNESS_COMMITMENT:o.output.check(e)?l.NULLDATA:l.NONSTANDARD},e.input=function(t,e){const r=n.decompile(t);if(!r)throw new TypeError("Invalid script");return a.input.check(r)?l.P2PKH:u.input.check(r,e)?l.P2SH:i.input.check(r,e)?l.P2MS:s.input.check(r)?l.P2PK:l.NONSTANDARD},e.witness=function(t,e){const r=n.decompile(t);if(!r)throw new TypeError("Invalid script");return h.input.check(r)?l.P2WPKH:c.input.check(r,e)?l.P2WSH:l.NONSTANDARD}},2572:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(6162);function i(t){try{return n("rmd160").update(t).digest()}catch(e){return n("ripemd160").update(t).digest()}}function o(t){return n("sha256").update(t).digest()}e.ripemd160=i,e.sha1=function(t){return n("sha1").update(t).digest()},e.sha256=o,e.hash160=function(t){return i(o(t))},e.hash256=function(t){return o(o(t))}},8893:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(419),o=r(6168),s=r(701),a=r(5003),u=r(9031),f=r(1384),h=u.maybe(u.compile({compressed:o.maybe(o.Boolean),network:o.maybe(o.Network)}));class c{constructor(t,e,r){this.__D=t,this.__Q=e,this.lowR=!1,void 0===r&&(r={}),this.compressed=void 0===r.compressed||r.compressed,this.network=r.network||i.bitcoin,void 0!==e&&(this.__Q=s.pointCompress(e,this.compressed))}get privateKey(){return this.__D}get publicKey(){return this.__Q||(this.__Q=s.pointFromScalar(this.__D,this.compressed)),this.__Q}toWIF(){if(!this.__D)throw new Error("Missing private key");return f.encode(this.network.wif,this.__D,this.compressed)}sign(t,e){if(!this.__D)throw new Error("Missing private key");if(void 0===e&&(e=this.lowR),!1===e)return s.sign(t,this.__D);{let e=s.sign(t,this.__D);const r=n.alloc(32,0);let i=0;for(;e[0]>127;)i++,r.writeUIntLE(i,0,6),e=s.signWithEntropy(t,this.__D,r);return e}}verify(t,e){return s.verify(t,this.publicKey,e)}}function l(t,e){if(u(o.Buffer256bit,t),!s.isPrivate(t))throw new TypeError("Private key not in range [1, n)");return u(h,e),new c(t,void 0,e)}e.fromPrivateKey=l,e.fromPublicKey=function(t,e){return u(s.isPoint,t),u(h,e),new c(void 0,t,e)},e.fromWIF=function(t,e){const r=f.decode(t),n=r.version;if(o.Array(e)){if(!(e=e.filter((t=>n===t.wif)).pop()))throw new Error("Unknown network version")}else if(e=e||i.bitcoin,n!==e.wif)throw new Error("Invalid network version");return l(r.privateKey,{compressed:r.compressed,network:e})},e.makeRandom=function(t){u(h,t),void 0===t&&(t={});const e=t.rng||a;let r;do{r=e(32),u(o.Buffer256bit,r)}while(!s.isPrivate(r));return l(r,t)}},6314:(t,e,r)=>{"use strict";r(4132),r(9168),r(2572),r(8893),r(419),r(6469);const n=r(3016);e._v=n,r(485).Block,r(9468).Psbt,r(3016).OPS;var i=r(4457);e.YW=i.Transaction,r(6459).TransactionBuilder},419:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},e.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},e.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}},2916:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(419),i=r(3016),o=r(8535),s=r(9031),a=i.OPS;e.p2data=function(t,e){if(!t.data&&!t.output)throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),s({network:s.maybe(s.Object),output:s.maybe(s.Buffer),data:s.maybe(s.arrayOf(s.Buffer))},t);const r={name:"embed",network:t.network||n.bitcoin};if(o.prop(r,"output",(()=>{if(t.data)return i.compile([a.OP_RETURN].concat(t.data))})),o.prop(r,"data",(()=>{if(t.output)return i.decompile(t.output).slice(1)})),e.validate&&t.output){const e=i.decompile(t.output);if(e[0]!==a.OP_RETURN)throw new TypeError("Output is invalid");if(!e.slice(1).every(s.Buffer))throw new TypeError("Output is invalid");if(t.data&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.data,r.data))throw new TypeError("Data mismatch")}return Object.assign(r,t)}},6469:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(2916);e.embed=n.p2data;const i=r(1863);e.p2ms=i.p2ms;const o=r(8536);e.p2pk=o.p2pk;const s=r(4696);e.p2pkh=s.p2pkh;const a=r(743);e.p2sh=a.p2sh;const u=r(16);e.p2wpkh=u.p2wpkh;const f=r(5732);e.p2wsh=f.p2wsh},8535:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.prop=function(t,e,r){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){const t=r.call(this);return this[e]=t,t},set(t){Object.defineProperty(this,e,{configurable:!0,enumerable:!0,value:t,writable:!0})}})},e.value=function(t){let e;return()=>(void 0!==e||(e=t()),e)}},1863:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(419),i=r(3016),o=r(8535),s=i.OPS,a=r(9031),u=r(701),f=s.OP_RESERVED;function h(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}e.p2ms=function(t,e){if(!(t.input||t.output||t.pubkeys&&void 0!==t.m||t.signatures))throw new TypeError("Not enough data");function r(t){return i.isCanonicalScriptSignature(t)||void 0!==(e.allowIncomplete&&t===s.OP_0)}e=Object.assign({validate:!0},e||{}),a({network:a.maybe(a.Object),m:a.maybe(a.Number),n:a.maybe(a.Number),output:a.maybe(a.Buffer),pubkeys:a.maybe(a.arrayOf(u.isPoint)),signatures:a.maybe(a.arrayOf(r)),input:a.maybe(a.Buffer)},t);const c={network:t.network||n.bitcoin};let l=[],d=!1;function p(t){d||(d=!0,l=i.decompile(t),c.m=l[0]-f,c.n=l[l.length-2]-f,c.pubkeys=l.slice(1,-2))}if(o.prop(c,"output",(()=>{if(t.m&&c.n&&t.pubkeys)return i.compile([].concat(f+t.m,t.pubkeys,f+c.n,s.OP_CHECKMULTISIG))})),o.prop(c,"m",(()=>{if(c.output)return p(c.output),c.m})),o.prop(c,"n",(()=>{if(c.pubkeys)return c.pubkeys.length})),o.prop(c,"pubkeys",(()=>{if(t.output)return p(t.output),c.pubkeys})),o.prop(c,"signatures",(()=>{if(t.input)return i.decompile(t.input).slice(1)})),o.prop(c,"input",(()=>{if(t.signatures)return i.compile([s.OP_0].concat(t.signatures))})),o.prop(c,"witness",(()=>{if(c.input)return[]})),o.prop(c,"name",(()=>{if(c.m&&c.n)return`p2ms(${c.m} of ${c.n})`})),e.validate){if(t.output){if(p(t.output),!a.Number(l[0]))throw new TypeError("Output is invalid");if(!a.Number(l[l.length-2]))throw new TypeError("Output is invalid");if(l[l.length-1]!==s.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(c.m<=0||c.n>16||c.m>c.n||c.n!==l.length-3)throw new TypeError("Output is invalid");if(!c.pubkeys.every((t=>u.isPoint(t))))throw new TypeError("Output is invalid");if(void 0!==t.m&&t.m!==c.m)throw new TypeError("m mismatch");if(void 0!==t.n&&t.n!==c.n)throw new TypeError("n mismatch");if(t.pubkeys&&!h(t.pubkeys,c.pubkeys))throw new TypeError("Pubkeys mismatch")}if(t.pubkeys){if(void 0!==t.n&&t.n!==t.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(c.n=t.pubkeys.length,c.n<c.m)throw new TypeError("Pubkey count cannot be less than m")}if(t.signatures){if(t.signatures.length<c.m)throw new TypeError("Not enough signatures provided");if(t.signatures.length>c.m)throw new TypeError("Too many signatures provided")}if(t.input){if(t.input[0]!==s.OP_0)throw new TypeError("Input is invalid");if(0===c.signatures.length||!c.signatures.every(r))throw new TypeError("Input has invalid signature(s)");if(t.signatures&&!h(t.signatures,c.signatures))throw new TypeError("Signature mismatch");if(void 0!==t.m&&t.m!==t.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(c,t)}},8536:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(419),i=r(3016),o=r(8535),s=r(9031),a=i.OPS,u=r(701);e.p2pk=function(t,e){if(!(t.input||t.output||t.pubkey||t.input||t.signature))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),s({network:s.maybe(s.Object),output:s.maybe(s.Buffer),pubkey:s.maybe(u.isPoint),signature:s.maybe(i.isCanonicalScriptSignature),input:s.maybe(s.Buffer)},t);const r=o.value((()=>i.decompile(t.input))),f={name:"p2pk",network:t.network||n.bitcoin};if(o.prop(f,"output",(()=>{if(t.pubkey)return i.compile([t.pubkey,a.OP_CHECKSIG])})),o.prop(f,"pubkey",(()=>{if(t.output)return t.output.slice(1,-1)})),o.prop(f,"signature",(()=>{if(t.input)return r()[0]})),o.prop(f,"input",(()=>{if(t.signature)return i.compile([t.signature])})),o.prop(f,"witness",(()=>{if(f.input)return[]})),e.validate){if(t.output){if(t.output[t.output.length-1]!==a.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!u.isPoint(f.pubkey))throw new TypeError("Output pubkey is invalid");if(t.pubkey&&!t.pubkey.equals(f.pubkey))throw new TypeError("Pubkey mismatch")}if(t.signature&&t.input&&!t.input.equals(f.input))throw new TypeError("Signature mismatch");if(t.input){if(1!==r().length)throw new TypeError("Input is invalid");if(!i.isCanonicalScriptSignature(f.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(f,t)}},4696:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(2572),o=r(419),s=r(3016),a=r(8535),u=r(9031),f=s.OPS,h=r(701),c=r(4075);e.p2pkh=function(t,e){if(!(t.address||t.hash||t.output||t.pubkey||t.input))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),u({network:u.maybe(u.Object),address:u.maybe(u.String),hash:u.maybe(u.BufferN(20)),output:u.maybe(u.BufferN(25)),pubkey:u.maybe(h.isPoint),signature:u.maybe(s.isCanonicalScriptSignature),input:u.maybe(u.Buffer)},t);const r=a.value((()=>{const e=c.decode(t.address);return{version:e.readUInt8(0),hash:e.slice(1)}})),l=a.value((()=>s.decompile(t.input))),d=t.network||o.bitcoin,p={name:"p2pkh",network:d};if(a.prop(p,"address",(()=>{if(!p.hash)return;const t=n.allocUnsafe(21);return t.writeUInt8(d.pubKeyHash,0),p.hash.copy(t,1),c.encode(t)})),a.prop(p,"hash",(()=>t.output?t.output.slice(3,23):t.address?r().hash:t.pubkey||p.pubkey?i.hash160(t.pubkey||p.pubkey):void 0)),a.prop(p,"output",(()=>{if(p.hash)return s.compile([f.OP_DUP,f.OP_HASH160,p.hash,f.OP_EQUALVERIFY,f.OP_CHECKSIG])})),a.prop(p,"pubkey",(()=>{if(t.input)return l()[1]})),a.prop(p,"signature",(()=>{if(t.input)return l()[0]})),a.prop(p,"input",(()=>{if(t.pubkey&&t.signature)return s.compile([t.signature,t.pubkey])})),a.prop(p,"witness",(()=>{if(p.input)return[]})),e.validate){let e=n.from([]);if(t.address){if(r().version!==d.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==r().hash.length)throw new TypeError("Invalid address");e=r().hash}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(25!==t.output.length||t.output[0]!==f.OP_DUP||t.output[1]!==f.OP_HASH160||20!==t.output[2]||t.output[23]!==f.OP_EQUALVERIFY||t.output[24]!==f.OP_CHECKSIG)throw new TypeError("Output is invalid");const r=t.output.slice(3,23);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.pubkey){const r=i.hash160(t.pubkey);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.input){const r=l();if(2!==r.length)throw new TypeError("Input is invalid");if(!s.isCanonicalScriptSignature(r[0]))throw new TypeError("Input has invalid signature");if(!h.isPoint(r[1]))throw new TypeError("Input has invalid pubkey");if(t.signature&&!t.signature.equals(r[0]))throw new TypeError("Signature mismatch");if(t.pubkey&&!t.pubkey.equals(r[1]))throw new TypeError("Pubkey mismatch");const n=i.hash160(r[1]);if(e.length>0&&!e.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(p,t)}},743:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(2572),o=r(419),s=r(3016),a=r(8535),u=r(9031),f=s.OPS,h=r(4075);e.p2sh=function(t,e){if(!(t.address||t.hash||t.output||t.redeem||t.input))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),u({network:u.maybe(u.Object),address:u.maybe(u.String),hash:u.maybe(u.BufferN(20)),output:u.maybe(u.BufferN(23)),redeem:u.maybe({network:u.maybe(u.Object),output:u.maybe(u.Buffer),input:u.maybe(u.Buffer),witness:u.maybe(u.arrayOf(u.Buffer))}),input:u.maybe(u.Buffer),witness:u.maybe(u.arrayOf(u.Buffer))},t);let r=t.network;r||(r=t.redeem&&t.redeem.network||o.bitcoin);const c={network:r},l=a.value((()=>{const e=h.decode(t.address);return{version:e.readUInt8(0),hash:e.slice(1)}})),d=a.value((()=>s.decompile(t.input))),p=a.value((()=>{const e=d();return{network:r,output:e[e.length-1],input:s.compile(e.slice(0,-1)),witness:t.witness||[]}}));if(a.prop(c,"address",(()=>{if(!c.hash)return;const t=n.allocUnsafe(21);return t.writeUInt8(c.network.scriptHash,0),c.hash.copy(t,1),h.encode(t)})),a.prop(c,"hash",(()=>t.output?t.output.slice(2,22):t.address?l().hash:c.redeem&&c.redeem.output?i.hash160(c.redeem.output):void 0)),a.prop(c,"output",(()=>{if(c.hash)return s.compile([f.OP_HASH160,c.hash,f.OP_EQUAL])})),a.prop(c,"redeem",(()=>{if(t.input)return p()})),a.prop(c,"input",(()=>{if(t.redeem&&t.redeem.input&&t.redeem.output)return s.compile([].concat(s.decompile(t.redeem.input),t.redeem.output))})),a.prop(c,"witness",(()=>c.redeem&&c.redeem.witness?c.redeem.witness:c.input?[]:void 0)),a.prop(c,"name",(()=>{const t=["p2sh"];return void 0!==c.redeem&&t.push(c.redeem.name),t.join("-")})),e.validate){let e=n.from([]);if(t.address){if(l().version!==r.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==l().hash.length)throw new TypeError("Invalid address");e=l().hash}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(23!==t.output.length||t.output[0]!==f.OP_HASH160||20!==t.output[1]||t.output[22]!==f.OP_EQUAL)throw new TypeError("Output is invalid");const r=t.output.slice(2,22);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}const o=t=>{if(t.output){const r=s.decompile(t.output);if(!r||r.length<1)throw new TypeError("Redeem.output too short");const n=i.hash160(t.output);if(e.length>0&&!e.equals(n))throw new TypeError("Hash mismatch");e=n}if(t.input){const e=t.input.length>0,r=t.witness&&t.witness.length>0;if(!e&&!r)throw new TypeError("Empty input");if(e&&r)throw new TypeError("Input and witness provided");if(e){const e=s.decompile(t.input);if(!s.isPushOnly(e))throw new TypeError("Non push-only scriptSig")}}};if(t.input){const t=d();if(!t||t.length<1)throw new TypeError("Input too short");if(!n.isBuffer(p().output))throw new TypeError("Input is invalid");o(p())}if(t.redeem){if(t.redeem.network&&t.redeem.network!==r)throw new TypeError("Network mismatch");if(t.input){const e=p();if(t.redeem.output&&!t.redeem.output.equals(e.output))throw new TypeError("Redeem.output mismatch");if(t.redeem.input&&!t.redeem.input.equals(e.input))throw new TypeError("Redeem.input mismatch")}o(t.redeem)}if(t.witness&&t.redeem&&t.redeem.witness&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.redeem.witness,t.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(c,t)}},16:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(2572),o=r(419),s=r(3016),a=r(8535),u=r(9031),f=s.OPS,h=r(701),c=r(1273),l=n.alloc(0);e.p2wpkh=function(t,e){if(!(t.address||t.hash||t.output||t.pubkey||t.witness))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),u({address:u.maybe(u.String),hash:u.maybe(u.BufferN(20)),input:u.maybe(u.BufferN(0)),network:u.maybe(u.Object),output:u.maybe(u.BufferN(22)),pubkey:u.maybe(h.isPoint),signature:u.maybe(s.isCanonicalScriptSignature),witness:u.maybe(u.arrayOf(u.Buffer))},t);const r=a.value((()=>{const e=c.decode(t.address),r=e.words.shift(),i=c.fromWords(e.words);return{version:r,prefix:e.prefix,data:n.from(i)}})),d=t.network||o.bitcoin,p={name:"p2wpkh",network:d};if(a.prop(p,"address",(()=>{if(!p.hash)return;const t=c.toWords(p.hash);return t.unshift(0),c.encode(d.bech32,t)})),a.prop(p,"hash",(()=>t.output?t.output.slice(2,22):t.address?r().data:t.pubkey||p.pubkey?i.hash160(t.pubkey||p.pubkey):void 0)),a.prop(p,"output",(()=>{if(p.hash)return s.compile([f.OP_0,p.hash])})),a.prop(p,"pubkey",(()=>t.pubkey?t.pubkey:t.witness?t.witness[1]:void 0)),a.prop(p,"signature",(()=>{if(t.witness)return t.witness[0]})),a.prop(p,"input",(()=>{if(p.witness)return l})),a.prop(p,"witness",(()=>{if(t.pubkey&&t.signature)return[t.signature,t.pubkey]})),e.validate){let e=n.from([]);if(t.address){if(d&&d.bech32!==r().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw new TypeError("Invalid address version");if(20!==r().data.length)throw new TypeError("Invalid address data");e=r().data}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(22!==t.output.length||t.output[0]!==f.OP_0||20!==t.output[1])throw new TypeError("Output is invalid");if(e.length>0&&!e.equals(t.output.slice(2)))throw new TypeError("Hash mismatch");e=t.output.slice(2)}if(t.pubkey){const r=i.hash160(t.pubkey);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");if(e=r,!h.isPoint(t.pubkey)||33!==t.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(t.witness){if(2!==t.witness.length)throw new TypeError("Witness is invalid");if(!s.isCanonicalScriptSignature(t.witness[0]))throw new TypeError("Witness has invalid signature");if(!h.isPoint(t.witness[1])||33!==t.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(t.signature&&!t.signature.equals(t.witness[0]))throw new TypeError("Signature mismatch");if(t.pubkey&&!t.pubkey.equals(t.witness[1]))throw new TypeError("Pubkey mismatch");const r=i.hash160(t.witness[1]);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch")}}return Object.assign(p,t)}},5732:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(2572),o=r(419),s=r(3016),a=r(8535),u=r(9031),f=s.OPS,h=r(701),c=r(1273),l=n.alloc(0);function d(t){return!(!n.isBuffer(t)||65!==t.length||4!==t[0]||!h.isPoint(t))}e.p2wsh=function(t,e){if(!(t.address||t.hash||t.output||t.redeem||t.witness))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),u({network:u.maybe(u.Object),address:u.maybe(u.String),hash:u.maybe(u.BufferN(32)),output:u.maybe(u.BufferN(34)),redeem:u.maybe({input:u.maybe(u.Buffer),network:u.maybe(u.Object),output:u.maybe(u.Buffer),witness:u.maybe(u.arrayOf(u.Buffer))}),input:u.maybe(u.BufferN(0)),witness:u.maybe(u.arrayOf(u.Buffer))},t);const r=a.value((()=>{const e=c.decode(t.address),r=e.words.shift(),i=c.fromWords(e.words);return{version:r,prefix:e.prefix,data:n.from(i)}})),h=a.value((()=>s.decompile(t.redeem.input)));let p=t.network;p||(p=t.redeem&&t.redeem.network||o.bitcoin);const y={network:p};if(a.prop(y,"address",(()=>{if(!y.hash)return;const t=c.toWords(y.hash);return t.unshift(0),c.encode(p.bech32,t)})),a.prop(y,"hash",(()=>t.output?t.output.slice(2):t.address?r().data:y.redeem&&y.redeem.output?i.sha256(y.redeem.output):void 0)),a.prop(y,"output",(()=>{if(y.hash)return s.compile([f.OP_0,y.hash])})),a.prop(y,"redeem",(()=>{if(t.witness)return{output:t.witness[t.witness.length-1],input:l,witness:t.witness.slice(0,-1)}})),a.prop(y,"input",(()=>{if(y.witness)return l})),a.prop(y,"witness",(()=>{if(t.redeem&&t.redeem.input&&t.redeem.input.length>0&&t.redeem.output&&t.redeem.output.length>0){const e=s.toStack(h());return y.redeem=Object.assign({witness:e},t.redeem),y.redeem.input=l,[].concat(e,t.redeem.output)}if(t.redeem&&t.redeem.output&&t.redeem.witness)return[].concat(t.redeem.witness,t.redeem.output)})),a.prop(y,"name",(()=>{const t=["p2wsh"];return void 0!==y.redeem&&t.push(y.redeem.name),t.join("-")})),e.validate){let e=n.from([]);if(t.address){if(r().prefix!==p.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw new TypeError("Invalid address version");if(32!==r().data.length)throw new TypeError("Invalid address data");e=r().data}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(34!==t.output.length||t.output[0]!==f.OP_0||32!==t.output[1])throw new TypeError("Output is invalid");const r=t.output.slice(2);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.redeem){if(t.redeem.network&&t.redeem.network!==p)throw new TypeError("Network mismatch");if(t.redeem.input&&t.redeem.input.length>0&&t.redeem.witness&&t.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(t.redeem.output){if(0===s.decompile(t.redeem.output).length)throw new TypeError("Redeem.output is invalid");const r=i.sha256(t.redeem.output);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.redeem.input&&!s.isPushOnly(h()))throw new TypeError("Non push-only scriptSig");if(t.witness&&t.redeem.witness&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.witness,t.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(t.redeem.input&&h().some(d)||t.redeem.output&&(s.decompile(t.redeem.output)||[]).some(d))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(t.witness&&t.witness.length>0){const e=t.witness[t.witness.length-1];if(t.redeem&&t.redeem.output&&!t.redeem.output.equals(e))throw new TypeError("Witness and redeem.output mismatch");if(t.witness.some(d)||(s.decompile(e)||[]).some(d))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(y,t)}},9468:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8174),o=r(9214),s=r(5639),a=r(9168),u=r(9359),f=r(2572),h=r(8893),c=r(419),l=r(6469),d=r(3016),p=r(4457),y={network:c.bitcoin,maximumFeeRate:5e3};class m{constructor(t={},e=new i.Psbt(new b)){this.data=e,this.opts=Object.assign({},y,t),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},0===this.data.inputs.length&&this.setVersion(2);const r=(t,e,r,n)=>Object.defineProperty(t,e,{enumerable:r,writable:n});r(this,"__CACHE",!1,!0),r(this,"opts",!1,!0)}static fromBase64(t,e={}){const r=n.from(t,"base64");return this.fromBuffer(r,e)}static fromHex(t,e={}){const r=n.from(t,"hex");return this.fromBuffer(r,e)}static fromBuffer(t,e={}){const r=i.Psbt.fromBuffer(t,g),n=new m(e,r);var o,s;return o=n.__CACHE.__TX,s=n.__CACHE,o.ins.forEach((t=>{N(s,t)})),n}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(t){this.setVersion(t)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(t){this.setLocktime(t)}get txInputs(){return this.__CACHE.__TX.ins.map((t=>({hash:u.cloneBuffer(t.hash),index:t.index,sequence:t.sequence})))}get txOutputs(){return this.__CACHE.__TX.outs.map((t=>{let e;try{e=a.fromOutputScript(t.script,this.opts.network)}catch(t){}return{script:u.cloneBuffer(t.script),value:t.value,address:e}}))}combine(...t){return this.data.combine(...t.map((t=>t.data))),this}clone(){const t=m.fromBuffer(this.data.toBuffer());return t.opts=JSON.parse(JSON.stringify(this.opts)),t}setMaximumFeeRate(t){x(t),this.opts.maximumFeeRate=t}setVersion(t){x(t),P(this.data.inputs,"setVersion");const e=this.__CACHE;return e.__TX.version=t,e.__EXTRACTED_TX=void 0,this}setLocktime(t){x(t),P(this.data.inputs,"setLocktime");const e=this.__CACHE;return e.__TX.locktime=t,e.__EXTRACTED_TX=void 0,this}setInputSequence(t,e){x(e),P(this.data.inputs,"setInputSequence");const r=this.__CACHE;if(r.__TX.ins.length<=t)throw new Error("Input index too high");return r.__TX.ins[t].sequence=e,r.__EXTRACTED_TX=void 0,this}addInputs(t){return t.forEach((t=>this.addInput(t))),this}addInput(t){if(arguments.length>1||!t||void 0===t.hash||void 0===t.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");P(this.data.inputs,"addInput"),t.witnessScript&&X(t.witnessScript);const e=this.__CACHE;this.data.addInput(t),N(e,e.__TX.ins[e.__TX.ins.length-1]);const r=this.data.inputs.length-1,n=this.data.inputs[r];return n.nonWitnessUtxo&&z(this.__CACHE,n,r),e.__FEE=void 0,e.__FEE_RATE=void 0,e.__EXTRACTED_TX=void 0,this}addOutputs(t){return t.forEach((t=>this.addOutput(t))),this}addOutput(t){if(arguments.length>1||!t||void 0===t.value||void 0===t.address&&void 0===t.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");P(this.data.inputs,"addOutput");const{address:e}=t;if("string"==typeof e){const{network:r}=this.opts,n=a.toOutputScript(e,r);t=Object.assign(t,{script:n})}const r=this.__CACHE;return this.data.addOutput(t),r.__FEE=void 0,r.__FEE_RATE=void 0,r.__EXTRACTED_TX=void 0,this}extractTransaction(t){if(!this.data.inputs.every(_))throw new Error("Not finalized");const e=this.__CACHE;if(t||function(t,e,r){const n=e.__FEE_RATE||t.getFeeRate(),i=e.__EXTRACTED_TX.virtualSize(),o=n*i;if(n>=r.maximumFeeRate)throw new Error(`Warning: You are paying around ${(o/1e8).toFixed(8)} in fees, which is ${n} satoshi per byte for a transaction with a VSize of ${i} bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.`)}(this,e,this.opts),e.__EXTRACTED_TX)return e.__EXTRACTED_TX;const r=e.__TX.clone();return $(this.data.inputs,r,e,!0),r}getFeeRate(){return C("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return C("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return s.checkForInput(this.data.inputs,0),Y(this.data.inputs.length).forEach((t=>this.finalizeInput(t))),this}finalizeInput(t,e=j){const r=s.checkForInput(this.data.inputs,t),{script:n,isP2SH:i,isP2WSH:o,isSegwit:a}=function(t,e,r){const n=r.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!e.redeemScript,i.isP2WSH=!!e.witnessScript,e.witnessScript)i.script=e.witnessScript;else if(e.redeemScript)i.script=e.redeemScript;else if(e.nonWitnessUtxo){const o=K(r,e,t),s=n.ins[t].index;i.script=o.outs[s].script}else e.witnessUtxo&&(i.script=e.witnessUtxo.script);return(e.witnessScript||A(i.script))&&(i.isSegwit=!0),i}(t,r,this.__CACHE);if(!n)throw new Error(`No script found for input #${t}`);!function(t){if(!t.sighashType||!t.partialSig)return;const{partialSig:e,sighashType:r}=t;e.forEach((t=>{const{hashType:e}=d.signature.decode(t.signature);if(r!==e)throw new Error("Signature sighash does not match input sighash type")}))}(r);const{finalScriptSig:u,finalScriptWitness:f}=e(t,r,n,a,i,o);if(u&&this.data.updateInput(t,{finalScriptSig:u}),f&&this.data.updateInput(t,{finalScriptWitness:f}),!u&&!f)throw new Error(`Unknown error finalizing input #${t}`);return this.data.clearFinalizedInput(t),this}getInputType(t){const e=s.checkForInput(this.data.inputs,t),r=G(W(t,e,this.__CACHE),t,"input",e.redeemScript||function(t){if(!t)return;const e=d.decompile(t);if(!e)return;const r=e[e.length-1];var i;if(n.isBuffer(r)&&!V(r)&&(i=r,!d.isCanonicalScriptSignature(i))&&d.decompile(r))return r}(e.finalScriptSig),e.witnessScript||function(t){if(!t)return;const e=q(t),r=e[e.length-1];return!V(r)&&d.decompile(r)?r:void 0}(e.finalScriptWitness));return("raw"===r.type?"":r.type+"-")+Z(r.meaningfulScript)}inputHasPubkey(t,e){return function(t,e,r,n){const i=W(r,e,n),{meaningfulScript:o}=G(i,r,"input",e.redeemScript,e.witnessScript);return J(t,o)}(e,s.checkForInput(this.data.inputs,t),t,this.__CACHE)}inputHasHDKey(t,e){const r=s.checkForInput(this.data.inputs,t),n=T(e);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}outputHasPubkey(t,e){return function(t,e,r,n){const i=n.__TX.outs[r].script,{meaningfulScript:o}=G(i,r,"output",e.redeemScript,e.witnessScript);return J(t,o)}(e,s.checkForOutput(this.data.outputs,t),t,this.__CACHE)}outputHasHDKey(t,e){const r=s.checkForOutput(this.data.outputs,t),n=T(e);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}validateSignaturesOfAllInputs(){return s.checkForInput(this.data.inputs,0),Y(this.data.inputs.length).map((t=>this.validateSignaturesOfInput(t))).reduce(((t,e)=>!0===e&&t),!0)}validateSignaturesOfInput(t,e){const r=this.data.inputs[t],n=(r||{}).partialSig;if(!r||!n||n.length<1)throw new Error("No signatures to validate");const i=e?n.filter((t=>t.pubkey.equals(e))):n;if(i.length<1)throw new Error("No signatures for this pubkey");const o=[];let s,a,u;for(const e of i){const n=d.signature.decode(e.signature),{hash:i,script:f}=u!==n.hashType?H(t,Object.assign({},r,{sighashType:n.hashType}),this.__CACHE,!0):{hash:s,script:a};u=n.hashType,s=i,a=f,B(e.pubkey,f,"verify");const c=h.fromPublicKey(e.pubkey);o.push(c.verify(i,n.signature))}return o.every((t=>!0===t))}signAllInputsHD(t,e=[p.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");const r=[];for(const n of Y(this.data.inputs.length))try{this.signInputHD(n,t,e),r.push(!0)}catch(t){r.push(!1)}if(r.every((t=>!1===t)))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(t,e=[p.Transaction.SIGHASH_ALL]){return new Promise(((r,n)=>{if(!t||!t.publicKey||!t.fingerprint)return n(new Error("Need HDSigner to sign input"));const i=[],o=[];for(const r of Y(this.data.inputs.length))o.push(this.signInputHDAsync(r,t,e).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((t=>!1===t)))return n(new Error("No inputs were signed"));r()}))}))}signInputHD(t,e,r=[p.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");return D(t,this.data.inputs,e).forEach((e=>this.signInput(t,e,r))),this}signInputHDAsync(t,e,r=[p.Transaction.SIGHASH_ALL]){return new Promise(((n,i)=>{if(!e||!e.publicKey||!e.fingerprint)return i(new Error("Need HDSigner to sign input"));const o=D(t,this.data.inputs,e).map((e=>this.signInputAsync(t,e,r)));return Promise.all(o).then((()=>{n()})).catch(i)}))}signAllInputs(t,e=[p.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const r=[];for(const n of Y(this.data.inputs.length))try{this.signInput(n,t,e),r.push(!0)}catch(t){r.push(!1)}if(r.every((t=>!1===t)))throw new Error("No inputs were signed");return this}signAllInputsAsync(t,e=[p.Transaction.SIGHASH_ALL]){return new Promise(((r,n)=>{if(!t||!t.publicKey)return n(new Error("Need Signer to sign input"));const i=[],o=[];for(const[r]of this.data.inputs.entries())o.push(this.signInputAsync(r,t,e).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((t=>!1===t)))return n(new Error("No inputs were signed"));r()}))}))}signInput(t,e,r=[p.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const{hash:n,sighashType:i}=F(this.data.inputs,t,e.publicKey,this.__CACHE,r),o=[{pubkey:e.publicKey,signature:d.signature.encode(e.sign(n),i)}];return this.data.updateInput(t,{partialSig:o}),this}signInputAsync(t,e,r=[p.Transaction.SIGHASH_ALL]){return Promise.resolve().then((()=>{if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const{hash:n,sighashType:i}=F(this.data.inputs,t,e.publicKey,this.__CACHE,r);return Promise.resolve(e.sign(n)).then((r=>{const n=[{pubkey:e.publicKey,signature:d.signature.encode(r,i)}];this.data.updateInput(t,{partialSig:n})}))}))}toBuffer(){return v(this.__CACHE),this.data.toBuffer()}toHex(){return v(this.__CACHE),this.data.toHex()}toBase64(){return v(this.__CACHE),this.data.toBase64()}updateGlobal(t){return this.data.updateGlobal(t),this}updateInput(t,e){return e.witnessScript&&X(e.witnessScript),this.data.updateInput(t,e),e.nonWitnessUtxo&&z(this.__CACHE,this.data.inputs[t],t),this}updateOutput(t,e){return this.data.updateOutput(t,e),this}addUnknownKeyValToGlobal(t){return this.data.addUnknownKeyValToGlobal(t),this}addUnknownKeyValToInput(t,e){return this.data.addUnknownKeyValToInput(t,e),this}addUnknownKeyValToOutput(t,e){return this.data.addUnknownKeyValToOutput(t,e),this}clearFinalizedInput(t){return this.data.clearFinalizedInput(t),this}}e.Psbt=m;const g=t=>new b(t);class b{constructor(t=n.from([2,0,0,0,0,0,0,0,0,0])){this.tx=p.Transaction.fromBuffer(t),function(t){if(!t.ins.every((t=>t.script&&0===t.script.length&&t.witness&&0===t.witness.length)))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(t){if(void 0===t.hash||void 0===t.index||!n.isBuffer(t.hash)&&"string"!=typeof t.hash||"number"!=typeof t.index)throw new Error("Error adding input.");const e="string"==typeof t.hash?u.reverseBuffer(n.from(t.hash,"hex")):t.hash;this.tx.addInput(e,t.index,t.sequence)}addOutput(t){if(void 0===t.script||void 0===t.value||!n.isBuffer(t.script)||"number"!=typeof t.value)throw new Error("Error adding output.");this.tx.addOutput(t.script,t.value)}toBuffer(){return this.tx.toBuffer()}}function v(t){if(!1!==t.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function w(t,e,r){if(!e)return!1;let n;if(n=r?r.map((t=>{const r=h.fromPublicKey(t,{compressed:!0}).publicKey;return e.find((t=>t.pubkey.equals(r)))})).filter((t=>!!t)):e,n.length>t)throw new Error("Too many signatures");return n.length===t}function _(t){return!!t.finalScriptSig||!!t.finalScriptWitness}function S(t){return e=>{try{return t({output:e}),!0}catch(t){return!1}}}const E=S(l.p2ms),M=S(l.p2pk),k=S(l.p2pkh),A=S(l.p2wpkh),O=S(l.p2wsh),I=S(l.p2sh);function T(t){return e=>!!e.masterFingerprint.equals(t.fingerprint)&&!!t.derivePath(e.path).publicKey.equals(e.pubkey)}function x(t){if("number"!=typeof t||t!==Math.floor(t)||t>4294967295||t<0)throw new Error("Invalid 32 bit integer")}function P(t,e){t.forEach((t=>{let r=!1,i=[];if(0===(t.partialSig||[]).length){if(!t.finalScriptSig&&!t.finalScriptWitness)return;i=function(t){const e=t.finalScriptSig&&d.decompile(t.finalScriptSig)||[],r=t.finalScriptWitness&&d.decompile(t.finalScriptWitness)||[];return e.concat(r).filter((t=>n.isBuffer(t)&&d.isCanonicalScriptSignature(t))).map((t=>({signature:t})))}(t)}else i=t.partialSig;if(i.forEach((t=>{const{hashType:n}=d.signature.decode(t.signature),i=[];switch(n&p.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&n){case p.Transaction.SIGHASH_ALL:break;case p.Transaction.SIGHASH_SINGLE:case p.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}-1===i.indexOf(e)&&(r=!0)})),r)throw new Error("Can not modify transaction, signatures exist.")}))}function B(t,e,r){if(!J(t,e))throw new Error(`Can not ${r} for this input with the key ${t.toString("hex")}`)}function N(t,e){const r=u.reverseBuffer(n.from(e.hash)).toString("hex")+":"+e.index;if(t.__TX_IN_CACHE[r])throw new Error("Duplicate input detected.");t.__TX_IN_CACHE[r]=1}function U(t,e){return(r,n,i,o)=>{const s=t({redeem:{output:i}}).output;if(!n.equals(s))throw new Error(`${e} for ${o} #${r} doesn't match the scriptPubKey in the prevout`)}}const R=U(l.p2sh,"Redeem script"),L=U(l.p2wsh,"Witness script");function C(t,e,r,n){if(!r.every(_))throw new Error(`PSBT must be finalized to calculate ${e}`);if("__FEE_RATE"===t&&n.__FEE_RATE)return n.__FEE_RATE;if("__FEE"===t&&n.__FEE)return n.__FEE;let i,o=!0;return n.__EXTRACTED_TX?(i=n.__EXTRACTED_TX,o=!1):i=n.__TX.clone(),$(r,i,n,o),"__FEE_RATE"===t?n.__FEE_RATE:"__FEE"===t?n.__FEE:void 0}function j(t,e,r,i,s,a){const u=Z(r);if(!function(t,e,r){switch(r){case"pubkey":case"pubkeyhash":case"witnesspubkeyhash":return w(1,t.partialSig);case"multisig":const r=l.p2ms({output:e});return w(r.m,t.partialSig,r.pubkeys);default:return!1}}(e,r,u))throw new Error(`Can not finalize input #${t}`);return function(t,e,r,i,s,a){let u,f;const h=function(t,e,r){let n;switch(e){case"multisig":const e=function(t,e){return l.p2ms({output:t}).pubkeys.map((t=>(e.filter((e=>e.pubkey.equals(t)))[0]||{}).signature)).filter((t=>!!t))}(t,r);n=l.p2ms({output:t,signatures:e});break;case"pubkey":n=l.p2pk({output:t,signature:r[0].signature});break;case"pubkeyhash":n=l.p2pkh({output:t,pubkey:r[0].pubkey,signature:r[0].signature});break;case"witnesspubkeyhash":n=l.p2wpkh({output:t,pubkey:r[0].pubkey,signature:r[0].signature})}return n}(t,e,r),c=a?l.p2wsh({redeem:h}):null,d=s?l.p2sh({redeem:c||h}):null;return i?(f=function(t){let e=n.allocUnsafe(0);function r(t){const r=e.length,i=o.encodingLength(t);e=n.concat([e,n.allocUnsafe(i)]),o.encode(t,e,r)}function i(t){r(t.length),function(t){e=n.concat([e,n.from(t)])}(t)}var s;return r((s=t).length),s.forEach(i),e}(c?c.witness:h.witness),d&&(u=d.input)):u=d?d.input:h.input,{finalScriptSig:u,finalScriptWitness:f}}(r,u,e.partialSig,i,s,a)}function F(t,e,r,n,i){const o=s.checkForInput(t,e),{hash:a,sighashType:u,script:f}=H(e,o,n,!1,i);return B(r,f,"sign"),{hash:a,sighashType:u}}function H(t,e,r,n,i){const o=r.__TX,s=e.sighashType||p.Transaction.SIGHASH_ALL;if(i&&i.indexOf(s)<0){const t=function(t){let e=t&p.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&t){case p.Transaction.SIGHASH_ALL:e+="SIGHASH_ALL";break;case p.Transaction.SIGHASH_SINGLE:e+="SIGHASH_SINGLE";break;case p.Transaction.SIGHASH_NONE:e+="SIGHASH_NONE"}return e}(s);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${t}`)}let a,u;if(e.nonWitnessUtxo){const n=K(r,e,t),i=o.ins[t].hash,s=n.getHash();if(!i.equals(s))throw new Error(`Non-witness UTXO hash for input #${t} doesn't match the hash specified in the prevout`);const a=o.ins[t].index;u=n.outs[a]}else{if(!e.witnessUtxo)throw new Error("Need a Utxo input item for signing");u=e.witnessUtxo}const{meaningfulScript:f,type:h}=G(u.script,t,"input",e.redeemScript,e.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(h)>=0)a=o.hashForWitnessV0(t,f,u.value,s);else if(A(f)){const e=l.p2pkh({hash:f.slice(2)}).output;a=o.hashForWitnessV0(t,e,u.value,s)}else{if(void 0===e.nonWitnessUtxo&&!1===r.__UNSAFE_SIGN_NONSEGWIT)throw new Error(`Input #${t} has witnessUtxo but non-segwit script: ${f.toString("hex")}`);n||!1===r.__UNSAFE_SIGN_NONSEGWIT||console.warn("Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as the old TransactionBuilder class when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant.\n*********************\nPROCEED WITH CAUTION!\n*********************"),a=o.hashForSignature(t,f,s)}return{script:f,sighashType:s,hash:a}}function D(t,e,r){const n=s.checkForInput(e,t);if(!n.bip32Derivation||0===n.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");const i=n.bip32Derivation.map((t=>t.masterFingerprint.equals(r.fingerprint)?t:void 0)).filter((t=>!!t));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");return i.map((t=>{const e=r.derivePath(t.path);if(!t.pubkey.equals(e.publicKey))throw new Error("pubkey did not match bip32Derivation");return e}))}function q(t){let e=0;function r(){const r=o.decode(t,e);return e+=o.decode.bytes,r}return function(){const n=r(),i=[];for(let s=0;s<n;s++)i.push((o=void 0,o=r(),e+=o,t.slice(e-o,e)));var o;return i}()}function z(t,e,r){t.__NON_WITNESS_UTXO_BUF_CACHE[r]=e.nonWitnessUtxo;const n=p.Transaction.fromBuffer(e.nonWitnessUtxo);t.__NON_WITNESS_UTXO_TX_CACHE[r]=n;const i=t,o=r;delete e.nonWitnessUtxo,Object.defineProperty(e,"nonWitnessUtxo",{enumerable:!0,get(){const t=i.__NON_WITNESS_UTXO_BUF_CACHE[o],e=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==t)return t;{const t=e.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=t,t}},set(t){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=t}})}function $(t,e,r,n){let i=0;t.forEach(((t,o)=>{if(n&&t.finalScriptSig&&(e.ins[o].script=t.finalScriptSig),n&&t.finalScriptWitness&&(e.ins[o].witness=q(t.finalScriptWitness)),t.witnessUtxo)i+=t.witnessUtxo.value;else if(t.nonWitnessUtxo){const n=K(r,t,o),s=e.ins[o].index,a=n.outs[s];i+=a.value}}));const o=e.outs.reduce(((t,e)=>t+e.value),0),s=i-o;if(s<0)throw new Error("Outputs are spending more than Inputs");const a=e.virtualSize();r.__FEE=s,r.__EXTRACTED_TX=e,r.__FEE_RATE=Math.floor(s/a)}function K(t,e,r){const n=t.__NON_WITNESS_UTXO_TX_CACHE;return n[r]||z(t,e,r),n[r]}function W(t,e,r){if(void 0!==e.witnessUtxo)return e.witnessUtxo.script;if(void 0!==e.nonWitnessUtxo)return K(r,e,t).outs[r.__TX.ins[t].index].script;throw new Error("Can't find pubkey in input without Utxo data")}function V(t){return 33===t.length&&d.isCanonicalPubKey(t)}function G(t,e,r,n,i){const o=I(t),s=o&&n&&O(n),a=O(t);if(o&&void 0===n)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((a||s)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let u;return s?(u=i,R(e,t,n,r),L(e,n,i,r),X(u)):a?(u=i,L(e,t,i,r),X(u)):o?(u=n,R(e,t,n,r)):u=t,{meaningfulScript:u,type:s?"p2sh-p2wsh":o?"p2sh":a?"p2wsh":"raw"}}function X(t){if(A(t)||I(t))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function J(t,e){const r=f.hash160(t),n=d.decompile(e);if(null===n)throw new Error("Unknown script error");return n.some((e=>"number"!=typeof e&&(e.equals(t)||e.equals(r))))}function Z(t){return A(t)?"witnesspubkeyhash":k(t)?"pubkeyhash":E(t)?"multisig":M(t)?"pubkey":"nonstandard"}function Y(t){return[...Array(t).keys()]}},3016:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(7262),o=r(9394),s=r(6168),a=r(9875),u=r(701),f=r(7131),h=r(9031);e.OPS=r(196);const c=r(7401),l=e.OPS.OP_RESERVED;function d(t){return s.Buffer(t)||function(t){return s.Number(t)&&(t===e.OPS.OP_0||t>=e.OPS.OP_1&&t<=e.OPS.OP_16||t===e.OPS.OP_1NEGATE)}(t)}function p(t){return s.Array(t)&&t.every(d)}function y(t){return 0===t.length?e.OPS.OP_0:1===t.length?t[0]>=1&&t[0]<=16?l+t[0]:129===t[0]?e.OPS.OP_1NEGATE:void 0:void 0}function m(t){return n.isBuffer(t)}function g(t){return n.isBuffer(t)}function b(t){if(m(t))return t;h(s.Array,t);const e=t.reduce(((t,e)=>g(e)?1===e.length&&void 0!==y(e)?t+1:t+f.encodingLength(e.length)+e.length:t+1),0),r=n.allocUnsafe(e);let i=0;if(t.forEach((t=>{if(g(t)){const e=y(t);if(void 0!==e)return r.writeUInt8(e,i),void(i+=1);i+=f.encode(r,t.length,i),t.copy(r,i),i+=t.length}else r.writeUInt8(t,i),i+=1})),i!==r.length)throw new Error("Could not decode chunks");return r}function v(t){if(r=t,s.Array(r))return t;var r;h(s.Buffer,t);const n=[];let i=0;for(;i<t.length;){const r=t[i];if(r>e.OPS.OP_0&&r<=e.OPS.OP_PUSHDATA4){const e=f.decode(t,i);if(null===e)return null;if(i+=e.size,i+e.number>t.length)return null;const r=t.slice(i,i+e.number);i+=e.number;const o=y(r);void 0!==o?n.push(o):n.push(r)}else n.push(r),i+=1}return n}function w(t){const e=-129&t;return e>0&&e<4}e.isPushOnly=p,e.compile=b,e.decompile=v,e.toASM=function(t){return m(t)&&(t=v(t)),t.map((t=>{if(g(t)){const e=y(t);if(void 0===e)return t.toString("hex");t=e}return c[t]})).join(" ")},e.fromASM=function(t){return h(s.String,t),b(t.split(" ").map((t=>void 0!==e.OPS[t]?e.OPS[t]:(h(s.Hex,t),n.from(t,"hex")))))},e.toStack=function(t){return t=v(t),h(p,t),t.map((t=>g(t)?t:t===e.OPS.OP_0?n.allocUnsafe(0):i.encode(t-l)))},e.isCanonicalPubKey=function(t){return u.isPoint(t)},e.isDefinedHashType=w,e.isCanonicalScriptSignature=function(t){return!!n.isBuffer(t)&&!!w(t[t.length-1])&&a.check(t.slice(0,-1))},e.number=i,e.signature=o},7262:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.decode=function(t,e,r){e=e||4,r=void 0===r||r;const n=t.length;if(0===n)return 0;if(n>e)throw new TypeError("Script number overflow");if(r&&0==(127&t[n-1])&&(n<=1||0==(128&t[n-2])))throw new Error("Non-minimally encoded script number");if(5===n){const e=t.readUInt32LE(0),r=t.readUInt8(4);return 128&r?-(4294967296*(-129&r)+e):4294967296*r+e}let i=0;for(let e=0;e<n;++e)i|=t[e]<<8*e;return 128&t[n-1]?-(i&~(128<<8*(n-1))):i},e.encode=function(t){let e=Math.abs(t);const r=(i=e)>2147483647?5:i>8388607?4:i>32767?3:i>127?2:i>0?1:0;var i;const o=n.allocUnsafe(r),s=t<0;for(let t=0;t<r;++t)o.writeUInt8(255&e,t),e>>=8;return 128&o[r-1]?o.writeUInt8(s?128:0,r-1):s&&(o[r-1]|=128),o}},9394:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(6168),o=r(9875),s=r(9031),a=n.alloc(1,0);function u(t){let e=0;for(;0===t[e];)++e;return e===t.length?a:128&(t=t.slice(e))[0]?n.concat([a,t],1+t.length):t}function f(t){0===t[0]&&(t=t.slice(1));const e=n.alloc(32,0),r=Math.max(0,32-t.length);return t.copy(e,r),e}e.decode=function(t){const e=t.readUInt8(t.length-1),r=-129&e;if(r<=0||r>=4)throw new Error("Invalid hashType "+e);const i=o.decode(t.slice(0,-1)),s=f(i.r),a=f(i.s);return{signature:n.concat([s,a],64),hashType:e}},e.encode=function(t,e){s({signature:i.BufferN(64),hashType:i.UInt8},{signature:t,hashType:e});const r=-129&e;if(r<=0||r>=4)throw new Error("Invalid hashType "+e);const a=n.allocUnsafe(1);a.writeUInt8(e,0);const f=u(t.slice(0,32)),h=u(t.slice(32,64));return n.concat([o.encode(f,h),a])}},3155:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(5253);e.input=n;const i=r(8731);e.output=i},5253:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016);function o(t){return t===i.OPS.OP_0||n.isCanonicalScriptSignature(t)}function s(t,e){const r=n.decompile(t);return!(r.length<2)&&r[0]===i.OPS.OP_0&&(e?r.slice(1).every(o):r.slice(1).every(n.isCanonicalScriptSignature))}e.check=s,s.toJSON=()=>"multisig input"},8731:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016),o=r(6168),s=i.OPS.OP_RESERVED;function a(t,e){const r=n.decompile(t);if(r.length<4)return!1;if(r[r.length-1]!==i.OPS.OP_CHECKMULTISIG)return!1;if(!o.Number(r[0]))return!1;if(!o.Number(r[r.length-2]))return!1;const a=r[0]-s,u=r[r.length-2]-s;return!(a<=0)&&(!(u>16)&&(!(a>u)&&(u===r.length-3&&(!!e||r.slice(1,-2).every(n.isCanonicalPubKey)))))}e.check=a,a.toJSON=()=>"multi-sig output"},9404:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=n.OPS;function o(t){const e=n.compile(t);return e.length>1&&e[0]===i.OP_RETURN}e.check=o,o.toJSON=()=>"null data output";const s={check:o};e.output=s},9177:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(435);e.input=n;const i=r(9047);e.output=i},435:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016);function i(t){const e=n.decompile(t);return 1===e.length&&n.isCanonicalScriptSignature(e[0])}e.check=i,i.toJSON=()=>"pubKey input"},9047:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016);function o(t){const e=n.decompile(t);return 2===e.length&&n.isCanonicalPubKey(e[0])&&e[1]===i.OPS.OP_CHECKSIG}e.check=o,o.toJSON=()=>"pubKey output"},6858:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1142);e.input=n;const i=r(5448);e.output=i},1142:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016);function i(t){const e=n.decompile(t);return 2===e.length&&n.isCanonicalScriptSignature(e[0])&&n.isCanonicalPubKey(e[1])}e.check=i,i.toJSON=()=>"pubKeyHash input"},5448:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016);function o(t){const e=n.compile(t);return 25===e.length&&e[0]===i.OPS.OP_DUP&&e[1]===i.OPS.OP_HASH160&&20===e[2]&&e[23]===i.OPS.OP_EQUALVERIFY&&e[24]===i.OPS.OP_CHECKSIG}e.check=o,o.toJSON=()=>"pubKeyHash output"},6696:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(8462);e.input=n;const i=r(9387);e.output=i},8462:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(3016),o=r(3155),s=r(9177),a=r(6858),u=r(3805),f=r(6226);function h(t,e){const r=i.decompile(t);if(r.length<1)return!1;const h=r[r.length-1];if(!n.isBuffer(h))return!1;const c=i.decompile(i.compile(r.slice(0,-1))),l=i.decompile(h);return!!l&&!!i.isPushOnly(c)&&(1===r.length?f.check(l)||u.check(l):!(!a.input.check(c)||!a.output.check(l))||!(!o.input.check(c,e)||!o.output.check(l))||!(!s.input.check(c)||!s.output.check(l)))}e.check=h,h.toJSON=()=>"scriptHash input"},9387:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016);function o(t){const e=n.compile(t);return 23===e.length&&e[0]===i.OPS.OP_HASH160&&20===e[1]&&e[22]===i.OPS.OP_EQUAL}e.check=o,o.toJSON=()=>"scriptHash output"},2468:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(2562);e.output=n},2562:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(3016),o=r(3016),s=r(6168),a=r(9031),u=n.from("aa21a9ed","hex");function f(t){const e=i.compile(t);return e.length>37&&e[0]===o.OPS.OP_RETURN&&36===e[1]&&e.slice(2,6).equals(u)}e.check=f,f.toJSON=()=>"Witness commitment output",e.encode=function(t){a(s.Hash256bit,t);const e=n.allocUnsafe(36);return u.copy(e,0),t.copy(e,4),i.compile([o.OPS.OP_RETURN,e])},e.decode=function(t){return a(f,t),i.decompile(t)[1].slice(4,36)}},8387:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1120);e.input=n;const i=r(3805);e.output=i},1120:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016);function i(t){const e=n.decompile(t);return 2===e.length&&n.isCanonicalScriptSignature(e[0])&&(r=e[1],n.isCanonicalPubKey(r)&&33===r.length);var r}e.check=i,i.toJSON=()=>"witnessPubKeyHash input"},3805:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016);function o(t){const e=n.compile(t);return 22===e.length&&e[0]===i.OPS.OP_0&&20===e[1]}e.check=o,o.toJSON=()=>"Witness pubKeyHash output"},8861:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3412);e.input=n;const i=r(6226);e.output=i},3412:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(3016),o=r(9031),s=r(3155),a=r(9177),u=r(6858);function f(t,e){if(o(o.Array,t),t.length<1)return!1;const r=t[t.length-1];if(!n.isBuffer(r))return!1;const f=i.decompile(r);if(!f||0===f.length)return!1;const h=i.compile(t.slice(0,-1));return!(!u.input.check(h)||!u.output.check(f))||!(!s.input.check(h,e)||!s.output.check(f))||!(!a.input.check(h)||!a.output.check(f))}e.check=f,f.toJSON=()=>"witnessScriptHash input"},6226:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(3016),i=r(3016);function o(t){const e=n.compile(t);return 34===e.length&&e[0]===i.OPS.OP_0&&32===e[1]}e.check=o,o.toJSON=()=>"Witness scriptHash output"},4457:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9359),o=r(2572),s=r(3016),a=r(3016),u=r(6168),f=r(9031),h=r(8595);function c(t){const e=t.length;return h.encodingLength(e)+e}const l=n.allocUnsafe(0),d=[],p=n.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),y=n.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),m=n.from("ffffffffffffffff","hex"),g={script:l,valueBuffer:m};class b{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(t,e){const r=new i.BufferReader(t),n=new b;n.version=r.readInt32();const o=r.readUInt8(),s=r.readUInt8();let a=!1;o===b.ADVANCED_TRANSACTION_MARKER&&s===b.ADVANCED_TRANSACTION_FLAG?a=!0:r.offset-=2;const u=r.readVarInt();for(let t=0;t<u;++t)n.ins.push({hash:r.readSlice(32),index:r.readUInt32(),script:r.readVarSlice(),sequence:r.readUInt32(),witness:d});const f=r.readVarInt();for(let t=0;t<f;++t)n.outs.push({value:r.readUInt64(),script:r.readVarSlice()});if(a){for(let t=0;t<u;++t)n.ins[t].witness=r.readVector();if(!n.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(n.locktime=r.readUInt32(),e)return n;if(r.offset!==t.length)throw new Error("Transaction has unexpected data");return n}static fromHex(t){return b.fromBuffer(n.from(t,"hex"),!1)}static isCoinbaseHash(t){f(u.Hash256bit,t);for(let e=0;e<32;++e)if(0!==t[e])return!1;return!0}isCoinbase(){return 1===this.ins.length&&b.isCoinbaseHash(this.ins[0].hash)}addInput(t,e,r,n){return f(u.tuple(u.Hash256bit,u.UInt32,u.maybe(u.UInt32),u.maybe(u.Buffer)),arguments),u.Null(r)&&(r=b.DEFAULT_SEQUENCE),this.ins.push({hash:t,index:e,script:n||l,sequence:r,witness:d})-1}addOutput(t,e){return f(u.tuple(u.Buffer,u.Satoshi),arguments),this.outs.push({script:t,value:e})-1}hasWitnesses(){return this.ins.some((t=>0!==t.witness.length))}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(t=!0){const e=t&&this.hasWitnesses();return(e?10:8)+h.encodingLength(this.ins.length)+h.encodingLength(this.outs.length)+this.ins.reduce(((t,e)=>t+40+c(e.script)),0)+this.outs.reduce(((t,e)=>t+8+c(e.script)),0)+(e?this.ins.reduce(((t,e)=>t+function(t){const e=t.length;return h.encodingLength(e)+t.reduce(((t,e)=>t+c(e)),0)}(e.witness)),0):0)}clone(){const t=new b;return t.version=this.version,t.locktime=this.locktime,t.ins=this.ins.map((t=>({hash:t.hash,index:t.index,script:t.script,sequence:t.sequence,witness:t.witness}))),t.outs=this.outs.map((t=>({script:t.script,value:t.value}))),t}hashForSignature(t,e,r){if(f(u.tuple(u.UInt32,u.Buffer,u.Number),arguments),t>=this.ins.length)return y;const i=s.compile(s.decompile(e).filter((t=>t!==a.OPS.OP_CODESEPARATOR))),h=this.clone();if((31&r)===b.SIGHASH_NONE)h.outs=[],h.ins.forEach(((e,r)=>{r!==t&&(e.sequence=0)}));else if((31&r)===b.SIGHASH_SINGLE){if(t>=this.outs.length)return y;h.outs.length=t+1;for(let e=0;e<t;e++)h.outs[e]=g;h.ins.forEach(((e,r)=>{r!==t&&(e.sequence=0)}))}r&b.SIGHASH_ANYONECANPAY?(h.ins=[h.ins[t]],h.ins[0].script=i):(h.ins.forEach((t=>{t.script=l})),h.ins[t].script=i);const c=n.allocUnsafe(h.byteLength(!1)+4);return c.writeInt32LE(r,c.length-4),h.__toBuffer(c,0,!1),o.hash256(c)}hashForWitnessV0(t,e,r,s){f(u.tuple(u.UInt32,u.Buffer,u.Satoshi,u.UInt32),arguments);let a,h=n.from([]),l=p,d=p,y=p;if(s&b.SIGHASH_ANYONECANPAY||(h=n.allocUnsafe(36*this.ins.length),a=new i.BufferWriter(h,0),this.ins.forEach((t=>{a.writeSlice(t.hash),a.writeUInt32(t.index)})),d=o.hash256(h)),s&b.SIGHASH_ANYONECANPAY||(31&s)===b.SIGHASH_SINGLE||(31&s)===b.SIGHASH_NONE||(h=n.allocUnsafe(4*this.ins.length),a=new i.BufferWriter(h,0),this.ins.forEach((t=>{a.writeUInt32(t.sequence)})),y=o.hash256(h)),(31&s)!==b.SIGHASH_SINGLE&&(31&s)!==b.SIGHASH_NONE){const t=this.outs.reduce(((t,e)=>t+8+c(e.script)),0);h=n.allocUnsafe(t),a=new i.BufferWriter(h,0),this.outs.forEach((t=>{a.writeUInt64(t.value),a.writeVarSlice(t.script)})),l=o.hash256(h)}else if((31&s)===b.SIGHASH_SINGLE&&t<this.outs.length){const e=this.outs[t];h=n.allocUnsafe(8+c(e.script)),a=new i.BufferWriter(h,0),a.writeUInt64(e.value),a.writeVarSlice(e.script),l=o.hash256(h)}h=n.allocUnsafe(156+c(e)),a=new i.BufferWriter(h,0);const m=this.ins[t];return a.writeUInt32(this.version),a.writeSlice(d),a.writeSlice(y),a.writeSlice(m.hash),a.writeUInt32(m.index),a.writeVarSlice(e),a.writeUInt64(r),a.writeUInt32(m.sequence),a.writeSlice(l),a.writeUInt32(this.locktime),a.writeUInt32(s),o.hash256(h)}getHash(t){return t&&this.isCoinbase()?n.alloc(32,0):o.hash256(this.__toBuffer(void 0,void 0,t))}getId(){return i.reverseBuffer(this.getHash(!1)).toString("hex")}toBuffer(t,e){return this.__toBuffer(t,e,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(t,e){f(u.tuple(u.Number,u.Buffer),arguments),this.ins[t].script=e}setWitness(t,e){f(u.tuple(u.Number,[u.Buffer]),arguments),this.ins[t].witness=e}__toBuffer(t,e,r=!1){t||(t=n.allocUnsafe(this.byteLength(r)));const o=new i.BufferWriter(t,e||0);o.writeInt32(this.version);const s=r&&this.hasWitnesses();return s&&(o.writeUInt8(b.ADVANCED_TRANSACTION_MARKER),o.writeUInt8(b.ADVANCED_TRANSACTION_FLAG)),o.writeVarInt(this.ins.length),this.ins.forEach((t=>{o.writeSlice(t.hash),o.writeUInt32(t.index),o.writeVarSlice(t.script),o.writeUInt32(t.sequence)})),o.writeVarInt(this.outs.length),this.outs.forEach((t=>{void 0!==t.value?o.writeUInt64(t.value):o.writeSlice(t.valueBuffer),o.writeVarSlice(t.script)})),s&&this.ins.forEach((t=>{o.writeVector(t.witness)})),o.writeUInt32(this.locktime),void 0!==e?t.slice(e,o.offset):t}}b.DEFAULT_SEQUENCE=4294967295,b.SIGHASH_ALL=1,b.SIGHASH_NONE=2,b.SIGHASH_SINGLE=3,b.SIGHASH_ANYONECANPAY=128,b.ADVANCED_TRANSACTION_MARKER=0,b.ADVANCED_TRANSACTION_FLAG=1,e.Transaction=b},6459:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9168),o=r(9359),s=r(4654),a=r(2572),u=r(8893),f=r(419),h=r(6469),c=r(3016),l=r(3016),d=r(4457),p=r(6168),y=r(9031),m=s.types,g=new Set(["p2pkh","p2pk","p2wpkh","p2ms","p2sh-p2pkh","p2sh-p2pk","p2sh-p2wpkh","p2sh-p2ms","p2wsh-p2pkh","p2wsh-p2pk","p2wsh-p2ms","p2sh-p2wsh-p2pkh","p2sh-p2wsh-p2pk","p2sh-p2wsh-p2ms"]);function b(t,e,r){try{y(t,e)}catch(t){throw new Error(r)}}class v{constructor(t=f.bitcoin,e=2500){this.network=t,this.maximumFeeRate=e,this.__PREV_TX_SET={},this.__INPUTS=[],this.__TX=new d.Transaction,this.__TX.version=2,this.__USE_LOW_R=!1,console.warn("Deprecation Warning: TransactionBuilder will be removed in the future. (v6.x.x or later) Please use the Psbt class instead. Examples of usage are available in the transactions-psbt.js integration test file on our Github. A high level explanation is available in the psbt.ts and psbt.js files as well.")}static fromTransaction(t,e){const r=new v(e);return r.setVersion(t.version),r.setLockTime(t.locktime),t.outs.forEach((t=>{r.addOutput(t.script,t.value)})),t.ins.forEach((t=>{r.__addInputUnsafe(t.hash,t.index,{sequence:t.sequence,script:t.script,witness:t.witness})})),r.__INPUTS.forEach(((e,r)=>{!function(t,e,r){if(t.redeemScriptType!==m.P2MS||!t.redeemScript)return;if(t.pubkeys.length===t.signatures.length)return;const n=t.signatures.concat();t.signatures=t.pubkeys.map((i=>{const o=u.fromPublicKey(i);let s;return n.some(((i,a)=>{if(!i)return!1;const u=c.signature.decode(i),f=e.hashForSignature(r,t.redeemScript,u.hashType);return!!o.verify(f,u.signature)&&(n[a]=void 0,s=i,!0)})),s}))}(e,t,r)})),r}setLowR(t){return y(y.maybe(y.Boolean),t),void 0===t&&(t=!0),this.__USE_LOW_R=t,t}setLockTime(t){if(y(p.UInt32,t),this.__INPUTS.some((t=>!!t.signatures&&t.signatures.some((t=>void 0!==t)))))throw new Error("No, this would invalidate signatures");this.__TX.locktime=t}setVersion(t){y(p.UInt32,t),this.__TX.version=t}addInput(t,e,r,i){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");let s;if("string"==typeof(a=t)||a instanceof String)t=o.reverseBuffer(n.from(t,"hex"));else if(function(t){return t instanceof d.Transaction}(t)){const r=t.outs[e];i=r.script,s=r.value,t=t.getHash(!1)}var a;return this.__addInputUnsafe(t,e,{sequence:r,prevOutScript:i,value:s})}addOutput(t,e){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof t&&(t=i.toOutputScript(t,this.network)),this.__TX.addOutput(t,e)}build(){return this.__build(!1)}buildIncomplete(){return this.__build(!0)}sign(t,e,r,n,i,o){!function({input:t,ourPubKey:e,keyPair:r,signatureHash:n,hashType:i,useLowR:o}){let s=!1;for(const[a,u]of t.pubkeys.entries()){if(!e.equals(u))continue;if(t.signatures[a])throw new Error("Signature already exists");if(33!==e.length&&t.hasWitness)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");const f=r.sign(n,o);t.signatures[a]=c.signature.encode(f,i),s=!0}if(!s)throw new Error("Key pair cannot sign for this input")}(function(t,e,r,n,i,o,s,a,u,f,l){let v;if("number"==typeof i)console.warn("DEPRECATED: TransactionBuilder sign method arguments will change in v6, please use the TxbSignArg interface"),v=i;else{if("object"!=typeof i)throw new TypeError("TransactionBuilder sign first arg must be TxbSignArg or number");!function(t,e){if(!g.has(e.prevOutScriptType))throw new TypeError(`Unknown prevOutScriptType "${e.prevOutScriptType}"`);b(y.Number,e.vin,"sign must include vin parameter as Number (input index)"),b(p.Signer,e.keyPair,"sign must include keyPair parameter as Signer interface"),b(y.maybe(y.Number),e.hashType,"sign hashType parameter must be a number");const r=(t[e.vin]||[]).prevOutType,n=e.prevOutScriptType;switch(n){case"p2pkh":if(r&&"pubkeyhash"!==r)throw new TypeError(`input #${e.vin} is not of type p2pkh: ${r}`);b(y.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),b(y.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),b(y.value(void 0),e.witnessValue,`${n} requires NO witnessValue`);break;case"p2pk":if(r&&"pubkey"!==r)throw new TypeError(`input #${e.vin} is not of type p2pk: ${r}`);b(y.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),b(y.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),b(y.value(void 0),e.witnessValue,`${n} requires NO witnessValue`);break;case"p2wpkh":if(r&&"witnesspubkeyhash"!==r)throw new TypeError(`input #${e.vin} is not of type p2wpkh: ${r}`);b(y.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),b(y.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),b(p.Satoshi,e.witnessValue,`${n} requires witnessValue`);break;case"p2ms":if(r&&"multisig"!==r)throw new TypeError(`input #${e.vin} is not of type p2ms: ${r}`);b(y.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),b(y.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),b(y.value(void 0),e.witnessValue,`${n} requires NO witnessValue`);break;case"p2sh-p2wpkh":if(r&&"scripthash"!==r)throw new TypeError(`input #${e.vin} is not of type p2sh-p2wpkh: ${r}`);b(y.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),b(y.Buffer,e.redeemScript,`${n} requires redeemScript`),b(p.Satoshi,e.witnessValue,`${n} requires witnessValue`);break;case"p2sh-p2ms":case"p2sh-p2pk":case"p2sh-p2pkh":if(r&&"scripthash"!==r)throw new TypeError(`input #${e.vin} is not of type ${n}: ${r}`);b(y.value(void 0),e.witnessScript,`${n} requires NO witnessScript`),b(y.Buffer,e.redeemScript,`${n} requires redeemScript`),b(y.value(void 0),e.witnessValue,`${n} requires NO witnessValue`);break;case"p2wsh-p2ms":case"p2wsh-p2pk":case"p2wsh-p2pkh":if(r&&"witnessscripthash"!==r)throw new TypeError(`input #${e.vin} is not of type ${n}: ${r}`);b(y.Buffer,e.witnessScript,`${n} requires witnessScript`),b(y.value(void 0),e.redeemScript,`${n} requires NO redeemScript`),b(p.Satoshi,e.witnessValue,`${n} requires witnessValue`);break;case"p2sh-p2wsh-p2ms":case"p2sh-p2wsh-p2pk":case"p2sh-p2wsh-p2pkh":if(r&&"scripthash"!==r)throw new TypeError(`input #${e.vin} is not of type ${n}: ${r}`);b(y.Buffer,e.witnessScript,`${n} requires witnessScript`),b(y.Buffer,e.redeemScript,`${n} requires witnessScript`),b(p.Satoshi,e.witnessValue,`${n} requires witnessScript`)}}(e,i),({vin:v,keyPair:o,redeemScript:s,hashType:a,witnessValue:u,witnessScript:f}=i)}if(void 0===o)throw new Error("sign requires keypair");if(o.network&&o.network!==t)throw new TypeError("Inconsistent network");if(!e[v])throw new Error("No input at index: "+v);if(r(a=a||d.Transaction.SIGHASH_ALL))throw new Error("Transaction needs outputs");const w=e[v];if(void 0!==w.redeemScript&&s&&!w.redeemScript.equals(s))throw new Error("Inconsistent redeemScript");const S=o.publicKey||o.getPublicKey&&o.getPublicKey();if(!E(w)){if(void 0!==u){if(void 0!==w.value&&w.value!==u)throw new Error("Input did not match witnessValue");y(p.Satoshi,u),w.value=u}if(!E(w)){const t=function(t,e,r,n){if(r&&n){const i=h.p2wsh({redeem:{output:n}}),o=h.p2wsh({output:r}),s=h.p2sh({redeem:{output:r}}),a=h.p2sh({redeem:i});if(!i.hash.equals(o.hash))throw new Error("Witness script inconsistent with prevOutScript");if(!s.hash.equals(a.hash))throw new Error("Redeem script inconsistent with prevOutScript");const u=_(i.redeem.output,e);if(!u.pubkeys)throw new Error(u.type+" not supported as witnessScript ("+c.toASM(n)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(u.signatures=t.signatures);const f=n;if(u.type===m.P2WPKH)throw new Error("P2SH(P2WSH(P2WPKH)) is a consensus failure");return{redeemScript:r,redeemScriptType:m.P2WSH,witnessScript:n,witnessScriptType:u.type,prevOutType:m.P2SH,prevOutScript:s.output,hasWitness:!0,signScript:f,signType:u.type,pubkeys:u.pubkeys,signatures:u.signatures,maxSignatures:u.maxSignatures}}if(r){const n=h.p2sh({redeem:{output:r}});if(t.prevOutScript){let e;try{e=h.p2sh({output:t.prevOutScript})}catch(t){throw new Error("PrevOutScript must be P2SH")}if(!n.hash.equals(e.hash))throw new Error("Redeem script inconsistent with prevOutScript")}const i=_(n.redeem.output,e);if(!i.pubkeys)throw new Error(i.type+" not supported as redeemScript ("+c.toASM(r)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(i.signatures=t.signatures);let o=r;return i.type===m.P2WPKH&&(o=h.p2pkh({pubkey:i.pubkeys[0]}).output),{redeemScript:r,redeemScriptType:i.type,prevOutType:m.P2SH,prevOutScript:n.output,hasWitness:i.type===m.P2WPKH,signScript:o,signType:i.type,pubkeys:i.pubkeys,signatures:i.signatures,maxSignatures:i.maxSignatures}}if(n){const r=h.p2wsh({redeem:{output:n}});if(t.prevOutScript){const e=h.p2wsh({output:t.prevOutScript});if(!r.hash.equals(e.hash))throw new Error("Witness script inconsistent with prevOutScript")}const i=_(r.redeem.output,e);if(!i.pubkeys)throw new Error(i.type+" not supported as witnessScript ("+c.toASM(n)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(i.signatures=t.signatures);const o=n;if(i.type===m.P2WPKH)throw new Error("P2WSH(P2WPKH) is a consensus failure");return{witnessScript:n,witnessScriptType:i.type,prevOutType:m.P2WSH,prevOutScript:r.output,hasWitness:!0,signScript:o,signType:i.type,pubkeys:i.pubkeys,signatures:i.signatures,maxSignatures:i.maxSignatures}}if(t.prevOutType&&t.prevOutScript){if(t.prevOutType===m.P2SH)throw new Error("PrevOutScript is "+t.prevOutType+", requires redeemScript");if(t.prevOutType===m.P2WSH)throw new Error("PrevOutScript is "+t.prevOutType+", requires witnessScript");if(!t.prevOutScript)throw new Error("PrevOutScript is missing");const r=_(t.prevOutScript,e);if(!r.pubkeys)throw new Error(r.type+" not supported ("+c.toASM(t.prevOutScript)+")");t.signatures&&t.signatures.some((t=>void 0!==t))&&(r.signatures=t.signatures);let n=t.prevOutScript;return r.type===m.P2WPKH&&(n=h.p2pkh({pubkey:r.pubkeys[0]}).output),{prevOutType:r.type,prevOutScript:t.prevOutScript,hasWitness:r.type===m.P2WPKH,signScript:n,signType:r.type,pubkeys:r.pubkeys,signatures:r.signatures,maxSignatures:r.maxSignatures}}const i=h.p2pkh({pubkey:e}).output;return{prevOutType:m.P2PKH,prevOutScript:i,hasWitness:!1,signScript:i,signType:m.P2PKH,pubkeys:[e],signatures:[void 0]}}(w,S,s,f);Object.assign(w,t)}if(!E(w))throw Error(w.prevOutType+" not supported")}let M;return M=w.hasWitness?n.hashForWitnessV0(v,w.signScript,w.value,a):n.hashForSignature(v,w.signScript,a),{input:w,ourPubKey:S,keyPair:o,signatureHash:M,hashType:a,useLowR:!!l}}(this.network,this.__INPUTS,this.__needsOutputs.bind(this),this.__TX,t,e,r,n,i,o,this.__USE_LOW_R))}__addInputUnsafe(t,e,r){if(d.Transaction.isCoinbaseHash(t))throw new Error("coinbase inputs not supported");const n=t.toString("hex")+":"+e;if(void 0!==this.__PREV_TX_SET[n])throw new Error("Duplicate TxOut: "+n);let i={};if(void 0!==r.script&&(i=w(r.script,r.witness||[])),void 0!==r.value&&(i.value=r.value),!i.prevOutScript&&r.prevOutScript){let t;if(!i.pubkeys&&!i.signatures){const e=_(r.prevOutScript);e.pubkeys&&(i.pubkeys=e.pubkeys,i.signatures=e.signatures),t=e.type}i.prevOutScript=r.prevOutScript,i.prevOutType=t||s.output(r.prevOutScript)}const o=this.__TX.addInput(t,e,r.sequence,r.scriptSig);return this.__INPUTS[o]=i,this.__PREV_TX_SET[n]=!0,o}__build(t){if(!t){if(!this.__TX.ins.length)throw new Error("Transaction has no inputs");if(!this.__TX.outs.length)throw new Error("Transaction has no outputs")}const e=this.__TX.clone();if(this.__INPUTS.forEach(((r,n)=>{if(!r.prevOutType&&!t)throw new Error("Transaction is not complete");const i=S(r.prevOutType,r,t);if(i)e.setInputScript(n,i.input),e.setWitness(n,i.witness);else{if(!t&&r.prevOutType===m.NONSTANDARD)throw new Error("Unknown input type");if(!t)throw new Error("Not enough information")}})),!t&&this.__overMaximumFees(e.virtualSize()))throw new Error("Transaction has absurd fees");return e}__canModifyInputs(){return this.__INPUTS.every((t=>!t.signatures||t.signatures.every((t=>!t||0!=(M(t)&d.Transaction.SIGHASH_ANYONECANPAY)))))}__needsOutputs(t){return t===d.Transaction.SIGHASH_ALL?0===this.__TX.outs.length:0===this.__TX.outs.length&&this.__INPUTS.some((t=>!!t.signatures&&t.signatures.some((t=>!!t&&!(M(t)&d.Transaction.SIGHASH_NONE)))))}__canModifyOutputs(){const t=this.__TX.ins.length,e=this.__TX.outs.length;return this.__INPUTS.every((r=>void 0===r.signatures||r.signatures.every((r=>{if(!r)return!0;const n=31&M(r);return n===d.Transaction.SIGHASH_NONE||n===d.Transaction.SIGHASH_SINGLE&&t<=e}))))}__overMaximumFees(t){return(this.__INPUTS.reduce(((t,e)=>t+(e.value>>>0)),0)-this.__TX.outs.reduce(((t,e)=>t+e.value),0))/t>this.maximumFeeRate}}function w(t,e,r,n){if(0===t.length&&0===e.length)return{};if(!r){let n=s.input(t,!0),i=s.witness(e,!0);n===m.NONSTANDARD&&(n=void 0),i===m.NONSTANDARD&&(i=void 0),r=n||i}switch(r){case m.P2WPKH:{const{output:t,pubkey:r,signature:n}=h.p2wpkh({witness:e});return{prevOutScript:t,prevOutType:m.P2WPKH,pubkeys:[r],signatures:[n]}}case m.P2PKH:{const{output:e,pubkey:r,signature:n}=h.p2pkh({input:t});return{prevOutScript:e,prevOutType:m.P2PKH,pubkeys:[r],signatures:[n]}}case m.P2PK:{const{signature:e}=h.p2pk({input:t});return{prevOutType:m.P2PK,pubkeys:[void 0],signatures:[e]}}case m.P2MS:{const{m:e,pubkeys:r,signatures:i}=h.p2ms({input:t,output:n},{allowIncomplete:!0});return{prevOutType:m.P2MS,pubkeys:r,signatures:i,maxSignatures:e}}}if(r===m.P2SH){const{output:r,redeem:n}=h.p2sh({input:t,witness:e}),i=s.output(n.output),o=w(n.input,n.witness,i,n.output);return o.prevOutType?{prevOutScript:r,prevOutType:m.P2SH,redeemScript:n.output,redeemScriptType:o.prevOutType,witnessScript:o.witnessScript,witnessScriptType:o.witnessScriptType,pubkeys:o.pubkeys,signatures:o.signatures}:{}}if(r===m.P2WSH){const{output:r,redeem:n}=h.p2wsh({input:t,witness:e}),i=s.output(n.output);let o;return o=i===m.P2WPKH?w(n.input,n.witness,i):w(c.compile(n.witness),[],i,n.output),o.prevOutType?{prevOutScript:r,prevOutType:m.P2WSH,witnessScript:n.output,witnessScriptType:o.prevOutType,pubkeys:o.pubkeys,signatures:o.signatures}:{}}return{prevOutType:m.NONSTANDARD,prevOutScript:t}}function _(t,e){y(p.Buffer,t);const r=s.output(t);switch(r){case m.P2PKH:{if(!e)return{type:r};const n=h.p2pkh({output:t}).hash,i=a.hash160(e);return n.equals(i)?{type:r,pubkeys:[e],signatures:[void 0]}:{type:r}}case m.P2WPKH:{if(!e)return{type:r};const n=h.p2wpkh({output:t}).hash,i=a.hash160(e);return n.equals(i)?{type:r,pubkeys:[e],signatures:[void 0]}:{type:r}}case m.P2PK:return{type:r,pubkeys:[h.p2pk({output:t}).pubkey],signatures:[void 0]};case m.P2MS:{const e=h.p2ms({output:t});return{type:r,pubkeys:e.pubkeys,signatures:e.pubkeys.map((()=>{})),maxSignatures:e.m}}}return{type:r}}function S(t,e,r){const n=e.pubkeys||[];let i=e.signatures||[];switch(t){case m.P2PKH:if(0===n.length)break;if(0===i.length)break;return h.p2pkh({pubkey:n[0],signature:i[0]});case m.P2WPKH:if(0===n.length)break;if(0===i.length)break;return h.p2wpkh({pubkey:n[0],signature:i[0]});case m.P2PK:if(0===n.length)break;if(0===i.length)break;return h.p2pk({signature:i[0]});case m.P2MS:{const t=e.maxSignatures;i=r?i.map((t=>t||l.OPS.OP_0)):i.filter((t=>t));const o=!r||t===i.length;return h.p2ms({m:t,pubkeys:n,signatures:i},{allowIncomplete:r,validate:o})}case m.P2SH:{const t=S(e.redeemScriptType,e,r);if(!t)return;return h.p2sh({redeem:{output:t.output||e.redeemScript,input:t.input,witness:t.witness}})}case m.P2WSH:{const t=S(e.witnessScriptType,e,r);if(!t)return;return h.p2wsh({redeem:{output:e.witnessScript,input:t.input,witness:t.witness}})}}}function E(t){return void 0!==t.signScript&&void 0!==t.signType&&void 0!==t.pubkeys&&void 0!==t.signatures&&t.signatures.length===t.pubkeys.length&&t.pubkeys.length>0&&(!1===t.hasWitness||void 0!==t.value)}function M(t){return t.readUInt8(t.length-1)}e.TransactionBuilder=v},6168:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(9031),i=Math.pow(2,31)-1;function o(t){return n.String(t)&&!!t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}e.UInt31=function(t){return n.UInt32(t)&&t<=i},e.BIP32Path=o,o.toJSON=()=>"BIP32 derivation path",e.Signer=function(t){return(n.Buffer(t.publicKey)||"function"==typeof t.getPublicKey)&&"function"==typeof t.sign},e.Satoshi=function(t){return n.UInt53(t)&&t<=21e14},e.ECPoint=n.quacksLike("Point"),e.Network=n.compile({messagePrefix:n.oneOf(n.Buffer,n.String),bip32:{public:n.UInt32,private:n.UInt32},pubKeyHash:n.UInt8,scriptHash:n.UInt8,wif:n.UInt8}),e.Buffer256bit=n.BufferN(32),e.Hash160bit=n.BufferN(20),e.Hash256bit=n.BufferN(32),e.Number=n.Number,e.Array=n.Array,e.Boolean=n.Boolean,e.String=n.String,e.Buffer=n.Buffer,e.Hex=n.Hex,e.maybe=n.maybe,e.tuple=n.tuple,e.UInt8=n.UInt8,e.UInt32=n.UInt32,e.Function=n.Function,e.BufferN=n.BufferN,e.Null=n.Null,e.oneOf=n.oneOf},2197:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(3196).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u<a;u++){var f=t.charCodeAt(u)-48;o*=i,s=f>=49?f-49+10:f>=17?f-17+10:f,n(f>=0&&s<i,"Invalid character"),o+=s}return o}function h(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=f(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=f(t,h,t.length,e),h=0;h<s;h++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype._move=function(t){h(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function y(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var f=1;f<n;f++){for(var h=u>>>26,c=67108863&u,l=Math.min(f,e.length-1),d=Math.max(0,f-t.length+1);d<=l;d++){var p=f-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[f]=0|c,u=0|h}return 0!==u?r.words[f]=0|u:r.length--,r._strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?l[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var f=d[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var y=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?y+r:l[f-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,f=0,h=0|s[0],c=8191&h,l=h>>>13,d=0|s[1],p=8191&d,y=d>>>13,m=0|s[2],g=8191&m,b=m>>>13,v=0|s[3],w=8191&v,_=v>>>13,S=0|s[4],E=8191&S,M=S>>>13,k=0|s[5],A=8191&k,O=k>>>13,I=0|s[6],T=8191&I,x=I>>>13,P=0|s[7],B=8191&P,N=P>>>13,U=0|s[8],R=8191&U,L=U>>>13,C=0|s[9],j=8191&C,F=C>>>13,H=0|a[0],D=8191&H,q=H>>>13,z=0|a[1],$=8191&z,K=z>>>13,W=0|a[2],V=8191&W,G=W>>>13,X=0|a[3],J=8191&X,Z=X>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ht=0|a[8],ct=8191&ht,lt=ht>>>13,dt=0|a[9],pt=8191&dt,yt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(f+(n=Math.imul(c,D))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(l,D)|0))<<13)|0;f=((o=Math.imul(l,q))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,D),i=(i=Math.imul(p,q))+Math.imul(y,D)|0,o=Math.imul(y,q);var gt=(f+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,K)|0)+Math.imul(l,$)|0))<<13)|0;f=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,D),i=(i=Math.imul(g,q))+Math.imul(b,D)|0,o=Math.imul(b,q),n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,K)|0;var bt=(f+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(l,V)|0))<<13)|0;f=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,D),i=(i=Math.imul(w,q))+Math.imul(_,D)|0,o=Math.imul(_,q),n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,K)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,K)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,G)|0;var vt=(f+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(l,J)|0))<<13)|0;f=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(E,D),i=(i=Math.imul(E,q))+Math.imul(M,D)|0,o=Math.imul(M,q),n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Z)|0;var wt=(f+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;f=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,D),i=(i=Math.imul(A,q))+Math.imul(O,D)|0,o=Math.imul(O,q),n=n+Math.imul(E,$)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,K)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(g,J)|0,i=(i=i+Math.imul(g,Z)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0;var _t=(f+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(l,rt)|0))<<13)|0;f=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,D),i=(i=Math.imul(T,q))+Math.imul(x,D)|0,o=Math.imul(x,q),n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,K)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0;var St=(f+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(l,ot)|0))<<13)|0;f=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(B,D),i=(i=Math.imul(B,q))+Math.imul(N,D)|0,o=Math.imul(N,q),n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,K)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(E,J)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Z)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0;var Et=(f+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(l,ut)|0))<<13)|0;f=((o=o+Math.imul(l,ft)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,D),i=(i=Math.imul(R,q))+Math.imul(L,D)|0,o=Math.imul(L,q),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,K)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ft)|0;var Mt=(f+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;f=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(j,D),i=(i=Math.imul(j,q))+Math.imul(F,D)|0,o=Math.imul(F,q),n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,K)|0,n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ft)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ft)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var kt=(f+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,yt)|0)+Math.imul(l,pt)|0))<<13)|0;f=((o=o+Math.imul(l,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,K))+Math.imul(F,$)|0,o=Math.imul(F,K),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Z)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Z)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ft)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,lt)|0)+Math.imul(b,ct)|0,o=o+Math.imul(b,lt)|0;var At=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;f=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,G))+Math.imul(F,V)|0,o=Math.imul(F,G),n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ft)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ft)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var Ot=(f+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((o=o+Math.imul(b,yt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(j,J),i=(i=Math.imul(j,Z))+Math.imul(F,J)|0,o=Math.imul(F,Z),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ft)|0,n=n+Math.imul(E,ct)|0,i=(i=i+Math.imul(E,lt)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,lt)|0;var It=(f+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,yt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((o=o+Math.imul(_,yt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ft)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ft)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(O,ct)|0,o=o+Math.imul(O,lt)|0;var Tt=(f+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,yt)|0)+Math.imul(M,pt)|0))<<13)|0;f=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ft)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ft)|0,n=n+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(f+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,yt)|0)+Math.imul(O,pt)|0))<<13)|0;f=((o=o+Math.imul(O,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,ot),i=(i=Math.imul(j,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ft)|0,n=n+Math.imul(B,ct)|0,i=(i=i+Math.imul(B,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(f+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,yt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((o=o+Math.imul(x,yt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(j,ut),i=(i=Math.imul(j,ft))+Math.imul(F,ut)|0,o=Math.imul(F,ft),n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(L,ct)|0,o=o+Math.imul(L,lt)|0;var Bt=(f+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,yt)|0)+Math.imul(N,pt)|0))<<13)|0;f=((o=o+Math.imul(N,yt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,ct),i=(i=Math.imul(j,lt))+Math.imul(F,ct)|0,o=Math.imul(F,lt);var Nt=(f+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,yt)|0)+Math.imul(L,pt)|0))<<13)|0;f=((o=o+Math.imul(L,yt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Ut=(f+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,yt))+Math.imul(F,pt)|0))<<13)|0;return f=((o=Math.imul(F,yt))+(i>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,u[0]=mt,u[1]=gt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=St,u[7]=Et,u[8]=Mt,u[9]=kt,u[10]=At,u[11]=Ot,u[12]=It,u[13]=Tt,u[14]=xt,u[15]=Pt,u[16]=Bt,u[17]=Nt,u[18]=Ut,0!==f&&(u[19]=f,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),f=Math.max(0,o-t.length+1);f<=u;f++){var h=o-f,c=(0|t.words[h])*(0|e.words[f]),l=67108863&c;a=67108863&(l=l+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function b(t,e,r){return g(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(m=y),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?y(this,t,e):r<1024?g(this,t,e):b(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},v.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},v.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),f=Math.sin(2*Math.PI/a),h=0;h<i;h+=a)for(var c=u,l=f,d=0;d<s;d++){var p=r[h+d],y=n[h+d],m=r[h+d+s],g=n[h+d+s],b=c*m-l*g;g=c*g+l*m,m=b,r[h+d]=p+m,n[h+d]=y+g,r[h+d+s]=p-m,n[h+d+s]=y-g,d!==a&&(b=u*c-f*l,l=u*l+f*c,c=b)}},v.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},v.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},v.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},v.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},v.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},v.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),f=new Array(n),h=new Array(n),c=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,f,n),this.transform(s,o,a,u,n,i),this.transform(f,o,h,c,n,i);for(var d=0;d<n;d++){var p=a[d]*h[d]-u[d]*c[d];u[d]=a[d]*c[d]+u[d]*h[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),b(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var f=0;f<s;f++)u.words[f]=this.words[f];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,f=0;f<this.length;f++)this.words[f]=this.words[f+s];else this.words[0]=0,this.length=1;var h=0;for(f=this.length-1;f>=0&&(0!==h||f>=i);f--){var c=0|this.words[f];this.words[f]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var f=0;f<a.length;f++)a.words[f]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var c=u-1;c>=0;c--){var l=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=l)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),f=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++f;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(f)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function O(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},i(S,_),S.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},S.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(E,_),i(M,_),i(k,_),k.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new S;else if("p224"===t)e=new E;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new k}return w[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,f).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var y=d,m=0;0!==y.cmp(a);m++)y=y.redSqr();n(m<p);var g=this.pow(c,new o(1).iushln(p-m-1));l=l.redMul(g),c=g.redSqr(),d=d.redMul(c),p=m}return l},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var f=e.words[n],h=u-1;h>=0;h--){var c=f>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new O(t)},i(O,A),O.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},O.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},O.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},O.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},O.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},2745:(t,e,r)=>{var n;function i(t){this.rand=t}if(t.exports=function(t){return n||(n=new i(null)),n.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=r(8087);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},7022:(t,e,r)=>{const n=r(8166);t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},8616:(t,e,r)=>{"use strict";var n=r(9587),i=r(7834).Buffer;t.exports=function(t){function e(e){var r=e.slice(0,-4),n=e.slice(-4),i=t(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(e){var r=t(e);return n.encode(i.concat([e,r],e.length+4))},decode:function(t){var r=e(n.decode(t));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(t){var r=n.decodeUnsafe(t);if(r)return e(r)}}}},4075:(t,e,r)=>{"use strict";var n=r(6162),i=r(8616);t.exports=i((function(t){var e=n("sha256").update(t).digest();return n("sha256").update(e).digest()}))},9532:(t,e,r)=>{"use strict";var n=r(7834).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(255!==e[s])throw new TypeError(o+" is ambiguous");e[s]=i}var a=t.length,u=t.charAt(0),f=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function c(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return n.alloc(0);for(var r=0,i=0,o=0;t[r]===u;)i++,r++;for(var s=(t.length-r)*f+1>>>0,h=new Uint8Array(s);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var l=0,d=s-1;(0!==c||l<o)&&-1!==d;d--,l++)c+=a*h[d]>>>0,h[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");o=l,r++}for(var p=s-o;p!==s&&0===h[p];)p++;var y=n.allocUnsafe(i+(s-p));y.fill(0,0,i);for(var m=i;p!==s;)y[m++]=h[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,o=0,s=e.length;o!==s&&0===e[o];)o++,r++;for(var f=(s-o)*h+1>>>0,c=new Uint8Array(f);o!==s;){for(var l=e[o],d=0,p=f-1;(0!==l||d<i)&&-1!==p;p--,d++)l+=256*c[p]>>>0,c[p]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,o++}for(var y=f-i;y!==f&&0===c[y];)y++;for(var m=u.repeat(r);y<f;++y)m+=t.charAt(c[y]);return m},decodeUnsafe:c,decode:function(t){var e=c(t);if(e)return e;throw new Error("Non-base"+a+" character")}}}},9587:(t,e,r)=>{var n=r(9532);t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},8834:(t,e,r)=>{"use strict";const n=r(5766),i=r(2333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return f(t,e,r)}function f(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let n=a(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(X(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(X(t,SharedArrayBuffer)||t&&X(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const i=function(t){if(u.isBuffer(t)){const e=0|p(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?a(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return h(t),a(t<0?0:0|p(t))}function l(t){const e=t.length<0?0:0|p(t.length),r=a(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function p(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(t).length;default:if(i)return n?-1:W(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return k(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){let o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<a;o++)if(f(t,o)===f(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(f(t,o+n)!==f(e,n)){r=!1;break}if(r)return o}return-1}function w(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(J(n))return s;t[r+s]=n}return s}function _(t,e,r,n){return G(W(e,t.length-r),t,r,n)}function S(t,e,r,n){return G(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return G(V(e),t,r,n)}function M(t,e,r,n){return G(function(t,e){let r,n,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function k(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],a=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=O));return r}(n)}e.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return f(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),X(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.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}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=u.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(X(e,Uint8Array))i+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)g(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):m.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const a=Math.min(o,s),f=this.slice(n,i),h=t.slice(e,r);for(let t=0;t<a;++t)if(f[t]!==h[t]){o=f[t],s=h[t];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return S(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function I(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function T(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function x(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=Z[t[n]];return i}function P(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function B(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function U(t,e,r,n,i){q(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function R(t,e,r,n,i){q(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function L(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function j(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Y((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||$(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),u.prototype.readBigUInt64BE=Y((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||$(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Y((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||$(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),u.prototype.readBigInt64BE=Y((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||$(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=Y((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Y((function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=Y((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Y((function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=u.isBuffer(t)?t:u.from(t,n),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%s]}return this};const F={};function H(t,e,r){F[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function D(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function q(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new F.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||$(e,t.length-(r+1))}(n,i,o)}function z(t,e){if("number"!=typeof t)throw new F.ERR_INVALID_ARG_TYPE(e,"number",t)}function $(t,e,r){if(Math.floor(t)!==t)throw z(t,r),new F.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}H("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),H("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),H("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=D(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=D(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function W(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function V(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Y(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},8098:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32ToB58=e.b58ToC32=e.c32addressDecode=e.c32address=e.versions=void 0;var n=r(392),i=r(2716);e.versions={mainnet:{p2pkh:22,p2sh:20},testnet:{p2pkh:26,p2sh:21}};var o={};o[0]=e.versions.mainnet.p2pkh,o[5]=e.versions.mainnet.p2sh,o[111]=e.versions.testnet.p2pkh,o[196]=e.versions.testnet.p2sh;var s={};function a(t,e){if(!e.match(/^[0-9a-fA-F]{40}$/))throw new Error("Invalid argument: not a hash160 hex string");return"S"+n.c32checkEncode(t,e)}function u(t){if(t.length<=5)throw new Error("Invalid c32 address: invalid length");if("S"!=t[0])throw new Error('Invalid c32 address: must start with "S"');return n.c32checkDecode(t.slice(1))}s[e.versions.mainnet.p2pkh]=0,s[e.versions.mainnet.p2sh]=5,s[e.versions.testnet.p2pkh]=111,s[e.versions.testnet.p2sh]=196,e.c32address=a,e.c32addressDecode=u,e.b58ToC32=function(t,e){void 0===e&&(e=-1);var r,n=i.decode(t),s=n.data.toString("hex"),u=parseInt(n.prefix.toString("hex"),16);return e<0?(r=u,void 0!==o[u]&&(r=o[u])):r=e,a(r,s)},e.c32ToB58=function(t,e){void 0===e&&(e=-1);var r,n=u(t),o=n[0],a=n[1];e<0?(r=o,void 0!==s[o]&&(r=s[o])):r=e;var f=r.toString(16);return 1===f.length&&(f="0"+f),i.encode(a,f)}},2716:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=void 0;var n=r(8131),i=r(9926),o=r(9805),s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";e.encode=function(t,e,r){if(void 0===e&&(e="00"),void 0===r&&(r="hex"),"string"==typeof t&&(t=new n.Buffer(t,r)),!(t instanceof n.Buffer))throw new TypeError('"data" argument must be an Array of Buffers');e instanceof n.Buffer||(e=new n.Buffer(e,r));var a=n.Buffer.concat([e,t]);return a=i.hashSha256(a),a=i.hashSha256(a),a=n.Buffer.concat([e,t,a.slice(0,4)]),o(s).encode(a)},e.decode=function(t,e){var r=new n.Buffer(o(s).decode(t)),a=r.slice(0,1),u=r.slice(1,-4),f=n.Buffer.concat([a,u]);return f=i.hashSha256(f),f=i.hashSha256(f),r.slice(-4).forEach((function(t,e){if(t!==f[e])throw new Error("Invalid checksum")})),e&&(a=a.toString(e),u=u.toString(e)),{prefix:a,data:u}}},392:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32checkDecode=e.c32checkEncode=void 0;var n=r(8131),i=r(4103),o=r(9926);function s(t){return o.hashSha256(o.hashSha256(n.Buffer.from(t,"hex"))).slice(0,4).toString("hex")}e.c32checkEncode=function(t,e){if(t<0||t>=32)throw new Error("Invalid version (must be between 0 and 31)");if(!e.match(/^[0-9a-fA-F]*$/))throw new Error("Invalid data (not a hex string)");(e=e.toLowerCase()).length%2!=0&&(e="0"+e);var r=t.toString(16);1===r.length&&(r="0"+r);var n=s(""+r+e),o=i.c32encode(""+e+n);return""+i.c32[t]+o},e.c32checkDecode=function(t){t=i.c32normalize(t);var e=i.c32decode(t.slice(1)),r=t[0],n=i.c32.indexOf(r),o=e.slice(-8),a=n.toString(16);if(1===a.length&&(a="0"+a),s(""+a+e.substring(0,e.length-8))!==o)throw new Error("Invalid c32check string: checksum mismatch");return[n,e.substring(0,e.length-8)]}},4103:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32decode=e.c32normalize=e.c32encode=e.c32=void 0;var n=r(8131);e.c32="0123456789ABCDEFGHJKMNPQRSTVWXYZ";var i="0123456789abcdef";function o(t){return t.toUpperCase().replace(/O/g,"0").replace(/L|I/g,"1")}e.c32encode=function(t,r){if(!t.match(/^[0-9a-fA-F]*$/))throw new Error("Not a hex-encoded string");t.length%2!=0&&(t="0"+t);for(var o=[],s=0,a=(t=t.toLowerCase()).length-1;a>=0;a--)if(s<4){var u=i.indexOf(t[a])>>s,f=0;0!==a&&(f=i.indexOf(t[a-1]));var h=1+s,c=f%(1<<h)<<5-h,l=e.c32[u+c];s=h,o.unshift(l)}else s=0;var d=0;for(a=0;a<o.length&&"0"===o[a];a++)d++;o=o.slice(d);var p=n.Buffer.from(t,"hex").toString().match(/^\u0000*/),y=p?p[0].length:0;for(a=0;a<y;a++)o.unshift(e.c32[0]);if(r){var m=r-o.length;for(a=0;a<m;a++)o.unshift(e.c32[0])}return o.join("")},e.c32normalize=o,e.c32decode=function(t,r){if(!(t=o(t)).match("^["+e.c32+"]*$"))throw new Error("Not a c32-encoded string");for(var n=t.match("^"+e.c32[0]+"*"),s=n?n[0].length:0,a=[],u=0,f=0,h=t.length-1;h>=0;h--){4===f&&(a.unshift(i[u]),f=0,u=0);var c=(e.c32.indexOf(t[h])<<f)+u,l=i[c%16];if((u=c>>4)>1<<(f+=1))throw new Error("Panic error in decoding.");a.unshift(l)}a.unshift(i[u]),a.length%2==1&&a.unshift("0");var d=0;for(h=0;h<a.length&&"0"===a[h];h++)d++;var p=(a=a.slice(d-d%2)).join("");for(h=0;h<s;h++)p="00"+p;if(r){var y=2*r-p.length;for(h=0;h<y;h+=2)p="00"+p}return p}},2870:(t,e,r)=>{"use strict";e.H4=void 0;r(4103),r(392);var n=r(8098);Object.defineProperty(e,"H4",{enumerable:!0,get:function(){return n.c32address}})},9805:(t,e,r)=>{"use strict";var n=r(7834).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(255!==e[s])throw new TypeError(o+" is ambiguous");e[s]=i}var a=t.length,u=t.charAt(0),f=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function c(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return n.alloc(0);for(var r=0,i=0,o=0;t[r]===u;)i++,r++;for(var s=(t.length-r)*f+1>>>0,h=new Uint8Array(s);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var l=0,d=s-1;(0!==c||l<o)&&-1!==d;d--,l++)c+=a*h[d]>>>0,h[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");o=l,r++}for(var p=s-o;p!==s&&0===h[p];)p++;var y=n.allocUnsafe(i+(s-p));y.fill(0,0,i);for(var m=i;p!==s;)y[m++]=h[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,o=0,s=e.length;o!==s&&0===e[o];)o++,r++;for(var f=(s-o)*h+1>>>0,c=new Uint8Array(f);o!==s;){for(var l=e[o],d=0,p=f-1;(0!==l||d<i)&&-1!==p;p--,d++)l+=256*c[p]>>>0,c[p]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,o++}for(var y=f-i;y!==f&&0===c[y];)y++;for(var m=u.repeat(r);y<f;++y)m+=t.charAt(c[y]);return m},decodeUnsafe:c,decode:function(t){var e=c(t);if(e)return e;throw new Error("Non-base"+a+" character")}}}},8131:(t,e,r)=>{"use strict";var n=r(5766),i=r(2333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;var s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return f(t,e,r)}function f(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|y(t,e),n=a(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(D(t,Uint8Array)){var e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(D(t,ArrayBuffer)||t&&D(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(D(t,SharedArrayBuffer)||t&&D(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);var i=function(t){if(u.isBuffer(t)){var e=0|p(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||q(t.length)?a(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return h(t),a(t<0?0:0|p(t))}function l(t){for(var e=t.length<0?0:0|p(t.length),r=a(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function p(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||D(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(i)return n?-1:j(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return k(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;o<a;o++)if(f(t,o)===f(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var c=!0,l=0;l<u;l++)if(f(t,o+l)!==f(e,l)){c=!1;break}if(c)return o}return-1}function w(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(q(a))return s;t[r+s]=a}return s}function _(t,e,r,n){return H(j(e,t.length-r),t,r,n)}function S(t,e,r,n){return H(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return H(F(e),t,r,n)}function M(t,e,r,n){return H(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function k(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,f=t[i],h=null,c=f>239?4:f>223?3:f>191?2:1;if(i+c<=r)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&f)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=O));return r}(n)}e.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return f(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(D(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),D(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.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}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(D(o,Uint8Array))i+o.length>n.length?u.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):m.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(D(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),f=this.slice(n,i),h=t.slice(e,r),c=0;c<a;++c)if(f[c]!==h[c]){o=f[c],s=h[c];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return S(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function I(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function T(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function x(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=z[t[o]];return i}function P(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function B(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function U(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(t,e,r,n,o){return e=+e,r>>>=0,o||U(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,o){return e=+e,r>>>=0,o||U(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,r){return R(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=u.isBuffer(t)?t:u.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var C=/[^+/0-9A-Za-z-_]/g;function j(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function D(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function q(t){return t!=t}var z=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()},3973:(t,e,r)=>{var n=r(7834).Buffer,i=r(4851).Transform,o=r(214).s;function s(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(1285)(s,i),s.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},t.exports=s},6162:(t,e,r)=>{"use strict";var n=r(1285),i=r(7993),o=r(1445),s=r(9065),a=r(3973);function u(t){a.call(this,"digest"),this._hash=t}n(u,a),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},2511:(t,e,r)=>{var n=r(7993);t.exports=function(t){return(new n).update(t).digest()}},11:(t,e,r)=>{"use strict";var n=r(1285),i=r(6456),o=r(3973),s=r(7834).Buffer,a=r(2511),u=r(1445),f=r(9065),h=s.alloc(128);function c(t,e){o.call(this,"digest"),"string"==typeof e&&(e=s.from(e));var r="sha512"===t||"sha384"===t?128:64;this._alg=t,this._key=e,e.length>r?e=("rmd160"===t?new u:f(t)).update(e).digest():e.length<r&&(e=s.concat([e,h],r));for(var n=this._ipad=s.allocUnsafe(r),i=this._opad=s.allocUnsafe(r),a=0;a<r;a++)n[a]=54^e[a],i[a]=92^e[a];this._hash="rmd160"===t?new u:f(t),this._hash.update(n)}n(c,o),c.prototype._update=function(t){this._hash.update(t)},c.prototype._final=function(){var t=this._hash.digest();return("rmd160"===this._alg?new u:f(this._alg)).update(this._opad).update(t).digest()},t.exports=function(t,e){return"rmd160"===(t=t.toLowerCase())||"ripemd160"===t?new c("rmd160",e):"md5"===t?new i(a,e):new c(t,e)}},6456:(t,e,r)=>{"use strict";var n=r(1285),i=r(7834).Buffer,o=r(3973),s=i.alloc(128),a=64;function u(t,e){o.call(this,"digest"),"string"==typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>a?e=t(e):e.length<a&&(e=i.concat([e,s],a));for(var r=this._ipad=i.allocUnsafe(a),n=this._opad=i.allocUnsafe(a),u=0;u<a;u++)r[u]=54^e[u],n[u]=92^e[u];this._hash=[r]}n(u,o),u.prototype._update=function(t){this._hash.push(t)},u.prototype._final=function(){var t=this._alg(i.concat(this._hash));return this._alg(i.concat([this._opad,t]))},t.exports=u},3616:function(){!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function f(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=p(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=f(t),e=h(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[f(t)]},l.prototype.get=function(t){return t=f(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(f(t))},l.prototype.set=function(t,e){this.map[f(t)]=h(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){var r,n,i=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),b.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},g.call(v.prototype),g.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var S=[301,302,303,307,308];_.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(t,r){return new Promise((function(n,o){var s=new v(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;n(new _(i,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=l,t.Request=v,t.Response=_),e.Headers=l,e.Request=v,e.Response=_,e.fetch=E,Object.defineProperty(e,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:this)},6279:function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function f(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=p(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=f(t),e=h(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[f(t)]},l.prototype.get=function(t){return t=f(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(f(t))},l.prototype.set=function(t,e){this.map[f(t)]=h(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){var r,n,i=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),b.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},g.call(v.prototype),g.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var S=[301,302,303,307,308];_.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(t,r){return new Promise((function(n,o){var s=new v(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;n(new _(i,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=l,t.Request=v,t.Response=_),e.Headers=l,e.Request=v,e.Response=_,e.fetch=E,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},9926:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hashSha256=e.sha256=e.sha256nodeCrypto=e.sha256js=void 0;var n=r(3878),i=function(){function t(){this._blockSize=64,this._finalSize=56,this._len=0,this._w=new Array(64),this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this._block=n.Buffer.alloc(this._blockSize)}return t.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.Buffer.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,s=this._len,a=0;a<o;){for(var u=s%i,f=Math.min(o-a,i-u),h=0;h<f;h++)r[u+h]=t[a+h];a+=f,(s+=f)%i==0&&this._update(r)}return this._len+=o,this},t.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,o=(r-i)/4294967296;this._block.writeUInt32BE(o,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=n.Buffer.alloc(32);return s.writeInt32BE(this._a,0),s.writeInt32BE(this._b,4),s.writeInt32BE(this._c,8),s.writeInt32BE(this._d,12),s.writeInt32BE(this._e,16),s.writeInt32BE(this._f,20),s.writeInt32BE(this._g,24),s.writeInt32BE(this._h,28),t?s.toString(t):s},t.prototype.ch=function(t,e,r){return r^t&(e^r)},t.prototype.maj=function(t,e,r){return t&e|r&(t|e)},t.prototype.sigma0=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},t.prototype.sigma1=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},t.prototype.gamma0=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},t.prototype.gamma1=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10},t.prototype._update=function(e){for(var r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0|this._f,f=0|this._g,h=0|this._h,c=0;c<16;++c)r[c]=e.readInt32BE(4*c);for(;c<64;++c)r[c]=this.gamma1(r[c-2])+r[c-7]+this.gamma0(r[c-15])+r[c-16]|0;for(var l=0;l<64;++l){var d=h+this.sigma1(a)+this.ch(a,u,f)+t.K[l]+r[l]|0,p=this.sigma0(n)+this.maj(n,i,o)|0;h=f,f=u,u=a,a=s+d|0,s=o,o=i,i=n,n=d+p|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=u+this._f|0,this._g=f+this._g|0,this._h=h+this._h|0},t.K=[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],t}();e.sha256js=i;var o=function(){function t(){t.useCryptoModuleCache&&void 0!==t.nodeCryptoCreateHash||(t.nodeCryptoCreateHash=r(9096).createHash),this.hash=t.nodeCryptoCreateHash("sha256")}return t.prototype.update=function(t,e){return this.hash.update(t,e),this},t.prototype.digest=function(t){return t?this.hash.digest(t):this.hash.digest()},t.useCryptoModuleCache=!0,t}();e.sha256nodeCrypto=o;var s=void 0,a=function(){function t(){!function(){if(o.useCryptoModuleCache&&void 0!==s)return s;var t=!1;try{var e=r(9096);t=e&&"function"==typeof e.createHash}catch(t){}return s=t,t}()?this.instance=new i:this.instance=new o}return t.prototype.update=function(t,e){return this.instance.update(t,e),this},t.prototype.digest=function(t){return t?this.instance.digest(t):this.instance.digest()},t}();function u(t){return(new a).update(t).digest()}e.sha256=a,e.hashSha256=u,e.default=u},3878:(t,e,r)=>{"use strict";var n=r(5766),i=r(2333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;var s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return f(t,e,r)}function f(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|y(t,e),n=a(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(D(t,Uint8Array)){var e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(D(t,ArrayBuffer)||t&&D(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(D(t,SharedArrayBuffer)||t&&D(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);var i=function(t){if(u.isBuffer(t)){var e=0|p(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||q(t.length)?a(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return h(t),a(t<0?0:0|p(t))}function l(t){for(var e=t.length<0?0:0|p(t.length),r=a(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function p(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||D(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(i)return n?-1:j(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return k(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;o<a;o++)if(f(t,o)===f(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var c=!0,l=0;l<u;l++)if(f(t,o+l)!==f(e,l)){c=!1;break}if(c)return o}return-1}function w(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(q(a))return s;t[r+s]=a}return s}function _(t,e,r,n){return H(j(e,t.length-r),t,r,n)}function S(t,e,r,n){return H(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return H(F(e),t,r,n)}function M(t,e,r,n){return H(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function k(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,f=t[i],h=null,c=f>239?4:f>223?3:f>191?2:1;if(i+c<=r)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&f)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=O));return r}(n)}e.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return f(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(D(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),D(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.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}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(D(o,Uint8Array))i+o.length>n.length?u.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):m.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(D(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),f=this.slice(n,i),h=t.slice(e,r),c=0;c<a;++c)if(f[c]!==h[c]){o=f[c],s=h[c];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return S(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function I(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function T(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function x(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=z[t[o]];return i}function P(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function B(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function U(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(t,e,r,n,o){return e=+e,r>>>=0,o||U(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,o){return e=+e,r>>>=0,o||U(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,r){return R(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=u.isBuffer(t)?t:u.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var C=/[^+/0-9A-Za-z-_]/g;function j(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function D(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function q(t){return t!=t}var z=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()},6120:(t,e,r)=>{"use strict";var n=r(7834).Buffer,i=r(2221);function o(t){if(n.isBuffer(t))return t;if("string"==typeof t)return n.from(t,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function s(t,e,r){for(var n=0;e+n<r&&0===t[e+n];)++n;return t[e+n]>=128&&--n,n}t.exports={derToJose:function(t,e){t=o(t);var r=i(e),s=r+1,a=t.length,u=0;if(48!==t[u++])throw new Error('Could not find expected "seq"');var f=t[u++];if(129===f&&(f=t[u++]),a-u<f)throw new Error('"seq" specified length of "'+f+'", only "'+(a-u)+'" remaining');if(2!==t[u++])throw new Error('Could not find expected "int" for "r"');var h=t[u++];if(a-u-2<h)throw new Error('"r" specified length of "'+h+'", only "'+(a-u-2)+'" available');if(s<h)throw new Error('"r" specified length of "'+h+'", max of "'+s+'" is acceptable');var c=u;if(u+=h,2!==t[u++])throw new Error('Could not find expected "int" for "s"');var l=t[u++];if(a-u!==l)throw new Error('"s" specified length of "'+l+'", expected "'+(a-u)+'"');if(s<l)throw new Error('"s" specified length of "'+l+'", max of "'+s+'" is acceptable');var d=u;if((u+=l)!==a)throw new Error('Expected to consume entire buffer, but "'+(a-u)+'" bytes remain');var p=r-h,y=r-l,m=n.allocUnsafe(p+h+y+l);for(u=0;u<p;++u)m[u]=0;t.copy(m,u,c+Math.max(-p,0),c+h);for(var g=u=r;u<g+y;++u)m[u]=0;return t.copy(m,u,d+Math.max(-y,0),d+l),(m=m.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(t,e){t=o(t);var r=i(e),a=t.length;if(a!==2*r)throw new TypeError('"'+e+'" signatures must be "'+2*r+'" bytes, saw "'+a+'"');var u=s(t,0,r),f=s(t,r,t.length),h=r-u,c=r-f,l=2+h+1+1+c,d=l<128,p=n.allocUnsafe((d?2:3)+l),y=0;return p[y++]=48,d?p[y++]=l:(p[y++]=129,p[y++]=255&l),p[y++]=2,p[y++]=h,u<0?(p[y++]=0,y+=t.copy(p,y,0,r)):y+=t.copy(p,y,u,r),p[y++]=2,p[y++]=c,f<0?(p[y++]=0,t.copy(p,y,r)):t.copy(p,y,r+f),p}}},2221:t=>{"use strict";function e(t){return(t/8|0)+(t%8==0?0:1)}var r={ES256:e(256),ES384:e(384),ES512:e(521)};t.exports=function(t){var e=r[t];if(e)return e;throw new Error('Unknown algorithm "'+t+'"')}},7554:(t,e,r)=>{"use strict";var n=e;n.version=r(763).i8,n.utils=r(8288),n.rand=r(2745),n.curve=r(8610),n.curves=r(1479),n.ec=r(8596),n.eddsa=r(9208)},8919:(t,e,r)=>{"use strict";var n=r(2140),i=r(8288),o=i.getNAF,s=i.getJSF,a=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var s,u,f=[];for(s=0;s<n.length;s+=r.step){u=0;for(var h=s+r.step-1;h>=s;h--)u=(u<<1)+n[h];f.push(u)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s<f.length;s++)(u=f[s])===d?l=l.mixedAdd(r.points[s]):u===-d&&(l=l.mixedAdd(r.points[s].neg()));c=c.add(l)}return c.toP()},u.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=o(e,r,this._bitLength),u=this.jpoint(null,null,null),f=s.length-1;f>=0;f--){for(var h=0;f>=0&&0===s[f];f--)h++;if(f>=0&&h++,u=u.dblp(h),f<0)break;var c=s[f];a(0!==c),u="affine"===t.type?c>0?u.mixedAdd(i[c-1>>1]):u.mixedAdd(i[-c-1>>1].neg()):c>0?u.add(i[c-1>>1]):u.add(i[-c-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){var a,u,f,h=this._wnafT1,c=this._wnafT2,l=this._wnafT3,d=0;for(a=0;a<n;a++){var p=(f=e[a])._getNAFPoints(t);h[a]=p.wnd,c[a]=p.points}for(a=n-1;a>=1;a-=2){var y=a-1,m=a;if(1===h[y]&&1===h[m]){var g=[e[y],null,null,e[m]];0===e[y].y.cmp(e[m].y)?(g[1]=e[y].add(e[m]),g[2]=e[y].toJ().mixedAdd(e[m].neg())):0===e[y].y.cmp(e[m].y.redNeg())?(g[1]=e[y].toJ().mixedAdd(e[m]),g[2]=e[y].add(e[m].neg())):(g[1]=e[y].toJ().mixedAdd(e[m]),g[2]=e[y].toJ().mixedAdd(e[m].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[y],r[m]);for(d=Math.max(v[0].length,d),l[y]=new Array(d),l[m]=new Array(d),u=0;u<d;u++){var w=0|v[0][u],_=0|v[1][u];l[y][u]=b[3*(w+1)+(_+1)],l[m][u]=0,c[y]=g}}else l[y]=o(r[y],h[y],this._bitLength),l[m]=o(r[m],h[m],this._bitLength),d=Math.max(l[y].length,d),d=Math.max(l[m].length,d)}var S=this.jpoint(null,null,null),E=this._wnafT4;for(a=d;a>=0;a--){for(var M=0;a>=0;){var k=!0;for(u=0;u<n;u++)E[u]=0|l[u][a],0!==E[u]&&(k=!1);if(!k)break;M++,a--}if(a>=0&&M++,S=S.dblp(M),a<0)break;for(u=0;u<n;u++){var A=E[u];0!==A&&(A>0?f=c[u][A-1>>1]:A<0&&(f=c[u][-A-1>>1].neg()),S="affine"===f.type?S.mixedAdd(f):S.add(f))}}for(a=0;a<n;a++)c[a]=null;return i?S:S.toP()},u.BasePoint=f,f.prototype.eq=function(){throw new Error("Not implemented")},f.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(t,e){t=i.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?a(t[t.length-1]%2==0):7===t[0]&&a(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},f.prototype.encodeCompressed=function(t){return this.encode(t,!0)},f.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},f.prototype.encode=function(t,e){return i.encode(this._encode(e),t)},f.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},f.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},f.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},f.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},f.prototype._getBeta=function(){return null},f.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}},7105:(t,e,r)=>{"use strict";var n=r(8288),i=r(2140),o=r(1285),s=r(8919),a=n.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,s.call(this,"edwards",t),this.a=new i(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function f(t,e,r,n,o){s.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(e,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(u,s),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=n.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var u=a.fromRed().isOdd();return(e&&!u||!e&&u)&&(a=a.redNeg()),this.point(t,a)},u.prototype.pointFromY=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=n.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},o(f,s.BasePoint),u.prototype.pointFromJSON=function(t){return f.fromJSON(this,t)},u.prototype.point=function(t,e,r,n){return new f(this,t,e,r,n)},f.fromJSON=function(t,e){return new f(t,e[0],e[1],e[2])},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},f.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),s=o.redSub(r),a=n.redSub(e),u=i.redMul(s),f=o.redMul(a),h=i.redMul(a),c=s.redMul(o);return this.curve.point(u,f,c,h)},f.prototype._projDbl=function(){var t,e,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var f=(n=this.curve._mulA(a)).redAdd(u);this.zOne?(t=s.redSub(a).redSub(u).redMul(f.redSub(this.curve.two)),e=f.redMul(n.redSub(u)),r=f.redSqr().redSub(f).redSub(f)):(i=this.z.redSqr(),o=f.redSub(i).redISub(i),t=s.redSub(a).redISub(u).redMul(o),e=f.redMul(n.redSub(u)),r=f.redMul(o))}else n=a.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(s.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(a.redISub(u)),r=n.redMul(o);return this.curve.point(t,e,r)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),s=i.redSub(n),a=i.redAdd(n),u=r.redAdd(e),f=o.redMul(s),h=a.redMul(u),c=o.redMul(u),l=s.redMul(a);return this.curve.point(f,h,l,c)},f.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),u=i.redSub(a),f=i.redAdd(a),h=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),c=n.redMul(u).redMul(h);return this.curve.twisted?(e=n.redMul(f).redMul(s.redSub(this.curve._mulA(o))),r=u.redMul(f)):(e=n.redMul(f).redMul(s.redSub(o)),r=this.curve._mulC(u).redMul(f)),this.curve.point(c,e,r)},f.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},f.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},f.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},f.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function(){return this.normalize(),this.y.fromRed()},f.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},f.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},8610:(t,e,r)=>{"use strict";var n=e;n.base=r(8919),n.short=r(7715),n.mont=r(5125),n.edwards=r(7105)},5125:(t,e,r)=>{"use strict";var n=r(2140),i=r(1285),o=r(8919),s=r(8288);function a(t){o.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},i(u,o.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},a.prototype.point=function(t,e){return new u(this,t,e)},a.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),s=i.redMul(n),a=e.z.redMul(o.redAdd(s).redSqr()),u=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},7715:(t,e,r)=>{"use strict";var n=r(8288),i=r(2140),o=r(1285),s=r(8919),a=n.assert;function u(t){s.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function f(t,e,r,n){s.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(t,e,r,n){s.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,s),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,o,s,a,u,f,h,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=t,d=this.n.clone(),p=new i(1),y=new i(0),m=new i(0),g=new i(1),b=0;0!==l.cmpn(0);){var v=d.div(l);f=d.sub(v.mul(l)),h=m.sub(v.mul(p));var w=g.sub(v.mul(y));if(!n&&f.cmp(c)<0)e=u.neg(),r=p,n=f.neg(),o=h;else if(n&&2==++b)break;u=f,d=l,l=f,m=p,p=h,g=y,y=w}s=f.neg(),a=h;var _=n.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(_)>=0&&(s=e,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),f=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(f).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],u=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),u=u.neg(!0)),n[2*o]=a,n[2*o+1]=u,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var f=this._wnafMulAdd(1,n,i,2*o,r),h=0;h<2*o;h++)n[h]=null,i[h]=null;return f},o(f,s.BasePoint),u.prototype.point=function(t,e,r){return new f(this,t,e,r)},u.prototype.pointFromJSON=function(t,e){return f.fromJSON(this,t,e)},f.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},f.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},f.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}var o=e[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return this.inf},f.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},f.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},f.prototype.getX=function(){return this.x.fromRed()},f.prototype.getY=function(){return this.y.fromRed()},f.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},f.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},f.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},f.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(h,s.BasePoint),u.prototype.jpoint=function(t,e,r){return new h(this,t,e,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),h=f.redMul(a),c=n.redMul(f),l=u.redSqr().redIAdd(h).redISub(c).redISub(c),d=u.redMul(c.redISub(l)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(l,d,p)},h.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),f=u.redMul(s),h=r.redMul(u),c=a.redSqr().redIAdd(f).redISub(h).redISub(h),l=a.redMul(h.redISub(c)).redISub(i.redMul(f)),d=this.z.redMul(s);return this.curve.jpoint(c,l,d)},h.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,u=a.redSqr().redSqr(),f=s.redAdd(s);for(e=0;e<t;e++){var h=o.redSqr(),c=f.redSqr(),l=c.redSqr(),d=h.redAdd(h).redIAdd(h).redIAdd(n.redMul(u)),p=o.redMul(c),y=d.redSqr().redISub(p.redAdd(p)),m=p.redISub(y),g=d.redMul(m);g=g.redIAdd(g).redISub(l);var b=f.redMul(a);e+1<t&&(u=u.redMul(l)),o=y,a=b,f=g}return this.curve.jpoint(o,f.redMul(i),a)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),u=a.redSqr().redISub(s).redISub(s),f=o.redIAdd(o);f=(f=f.redIAdd(f)).redIAdd(f),t=u,e=a.redMul(s.redISub(u)).redISub(f),r=this.y.redAdd(this.y)}else{var h=this.x.redSqr(),c=this.y.redSqr(),l=c.redSqr(),d=this.x.redAdd(c).redSqr().redISub(h).redISub(l);d=d.redIAdd(d);var p=h.redAdd(h).redIAdd(h),y=p.redSqr(),m=l.redIAdd(l);m=(m=m.redIAdd(m)).redIAdd(m),t=y.redISub(d).redISub(d),e=p.redMul(d.redISub(t)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},h.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=a.redSqr().redISub(s).redISub(s);t=u;var f=o.redIAdd(o);f=(f=f.redIAdd(f)).redIAdd(f),e=a.redMul(s.redISub(u)).redISub(f),r=this.y.redAdd(this.y)}else{var h=this.z.redSqr(),c=this.y.redSqr(),l=this.x.redMul(c),d=this.x.redSub(h).redMul(this.x.redAdd(h));d=d.redAdd(d).redIAdd(d);var p=l.redIAdd(l),y=(p=p.redIAdd(p)).redAdd(p);t=d.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(c).redISub(h);var m=c.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),e=d.redMul(p.redISub(t)).redISub(m)}return this.curve.jpoint(t,e,r)},h.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),f=(u=u.redIAdd(u)).redMul(s),h=a.redSqr().redISub(f.redAdd(f)),c=f.redISub(h),l=s.redSqr();l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=a.redMul(c).redISub(l),p=r.redAdd(r).redMul(n);return this.curve.jpoint(h,d,p)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var f=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(u),h=e.redMul(f);h=(h=h.redIAdd(h)).redIAdd(h);var c=this.x.redMul(a).redISub(h);c=(c=c.redIAdd(c)).redIAdd(c);var l=this.y.redMul(f.redMul(u.redISub(f)).redISub(s.redMul(a)));l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(c,l,d)},h.prototype.mul=function(t,e){return t=new i(t,e),this.curve._wnafMul(this,t)},h.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},h.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},1479:(t,e,r)=>{"use strict";var n,i=e,o=r(4485),s=r(8610),a=r(8288).assert;function u(t){"short"===t.type?this.curve=new s.short(t):"edwards"===t.type?this.curve=new s.edwards(t):this.curve=new s.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function f(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=u,f("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),f("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),f("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(7983)}catch(t){n=void 0}f("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},8596:(t,e,r)=>{"use strict";var n=r(2140),i=r(8873),o=r(8288),s=r(1479),a=r(2745),u=o.assert,f=r(2307),h=r(1798);function c(t){if(!(this instanceof c))return new c(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(s,t),"Unknown curve "+t),t=s[t]),t instanceof s.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=c,c.prototype.keyPair=function(t){return new f(this,t)},c.prototype.keyFromPrivate=function(t,e){return f.fromPrivate(this,t,e)},c.prototype.keyFromPublic=function(t,e){return f.fromPublic(this,t,e)},c.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var s=new n(e.generate(r));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},c.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function(t,e,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray("be",s),u=t.toArray("be",s),f=new i({hash:this.hash,entropy:a,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),c=this.n.sub(new n(1)),l=0;;l++){var d=o.k?o.k(l):new n(f.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(c)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var y=p.getX(),m=y.umod(this.n);if(0!==m.cmpn(0)){var g=d.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(g=g.umod(this.n)).cmpn(0)){var b=(p.getY().isOdd()?1:0)|(0!==y.cmp(m)?2:0);return o.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),b^=1),new h({r:m,s:g,recoveryParam:b})}}}}}},c.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var o=(e=new h(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),f=u.mul(t).umod(this.n),c=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(f,r.getPublic(),c)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(f,r.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},c.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new h(e,i);var o=this.n,s=new n(t),a=e.r,f=e.s,c=1&r,l=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");a=l?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var d=e.r.invm(o),p=o.sub(s).mul(d).umod(o),y=f.mul(d).umod(o);return this.g.mulAdd(p,a,y)},c.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new h(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},2307:(t,e,r)=>{"use strict";var n=r(2140),i=r(8288).assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=o,o.fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},1798:(t,e,r)=>{"use strict";var n=r(2140),i=r(8288),o=i.assert;function s(t,e){if(t instanceof s)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o<n;o++,s++)i<<=8,i|=t[s],i>>>=0;return!(i<=127)&&(e.place=s,i)}function f(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function h(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=s,s.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var s=u(t,r);if(!1===s)return!1;var f=t.slice(r.place,s+r.place);if(r.place+=s,2!==t[r.place++])return!1;var h=u(t,r);if(!1===h)return!1;if(t.length!==h+r.place)return!1;var c=t.slice(r.place,h+r.place);if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}return this.r=new n(f),this.s=new n(c),this.recoveryParam=null,!0},s.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=f(e),r=f(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];h(n,e.length),(n=n.concat(e)).push(2),h(n,r.length);var o=n.concat(r),s=[48];return h(s,o.length),s=s.concat(o),i.encode(s,t)}},9208:(t,e,r)=>{"use strict";var n=r(4485),i=r(1479),o=r(8288),s=o.assert,a=o.parseBytes,u=r(851),f=r(6117);function h(t){if(s("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof h))return new h(t);t=i[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=n.sha512}t.exports=h,h.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),u=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},h.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},h.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return o.intFromLE(t.digest()).umod(this.curve.n)},h.prototype.keyFromPublic=function(t){return u.fromPublic(this,t)},h.prototype.keyFromSecret=function(t){return u.fromSecret(this,t)},h.prototype.makeSignature=function(t){return t instanceof f?t:new f(this,t)},h.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},h.prototype.decodePoint=function(t){var e=(t=o.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),n=0!=(128&t[e]),i=o.intFromLE(r);return this.curve.pointFromY(i,n)},h.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},h.prototype.decodeInt=function(t){return o.intFromLE(t)},h.prototype.isPoint=function(t){return t instanceof this.pointClass}},851:(t,e,r)=>{"use strict";var n=r(8288),i=n.assert,o=n.parseBytes,s=n.cachedProperty;function a(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}a.fromPublic=function(t,e){return e instanceof a?e:new a(t,{pub:e})},a.fromSecret=function(t,e){return e instanceof a?e:new a(t,{secret:e})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},a.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},a.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),t)},a.prototype.getPublic=function(t){return n.encode(this.pubBytes(),t)},t.exports=a},6117:(t,e,r)=>{"use strict";var n=r(2140),i=r(8288),o=i.assert,s=i.cachedProperty,a=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=a(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof n&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}s(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},7983:t=>{t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},8288:(t,e,r)=>{"use strict";var n=e,i=r(2140),o=r(9561),s=r(3022);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),s=0;s<n.length;s++){var a,u=o.andln(i-1);o.isOdd()?(a=u>(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,f=e.andln(3)+o&3;3===u&&(u=-1),3===f&&(f=-1),s=0==(1&u)?0:3!=(n=t.andln(7)+i&7)&&5!==n||2!==f?u:-u,r[0].push(s),a=0==(1&f)?0:3!=(n=e.andln(7)+o&7)&&5!==n||2!==u?f:-f,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},2140:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(488).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=f(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=f(t,h,t.length,e),h=0;h<s;h++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var f=1;f<n;f++){for(var h=u>>>26,c=67108863&u,l=Math.min(f,e.length-1),d=Math.max(0,f-t.length+1);d<=l;d++){var p=f-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[f]=0|c,u=0|h}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var f=c[t],d=l[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?y+r:h[f-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,f=new t(o),h=this.clone();if(u){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),f[a]=s;for(;a<o;a++)f[a]=0}else{for(a=0;a<o-i;a++)f[a]=0;for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),f[o-a-1]=s}return f},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,f=0,h=0|s[0],c=8191&h,l=h>>>13,d=0|s[1],p=8191&d,y=d>>>13,m=0|s[2],g=8191&m,b=m>>>13,v=0|s[3],w=8191&v,_=v>>>13,S=0|s[4],E=8191&S,M=S>>>13,k=0|s[5],A=8191&k,O=k>>>13,I=0|s[6],T=8191&I,x=I>>>13,P=0|s[7],B=8191&P,N=P>>>13,U=0|s[8],R=8191&U,L=U>>>13,C=0|s[9],j=8191&C,F=C>>>13,H=0|a[0],D=8191&H,q=H>>>13,z=0|a[1],$=8191&z,K=z>>>13,W=0|a[2],V=8191&W,G=W>>>13,X=0|a[3],J=8191&X,Z=X>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ht=0|a[8],ct=8191&ht,lt=ht>>>13,dt=0|a[9],pt=8191&dt,yt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(f+(n=Math.imul(c,D))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(l,D)|0))<<13)|0;f=((o=Math.imul(l,q))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,D),i=(i=Math.imul(p,q))+Math.imul(y,D)|0,o=Math.imul(y,q);var gt=(f+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,K)|0)+Math.imul(l,$)|0))<<13)|0;f=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,D),i=(i=Math.imul(g,q))+Math.imul(b,D)|0,o=Math.imul(b,q),n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,K)|0;var bt=(f+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(l,V)|0))<<13)|0;f=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,D),i=(i=Math.imul(w,q))+Math.imul(_,D)|0,o=Math.imul(_,q),n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,K)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,K)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,G)|0;var vt=(f+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(l,J)|0))<<13)|0;f=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(E,D),i=(i=Math.imul(E,q))+Math.imul(M,D)|0,o=Math.imul(M,q),n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Z)|0;var wt=(f+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;f=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,D),i=(i=Math.imul(A,q))+Math.imul(O,D)|0,o=Math.imul(O,q),n=n+Math.imul(E,$)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,K)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(g,J)|0,i=(i=i+Math.imul(g,Z)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0;var _t=(f+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(l,rt)|0))<<13)|0;f=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,D),i=(i=Math.imul(T,q))+Math.imul(x,D)|0,o=Math.imul(x,q),n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,K)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0;var St=(f+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(l,ot)|0))<<13)|0;f=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(B,D),i=(i=Math.imul(B,q))+Math.imul(N,D)|0,o=Math.imul(N,q),n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,K)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(E,J)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Z)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0;var Et=(f+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(l,ut)|0))<<13)|0;f=((o=o+Math.imul(l,ft)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,D),i=(i=Math.imul(R,q))+Math.imul(L,D)|0,o=Math.imul(L,q),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,K)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ft)|0;var Mt=(f+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;f=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(j,D),i=(i=Math.imul(j,q))+Math.imul(F,D)|0,o=Math.imul(F,q),n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,K)|0,n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ft)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ft)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var kt=(f+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,yt)|0)+Math.imul(l,pt)|0))<<13)|0;f=((o=o+Math.imul(l,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,K))+Math.imul(F,$)|0,o=Math.imul(F,K),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Z)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Z)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ft)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,lt)|0)+Math.imul(b,ct)|0,o=o+Math.imul(b,lt)|0;var At=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;f=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,G))+Math.imul(F,V)|0,o=Math.imul(F,G),n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ft)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ft)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var Ot=(f+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((o=o+Math.imul(b,yt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(j,J),i=(i=Math.imul(j,Z))+Math.imul(F,J)|0,o=Math.imul(F,Z),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ft)|0,n=n+Math.imul(E,ct)|0,i=(i=i+Math.imul(E,lt)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,lt)|0;var It=(f+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,yt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((o=o+Math.imul(_,yt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ft)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ft)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(O,ct)|0,o=o+Math.imul(O,lt)|0;var Tt=(f+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,yt)|0)+Math.imul(M,pt)|0))<<13)|0;f=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ft)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ft)|0,n=n+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(f+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,yt)|0)+Math.imul(O,pt)|0))<<13)|0;f=((o=o+Math.imul(O,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,ot),i=(i=Math.imul(j,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ft)|0,n=n+Math.imul(B,ct)|0,i=(i=i+Math.imul(B,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(f+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,yt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((o=o+Math.imul(x,yt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(j,ut),i=(i=Math.imul(j,ft))+Math.imul(F,ut)|0,o=Math.imul(F,ft),n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(L,ct)|0,o=o+Math.imul(L,lt)|0;var Bt=(f+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,yt)|0)+Math.imul(N,pt)|0))<<13)|0;f=((o=o+Math.imul(N,yt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,ct),i=(i=Math.imul(j,lt))+Math.imul(F,ct)|0,o=Math.imul(F,lt);var Nt=(f+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,yt)|0)+Math.imul(L,pt)|0))<<13)|0;f=((o=o+Math.imul(L,yt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Ut=(f+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,yt))+Math.imul(F,pt)|0))<<13)|0;return f=((o=Math.imul(F,yt))+(i>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,u[0]=mt,u[1]=gt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=St,u[7]=Et,u[8]=Mt,u[9]=kt,u[10]=At,u[11]=Ot,u[12]=It,u[13]=Tt,u[14]=xt,u[15]=Pt,u[16]=Bt,u[17]=Nt,u[18]=Ut,0!==f&&(u[19]=f,r.length++),r};function y(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),f=Math.max(0,o-t.length+1);f<=u;f++){var h=o-f,c=(0|t.words[h])*(0|e.words[f]),l=67108863&c;a=67108863&(l=l+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):y(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),f=Math.sin(2*Math.PI/a),h=0;h<i;h+=a)for(var c=u,l=f,d=0;d<s;d++){var p=r[h+d],y=n[h+d],m=r[h+d+s],g=n[h+d+s],b=c*m-l*g;g=c*g+l*m,m=b,r[h+d]=p+m,n[h+d]=y+g,r[h+d+s]=p-m,n[h+d+s]=y-g,d!==a&&(b=u*c-f*l,l=u*l+f*c,c=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),f=new Array(n),h=new Array(n),c=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,f,n),this.transform(s,o,a,u,n,i),this.transform(f,o,h,c,n,i);for(var d=0;d<n;d++){var p=a[d]*h[d]-u[d]*c[d];u[d]=a[d]*c[d]+u[d]*h[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),y(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var f=0;f<s;f++)u.words[f]=this.words[f];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,f=0;f<this.length;f++)this.words[f]=this.words[f+s];else this.words[0]=0,this.length=1;var h=0;for(f=this.length-1;f>=0&&(0!==h||f>=i);f--){var c=0|this.words[f];this.words[f]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var f=0;f<a.length;f++)a.words[f]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var c=u-1;c>=0;c--){var l=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),f=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++f;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(f)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new E(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(v,b),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,b),i(_,b),i(S,b),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return g[t]=e,e},E.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,f).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var y=d,m=0;0!==y.cmp(a);m++)y=y.redSqr();n(m<p);var g=this.pow(c,new o(1).iushln(p-m-1));l=l.redMul(g),c=g.redSqr(),d=d.redMul(c),p=m}return l},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var f=e.words[n],h=u-1;h>=0;h--){var c=f>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},2699:t=>{"use strict";var e,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}y(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&y(t,"error",e,{once:!0})}(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function f(t,e,r,n){var i,o,s,f;if(a(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=u(t))>0&&s.length>i&&!s.warned){s.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=s.length,f=h,console&&console.warn&&console.warn(f)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=h.bind(n);return i.listener=r,n.wrapFn=i,i}function l(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):p(i,i.length)}function d(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function y(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){n.once&&t.removeEventListener(e,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");s=t}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var i="error"===t,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)n(u,this,e);else{var f=u.length,h=p(u,f);for(r=0;r<f;++r)n(h[r],this,e)}return!0},o.prototype.addListener=function(t,e){return f(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return f(this,t,e,!0)},o.prototype.once=function(t,e){return a(e),this.on(t,c(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,c(this,t,e)),this},o.prototype.removeListener=function(t,e){var r,n,i,o,s;if(a(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},o.prototype.listeners=function(t){return l(this,t,!0)},o.prototype.rawListeners=function(t){return l(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},5232:(t,e,r)=>{"use strict";var n=r(7834).Buffer,i=r(7525).Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(1285)(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!n.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer")}(t),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=t[i++];this._update(),this._blockOffset=0}for(;i<t.length;)r[this._blockOffset++]=t[i++];for(var s=0,a=8*t.length;a>0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},4485:(t,e,r)=>{var n=e;n.utils=r(212),n.common=r(4495),n.sha=r(5530),n.ripemd=r(1396),n.hmac=r(5047),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},4495:(t,e,r)=>{"use strict";var n=r(212),i=r(9561);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=o,o.prototype.update=function(t,e){if(t=n.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n}},5047:(t,e,r)=>{"use strict";var n=r(212),i=r(9561);function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,e){return this.inner.update(t,e),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},1396:(t,e,r)=>{"use strict";var n=r(212),i=r(4495),o=n.rotl32,s=n.sum32,a=n.sum32_3,u=n.sum32_4,f=i.BlockHash;function h(){if(!(this instanceof h))return new h;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function c(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function l(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function d(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}n.inherits(h,f),e.ripemd160=h,h.blockSize=512,h.outSize=160,h.hmacStrength=192,h.padLength=64,h.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],f=this.h[3],h=this.h[4],b=r,v=n,w=i,_=f,S=h,E=0;E<80;E++){var M=s(o(u(r,c(E,n,i,f),t[p[E]+e],l(E)),m[E]),h);r=h,h=f,f=o(i,10),i=n,n=M,M=s(o(u(b,c(79-E,v,w,_),t[y[E]+e],d(E)),g[E]),S),b=S,S=_,_=o(w,10),w=v,v=M}M=a(this.h[1],i,_),this.h[1]=a(this.h[2],f,S),this.h[2]=a(this.h[3],h,b),this.h[3]=a(this.h[4],r,v),this.h[4]=a(this.h[0],n,w),this.h[0]=M},h.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],y=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],g=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},5530:(t,e,r)=>{"use strict";e.sha1=r(5079),e.sha224=r(3823),e.sha256=r(8032),e.sha384=r(5328),e.sha512=r(168)},5079:(t,e,r)=>{"use strict";var n=r(212),i=r(4495),o=r(713),s=n.rotl32,a=n.sum32,u=n.sum32_5,f=o.ft_1,h=i.BlockHash,c=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(l,h),t.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=s(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],h=this.h[2],l=this.h[3],d=this.h[4];for(n=0;n<r.length;n++){var p=~~(n/20),y=u(s(i,5),f(p,o,h,l),d,r[n],c[p]);d=l,l=h,h=s(o,30),o=i,i=y}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],h),this.h[3]=a(this.h[3],l),this.h[4]=a(this.h[4],d)},l.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},3823:(t,e,r)=>{"use strict";var n=r(212),i=r(8032);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},8032:(t,e,r)=>{"use strict";var n=r(212),i=r(4495),o=r(713),s=r(9561),a=n.sum32,u=n.sum32_4,f=n.sum32_5,h=o.ch32,c=o.maj32,l=o.s0_256,d=o.s1_256,p=o.g0_256,y=o.g1_256,m=i.BlockHash,g=[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];function b(){if(!(this instanceof b))return new b;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}n.inherits(b,m),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=u(y(r[n-2]),r[n-7],p(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],m=this.h[2],g=this.h[3],b=this.h[4],v=this.h[5],w=this.h[6],_=this.h[7];for(s(this.k.length===r.length),n=0;n<r.length;n++){var S=f(_,d(b),h(b,v,w),this.k[n],r[n]),E=a(l(i),c(i,o,m));_=w,w=v,v=b,b=a(g,S),g=m,m=o,o=i,i=a(S,E)}this.h[0]=a(this.h[0],i),this.h[1]=a(this.h[1],o),this.h[2]=a(this.h[2],m),this.h[3]=a(this.h[3],g),this.h[4]=a(this.h[4],b),this.h[5]=a(this.h[5],v),this.h[6]=a(this.h[6],w),this.h[7]=a(this.h[7],_)},b.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},5328:(t,e,r)=>{"use strict";var n=r(212),i=r(168);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},168:(t,e,r)=>{"use strict";var n=r(212),i=r(4495),o=r(9561),s=n.rotr64_hi,a=n.rotr64_lo,u=n.shr64_hi,f=n.shr64_lo,h=n.sum64,c=n.sum64_hi,l=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,y=n.sum64_5_hi,m=n.sum64_5_lo,g=i.BlockHash,b=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function w(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function _(t,e,r,n,i,o){var s=e&n^~e&o;return s<0&&(s+=4294967296),s}function S(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function E(t,e,r,n,i,o){var s=e&n^e&o^n&o;return s<0&&(s+=4294967296),s}function M(t,e){var r=s(t,e,28)^s(e,t,2)^s(e,t,7);return r<0&&(r+=4294967296),r}function k(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function A(t,e){var r=a(t,e,14)^a(t,e,18)^a(e,t,9);return r<0&&(r+=4294967296),r}function O(t,e){var r=s(t,e,1)^s(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function I(t,e){var r=a(t,e,1)^a(t,e,8)^f(t,e,7);return r<0&&(r+=4294967296),r}function T(t,e){var r=a(t,e,19)^a(e,t,29)^f(t,e,6);return r<0&&(r+=4294967296),r}n.inherits(v,g),t.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=(m=r[n-4],g=r[n-3],b=void 0,(b=s(m,g,19)^s(g,m,29)^u(m,g,6))<0&&(b+=4294967296),b),o=T(r[n-4],r[n-3]),a=r[n-14],f=r[n-13],h=O(r[n-30],r[n-29]),c=I(r[n-30],r[n-29]),l=r[n-32],y=r[n-31];r[n]=d(i,o,a,f,h,c,l,y),r[n+1]=p(i,o,a,f,h,c,l,y)}var m,g,b},v.prototype._update=function(t,e){this._prepareBlock(t,e);var r,n,i,a=this.W,u=this.h[0],f=this.h[1],d=this.h[2],p=this.h[3],g=this.h[4],b=this.h[5],v=this.h[6],O=this.h[7],I=this.h[8],T=this.h[9],x=this.h[10],P=this.h[11],B=this.h[12],N=this.h[13],U=this.h[14],R=this.h[15];o(this.k.length===a.length);for(var L=0;L<a.length;L+=2){var C=U,j=R,F=(i=void 0,(i=s(r=I,n=T,14)^s(r,n,18)^s(n,r,9))<0&&(i+=4294967296),i),H=A(I,T),D=w(I,0,x,0,B),q=_(0,T,0,P,0,N),z=this.k[L],$=this.k[L+1],K=a[L],W=a[L+1],V=y(C,j,F,H,D,q,z,$,K,W),G=m(C,j,F,H,D,q,z,$,K,W);C=M(u,f),j=k(u,f),F=S(u,0,d,0,g),H=E(0,f,0,p,0,b);var X=c(C,j,F,H),J=l(C,j,F,H);U=B,R=N,B=x,N=P,x=I,P=T,I=c(v,O,V,G),T=l(O,O,V,G),v=g,O=b,g=d,b=p,d=u,p=f,u=c(V,G,X,J),f=l(V,G,X,J)}h(this.h,0,u,f),h(this.h,2,d,p),h(this.h,4,g,b),h(this.h,6,v,O),h(this.h,8,I,T),h(this.h,10,x,P),h(this.h,12,B,N),h(this.h,14,U,R)},v.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},713:(t,e,r)=>{"use strict";var n=r(212).rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function s(t,e,r){return t^e^r}e.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?s(e,r,n):2===t?o(e,r,n):void 0},e.ch32=i,e.maj32=o,e.p32=s,e.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},e.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},e.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},e.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},212:(t,e,r)=>{"use strict";var n=r(9561),i=r(1285);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var s=t.charCodeAt(i);s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=63&s|128):o(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i<t.length;i++)r[i]=0|t[i];return r},e.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=a(t[r].toString(16));return e},e.htonl=s,e.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];"little"===e&&(i=s(i)),r+=u(i.toString(16))}return r},e.zero2=a,e.zero8=u,e.join32=function(t,e,r,i){var o=r-e;n(o%4==0);for(var s=new Array(o/4),a=0,u=e;a<s.length;a++,u+=4){var f;f="big"===i?t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],s[a]=f>>>0}return s},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|t>>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o<n?1:0)+r+i;t[e]=s>>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,s,a){var u=0,f=e;return u+=(f=f+n>>>0)<e?1:0,u+=(f=f+o>>>0)<o?1:0,t+r+i+s+(u+=(f=f+a>>>0)<a?1:0)>>>0},e.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,s,a,u,f){var h=0,c=e;return h+=(c=c+n>>>0)<e?1:0,h+=(c=c+o>>>0)<o?1:0,h+=(c=c+a>>>0)<a?1:0,t+r+i+s+u+(h+=(c=c+f>>>0)<f?1:0)>>>0},e.sum64_5_lo=function(t,e,r,n,i,o,s,a,u,f){return e+n+o+a+f>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},8873:(t,e,r)=>{"use strict";var n=r(4485),i=r(3022),o=r(9561);function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex"),n=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}t.exports=s,s.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},s.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},s.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},s.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=i.toArray(t,e),r=i.toArray(r,n),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},s.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<t;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var s=o.slice(0,t);return this._update(r),this._reseed++,i.encode(s,e)}},2333:(t,e)=>{e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,f=u>>1,h=-7,c=r?i-1:0,l=r?-1:1,d=t[e+c];for(c+=l,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+t[e+c],c+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+c],c+=l,h-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=f}return(d?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,f=8*o-i-1,h=(1<<f)-1,c=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(e*u-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,f+=i;f>0;t[r+d]=255&s,d+=p,s/=256,f-=8);t[r+d-p]|=128*y}},1285:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},9996:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(7650);e.SECP256K1Client=n.SECP256K1Client;const i={ES256K:n.SECP256K1Client};e.cryptoClients=i},7650:(t,e,r)=>{"use strict";var n=r(8834).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(7554),o=r(6120),s=r(8643);class a{constructor(){}static loadPrivateKey(t){return 66===t.length&&(t=t.slice(0,64)),a.ec.keyFromPrivate(t)}static loadPublicKey(t){return a.ec.keyFromPublic(t,"hex")}static derivePublicKey(t,e=!0){if("string"!=typeof t)throw Error("private key must be a string");if(!/^[0-9A-F]+$/i.test(t))throw Error("private key must be a hex string");if(66==t.length)t=t.slice(0,64);else if(!(t.length<=64))throw Error("private key must be 66 characters or less");return a.ec.keyFromPrivate(t).getPublic(e,"hex")}static signHash(t,e,r="jose"){if(!t||!e)throw new s.MissingParametersError("a signing input hash and private key are all required");const i=a.loadPrivateKey(e).sign(t),u=n.from(i.toDER());if("der"===r)return u.toString("hex");if("jose"===r)return o.derToJose(u,"ES256");throw Error("Invalid signature format")}static loadSignature(t){return o.joseToDer(t,"ES256")}static verifyHash(t,e,r){if(!(t&&e&&r))throw new s.MissingParametersError("a signing input hash, der signature, and public key are all required");return a.loadPublicKey(r).verify(t,e)}}e.SECP256K1Client=a,a.ec=new i.ec("secp256k1"),a.algorithmName="ES256K"},874:function(t,e,r){"use strict";var n=r(8834).Buffer,i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const o=r(9065);function s(t){return(new o.sha256).update(t).digest()}e.hashSha256=s,e.hashSha256Async=function(t){return i(this,void 0,void 0,(function*(){try{if("undefined"!=typeof crypto&&void 0!==crypto.subtle){const e="string"==typeof t?n.from(t):t,r=yield crypto.subtle.digest("SHA-256",e);return n.from(r)}{const e=r(1812);if(!e.createHash)throw new Error("`crypto` module does not contain `createHash`");return Promise.resolve(e.createHash("sha256").update(t).digest())}}catch(e){return console.log(e),console.log('Crypto lib not found. Neither the global `crypto.subtle` Web Crypto API, nor the or the Node.js `require("crypto").createHash` module is available. Falling back to JS implementation.'),Promise.resolve(s(t))}}))}},8917:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(9487);e.decodeToken=function(t){if("string"==typeof t){const e=t.split(".");return{header:JSON.parse(n.default.decode(e[0])),payload:JSON.parse(n.default.decode(e[1])),signature:e[2]}}if("object"==typeof t){if("string"!=typeof t.payload)throw new Error("Expected token payload to be a base64 or json string");let e=t.payload;"{"!==t.payload[0]&&(e=n.default.decode(e));const r=[];return t.header.map((t=>{const e=JSON.parse(n.default.decode(t));r.push(e)})),{header:r,payload:JSON.parse(e),signature:t.signature}}}},8643:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});class r extends Error{constructor(t){super(),this.name="MissingParametersError",this.message=t||""}}e.MissingParametersError=r;class n extends Error{constructor(t){super(),this.name="InvalidTokenError",this.message=t||""}}e.InvalidTokenError=n},7474:(t,e,r)=>{"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(5650)),n(r(7458)),n(r(8917)),n(r(8643)),n(r(9996))},5650:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const i=r(9487),o=r(9996),s=r(8643),a=r(874);function u(t,e){const r=[],n=i.default.encode(JSON.stringify(e));r.push(n);const o=i.default.encode(JSON.stringify(t));return r.push(o),r.join(".")}e.createUnsecuredToken=function(t){return u(t,{typ:"JWT",alg:"none"})+"."},e.TokenSigner=class{constructor(t,e){if(!t||!e)throw new s.MissingParametersError("a signing algorithm and private key are required");if("string"!=typeof t)throw new Error("signing algorithm parameter must be a string");if(t=t.toUpperCase(),!o.cryptoClients.hasOwnProperty(t))throw new Error("invalid signing algorithm");this.tokenType="JWT",this.cryptoClient=o.cryptoClients[t],this.rawPrivateKey=e}header(t={}){const e={typ:this.tokenType,alg:this.cryptoClient.algorithmName};return Object.assign({},e,t)}sign(t,e=!1,r={}){const n=this.header(r),i=u(t,n),o=a.hashSha256(i);return this.createWithSignedHash(t,e,n,i,o)}signAsync(t,e=!1,r={}){return n(this,void 0,void 0,(function*(){const n=this.header(r),i=u(t,n),o=yield a.hashSha256Async(i);return this.createWithSignedHash(t,e,n,i,o)}))}createWithSignedHash(t,e,r,n,o){const s=this.cryptoClient.signHash(o,this.rawPrivateKey);return e?{header:[i.default.encode(JSON.stringify(r))],payload:JSON.stringify(t),signature:[s]}:[n,s].join(".")}}},7458:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(9487),i=r(9996),o=r(8643),s=r(874);e.TokenVerifier=class{constructor(t,e){if(!t||!e)throw new o.MissingParametersError("a signing algorithm and public key are required");if("string"!=typeof t)throw"signing algorithm parameter must be a string";if(t=t.toUpperCase(),!i.cryptoClients.hasOwnProperty(t))throw"invalid signing algorithm";this.tokenType="JWT",this.cryptoClient=i.cryptoClients[t],this.rawPublicKey=e}verify(t){return"string"==typeof t?this.verifyCompact(t,!1):"object"==typeof t?this.verifyExpanded(t,!1):void 0}verifyAsync(t){return"string"==typeof t?this.verifyCompact(t,!0):"object"==typeof t?this.verifyExpanded(t,!0):Promise.resolve(!1)}verifyCompact(t,e){const r=t.split("."),n=r[0]+"."+r[1],i=t=>{const e=this.cryptoClient.loadSignature(r[2]);return this.cryptoClient.verifyHash(t,e,this.rawPublicKey)};if(e)return s.hashSha256Async(n).then((t=>i(t)));{const t=s.hashSha256(n);return i(t)}}verifyExpanded(t,e){const r=[t.header.join("."),n.default.encode(t.payload)].join(".");let i=!0;const o=e=>(t.signature.map((t=>{const r=this.cryptoClient.loadSignature(t);this.cryptoClient.verifyHash(e,r,this.rawPublicKey)||(i=!1)})),i);if(e)return s.hashSha256Async(r).then((t=>o(t)));{const t=s.hashSha256(r);return o(t)}}}},9907:(t,e,r)=>{t=r.nmd(t);var n="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Boolean]",a="[object Date]",u="[object Function]",f="[object GeneratorFunction]",h="[object Map]",c="[object Number]",l="[object Object]",d="[object Promise]",p="[object RegExp]",y="[object Set]",m="[object String]",g="[object Symbol]",b="[object WeakMap]",v="[object ArrayBuffer]",w="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",E="[object Int8Array]",M="[object Int16Array]",k="[object Int32Array]",A="[object Uint8Array]",O="[object Uint8ClampedArray]",I="[object Uint16Array]",T="[object Uint32Array]",x=/\w*$/,P=/^\[object .+?Constructor\]$/,B=/^(?:0|[1-9]\d*)$/,N={};N[o]=N["[object Array]"]=N[v]=N[w]=N[s]=N[a]=N[_]=N[S]=N[E]=N[M]=N[k]=N[h]=N[c]=N[l]=N[p]=N[y]=N[m]=N[g]=N[A]=N[O]=N[I]=N[T]=!0,N["[object Error]"]=N[u]=N[b]=!1;var U="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,R="object"==typeof self&&self&&self.Object===Object&&self,L=U||R||Function("return this")(),C=e&&!e.nodeType&&e,j=C&&t&&!t.nodeType&&t,F=j&&j.exports===C;function H(t,e){return t.set(e[0],e[1]),t}function D(t,e){return t.add(e),t}function q(t,e,r,n){var i=-1,o=t?t.length:0;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}function z(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function $(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function K(t,e){return function(r){return t(e(r))}}function W(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var V,G=Array.prototype,X=Function.prototype,J=Object.prototype,Z=L["__core-js_shared__"],Y=(V=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"",Q=X.toString,tt=J.hasOwnProperty,et=J.toString,rt=RegExp("^"+Q.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=F?L.Buffer:void 0,it=L.Symbol,ot=L.Uint8Array,st=K(Object.getPrototypeOf,Object),at=Object.create,ut=J.propertyIsEnumerable,ft=G.splice,ht=Object.getOwnPropertySymbols,ct=nt?nt.isBuffer:void 0,lt=K(Object.keys,Object),dt=Lt(L,"DataView"),pt=Lt(L,"Map"),yt=Lt(L,"Promise"),mt=Lt(L,"Set"),gt=Lt(L,"WeakMap"),bt=Lt(Object,"create"),vt=Dt(dt),wt=Dt(pt),_t=Dt(yt),St=Dt(mt),Et=Dt(gt),Mt=it?it.prototype:void 0,kt=Mt?Mt.valueOf:void 0;function At(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Ot(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function It(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Tt(t){this.__data__=new Ot(t)}function xt(t,e,r){var n=t[e];tt.call(t,e)&&qt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function Pt(t,e){for(var r=t.length;r--;)if(qt(t[r][0],e))return r;return-1}function Bt(t,e,r,n,i,d,b){var P;if(n&&(P=d?n(t,i,d,b):n(t)),void 0!==P)return P;if(!Vt(t))return t;var B=zt(t);if(B){if(P=function(t){var e=t.length,r=t.constructor(e);return e&&"string"==typeof t[0]&&tt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!e)return function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}(t,P)}else{var U=jt(t),R=U==u||U==f;if(Kt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(U==l||U==o||R&&!d){if(z(t))return d?t:{};if(P=function(t){return"function"!=typeof t.constructor||Ht(t)?{}:Vt(e=st(t))?at(e):{};var e}(R?{}:t),!e)return function(t,e){return Ut(t,Ct(t),e)}(t,function(t,e){return t&&Ut(e,Gt(e),t)}(P,t))}else{if(!N[U])return d?t:{};P=function(t,e,r,n){var i,o=t.constructor;switch(e){case v:return Nt(t);case s:case a:return new o(+t);case w:return function(t,e){var r=e?Nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case _:case S:case E:case M:case k:case A:case O:case I:case T:return function(t,e){var r=e?Nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case h:return function(t,e,r){return q(e?r($(t),!0):$(t),H,new t.constructor)}(t,n,r);case c:case m:return new o(t);case p:return function(t){var e=new t.constructor(t.source,x.exec(t));return e.lastIndex=t.lastIndex,e}(t);case y:return function(t,e,r){return q(e?r(W(t),!0):W(t),D,new t.constructor)}(t,n,r);case g:return i=t,kt?Object(kt.call(i)):{}}}(t,U,Bt,e)}}b||(b=new Tt);var L=b.get(t);if(L)return L;if(b.set(t,P),!B)var C=r?function(t){return function(t,e,r){var n=e(t);return zt(t)?n:function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}(n,r(t))}(t,Gt,Ct)}(t):Gt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r););}(C||t,(function(i,o){C&&(i=t[o=i]),xt(P,o,Bt(i,e,r,n,o,t,b))})),P}function Nt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Ut(t,e,r,n){r||(r={});for(var i=-1,o=e.length;++i<o;){var s=e[i],a=n?n(r[s],t[s],s,r,t):void 0;xt(r,s,void 0===a?t[s]:a)}return r}function Rt(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function Lt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Vt(t)||(e=t,Y&&Y in e))&&(Wt(t)||z(t)?rt:P).test(Dt(t));var e}(r)?r:void 0}At.prototype.clear=function(){this.__data__=bt?bt(null):{}},At.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},At.prototype.get=function(t){var e=this.__data__;if(bt){var r=e[t];return r===n?void 0:r}return tt.call(e,t)?e[t]:void 0},At.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:tt.call(e,t)},At.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?n:e,this},Ot.prototype.clear=function(){this.__data__=[]},Ot.prototype.delete=function(t){var e=this.__data__,r=Pt(e,t);return!(r<0||(r==e.length-1?e.pop():ft.call(e,r,1),0))},Ot.prototype.get=function(t){var e=this.__data__,r=Pt(e,t);return r<0?void 0:e[r][1]},Ot.prototype.has=function(t){return Pt(this.__data__,t)>-1},Ot.prototype.set=function(t,e){var r=this.__data__,n=Pt(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},It.prototype.clear=function(){this.__data__={hash:new At,map:new(pt||Ot),string:new At}},It.prototype.delete=function(t){return Rt(this,t).delete(t)},It.prototype.get=function(t){return Rt(this,t).get(t)},It.prototype.has=function(t){return Rt(this,t).has(t)},It.prototype.set=function(t,e){return Rt(this,t).set(t,e),this},Tt.prototype.clear=function(){this.__data__=new Ot},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Ot){var n=r.__data__;if(!pt||n.length<199)return n.push([t,e]),this;r=this.__data__=new It(n)}return r.set(t,e),this};var Ct=ht?K(ht,Object):function(){return[]},jt=function(t){return et.call(t)};function Ft(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||B.test(t))&&t>-1&&t%1==0&&t<e}function Ht(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||J)}function Dt(t){if(null!=t){try{return Q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function qt(t,e){return t===e||t!=t&&e!=e}(dt&&jt(new dt(new ArrayBuffer(1)))!=w||pt&&jt(new pt)!=h||yt&&jt(yt.resolve())!=d||mt&&jt(new mt)!=y||gt&&jt(new gt)!=b)&&(jt=function(t){var e=et.call(t),r=e==l?t.constructor:void 0,n=r?Dt(r):void 0;if(n)switch(n){case vt:return w;case wt:return h;case _t:return d;case St:return y;case Et:return b}return e});var zt=Array.isArray;function $t(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Wt(t)}var Kt=ct||function(){return!1};function Wt(t){var e=Vt(t)?et.call(t):"";return e==u||e==f}function Vt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Gt(t){return $t(t)?function(t,e){var r=zt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&$t(t)}(t)&&tt.call(t,"callee")&&(!ut.call(t,"callee")||et.call(t)==o)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,i=!!n;for(var s in t)!e&&!tt.call(t,s)||i&&("length"==s||Ft(s,n))||r.push(s);return r}(t):function(t){if(!Ht(t))return lt(t);var e=[];for(var r in Object(t))tt.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return Bt(t,!0,!0)}},7993:(t,e,r)=>{"use strict";var n=r(1285),i=r(5232),o=r(7834).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<<e|t>>>32-e}function f(t,e,r,n,i,o,s){return u(t+(e&r|~e&n)+i+o|0,s)+e|0}function h(t,e,r,n,i,o,s){return u(t+(e&n|r&~n)+i+o|0,s)+e|0}function c(t,e,r,n,i,o,s){return u(t+(e^r^n)+i+o|0,s)+e|0}function l(t,e,r,n,i,o,s){return u(t+(r^(e|~n))+i+o|0,s)+e|0}n(a,i),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=f(r,n,i,o,t[0],3614090360,7),o=f(o,r,n,i,t[1],3905402710,12),i=f(i,o,r,n,t[2],606105819,17),n=f(n,i,o,r,t[3],3250441966,22),r=f(r,n,i,o,t[4],4118548399,7),o=f(o,r,n,i,t[5],1200080426,12),i=f(i,o,r,n,t[6],2821735955,17),n=f(n,i,o,r,t[7],4249261313,22),r=f(r,n,i,o,t[8],1770035416,7),o=f(o,r,n,i,t[9],2336552879,12),i=f(i,o,r,n,t[10],4294925233,17),n=f(n,i,o,r,t[11],2304563134,22),r=f(r,n,i,o,t[12],1804603682,7),o=f(o,r,n,i,t[13],4254626195,12),i=f(i,o,r,n,t[14],2792965006,17),r=h(r,n=f(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=h(o,r,n,i,t[6],3225465664,9),i=h(i,o,r,n,t[11],643717713,14),n=h(n,i,o,r,t[0],3921069994,20),r=h(r,n,i,o,t[5],3593408605,5),o=h(o,r,n,i,t[10],38016083,9),i=h(i,o,r,n,t[15],3634488961,14),n=h(n,i,o,r,t[4],3889429448,20),r=h(r,n,i,o,t[9],568446438,5),o=h(o,r,n,i,t[14],3275163606,9),i=h(i,o,r,n,t[3],4107603335,14),n=h(n,i,o,r,t[8],1163531501,20),r=h(r,n,i,o,t[13],2850285829,5),o=h(o,r,n,i,t[2],4243563512,9),i=h(i,o,r,n,t[7],1735328473,14),r=c(r,n=h(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=c(o,r,n,i,t[8],2272392833,11),i=c(i,o,r,n,t[11],1839030562,16),n=c(n,i,o,r,t[14],4259657740,23),r=c(r,n,i,o,t[1],2763975236,4),o=c(o,r,n,i,t[4],1272893353,11),i=c(i,o,r,n,t[7],4139469664,16),n=c(n,i,o,r,t[10],3200236656,23),r=c(r,n,i,o,t[13],681279174,4),o=c(o,r,n,i,t[0],3936430074,11),i=c(i,o,r,n,t[3],3572445317,16),n=c(n,i,o,r,t[6],76029189,23),r=c(r,n,i,o,t[9],3654602809,4),o=c(o,r,n,i,t[12],3873151461,11),i=c(i,o,r,n,t[15],530742520,16),r=l(r,n=c(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=l(o,r,n,i,t[7],1126891415,10),i=l(i,o,r,n,t[14],2878612391,15),n=l(n,i,o,r,t[5],4237533241,21),r=l(r,n,i,o,t[12],1700485571,6),o=l(o,r,n,i,t[3],2399980690,10),i=l(i,o,r,n,t[10],4293915773,15),n=l(n,i,o,r,t[1],2240044497,21),r=l(r,n,i,o,t[8],1873313359,6),o=l(o,r,n,i,t[15],4264355552,10),i=l(i,o,r,n,t[6],2734768916,15),n=l(n,i,o,r,t[13],1309151649,21),r=l(r,n,i,o,t[4],4149444226,6),o=l(o,r,n,i,t[11],3174756917,10),i=l(i,o,r,n,t[2],718787259,15),n=l(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},7332:(t,e,r)=>{var n=r(8834).Buffer;t.exports=function(t,e){if(!Array.isArray(t))throw TypeError("Expected values Array");if("function"!=typeof e)throw TypeError("Expected digest Function");for(var r=t.length,i=t.concat();r>1;){for(var o=0,s=0;s<r;s+=2,++o){var a=i[s],u=s+1===r?a:i[s+1],f=n.concat([a,u]);i[o]=e(f)}r=o}return i[0]}},9561:t=>{function e(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=e,e.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},3022:(t,e)=>{"use strict";var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16));else for(n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}},4406:t=>{var e,r,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var a,u=[],f=!1,h=-1;function c(){f&&a&&(f=!1,a.length?u=a.concat(u):h=-1,u.length&&l())}function l(){if(!f){var t=s(c);f=!0;for(var e=u.length;e;){for(a=u,u=[];++h<e;)a&&a[h].run();h=-1,e=u.length}a=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function p(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new d(t,e)),1!==u.length||f||s(l)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},7131:(t,e,r)=>{var n=r(196);function i(t){return t<n.OP_PUSHDATA1?1:t<=255?2:t<=65535?3:5}t.exports={encodingLength:i,encode:function(t,e,r){var o=i(e);return 1===o?t.writeUInt8(e,r):2===o?(t.writeUInt8(n.OP_PUSHDATA1,r),t.writeUInt8(e,r+1)):3===o?(t.writeUInt8(n.OP_PUSHDATA2,r),t.writeUInt16LE(e,r+1)):(t.writeUInt8(n.OP_PUSHDATA4,r),t.writeUInt32LE(e,r+1)),o},decode:function(t,e){var r,i,o=t.readUInt8(e);if(o<n.OP_PUSHDATA1)r=o,i=1;else if(o===n.OP_PUSHDATA1){if(e+2>t.length)return null;r=t.readUInt8(e+1),i=2}else if(o===n.OP_PUSHDATA2){if(e+3>t.length)return null;r=t.readUInt16LE(e+1),i=3}else{if(e+5>t.length)return null;if(o!==n.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=t.readUInt32LE(e+1),i=5}return{opcode:o,number:r,size:i}}}},5003:(t,e,r)=>{"use strict";var n=r(4406),i=65536,o=r(7834).Buffer,s=r.g.crypto||r.g.msCrypto;s&&s.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var r=o.allocUnsafe(t);if(t>0)if(t>i)for(var a=0;a<t;a+=i)s.getRandomValues(r.slice(a,a+i));else s.getRandomValues(r);return"function"==typeof e?n.nextTick((function(){e(null,r)})):r}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}},4452:t=>{"use strict";var e={};function r(t,r,n){n||(n=Error);var i=function(t){var e,n;function i(e,n,i){return t.call(this,function(t,e,n){return"string"==typeof r?r:r(t,e,n)}(e,n,i))||this}return n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=t,e[t]=i}function n(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}r("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,o,s,a,u;if("string"==typeof e&&(o="not ",e.substr(0,o.length)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(n(e,"type"));else{var f=("number"!=typeof u&&(u=0),u+".".length>(a=t).length||-1===a.indexOf(".",u)?"argument":"property");s='The "'.concat(t,'" ').concat(f," ").concat(i," ").concat(n(e,"type"))}return s+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},7073:(t,e,r)=>{"use strict";var n=r(4406),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var o=r(8051),s=r(2557);r(1285)(h,o);for(var a=i(s.prototype),u=0;u<a.length;u++){var f=a[u];h.prototype[f]||(h.prototype[f]=s.prototype[f])}function h(t){if(!(this instanceof h))return new h(t);o.call(this,t),s.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",c)))}function c(){this._writableState.ended||n.nextTick(l,this)}function l(t){t.end()}Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(h.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(h.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(h.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})},5163:(t,e,r)=>{"use strict";t.exports=i;var n=r(7640);function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}r(1285)(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},8051:(t,e,r)=>{"use strict";var n,i=r(4406);t.exports=k,k.ReadableState=M,r(2699).EventEmitter;var o,s=function(t,e){return t.listeners(e).length},a=r(5010),u=r(8834).Buffer,f=r.g.Uint8Array||function(){},h=r(6602);o=h&&h.debuglog?h.debuglog("stream"):function(){};var c,l,d,p=r(6637),y=r(2262),m=r(7605).getHighWaterMark,g=r(4452).q,b=g.ERR_INVALID_ARG_TYPE,v=g.ERR_STREAM_PUSH_AFTER_EOF,w=g.ERR_METHOD_NOT_IMPLEMENTED,_=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(1285)(k,a);var S=y.errorOrDestroy,E=["error","close","destroy","pause","resume"];function M(t,e,i){n=n||r(7073),t=t||{},"boolean"!=typeof i&&(i=e instanceof n),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(c||(c=r(214).s),this.decoder=new c(t.encoding),this.encoding=t.encoding)}function k(t){if(n=n||r(7073),!(this instanceof k))return new k(t);var e=this instanceof n;this._readableState=new M(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function A(t,e,r,n,i){o("readableAddChunk",e);var s,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(o("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?x(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,P(t)))}}(t,a);else if(i||(s=function(t,e){var r,n;return n=e,u.isBuffer(n)||n instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e)),r}(a,e)),s)S(t,s);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),n)a.endEmitted?S(t,new _):O(t,a,e,!0);else if(a.ended)S(t,new v);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?O(t,a,e,!1):B(t,a)):O(t,a,e,!1)}else n||(a.reading=!1,B(t,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function O(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&x(t)),B(t,e)}Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),k.prototype.destroy=y.destroy,k.prototype._undestroy=y.undestroy,k.prototype._destroy=function(t,e){e(t)},k.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=u.from(t,e),e=""),r=!0),A(this,t,e,!1,r)},k.prototype.unshift=function(t){return A(this,t,null,!0,!1)},k.prototype.isPaused=function(){return!1===this._readableState.flowing},k.prototype.setEncoding=function(t){c||(c=r(214).s);var e=new c(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=e.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var I=1073741824;function T(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=I?t=I:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function x(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(P,t))}function P(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,C(t)}function B(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(N,t,e))}function N(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(o("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function U(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function R(t){o("readable nexttick read 0"),t.read(0)}function L(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),C(t),e.flowing&&!e.reading&&t.read(0)}function C(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function j(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function F(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(H,e,t))}function H(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function D(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}k.prototype.read=function(t){o("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?F(this):x(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&F(this),null;var n,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&o("length less than watermark",i=!0),e.ended||e.reading?o("reading or ended",i=!1):i&&(o("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=T(r,e))),null===(n=t>0?j(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&F(this)),null!==n&&this.emit("data",n),n},k.prototype._read=function(t){S(this,new w("_read()"))},k.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,o("pipe count=%d opts=%j",n.pipesCount,e);var a=e&&!1===e.end||t===i.stdout||t===i.stderr?y:u;function u(){o("onend"),t.end()}n.endEmitted?i.nextTick(a):r.once("end",a),t.on("unpipe",(function e(i,s){o("onunpipe"),i===r&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",f),t.removeListener("error",l),t.removeListener("unpipe",e),r.removeListener("end",u),r.removeListener("end",y),r.removeListener("data",c),h=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}));var f=function(t){return function(){var e=t._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,C(t))}}(r);t.on("drain",f);var h=!1;function c(e){o("ondata");var i=t.write(e);o("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==D(n.pipes,t))&&!h&&(o("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function l(e){o("onerror",e),y(),t.removeListener("error",l),0===s(t,"error")&&S(t,e)}function d(){t.removeListener("finish",p),y()}function p(){o("onfinish"),t.removeListener("close",d),y()}function y(){o("unpipe"),r.unpipe(t)}return r.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events.error?Array.isArray(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on(e,r)}(t,"error",l),t.once("close",d),t.once("finish",p),t.emit("pipe",r),n.flowing||(o("pipe resume"),r.resume()),t},k.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=D(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},k.prototype.on=function(t,e){var r=a.prototype.on.call(this,t,e),n=this._readableState;return"data"===t?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,o("on readable",n.length,n.reading),n.length?x(this):n.reading||i.nextTick(R,this))),r},k.prototype.addListener=k.prototype.on,k.prototype.removeListener=function(t,e){var r=a.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(U,this),r},k.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(U,this),e},k.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(L,t,e))}(this,t)),t.paused=!1,this},k.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},k.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(o("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s<E.length;s++)t.on(E[s],this.emit.bind(this,E[s]));return this._read=function(e){o("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(k.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=r(1029)),l(this)}),Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(k.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(k.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),k._fromList=j,Object.defineProperty(k.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(k.from=function(t,e){return void 0===d&&(d=r(352)),d(k,t,e)})},7640:(t,e,r)=>{"use strict";t.exports=h;var n=r(4452).q,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(7073);function f(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function h(t){if(!(this instanceof h))return new h(t);u.call(this,t),this._transformState={afterTransform:f.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",c)}function c(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?l(this,null,null):this._flush((function(e,r){l(t,e,r)}))}function l(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new a;if(t._transformState.transforming)throw new s;return t.push(null)}r(1285)(h,u),h.prototype.push=function(t,e){return this._transformState.needTransform=!1,u.prototype.push.call(this,t,e)},h.prototype._transform=function(t,e,r){r(new i("_transform()"))},h.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},h.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},h.prototype._destroy=function(t,e){u.prototype._destroy.call(this,t,(function(t){e(t)}))}},2557:(t,e,r)=>{"use strict";var n,i=r(4406);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(undefined),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=k,k.WritableState=M;var s,a={deprecate:r(5803)},u=r(5010),f=r(8834).Buffer,h=r.g.Uint8Array||function(){},c=r(2262),l=r(7605).getHighWaterMark,d=r(4452).q,p=d.ERR_INVALID_ARG_TYPE,y=d.ERR_METHOD_NOT_IMPLEMENTED,m=d.ERR_MULTIPLE_CALLBACK,g=d.ERR_STREAM_CANNOT_PIPE,b=d.ERR_STREAM_DESTROYED,v=d.ERR_STREAM_NULL_VALUES,w=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,S=c.errorOrDestroy;function E(){}function M(t,e,s){n=n||r(7073),t=t||{},"boolean"!=typeof s&&(s=e instanceof n),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=l(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,o=r.writecb;if("function"!=typeof o)throw new m;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,o){--e.pendingcb,r?(i.nextTick(o,n),i.nextTick(P,t,e),t._writableState.errorEmitted=!0,S(t,n)):(o(n),t._writableState.errorEmitted=!0,S(t,n),P(t,e))}(t,r,n,e,o);else{var s=T(r)||t.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||I(t,r),n?i.nextTick(O,t,r,s,o):O(t,r,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function k(t){var e=this instanceof(n=n||r(7073));if(!e&&!s.call(k,this))return new k(t);this._writableState=new M(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function A(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function O(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),P(t,e)}function I(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),s=e.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,A(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,h=r.encoding,c=r.callback;if(A(t,e,!1,e.objectMode?1:f.length,f,h,c),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function T(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final((function(r){e.pendingcb--,r&&S(t,r),e.prefinished=!0,t.emit("prefinish"),P(t,e)}))}function P(t,e){var r=T(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,i.nextTick(x,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var n=t._readableState;(!n||n.autoDestroy&&n.endEmitted)&&t.destroy()}return r}r(1285)(k,u),M.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(M.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===k&&t&&t._writableState instanceof M}})):s=function(t){return t instanceof this},k.prototype.pipe=function(){S(this,new g)},k.prototype.write=function(t,e,r){var n,o=this._writableState,s=!1,a=!o.objectMode&&(n=t,f.isBuffer(n)||n instanceof h);return a&&!f.isBuffer(t)&&(t=function(t){return f.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=E),o.ending?function(t,e){var r=new w;S(t,r),i.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var o;return null===r?o=new v:"string"==typeof r||e.objectMode||(o=new p("chunk",["string","Buffer"],r)),!o||(S(t,o),i.nextTick(n,o),!1)}(this,o,t,r))&&(o.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=f.from(e,r)),e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length<e.highWaterMark;if(u||(e.needDrain=!0),e.writing||e.corked){var h=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},h?h.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else A(t,e,!1,a,n,i,o);return u}(this,o,a,t,e,r)),s},k.prototype.cork=function(){this._writableState.corked++},k.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||I(this,t))},k.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),k.prototype._write=function(t,e,r){r(new y("_write()"))},k.prototype._writev=null,k.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,P(t,e),r&&(e.finished?i.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),k.prototype.destroy=c.destroy,k.prototype._undestroy=c.undestroy,k.prototype._destroy=function(t,e){e(t)}},1029:(t,e,r)=>{"use strict";var n,i=r(4406);function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s=r(9885),a=Symbol("lastResolve"),u=Symbol("lastReject"),f=Symbol("error"),h=Symbol("ended"),c=Symbol("lastPromise"),l=Symbol("handlePromise"),d=Symbol("stream");function p(t,e){return{value:t,done:e}}function y(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[c]=null,t[a]=null,t[u]=null,e(p(r,!1)))}}function m(t){i.nextTick(y,t)}var g=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(n={get stream(){return this[d]},next:function(){var t=this,e=this[f];if(null!==e)return Promise.reject(e);if(this[h])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(e,r){i.nextTick((function(){t[f]?r(t[f]):e(p(void 0,!0))}))}));var r,n=this[c];if(n)r=new Promise(function(t,e){return function(r,n){t.then((function(){e[h]?r(p(void 0,!0)):e[l](r,n)}),n)}}(n,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));r=new Promise(this[l])}return this[c]=r,r}},Symbol.asyncIterator,(function(){return this})),o(n,"return",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(p(void 0,!0))}))}))})),n),g);t.exports=function(t){var e,r=Object.create(b,(o(e={},d,{value:t,writable:!0}),o(e,a,{value:null,writable:!0}),o(e,u,{value:null,writable:!0}),o(e,f,{value:null,writable:!0}),o(e,h,{value:t._readableState.endEmitted,writable:!0}),o(e,l,{value:function(t,e){var n=r[d].read();n?(r[c]=null,r[a]=null,r[u]=null,t(p(n,!1))):(r[a]=t,r[u]=e)},writable:!0}),e));return r[c]=null,s(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[u];return null!==e&&(r[c]=null,r[a]=null,r[u]=null,e(t)),void(r[f]=t)}var n=r[a];null!==n&&(r[c]=null,r[a]=null,r[u]=null,n(p(void 0,!0))),r[h]=!0})),t.on("readable",m.bind(null,r)),r}},6637:(t,e,r)=>{"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var s=r(8834).Buffer,a=r(4854).inspect,u=a&&a.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r;return e=t,r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e,r,n,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=i,n=a,s.prototype.copy.call(e,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:u,value:function(t,e){return a(this,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}],r&&o(e.prototype,r),t}()},2262:(t,e,r)=>{"use strict";var n=r(4406);function i(t,e){s(t,e),o(t)}function o(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(s,this,t)):n.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?r._writableState?r._writableState.errorEmitted?n.nextTick(o,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,t)):n.nextTick(i,r,t):e?(n.nextTick(o,r),e(t)):n.nextTick(o,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}}},9885:(t,e,r)=>{"use strict";var n=r(4452).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var s=r.readable||!1!==r.readable&&e.readable,a=r.writable||!1!==r.writable&&e.writable,u=function(){e.writable||h()},f=e._writableState&&e._writableState.finished,h=function(){a=!1,f=!0,s||o.call(e)},c=e._readableState&&e._readableState.endEmitted,l=function(){s=!1,c=!0,a||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return s&&!c?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):a&&!f?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},y=function(){e.req.on("finish",h)};return function(t){return t.setHeader&&"function"==typeof t.abort}(e)?(e.on("complete",h),e.on("abort",p),e.req?y():e.on("request",y)):a&&!e._writableState&&(e.on("end",u),e.on("close",u)),e.on("end",l),e.on("finish",h),!1!==r.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",h),e.removeListener("abort",p),e.removeListener("request",y),e.req&&e.req.removeListener("finish",h),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",h),e.removeListener("end",l),e.removeListener("error",d),e.removeListener("close",p)}}},352:t=>{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},3495:(t,e,r)=>{"use strict";var n,i=r(4452).q,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function u(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var a=!1;t.on("close",(function(){a=!0})),void 0===n&&(n=r(9885)),n(t,{readable:e,writable:i},(function(t){if(t)return o(t);a=!0,o()}));var u=!1;return function(e){if(!a&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new s("pipe"))}}function f(t){t()}function h(t,e){return t.pipe(e)}function c(t){return t.length?"function"!=typeof t[t.length-1]?a:t.pop():a}t.exports=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=c(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var s=e.map((function(t,r){var o=r<e.length-1;return u(t,o,r>0,(function(t){n||(n=t),t&&s.forEach(f),o||(s.forEach(f),i(n))}))}));return e.reduce(h)}},7605:(t,e,r)=>{"use strict";var n=r(4452).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},5010:(t,e,r)=>{t.exports=r(2699).EventEmitter},7525:(t,e,r)=>{(e=t.exports=r(8051)).Stream=e,e.Readable=e,e.Writable=r(2557),e.Duplex=r(7073),e.Transform=r(7640),e.PassThrough=r(5163),e.finished=r(9885),e.pipeline=r(3495)},1445:(t,e,r)=>{"use strict";var n=r(8834).Buffer,i=r(1285),o=r(5232),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],f=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],h=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],c=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<<e|t>>>32-e}function y(t,e,r,n,i,o,s,a){return p(t+(e^r^n)+o+s|0,a)+i|0}function m(t,e,r,n,i,o,s,a){return p(t+(e&r|~e&n)+o+s|0,a)+i|0}function g(t,e,r,n,i,o,s,a){return p(t+((e|~r)^n)+o+s|0,a)+i|0}function b(t,e,r,n,i,o,s,a){return p(t+(e&n|r&~n)+o+s|0,a)+i|0}function v(t,e,r,n,i,o,s,a){return p(t+(e^(r|~n))+o+s|0,a)+i|0}i(d,o),d.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,d=0|this._e,w=0|this._a,_=0|this._b,S=0|this._c,E=0|this._d,M=0|this._e,k=0;k<80;k+=1){var A,O;k<16?(A=y(r,n,i,o,d,t[a[k]],c[0],f[k]),O=v(w,_,S,E,M,t[u[k]],l[0],h[k])):k<32?(A=m(r,n,i,o,d,t[a[k]],c[1],f[k]),O=b(w,_,S,E,M,t[u[k]],l[1],h[k])):k<48?(A=g(r,n,i,o,d,t[a[k]],c[2],f[k]),O=g(w,_,S,E,M,t[u[k]],l[2],h[k])):k<64?(A=b(r,n,i,o,d,t[a[k]],c[3],f[k]),O=m(w,_,S,E,M,t[u[k]],l[3],h[k])):(A=v(r,n,i,o,d,t[a[k]],c[4],f[k]),O=y(w,_,S,E,M,t[u[k]],l[4],h[k])),r=d,d=o,o=p(i,10),i=n,n=A,w=M,M=E,E=p(S,10),S=_,_=O}var I=this._b+i+E|0;this._b=this._c+o+M|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+n+S|0,this._a=I},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=d},7834:(t,e,r)=>{var n=r(8834),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},2179:(t,e,r)=>{t.exports=r(8224)},8224:(t,e,r)=>{!function(){var e={};if(e.async=r(625),"object"!=typeof e.async)throw new Error("Module async is required (https://github.com/caolan/async)");var n=e.async;function i(t,e){if(!e||"object"!=typeof e)return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function o(){var t={},e=Array.prototype.slice.call(arguments),r=null,n=null;return e.forEach((function(e){if(e&&e.constructor===Object)for(r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]]})),t}function s(){this.custom={},this.extend=function(t){return i(this.custom,t)},this.reset=function(){this.custom={}},this.remove=function(t){u.array(t)||(t=[t]),t.forEach((function(t){delete this.custom[t]}),this)}}function a(t,e){var r=["@"];if(this._schema=t,this._custom={},null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._custom["$"+n]=e[n]);this._getDepth=function(){return r.length},this._dumpStack=function(){return r.map((function(t){return t.replace(/^\[/g,"")})).join(".").replace(/\.\u001b\u001c\u001d\u001e/g,"[")},this._deeperObject=function(t){return r.push(/^[a-z$_][a-z0-9$_]*$/i.test(t)?t:'["'+t+'"]'),this},this._deeperArray=function(t){return r.push("["+t+"]"),this},this._back=function(){return r.pop(),this}}var u={function:function(t){return"function"==typeof t},string:function(t){return"string"==typeof t},number:function(t){return"number"==typeof t&&!isNaN(t)},integer:function(t){return"number"==typeof t&&t%1==0},NaN:function(t){return"number"==typeof t&&isNaN(t)},boolean:function(t){return"boolean"==typeof t},null:function(t){return null===t},date:function(t){return null!=t&&t instanceof Date},object:function(t){return"object"==typeof t&&t.constructor!==Array&&null!=t},array:function(t){return null!=t&&t.constructor===Array},any:function(){return!0}};function f(t,e){return"function"==typeof t?e instanceof t:u[t=t in u?t:"any"](e)}function h(t,e){for(var r=[],n=t.indexOf(e);-1!==n;)r.push(n),n=t.indexOf(e,n+1);return r}var c={void:/^$/,url:/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)?(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,"date-time":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z?|(-|\+)\d{2}:\d{2})$/,date:/^\d{4}-\d{2}-\d{2}$/,coolDateTime:/^\d{4}(-|\/)\d{2}(-|\/)\d{2}(T| )\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,time:/^\d{2}\:\d{2}\:\d{2}$/,color:/^#([0-9a-f])+$/i,email:new RegExp("(?:[^\\W_](?:[\\w\\.\\+]+)@(?:localhost|(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:northwesternmutual|travelersinsurance|vermögensberatung|vermögensberater|americanexpress|kerryproperties|sandvikcoromant|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|construction|lplfinancial|scholarships|versicherung|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|university|vlaanderen|volkswagen|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|موريتانيا|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|السعودية|yokohama|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|католик|الجزائر|العليان|اتصالات|پاکستان|البحرين|كاثوليك|இந்தியா|yamaxun|youtube|zuerich|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|москва|онлайн|ファッション|भारतम्|ارامكو|امارات|الاردن|المغرب|ابوظبي|مليسيا|இலங்கை|فلسطين|yachts|yandex|zappos|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|ישראל|বাংলা|భారత్|भारोत|संगठन|ایران|بازار|بھارت|سودان|همراه|سورية|ഭാരതം|嘉里大酒店|yahoo|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|duck|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|ಭಾರತ|ଭାରତ|大众汽车|ভাৰত|ভারত|موقع|香格里拉|сайт|アマゾン|дети|ポイント|ලංකා|電訊盈科|クラウド|ભારત|भारत|عمان|بارت|ڀارت|عراق|شبكة|بيتك|组织机构|تونس|グーグル|ਭਾਰਤ|yoga|zara|zero|zone|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|कॉम|セール|คอม|我爱你|қаз|срб|бел|קום|淡马锡|орг|नेट|ストア|мкд|كوم|中文网|ком|укр|亚马逊|诺基亚|飞利浦|мон|عرب|ไทย|рус|ລາວ|みんな|天主教|مصر|قطر|հայ|新加坡|xxx|xyz|you|yun|zip|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|佛山|慈善|集团|在线|한국|点看|八卦|公益|公司|网站|移动|联通|бг|时尚|微博|삼성|商标|商店|商城|ею|新闻|家電|中信|中国|中國|娱乐|谷歌|购物|通販|网店|餐厅|网络|香港|食品|台湾|台灣|手机|澳門|닷컴|政府|გე|机构|健康|招聘|рф|大拿|ευ|ελ|世界|書籍|网址|닷넷|コム|游戏|企业|信息|嘉里|广东|政务|ye|yt|za|zm|zw))))"),numeric:/^[0-9]+$/,integer:/^\-?[0-9]+$/,decimal:/^\-?[0-9]*\.?[0-9]+$/,alpha:/^[a-z]+$/i,alphaNumeric:/^[a-z0-9]+$/i,alphaDash:/^[a-z0-9_-]+$/i,javascript:/^[a-z_\$][a-z0-9_\$]*$/i,upperString:/^[A-Z ]*$/,lowerString:/^[a-z ]*$/,v4uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i},l={optional:function(t,e){!0!==("boolean"==typeof t.optional?t.optional:"true"===t.optional)&&void 0===e&&this.report("is missing and not optional",null,"optional")},type:function(t,e){if(void 0!==e&&("string"==typeof t.type||t.type instanceof Array||"function"==typeof t.type)){var r=u.array(t.type)?t.type:[t.type];r.some((function(t){return f(t,e)}))||(r=r.map((function(t){return"function"==typeof t?"an instance of "+t.name:t})),this.report("must be "+r.join(" or ")+", but is "+function(t){for(var e in u)if(f(e,t))return"any"===e||"object"===e&&t.constructor!==Object?"an instance of "+t.constructor.name:e}(e),null,"type"))}},uniqueness:function(t,e){if("string"==typeof t.uniqueness&&(t.uniqueness="true"===t.uniqueness),"boolean"==typeof t.uniqueness&&!1!==t.uniqueness&&(u.array(e)||"string"==typeof e))for(var r=[],n=0;n<e.length;n++)if(!(r.indexOf(e[n])>=0)){var i=h(e,e[n]);i.length>1&&(r.push(e[n]),this.report("has value ["+e[n]+"] more than once at indexes ["+i.join(", ")+"]",null,"uniqueness"))}},pattern:function(t,e){var r=t.pattern;if("string"==typeof e){var n=!1;u.array(r)||(r=[r]),r.forEach((function(t){"string"==typeof t&&t in c&&(t=c[t]),t instanceof RegExp&&t.test(e)&&(n=!0)})),n||this.report("must match ["+r.join(" or ")+'], but is equal to "'+e+'"',null,"pattern")}},validDate:function(t,e){"true"===String(t.validDate)&&e instanceof Date&&isNaN(e.getTime())&&this.report("must be a valid date",null,"validDate")},minLength:function(t,e){if("string"==typeof e||u.array(e)){var r=Number(t.minLength);isNaN(r)||e.length<r&&this.report("must be longer than "+r+" elements, but it has "+e.length,null,"minLength")}},maxLength:function(t,e){if("string"==typeof e||u.array(e)){var r=Number(t.maxLength);isNaN(r)||e.length>r&&this.report("must be shorter than "+r+" elements, but it has "+e.length,null,"maxLength")}},exactLength:function(t,e){if("string"==typeof e||u.array(e)){var r=Number(t.exactLength);isNaN(r)||e.length!==r&&this.report("must have exactly "+r+" elements, but it have "+e.length,null,"exactLength")}},lt:function(t,e){var r=Number(t.lt);"number"!=typeof e||isNaN(r)||e>=r&&this.report("must be less than "+r+', but is equal to "'+e+'"',null,"lt")},lte:function(t,e){var r=Number(t.lte);"number"!=typeof e||isNaN(r)||e>r&&this.report("must be less than or equal to "+r+', but is equal to "'+e+'"',null,"lte")},gt:function(t,e){var r=Number(t.gt);"number"!=typeof e||isNaN(r)||e<=r&&this.report("must be greater than "+r+', but is equal to "'+e+'"',null,"gt")},gte:function(t,e){var r=Number(t.gte);"number"!=typeof e||isNaN(r)||e<r&&this.report("must be greater than or equal to "+r+', but is equal to "'+e+'"',null,"gte")},eq:function(t,e){if("number"==typeof e||"string"==typeof e||"boolean"==typeof e){var r=t.eq;if("number"==typeof r||"string"==typeof r||"boolean"==typeof r||u.array(r))if(u.array(r)){for(var n=0;n<r.length;n++)if(e===r[n])return;this.report("must be equal to ["+r.map((function(t){return'"'+t+'"'})).join(" or ")+'], but is equal to "'+e+'"',null,"eq")}else e!==r&&this.report('must be equal to "'+r+'", but is equal to "'+e+'"',null,"eq")}},ne:function(t,e){if("number"==typeof e||"string"==typeof e){var r=t.ne;if("number"==typeof r||"string"==typeof r||u.array(r))if(u.array(r)){for(var n=0;n<r.length;n++)if(e===r[n])return void this.report('must not be equal to "'+r[n]+'"',null,"ne")}else e===r&&this.report('must not be equal to "'+r+'"',null,"ne")}},someKeys:function(t,e){var r=t.someKeys;u.object(e)&&(r.some((function(t){return t in e}))||this.report("must have at least key "+r.map((function(t){return'"'+t+'"'})).join(" or "),null,"someKeys"))},strict:function(t,e){if("string"==typeof t.strict&&(t.strict="true"===t.strict),!0===t.strict&&u.object(e)&&u.object(t.properties)&&void 0===t.properties["*"]){var r=Object.keys(e).filter((function(e){return void 0===t.properties[e]}));if(r.length>0){var n="should not contains "+(r.length>1?"properties":"property")+" ["+r.map((function(t){return'"'+t+'"'})).join(", ")+"]";this.report(n,null,"strict")}}},exec:function(t,e,r){var n=this;if("function"==typeof r)return this.asyncExec(t,e,r);(u.array(t.exec)?t.exec:[t.exec]).forEach((function(r){"function"==typeof r&&r.call(n,t,e)}))},properties:function(t,e,r){if("function"==typeof r)return this.asyncProperties(t,e,r);if(t.properties instanceof Object&&e instanceof Object){var n,i=t.properties;if(null!=i["*"])for(n in e)n in i||(this._deeperObject(n),this._validate(i["*"],e[n]),this._back());for(n in i)"*"!==n&&(this._deeperObject(n),this._validate(i[n],e[n]),this._back())}},items:function(t,e,r){if("function"==typeof r)return this.asyncItems(t,e,r);if(t.items instanceof Object&&e instanceof Object){var n,i,o=t.items;if(u.array(o)&&u.array(e))for(n=0,i=o.length;n<i;n++)this._deeperArray(n),this._validate(o[n],e[n]),this._back();else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(this._deeperArray(s),this._validate(o,e[s]),this._back())}}},d={asyncExec:function(t,e,r){var i=this;n.eachSeries(u.array(t.exec)?t.exec:[t.exec],(function(r,o){if("function"==typeof r){if(r.length>2)return r.call(i,t,e,o);r.call(i,t,e)}n.nextTick(o)}),r)},asyncProperties:function(t,e,r){if(!(t.properties instanceof Object&&u.object(e)))return r();var i=this,o=t.properties;n.series([function(t){if(null==o["*"])return t();n.eachSeries(Object.keys(e),(function(t,r){if(t in o)return n.nextTick(r);i._deeperObject(t),i._asyncValidate(o["*"],e[t],(function(t){i._back(),r(t)}))}),t)},function(t){n.eachSeries(Object.keys(o),(function(t,r){if("*"===t)return n.nextTick(r);i._deeperObject(t),i._asyncValidate(o[t],e[t],(function(t){i._back(),r(t)}))}),t)}],r)},asyncItems:function(t,e,r){if(!(t.items instanceof Object&&e instanceof Object))return r();var i=this,o=t.items;u.array(o)&&u.array(e)?n.timesSeries(o.length,(function(t,r){i._deeperArray(t),i._asyncValidate(o[t],e[t],(function(t,e){i._back(),r(t,e)})),i._back()}),r):n.eachSeries(Object.keys(e),(function(t,r){i._deeperArray(t),i._asyncValidate(o,e[t],(function(t,e){i._back(),r(t,e)}))}),r)}};function p(t,e){a.prototype.constructor.call(this,t,o(p.custom,e));var r=[];this._basicFields=Object.keys(l),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t,e,n){var i={code:e||this.userCode||null,reason:n||"unknown",message:this.userError||t||"is invalid",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};return r.push(i),this},this.result=function(){return{error:r,valid:0===r.length,format:function(){return!0===this.valid?"Candidate is valid":this.error.map((function(t){return"Property "+t.property+": "+t.message})).join("\n")}}}}i(p.prototype,l),i(p.prototype,d),i(p,new s),p.prototype.validate=function(t,e){if(this.origin=t,"function"==typeof e){var r=this;return n.nextTick((function(){r._asyncValidate(r._schema,t,(function(t){r.origin=null,e(t,r.result())}))}))}return this._validate(this._schema,t).result()},p.prototype._validate=function(t,e,r){return this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,this._basicFields.forEach((function(r){!(r in t)&&"optional"!==r||"function"!=typeof this[r]||this[r](t,e)}),this),this._customFields.forEach((function(r){r in t&&"function"==typeof this._custom[r]&&this._custom[r].call(this,t,e)}),this),this},p.prototype._asyncValidate=function(t,e,r){var i=this;this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,n.series([function(r){n.eachSeries(Object.keys(l),(function(r,o){n.nextTick((function(){if((r in t||"optional"===r)&&"function"==typeof i[r]){if(i[r].length>2)return i[r](t,e,o);i[r](t,e)}o()}))}),r)},function(r){n.eachSeries(Object.keys(i._custom),(function(r,o){n.nextTick((function(){if(r in t&&"function"==typeof i._custom[r]){if(i._custom[r].length>2)return i._custom[r].call(i,t,e,o);i._custom[r].call(i,t,e)}o()}))}),r)}],r)};var y={number:function(t,e){var r;if("number"==typeof t)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(r=parseFloat(t.replace(/,/g,".").replace(/ /g,""))))return r}else if(t instanceof Date)return+t;return null},integer:function(t,e){var r;if("number"==typeof t&&t%1==0)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(r=parseInt(t.replace(/ /g,""),10)))return r}else{if("number"==typeof t)return parseInt(t,10);if("boolean"==typeof t)return t?1:0;if(t instanceof Date)return+t}return null},string:function(t,e){return"boolean"==typeof t||"number"==typeof t||t instanceof Date?t.toString():u.array(t)?e.items||e.properties?t:t.join(String(e.joinWith||",")):t instanceof Object?e.items||e.properties?t:JSON.stringify(t):"string"==typeof t&&t.length?t:null},date:function(t,e){if(t instanceof Date)return t;var r=new Date(t);return isNaN(r.getTime())?null:r},boolean:function(t,e){return void 0===t?null:("string"!=typeof t||"false"!==t.toLowerCase())&&!!t},object:function(t,e){if("string"!=typeof t||u.object(t))return t;try{return JSON.parse(t)}catch(t){return null}},array:function(t,e){if(u.array(t))return t;if(void 0===t)return null;if("string"==typeof t){if("["===t.substring(0,1)&&"]"===t.slice(-1))try{return JSON.parse(t)}catch(t){return null}return t.split(String(e.splitWith||","))}return u.array(t)?null:[t]}},m={upper:function(t){return t.toUpperCase()},lower:function(t){return t.toLowerCase()},title:function(t){return t.replace(/\S*/g,(function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()}))},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()},ucfirst:function(t){return t.charAt(0).toUpperCase()+t.substr(1)},trim:function(t){return t.trim()}},g={strict:function(t,e){return"string"==typeof t.strict&&(t.strict="true"===t.strict),!0!==t.strict?e:u.object(t.properties)&&u.object(e)?(Object.keys(e).forEach((function(r){r in t.properties||delete e[r]})),e):e},optional:function(t,e){return!0===("boolean"==typeof t.optional?t.optional:"false"!==t.optional)||void 0!==e?e:(this.report(),t.def===Date?new Date:t.def)},type:function(t,e){if("string"!=typeof t.type||"function"!=typeof y[t.type])return e;var r,n="boolean"!=typeof t.optional||t.optional;return"function"==typeof y[t.type]?(null===(r=y[t.type](e,t))&&!n||!r&&isNaN(r)||null===r&&"string"===t.type)&&(r=t.def):n||(r=t.def),(null!=r||void 0!==t.def&&t.def===r)&&r!==e?(this.report(),r):e},rules:function(t,e){var r=t.rules;if("string"!=typeof e||"string"!=typeof r&&!u.array(r))return e;var n=!1;return(u.array(r)?r:[r]).forEach((function(t){"function"==typeof m[t]&&(e=m[t](e),n=!0)})),n&&this.report(),e},min:function(t,e){var r=Number(e);if(isNaN(r))return e;var n=Number(t.min);return isNaN(n)?e:r<n?(this.report(),n):e},max:function(t,e){var r=Number(e);if(isNaN(r))return e;var n=Number(t.max);return isNaN(n)?e:r>n?(this.report(),n):e},minLength:function(t,e){var r=Number(t.minLength);if("string"!=typeof e||isNaN(r)||r<0)return e;var n="",i=r-e.length;if(i>0){for(var o=0;o<i;o++)n+="-";return this.report(),e+n}return e},maxLength:function(t,e){var r=Number(t.maxLength);return"string"!=typeof e||isNaN(r)||r<0?e:e.length>r?(this.report(),e.slice(0,r)):e},properties:function(t,e,r){if("function"==typeof r)return this.asyncProperties(t,e,r);if(!e||"object"!=typeof e)return e;var n,i,o=t.properties;if(void 0!==o["*"])for(i in e)i in o||(this._deeperObject(i),void 0!==(n=this._sanitize(t.properties["*"],e[i]))&&(e[i]=n),this._back());for(i in t.properties)"*"!==i&&(this._deeperObject(i),void 0!==(n=this._sanitize(t.properties[i],e[i]))&&(e[i]=n),this._back());return e},items:function(t,e,r){if("function"==typeof r)return this.asyncItems(t,e,r);if(!(t.items instanceof Object&&e instanceof Object))return e;var n;if(u.array(t.items)&&u.array(e)){var i=t.items.length<e.length?t.items.length:e.length;for(n=0;n<i;n++)this._deeperArray(n),e[n]=this._sanitize(t.items[n],e[n]),this._back()}else for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._deeperArray(n),e[n]=this._sanitize(t.items,e[n]),this._back());return e},exec:function(t,e,r){return"function"==typeof r?this.asyncExec(t,e,r):((u.array(t.exec)?t.exec:[t.exec]).forEach((function(r){"function"==typeof r&&(e=r.call(this,t,e))}),this),e)}},b={asyncExec:function(t,e,r){var i=this,o=u.array(t.exec)?t.exec:[t.exec];n.eachSeries(o,(function(r,n){if("function"==typeof r){if(r.length>2)return r.call(i,t,e,(function(t,r){if(t)return n(t);e=r,n()}));e=r.call(i,t,e)}n()}),(function(t){r(t,e)}))},asyncProperties:function(t,e,r){if(!e||"object"!=typeof e)return r(null,e);var i=this,o=t.properties;n.series([function(t){if(null==o["*"])return t();var r=o["*"];n.eachSeries(Object.keys(e),(function(t,n){if(t in o)return n();i._deeperObject(t),i._asyncSanitize(r,e[t],(function(r,o){void 0!==o&&(e[t]=o),i._back(),n()}))}),t)},function(t){n.eachSeries(Object.keys(o),(function(t,r){if("*"===t)return r();i._deeperObject(t),i._asyncSanitize(o[t],e[t],(function(n,o){if(n)return r(n);void 0!==o&&(e[t]=o),i._back(),r()}))}),t)}],(function(t){return r(t,e)}))},asyncItems:function(t,e,r){if(!(t.items instanceof Object&&e instanceof Object))return r(null,e);var i=this,o=t.items;if(u.array(o)&&u.array(e)){var s=o.length<e.length?o.length:e.length;n.timesSeries(s,(function(t,r){i._deeperArray(t),i._asyncSanitize(o[t],e[t],(function(n,o){if(n)return r(n);e[t]=o,i._back(),r()}))}),(function(t){r(t,e)}))}else n.eachSeries(Object.keys(e),(function(t,r){i._deeperArray(t),i._asyncSanitize(o,e[t],(function(n,o){if(n)return r();e[t]=o,i._back(),r()}))}),(function(t){r(t,e)}));return e}};function v(t,e){a.prototype.constructor.call(this,t,o(v.custom,e));var r=[];this._basicFields=Object.keys(g),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t){var e={message:t||"was sanitized",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};r.some((function(t){return t.property===e.property}))||r.push(e)},this.result=function(t){return{data:t,reporting:r,format:function(){return this.reporting.map((function(t){return"Property "+t.property+" "+t.message})).join("\n")}}}}i(v.prototype,g),i(v.prototype,b),i(v,new s),v.prototype.sanitize=function(t,e){if(this.origin=t,"function"==typeof e){var r=this;return this._asyncSanitize(this._schema,t,(function(t,n){r.origin=null,e(t,r.result(n))}))}var n=this._sanitize(this._schema,t);return this.origin=null,this.result(n)},v.prototype._sanitize=function(t,e){return this.userAlias=t.alias||null,this._basicFields.forEach((function(r){!(r in t)&&"optional"!==r||"function"!=typeof this[r]||(e=this[r](t,e))}),this),this._customFields.forEach((function(r){r in t&&"function"==typeof this._custom[r]&&(e=this._custom[r].call(this,t,e))}),this),e},v.prototype._asyncSanitize=function(t,e,r){var i=this;this.userAlias=t.alias||null,n.waterfall([function(r){n.reduce(i._basicFields,e,(function(e,r,o){n.nextTick((function(){if((r in t||"optional"===r)&&"function"==typeof i[r]){if(i[r].length>2)return i[r](t,e,o);e=i[r](t,e)}o(null,e)}))}),r)},function(e,r){n.reduce(i._customFields,e,(function(e,r,o){n.nextTick((function(){if(r in t&&"function"==typeof i._custom[r]){if(i._custom[r].length>2)return i._custom[r].call(i,t,e,o);e=i._custom[r].call(i,t,e)}o(null,e)}))}),r)}],r)};var w=2147483647,_={int:function(t,e){return t+(0|Math.random()*(e-t+1))},float:function(t,e){return Math.random()*(e-t)+t},bool:function(){return Math.random()>.5},char:function(t,e){return String.fromCharCode(this.int(t,e))},fromList:function(t){return t[this.int(0,t.length-1)]}},S={"date-time":function(){return(new Date).toISOString()},date:function(){return(new Date).toISOString().replace(/T.*$/,"")},time:function(){return(new Date).toLocaleTimeString({},{hour12:!1})},color:function(t,e){var r="#";t<1&&(t=1);for(var n=0,i=_.int(t,e);n<i;n++)r+=_.fromList("0123456789abcdefABCDEF");return r},numeric:function(){return""+_.int(0,w)},integer:function(){return!0===_.bool()?"-"+this.numeric():this.numeric()},decimal:function(){return this.integer()+"."+this.numeric()},alpha:function(t,e){var r="";t<1&&(t=1);for(var n=0,i=_.int(t,e);n<i;n++)r+=_.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");return r},alphaNumeric:function(t,e){var r="";t<1&&(t=1);for(var n=0,i=_.int(t,e);n<i;n++)r+=_.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");return r},alphaDash:function(t,e){var r="";t<1&&(t=1);for(var n=0,i=_.int(t,e);n<i;n++)r+=_.fromList("_-abcdefghijklmnopqrstuvwxyz_-ABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789_-");return r},javascript:function(t,e){for(var r=_.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$"),n=0,i=_.int(t,e-1);n<i;n++)r+=_.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$0123456789_$");return r}};function E(t){var e=-2147483648,r=w;return null!=t.gte?e=t.gte:null!=t.gt&&(e=t.gt+1),null!=t.lte?r=t.lte:null!=t.lt&&(r=t.lt-1),{min:e,max:r}}var M={string:function(t){if(null!=t.eq)return t.eq;var e="",r=null!=t.minLength?t.minLength:0,n=null!=t.maxLength?t.maxLength:32;if("string"==typeof t.pattern&&"function"==typeof S[t.pattern])return S[t.pattern](r,n);for(var i=null!=t.exactLength?t.exactLength:_.int(r,n),o=0;o<i;o++)e+=_.char(32,126);return e},number:function(t){if(null!=t.eq)return t.eq;var e=E(t),r=_.float(e.min,e.max);if(null!=t.ne)for(var n=u.array(t.ne)?t.ne:[t.ne];-1!==n.indexOf(r);)r=_.float(e.min,e.max);return r},integer:function(t){if(null!=t.eq)return t.eq;var e=E(t),r=_.int(e.min,e.max);if(null!=t.ne)for(var n=u.array(t.ne)?t.ne:[t.ne];-1!==n.indexOf(r);)r=_.int(e.min,e.max);return r},boolean:function(t){return null!=t.eq?t.eq:_.bool()},null:function(t){return null},date:function(t){return null!=t.eq?t.eq:new Date},object:function(t){var e={},r=t.properties||{};for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){if(!0===r[n].optional&&!0===_.bool())continue;if("*"!==n)e[n]=this.generate(r[n]);else for(var i="__random_key_",o=i+0,s=_.int(1,9),a=1;a<=s;a++)o in r||(e[o]=this.generate(r[n])),o=i+a}return e},array:function(t){var e,r,n,i,o=t.items||{},s=null!=t.minLength?t.minLength:0,a=null!=t.maxLength?t.maxLength:16;if(u.array(o))for(n=o.length,null!=t.exactLength?n=t.exactLength:n<s?n=s:n>a&&(n=a),r=new Array(n),e=null,i=0;i<n;i++)e=o[i].type||"any",u.array(e)&&(e=e[_.int(0,e.length-1)]),r[i]=this[e](o[i]);else for(n=null!=t.exactLength?t.exactLength:_.int(s,a),r=new Array(n),e=o.type||"any",u.array(e)&&(e=e[_.int(0,e.length-1)]),i=0;i<n;i++)r[i]=this[e](o);return r},any:function(t){var e=Object.keys(M);return this[e[_.int(0,e.length-2)]](t)}};function k(){}i(k.prototype,M);var A=null;k.instance=function(){return A instanceof k||(A=new k),A},k.prototype.generate=function(t){var e=t.type||"any";return u.array(e)&&(e=e[_.int(0,e.length-1)]),this[e](t)};var O={};t.exports?t.exports=O:window.SchemaInspector=O,O.newSanitization=function(t,e){return new v(t,e)},O.newValidation=function(t,e){return new p(t,e)},O.Validation=p,O.Sanitization=v,O.sanitize=function(t,e,r,n){return 3===arguments.length&&"function"==typeof r&&(n=r,r=null),new v(t,r).sanitize(e,n)},O.validate=function(t,e,r,n){return 3===arguments.length&&"function"==typeof r&&(n=r,r=null),new p(t,r).validate(e,n)},O.generate=function(t,e){if("number"==typeof e){for(var r=new Array(e),n=0;n<e;n++)r[n]=k.instance().generate(t);return r}return k.instance().generate(t)}}()},3327:(t,e,r)=>{var n=r(7834).Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,s=this._len,a=0;a<o;){for(var u=s%i,f=Math.min(o-a,i-u),h=0;h<f;h++)r[u+h]=t[a+h];a+=f,(s+=f)%i==0&&this._update(r)}return this._len+=o,this},i.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},9065:(t,e,r)=>{var n=t.exports=function(t){t=t.toLowerCase();var e=n[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};n.sha=r(8820),n.sha1=r(7885),n.sha224=r(8321),n.sha256=r(4424),n.sha384=r(213),n.sha512=r(5596)},8820:(t,e,r)=>{var n=r(1285),i=r(3327),o=r(7834).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function f(t){return t<<30|t>>>2}function h(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<80;++c)r[c]=r[c-3]^r[c-8]^r[c-14]^r[c-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((e=n)<<5|e>>>27)+h(d,i,o,a)+u+r[l]+s[d];u=a,a=o,o=f(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},7885:(t,e,r)=>{var n=r(1285),i=r(3327),o=r(7834).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function f(t){return t<<5|t>>>27}function h(t){return t<<30|t>>>2}function c(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=(e=r[l-3]^r[l-8]^r[l-14]^r[l-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),y=f(n)+c(p,i,o,a)+u+r[d]+s[p]|0;u=a,a=o,o=h(i),i=n,n=y}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},8321:(t,e,r)=>{var n=r(1285),i=r(4424),o=r(3327),s=r(7834).Buffer,a=new Array(64);function u(){this.init(),this._w=a,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=s.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},4424:(t,e,r)=>{var n=r(1285),i=r(3327),o=r(7834).Buffer,s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function u(){this.init(),this._w=a,i.call(this,64,56)}function f(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function c(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function l(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}n(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,p=0|this._f,y=0|this._g,m=0|this._h,g=0;g<16;++g)r[g]=t.readInt32BE(4*g);for(;g<64;++g)r[g]=0|(((e=r[g-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[g-7]+d(r[g-15])+r[g-16];for(var b=0;b<64;++b){var v=m+l(u)+f(u,p,y)+s[b]+r[b]|0,w=c(n)+h(n,i,o)|0;m=y,y=p,p=u,u=a+v|0,a=o,o=i,i=n,n=v+w|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=y+this._g|0,this._h=m+this._h|0},u.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},213:(t,e,r)=>{var n=r(1285),i=r(5596),o=r(3327),s=r(7834).Buffer,a=new Array(160);function u(){this.init(),this._w=a,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=s.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=u},5596:(t,e,r)=>{var n=r(1285),i=r(3327),o=r(7834).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}function f(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function c(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function l(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function y(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function g(t,e){return t>>>0<e>>>0?1:0}n(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,u=0|this._fh,b=0|this._gh,v=0|this._hh,w=0|this._al,_=0|this._bl,S=0|this._cl,E=0|this._dl,M=0|this._el,k=0|this._fl,A=0|this._gl,O=0|this._hl,I=0;I<32;I+=2)e[I]=t.readInt32BE(4*I),e[I+1]=t.readInt32BE(4*I+4);for(;I<160;I+=2){var T=e[I-30],x=e[I-30+1],P=d(T,x),B=p(x,T),N=y(T=e[I-4],x=e[I-4+1]),U=m(x,T),R=e[I-14],L=e[I-14+1],C=e[I-32],j=e[I-32+1],F=B+L|0,H=P+R+g(F,B)|0;H=(H=H+N+g(F=F+U|0,U)|0)+C+g(F=F+j|0,j)|0,e[I]=H,e[I+1]=F}for(var D=0;D<160;D+=2){H=e[D],F=e[D+1];var q=h(r,n,i),z=h(w,_,S),$=c(r,w),K=c(w,r),W=l(a,M),V=l(M,a),G=s[D],X=s[D+1],J=f(a,u,b),Z=f(M,k,A),Y=O+V|0,Q=v+W+g(Y,O)|0;Q=(Q=(Q=Q+J+g(Y=Y+Z|0,Z)|0)+G+g(Y=Y+X|0,X)|0)+H+g(Y=Y+F|0,F)|0;var tt=K+z|0,et=$+q+g(tt,K)|0;v=b,O=A,b=u,A=k,u=a,k=M,a=o+Q+g(M=E+Y|0,E)|0,o=i,E=S,i=n,S=_,n=r,_=w,r=Q+et+g(w=Y+tt|0,Y)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+S|0,this._dl=this._dl+E|0,this._el=this._el+M|0,this._fl=this._fl+k|0,this._gl=this._gl+A|0,this._hl=this._hl+O|0,this._ah=this._ah+r+g(this._al,w)|0,this._bh=this._bh+n+g(this._bl,_)|0,this._ch=this._ch+i+g(this._cl,S)|0,this._dh=this._dh+o+g(this._dl,E)|0,this._eh=this._eh+a+g(this._el,M)|0,this._fh=this._fh+u+g(this._fl,k)|0,this._gh=this._gh+b+g(this._gl,A)|0,this._hh=this._hh+v+g(this._hl,O)|0},u.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u},4851:(t,e,r)=>{t.exports=i;var n=r(2699).EventEmitter;function i(){n.call(this)}r(1285)(i,n),i.Readable=r(8051),i.Writable=r(2557),i.Duplex=r(7073),i.Transform=r(7640),i.PassThrough=r(5163),i.finished=r(9885),i.pipeline=r(3495),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",u));var s=!1;function a(){s||(s=!0,t.end())}function u(){s||(s=!0,"function"==typeof t.destroy&&t.destroy())}function f(t){if(h(),0===n.listenerCount(this,"error"))throw t}function h(){r.removeListener("data",i),t.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",f),t.removeListener("error",f),r.removeListener("end",h),r.removeListener("close",h),t.removeListener("close",h)}return r.on("error",f),t.on("error",f),r.on("end",h),r.on("close",h),t.on("close",h),t.emit("pipe",r),t}},214:(t,e,r)=>{"use strict";var n=r(7834).Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=f,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=h,this.end=c,e=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function f(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function h(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function c(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.s=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var i=s(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||-2===i?0:(i=s(e[n]))>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||-2===i?0:(i=s(e[n]))>=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},701:(t,e,r)=>{var n=r(8834).Buffer;const i=r(1095),o=new(0,r(7554).ec)("secp256k1"),s=r(9624),a=n.alloc(32,0),u=n.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),f=n.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),h=o.curve.n,c=h.shrn(1),l=o.curve.g,d="Expected Private",p="Expected Point",y="Expected Tweak",m="Expected Hash";function g(t){return n.isBuffer(t)&&32===t.length}function b(t){return!!g(t)&&t.compare(u)<0}function v(t){if(!n.isBuffer(t))return!1;if(t.length<33)return!1;const e=t[0],r=t.slice(1,33);if(0===r.compare(a))return!1;if(r.compare(f)>=0)return!1;if((2===e||3===e)&&33===t.length){try{k(t)}catch(t){return!1}return!0}const i=t.slice(33);return 0!==i.compare(a)&&!(i.compare(f)>=0)&&4===e&&65===t.length}function w(t){return 4!==t[0]}function _(t){return!!g(t)&&t.compare(a)>0&&t.compare(u)<0}function S(t,e){return void 0===t&&void 0!==e?w(e):void 0===t||t}function E(t){return new i(t)}function M(t){return t.toArrayLike(n,"be",32)}function k(t){return o.curve.decodePoint(t)}function A(t,e){return n.from(t._encode(e))}function O(t,e,r){if(!g(t))throw new TypeError(m);if(!_(e))throw new TypeError(d);if(void 0!==r&&!g(r))throw new TypeError("Expected Extra Data (32 bytes)");const i=E(e),o=E(t);let a,u;s(t,e,(function(t){const e=E(t),r=l.mul(e);return!r.isInfinity()&&(a=r.x.umod(h),0!==a.isZero()&&(u=e.invm(h).mul(o.add(i.mul(a))).umod(h),0!==u.isZero()))}),_,r),u.cmp(c)>0&&(u=h.sub(u));const f=n.allocUnsafe(64);return M(a).copy(f,0),M(u).copy(f,32),f}t.exports={isPoint:v,isPointCompressed:function(t){return!!v(t)&&w(t)},isPrivate:_,pointAdd:function(t,e,r){if(!v(t))throw new TypeError(p);if(!v(e))throw new TypeError(p);const n=k(t),i=k(e),o=n.add(i);return o.isInfinity()?null:A(o,S(r,t))},pointAddScalar:function(t,e,r){if(!v(t))throw new TypeError(p);if(!b(e))throw new TypeError(y);const n=S(r,t),i=k(t);if(0===e.compare(a))return A(i,n);const o=E(e),s=l.mul(o),u=i.add(s);return u.isInfinity()?null:A(u,n)},pointCompress:function(t,e){if(!v(t))throw new TypeError(p);const r=k(t);if(r.isInfinity())throw new TypeError(p);return A(r,S(e,t))},pointFromScalar:function(t,e){if(!_(t))throw new TypeError(d);const r=E(t),n=l.mul(r);return n.isInfinity()?null:A(n,S(e))},pointMultiply:function(t,e,r){if(!v(t))throw new TypeError(p);if(!b(e))throw new TypeError(y);const n=S(r,t),i=k(t),o=E(e),s=i.mul(o);return s.isInfinity()?null:A(s,n)},privateAdd:function(t,e){if(!_(t))throw new TypeError(d);if(!b(e))throw new TypeError(y);const r=E(t),n=E(e),i=M(r.add(n).umod(h));return _(i)?i:null},privateSub:function(t,e){if(!_(t))throw new TypeError(d);if(!b(e))throw new TypeError(y);const r=E(t),n=E(e),i=M(r.sub(n).umod(h));return _(i)?i:null},sign:function(t,e){return O(t,e)},signWithEntropy:function(t,e,r){return O(t,e,r)},verify:function(t,e,r,i){if(!g(t))throw new TypeError(m);if(!v(e))throw new TypeError(p);if(!function(t){const e=t.slice(0,32),r=t.slice(32,64);return n.isBuffer(t)&&64===t.length&&e.compare(u)<0&&r.compare(u)<0}(r))throw new TypeError("Expected Signature");const o=k(e),s=E(r.slice(0,32)),a=E(r.slice(32,64));if(i&&a.cmp(c)>0)return!1;if(s.gtn(0)<=0)return!1;if(a.gtn(0)<=0)return!1;const f=E(t),d=a.invm(h),y=f.mul(d).umod(h),b=s.mul(d).umod(h),w=l.mulAdd(y,o,b);return!w.isInfinity()&&w.x.umod(h).eq(s)}}},1095:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(2728).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function f(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=u(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=f(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=f(t,h,t.length,e),h=0;h<s;h++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var f=1;f<n;f++){for(var h=u>>>26,c=67108863&u,l=Math.min(f,e.length-1),d=Math.max(0,f-t.length+1);d<=l;d++){var p=f-d|0;h+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[f]=0|c,u=0|h}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?h[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var f=c[t],d=l[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?y+r:h[f-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,f=new t(o),h=this.clone();if(u){for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),f[a]=s;for(;a<o;a++)f[a]=0}else{for(a=0;a<o-i;a++)f[a]=0;for(a=0;!h.isZero();a++)s=h.andln(255),h.iushrn(8),f[o-a-1]=s}return f},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,f=0,h=0|s[0],c=8191&h,l=h>>>13,d=0|s[1],p=8191&d,y=d>>>13,m=0|s[2],g=8191&m,b=m>>>13,v=0|s[3],w=8191&v,_=v>>>13,S=0|s[4],E=8191&S,M=S>>>13,k=0|s[5],A=8191&k,O=k>>>13,I=0|s[6],T=8191&I,x=I>>>13,P=0|s[7],B=8191&P,N=P>>>13,U=0|s[8],R=8191&U,L=U>>>13,C=0|s[9],j=8191&C,F=C>>>13,H=0|a[0],D=8191&H,q=H>>>13,z=0|a[1],$=8191&z,K=z>>>13,W=0|a[2],V=8191&W,G=W>>>13,X=0|a[3],J=8191&X,Z=X>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ht=0|a[8],ct=8191&ht,lt=ht>>>13,dt=0|a[9],pt=8191&dt,yt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(f+(n=Math.imul(c,D))|0)+((8191&(i=(i=Math.imul(c,q))+Math.imul(l,D)|0))<<13)|0;f=((o=Math.imul(l,q))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,D),i=(i=Math.imul(p,q))+Math.imul(y,D)|0,o=Math.imul(y,q);var gt=(f+(n=n+Math.imul(c,$)|0)|0)+((8191&(i=(i=i+Math.imul(c,K)|0)+Math.imul(l,$)|0))<<13)|0;f=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,D),i=(i=Math.imul(g,q))+Math.imul(b,D)|0,o=Math.imul(b,q),n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,K)|0;var bt=(f+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(l,V)|0))<<13)|0;f=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,D),i=(i=Math.imul(w,q))+Math.imul(_,D)|0,o=Math.imul(_,q),n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,K)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,K)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,G)|0;var vt=(f+(n=n+Math.imul(c,J)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(l,J)|0))<<13)|0;f=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(E,D),i=(i=Math.imul(E,q))+Math.imul(M,D)|0,o=Math.imul(M,q),n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,G)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Z)|0;var wt=(f+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;f=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,D),i=(i=Math.imul(A,q))+Math.imul(O,D)|0,o=Math.imul(O,q),n=n+Math.imul(E,$)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,K)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(g,J)|0,i=(i=i+Math.imul(g,Z)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0;var _t=(f+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(l,rt)|0))<<13)|0;f=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,D),i=(i=Math.imul(T,q))+Math.imul(x,D)|0,o=Math.imul(x,q),n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,K)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0;var St=(f+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(l,ot)|0))<<13)|0;f=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(B,D),i=(i=Math.imul(B,q))+Math.imul(N,D)|0,o=Math.imul(N,q),n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,K)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(E,J)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Z)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=(i=i+Math.imul(g,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0;var Et=(f+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(l,ut)|0))<<13)|0;f=((o=o+Math.imul(l,ft)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,D),i=(i=Math.imul(R,q))+Math.imul(L,D)|0,o=Math.imul(L,q),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,K)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(g,ot)|0,i=(i=i+Math.imul(g,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ft)|0;var Mt=(f+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;f=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(j,D),i=(i=Math.imul(j,q))+Math.imul(F,D)|0,o=Math.imul(F,q),n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,K)|0,n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(g,ut)|0,i=(i=i+Math.imul(g,ft)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ft)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var kt=(f+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,yt)|0)+Math.imul(l,pt)|0))<<13)|0;f=((o=o+Math.imul(l,yt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,K))+Math.imul(F,$)|0,o=Math.imul(F,K),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Z)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Z)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ft)|0,n=n+Math.imul(g,ct)|0,i=(i=i+Math.imul(g,lt)|0)+Math.imul(b,ct)|0,o=o+Math.imul(b,lt)|0;var At=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,yt)|0)+Math.imul(y,pt)|0))<<13)|0;f=((o=o+Math.imul(y,yt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,G))+Math.imul(F,V)|0,o=Math.imul(F,G),n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ft)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ft)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var Ot=(f+(n=n+Math.imul(g,pt)|0)|0)+((8191&(i=(i=i+Math.imul(g,yt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((o=o+Math.imul(b,yt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(j,J),i=(i=Math.imul(j,Z))+Math.imul(F,J)|0,o=Math.imul(F,Z),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ft)|0,n=n+Math.imul(E,ct)|0,i=(i=i+Math.imul(E,lt)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,lt)|0;var It=(f+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,yt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((o=o+Math.imul(_,yt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ft)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ft)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(O,ct)|0,o=o+Math.imul(O,lt)|0;var Tt=(f+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,yt)|0)+Math.imul(M,pt)|0))<<13)|0;f=((o=o+Math.imul(M,yt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(F,rt)|0,o=Math.imul(F,nt),n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ft)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ft)|0,n=n+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(f+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,yt)|0)+Math.imul(O,pt)|0))<<13)|0;f=((o=o+Math.imul(O,yt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,ot),i=(i=Math.imul(j,st))+Math.imul(F,ot)|0,o=Math.imul(F,st),n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ft)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ft)|0,n=n+Math.imul(B,ct)|0,i=(i=i+Math.imul(B,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(f+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,yt)|0)+Math.imul(x,pt)|0))<<13)|0;f=((o=o+Math.imul(x,yt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(j,ut),i=(i=Math.imul(j,ft))+Math.imul(F,ut)|0,o=Math.imul(F,ft),n=n+Math.imul(R,ct)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(L,ct)|0,o=o+Math.imul(L,lt)|0;var Bt=(f+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,yt)|0)+Math.imul(N,pt)|0))<<13)|0;f=((o=o+Math.imul(N,yt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,ct),i=(i=Math.imul(j,lt))+Math.imul(F,ct)|0,o=Math.imul(F,lt);var Nt=(f+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,yt)|0)+Math.imul(L,pt)|0))<<13)|0;f=((o=o+Math.imul(L,yt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Ut=(f+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,yt))+Math.imul(F,pt)|0))<<13)|0;return f=((o=Math.imul(F,yt))+(i>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,u[0]=mt,u[1]=gt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=St,u[7]=Et,u[8]=Mt,u[9]=kt,u[10]=At,u[11]=Ot,u[12]=It,u[13]=Tt,u[14]=xt,u[15]=Pt,u[16]=Bt,u[17]=Nt,u[18]=Ut,0!==f&&(u[19]=f,r.length++),r};function y(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),f=Math.max(0,o-t.length+1);f<=u;f++){var h=o-f,c=(0|t.words[h])*(0|e.words[f]),l=67108863&c;a=67108863&(l=l+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):y(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),f=Math.sin(2*Math.PI/a),h=0;h<i;h+=a)for(var c=u,l=f,d=0;d<s;d++){var p=r[h+d],y=n[h+d],m=r[h+d+s],g=n[h+d+s],b=c*m-l*g;g=c*g+l*m,m=b,r[h+d]=p+m,n[h+d]=y+g,r[h+d+s]=p-m,n[h+d+s]=y-g,d!==a&&(b=u*c-f*l,l=u*l+f*c,c=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,r,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)r[s]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),f=new Array(n),h=new Array(n),c=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,f,n),this.transform(s,o,a,u,n,i),this.transform(f,o,h,c,n,i);for(var d=0;d<n;d++){var p=a[d]*h[d]-u[d]*c[d];u[d]=a[d]*c[d]+u[d]*h[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),y(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var f=0;f<s;f++)u.words[f]=this.words[f];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,f=0;f<this.length;f++)this.words[f]=this.words[f+s];else this.words[0]=0,this.length=1;var h=0;for(f=this.length-1;f>=0&&(0!==h||f>=i);f--){var c=0|this.words[f];this.words[f]=h<<26-o|c>>>o,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var i,o,s=t.length+r;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var f=0;f<a.length;f++)a.words[f]=0}var h=n.clone()._ishlnsubmul(i,1,u);0===h.negative&&(n=h,a&&(a.words[u]=1));for(var c=u-1;c>=0;c--){var l=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),f=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++f;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(h),s.isub(c)),i.iushrn(1),s.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a,b:u,gcd:r.iushln(f)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new E(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(v,b),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,b),i(_,b),i(S,b),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return g[t]=e,e},E.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,f).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var y=d,m=0;0!==y.cmp(a);m++)y=y.redSqr();n(m<p);var g=this.pow(c,new o(1).iushln(p-m-1));l=l.redMul(g),c=g.redSqr(),d=d.redMul(c),p=m}return l},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var f=e.words[n],h=u-1;h>=0;h--){var c=f>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==s?(s<<=1,s|=c,(4==++a||0===n&&0===h)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,E),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},9624:(t,e,r)=>{var n=r(8834).Buffer;const i=r(11),o=n.alloc(1,1),s=n.alloc(1,0);t.exports=function(t,e,r,a,u){let f=n.alloc(32,0),h=n.alloc(32,1);f=i("sha256",f).update(h).update(s).update(e).update(t).update(u||"").digest(),h=i("sha256",f).update(h).digest(),f=i("sha256",f).update(h).update(o).update(e).update(t).update(u||"").digest(),h=i("sha256",f).update(h).digest(),h=i("sha256",f).update(h).digest();let c=h;for(;!a(c)||!r(c);)f=i("sha256",f).update(h).update(s).digest(),h=i("sha256",f).update(h).digest(),h=i("sha256",f).update(h).digest(),c=h;return c}},1589:(t,e,r)=>{var n=r(9522);function i(t){return t.name||t.toString().match(/function (.*?)\s*\(/)[1]}function o(t){return n.Nil(t)?"":i(t.constructor)}function s(t,e){Error.captureStackTrace&&Error.captureStackTrace(t,e)}function a(t){return n.Function(t)?t.toJSON?t.toJSON():i(t):n.Array(t)?"Array":t&&n.Object(t)?"Object":void 0!==t?t:""}function u(t,e,r){var i=function(t){return n.Function(t)?"":n.String(t)?JSON.stringify(t):t&&n.Object(t)?"":t}(e);return"Expected "+a(t)+", got"+(""!==r?" "+r:"")+(""!==i?" "+i:"")}function f(t,e,r){r=r||o(e),this.message=u(t,e,r),s(this,f),this.__type=t,this.__value=e,this.__valueTypeName=r}function h(t,e,r,n,i){t?(i=i||o(n),this.message=function(t,e,r,n,i){var o='" of type ';return"key"===e&&(o='" with key type '),u('property "'+a(r)+o+a(t),n,i)}(t,r,e,n,i)):this.message='Unexpected property "'+e+'"',s(this,f),this.__label=r,this.__property=e,this.__type=t,this.__value=n,this.__valueTypeName=i}f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,h.prototype=Object.create(Error.prototype),h.prototype.constructor=f,t.exports={TfTypeError:f,TfPropertyTypeError:h,tfCustomError:function(t,e){return new f(t,{},e)},tfSubError:function(t,e,r){return t instanceof h?(e=e+"."+t.__property,t=new h(t.__type,e,t.__label,t.__value,t.__valueTypeName)):t instanceof f&&(t=new h(t.__type,e,r,t.__value,t.__valueTypeName)),s(t),t},tfJSON:a,getValueTypeName:o}},9828:(t,e,r)=>{var n=r(8834).Buffer,i=r(9522),o=r(1589);function s(t){return n.isBuffer(t)}function a(t){return"string"==typeof t&&/^([0-9a-f]{2})+$/i.test(t)}function u(t,e){var r=t.toJSON();function n(n){if(!t(n))return!1;if(n.length===e)return!0;throw o.tfCustomError(r+"(Length: "+e+")",r+"(Length: "+n.length+")")}return n.toJSON=function(){return r},n}var f=u.bind(null,i.Array),h=u.bind(null,s),c=u.bind(null,a),l=u.bind(null,i.String),d=Math.pow(2,53)-1,p={ArrayN:f,Buffer:s,BufferN:h,Finite:function(t){return"number"==typeof t&&isFinite(t)},Hex:a,HexN:c,Int8:function(t){return t<<24>>24===t},Int16:function(t){return t<<16>>16===t},Int32:function(t){return(0|t)===t},Int53:function(t){return"number"==typeof t&&t>=-d&&t<=d&&Math.floor(t)===t},Range:function(t,e,r){function n(n,i){return r(n,i)&&n>t&&n<e}return r=r||i.Number,n.toJSON=function(){return`${r.toJSON()} between [${t}, ${e}]`},n},StringN:l,UInt8:function(t){return(255&t)===t},UInt16:function(t){return(65535&t)===t},UInt32:function(t){return t>>>0===t},UInt53:function(t){return"number"==typeof t&&t>=0&&t<=d&&Math.floor(t)===t}};for(var y in p)p[y].toJSON=function(t){return t}.bind(null,y);t.exports=p},9031:(t,e,r)=>{var n=r(1589),i=r(9522),o=n.tfJSON,s=n.TfTypeError,a=n.TfPropertyTypeError,u=n.tfSubError,f=n.getValueTypeName,h={arrayOf:function(t,e){function r(r,n){return!!i.Array(r)&&!i.Nil(r)&&!(void 0!==e.minLength&&r.length<e.minLength)&&!(void 0!==e.maxLength&&r.length>e.maxLength)&&(void 0===e.length||r.length===e.length)&&r.every((function(e,r){try{return l(t,e,n)}catch(t){throw u(t,r)}}))}return t=c(t),e=e||{},r.toJSON=function(){var r="["+o(t)+"]";return void 0!==e.length?r+="{"+e.length+"}":void 0===e.minLength&&void 0===e.maxLength||(r+="{"+(void 0===e.minLength?0:e.minLength)+","+(void 0===e.maxLength?1/0:e.maxLength)+"}"),r},r},maybe:function t(e){function r(r,n){return i.Nil(r)||e(r,n,t)}return e=c(e),r.toJSON=function(){return"?"+o(e)},r},map:function(t,e){function r(r,n){if(!i.Object(r))return!1;if(i.Nil(r))return!1;for(var o in r){try{e&&l(e,o,n)}catch(t){throw u(t,o,"key")}try{var s=r[o];l(t,s,n)}catch(t){throw u(t,o)}}return!0}return t=c(t),e&&(e=c(e)),r.toJSON=e?function(){return"{"+o(e)+": "+o(t)+"}"}:function(){return"{"+o(t)+"}"},r},object:function(t){var e={};for(var r in t)e[r]=c(t[r]);function n(t,r){if(!i.Object(t))return!1;if(i.Nil(t))return!1;var n;try{for(n in e)l(e[n],t[n],r)}catch(t){throw u(t,n)}if(r)for(n in t)if(!e[n])throw new a(void 0,n);return!0}return n.toJSON=function(){return o(e)},n},anyOf:function(){var t=[].slice.call(arguments).map(c);function e(e,r){return t.some((function(t){try{return l(t,e,r)}catch(t){return!1}}))}return e.toJSON=function(){return t.map(o).join("|")},e},allOf:function(){var t=[].slice.call(arguments).map(c);function e(e,r){return t.every((function(t){try{return l(t,e,r)}catch(t){return!1}}))}return e.toJSON=function(){return t.map(o).join(" & ")},e},quacksLike:function(t){function e(e){return t===f(e)}return e.toJSON=function(){return t},e},tuple:function(){var t=[].slice.call(arguments).map(c);function e(e,r){return!i.Nil(e)&&!i.Nil(e.length)&&(!r||e.length===t.length)&&t.every((function(t,n){try{return l(t,e[n],r)}catch(t){throw u(t,n)}}))}return e.toJSON=function(){return"("+t.map(o).join(", ")+")"},e},value:function(t){function e(e){return e===t}return e.toJSON=function(){return t},e}};function c(t){if(i.String(t))return"?"===t[0]?h.maybe(t.slice(1)):i[t]||h.quacksLike(t);if(t&&i.Object(t)){if(i.Array(t)){if(1!==t.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return h.arrayOf(t[0])}return h.object(t)}return i.Function(t)?t:h.value(t)}function l(t,e,r,n){if(i.Function(t)){if(t(e,r))return!0;throw new s(n||t,e)}return l(c(t),e,r)}for(var d in h.oneOf=h.anyOf,i)l[d]=i[d];for(d in h)l[d]=h[d];var p=r(9828);for(d in p)l[d]=p[d];l.compile=c,l.TfTypeError=s,l.TfPropertyTypeError=a,t.exports=l},9522:t=>{var e={Array:function(t){return null!=t&&t.constructor===Array},Boolean:function(t){return"boolean"==typeof t},Function:function(t){return"function"==typeof t},Nil:function(t){return null==t},Number:function(t){return"number"==typeof t},Object:function(t){return"object"==typeof t},String:function(t){return"string"==typeof t},"":function(){return!0}};for(var r in e.Null=e.Nil,e)e[r].toJSON=function(t){return t}.bind(null,r);t.exports=e},5803:(t,e,r)=>{function n(t){try{if(!r.g.localStorage)return!1}catch(t){return!1}var e=r.g.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}},8595:(t,e,r)=>{"use strict";var n=r(7834).Buffer;function i(t){if(t<0||t>9007199254740991||t%1!=0)throw new RangeError("value out of range")}function o(t){return i(t),t<253?1:t<=65535?3:t<=4294967295?5:9}t.exports={encode:function t(e,r,s){if(i(e),r||(r=n.allocUnsafe(o(e))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return s||(s=0),e<253?(r.writeUInt8(e,s),t.bytes=1):e<=65535?(r.writeUInt8(253,s),r.writeUInt16LE(e,s+1),t.bytes=3):e<=4294967295?(r.writeUInt8(254,s),r.writeUInt32LE(e,s+1),t.bytes=5):(r.writeUInt8(255,s),r.writeUInt32LE(e>>>0,s+1),r.writeUInt32LE(e/4294967296|0,s+5),t.bytes=9),r},decode:function t(e,r){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var o=e.readUInt8(r);if(o<253)return t.bytes=1,o;if(253===o)return t.bytes=3,e.readUInt16LE(r+1);if(254===o)return t.bytes=5,e.readUInt32LE(r+1);t.bytes=9;var s=e.readUInt32LE(r+1),a=4294967296*e.readUInt32LE(r+5)+s;return i(a),a},encodingLength:o}},1384:(t,e,r)=>{var n=r(8834).Buffer,i=r(4075);function o(t,e){if(void 0!==e&&t[0]!==e)throw new Error("Invalid network version");if(33===t.length)return{version:t[0],privateKey:t.slice(1,33),compressed:!1};if(34!==t.length)throw new Error("Invalid WIF length");if(1!==t[33])throw new Error("Invalid compression flag");return{version:t[0],privateKey:t.slice(1,33),compressed:!0}}function s(t,e,r){var i=new n(r?34:33);return i.writeUInt8(t,0),e.copy(i,1),r&&(i[33]=1),i}t.exports={decode:function(t,e){return o(i.decode(t),e)},decodeRaw:o,encode:function(t,e,r){return"number"==typeof t?i.encode(s(t,e,r)):i.encode(s(t.version,t.privateKey,t.compressed))},encodeRaw:s}},2377:(t,e,r)=>{"use strict";t.exports=r(8613)},8613:(t,e)=>{"use strict";function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function i(t,e){return void 0===e&&(e="{$origin}\n{$ttl}\n\n; SOA Record\n{name} {ttl} IN SOA {mname}{rname}(\n{serial} ;serial\n{refresh} ;refresh\n{retry} ;retry\n{expire} ;expire\n{minimum} ;minimum ttl\n)\n\n; NS Records\n{ns}\n\n; MX Records\n{mx}\n\n; A Records\n{a}\n\n; AAAA Records\n{aaaa}\n\n; CNAME Records\n{cname}\n\n; PTR Records\n{ptr}\n\n; TXT Records\n{txt}\n\n; SRV Records\n{srv}\n\n; SPF Records\n{spf}\n\n; URI Records\n{uri}\n"),e=function(t,e){var r="";return void 0!==t&&(r+="$ORIGIN "+t),e.replace("{$origin}",r)}(t.$origin,e),e=function(t,e){var r="";return void 0!==t&&(r+="$TTL "+t),e.replace("{$ttl}",r)}(t.$ttl,e),e=function(t,e){var r=e;if(void 0!==t)for(var n in t.name=t.name||"@",t.ttl=t.ttl||"",t)r=r.replace("{"+n+"}",t[n]+"\t");return r}(t.soa,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tNS\t"+s.host+"\n"}return e.replace("{ns}",r)}(t.ns,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tA\t"+s.ip+"\n"}return e.replace("{a}",r)}(t.a,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tAAAA\t"+s.ip+"\n"}return e.replace("{aaaa}",r)}(t.aaaa,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tCNAME\t"+s.alias+"\n"}return e.replace("{cname}",r)}(t.cname,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tMX\t"+s.preference+"\t"+s.host+"\n"}return e.replace("{mx}",r)}(t.mx,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tPTR\t"+s.host+"\n"}return e.replace("{ptr}",r)}(t.ptr,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tTXT\t";var a=s.txt;"string"==typeof a?r+='"'+a+'"':a instanceof Array&&(r+=a.map((function(t){return'"'+t+'"'})).join(" ")),r+="\n"}return e.replace("{txt}",r)}(t.txt,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tSRV\t"+s.priority+"\t",r+=s.weight+"\t",r+=s.port+"\t",r+=s.target+"\n"}return e.replace("{srv}",r)}(t.srv,e),e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tSPF\t"+s.data+"\n"}return e.replace("{spf}",r)}(t.spf,e),(e=function(t,e){e=(e=e.replace("{zone}",t.$origin||!!t.soa&&t.soa.name||"")).replace("{datetime}",(new Date).toISOString());var r=Math.round(Date.now()/1e3);return e.replace("{time}",""+r)}(t,e=function(t,e){var r="";if(t)for(var i,o=n(t);!(i=o()).done;){var s=i.value;r+=(s.name||"@")+"\t",s.ttl&&(r+=s.ttl+"\t"),r+="IN\tURI\t"+s.priority+"\t",r+=s.weight+"\t",r+='"'+s.target+'"\n'}return e.replace("{uri}",r)}(t.uri,e))).replace(/\n{2,}/gim,"\n\n")}function o(t){return function(t){for(var e,r={},i=n(t.split("\n"));!(e=i()).done;){var o=e.value;if(o&&o.trim()){var g=o.toUpperCase();/\s+TXT\s+/.test(g)?(r.txt=r.txt||[],r.txt.push(l(o))):0===g.indexOf("$ORIGIN")?r.$origin=o.split(/\s+/g)[1]:0===g.indexOf("$TTL")?r.$ttl=parseInt(o.split(/\s+/g)[1],10):/\s+SOA\s+/.test(g)?r.soa=s(o):/\s+NS\s+/.test(g)?(r.ns=r.ns||[],r.ns.push(a(o))):/\s+A\s+/.test(g)?(r.a=r.a||[],r.a.push(u(o,r.a))):/\s+AAAA\s+/.test(g)?(r.aaaa=r.aaaa||[],r.aaaa.push(f(o))):/\s+CNAME\s+/.test(g)?(r.cname=r.cname||[],r.cname.push(h(o))):/\s+MX\s+/.test(g)?(r.mx=r.mx||[],r.mx.push(c(o))):/\s+PTR\s+/.test(g)?(r.ptr=r.ptr||[],r.ptr.push(d(o,r.ptr,r.$origin))):/\s+SRV\s+/.test(g)?(r.srv=r.srv||[],r.srv.push(p(o))):/\s+SPF\s+/.test(g)?(r.spf=r.spf||[],r.spf.push(y(o))):/\s+URI\s+/.test(g)&&(r.uri=r.uri||[],r.uri.push(m(o)))}}return r}(t=function(t){for(var e=[],r=/\([\s\S]*?\)/gim,n=r.exec(t);null!==n;){var i=n[0].replace(/\s+/gm," ");e.push({match:n,replacement:i}),n=r.exec(t)}for(var o=t.split(""),s=0,a=e;s<a.length;s++){var u=a[s],f=u.match;o.splice(f.index,f[0].length,u.replacement)}return o.join("").replace(/\(|\)/gim," ")}(t=function(t){return t.replace(/(^|[^\\]);.*/g,(function(t,e){return e||""}))}(t)))}function s(t){var e={},r=t.trim().split(/\s+/g),n=r.length;return e.name=r[0],e.minimum=parseInt(r[n-1],10),e.expire=parseInt(r[n-2],10),e.retry=parseInt(r[n-3],10),e.refresh=parseInt(r[n-4],10),e.serial=parseInt(r[n-5],10),e.rname=r[n-6],e.mname=r[n-7],isNaN(r[1])||(e.ttl=parseInt(r[1],10)),e}function a(t){var e=t.trim().split(/\s+/g),r={name:e[0],host:e[e.length-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function u(t,e){var r=t.trim().split(/\s+/g),n=t.trim().toUpperCase().split(/\s+/g),i={name:r[0],ip:r[r.length-1]};return 0===n.lastIndexOf("A")&&(i.name=e.length?e[e.length-1].name:"@"),isNaN(r[1])||(i.ttl=parseInt(r[1],10)),i}function f(t){var e=t.trim().split(/\s+/g),r={name:e[0],ip:e[e.length-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function h(t){var e=t.trim().split(/\s+/g),r={name:e[0],alias:e[e.length-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function c(t){var e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],preference:parseInt(e[r-2],10),host:e[r-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function l(t){var e=t.trim().match(/[^\s"']+|"[^"]*"|'[^']*'/g);if(!e)throw new Error("Failure to tokenize TXT record");var r,n=e.length,i=e.indexOf("TXT");function o(t){return t.indexOf('"')>-1&&(t=t.split('"')[1]),t}r=n-i-1>1?[].concat(e.slice(i+1).map(o)):o(e[n-1]);var s={name:e[0],txt:r};return isNaN(e[1])||(s.ttl=parseInt(e[1],10)),s}function d(t,e,r){var n=t.trim().split(/\s+/g);0===t.trim().toUpperCase().split(/\s+/g).lastIndexOf("PTR")&&e[e.length-1]&&n.unshift(e[e.length-1].name);var i={name:n[0],fullname:n[0]+"."+r,host:n[n.length-1]};return isNaN(n[1])||(i.ttl=parseInt(n[1],10)),i}function p(t){var e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],target:e[r-1],priority:parseInt(e[r-4],10),weight:parseInt(e[r-3],10),port:parseInt(e[r-2],10)};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function y(t){for(var e=t.trim().split(/\s+/g),r={name:e[0],data:""},n=e.length;n-- >4;)r.data=e[n]+" "+r.data.trim();return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function m(t){var e=t.trim().split(/\s+/g),r=e.length,n={name:e[0],target:e[r-1].replace(/"/g,""),priority:parseInt(e[r-3],10),weight:parseInt(e[r-2],10)};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}(function(){var t=function(t){this.jsonZoneFile="object"==typeof t?JSON.parse(JSON.stringify(t)):"string"==typeof t?o(t):void 0}.prototype;t.toJSON=function(){return this.jsonZoneFile},t.toString=function(){return i(this.toJSON())}})(),e.makeZoneFile=i,e.parseZoneFile=o},9314:()=>{},3196:()=>{},8087:()=>{},9096:()=>{},488:()=>{},1812:()=>{},4854:()=>{},6602:()=>{},2728:()=>{},196:t=>{"use strict";t.exports=JSON.parse('{"OP_FALSE":0,"OP_0":0,"OP_PUSHDATA1":76,"OP_PUSHDATA2":77,"OP_PUSHDATA4":78,"OP_1NEGATE":79,"OP_RESERVED":80,"OP_TRUE":81,"OP_1":81,"OP_2":82,"OP_3":83,"OP_4":84,"OP_5":85,"OP_6":86,"OP_7":87,"OP_8":88,"OP_9":89,"OP_10":90,"OP_11":91,"OP_12":92,"OP_13":93,"OP_14":94,"OP_15":95,"OP_16":96,"OP_NOP":97,"OP_VER":98,"OP_IF":99,"OP_NOTIF":100,"OP_VERIF":101,"OP_VERNOTIF":102,"OP_ELSE":103,"OP_ENDIF":104,"OP_VERIFY":105,"OP_RETURN":106,"OP_TOALTSTACK":107,"OP_FROMALTSTACK":108,"OP_2DROP":109,"OP_2DUP":110,"OP_3DUP":111,"OP_2OVER":112,"OP_2ROT":113,"OP_2SWAP":114,"OP_IFDUP":115,"OP_DEPTH":116,"OP_DROP":117,"OP_DUP":118,"OP_NIP":119,"OP_OVER":120,"OP_PICK":121,"OP_ROLL":122,"OP_ROT":123,"OP_SWAP":124,"OP_TUCK":125,"OP_CAT":126,"OP_SUBSTR":127,"OP_LEFT":128,"OP_RIGHT":129,"OP_SIZE":130,"OP_INVERT":131,"OP_AND":132,"OP_OR":133,"OP_XOR":134,"OP_EQUAL":135,"OP_EQUALVERIFY":136,"OP_RESERVED1":137,"OP_RESERVED2":138,"OP_1ADD":139,"OP_1SUB":140,"OP_2MUL":141,"OP_2DIV":142,"OP_NEGATE":143,"OP_ABS":144,"OP_NOT":145,"OP_0NOTEQUAL":146,"OP_ADD":147,"OP_SUB":148,"OP_MUL":149,"OP_DIV":150,"OP_MOD":151,"OP_LSHIFT":152,"OP_RSHIFT":153,"OP_BOOLAND":154,"OP_BOOLOR":155,"OP_NUMEQUAL":156,"OP_NUMEQUALVERIFY":157,"OP_NUMNOTEQUAL":158,"OP_LESSTHAN":159,"OP_GREATERTHAN":160,"OP_LESSTHANOREQUAL":161,"OP_GREATERTHANOREQUAL":162,"OP_MIN":163,"OP_MAX":164,"OP_WITHIN":165,"OP_RIPEMD160":166,"OP_SHA1":167,"OP_SHA256":168,"OP_HASH160":169,"OP_HASH256":170,"OP_CODESEPARATOR":171,"OP_CHECKSIG":172,"OP_CHECKSIGVERIFY":173,"OP_CHECKMULTISIG":174,"OP_CHECKMULTISIGVERIFY":175,"OP_NOP1":176,"OP_NOP2":177,"OP_CHECKLOCKTIMEVERIFY":177,"OP_NOP3":178,"OP_CHECKSEQUENCEVERIFY":178,"OP_NOP4":179,"OP_NOP5":180,"OP_NOP6":181,"OP_NOP7":182,"OP_NOP8":183,"OP_NOP9":184,"OP_NOP10":185,"OP_PUBKEYHASH":253,"OP_PUBKEY":254,"OP_INVALIDOPCODE":255}')},763:t=>{"use strict";t.exports={i8:"6.5.4"}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var n={};return(()=>{"use strict";r.r(n),r.d(n,{BLOCKSTACK_GAIA_HUB_LABEL:()=>Ze,GaiaHubConfig:()=>t.GaiaHubConfig,Storage:()=>or,connectToGaiaHub:()=>rr,deleteFromGaiaHub:()=>Qe,getBucketUrl:()=>nr,getFullReadUrl:()=>tr,getUserAppFileUrl:()=>sr,uploadToGaiaHub:()=>Ye});var t={};r.r(t),r.d(t,{Ne:()=>Ze,cc:()=>rr,gZ:()=>Qe,CC:()=>ir,JV:()=>nr,J$:()=>tr,d_:()=>Ye});var e=r(7474);const i=["debug","info","warn","error","none"],o={},s={};for(let t=0;t<i.length;t++){const e=i[t];o[e]=t,s[t]=e}class a{static error(t){this.shouldLog("error")&&console.error(this.logMessage("error",t))}static warn(t){this.shouldLog("warn")&&console.warn(this.logMessage("warn",t))}static info(t){this.shouldLog("info")&&console.log(this.logMessage("info",t))}static debug(t){this.shouldLog("debug")&&console.log(this.logMessage("debug",t))}static logMessage(t,e){return`[${t.toUpperCase()}] ${e}`}static shouldLog(t){return o.debug<=o[t]}}var u=r(8834),f=(r(2197),r(8834).Buffer);const h=void 0!==f?f:u.Buffer;function c(t){return Number.isFinite(t)?Math.floor(1024*t*1024):0}function l(){let t=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))}function d(t,{throwIfUnavailable:e,usageDesc:n,returnEmptyObject:i}={}){let o;try{if(o=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("Unexpected runtime environment - no supported global scope (`window`, `self`, `global`) available")}(),o){const e=o[t];if(e)return e}}catch(e){a.error(`Error getting object '${t}' from global scope '${o}': ${e}`)}if(e){const e=function(t,e,r){return r?`Use of '${r}' requires \`${e}\` which is unavailable on the '${t}' object within the currently executing environment.`:`\`${e}\` is unavailable on the '${t}' object within the currently executing environment.`}(o,t.toString(),n);throw a.error(e),new Error(e)}if(i)return{}}"object"==typeof self&&"crypto"in self&&self.crypto;const p=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),y=(t,e)=>t<<32-e|t>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function m(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new TypeError("utf8ToBytes expected string, got "+typeof t);return(new TextEncoder).encode(t)}(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}function g(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0"))),(()=>{const t="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);try{if(t){const{setImmediate:e}=t("timers")}}catch(t){}})();class b{clone(){return this._cloneInto()}}class v extends b{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");g(t.outputLen),g(t.blockLen)}(t);const r=m(e);if(this.iHash=t.create(),!(this.iHash instanceof b))throw new TypeError("Expected instance of class which extends utils.Hash");const n=this.blockLen=this.iHash.blockLen;this.outputLen=this.iHash.outputLen;const i=new Uint8Array(n);i.set(r.length>this.iHash.blockLen?t.create().update(r).digest():r);for(let t=0;t<i.length;t++)i[t]^=54;this.iHash.update(i),this.oHash=t.create();for(let t=0;t<i.length;t++)i[t]^=106;this.oHash.update(i),i.fill(0)}update(t){if(this.destroyed)throw new Error("instance is destroyed");return this.iHash.update(t),this}digestInto(t){if(this.destroyed)throw new Error("instance is destroyed");if(!(t instanceof Uint8Array)||t.length!==this.outputLen)throw new Error("HMAC: Invalid output buffer");if(this.finished)throw new Error("digest() was already called");this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return(t=t).finished=n,t.destroyed=i,t.blockLen=o,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const w=(t,e,r)=>new v(t,e).update(r).digest();w.create=(t,e)=>new v(t,e);class _ extends b{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=p(this.buffer)}update(t){if(this.destroyed)throw new Error("instance is destroyed");const{view:e,buffer:r,blockLen:n,finished:i}=this;if(i)throw new Error("digest() was already called");const o=(t=m(t)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s!==n)r.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(e,0),this.pos=0);else{const e=p(t);for(;n<=o-i;i+=n)this.process(e,i)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){if(this.destroyed)throw new Error("instance is destroyed");if(!(t instanceof Uint8Array)||t.length<this.outputLen)throw new Error("_Sha2: Invalid output buffer");if(this.finished)throw new Error("digest() was already called");this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let t=o;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),u=n?4:0,f=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+f,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=p(t);this.get().forEach(((t,e)=>s.setUint32(4*e,t,i)))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return t.length=n,t.pos=s,t.finished=i,t.destroyed=o,n%e&&t.buffer.set(r),t}}const S=(t,e,r)=>t&e^t&r^e&r,E=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]),M=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),k=new Uint32Array(64);class A extends _{constructor(){super(64,32,8,!1),this.A=0|M[0],this.B=0|M[1],this.C=0|M[2],this.D=0|M[3],this.E=0|M[4],this.F=0|M[5],this.G=0|M[6],this.H=0|M[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[t,e,r,n,i,o,s,a]}set(t,e,r,n,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)k[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=k[t-15],r=k[t-2],n=y(e,7)^y(e,18)^e>>>3,i=y(r,17)^y(r,19)^r>>>10;k[t]=i+k[t-7]+n+k[t-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:f}=this;for(let t=0;t<64;t++){const e=f+(y(s,6)^y(s,11)^y(s,25))+((h=s)&a^~h&u)+E[t]+k[t]|0,c=(y(r,2)^y(r,13)^y(r,22))+S(r,n,i)|0;f=u,u=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+c|0}var h;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(r,n,i,o,s,a,u,f)}roundClean(){k.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const O=function(t){const e=e=>t().update(m(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}((()=>new A));var I=r(9314);const T=BigInt(0),x=BigInt(1),P=BigInt(2),B=BigInt(3),N=BigInt(8),U=P**BigInt(256),R={a:T,b:BigInt(7),P:U-P**BigInt(32)-BigInt(977),n:U-BigInt("432420386565659656852420866394968145599"),h:x,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")};function L(t){const{a:e,b:r}=R,n=et(t*t),i=et(n*t);return et(i+e*t+r)}const C=R.a===T;class j{constructor(t,e,r){this.x=t,this.y=e,this.z=r}static fromAffine(t){if(!(t instanceof H))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new j(t.x,t.y,x)}static toAffineBatch(t){const e=function(t,e=R.P){const r=new Array(t.length),n=nt(t.reduce(((t,n,i)=>n===T?t:(r[i]=t,et(t*n,e))),x),e);return t.reduceRight(((t,n,i)=>n===T?t:(r[i]=et(t*r[i],e),et(t*n,e))),n),r}(t.map((t=>t.z)));return t.map(((t,r)=>t.toAffine(e[r])))}static normalizeZ(t){return j.toAffineBatch(t).map(j.fromAffine)}equals(t){if(!(t instanceof j))throw new TypeError("JacobianPoint expected");const{x:e,y:r,z:n}=this,{x:i,y:o,z:s}=t,a=et(n**P),u=et(s**P),f=et(e*u),h=et(i*a),c=et(et(r*s)*u),l=et(et(o*n)*a);return f===h&&c===l}negate(){return new j(this.x,et(-this.y),this.z)}double(){const{x:t,y:e,z:r}=this,n=et(t**P),i=et(e**P),o=et(i**P),s=et(P*(et((t+i)**P)-n-o)),a=et(B*n),u=et(a**P),f=et(u-P*s),h=et(a*(s-f)-N*o),c=et(P*e*r);return new j(f,h,c)}add(t){if(!(t instanceof j))throw new TypeError("JacobianPoint expected");const{x:e,y:r,z:n}=this,{x:i,y:o,z:s}=t;if(i===T||o===T)return this;if(e===T||r===T)return t;const a=et(n**P),u=et(s**P),f=et(e*u),h=et(i*a),c=et(et(r*s)*u),l=et(et(o*n)*a),d=et(h-f),p=et(l-c);if(d===T)return p===T?this.double():j.ZERO;const y=et(d**P),m=et(d*y),g=et(f*y),b=et(p**P-m-P*g),v=et(p*(g-b)-c*m),w=et(n*s*d);return new j(b,v,w)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){let e=tt(t);j.BASE;const r=j.ZERO;if(e===T)return r;if(e===x)return this;if(!C){let t=r,n=this;for(;e>T;)e&x&&(t=t.add(n)),n=n.double(),e>>=x;return t}let{k1neg:n,k1:i,k2neg:o,k2:s}=st(e),a=r,u=r,f=this;for(;i>T||s>T;)i&x&&(a=a.add(f)),s&x&&(u=u.add(f)),f=f.double(),i>>=x,s>>=x;return n&&(a=a.negate()),o&&(u=u.negate()),u=new j(et(u.x*R.beta),u.y,u.z),a.add(u)}precomputeWindow(t){const e=C?128/t+1:256/t+1,r=[];let n=this,i=n;for(let o=0;o<e;o++){i=n,r.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(t,e){!e&&this.equals(j.BASE)&&(e=H.BASE);const r=e&&e._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=e&&F.get(e);n||(n=this.precomputeWindow(r),e&&1!==r&&(n=j.normalizeZ(n),F.set(e,n)));let i=j.ZERO,o=j.ZERO;const s=1+(C?128/r:256/r),a=2**(r-1),u=BigInt(2**r-1),f=2**r,h=BigInt(r);for(let e=0;e<s;e++){const r=e*a;let s=Number(t&u);if(t>>=h,s>a&&(s-=f,t+=x),0===s){let t=n[r];e%2&&(t=t.negate()),o=o.add(t)}else{let t=n[r+Math.abs(s)-1];s<0&&(t=t.negate()),i=i.add(t)}}return{p:i,f:o}}multiply(t,e){let r,n,i=tt(t);if(C){const{k1neg:t,k1:o,k2neg:s,k2:a}=st(i);let{p:u,f}=this.wNAF(o,e),{p:h,f:c}=this.wNAF(a,e);t&&(u=u.negate()),s&&(h=h.negate()),h=new j(et(h.x*R.beta),h.y,h.z),r=u.add(h),n=f.add(c)}else{const{p:t,f:o}=this.wNAF(i,e);r=t,n=o}return j.normalizeZ([r,n])[0]}toAffine(t=nt(this.z)){const{x:e,y:r,z:n}=this,i=t,o=et(i*i),s=et(o*i),a=et(e*o),u=et(r*s);if(et(n*i)!==x)throw new Error("invZ was invalid");return new H(a,u)}}j.BASE=new j(R.Gx,R.Gy,x),j.ZERO=new j(T,x,T);const F=new WeakMap;class H{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,F.delete(this)}static fromCompressedHex(t){const e=32===t.length,r=Y(e?t:t.subarray(1));if(!ht(r))throw new Error("Point is not on curve");let n=function(t){const{P:e}=R,r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),a=BigInt(88),u=t*t*t%e,f=u*u*t%e,h=rt(f,B)*f%e,c=rt(h,B)*f%e,l=rt(c,P)*u%e,d=rt(l,n)*l%e,p=rt(d,i)*d%e,y=rt(p,s)*p%e,m=rt(y,a)*y%e,g=rt(m,s)*p%e,b=rt(g,B)*f%e,v=rt(b,o)*d%e,w=rt(v,r)*u%e;return rt(w,P)}(L(r));const i=(n&x)===x;e?i&&(n=et(-n)):1==(1&t[0])!==i&&(n=et(-n));const o=new H(r,n);return o.assertValidity(),o}static fromUncompressedHex(t){const e=Y(t.subarray(1,33)),r=Y(t.subarray(33,65)),n=new H(e,r);return n.assertValidity(),n}static fromHex(t){const e=Q(t),r=e.length,n=e[0];if(32===r||33===r&&(2===n||3===n))return this.fromCompressedHex(e);if(65===r&&4===n)return this.fromUncompressedHex(e);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${r}`)}static fromPrivateKey(t){return H.BASE.multiply(lt(t))}static fromSignature(t,e,r){const n=at(t=Q(t)),{r:i,s:o}=dt(e);if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid recovery bit");if(n===T)throw new Error("Cannot recover signature: msgHash cannot be 0");const s=1&r?"03":"02",a=H.fromHex(s+G(i)),{n:u}=R,f=nt(i,u),h=et(-n*f,u),c=et(o*f,u),l=H.BASE.multiplyAndAddUnsafe(a,h,c);if(!l)throw new Error("Cannot recover signature: point at infinify");return l.assertValidity(),l}toRawBytes(t=!1){return Z(this.toHex(t))}toHex(t=!1){const e=G(this.x);return t?`${this.y&x?"03":"02"}${e}`:`04${e}${G(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:r}=this;if(!ht(e)||!ht(r))throw new Error(t);const n=et(r*r);if(et(n-L(e))!==T)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new H(this.x,et(-this.y))}double(){return j.fromAffine(this).double().toAffine()}add(t){return j.fromAffine(this).add(j.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return j.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,r){const n=j.fromAffine(this).multiply(e),i=j.fromAffine(t).multiplyUnsafe(r),o=n.add(i);return o.equals(j.ZERO)?void 0:o.toAffine()}}function D(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function q(t){if(t.length<2||2!==t[0])throw new Error(`Invalid signature integer tag: ${V(t)}`);const e=t[1],r=t.subarray(2,e+2);if(!e||r.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:Y(r),left:t.subarray(e+2)}}H.BASE=new H(R.Gx,R.Gy),H.ZERO=new H(T,T);class z{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=K(t),r="Signature.fromCompact";if("string"!=typeof t&&!e)throw new TypeError(`${r}: Expected string or Uint8Array`);const n=e?V(t):t;if(128!==n.length)throw new Error(`${r}: Expected 64-byte hex`);return new z(J(n.slice(0,64)),J(n.slice(64,128)))}static fromDER(t){const e=K(t);if("string"!=typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s:n}=function(t){if(t.length<2||48!=t[0])throw new Error(`Invalid signature tag: ${V(t)}`);if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:r}=q(t.subarray(2)),{data:n,left:i}=q(r);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${V(i)}`);return{r:e,s:n}}(e?t:Z(t));return new z(r,n)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!ft(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!ft(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=R.n>>x;return this.s>t}normalizeS(){return this.hasHighS()?new z(this.r,R.n-this.s):this}toDERRawBytes(t=!1){return Z(this.toDERHex(t))}toDERHex(t=!1){const e=D(X(this.s));if(t)return e;const r=D(X(this.r)),n=X(r.length/2),i=X(e.length/2);return`30${X(r.length/2+e.length/2+4)}02${n}${r}02${i}${e}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return Z(this.toCompactHex())}toCompactHex(){return G(this.r)+G(this.s)}}function $(...t){if(!t.every(K))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const e=t.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}function K(t){return t instanceof Uint8Array}const W=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function V(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let r=0;r<t.length;r++)e+=W[t[r]];return e}function G(t){if(t>U)throw new Error("Expected number < 2^256");return t.toString(16).padStart(64,"0")}function X(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function J(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function Z(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+t.length);const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=2*r,i=t.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[r]=o}return e}function Y(t){return J(V(t))}function Q(t){return t instanceof Uint8Array?Uint8Array.from(t):Z(t)}function tt(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&ft(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function et(t,e=R.P){const r=t%e;return r>=T?r:e+r}function rt(t,e){const{P:r}=R;let n=t;for(;e-- >T;)n*=n,n%=r;return n}function nt(t,e=R.P){if(t===T||e<=T)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=et(t,e),n=e,i=T,o=x,s=x,a=T;for(;r!==T;){const t=n/r,e=n%r,u=i-s*t,f=o-a*t;n=r,r=e,i=s,o=a,s=u,a=f}if(n!==x)throw new Error("invert: does not exist");return et(i,e)}const it=(t,e)=>(t+e/P)/e,ot=P**BigInt(128);function st(t){const{n:e}=R,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-x*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=it(o*t,e),a=it(-n*t,e);let u=et(t-s*r-a*i,e),f=et(-s*n-a*o,e);const h=u>ot,c=f>ot;if(h&&(u=e-u),c&&(f=e-f),u>ot||f>ot)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:h,k1:u,k2neg:c,k2:f}}function at(t){const{n:e}=R,r=8*t.length-256;let n=Y(t);return r>0&&(n>>=BigInt(r)),n>=e&&(n-=e),n}class ut{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(...t){return wt.hmacSha256(this.k,...t)}hmacSync(...t){if("function"!=typeof wt.hmacSha256Sync)throw new Error("utils.hmacSha256Sync is undefined, you need to set it");const e=wt.hmacSha256Sync(this.k,...t);if(e instanceof Promise)throw new Error("To use sync sign(), ensure utils.hmacSha256 is sync");return e}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(t=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(t=new Uint8Array){this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){return this.incr(),this.v=await this.hmac(this.v),this.v}generateSync(){return this.incr(),this.v=this.hmacSync(this.v),this.v}}function ft(t){return T<t&&t<R.n}function ht(t){return T<t&&t<R.P}function ct(t,e,r){const n=Y(t);if(!ft(n))return;const{n:i}=R,o=H.BASE.multiply(n),s=et(o.x,i);if(s===T)return;const a=et(nt(n,i)*et(e+r*s,i),i);if(a===T)return;const u=new z(s,a);return{sig:u,recovery:(o.x===u.r?0:2)|Number(o.y&x)}}function lt(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(64!==t.length)throw new Error("Expected 32 bytes of private key");e=J(t)}else{if(!K(t))throw new TypeError("Expected valid private key");if(32!==t.length)throw new Error("Expected 32 bytes of private key");e=Y(t)}if(!ft(e))throw new Error("Expected private key: 0 < key < n");return e}function dt(t){if(t instanceof z)return t.assertValidity(),t;try{return z.fromDER(t)}catch(e){return z.fromCompact(t)}}function pt(t){return Y(t.length>32?t.slice(0,32):t)}function yt(t){const e=pt(t),r=et(e,R.n);return mt(r<T?e:r)}function mt(t){if("bigint"!=typeof t)throw new Error("Expected bigint");return Z(G(t))}function gt(t,e,r={}){const{seed:n,m:i,d:o}=function(t,e,r){if(null==t)throw new Error(`sign: expected valid message hash, not "${t}"`);const n=Q(t),i=lt(e),o=[mt(i),yt(n)];if(null!=r){!0===r&&(r=wt.randomBytes(32));const t=Q(r);if(32!==t.length)throw new Error("sign: Expected 32 bytes of extra data");o.push(t)}return{seed:$(...o),m:pt(n),d:i}}(t,e,r.extraEntropy);let s;const a=new ut;for(a.reseedSync(n);!(s=ct(a.generateSync(),i,o));)a.reseedSync();return function(t,e){let{sig:r,recovery:n}=t;const{canonical:i,der:o,recovered:s}=Object.assign({canonical:!0,der:!0},e);i&&r.hasHighS()&&(r=r.normalizeS(),n^=1);const a=o?r.toDERRawBytes():r.toCompactRawBytes();return s?[a,n]:a}(s,r)}const bt={strict:!0};H.BASE._setWindowSize(8);const vt={node:I,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},wt={isValidPrivateKey(t){try{return lt(t),!0}catch(t){return!1}},hashToPrivateKey:t=>{if((t=Q(t)).length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");const e=et(Y(t),R.n);if(e===T||e===x)throw new Error("Invalid private key");return function(t){return Z(G(t))}(e)},randomBytes:(t=32)=>{if(vt.web)return vt.web.getRandomValues(new Uint8Array(t));if(vt.node){const{randomBytes:e}=vt.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>wt.hashToPrivateKey(wt.randomBytes(40)),bytesToHex:V,mod:et,sha256:async t=>{if(vt.web){const e=await vt.web.subtle.digest("SHA-256",t.buffer);return new Uint8Array(e)}if(vt.node){const{createHash:e}=vt.node;return Uint8Array.from(e("sha256").update(t).digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(vt.web){const r=await vt.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=$(...e),i=await vt.web.subtle.sign("HMAC",r,n);return new Uint8Array(i)}if(vt.node){const{createHmac:r}=vt.node,n=r("sha256",t);return e.forEach((t=>n.update(t))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,precompute(t=8,e=H.BASE){const r=e===H.BASE?e:new H(e.x,e.y);return r._setWindowSize(t),r.multiply(B),r}};var _t,St,Et,Mt,kt,At,Ot,It,Tt,xt,Pt,Bt,Nt,Ut,Rt,Lt,Ct,jt,Ft,Ht,Dt=r(2870);(St=_t||(_t={}))[St.Testnet=2147483648]="Testnet",St[St.Mainnet=1]="Mainnet",_t.Mainnet,(It=Et||(Et={}))[It.Address=0]="Address",It[It.Principal=1]="Principal",It[It.LengthPrefixedString=2]="LengthPrefixedString",It[It.MemoString=3]="MemoString",It[It.AssetInfo=4]="AssetInfo",It[It.PostCondition=5]="PostCondition",It[It.PublicKey=6]="PublicKey",It[It.LengthPrefixedList=7]="LengthPrefixedList",It[It.Payload=8]="Payload",It[It.MessageSignature=9]="MessageSignature",It[It.TransactionAuthField=10]="TransactionAuthField",function(t){t[t.TokenTransfer=0]="TokenTransfer",t[t.SmartContract=1]="SmartContract",t[t.ContractCall=2]="ContractCall",t[t.PoisonMicroblock=3]="PoisonMicroblock",t[t.Coinbase=4]="Coinbase"}(Mt||(Mt={})),function(t){t[t.OnChainOnly=1]="OnChainOnly",t[t.OffChainOnly=2]="OffChainOnly",t[t.Any=3]="Any"}(kt||(kt={})),(Ot=At||(At={}))[Ot.Mainnet=0]="Mainnet",Ot[Ot.Testnet=128]="Testnet",At.Mainnet,function(t){t[t.Allow=1]="Allow",t[t.Deny=2]="Deny"}(Tt||(Tt={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(xt||(xt={})),function(t){t[t.Standard=4]="Standard",t[t.Sponsored=5]="Sponsored"}(Pt||(Pt={})),function(t){t[t.SerializeP2PKH=0]="SerializeP2PKH",t[t.SerializeP2SH=1]="SerializeP2SH",t[t.SerializeP2WPKH=2]="SerializeP2WPKH",t[t.SerializeP2WSH=3]="SerializeP2WSH"}(Bt||(Bt={})),function(t){t[t.MainnetSingleSig=22]="MainnetSingleSig",t[t.MainnetMultiSig=20]="MainnetMultiSig",t[t.TestnetSingleSig=26]="TestnetSingleSig",t[t.TestnetMultiSig=21]="TestnetMultiSig"}(Nt||(Nt={})),(Ht=Ut||(Ut={}))[Ht.Compressed=0]="Compressed",Ht[Ht.Uncompressed=1]="Uncompressed",function(t){t[t.Equal=1]="Equal",t[t.Greater=2]="Greater",t[t.GreaterEqual=3]="GreaterEqual",t[t.Less=4]="Less",t[t.LessEqual=5]="LessEqual"}(Rt||(Rt={})),function(t){t[t.DoesNotOwn=16]="DoesNotOwn",t[t.Owns=17]="Owns"}(Lt||(Lt={})),function(t){t[t.Origin=1]="Origin",t[t.Standard=2]="Standard",t[t.Contract=3]="Contract"}(Ct||(Ct={})),function(t){t[t.STX=0]="STX",t[t.Fungible=1]="Fungible",t[t.NonFungible=2]="NonFungible"}(jt||(jt={})),function(t){t.Serialization="Serialization",t.Deserialization="Deserialization",t.SignatureValidation="SignatureValidation",t.FeeTooLow="FeeTooLow",t.BadNonce="BadNonce",t.NotEnoughFunds="NotEnoughFunds",t.NoSuchContract="NoSuchContract",t.NoSuchPublicFunction="NoSuchPublicFunction",t.BadFunctionArgument="BadFunctionArgument",t.ContractAlreadyExists="ContractAlreadyExists",t.PoisonMicroblocksDoNotConflict="PoisonMicroblocksDoNotConflict",t.PoisonMicroblockHasUnknownPubKeyHash="PoisonMicroblockHasUnknownPubKeyHash",t.PoisonMicroblockIsInvalid="PoisonMicroblockIsInvalid",t.BadAddressVersionByte="BadAddressVersionByte",t.NoCoinbaseViaMempool="NoCoinbaseViaMempool",t.ServerFailureNoSuchChainTip="ServerFailureNoSuchChainTip",t.ServerFailureDatabase="ServerFailureDatabase",t.ServerFailureOther="ServerFailureOther"}(Ft||(Ft={}));var qt=r(9065);const zt=new Array(16),$t=se([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),Kt=se([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),Wt=se([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),Vt=se([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),Gt=oe([0,1518500249,1859775393,2400959708,2840853838]),Xt=oe([1352829926,1548603684,1836072691,2053994217,0]);function Jt(t,e){return t<<e|t>>>32-e}function Zt(t,e,r,n,i,o,s,a){return Jt(t+(e^r^n)+o+s|0,a)+i|0}function Yt(t,e,r,n,i,o,s,a){return Jt(t+(e&r|~e&n)+o+s|0,a)+i|0}function Qt(t,e,r,n,i,o,s,a){return Jt(t+((e|~r)^n)+o+s|0,a)+i|0}function te(t,e,r,n,i,o,s,a){return Jt(t+(e&n|r&~n)+o+s|0,a)+i|0}function ee(t,e,r,n,i,o,s,a){return Jt(t+(e^(r|~n))+o+s|0,a)+i|0}function re(t,e){return t[e>>>=0]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24}function ne(t,e,r){return e=+e,t[3+(r>>>=0)]=e>>>24,t[r+2]=e>>>16,t[r+1]=e>>>8,t[r]=255&e,r+4}function ie(t,e,r){return e=+e,t[r>>>=0]=255&e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,r+4}function oe(t){return"undefined"!=typeof Uint32Array?new Uint32Array(t):t}function se(t){return"undefined"!=typeof Uint8Array?new Uint8Array(t):t}function ae(t){return"undefined"!=typeof Uint8Array?new Uint8Array(t):new Array(t)}const ue=class{constructor(){this._block=ae(64),this._blockSize=64,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1,this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}update(t){if(this._finalized)throw new Error("Digest already called");const e=this._block;let r=0;for(;this._blockOffset+t.length-r>=this._blockSize;){for(let n=this._blockOffset;n<this._blockSize;)e[n++]=t[r++];this._update(),this._blockOffset=0}for(;r<t.length;)e[this._blockOffset++]=t[r++];for(let e=0,r=8*t.length;r>0;++e)this._length[e]+=r,r=this._length[e]/4294967296|0,r>0&&(this._length[e]-=4294967296*r);return this}_update(){const t=zt;for(let e=0;e<16;++e)t[e]=re(this._block,4*e);let e=0|this._a,r=0|this._b,n=0|this._c,i=0|this._d,o=0|this._e,s=0|this._a,a=0|this._b,u=0|this._c,f=0|this._d,h=0|this._e;for(let c=0;c<80;c+=1){let l,d;c<16?(l=Zt(e,r,n,i,o,t[$t[c]],Gt[0],Wt[c]),d=ee(s,a,u,f,h,t[Kt[c]],Xt[0],Vt[c])):c<32?(l=Yt(e,r,n,i,o,t[$t[c]],Gt[1],Wt[c]),d=te(s,a,u,f,h,t[Kt[c]],Xt[1],Vt[c])):c<48?(l=Qt(e,r,n,i,o,t[$t[c]],Gt[2],Wt[c]),d=Qt(s,a,u,f,h,t[Kt[c]],Xt[2],Vt[c])):c<64?(l=te(e,r,n,i,o,t[$t[c]],Gt[3],Wt[c]),d=Yt(s,a,u,f,h,t[Kt[c]],Xt[3],Vt[c])):(l=ee(e,r,n,i,o,t[$t[c]],Gt[4],Wt[c]),d=Zt(s,a,u,f,h,t[Kt[c]],Xt[4],Vt[c])),e=o,o=i,i=Jt(n,10),n=r,r=l,s=h,h=f,f=Jt(u,10),u=a,a=d}const c=this._b+n+f|0;this._b=this._c+i+h|0,this._c=this._d+o+s|0,this._d=this._e+e+a|0,this._e=this._a+r+u|0,this._a=c}digest(){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),ne(this._block,this._length[0],56),ne(this._block,this._length[1],60),this._update();const t=ae(20);ie(t,this._a,0),ie(t,this._b,4),ie(t,this._c,8),ie(t,this._d,12),ie(t,this._e,16),this._block.fill(0),this._blockOffset=0;for(let t=0;t<4;++t)this._length[t]=0;return t}};r(6279),r(9907);function fe(t,e=At.Mainnet){t="string"==typeof t?t:t.toString("hex");var r,n,i;return i=(r=function(t,e){switch(t){case Bt.SerializeP2PKH:switch(e){case At.Mainnet:return Nt.MainnetSingleSig;case At.Testnet:return Nt.TestnetSingleSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}case Bt.SerializeP2SH:case Bt.SerializeP2WPKH:case Bt.SerializeP2WSH:switch(e){case At.Mainnet:return Nt.MainnetMultiSig;case At.Testnet:return Nt.TestnetMultiSig;default:throw new Error(`Unexpected txVersion ${JSON.stringify(e)} for hashMode ${t}`)}default:throw new Error(`Unexpected hashMode ${JSON.stringify(t)}`)}}(Bt.SerializeP2PKH,e),n=(t=>{const e=(new qt.sha256).update(t).digest();return h.from((new ue).update(e).digest())})(h.from(t,"hex")).toString("hex"),{type:Et.Address,version:r,hash160:n}),(0,Dt.H4)(i.version,i.hash160).toString()}function he(t,r=null){let n;n=r?function(t,r){const n=(0,e.decodeToken)(t),i=n.payload;if("string"==typeof i)throw new Error("Unexpected token payload type of string");if(!i.hasOwnProperty("subject")||!i.subject)throw new Error("Token doesn't have a subject");if(!i.subject.hasOwnProperty("publicKey"))throw new Error("Token doesn't have a subject public key");if(!i.hasOwnProperty("issuer")||!i.issuer)throw new Error("Token doesn't have an issuer");if(!i.issuer.hasOwnProperty("publicKey"))throw new Error("Token doesn't have an issuer public key");if(!i.hasOwnProperty("claim"))throw new Error("Token doesn't have a claim");const o=i.issuer.publicKey,s=fe(o);if(r===o);else if(r!==s)throw new Error("Token issuer public key does not match the verifying value");const a=new e.TokenVerifier(n.header.alg,o);if(!a)throw new Error("Invalid token verifier");if(!a.verify(t))throw new Error("Token verification failed");return n}(t,r):(0,e.decodeToken)(t);let i={};if(n.hasOwnProperty("payload")){const t=n.payload;if("string"==typeof t)throw new Error("Unexpected token payload type of string");t.hasOwnProperty("claim")&&(i=t.claim)}return i}function ce(t,e){let r;return e.proof&&e.proof.url&&(r=e.proof.url),{"@type":"Account",service:t,identifier:e.username,proofType:"http",proofUrl:r}}wt.hmacSha256Sync=(t,...e)=>{const r=w.create(O,t);return e.forEach((t=>r.update(t))),r.digest()};var le=r(2377),de=r(2179);async function pe(t,e){const r=Object.assign({referrer:"no-referrer",referrerPolicy:"no-referrer"},e);return await fetch(t,r)}r(3616);const ye={type:"object",properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"}}};class me{constructor(t={}){this._profile=Object.assign({},{"@context":"http://schema.org/"},t)}toJSON(){return Object.assign({},this._profile)}toToken(t){return function(t,r,n,i,o="ES256K",s=new Date,a=function(){return new Date((new Date).setFullYear((new Date).getFullYear()+1))}()){if("ES256K"!==o)throw new Error("Signing algorithm not supported");const u=e.SECP256K1Client.derivePublicKey(r);n||(n={publicKey:u}),i||(i={publicKey:u});const f=new e.TokenSigner(o,r),h={jti:l(),iat:s.toISOString(),exp:a.toISOString(),subject:n,issuer:i,claim:t};return f.sign(h)}(this.toJSON(),t)}static validateSchema(t,e=!1){return ye.strict=e,de.validate(ye,t)}static fromToken(t,e=null){const r=he(t,e);return new me(r)}static makeZoneFile(t,e){return function(t,e){if(!e.includes("://"))throw new Error("Invalid token file url");const r=e.split("://")[0],n=e.split("://")[1].split("/"),i={$origin:t,$ttl:3600,uri:[{name:"_http._tcp",priority:10,weight:1,target:`${r}://${n[0]}${`/${n.slice(1).join("/")}`}`}]};return(0,le.makeZoneFile)(i,"{$origin}\n{$ttl}\n{uri}\n")}(t,e)}}const ge={type:"object",strict:!1,properties:{"@context":{type:"string",optional:!0},"@type":{type:"string"},"@id":{type:"string",optional:!0},name:{type:"string",optional:!0},givenName:{type:"string",optional:!0},familyName:{type:"string",optional:!0},description:{type:"string",optional:!0},image:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},name:{type:"string",optional:!0},contentUrl:{type:"string",optional:!0}}}},website:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},url:{type:"string",optional:!0}}}},account:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},service:{type:"string",optional:!0},identifier:{type:"string",optional:!0},proofType:{type:"string",optional:!0},proofUrl:{type:"string",optional:!0},proofMessage:{type:"string",optional:!0},proofSignature:{type:"string",optional:!0}}}},worksFor:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},knows:{type:"array",optional:!0,items:{type:"object",properties:{"@type":{type:"string"},"@id":{type:"string",optional:!0}}}},address:{type:"object",optional:!0,properties:{"@type":{type:"string"},streetAddress:{type:"string",optional:!0},addressLocality:{type:"string",optional:!0},postalCode:{type:"string",optional:!0},addressCountry:{type:"string",optional:!0}}},birthDate:{type:"string",optional:!0},taxID:{type:"string",optional:!0}}};class be extends me{constructor(t={}){super(t),this._profile=Object.assign({},{"@type":"Person"},this._profile)}static validateSchema(t,e=!1){return ge.strict=e,de.validate(ye,t)}static fromToken(t,e=null){const r=he(t,e);return new be(r)}static fromLegacyFormat(t){const e=function(t){const e={"@type":"Person"};if(t){t.name&&t.name.formatted&&(e.name=t.name.formatted),t.bio&&(e.description=t.bio),t.location&&t.location.formatted&&(e.address={"@type":"PostalAddress",addressLocality:t.location.formatted});const r=[];t.avatar&&t.avatar.url&&r.push({"@type":"ImageObject",name:"avatar",contentUrl:t.avatar.url}),t.cover&&t.cover.url&&r.push({"@type":"ImageObject",name:"cover",contentUrl:t.cover.url}),r.length&&(e.image=r),t.website&&(e.website=[{"@type":"WebSite",url:t.website}]);const n=[];t.bitcoin&&t.bitcoin.address&&n.push({"@type":"Account",role:"payment",service:"bitcoin",identifier:t.bitcoin.address}),t.twitter&&t.twitter.username&&n.push(ce("twitter",t.twitter)),t.facebook&&t.facebook.username&&n.push(ce("facebook",t.facebook)),t.github&&t.github.username&&n.push(ce("github",t.github)),t.auth&&t.auth.length>0&&t.auth[0]&&t.auth[0].publicKeychain&&n.push({"@type":"Account",role:"key",service:"bip32",identifier:t.auth[0].publicKeychain}),t.pgp&&t.pgp.url&&n.push({"@type":"Account",role:"key",service:"pgp",identifier:t.pgp.fingerprint,contentUrl:t.pgp.url}),e.account=n}return e}(t);return new be(e)}toJSON(){return{profile:this.profile(),name:this.name(),givenName:this.givenName(),familyName:this.familyName(),description:this.description(),avatarUrl:this.avatarUrl(),verifiedAccounts:this.verifiedAccounts(),address:this.address(),birthDate:this.birthDate(),connections:this.connections(),organizations:this.organizations()}}profile(){return Object.assign({},this._profile)}name(){return function(t){if(!t)return null;let e=null;return t.name?e=t.name:(t.givenName||t.familyName)&&(e="",t.givenName&&(e=t.givenName),t.familyName&&(e+=` ${t.familyName}`)),e}(this.profile())}givenName(){return function(t){if(!t)return null;let e=null;return t.givenName?e=t.givenName:t.name&&(e=t.name.split(" ").slice(0,-1).join(" ")),e}(this.profile())}familyName(){return function(t){if(!t)return null;let e=null;return t.familyName?e=t.familyName:t.name&&(e=t.name.split(" ").pop()),e}(this.profile())}description(){return function(t){if(!t)return null;let e=null;return t.description&&(e=t.description),e}(this.profile())}avatarUrl(){return function(t){if(!t)return null;let e=null;return t.image&&t.image.map((t=>"avatar"===t.name?(e=t.contentUrl,e):null)),e}(this.profile())}verifiedAccounts(t){return function(t,e){if(!t)return null;const r=[];return t.hasOwnProperty("account")&&e&&t.account.map((t=>{let n=!1,i=null;return e.map((e=>(e.hasOwnProperty("proof_url")&&(e.proofUrl=e.proof_url),!(!e.valid||e.service!==t.service||e.identifier!==t.identifier||!e.proofUrl||(n=!0,i=e.proofUrl,0))))),n?(t.proofUrl=i,r.push(t),t):null})),r}(this.profile(),t)}address(){return function(t){if(!t)return null;let e=null;if(t.hasOwnProperty("address")){const r=[];t.address.hasOwnProperty("streetAddress")&&r.push(t.address.streetAddress),t.address.hasOwnProperty("addressLocality")&&r.push(t.address.addressLocality),t.address.hasOwnProperty("postalCode")&&r.push(t.address.postalCode),t.address.hasOwnProperty("addressCountry")&&r.push(t.address.addressCountry),r.length&&(e=r.join(", "))}return e}(this.profile())}birthDate(){return function(t){if(!t)return null;const e=["January","February","March","April","May","June","July","August","September","October","November","December"];let r=null;if(t.hasOwnProperty("birthDate")){const n=new Date(t.birthDate);r=`${e[n.getMonth()]} ${n.getDate()}, ${n.getFullYear()}`}return r}(this.profile())}connections(){return function(t){if(!t)return null;let e=[];return t.hasOwnProperty("knows")&&(e=t.knows),e}(this.profile())}organizations(){return(t=this.profile())?t.hasOwnProperty("worksFor")?t.worksFor:[]:null;var t}}var ve,we;!function(t){t[t.Testnet=2147483648]="Testnet",t[t.Mainnet=1]="Mainnet"}(ve||(ve={})),function(t){t[t.Mainnet=0]="Mainnet",t[t.Testnet=128]="Testnet"}(we||(we={}));const _e=["mainnet","testnet"];class Se{constructor(t){this.version=we.Mainnet,this.chainId=ve.Mainnet,this.bnsLookupUrl="https://stacks-node-api.mainnet.stacks.co",this.broadcastEndpoint="/v2/transactions",this.transferFeeEstimateEndpoint="/v2/fees/transfer",this.transactionFeeEstimateEndpoint="/v2/fees/transaction",this.accountEndpoint="/v2/accounts",this.contractAbiEndpoint="/v2/contracts/interface",this.readOnlyFunctionCallEndpoint="/v2/contracts/call-read",this.isMainnet=()=>this.version===we.Mainnet,this.getBroadcastApiUrl=()=>`${this.coreApiUrl}${this.broadcastEndpoint}`,this.getTransferFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transferFeeEstimateEndpoint}`,this.getTransactionFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transactionFeeEstimateEndpoint}`,this.getAccountApiUrl=t=>`${this.coreApiUrl}${this.accountEndpoint}/${t}?proof=0`,this.getAbiApiUrl=(t,e)=>`${this.coreApiUrl}${this.contractAbiEndpoint}/${t}/${e}`,this.getReadOnlyFunctionCallApiUrl=(t,e,r)=>`${this.coreApiUrl}${this.readOnlyFunctionCallEndpoint}/${t}/${e}/${encodeURIComponent(r)}`,this.getInfoUrl=()=>`${this.coreApiUrl}/v2/info`,this.getBlockTimeInfoUrl=()=>`${this.coreApiUrl}/extended/v1/info/network_block_times`,this.getPoxInfoUrl=()=>`${this.coreApiUrl}/v2/pox`,this.getRewardsUrl=(t,e)=>{let r=`${this.coreApiUrl}/extended/v1/burnchain/rewards/${t}`;return e&&(r=`${r}?limit=${e.limit}&offset=${e.offset}`),r},this.getRewardsTotalUrl=t=>`${this.coreApiUrl}/extended/v1/burnchain/rewards/${t}/total`,this.getRewardHoldersUrl=(t,e)=>{let r=`${this.coreApiUrl}/extended/v1/burnchain/reward_slot_holders/${t}`;return e&&(r=`${r}?limit=${e.limit}&offset=${e.offset}`),r},this.getStackerInfoUrl=(t,e)=>`${this.coreApiUrl}${this.readOnlyFunctionCallEndpoint}\n ${t}/${e}/get-stacker-info`,this.coreApiUrl=t.url}getNameInfo(t){return pe(`${this.bnsLookupUrl}/v1/names/${t}`).then((t=>{if(404===t.status)throw new Error("Name not found");if(200!==t.status)throw new Error(`Bad response status: ${t.status}`);return t.json()})).then((t=>t.address?Object.assign({},t,{address:t.address}):t))}}Se.fromName=t=>{switch(t){case"mainnet":return new Ee;case"testnet":return new Me;default:throw new Error(`Invalid network name provided. Must be one of the following: ${_e.join(", ")}`)}},Se.fromNameOrNetwork=t=>"string"!=typeof t&&"version"in t?t:Se.fromName(t);class Ee extends Se{constructor(t={url:"https://stacks-node-api.mainnet.stacks.co"}){super(t),this.version=we.Mainnet,this.chainId=ve.Mainnet}}class Me extends Se{constructor(t={url:"https://stacks-node-api.testnet.stacks.co"}){super(t),this.version=we.Testnet,this.chainId=ve.Testnet}}const ke={MISSING_PARAMETER:"missing_parameter",REMOTE_SERVICE_ERROR:"remote_service_error",INVALID_STATE:"invalid_state",NO_SESSION_DATA:"no_session_data",DOES_NOT_EXIST:"does_not_exist",FAILED_DECRYPTION_ERROR:"failed_decryption_error",INVALID_DID_ERROR:"invalid_did_error",NOT_ENOUGH_FUNDS_ERROR:"not_enough_error",INVALID_AMOUNT_ERROR:"invalid_amount_error",LOGIN_FAILED_ERROR:"login_failed",SIGNATURE_VERIFICATION_ERROR:"signature_verification_failure",CONFLICT_ERROR:"conflict_error",NOT_ENOUGH_PROOF_ERROR:"not_enough_proof_error",BAD_PATH_ERROR:"bad_path_error",VALIDATION_ERROR:"validation_error",PAYLOAD_TOO_LARGE_ERROR:"payload_too_large_error",PRECONDITION_FAILED_ERROR:"precondition_failed_error",UNKNOWN:"unknown"};Object.freeze(ke);class Ae extends Error{constructor(t){super();let e=t.message,r=`Error Code: ${t.code}`,n=this.stack;if(n)r+=`Stack Trace:\n${n}`;else try{throw new Error}catch(t){n=t.stack}e+=`\nIf you believe this exception is caused by a bug in stacks.js,\n please file a bug report: https://github.com/blockstack/stacks.js/issues\n\n${r}`,this.message=e,this.code=t.code,this.parameter=t.parameter?t.parameter:void 0}toString(){return`${super.toString()}\n code: ${this.code} param: ${this.parameter?this.parameter:"n/a"}`}}class Oe extends Ae{constructor(t){const e=`Failed to verify signature: ${t}`;super({code:ke.SIGNATURE_VERIFICATION_ERROR,message:e}),this.message=e,this.name="SignatureVerificationError"}}class Ie extends Ae{constructor(t){super({code:ke.INVALID_STATE,message:t}),this.message=t,this.name="InvalidStateError"}}class Te extends Ae{constructor(t,e){super(t),e&&(this.hubError={statusCode:e.status,statusText:e.statusText},"string"==typeof e.body?this.hubError.message=e.body:"object"==typeof e.body&&Object.assign(this.hubError,e.body))}}class xe extends Te{constructor(t,e){super({message:t,code:ke.DOES_NOT_EXIST},e),this.name="DoesNotExist"}}class Pe extends Te{constructor(t,e){super({message:t,code:ke.CONFLICT_ERROR},e),this.name="ConflictError"}}class Be extends Te{constructor(t,e){super({message:t,code:ke.NOT_ENOUGH_PROOF_ERROR},e),this.name="NotEnoughProofError"}}class Ne extends Te{constructor(t,e){super({message:t,code:ke.BAD_PATH_ERROR},e),this.name="BadPathError"}}class Ue extends Te{constructor(t,e){super({message:t,code:ke.VALIDATION_ERROR},e),this.name="ValidationError"}}class Re extends Te{constructor(t,e,r){super({message:t,code:ke.PAYLOAD_TOO_LARGE_ERROR},e),this.name="PayloadTooLargeError",this.maxUploadByteSize=r}}class Le extends Te{constructor(t,e){super({message:t,code:ke.PRECONDITION_FAILED_ERROR},e),this.name="PreconditionFailedError"}}function Ce(t){const e=h.isBuffer(t)?t:h.from(t,"hex");if(32!=e.length&&33!=e.length)throw new Error(`Improperly formatted private-key. Private-key byte length should be 32 or 33. Length provided: ${e.length}`);if(33==e.length&&1!==e[32])throw new Error("Improperly formatted private-key. 33 bytes indicate compressed key, but the last byte must be == 01");return e}var je=r(7022),Fe=r.n(je);class He{digest(t){const e=new ue;e.update(t);const r=e.digest();return Array.isArray(r)?h.from(r):h.from(r.buffer)}}class De{constructor(t){this.nodeCryptoCreateHash=t}digest(t){try{return this.nodeCryptoCreateHash("rmd160").update(t).digest()}catch(e){try{return this.nodeCryptoCreateHash("ripemd160").update(t).digest()}catch(r){return console.log(e),console.log("Node.js `crypto.createHash` exists but failing to digest for ripemd160, falling back to js implementation"),(new He).digest(t)}}}}function qe(t){const e=new qt.sha256;return e.update(t),e.digest()}const ze=0;function $e(t){var e,n;return e=qe(h.isBuffer(t)?t:h.from(t,"hex")),n=function(){const t=function(t){try{if(!Object(function(){var t=new Error("Cannot find module 'crypto'");throw t.code="MODULE_NOT_FOUND",t}()))return!1;const e=r(Object(function(){var t=new Error("Cannot find module 'crypto'");throw t.code="MODULE_NOT_FOUND",t}()));return!!e&&(!t||t(e))}catch(t){return!1}}((t=>"function"==typeof t.createHash&&t.createHash));return t?new De(t):new He}().digest(e),function(t){const e=O(O(t));return Fe().encode(h.concat([t,e],t.length+4))}(h.from([ze,...n].slice(0,21)))}function Ke(t){const e=Ce(t);return h.from(function(t,e=!1){return H.fromPrivateKey(t).toRawBytes(e)}(e.slice(0,32),!0)).toString("hex")}var We;function Ve(t,e,r){const n=function(t){return t instanceof h?t:(ArrayBuffer,h.from(t))}(t);return function(t,e,r,n=bt){let i;try{i=dt(t),e=Q(e)}catch(t){return!1}const{r:o,s}=i;if(n.strict&&i.hasHighS())return!1;const a=at(e);if(a===T)return!1;let u;try{u=function(t){return t instanceof H?(t.assertValidity(),t):H.fromHex(t)}(r)}catch(t){return!1}const{n:f}=R,h=nt(s,f),c=et(a*h,f),l=et(o*h,f),d=H.BASE.multiplyAndAddUnsafe(u,c,l);return!!d&&et(d.x,f)===o}(r,qe(n),e)}wt.hmacSha256Sync=(t,...e)=>{const r=w.create(O,t);return e.forEach((t=>r.update(t))),r.digest()},wt.hmacSha256Sync=(t,...e)=>{const r=w.create(O,t);return e.forEach((t=>r.update(t))),r.digest()},function(t){t.InvalidFormat="InvalidFormat",t.IsNotPoint="IsNotPoint"}(We||(We={}));const Ge=class{constructor(t,e){this.wasString="string"==typeof t,this.content=Ge.normalizeContentDataType(t,e),this.contentType=e||this.detectContentType(),this.contentByteLength=this.detectContentLength()}static normalizeContentDataType(t,e){try{if("string"==typeof t){const r=(e||"").toLowerCase().replace("-","");if(r.includes("charset")&&!r.includes("charset=utf8")&&!r.includes("charset=ascii"))throw new Error(`Unable to determine byte length with charset: ${e}`);if("undefined"!=typeof TextEncoder){const e=(new TextEncoder).encode(t);return h.from(e.buffer)}return h.from(t)}if(h.isBuffer(t))return t;if(ArrayBuffer.isView(t))return h.from(t.buffer,t.byteOffset,t.byteLength);if("undefined"!=typeof Blob&&t instanceof Blob)return t;if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer)return h.from(t);if(Array.isArray(t)){if(t.length>0&&(!Number.isInteger(t[0])||t[0]<0||t[0]>255))throw new Error(`Unexpected array values provided as file data: value "${t[0]}" at index 0 is not an octet number. ${this.supportedTypesMsg}`);return h.from(t)}{const e=Object.prototype.toString.call(t);throw new Error(`Unexpected type provided as file data: ${e}. ${this.supportedTypesMsg}`)}}catch(t){throw console.error(t),new Error(`Error processing data: ${t}`)}}detectContentType(){return this.wasString?"text/plain; charset=utf-8":"undefined"!=typeof Blob&&this.content instanceof Blob&&this.content.type?this.content.type:"application/octet-stream"}detectContentLength(){if(ArrayBuffer.isView(this.content)||h.isBuffer(this.content))return this.content.byteLength;if("undefined"!=typeof Blob&&this.content instanceof Blob)return this.content.size;const t=Object.prototype.toString.call(this.content),e=new Error(`Unexpected type "${t}" while detecting content length`);throw console.error(e),e}async loadContent(){try{if(h.isBuffer(this.content))return this.content;if(ArrayBuffer.isView(this.content))return h.from(this.content.buffer,this.content.byteOffset,this.content.byteLength);if("undefined"!=typeof Blob&&this.content instanceof Blob){const t=new FileReader,e=new Promise(((e,r)=>{t.onerror=t=>{r(t)},t.onload=()=>{const r=t.result;e(h.from(r))},t.readAsArrayBuffer(this.content)}));return await e}{const t=Object.prototype.toString.call(this.content);throw new Error(`Unexpected type ${t}`)}}catch(t){console.error(t);const e=new Error(`Error loading content: ${t}`);throw console.error(e),e}}load(){return void 0===this.loadedData&&(this.loadedData=this.loadContent()),this.loadedData}};let Xe=Ge;Xe.supportedTypesMsg="Supported types are: `string` (to be UTF8 encoded), `Buffer`, `Blob`, `File`, `ArrayBuffer`, `UInt8Array` or any other typed array buffer. ";var Je=r(6314);const Ze="blockstack-gaia-hub-config";async function Ye(t,e,r,n="application/octet-stream",i=!0,o,s){a.debug(`uploadToGaiaHub: uploading ${t} to ${r.server}`);const u={"Content-Type":n,Authorization:`bearer ${r.token}`};s||(i?u["If-None-Match"]="*":o&&(u["If-Match"]=o));const f=await pe(`${r.server}/store/${r.address}/${t}`,{method:"POST",headers:u,body:e});if(!f.ok)throw await ir(f,"Error when uploading to Gaia hub.",r);const h=await f.text();return JSON.parse(h)}async function Qe(t,e){a.debug(`deleteFromGaiaHub: deleting ${t} from ${e.server}`);const r=await pe(`${e.server}/delete/${e.address}/${t}`,{method:"DELETE",headers:{Authorization:`bearer ${e.token}`}});if(!r.ok)throw await ir(r,"Error deleting file from Gaia hub.",e)}function tr(t,e){return Promise.resolve(`${e.url_prefix}${e.address}/${t}`)}function er(t,r,n,i){const o=t.challenge_text,s=t.latest_auth_version&&parseInt(t.latest_auth_version.slice(1),10)>=1,a=Ke(r);if(!s)return function(t,e){let r;try{r=JSON.parse(t)}catch(t){throw new Error("Failed in parsing legacy challenge text from the gaia hub.")}if("gaiahub"===r[0]&&"blockstack_storage_please_sign"===r[3]){const r=(n=qe(h.from(t)),i=function(t){const e=Ce(t);return 33==e.length?e:h.concat([e,h.from([1])])}(e),h.from(gt(n,Ce(i).slice(0,32),{der:!1}))),o=Je._v.signature.encode(r,Je.YW.SIGHASH_NONE).toString("hex").slice(0,-2),s=Ke(e);return h.from(JSON.stringify({publickey:s,signature:o})).toString("base64")}throw new Error("Failed to connect to legacy gaia hub. If you operate this hub, please update.");var n,i}(o,r);const u={gaiaChallenge:o,hubUrl:n,iss:a,salt:(16,h.from(wt.randomBytes(16))).toString("hex"),associationToken:i};return`v1:${new e.TokenSigner("ES256K",r).sign(u)}`}async function rr(t,e,r){a.debug(`connectToGaiaHub: ${t}/hub_info`);const n=await pe(`${t}/hub_info`),i=await n.json(),o=i.read_url_prefix,s=er(i,e,t,r),u=$e(Ke(e));return{url_prefix:o,max_file_upload_size_megabytes:i.max_file_upload_size_megabytes,address:u,token:s,server:t}}async function nr(t,e){const r=await pe(`${t}/hub_info`),n=await r.text();return`${JSON.parse(n).read_url_prefix}${$e(Ke(e))}/`}async function ir(t,e,r){if(t.ok)throw new Error("Cannot get a BlockstackError from a valid response.");const n=await async function(t){let e,r="";try{r=await t.text();try{e=JSON.parse(r)}catch(t){}}catch(t){a.debug(`Error getting bad http response text: ${t}`)}return{status:t.status,statusText:t.statusText,body:e||r}}(t);if(401===n.status)return new Ue(e,n);if(402===n.status)return new Be(e,n);if(403===n.status)return new Ne(e,n);if(404===n.status)throw new xe(e,n);if(409===n.status)return new Pe(e,n);if(412===n.status)return new Le(e,n);if(413===n.status){const t=r&&r.max_file_upload_size_megabytes?c(r.max_file_upload_size_megabytes):0;return new Re(e,n,t)}return new Error(e)}class or{constructor(t){this.userSession=t.userSession}async getFile(t,e){const r={decrypt:!0,verify:!1,app:d("location",{returnEmptyObject:!0}).origin},n=Object.assign({},r,e);if(n.verify&&!n.decrypt)return this.getFileSignedUnencrypted(t,n);const i=await this.getFileContents(t,n.app,n.username,n.zoneFileLookupURL,!!n.decrypt);if(null===i)return i;if(n.decrypt&&!n.verify){if("string"!=typeof i)throw new Error("Expected to get back a string for the cipherText");if("string"==typeof n.decrypt){const t={privateKey:n.decrypt};return this.userSession.decryptContent(i,t)}return this.userSession.decryptContent(i)}if(n.decrypt&&n.verify){if("string"!=typeof i)throw new Error("Expected to get back a string for the cipherText");let e;return"string"==typeof n.decrypt&&(e=n.decrypt),this.handleSignedEncryptedContents(t,i,n.app,e,n.username,n.zoneFileLookupURL)}if(n.verify||n.decrypt)throw new Error("Should be unreachable.");return i}async getUserAppFileUrl(t,e,r,n){const i=await function(t){if(!t.username)return Promise.reject(new Error("No username provided"));const e={network:new Ee},r=Object.assign(e,t),n=Se.fromNameOrNetwork(r.network);let i;return i=r.zoneFileLookupURL?pe(`${r.zoneFileLookupURL.replace(/\/$/,"")}/${r.username}`).then((t=>t.json())):n.getNameInfo(r.username),i.then((t=>{if(t.hasOwnProperty("zonefile")&&t.hasOwnProperty("address"))return e=t.zonefile,r=t.address,new Promise(((t,n)=>{let i=null;try{i=(0,le.parseZoneFile)(e),i.hasOwnProperty("$origin")||(i=null)}catch(t){n(t)}let o=null;if(i&&Object.keys(i).length>0)o=function(t){if(!t.hasOwnProperty("uri"))return null;if(!Array.isArray(t.uri))return null;if(t.uri.length<1)return null;const e=t.uri.filter((t=>t.hasOwnProperty("target")&&"_http._tcp"===t.name));if(e.length<1)return null;const r=e[0];if(!r.hasOwnProperty("target"))return null;let n=r.target;return n.startsWith("https")||n.startsWith("http")||(n=`https://${n}`),n}(i);else try{return t(be.fromLegacyFormat(JSON.parse(e)).profile())}catch(t){return n(t)}o?pe(o).then((t=>t.text())).then((t=>JSON.parse(t))).then((e=>{const n=he(e[0].token,r);t(n)})).catch((t=>{a.error(`resolveZoneFileToProfile: error fetching token file ${o}: ${t}`),n(t)})):(a.debug("Token file url not found. Resolving to blank profile."),t({}))}));var e,r;throw new Error("Invalid zonefile lookup response: did not contain `address` or `zonefile` field")}))}({username:e,zoneFileLookupURL:n});let o;return i.hasOwnProperty("apps")&&i.apps.hasOwnProperty(r)&&(o=`${i.apps[r].replace(/\/?(\?|#|$)/,"/$1")}${t}`),o}async getGaiaAddress(t,e,r){const n=ar(this.userSession,{app:t,username:e,zoneFileLookupURL:r});let i;if(e)i=await this.getUserAppFileUrl("/",n.username,n.app,n.zoneFileLookupURL);else{const t=await this.getOrSetLocalGaiaHubConnection();i=await tr("/",t)}const o=i.match(/([13][a-km-zA-HJ-NP-Z0-9]{26,35})/);if(!o)throw new Error("Failed to parse gaia address");return o[o.length-1]}async getFileUrl(t,e){const r=ar(this.userSession,e);let n;if(r.username)n=await this.getUserAppFileUrl(t,r.username,r.app,r.zoneFileLookupURL);else{const e=await this.getOrSetLocalGaiaHubConnection();n=await tr(t,e)}if(n)return n;throw new Error("Missing readURL")}async getFileContents(t,e,r,n,i){const o={app:e,username:r,zoneFileLookupURL:n},s=await this.getFileUrl(t,o),a=await pe(s);if(!a.ok)throw await ir(a,`getFile ${t} failed.`,null);let u=a.headers.get("Content-Type");"string"==typeof u&&(u=u.toLowerCase());const f=a.headers.get("ETag");if(f){const e=this.userSession.store.getSessionData();e.etags[t]=f,this.userSession.store.setSessionData(e)}return i||null===u||u.startsWith("text")||u.startsWith("application/json")?a.text():a.arrayBuffer()}async getFileSignedUnencrypted(t,e){const r=`${t}.sig`;try{const[n,i,o]=await Promise.all([this.getFileContents(t,e.app,e.username,e.zoneFileLookupURL,!1),this.getFileContents(r,e.app,e.username,e.zoneFileLookupURL,!0),this.getGaiaAddress(e.app,e.username,e.zoneFileLookupURL)]);if(!n)return n;if(!o)throw new Oe(`Failed to get gaia address for verification of: ${t}`);if(!i||"string"!=typeof i)throw new Oe(`Failed to obtain signature for file: ${t} -- looked in ${t}.sig`);let s,a;try{const t=JSON.parse(i);s=t.signature,a=t.publicKey}catch(e){throw e instanceof SyntaxError?new Error(`Failed to parse signature content JSON (path: ${t}.sig) The content may be corrupted.`):e}const u=$e(a);if(o!==u)throw new Oe(`Signer pubkey address (${u}) doesn't match gaia address (${o})`);if(Ve(n,a,s))return n;throw new Oe(`Contents do not match ECDSA signature: path: ${t}, signature: ${t}.sig`)}catch(e){throw e instanceof xe&&e.message.indexOf(r)>=0?new Oe(`Failed to obtain signature for file: ${t} -- looked in ${t}.sig`):e}}async handleSignedEncryptedContents(t,e,r,n,i,o){const s=Ke(n||this.userSession.loadUserData().appPrivateKey);let a,u;if(a=i?await this.getGaiaAddress(r,i,o):$e(s),!a)throw new Oe(`Failed to get gaia address for verification of: ${t}`);try{u=JSON.parse(e)}catch(t){throw t instanceof SyntaxError?new Error("Failed to parse encrypted, signed content JSON. The content may not be encrypted. If using getFile, try passing { verify: false, decrypt: false }."):t}const f=u.signature,h=u.publicKey,c=u.cipherText,l=$e(h);if(h&&c&&f){if(l!==a)throw new Oe(`Signer pubkey address (${l}) doesn't match gaia address (${a})`);if(Ve(c,h,f)){if("string"==typeof n){const t={privateKey:n};return this.userSession.decryptContent(c,t)}return this.userSession.decryptContent(c)}throw new Oe(`Contents do not match ECDSA signature in file: ${t}`)}throw new Oe(`Failed to get signature verification data from file: ${t}`)}async putFile(t,e,r){var n,i;const o=Object.assign({},{encrypt:!0,sign:!1,cipherTextEncoding:"hex",dangerouslyIgnoreEtag:!1},r),s=await this.getOrSetLocalGaiaHubConnection(),a=c(s.max_file_upload_size_megabytes),u=a>0,f=new Xe(e,o.contentType);let l,d=f.contentType;if(!o.encrypt&&u&&f.contentByteLength>a){const t=`The max file upload size for this hub is ${a} bytes, the given content is ${f.contentByteLength} bytes`,e=new Re(t,null,a);throw console.error(e),e}if(o.encrypt&&u){const t=function(t){const{payloadShell:e,payloadValuesLength:r}=function(t){const e={iv:"",ephemeralPK:"",mac:"",cipherText:"",wasString:!!t.wasString};return"base64"===t.cipherTextEncoding&&(e.cipherTextEncoding="base64"),{payloadValuesLength:162,payloadShell:JSON.stringify(e)}}(t),n=(i=t.contentLength,16*(Math.floor(i/16)+1));var i;let o;if(t.cipherTextEncoding&&"hex"!==t.cipherTextEncoding){if("base64"!==t.cipherTextEncoding)throw new Error(`Unexpected cipherTextEncoding "${t.cipherTextEncoding}"`);o=function(t){return 4*Math.ceil(t/3)}(n)}else o=2*n;if(t.sign){const{signedPayloadShell:t,signedPayloadValuesLength:n}=function(t){const e={signature:"",publicKey:"",cipherText:t};return{signedPayloadValuesLength:210,signedPayloadShell:JSON.stringify(e)}}(e);return t.length+n+r+o}return e.length+r+o}({contentLength:f.contentByteLength,wasString:f.wasString,sign:!!o.sign,cipherTextEncoding:o.cipherTextEncoding});if(t>a){const e=new Re(`The max file upload size for this hub is ${a} bytes, the given content is ${t} bytes after encryption`,null,a);throw console.error(e),e}}let p=!0;const y=this.userSession.store.getSessionData();let m;if(o.dangerouslyIgnoreEtag||(null==(n=y.etags)?void 0:n[t])&&(p=!1,l=null==(i=y.etags)?void 0:i[t]),!o.encrypt&&o.sign){const e=await f.load();let r;r="string"==typeof o.sign?o.sign:this.userSession.loadUserData().appPrivateKey;const n=function(t,e){const r=e instanceof h?e:h.from(e),n=Ke(t),i=gt(qe(r),t);return{signature:wt.bytesToHex(i),publicKey:n}}(r,e),i=JSON.stringify(n);m=async r=>{const n=(await Promise.all([Ye(t,e,r,d,p,l,o.dangerouslyIgnoreEtag),Ye(`${t}.sig`,i,r,"application/json")]))[0];return!o.dangerouslyIgnoreEtag&&n.etag&&(y.etags[t]=n.etag,this.userSession.store.setSessionData(y)),n.publicURL}}else{let e;if(o.encrypt||o.sign){let t;t="string"==typeof o.encrypt?o.encrypt:"string"==typeof o.sign?Ke(o.sign):Ke(this.userSession.loadUserData().appPrivateKey);const r=await f.load();e=await this.userSession.encryptContent(r,{publicKey:t,wasString:f.wasString,cipherTextEncoding:o.cipherTextEncoding,sign:o.sign}),d="application/json"}else e=f.content;m=async r=>{const n=await Ye(t,e,r,d,p,l,o.dangerouslyIgnoreEtag);return n.etag&&(y.etags[t]=n.etag,this.userSession.store.setSessionData(y)),n.publicURL}}try{return await m(s)}catch(t){if(function(t){if(!t||!t.hubError||!t.hubError.statusCode)return!1;const e=t.hubError.statusCode;return 401===e||(409===e||e>=500&&e<=599)}(t)){console.error(t),console.error("Possible recoverable error during Gaia upload, retrying...");const e=await this.setLocalGaiaHubConnection();return await m(e)}throw t}}async deleteFile(t,e){const r=await this.getOrSetLocalGaiaHubConnection();if(Object.assign({},e).wasSigned)try{await Qe(t,r),await Qe(`${t}.sig`,r);const e=this.userSession.store.getSessionData();delete e.etags[t],this.userSession.store.setSessionData(e)}catch(e){const n=await this.setLocalGaiaHubConnection();await Qe(t,n),await Qe(`${t}.sig`,r);const i=this.userSession.store.getSessionData();delete i.etags[t],this.userSession.store.setSessionData(i)}else try{await Qe(t,r);const e=this.userSession.store.getSessionData();delete e.etags[t],this.userSession.store.setSessionData(e)}catch(e){const r=await this.setLocalGaiaHubConnection();await Qe(t,r);const n=this.userSession.store.getSessionData();delete n.etags[t],this.userSession.store.setSessionData(n)}}getAppBucketUrl(t,e){return nr(t,e)}async listFilesLoop(t,e,r,n,i){if(r>65536)throw new Error("Too many entries to list");let o;t=t||await this.getOrSetLocalGaiaHubConnection();try{const r=JSON.stringify({page:e}),n={method:"POST",headers:{"Content-Type":"application/json","Content-Length":`${r.length}`,Authorization:`bearer ${t.token}`},body:r};if(o=await pe(`${t.server}/list-files/${t.address}`,n),!o.ok)throw await ir(o,"ListFiles failed.",t)}catch(t){if(0===r){const t=await this.setLocalGaiaHubConnection();return this.listFilesLoop(t,e,r+1,0,i)}throw t}const s=await o.text(),a=JSON.parse(s),u=a.entries,f=a.page;if(null==u)throw new Error("Bad listFiles response: no entries");let h=0;for(let t=0;t<u.length;t++)if(null!==u[t]&&(h++,!i(u[t])))return n+t;return f&&u.length>0?this.listFilesLoop(t,f,r+1,n+h,i):n+h}listFiles(t){return this.listFilesLoop(null,null,0,0,t)}async getOrSetLocalGaiaHubConnection(){const t=this.userSession.store.getSessionData().userData;if(!t)throw new Ie("Missing userData");const e=t.gaiaHubConfig;return e?Promise.resolve(e):this.setLocalGaiaHubConnection()}async setLocalGaiaHubConnection(){const t=this.userSession.loadUserData();if(!t)throw new Ie("Missing userData");t.hubUrl||(t.hubUrl="https://hub.blockstack.org");const e=await rr(t.hubUrl,t.appPrivateKey,t.gaiaAssociationToken);t.gaiaHubConfig=e;const r=this.userSession.store.getSessionData();return r.userData.gaiaHubConfig=e,this.userSession.store.setSessionData(r),e}}function sr(t){return new or({}).getUserAppFileUrl(t.path,t.username,t.appOrigin,t.zoneFileLookupURL)}function ar(t,e){var r;const n=Object.assign({},e);if(n.username){if(!n.app){if(!t.appConfig)throw new Ie("Missing AppConfig");n.app=t.appConfig.appDomain}if(!n.zoneFileLookupURL){if(!t.appConfig)throw new Ie("Missing AppConfig");if(!t.store)throw new Ie("Missing store UserSession");const e=(null==(r=t.store.getSessionData().userData)?void 0:r.coreNode)||t.appConfig.coreNode;e&&(n.zoneFileLookupURL=`${e}/v1/names`)}}return n}})(),n})()));
3
3
  //# sourceMappingURL=index.js.map